Chromium Code Reviews| Index: third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp |
| diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp |
| index e977cdbe0a6ac5ba2d6c2999b0254ba12da9e056..3c71c5cec51552d48d7981de268ee3da979f1d16 100644 |
| --- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp |
| +++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp |
| @@ -45,18 +45,6 @@ |
| namespace blink { |
| -MarkerRemoverPredicate::MarkerRemoverPredicate(const Vector<String>& words) |
| - : words_(words) {} |
| - |
| -bool MarkerRemoverPredicate::operator()(const DocumentMarker& document_marker, |
| - const Text& text_node) const { |
| - unsigned start = document_marker.StartOffset(); |
| - unsigned length = document_marker.EndOffset() - document_marker.StartOffset(); |
| - |
| - String marker_text = text_node.data().Substring(start, length); |
| - return words_.Contains(marker_text); |
| -} |
| - |
| namespace { |
| DocumentMarker::MarkerTypeIndex MarkerTypeToMarkerIndex( |
| @@ -508,8 +496,8 @@ void DocumentMarkerController::RemoveMarkers( |
| RemoveMarkersFromList(iterator, marker_types); |
| } |
| -void DocumentMarkerController::RemoveMarkers( |
| - const MarkerRemoverPredicate& should_remove_marker) { |
| +void DocumentMarkerController::RemoveSpellingMarkersUnderWords( |
| + const Vector<String>& words) { |
| for (auto& node_markers : markers_) { |
| const Node& node = *node_markers.key; |
| if (!node.IsTextNode()) // MarkerRemoverPredicate requires a Text node. |
| @@ -523,8 +511,13 @@ void DocumentMarkerController::RemoveMarkers( |
| continue; |
| bool removed_markers = false; |
| for (size_t j = list->size(); j > 0; --j) { |
| - if (should_remove_marker(*list->at(j - 1), |
| - static_cast<const Text&>(node))) { |
| + const DocumentMarker& marker = *list->at(j - 1); |
| + |
| + const unsigned start = marker.StartOffset(); |
| + const unsigned length = marker.EndOffset() - marker.StartOffset(); |
| + |
| + const String marker_text = ToText(node).data().Substring(start, length); |
|
rlanday
2017/04/22 10:03:23
oops, missed making this a reference here, I'm mov
|
| + if (words.Contains(marker_text)) { |
| list->erase(j - 1); |
| removed_markers = true; |
| } |