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

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

Issue 960843003: Add a version of SVGLengthContext::valueForLength with explicit dimension (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase; Change argument order. 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 4f229d37b1ff000f0601d32346b4a59b73e4cd05..13c8784f7473ca59b853d36378192259f97b00fa 100644
--- a/Source/core/svg/SVGLengthContext.cpp
+++ b/Source/core/svg/SVGLengthContext.cpp
@@ -98,20 +98,21 @@ float SVGLengthContext::resolveLength(const SVGElement* context, SVGUnitTypes::S
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);
// The viewport will be unaffected by zoom.
- dimension = dimensionForLengthMode(mode, viewportSize) * zoom;
+ dimension = dimensionForLengthMode(mode, viewportSize);
}
- return floatValueForLength(length, dimension) / zoom;
+ return valueForLength(length, style, dimension);
+}
+
+float SVGLengthContext::valueForLength(const Length& length, const LayoutStyle& style, float dimension)
+{
+ const float zoom = style.effectiveZoom();
+ ASSERT(zoom != 0);
+ return floatValueForLength(length, dimension * zoom) / 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