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

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

Issue 2350773004: Move HitTestResult::isMisspelled to SelectionController (Closed)
Patch Set: Remove DocumentMarkerController.h from include Created 4 years, 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/HitTestResult.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c51b8611dadfb7e804e58b0b952b734d5a35bfaa..03a2a61ddcc3989780925499155240368b4e6341 100644
--- a/third_party/WebKit/Source/core/editing/SelectionController.cpp
+++ b/third_party/WebKit/Source/core/editing/SelectionController.cpp
@@ -595,6 +595,18 @@ bool SelectionController::handleGestureLongPress(const PlatformGestureEvent& ges
return selection().isRange();
}
+static bool hitTestResultIsMisspelled(const HitTestResult& result)
+{
+ Node* innerNode = result.innerNode();
+ if (!innerNode || !innerNode->layoutObject())
+ return false;
+ VisiblePosition pos = createVisiblePosition(innerNode->layoutObject()->positionForPoint(result.localPoint()));
+ if (pos.isNull())
+ return false;
+ return innerNode->document().markers().markersInRange(
+ EphemeralRange(pos.deepEquivalent().parentAnchoredEquivalent()), DocumentMarker::MisspellingMarkers()).size() > 0;
+}
+
void SelectionController::sendContextMenuEvent(const MouseEventWithHitTestResults& mev, const LayoutPoint& position)
{
if (!selection().isAvailable())
@@ -610,7 +622,7 @@ void SelectionController::sendContextMenuEvent(const MouseEventWithHitTestResult
// Context menu events are always allowed to perform a selection.
AutoReset<bool> mouseDownMayStartSelectChange(&m_mouseDownMayStartSelect, true);
- if (mev.hitTestResult().isMisspelled())
+ if (hitTestResultIsMisspelled(mev.hitTestResult()))
return selectClosestMisspellingFromMouseEvent(mev);
if (!m_frame->editor().behavior().shouldSelectOnContextualMenuClick())
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/HitTestResult.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698