Chromium Code Reviews

Unified Diff: Source/core/testing/Internals.cpp

Issue 1237093003: Robustify window.internals.textSurroundingNode(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « LayoutTests/editing/surrounding-text/surrounding-text-detached-no-crash-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/testing/Internals.cpp
diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp
index 60a01a4e2f0013f89047e12ae3a2f6c53e14426c..97c67e97f9681154bdc4bcdccef101d4a03609bd 100644
--- a/Source/core/testing/Internals.cpp
+++ b/Source/core/testing/Internals.cpp
@@ -2314,7 +2314,7 @@ void Internals::setValueForUser(Element* element, const String& value)
String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long maxLength)
{
- if (!node)
+ if (!node || !node->layoutObject())
return String();
blink::WebPoint point(x, y);
SurroundingText surroundingText(VisiblePosition(node->layoutObject()->positionForPoint(static_cast<IntPoint>(point))).deepEquivalent().parentAnchoredEquivalent(), maxLength);
« no previous file with comments | « LayoutTests/editing/surrounding-text/surrounding-text-detached-no-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine