Remove SVGTextMetrics::m_glyph
This field was previously used for ligature and kerning lookups for SVG
fonts. Since SVGTextMetrics::glyph() is no longer called we can remove the
field and collapse some related code.
BUG=242735
Review URL: https://codereview.chromium.org/665253003
git-svn-id: svn://svn.chromium.org/blink/trunk@184376 bbb929c8-8fbe-4397-9dbb-9b2b20218538
diff --git a/Source/core/rendering/svg/SVGTextLayoutEngineSpacing.h b/Source/core/rendering/svg/SVGTextLayoutEngineSpacing.h
index cccb7cb..6db20d8 100644
--- a/Source/core/rendering/svg/SVGTextLayoutEngineSpacing.h
+++ b/Source/core/rendering/svg/SVGTextLayoutEngineSpacing.h
@@ -21,6 +21,8 @@
#define SVGTextLayoutEngineSpacing_h
#include "core/rendering/svg/SVGTextMetrics.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/unicode/Unicode.h"
namespace blink {
diff --git a/Source/core/rendering/svg/SVGTextMetrics.cpp b/Source/core/rendering/svg/SVGTextMetrics.cpp
index 21638f3..a376aed 100644
--- a/Source/core/rendering/svg/SVGTextMetrics.cpp
+++ b/Source/core/rendering/svg/SVGTextMetrics.cpp
@@ -29,7 +29,6 @@
: m_width(0)
, m_height(0)
, m_length(0)
- , m_glyph(0)
{
}
@@ -37,7 +36,6 @@
: m_width(0)
, m_height(0)
, m_length(1)
- , m_glyph(0)
{
}
@@ -49,14 +47,13 @@
ASSERT(scalingFactor);
const Font& scaledFont = textRenderer->scaledFont();
- int length = 0;
// Calculate width/height using the scaled font, divide this result by the scalingFactor afterwards.
- m_width = scaledFont.width(run, length, m_glyph) / scalingFactor;
+ m_width = scaledFont.width(run) / scalingFactor;
m_height = scaledFont.fontMetrics().floatHeight() / scalingFactor;
- ASSERT(length >= 0);
- m_length = static_cast<unsigned>(length);
+ ASSERT(run.length() >= 0);
+ m_length = static_cast<unsigned>(run.length());
}
TextRun SVGTextMetrics::constructTextRun(RenderSVGInlineText* text, unsigned position, unsigned length)
@@ -106,7 +103,7 @@
return SVGTextMetrics(text, constructTextRun(text, position, length));
}
-SVGTextMetrics::SVGTextMetrics(RenderSVGInlineText* text, unsigned position, unsigned length, float width, Glyph glyphNameGlyphId)
+SVGTextMetrics::SVGTextMetrics(RenderSVGInlineText* text, unsigned position, unsigned length, float width)
{
ASSERT(text);
@@ -115,7 +112,6 @@
m_width = width / scalingFactor;
m_height = text->scaledFont().fontMetrics().floatHeight() / scalingFactor;
- m_glyph = 0;
m_length = length;
}
diff --git a/Source/core/rendering/svg/SVGTextMetrics.h b/Source/core/rendering/svg/SVGTextMetrics.h
index b895614..774b971 100644
--- a/Source/core/rendering/svg/SVGTextMetrics.h
+++ b/Source/core/rendering/svg/SVGTextMetrics.h
@@ -20,9 +20,7 @@
#ifndef SVGTextMetrics_h
#define SVGTextMetrics_h
-#include "platform/fonts/Glyph.h"
#include "platform/text/TextDirection.h"
-#include "wtf/text/WTFString.h"
namespace blink {
@@ -37,7 +35,7 @@
SVGTextMetrics();
SVGTextMetrics(MetricsType);
- SVGTextMetrics(RenderSVGInlineText*, unsigned position, unsigned length, float width, Glyph glyphNameGlyphId);
+ SVGTextMetrics(RenderSVGInlineText*, unsigned position, unsigned length, float width);
// FIXME: Migrate away from these to the two below.
static SVGTextMetrics measureCharacterRange(RenderSVGInlineText*, unsigned position, unsigned length);
@@ -54,16 +52,12 @@
float height() const { return m_height; }
unsigned length() const { return m_length; }
- // Only useful when measuring individual characters, to lookup ligatures.
- Glyph glyph() const { return m_glyph; }
-
private:
SVGTextMetrics(RenderSVGInlineText*, const TextRun&);
float m_width;
float m_height;
unsigned m_length;
- Glyph m_glyph;
};
} // namespace blink
diff --git a/Source/core/rendering/svg/SVGTextMetricsBuilder.cpp b/Source/core/rendering/svg/SVGTextMetricsBuilder.cpp
index 5f3cbf0..03970db 100644
--- a/Source/core/rendering/svg/SVGTextMetricsBuilder.cpp
+++ b/Source/core/rendering/svg/SVGTextMetricsBuilder.cpp
@@ -124,8 +124,7 @@
float currentWidth = m_simpleShaper->runWidthSoFar() - m_totalWidth;
m_totalWidth = m_simpleShaper->runWidthSoFar();
- Glyph glyphId = glyphBuffer.glyphAt(0);
- return SVGTextMetrics(m_text, textPosition, metricsLength, currentWidth, glyphId);
+ return SVGTextMetrics(m_text, textPosition, metricsLength, currentWidth);
}
SVGTextMetrics SVGTextMetricsCalculator::computeMetricsForCharacterComplex(unsigned textPosition)
diff --git a/Source/platform/fonts/Font.cpp b/Source/platform/fonts/Font.cpp
index e98a2c7..bc22d60 100644
--- a/Source/platform/fonts/Font.cpp
+++ b/Source/platform/fonts/Font.cpp
@@ -259,13 +259,6 @@
return result;
}
-float Font::width(const TextRun& run, int& charsConsumed, Glyph& glyphId) const
-{
- charsConsumed = run.length();
- glyphId = 0;
- return width(run);
-}
-
namespace {
template <bool hasOffsets>
diff --git a/Source/platform/fonts/Font.h b/Source/platform/fonts/Font.h
index 4f10d75..33c1612 100644
--- a/Source/platform/fonts/Font.h
+++ b/Source/platform/fonts/Font.h
@@ -106,7 +106,6 @@
void drawEmphasisMarks(GraphicsContext*, const TextRunPaintInfo&, const AtomicString& mark, const FloatPoint&) const;
float width(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
- float width(const TextRun&, int& charsConsumed, Glyph& glyphId) const;
int offsetForPosition(const TextRun&, float position, bool includePartialGlyphs) const;
FloatRect selectionRectForText(const TextRun&, const FloatPoint&, int h, int from = 0, int to = -1, bool accountForGlyphBounds = false) const;