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

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

Issue 1541083002: Fix invalid selection produced when dragging mouse outside the SVG text element (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
Index: third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp
index 973ba5d3794a2901cd410db73dfbda1a5371133a..d76403ab6d57d2c6a4cc498e61f5039f9b537a3c 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp
@@ -452,14 +452,17 @@ PositionWithAffinity LayoutSVGText::positionForPoint(const LayoutPoint& pointInC
if (!rootBox)
return createPositionWithAffinity(0);
+ LayoutPoint clippedPointInContents(pointInContents);
+ clippedPointInContents.clampNegativeToZero();
+
ASSERT(!rootBox->nextRootBox());
ASSERT(childrenInline());
- InlineBox* closestBox = toSVGRootInlineBox(rootBox)->closestLeafChildForPosition(pointInContents);
+ InlineBox* closestBox = toSVGRootInlineBox(rootBox)->closestLeafChildForPosition(clippedPointInContents);
if (!closestBox)
return createPositionWithAffinity(0);
- return closestBox->lineLayoutItem().positionForPoint(LayoutPoint(pointInContents.x(), closestBox->y()));
+ return closestBox->lineLayoutItem().positionForPoint(LayoutPoint(clippedPointInContents.x(), closestBox->y()));
}
void LayoutSVGText::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const

Powered by Google App Engine
This is Rietveld 408576698