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

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

Issue 2250133004: No hang when inserting a list over uneditable element in contenteditable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove extra blanks in the test case Created 4 years, 4 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/LayoutTests/editing/selection/insert-list-over-uneditable-in-contenteditable.html ('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/core/editing/EditingUtilities.cpp
diff --git a/third_party/WebKit/Source/core/editing/EditingUtilities.cpp b/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
index 0b872ea695c070058c0f0ec7f83d36fc39d4159a..e6ae084a701f5fe8e2bf77af8ecd364357fc0b4b 100644
--- a/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
+++ b/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
@@ -559,12 +559,20 @@ PositionTemplate<Strategy> firstEditablePositionAfterPositionInRootAlgorithm(con
editablePosition = PositionTemplate<Strategy>::afterNode(shadowAncestor);
}
- while (editablePosition.anchorNode() && !isEditablePosition(editablePosition) && editablePosition.anchorNode()->isDescendantOf(&highestRoot))
+ Node* nonEditableNode = nullptr;
+ while (editablePosition.anchorNode() && !isEditablePosition(editablePosition) && editablePosition.anchorNode()->isDescendantOf(&highestRoot)) {
+ nonEditableNode = editablePosition.anchorNode();
editablePosition = isAtomicNode(editablePosition.anchorNode()) ? PositionTemplate<Strategy>::inParentAfterNode(*editablePosition.anchorNode()) : nextVisuallyDistinctCandidate(editablePosition);
+ }
if (editablePosition.anchorNode() && editablePosition.anchorNode() != &highestRoot && !editablePosition.anchorNode()->isDescendantOf(&highestRoot))
return PositionTemplate<Strategy>();
+ // If |editablePosition| has the non-editable child skipped, get the next sibling position.
+ // If not, we can't get the next paragraph in InsertListCommand::doApply's while loop.
+ // See http://crbug.com/571420
+ if (nonEditableNode && nonEditableNode->isDescendantOf(editablePosition.anchorNode()))
+ editablePosition = nextVisuallyDistinctCandidate(editablePosition);
return editablePosition;
}
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/selection/insert-list-over-uneditable-in-contenteditable.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698