Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1622)

Unified Diff: third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp

Issue 2851633003: [DMC #5.5] Move SpellCheckMarkerListImpl::Add() implementation from DMLEditor.cpp (Closed)
Patch Set: Remove RemoveMarkersUnderWords() changes that are not supposed to be in this CL Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/markers/SpellCheckMarkerListImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp
diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp
index c97266f7a5aae4a3e36d2ed3032e28734846d0e6..60ac613c06ac89ac44a3b89305686db22ab3ea71 100644
--- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp
@@ -5,7 +5,6 @@
#include "core/editing/markers/DocumentMarkerListEditor.h"
#include "core/editing/markers/RenderedDocumentMarker.h"
-#include "core/editing/markers/SpellCheckMarkerListImpl.h"
namespace blink {
@@ -129,37 +128,4 @@ bool DocumentMarkerListEditor::ShiftMarkers(MarkerList* list,
return did_shift_marker;
}
-// TODO(rlanday): move to SpellCheckMarkerListImpl.cpp
-void SpellCheckMarkerListImpl::Add(DocumentMarker* marker) {
- RenderedDocumentMarker* rendered_marker =
- RenderedDocumentMarker::Create(*marker);
- if (markers_.IsEmpty() ||
- markers_.back()->EndOffset() < marker->StartOffset()) {
- markers_.push_back(rendered_marker);
- return;
- }
-
- auto first_overlapping = std::lower_bound(
- markers_.begin(), markers_.end(), rendered_marker,
- [](const Member<RenderedDocumentMarker>& marker_in_list,
- const DocumentMarker* marker_to_insert) {
- return marker_in_list->EndOffset() < marker_to_insert->StartOffset();
- });
-
- size_t index = first_overlapping - markers_.begin();
- markers_.insert(index, rendered_marker);
- const auto inserted = markers_.begin() + index;
- first_overlapping = inserted + 1;
- // TODO(rlanday): optimize this loop so it runs in O(N) time and not O(N^2)
- for (const auto i = first_overlapping;
- i != markers_.end() &&
- (*i)->StartOffset() <= (*inserted)->EndOffset();) {
- (*inserted)->SetStartOffset(
- std::min((*inserted)->StartOffset(), (*i)->StartOffset()));
- (*inserted)->SetEndOffset(
- std::max((*inserted)->EndOffset(), (*i)->EndOffset()));
- markers_.erase(i - markers_.begin());
- }
-}
-
} // namespace blink
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/markers/SpellCheckMarkerListImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698