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 574047ff6c5dec3dafcc83117d8c37ed5919827a..eb4b6f3c3f839f616a27e5fc3664a55fe1748483 100644 |
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGBlock.cpp |
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGBlock.cpp |
@@ -21,12 +21,14 @@ |
#include "core/layout/svg/LayoutSVGBlock.h" |
+#include "core/layout/LayoutGeometryMap.h" |
#include "core/layout/LayoutView.h" |
#include "core/layout/svg/LayoutSVGRoot.h" |
#include "core/layout/svg/SVGLayoutSupport.h" |
#include "core/layout/svg/SVGResourcesCache.h" |
#include "core/style/ShadowList.h" |
#include "core/svg/SVGElement.h" |
+#include "platform/geometry/TransformState.h" |
namespace blink { |
@@ -92,6 +94,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); |
} |
@@ -100,12 +105,19 @@ void LayoutSVGBlock::mapAncestorToLocal(const LayoutBoxModelObject* ancestor, |
MapCoordinatesFlags flags) const { |
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()); |
} |
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); |
} |
@@ -118,6 +130,9 @@ bool LayoutSVGBlock::mapToVisualRectInAncestorSpace( |
const LayoutBoxModelObject* ancestor, |
LayoutRect& rect, |
VisualRectFlags) const { |
+ // Convert from local HTML coordinates to local SVG coordinates. |
+ rect.moveBy(location()); |
+ // Apply other mappings on local SVG coordinates. |
return SVGLayoutSupport::mapToVisualRectInAncestorSpace( |
*this, ancestor, FloatRect(rect), rect); |
} |