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

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

Issue 2711503002: Compute a more correct "screen scope" transform for SVGSVGElement (Closed)
Patch Set: Tweak test Created 3 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 | « third_party/WebKit/Source/core/svg/SVGSVGElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 79dcc61cc0e289a71c46106bd7cefbed214a7be9..5cdb55aa470102e089166c9dd519594f4026d229 100644
--- a/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp
@@ -450,57 +450,18 @@ SVGTransformTearOff* SVGSVGElement::createSVGTransformFromMatrix(
return SVGTransformTearOff::create(matrix);
}
-AffineTransform SVGSVGElement::localCoordinateSpaceTransform(
- SVGElement::CTMScope mode) const {
- AffineTransform viewBoxTransform;
- if (!hasEmptyViewBox()) {
- FloatSize size = currentViewportSize();
- viewBoxTransform = viewBoxToViewTransform(size.width(), size.height());
- }
-
+AffineTransform SVGSVGElement::localCoordinateSpaceTransform() const {
AffineTransform transform;
if (!isOutermostSVGSVGElement()) {
SVGLengthContext lengthContext(this);
transform.translate(m_x->currentValue()->value(lengthContext),
m_y->currentValue()->value(lengthContext));
- } else if (mode == SVGElement::ScreenScope) {
- if (LayoutObject* layoutObject = this->layoutObject()) {
- FloatPoint location;
- float zoomFactor = 1;
-
- // At the SVG/HTML boundary (aka LayoutSVGRoot), we apply the
- // localToBorderBoxTransform to map an element from SVG viewport
- // coordinates to CSS box coordinates. LayoutSVGRoot's localToAbsolute
- // method expects CSS box coordinates. We also need to adjust for the
- // zoom level factored into CSS coordinates (bug #96361).
- if (layoutObject->isSVGRoot()) {
- location = toLayoutSVGRoot(layoutObject)
- ->localToBorderBoxTransform()
- .mapPoint(location);
- zoomFactor = 1 / layoutObject->style()->effectiveZoom();
- }
-
- // Translate in our CSS parent coordinate space
- // FIXME: This doesn't work correctly with CSS transforms.
- location = layoutObject->localToAbsolute(location, UseTransforms);
- location.scale(zoomFactor, zoomFactor);
-
- // Be careful here! localToBorderBoxTransform() included the x/y offset
- // coming from the viewBoxToViewTransform(), so we have to subtract it
- // here (original cause of bug #27183)
- transform.translate(location.x() - viewBoxTransform.e(),
- location.y() - viewBoxTransform.f());
-
- // Respect scroll offset.
- if (FrameView* view = document().view()) {
- LayoutSize scrollOffset(view->getScrollOffset());
- scrollOffset.scale(zoomFactor);
- transform.translate(-scrollOffset.width(), -scrollOffset.height());
- }
- }
}
-
- return transform.multiply(viewBoxTransform);
+ if (!hasEmptyViewBox()) {
+ FloatSize size = currentViewportSize();
+ transform.multiply(viewBoxToViewTransform(size.width(), size.height()));
+ }
+ return transform;
}
bool SVGSVGElement::layoutObjectIsNeeded(const ComputedStyle& style) {
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGSVGElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698