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

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

Issue 983103003: Use Length for the stroke-width property in SVGLayoutStyle (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: lengthSetterForProperty Created 5 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 | « Source/core/svg/SVGLengthContext.h ('k') | Source/core/svg/graphics/filters/SVGFEImage.cpp » ('j') | 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 3e2eb6f6393e3557a01b4cf57469743e5dde6d54..f1b5ffceebe4232d09b09d7adb8a71706b85bf90 100644
--- a/Source/core/svg/SVGLengthContext.cpp
+++ b/Source/core/svg/SVGLengthContext.cpp
@@ -96,8 +96,18 @@ float SVGLengthContext::resolveLength(const SVGElement* context, SVGUnitTypes::S
return x.valueAsPercentage();
}
+float SVGLengthContext::valueForLength(const UnzoomedLength& unzoomedLength, SVGLengthMode mode) const
+{
+ return valueForLength(unzoomedLength.length(), 1, mode);
+}
+
float SVGLengthContext::valueForLength(const Length& length, const LayoutStyle& style, SVGLengthMode mode) const
{
+ return valueForLength(length, style.effectiveZoom(), mode);
+}
+
+float SVGLengthContext::valueForLength(const Length& length, float zoom, SVGLengthMode mode) const
+{
float dimension = 0;
if (length.isPercent()) {
FloatSize viewportSize;
@@ -105,12 +115,16 @@ float SVGLengthContext::valueForLength(const Length& length, const LayoutStyle&
// The viewport will be unaffected by zoom.
dimension = dimensionForLengthMode(mode, viewportSize);
}
- return valueForLength(length, style, dimension);
+ return valueForLength(length, zoom, dimension);
}
float SVGLengthContext::valueForLength(const Length& length, const LayoutStyle& style, float dimension)
{
- const float zoom = style.effectiveZoom();
+ return valueForLength(length, style.effectiveZoom(), dimension);
+}
+
+float SVGLengthContext::valueForLength(const Length& length, float zoom, float dimension)
+{
ASSERT(zoom != 0);
return floatValueForLength(length, dimension * zoom) / zoom;
}
« no previous file with comments | « Source/core/svg/SVGLengthContext.h ('k') | Source/core/svg/graphics/filters/SVGFEImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698