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 dc2881b92fbe6d4cfae34626bc7e712bcfb6ae0e..05ec51f48af1c4841876a8a531643599d5f04c40 100644 |
| --- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp |
| +++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp |
| @@ -323,6 +323,23 @@ void DocumentMarkerController::RemoveMarkersInternal( |
| } |
| } |
| +Optional<DocumentMarker*> DocumentMarkerController::MarkerAtPosition( |
| + const Position& position, |
| + DocumentMarker::MarkerTypes marker_types) { |
| + if (!PossiblyHasMarkers(marker_types)) |
| + return Optional<DocumentMarker*>(); |
| + Node* node = position.ComputeContainerNode(); |
|
yosin_UTC9
2017/05/11 04:36:02
nit: s/Node*/Node* const/
|
| + unsigned offset = |
|
yosin_UTC9
2017/05/11 04:36:02
nit: s/unsigned/const unsigned/
|
| + static_cast<unsigned>(position.ComputeOffsetInContainerNode()); |
| + |
| + for (DocumentMarker* marker : MarkersFor(node, marker_types)) { |
| + if (marker->StartOffset() < offset && marker->EndOffset() > offset) |
| + return marker; |
| + } |
| + |
| + return Optional<DocumentMarker*>(); |
| +} |
| + |
| DocumentMarkerVector DocumentMarkerController::MarkersFor( |
| Node* node, |
| DocumentMarker::MarkerTypes marker_types) { |
| @@ -367,37 +384,6 @@ DocumentMarkerVector DocumentMarkerController::Markers() { |
| return result; |
| } |
| -DocumentMarkerVector DocumentMarkerController::MarkersInRange( |
| - const EphemeralRange& range, |
| - DocumentMarker::MarkerTypes marker_types) { |
| - if (!PossiblyHasMarkers(marker_types)) |
| - return DocumentMarkerVector(); |
| - |
| - DocumentMarkerVector found_markers; |
| - |
| - Node* start_container = range.StartPosition().ComputeContainerNode(); |
| - DCHECK(start_container); |
| - unsigned start_offset = static_cast<unsigned>( |
| - range.StartPosition().ComputeOffsetInContainerNode()); |
| - Node* end_container = range.EndPosition().ComputeContainerNode(); |
| - DCHECK(end_container); |
| - unsigned end_offset = |
| - static_cast<unsigned>(range.EndPosition().ComputeOffsetInContainerNode()); |
| - |
| - for (Node& node : range.Nodes()) { |
| - for (DocumentMarker* marker : MarkersFor(&node)) { |
| - if (!marker_types.Contains(marker->GetType())) |
| - continue; |
| - if (node == start_container && marker->EndOffset() <= start_offset) |
| - continue; |
| - if (node == end_container && marker->StartOffset() >= end_offset) |
| - continue; |
| - found_markers.push_back(marker); |
| - } |
| - } |
| - return found_markers; |
| -} |
| - |
| Vector<IntRect> DocumentMarkerController::RenderedRectsForMarkers( |
| DocumentMarker::MarkerType marker_type) { |
| Vector<IntRect> result; |