Commit 7ec6d7d9 authored by fs@opera.com's avatar fs@opera.com

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
parent e5324c52
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#define SVGTextLayoutEngineSpacing_h #define SVGTextLayoutEngineSpacing_h
#include "core/rendering/svg/SVGTextMetrics.h" #include "core/rendering/svg/SVGTextMetrics.h"
#include "wtf/Noncopyable.h"
#include "wtf/unicode/Unicode.h"
namespace blink { namespace blink {
......
...@@ -29,7 +29,6 @@ SVGTextMetrics::SVGTextMetrics() ...@@ -29,7 +29,6 @@ SVGTextMetrics::SVGTextMetrics()
: m_width(0) : m_width(0)
, m_height(0) , m_height(0)
, m_length(0) , m_length(0)
, m_glyph(0)
{ {
} }
...@@ -37,7 +36,6 @@ SVGTextMetrics::SVGTextMetrics(SVGTextMetrics::MetricsType) ...@@ -37,7 +36,6 @@ SVGTextMetrics::SVGTextMetrics(SVGTextMetrics::MetricsType)
: m_width(0) : m_width(0)
, m_height(0) , m_height(0)
, m_length(1) , m_length(1)
, m_glyph(0)
{ {
} }
...@@ -49,14 +47,13 @@ SVGTextMetrics::SVGTextMetrics(RenderSVGInlineText* textRenderer, const TextRun& ...@@ -49,14 +47,13 @@ SVGTextMetrics::SVGTextMetrics(RenderSVGInlineText* textRenderer, const TextRun&
ASSERT(scalingFactor); ASSERT(scalingFactor);
const Font& scaledFont = textRenderer->scaledFont(); const Font& scaledFont = textRenderer->scaledFont();
int length = 0;
// Calculate width/height using the scaled font, divide this result by the scalingFactor afterwards. // 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; m_height = scaledFont.fontMetrics().floatHeight() / scalingFactor;
ASSERT(length >= 0); ASSERT(run.length() >= 0);
m_length = static_cast<unsigned>(length); m_length = static_cast<unsigned>(run.length());
} }
TextRun SVGTextMetrics::constructTextRun(RenderSVGInlineText* text, unsigned position, unsigned length) TextRun SVGTextMetrics::constructTextRun(RenderSVGInlineText* text, unsigned position, unsigned length)
...@@ -106,7 +103,7 @@ SVGTextMetrics SVGTextMetrics::measureCharacterRange(RenderSVGInlineText* text, ...@@ -106,7 +103,7 @@ SVGTextMetrics SVGTextMetrics::measureCharacterRange(RenderSVGInlineText* text,
return SVGTextMetrics(text, constructTextRun(text, position, length)); 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); ASSERT(text);
...@@ -115,7 +112,6 @@ SVGTextMetrics::SVGTextMetrics(RenderSVGInlineText* text, unsigned position, uns ...@@ -115,7 +112,6 @@ SVGTextMetrics::SVGTextMetrics(RenderSVGInlineText* text, unsigned position, uns
m_width = width / scalingFactor; m_width = width / scalingFactor;
m_height = text->scaledFont().fontMetrics().floatHeight() / scalingFactor; m_height = text->scaledFont().fontMetrics().floatHeight() / scalingFactor;
m_glyph = 0;
m_length = length; m_length = length;
} }
......
...@@ -20,9 +20,7 @@ ...@@ -20,9 +20,7 @@
#ifndef SVGTextMetrics_h #ifndef SVGTextMetrics_h
#define SVGTextMetrics_h #define SVGTextMetrics_h
#include "platform/fonts/Glyph.h"
#include "platform/text/TextDirection.h" #include "platform/text/TextDirection.h"
#include "wtf/text/WTFString.h"
namespace blink { namespace blink {
...@@ -37,7 +35,7 @@ public: ...@@ -37,7 +35,7 @@ public:
SVGTextMetrics(); SVGTextMetrics();
SVGTextMetrics(MetricsType); 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. // FIXME: Migrate away from these to the two below.
static SVGTextMetrics measureCharacterRange(RenderSVGInlineText*, unsigned position, unsigned length); static SVGTextMetrics measureCharacterRange(RenderSVGInlineText*, unsigned position, unsigned length);
...@@ -54,16 +52,12 @@ public: ...@@ -54,16 +52,12 @@ public:
float height() const { return m_height; } float height() const { return m_height; }
unsigned length() const { return m_length; } unsigned length() const { return m_length; }
// Only useful when measuring individual characters, to lookup ligatures.
Glyph glyph() const { return m_glyph; }
private: private:
SVGTextMetrics(RenderSVGInlineText*, const TextRun&); SVGTextMetrics(RenderSVGInlineText*, const TextRun&);
float m_width; float m_width;
float m_height; float m_height;
unsigned m_length; unsigned m_length;
Glyph m_glyph;
}; };
} // namespace blink } // namespace blink
......
...@@ -124,8 +124,7 @@ SVGTextMetrics SVGTextMetricsCalculator::computeMetricsForCharacterSimple(unsign ...@@ -124,8 +124,7 @@ SVGTextMetrics SVGTextMetricsCalculator::computeMetricsForCharacterSimple(unsign
float currentWidth = m_simpleShaper->runWidthSoFar() - m_totalWidth; float currentWidth = m_simpleShaper->runWidthSoFar() - m_totalWidth;
m_totalWidth = m_simpleShaper->runWidthSoFar(); m_totalWidth = m_simpleShaper->runWidthSoFar();
Glyph glyphId = glyphBuffer.glyphAt(0); return SVGTextMetrics(m_text, textPosition, metricsLength, currentWidth);
return SVGTextMetrics(m_text, textPosition, metricsLength, currentWidth, glyphId);
} }
SVGTextMetrics SVGTextMetricsCalculator::computeMetricsForCharacterComplex(unsigned textPosition) SVGTextMetrics SVGTextMetricsCalculator::computeMetricsForCharacterComplex(unsigned textPosition)
......
...@@ -259,13 +259,6 @@ float Font::width(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFo ...@@ -259,13 +259,6 @@ float Font::width(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFo
return result; return result;
} }
float Font::width(const TextRun& run, int& charsConsumed, Glyph& glyphId) const
{
charsConsumed = run.length();
glyphId = 0;
return width(run);
}
namespace { namespace {
template <bool hasOffsets> template <bool hasOffsets>
......
...@@ -106,7 +106,6 @@ public: ...@@ -106,7 +106,6 @@ public:
void drawEmphasisMarks(GraphicsContext*, const TextRunPaintInfo&, const AtomicString& mark, const FloatPoint&) const; 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&, 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; 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; FloatRect selectionRectForText(const TextRun&, const FloatPoint&, int h, int from = 0, int to = -1, bool accountForGlyphBounds = false) const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment