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

Unified Diff: Source/core/svg/SVGLengthContext.cpp

Issue 947983002: Move zoom handling for x and y properties to svg (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: move function 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
« no previous file with comments | « Source/core/svg/SVGLengthContext.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGLengthContext.cpp
diff --git a/Source/core/svg/SVGLengthContext.cpp b/Source/core/svg/SVGLengthContext.cpp
index e3651cc0eb5285e95117e7b81e09edb7bc6f1f7a..d3c537291c19a43229131a3c3e7700ba6bac1d93 100644
--- a/Source/core/svg/SVGLengthContext.cpp
+++ b/Source/core/svg/SVGLengthContext.cpp
@@ -96,15 +96,22 @@ float SVGLengthContext::resolveLength(const SVGElement* context, SVGUnitTypes::S
return x.valueAsPercentage();
}
-float SVGLengthContext::valueForLength(const Length& length, SVGLengthMode mode) const
+float SVGLengthContext::valueForLength(const Length& length, const LayoutStyle& style, SVGLengthMode mode) const
{
+ return valueForLengthWithZoom(length, style.effectiveZoom(), mode);
+}
+
+float SVGLengthContext::valueForLengthWithZoom(const Length& length, float zoom, SVGLengthMode mode) const
+{
+ ASSERT(zoom != 0);
float dimension = 0;
if (length.isPercent()) {
FloatSize viewportSize;
determineViewport(viewportSize);
- dimension = dimensionForLengthMode(mode, viewportSize);
+ // The viewport will be unaffected by zoom.
+ dimension = dimensionForLengthMode(mode, viewportSize) * zoom;
}
- return floatValueForLength(length, dimension);
+ return floatValueForLength(length, dimension) / zoom;
}
float SVGLengthContext::convertValueToUserUnits(float value, SVGLengthMode mode, SVGLengthType fromUnit) const
« no previous file with comments | « Source/core/svg/SVGLengthContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698