| Index: third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
|
| diff --git a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
|
| index 76d4b0beec8e11c5bccccaa769bebd331ab89ab3..913e58bd61bc3f4f743cd7e7184037b7a1e71d2d 100644
|
| --- a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
|
| +++ b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
|
| @@ -596,6 +596,10 @@ bool WebFrameWidgetImpl::SelectionBounds(WebRect& anchor,
|
| if (!local_frame)
|
| return false;
|
|
|
| + FrameSelection& selection = local_frame->Selection();
|
| + if (!selection.IsAvailable() || selection.GetSelectionInDOMTree().IsNone())
|
| + return false;
|
| +
|
| // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets
|
| // needs to be audited. See http://crbug.com/590369 for more details.
|
| local_frame->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets();
|
| @@ -603,7 +607,6 @@ bool WebFrameWidgetImpl::SelectionBounds(WebRect& anchor,
|
| DocumentLifecycle::DisallowTransitionScope disallow_transition(
|
| local_frame->GetDocument()->Lifecycle());
|
|
|
| - FrameSelection& selection = local_frame->Selection();
|
| if (selection.ComputeVisibleSelectionInDOMTree().IsNone())
|
| return false;
|
|
|
| @@ -642,11 +645,14 @@ bool WebFrameWidgetImpl::SelectionTextDirection(WebTextDirection& start,
|
| if (!frame)
|
| return false;
|
|
|
| + FrameSelection& selection = frame->Selection();
|
| + if (!selection.IsAvailable())
|
| + return false;
|
| +
|
| // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets
|
| // needs to be audited. See http://crbug.com/590369 for more details.
|
| frame->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets();
|
|
|
| - FrameSelection& selection = frame->Selection();
|
| if (selection.ComputeVisibleSelectionInDOMTree()
|
| .ToNormalizedEphemeralRange()
|
| .IsNull())
|
| @@ -662,9 +668,9 @@ bool WebFrameWidgetImpl::SelectionTextDirection(WebTextDirection& start,
|
| // code needs to be refactored (http://crbug.com/629721).
|
| bool WebFrameWidgetImpl::IsSelectionAnchorFirst() const {
|
| if (const LocalFrame* frame = FocusedLocalFrameInWidget()) {
|
| - return frame->Selection()
|
| - .ComputeVisibleSelectionInDOMTreeDeprecated()
|
| - .IsBaseFirst();
|
| + FrameSelection& selection = frame->Selection();
|
| + return selection.IsAvailable() &&
|
| + selection.ComputeVisibleSelectionInDOMTreeDeprecated().IsBaseFirst();
|
| }
|
| return false;
|
| }
|
|
|