Chromium Code Reviews| 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..ab168e85f0ff0d83240821d4875aa47c319c1137 100644 |
| --- a/third_party/WebKit/Source/core/editing/Editor.cpp |
| +++ b/third_party/WebKit/Source/core/editing/Editor.cpp |
| @@ -284,22 +284,14 @@ bool Editor::canDelete() const |
| bool Editor::canDeleteRange(const EphemeralRange& range) const |
|
yosin_UTC9
2016/09/20 07:58:39
Since |canDeleteRange()| is called only from |shou
Xiaocheng
2016/09/20 08:12:35
TODO added.
|
| { |
| + DCHECK(!range.isCollapsed()); |
|
yosin_UTC9
2016/09/20 07:58:39
nit: Could you add |<< *range| for |DCHECK()|?
Xiaocheng
2016/09/20 08:12:34
Done.
|
| + |
| 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 |