| Index: third_party/WebKit/Source/core/editing/Editor.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp
|
| index 953b683cc0b668b60db066f6bcafa80938b9961c..da461c3d567635c84749f2fbd001275764291806 100644
|
| --- a/third_party/WebKit/Source/core/editing/Editor.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/Editor.cpp
|
| @@ -282,24 +282,17 @@ bool Editor::canDelete() const
|
| return selection.isRange() && selection.rootEditableElement();
|
| }
|
|
|
| +// TODO(xiaochengh): Merge it with |shouldDeleteRange|.
|
| bool Editor::canDeleteRange(const EphemeralRange& range) const
|
| {
|
| + DCHECK(!range.isCollapsed()) << range.startPosition();
|
| +
|
| Node* startContainer = range.startPosition().computeContainerNode();
|
| Node* endContainer = range.endPosition().computeContainerNode();
|
| if (!startContainer || !endContainer)
|
| return false;
|
|
|
| - if (!hasEditableStyle(*startContainer) || !hasEditableStyle(*endContainer))
|
| - return false;
|
| -
|
| - if (range.isCollapsed()) {
|
| - VisiblePosition start = createVisiblePositionDeprecated(range.startPosition());
|
| - VisiblePosition previous = previousPositionOf(start);
|
| - // FIXME: We sometimes allow deletions at the start of editable roots, like when the caret is in an empty list item.
|
| - if (previous.isNull() || rootEditableElement(*previous.deepEquivalent().anchorNode()) != rootEditableElement(*startContainer))
|
| - return false;
|
| - }
|
| - return true;
|
| + return hasEditableStyle(*startContainer) && hasEditableStyle(*endContainer);
|
| }
|
|
|
| bool Editor::smartInsertDeleteEnabled() const
|
|
|