Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(643)

Unified Diff: third_party/WebKit/Source/core/layout/svg/SVGTextMetricsBuilder.cpp

Issue 1825613005: More explicit SVGTextMetrics construction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@svg-metrics-cleanup-2
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/SVGTextMetrics.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/svg/SVGTextMetricsBuilder.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGTextMetricsBuilder.cpp b/third_party/WebKit/Source/core/layout/svg/SVGTextMetricsBuilder.cpp
index d28023ce38f1c422647ed2659b3d9058e92217a9..7285046b695b500d3b1653eaf90a1f624b9214ce 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGTextMetricsBuilder.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGTextMetricsBuilder.cpp
@@ -75,6 +75,8 @@ private:
unsigned m_currentPosition;
LineLayoutSVGInlineText m_text;
+ float m_fontScalingFactor;
+ float m_cachedFontHeight;
TextRun m_run;
BidiCharacterRun* m_bidiRun;
@@ -115,6 +117,8 @@ TextRun SVGTextMetricsCalculator::constructTextRun(LineLayoutSVGInlineText textL
SVGTextMetricsCalculator::SVGTextMetricsCalculator(LayoutSVGInlineText* text)
: m_currentPosition(0)
, m_text(LineLayoutSVGInlineText(text))
+ , m_fontScalingFactor(m_text.scalingFactor())
+ , m_cachedFontHeight(m_text.scaledFont().getFontMetrics().floatHeight() / m_fontScalingFactor)
, m_run(constructTextRun(m_text, 0, m_text.textLength(), m_text.styleRef().direction()))
, m_bidiRun(nullptr)
{
@@ -207,7 +211,7 @@ SVGTextMetrics SVGTextMetricsCalculator::currentCharacterMetrics()
unsigned currentSubrunPosition = updateSubrunRangesForCurrentPosition();
unsigned length = currentCharacterStartsSurrogatePair() ? 2 : 1;
float width = m_subrunRanges[currentSubrunPosition].width();
- return SVGTextMetrics(m_text, length, width);
+ return SVGTextMetrics(length, width / m_fontScalingFactor, m_cachedFontHeight);
}
struct TreeWalkTextState {
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/SVGTextMetrics.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698