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

Unified Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGBlock.cpp

Issue 2778873002: Reland "Let SVGForeignObject's local SVG coordinates mean what it should" (Closed)
Patch Set: Fix Created 3 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/layout/svg/LayoutSVGBlock.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGBlock.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGBlock.cpp
index 452d7234e434a72b169f17fbdad3f42e98af7acc..6b93388b791d60205060d5c0cee5f84a78b921cb 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGBlock.cpp
@@ -99,6 +99,9 @@ void LayoutSVGBlock::styleDidChange(StyleDifference diff,
void LayoutSVGBlock::mapLocalToAncestor(const LayoutBoxModelObject* ancestor,
TransformState& transformState,
MapCoordinatesFlags flags) const {
+ // Convert from local HTML coordinates to local SVG coordinates.
+ transformState.move(locationOffset());
+ // Apply other mappings on local SVG coordinates.
SVGLayoutSupport::mapLocalToAncestor(this, ancestor, transformState, flags);
}
@@ -108,12 +111,18 @@ void LayoutSVGBlock::mapAncestorToLocal(const LayoutBoxModelObject* ancestor,
if (this == ancestor)
return;
+ // Map to local SVG coordinates.
SVGLayoutSupport::mapAncestorToLocal(*this, ancestor, transformState, flags);
+ // Convert from local SVG coordinates to local HTML coordinates.
+ transformState.move(locationOffset());
Xianzhu 2017/03/28 17:45:09 This is the fix. In the original patch, this was "
}
const LayoutObject* LayoutSVGBlock::pushMappingToContainer(
const LayoutBoxModelObject* ancestorToStopAt,
LayoutGeometryMap& geometryMap) const {
+ // Convert from local HTML coordinates to local SVG coordinates.
+ geometryMap.push(this, locationOffset());
+ // Apply other mappings on local SVG coordinates.
return SVGLayoutSupport::pushMappingToContainer(this, ancestorToStopAt,
geometryMap);
}
@@ -128,6 +137,9 @@ bool LayoutSVGBlock::mapToVisualRectInAncestorSpaceInternal(
VisualRectFlags) const {
transformState.flatten();
LayoutRect rect(transformState.lastPlanarQuad().boundingBox());
+ // Convert from local HTML coordinates to local SVG coordinates.
+ rect.moveBy(location());
+ // Apply other mappings on local SVG coordinates.
bool retval = SVGLayoutSupport::mapToVisualRectInAncestorSpace(
*this, ancestor, FloatRect(rect), rect);
transformState.setQuad(FloatQuad(FloatRect(rect)));

Powered by Google App Engine
This is Rietveld 408576698