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

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

Issue 2097383002: Added support of calc() for SVGLength (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 5 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: third_party/WebKit/Source/core/svg/SVGLengthContext.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGLengthContext.cpp b/third_party/WebKit/Source/core/svg/SVGLengthContext.cpp
index 621a277ce9125389e12206cad2ec8e0b535c5d92..f86e33bc17e0d63e9fd713da848aa019e29c42bb 100644
--- a/third_party/WebKit/Source/core/svg/SVGLengthContext.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGLengthContext.cpp
@@ -24,6 +24,7 @@
#include "core/css/CSSHelper.h"
#include "core/css/CSSPrimitiveValue.h"
+#include "core/css/CSSToLengthConversionData.h"
#include "core/dom/NodeComputedStyle.h"
#include "core/frame/FrameView.h"
#include "core/layout/LayoutObject.h"
@@ -417,4 +418,18 @@ bool SVGLengthContext::determineViewport(FloatSize& viewportSize) const
return true;
}
+float SVGLengthContext::resolveValue(const CSSPrimitiveValue& primitiveValue, SVGLengthMode mode) const
+{
+ const ComputedStyle* style = computedStyleForLengthResolving(m_context);
+ if (!style)
+ return 0;
+
+ const ComputedStyle* rootStyle = rootElementStyle(m_context);
+ if (!rootStyle)
+ return 0;
+
+ CSSToLengthConversionData conversionData = CSSToLengthConversionData(style, rootStyle, m_context->document().layoutViewItem(), 1.0f);
+ Length length = primitiveValue.convertToLength(conversionData);
+ return valueForLength(length, 1.0f, mode);
+}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGLengthContext.h ('k') | third_party/WebKit/Source/core/svg/SVGLengthList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698