Index: third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp |
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp |
index fbe5909f7a0917a37e843ac9a56c9a385ae59861..9ea95ce6888052706e09a451725193f8e7203e5d 100644 |
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp |
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp |
@@ -28,6 +28,7 @@ |
#include "core/layout/LayoutAnalyzer.h" |
#include "core/layout/LayoutPart.h" |
#include "core/layout/LayoutView.h" |
+#include "core/layout/svg/LayoutSVGText.h" |
#include "core/layout/svg/SVGLayoutSupport.h" |
#include "core/layout/svg/SVGResourcesCache.h" |
#include "core/paint/PaintLayer.h" |
@@ -281,6 +282,33 @@ void LayoutSVGRoot::willBeRemovedFromTree() |
LayoutReplaced::willBeRemovedFromTree(); |
} |
+PositionWithAffinity LayoutSVGRoot::positionForPoint(const LayoutPoint& point) |
+{ |
+ FloatPoint absolutePoint = FloatPoint(point); |
+ AffineTransform transform; |
+ absolutePoint = m_localToBorderBoxTransform.inverse().mapPoint(absolutePoint); |
+ LayoutObject* closestDescendant = SVGLayoutSupport::findSelectedLayoutSVGText(this, transform, absolutePoint); |
+ |
+ if (!closestDescendant) |
+ return LayoutReplaced::positionForPoint(point); |
+ |
+ AffineTransform closestDescendantTransform; |
+ if (toLayoutSVGText(closestDescendant)->location().x()) |
+ closestDescendantTransform.setE(toLayoutSVGText(closestDescendant)->location().x()); |
+ if (toLayoutSVGText(closestDescendant)->location().y()) |
+ closestDescendantTransform.setF(toLayoutSVGText(closestDescendant)->location().y()); |
+ |
+ transform = transform * closestDescendantTransform; |
+ |
+ absolutePoint = transform.inverse().mapPoint(absolutePoint); |
+ if (absolutePoint.x() < 0) |
+ absolutePoint.setX(0); |
+ if (absolutePoint.y() < 0) |
+ absolutePoint.setY(0); |
+ |
+ return closestDescendant->positionForPoint(LayoutPoint(absolutePoint.x(), absolutePoint.y())); |
+} |
+ |
// LayoutBox methods will expect coordinates w/o any transforms in coordinates |
// relative to our borderBox origin. This method gives us exactly that. |
void LayoutSVGRoot::buildLocalToBorderBoxTransform() |