| Index: third_party/WebKit/Source/web/WebSurroundingText.cpp
|
| diff --git a/third_party/WebKit/Source/web/WebSurroundingText.cpp b/third_party/WebKit/Source/web/WebSurroundingText.cpp
|
| index 0ecd970dd407a7f6bb2cd220843beee4e755199f..bfdd99f5ca4ba4bd5983e6e0f8a931bddab12f9f 100644
|
| --- a/third_party/WebKit/Source/web/WebSurroundingText.cpp
|
| +++ b/third_party/WebKit/Source/web/WebSurroundingText.cpp
|
| @@ -49,10 +49,17 @@ WebSurroundingText::~WebSurroundingText()
|
| void WebSurroundingText::initialize(const WebNode& webNode, const WebPoint& nodePoint, size_t maxLength)
|
| {
|
| const Node* node = webNode.constUnwrap<Node>();
|
| - if (!node || !node->layoutObject())
|
| + if (!node)
|
| return;
|
|
|
| - m_private.reset(new SurroundingText(createVisiblePositionDeprecated(node->layoutObject()->positionForPoint(static_cast<IntPoint>(nodePoint))).deepEquivalent().parentAnchoredEquivalent(), maxLength));
|
| + // VisiblePosition and SurroundingText must be created with clean layout.
|
| + node->document().updateStyleAndLayoutIgnorePendingStylesheets();
|
| + DocumentLifecycle::DisallowTransitionScope disallowTransition(node->document().lifecycle());
|
| +
|
| + if (!node->layoutObject())
|
| + return;
|
| +
|
| + m_private.reset(new SurroundingText(createVisiblePosition(node->layoutObject()->positionForPoint(static_cast<IntPoint>(nodePoint))).deepEquivalent().parentAnchoredEquivalent(), maxLength));
|
| }
|
|
|
| void WebSurroundingText::initializeFromCurrentSelection(WebLocalFrame* frame, size_t maxLength)
|
|
|