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

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

Issue 2857173003: Remove DocumentMarkerController::MarkersInRange() (Closed)
Patch Set: Use std::find_if() 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 6d9cacb4d394447f8f2ed65ebd65b11090ee3df0..444584d6264a490b8b8483f2cafcc927abd3bc46 100644
--- a/third_party/WebKit/Source/core/editing/SelectionController.cpp
+++ b/third_party/WebKit/Source/core/editing/SelectionController.cpp
@@ -519,14 +519,14 @@ void SelectionController::SelectClosestMisspellingFromHitTestResult(
if (pos.IsNotNull()) {
const PositionInFlatTree& marker_position =
pos.DeepEquivalent().ParentAnchoredEquivalent();
- DocumentMarkerVector markers =
- inner_node->GetDocument().Markers().MarkersInRange(
- EphemeralRange(ToPositionInDOMTree(marker_position)),
+ const DocumentMarker* const marker =
+ inner_node->GetDocument().Markers().MarkerAtPosition(
+ ToPositionInDOMTree(marker_position),
DocumentMarker::MisspellingMarkers());
- if (markers.size() == 1) {
+ if (marker) {
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->StartOffset());
+ const PositionInFlatTree end(container_node, marker->EndOffset());
new_selection = CreateVisibleSelection(
SelectionInFlatTree::Builder().Collapse(start).Extend(end).Build());
}
@@ -1018,13 +1018,10 @@ static bool HitTestResultIsMisspelled(const HitTestResult& result) {
inner_node->GetLayoutObject()->PositionForPoint(result.LocalPoint()));
if (pos.IsNull())
return false;
- return inner_node->GetDocument()
- .Markers()
- .MarkersInRange(
- EphemeralRange(
- pos.DeepEquivalent().ParentAnchoredEquivalent()),
- DocumentMarker::MisspellingMarkers())
- .size() > 0;
+ const Position& marker_position =
+ pos.DeepEquivalent().ParentAnchoredEquivalent();
+ return inner_node->GetDocument().Markers().MarkerAtPosition(
+ marker_position, DocumentMarker::MisspellingMarkers());
}
void SelectionController::SendContextMenuEvent(

Powered by Google App Engine
This is Rietveld 408576698