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

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

Issue 956553004: Use Length for baselineShiftValue in SVGLayoutStyle (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Drop SVGLengthContext changes for now. Created 5 years, 10 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.cpp
diff --git a/Source/core/layout/svg/SVGTextLayoutEngineBaseline.cpp b/Source/core/layout/svg/SVGTextLayoutEngineBaseline.cpp
index 113fc8d4e1d6c94dbcc62d021afe5763d32bc3e8..ca02d789046eb03be10d0d3d628e3c3ebc152a3a 100644
--- a/Source/core/layout/svg/SVGTextLayoutEngineBaseline.cpp
+++ b/Source/core/layout/svg/SVGTextLayoutEngineBaseline.cpp
@@ -24,7 +24,7 @@
#include "core/layout/LayoutObject.h"
#include "core/layout/style/SVGLayoutStyle.h"
#include "core/layout/svg/SVGTextMetrics.h"
-#include "core/svg/SVGLengthContext.h"
+#include "platform/LengthFunctions.h"
#include "platform/fonts/Font.h"
#include "platform/text/UnicodeRange.h"
@@ -35,18 +35,15 @@ SVGTextLayoutEngineBaseline::SVGTextLayoutEngineBaseline(const Font& font)
{
}
-float SVGTextLayoutEngineBaseline::calculateBaselineShift(const SVGLayoutStyle& style, SVGElement* contextElement) const
+float SVGTextLayoutEngineBaseline::calculateBaselineShift(const LayoutStyle& style) const
{
- if (style.baselineShift() == BS_LENGTH) {
- RefPtrWillBeRawPtr<SVGLength> baselineShiftValueLength = style.baselineShiftValue();
- if (baselineShiftValueLength->unitType() == LengthTypePercentage)
- return baselineShiftValueLength->scaleByPercentage(m_font.fontDescription().computedPixelSize());
-
- SVGLengthContext lengthContext(contextElement);
- return baselineShiftValueLength->value(lengthContext);
+ const SVGLayoutStyle& svgStyle = style.svgStyle();
+ if (svgStyle.baselineShift() == BS_LENGTH) {
+ const float zoom = style.effectiveZoom();
+ return floatValueForLength(svgStyle.baselineShiftValue(), m_font.fontDescription().computedPixelSize() * zoom) / zoom;
}
- switch (style.baselineShift()) {
+ switch (svgStyle.baselineShift()) {
case BS_BASELINE:
return 0;
case BS_SUB:

Powered by Google App Engine
This is Rietveld 408576698