| Index: third_party/WebKit/Source/core/testing/Internals.cpp
|
| diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp
|
| index 61c8f550ac6d89bd2682672d8d1daff92ca4c000..25d0726171c3258c7b12bd409f09274d1bb20d52 100644
|
| --- a/third_party/WebKit/Source/core/testing/Internals.cpp
|
| +++ b/third_party/WebKit/Source/core/testing/Internals.cpp
|
| @@ -2431,10 +2431,17 @@ void Internals::setValueForUser(Element* element, const String& value)
|
|
|
| String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long maxLength)
|
| {
|
| - if (!node || !node->layoutObject())
|
| + if (!node)
|
| + return String();
|
| +
|
| + // VisiblePosition and SurroundingText must be created with clean layout.
|
| + node->document().updateStyleAndLayoutIgnorePendingStylesheets();
|
| + DocumentLifecycle::DisallowTransitionScope disallowTransition(node->document().lifecycle());
|
| +
|
| + if (!node->layoutObject())
|
| return String();
|
| blink::WebPoint point(x, y);
|
| - SurroundingText surroundingText(createVisiblePositionDeprecated(node->layoutObject()->positionForPoint(static_cast<IntPoint>(point))).deepEquivalent().parentAnchoredEquivalent(), maxLength);
|
| + SurroundingText surroundingText(createVisiblePosition(node->layoutObject()->positionForPoint(static_cast<IntPoint>(point))).deepEquivalent().parentAnchoredEquivalent(), maxLength);
|
| return surroundingText.content();
|
| }
|
|
|
|
|