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

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

Issue 2001083002: Explicit management of FrameSelection availability (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-06-08T18:08:39 Created 4 years, 6 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 | « third_party/WebKit/Source/core/page/DragController.cpp ('k') | 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/WebViewImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp
index fad565d27c6eaef57d89c1087056567fb40a7363..8371a6b88bb4d0b1fa797aeed1fe282af5a6dcfc 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -2424,6 +2424,10 @@ WebTextInputInfo WebViewImpl::textInputInfo()
return info;
FrameSelection& selection = focused->selection();
+ if (!selection.isAvailable()) {
+ // plugins/mouse-capture-inside-shadow.html reaches here.
+ return info;
+ }
Element* element = selection.selection().rootEditableElement();
if (!element)
return info;
@@ -2472,9 +2476,14 @@ WebTextInputType WebViewImpl::textInputType()
if (!focusedFrame)
return WebTextInputTypeNone;
+ if (!focusedFrame->selection().isAvailable()) {
+ // "mouse-capture-inside-shadow.html" reaches here.
+ return WebTextInputTypeNone;
+ }
+
// It's important to preserve the equivalence of textInputInfo().type and textInputType(),
// so perform the same rootEditableElement() existence check here for consistency.
- if (!focusedFrame || !focusedFrame->selection().selection().rootEditableElement())
+ if (!focusedFrame->selection().selection().rootEditableElement())
return WebTextInputTypeNone;
Document* document = focusedFrame->document();
@@ -2623,6 +2632,10 @@ bool WebViewImpl::selectionBounds(WebRect& anchor, WebRect& focus) const
if (!localFrame)
return false;
FrameSelection& selection = localFrame->selection();
+ if (!selection.isAvailable()) {
+ // plugins/mouse-capture-inside-shadow.html reaches here.
+ return false;
+ }
if (selection.isCaret()) {
anchor = focus = selection.absoluteCaretBounds();
@@ -2655,7 +2668,11 @@ bool WebViewImpl::selectionTextDirection(WebTextDirection& start, WebTextDirecti
const Frame* frame = focusedCoreFrame();
if (!frame || frame->isRemoteFrame())
return false;
- FrameSelection& selection = toLocalFrame(frame)->selection();
+ const FrameSelection& selection = toLocalFrame(frame)->selection();
+ if (!selection.isAvailable()) {
+ // plugins/mouse-capture-inside-shadow.html reaches here.
+ return false;
+ }
if (selection.selection().toNormalizedEphemeralRange().isNull())
return false;
start = toWebTextDirection(primaryDirectionOf(*selection.start().anchorNode()));
@@ -2668,7 +2685,12 @@ bool WebViewImpl::isSelectionAnchorFirst() const
const Frame* frame = focusedCoreFrame();
if (!frame || frame->isRemoteFrame())
return false;
- return toLocalFrame(frame)->selection().selection().isBaseFirst();
+ FrameSelection& selection = toLocalFrame(frame)->selection();
+ if (!selection.isAvailable()) {
+ // plugins/mouse-capture-inside-shadow.html reaches here.
+ return false;
+ }
+ return selection.selection().isBaseFirst();
}
WebColor WebViewImpl::backgroundColor() const
« no previous file with comments | « third_party/WebKit/Source/core/page/DragController.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698