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

Unified Diff: Source/core/layout/svg/SVGTextLayoutEngineBaseline.h

Issue 1081813003: Remove effective zoom from font metrics before SVG text layout. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added tests Created 5 years, 8 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
Index: Source/core/layout/svg/SVGTextLayoutEngineBaseline.h
diff --git a/Source/core/layout/svg/SVGTextLayoutEngineBaseline.h b/Source/core/layout/svg/SVGTextLayoutEngineBaseline.h
index 96e3325c05ba5e0d513eeb9a152439da2210809d..9c463cea79003a4ae347877916d12e747248b22d 100644
--- a/Source/core/layout/svg/SVGTextLayoutEngineBaseline.h
+++ b/Source/core/layout/svg/SVGTextLayoutEngineBaseline.h
@@ -36,7 +36,7 @@ class SVGTextMetrics;
class SVGTextLayoutEngineBaseline {
WTF_MAKE_NONCOPYABLE(SVGTextLayoutEngineBaseline);
public:
- SVGTextLayoutEngineBaseline(const Font&);
+ SVGTextLayoutEngineBaseline(const Font&, float effectiveZoom);
float calculateBaselineShift(const ComputedStyle&) const;
float calculateAlignmentBaselineShift(bool isVerticalText, const LayoutObject* textRenderer) const;
@@ -47,6 +47,14 @@ private:
EAlignmentBaseline dominantBaselineToAlignmentBaseline(bool isVerticalText, const LayoutObject* textRenderer) const;
const Font& m_font;
+
+ // Everything we read from the m_font's font descriptor during
+ // layout is scaled by the effective zoom, as fonts always are in
+ // computed style. Since layout inside SVG takes place in unzoomed
+ // coordinates, with zoom already in place on the graphical
+ // context, we compensate back when reading values from the font
+ // descriptor.
+ float m_effectiveZoom;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698