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

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

Issue 1827793003: Support currentScale for embedded SVG (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ignore pageZoomFactor modification Created 4 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
Index: third_party/WebKit/Source/core/svg/SVGSVGElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp b/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp
index 6e7ed43b997b1079d1b84a0118bdb129dc68c824..c3cc7465efaf94ba9a0c827f01f064f9eb8d38c9 100644
--- a/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp
@@ -69,6 +69,7 @@ inline SVGSVGElement::SVGSVGElement(Document& doc)
, m_useCurrentView(false)
, m_timeContainer(SMILTimeContainer::create(*this))
, m_translation(SVGPoint::create())
+ , m_currentScale(1.0)
fs 2016/03/31 10:53:04 Nit: Just 1 should do (and is what coding style pr
Shanmuga Pandi 2016/03/31 11:53:35 Done.
{
m_width->setDefaultValueAsString("100%");
m_height->setDefaultValueAsString("100%");
@@ -113,42 +114,14 @@ SVGViewSpec* SVGSVGElement::currentView()
return m_viewSpec.get();
}
-float SVGSVGElement::currentScale() const
-{
- if (!inDocument() || !isOutermostSVGSVGElement())
- return 1;
-
- LocalFrame* frame = document().frame();
- if (!frame)
- return 1;
-
- const FrameTree& frameTree = frame->tree();
-
- // The behaviour of currentScale() is undefined, when we're dealing with non-standalone SVG documents.
- // If the svg is embedded, the scaling is handled by the host layoutObject, so when asking from inside
- // the SVG document, a scale value of 1 seems reasonable, as it doesn't know anything about the parent scale.
- return frameTree.parent() ? 1 : frame->pageZoomFactor();
-}
-
void SVGSVGElement::setCurrentScale(float scale)
{
ASSERT(std::isfinite(scale));
if (!inDocument() || !isOutermostSVGSVGElement())
return;
- LocalFrame* frame = document().frame();
- if (!frame)
- return;
-
- const FrameTree& frameTree = frame->tree();
-
- // The behaviour of setCurrentScale() is undefined, when we're dealing with non-standalone SVG documents.
- // We choose the ignore this call, it's pretty useless to support calling setCurrentScale() from within
- // an embedded SVG document, for the same reasons as in currentScale() - needs resolution by SVG WG.
- if (frameTree.parent())
- return;
-
- frame->setPageZoomFactor(scale);
+ m_currentScale = scale;
+ updateCurrentTranslate();
fs 2016/03/31 10:53:04 I'd suggest you rename this to make this look slig
Shanmuga Pandi 2016/03/31 11:53:35 Done.
}
class SVGCurrentTranslateTearOff : public SVGPointTearOff {

Powered by Google App Engine
This is Rietveld 408576698