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

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

Issue 1646673003: Make InsertListCommand::unlififyParagraph() to do nothing when it applied to uneditable element (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-01-29T11:06:31 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/unlistify-uneditable-parent-crash.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..404efc734fdefed17b44bc82568e29c7a5edc04c 100644
--- a/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp
@@ -219,10 +219,24 @@ bool InsertListCommand::doApplyForSingleParagraph(bool forceCreateList, const HT
return false;
// Remove the list child.
RefPtrWillBeRawPtr<HTMLElement> listElement = enclosingList(listChildNode);
+ if (listElement) {
+ if (!listElement->hasEditableStyle()) {
+ // Since, |listElement| is uneditable, we can't move |listChild|
+ // out from |listElement|.
+ return false;
+ }
+ if (!listElement->parentNode()->hasEditableStyle()) {
+ // Since parent of |listElement| is uneditable, we can not remove
+ // |listElement| for switching list type neither unlistify.
+ return false;
+ }
+ }
if (!listElement) {
listElement = fixOrphanedListChild(listChildNode);
listElement = mergeWithNeighboringLists(listElement);
}
+ ASSERT(listElement->hasEditableStyle());
+ ASSERT(listElement->parentNode()->hasEditableStyle());
if (!listElement->hasTagName(listTag)) {
// |listChildNode| will be removed from the list and a list of type
// |m_type| will be created.
@@ -278,6 +292,9 @@ bool InsertListCommand::doApplyForSingleParagraph(bool forceCreateList, const HT
void InsertListCommand::unlistifyParagraph(const VisiblePosition& originalStart, HTMLElement* listElement, Node* listChildNode)
{
+ // Since, unlistify paragraph inserts nodes into parent and removes node
+ // from parent, if parent of |listElement| should be editable.
+ ASSERT(listElement->parentNode()->hasEditableStyle());
Node* nextListChild;
Node* previousListChild;
VisiblePosition start;
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/execCommand/unlistify-uneditable-parent-crash.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698