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

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

Issue 2853223002: getScreenCTM on <use> should not include the additional translation (Closed)
Patch Set: Created 3 years, 8 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/SVGGraphicsElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGGraphicsElement.cpp b/third_party/WebKit/Source/core/svg/SVGGraphicsElement.cpp
index f9b31b9b6246acc9ad0e1cba9acc077b6cd10c38..b6e36cdc2feffc6060d2ca9d30c7bd0867b4be70 100644
--- a/third_party/WebKit/Source/core/svg/SVGGraphicsElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGGraphicsElement.cpp
@@ -23,9 +23,7 @@
#include "core/SVGNames.h"
#include "core/dom/StyleChangeReason.h"
-#include "core/frame/FrameView.h"
#include "core/layout/LayoutObject.h"
-#include "core/layout/svg/LayoutSVGRoot.h"
#include "core/svg/SVGElementRareData.h"
#include "core/svg/SVGMatrixTearOff.h"
#include "core/svg/SVGRectTearOff.h"
@@ -73,7 +71,7 @@ AffineTransform SVGGraphicsElement::ComputeCTM(
break;
ctm = ToSVGElement(current_element)
- ->LocalCoordinateSpaceTransform()
+ ->LocalCoordinateSpaceTransform(mode)
.Multiply(ctm);
switch (mode) {
@@ -86,7 +84,7 @@ AffineTransform SVGGraphicsElement::ComputeCTM(
done = current_element == ancestor;
break;
default:
- NOTREACHED();
+ DCHECK_EQ(mode, kScreenScope);
break;
}
}
@@ -101,38 +99,7 @@ AffineTransform SVGGraphicsElement::GetCTM(
AffineTransform SVGGraphicsElement::GetScreenCTM(
StyleUpdateStrategy style_update_strategy) {
- if (style_update_strategy == kAllowStyleUpdate)
- GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
- TransformationMatrix transform;
- if (LayoutObject* layout_object = this->GetLayoutObject()) {
- // Adjust for the zoom level factored into CSS coordinates (WK bug #96361).
- transform.Scale(1.0 / layout_object->StyleRef().EffectiveZoom());
-
- // Origin in the document. (This, together with the inverse-scale above,
- // performs the same operation as
- // Document::adjustFloatRectForScrollAndAbsoluteZoom, but in transformation
- // matrix form.)
- if (FrameView* view = GetDocument().View()) {
- LayoutRect visible_content_rect(view->VisibleContentRect());
- transform.Translate(-visible_content_rect.X(), -visible_content_rect.Y());
- }
-
- // Apply transforms from our ancestor coordinate space, including any
- // non-SVG ancestor transforms.
- transform.Multiply(layout_object->LocalToAbsoluteTransform());
-
- // At the SVG/HTML boundary (aka LayoutSVGRoot), we need to apply the
- // localToBorderBoxTransform to map an element from SVG viewport
- // coordinates to CSS box coordinates.
- if (layout_object->IsSVGRoot()) {
- transform.Multiply(
- ToLayoutSVGRoot(layout_object)->LocalToBorderBoxTransform());
- }
- }
- // Drop any potential non-affine parts, because we're not able to convey that
- // information further anyway until getScreenCTM returns a DOMMatrix (4x4
- // matrix.)
- return transform.ToAffineTransform();
+ return ComputeCTM(kScreenScope, style_update_strategy);
}
SVGMatrixTearOff* SVGGraphicsElement::getCTMFromJavascript() {
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGGraphicsElement.h ('k') | third_party/WebKit/Source/core/svg/SVGPatternElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698