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

Unified Diff: third_party/WebKit/Source/core/editing/FrameSelection.cpp

Issue 2920583003: Stop crashing when VisibleSelections in DOM and Flat trees are inconsistent (Closed)
Patch Set: Mon Jun 5 11:40:52 PDT 2017 Created 3 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 | « no previous file | third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/FrameSelection.cpp
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.cpp b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
index 755cd849d23247806bb41382e98224910e27227b..26573bc13360bc2d72ede0a50cc48a658dfdc383 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
@@ -429,8 +429,10 @@ bool FrameSelection::SelectionHasFocus() const {
// TODO(editing-dev): Hoist UpdateStyleAndLayoutIgnorePendingStylesheets
// to caller. See http://crbug.com/590369 for more details.
GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
+ if (ComputeVisibleSelectionInFlatTree().IsNone())
+ return false;
const Node* current =
- ComputeVisibleSelectionInDOMTree().Start().ComputeContainerNode();
+ ComputeVisibleSelectionInFlatTree().Start().ComputeContainerNode();
if (!current)
return false;
@@ -444,12 +446,6 @@ bool FrameSelection::SelectionHasFocus() const {
if (focused_element->IsTextControl())
return focused_element->ContainsIncludingHostElements(*current);
- if (ComputeVisibleSelectionInFlatTree().IsNone()) {
- // TODO(editing-dev): We should avoid any case where VSInFlatTree is none
- // but VSInDOMTree is not none.
- DLOG(FATAL) << ComputeVisibleSelectionInDOMTree();
- }
-
// Selection has focus if it contains the focused element.
const PositionInFlatTree& focused_position =
PositionInFlatTree::FirstPositionInNode(focused_element);
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698