Fix spellchecker updating of marker ranges spanning multiple elements.

The optimization made in Blink r187820 (https://crrev.com/828293002)
completely failed to take into account the case where the start and
end position spanned multiple nodes.

With EphemeralRange since then introduced, fix by switching to it.
For the original test optimized for (blink_perf.dom:textarea-edit),
local testing with chrome-release shows no degradation in performance
either.

R=yosin
BUG=579151

Review URL: https://codereview.chromium.org/1615963004

Cr-Commit-Position: refs/heads/master@{#370929}
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations
index 2608d7c..dcdf977 100644
--- a/third_party/WebKit/LayoutTests/TestExpectations
+++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -1536,3 +1536,6 @@
 crbug.com/579365 [ Mac ] fast/replaced/border-radius-clip.html [ NeedsRebaseline ]
 
 crbug.com/573206 http/tests/workers/shared-worker-secure-context.https.html [ Skip ]
+
+crbug.com/579151 editing/deleting/delete-to-select-table.html [ NeedsRebaseline ]
+crbug.com/579151 editing/inserting/insert-div-018.html [ NeedsRebaseline ]
diff --git a/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp b/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
index 5d02a29e..7419642 100644
--- a/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
+++ b/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
@@ -710,10 +710,8 @@
     // of marker that contains the word in question, and remove marker on that whole range.
     Document* document = frame().document();
     ASSERT(document);
-    Node* startNode = startOfFirstWord.deepEquivalent().computeContainerNode();
-    int startOffset = startOfFirstWord.deepEquivalent().computeOffsetInContainerNode();
-    int endOffset = endOfLastWord.deepEquivalent().computeOffsetInContainerNode();
-    document->markers().removeMarkers(startNode, startOffset, endOffset - startOffset, DocumentMarker::MisspellingMarkers(), DocumentMarkerController::RemovePartiallyOverlappingMarker);
+    const EphemeralRange wordRange(startOfFirstWord.deepEquivalent(), endOfLastWord.deepEquivalent());
+    document->markers().removeMarkers(wordRange, DocumentMarker::MisspellingMarkers(), DocumentMarkerController::RemovePartiallyOverlappingMarker);
 }
 
 void SpellChecker::didEndEditingOnTextField(Element* e)