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

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

Issue 2960473002: [MarkersIntersectingRange #2.1] Add DocumentMarkerController::FirstMarkerIntersectingOffsetRange() (Closed)
Patch Set: Rebase Created 3 years, 5 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
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 761cea8414dce75c79056d74110aa1d42f2e80fb..ab1dfbf7ff92fbaf4ebe1720e1615827ac9de419 100644
--- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
@@ -398,6 +398,32 @@ DocumentMarker* DocumentMarkerController::MarkerAtPosition(
return nullptr;
}
+DocumentMarker* DocumentMarkerController::FirstMarkerIntersectingOffsetRange(
+ const Text& node,
+ unsigned start_offset,
+ unsigned end_offset,
+ DocumentMarker::MarkerTypes types) {
+ if (!PossiblyHasMarkers(types))
+ return nullptr;
+
+ MarkerLists* const markers = markers_.at(&node);
+ if (!markers)
+ return nullptr;
+
+ for (DocumentMarker::MarkerType type : types) {
+ const DocumentMarkerList* const list = ListForType(markers, type);
+ if (!list)
+ continue;
+
+ DocumentMarker* found_marker =
+ list->FirstMarkerIntersectingRange(start_offset, end_offset);
+ if (found_marker)
+ return found_marker;
+ }
+
+ return nullptr;
+}
+
DocumentMarkerVector DocumentMarkerController::MarkersFor(
Node* node,
DocumentMarker::MarkerTypes marker_types) {

Powered by Google App Engine
This is Rietveld 408576698