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

Unified Diff: third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp

Issue 1570733002: [Editing][BugFix] Check editability in InserListCommand::listifyParagraph (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 4 years, 11 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/execCommand/insertunorderedlist-crash-in-domsubtreemodified-event.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/commands/InsertListCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp b/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp
index bfac9e0f9ea424c73d92e3bccdd2459a5c2833d5..1b46887f885e0e57749944304bc34741c70692e2 100644
--- a/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp
@@ -361,6 +361,17 @@ void InsertListCommand::listifyParagraph(const VisiblePosition& originalStart, c
if (start.isNull() || end.isNull())
return;
+ {
+ // The paragraph between |start| and |end| shoule be editable.
+ const Position& startPosition = start.toParentAnchoredPosition();
+ const Position& endPosition = end.toParentAnchoredPosition();
+ if (!isEditablePosition(startPosition) || !isEditablePosition(endPosition))
+ return;
+ Node* commonAncestor = NodeTraversal::commonAncestor(*startPosition.anchorNode(), *endPosition.anchorNode());
+ if (!commonAncestor || !commonAncestor->hasEditableStyle())
+ return;
+ }
+
// Check for adjoining lists.
HTMLElement* const previousList = adjacentEnclosingList(start, previousPositionOf(start, CannotCrossEditingBoundary), listTag);
HTMLElement* const nextList = adjacentEnclosingList(start, nextPositionOf(end, CannotCrossEditingBoundary), listTag);
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/execCommand/insertunorderedlist-crash-in-domsubtreemodified-event.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698