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 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) { |