Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Unified Diff: third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp

Issue 2920853005: Fix a crash related to detaching a frame embedding pepper plugin with selection (Closed)
Patch Set: nits Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698