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

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

Issue 2857173003: Remove DocumentMarkerController::MarkersInRange() (Closed)
Patch Set: Respond to comments 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..8e9582ba466184b2b312d4ed513d17eb0bad8ffa 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 =
Xiaocheng 2017/05/11 18:25:20 Please change type of |marker| to |const DocumentM
+ 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,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