| Index: third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
|
| index 73d90630a003e57147bb3418f14174757b5f4ddb..ac5a5a4dccd4e0640c9fd3b5d05842a16683770a 100644
|
| --- a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
|
| @@ -437,23 +437,24 @@ void DeleteSelectionCommand::deleteTextFromNode(Text* node, unsigned offset, uns
|
|
|
| void DeleteSelectionCommand::makeStylingElementsDirectChildrenOfEditableRootToPreventStyleLoss(EditingState* editingState)
|
| {
|
| - Range* range = createRange(m_selectionToDelete.toNormalizedEphemeralRange());
|
| - Node* node = range->firstNode();
|
| - while (node && node != range->pastLastNode()) {
|
| - Node* nextNode = NodeTraversal::next(*node);
|
| - if (isHTMLStyleElement(*node) || isHTMLLinkElement(*node)) {
|
| - nextNode = NodeTraversal::nextSkippingChildren(*node);
|
| - Element* element = rootEditableElement(*node);
|
| + auto iterableRange = inRange(m_selectionToDelete.toNormalizedEphemeralRange());
|
| + for (auto it = iterableRange.begin(), end = iterableRange.end(); !it.isNull() && it != end;) {
|
| + Node& node = *it;
|
| + if (isHTMLStyleElement(node) || isHTMLLinkElement(node)) {
|
| + Node* const nextNode = NodeTraversal::nextSkippingChildren(node);
|
| + Element* element = rootEditableElement(node);
|
| if (element) {
|
| - removeNode(node, editingState);
|
| + removeNode(&node, editingState);
|
| if (editingState->isAborted())
|
| return;
|
| - appendNode(node, element, editingState);
|
| + appendNode(&node, element, editingState);
|
| if (editingState->isAborted())
|
| return;
|
| }
|
| + it.setCurrent(nextNode);
|
| + } else {
|
| + ++it;
|
| }
|
| - node = nextNode;
|
| }
|
| }
|
|
|
|
|