Chromium Code Reviews| 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..e1ef4e41c9eed4eb65eeb4f416610bc5d76c8347 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(); |
| + |
| + // SurroundingText must be created in clean layout. |
|
tkent
2016/09/20 08:08:21
"SurrondingText and VisiblePosition must be..." is
Xiaocheng
2016/09/20 08:22:17
Done.
|
| + 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(); |
| } |