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

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

Issue 2960473002: [MarkersIntersectingRange #2.1] Add DocumentMarkerController::FirstMarkerIntersectingOffsetRange() (Closed)
Patch Set: Rename MarkerIntersectingCollapsedRange test to FirstMarkerIntersectingOffsetRange_collapsed 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..e10c626d66032ca0ad2fd13d96a3d8bcddb62286 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;
+
+ const DocumentMarkerVector& markers_from_this_list =
+ list->MarkersIntersectingRange(start_offset, end_offset);
yosin_UTC9 2017/07/20 01:07:01 We should have DocumentMarjerList::FirstMarkerInte
+ if (!markers_from_this_list.IsEmpty())
+ return markers_from_this_list.front();
+ }
+
+ return nullptr;
+}
+
DocumentMarkerVector DocumentMarkerController::MarkersFor(
Node* node,
DocumentMarker::MarkerTypes marker_types) {

Powered by Google App Engine
This is Rietveld 408576698