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

Unified Diff: third_party/WebKit/Source/core/editing/SelectionController.cpp

Issue 2857173003: Remove DocumentMarkerController::MarkersInRange() (Closed)
Patch Set: Fix WebFrameTest.cpp 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
Index: third_party/WebKit/Source/core/editing/SelectionController.cpp
diff --git a/third_party/WebKit/Source/core/editing/SelectionController.cpp b/third_party/WebKit/Source/core/editing/SelectionController.cpp
index ac77e75ae8a58515ef8d1d34c7b81d5f84a3035f..4ea78fdd0590a3ebaaf3f26627f848035d47f538 100644
--- a/third_party/WebKit/Source/core/editing/SelectionController.cpp
+++ b/third_party/WebKit/Source/core/editing/SelectionController.cpp
@@ -519,14 +519,15 @@ void SelectionController::SelectClosestMisspellingFromHitTestResult(
if (pos.IsNotNull()) {
const PositionInFlatTree& marker_position =
pos.DeepEquivalent().ParentAnchoredEquivalent();
- DocumentMarkerVector markers =
- inner_node->GetDocument().Markers().MarkersInRange(
- EphemeralRange(ToPositionInDOMTree(marker_position)),
+ Optional<DocumentMarker*> marker =
+ inner_node->GetDocument().Markers().MarkerAtPosition(
+ ToPositionInDOMTree(marker_position),
DocumentMarker::MisspellingMarkers());
- if (markers.size() == 1) {
+ if (marker.has_value()) {
Node* container_node = marker_position.ComputeContainerNode();
- const PositionInFlatTree start(container_node, markers[0]->StartOffset());
- const PositionInFlatTree end(container_node, markers[0]->EndOffset());
+ const PositionInFlatTree start(container_node,
+ marker.value()->StartOffset());
+ const PositionInFlatTree end(container_node, marker.value()->EndOffset());
new_selection = CreateVisibleSelection(
SelectionInFlatTree::Builder().Collapse(start).Extend(end).Build());
}
@@ -1018,13 +1019,12 @@ static bool HitTestResultIsMisspelled(const HitTestResult& result) {
inner_node->GetLayoutObject()->PositionForPoint(result.LocalPoint()));
if (pos.IsNull())
return false;
+ const Position& marker_position =
+ pos.DeepEquivalent().ParentAnchoredEquivalent();
return inner_node->GetDocument()
- .Markers()
- .MarkersInRange(
- EphemeralRange(
- pos.DeepEquivalent().ParentAnchoredEquivalent()),
- DocumentMarker::MisspellingMarkers())
- .size() > 0;
+ .Markers()
+ .MarkerAtPosition(marker_position, DocumentMarker::MisspellingMarkers())
+ .has_value();
}
void SelectionController::SendContextMenuEvent(

Powered by Google App Engine
This is Rietveld 408576698