Chromium Code Reviews| Index: third_party/WebKit/Source/web/WebViewImpl.cpp |
| diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp |
| index 15774cf8a0acde13a189a2c3778095c341313f73..42346de941a7ccfd067d7dc8d5f5c716e8e59834 100644 |
| --- a/third_party/WebKit/Source/web/WebViewImpl.cpp |
| +++ b/third_party/WebKit/Source/web/WebViewImpl.cpp |
| @@ -43,6 +43,7 @@ |
| #include "core/editing/Editor.h" |
| #include "core/editing/FrameSelection.h" |
| #include "core/editing/InputMethodController.h" |
| +#include "core/editing/SelectionController.h" |
| #include "core/editing/iterators/TextIterator.h" |
| #include "core/editing/markers/DocumentMarkerController.h" |
| #include "core/editing/serializers/HTMLInterchange.h" |
| @@ -111,6 +112,7 @@ |
| #include "platform/UserGestureIndicator.h" |
| #include "platform/exported/WebActiveGestureAnimation.h" |
| #include "platform/fonts/FontCache.h" |
| +#include "platform/geometry/LayoutPoint.h" |
| #include "platform/graphics/Color.h" |
| #include "platform/graphics/FirstPaintInvalidationTracking.h" |
| #include "platform/graphics/GraphicsContext.h" |
| @@ -2256,6 +2258,28 @@ WebInputEventResult WebViewImpl::handleInputEvent(const WebInputEvent& inputEven |
| return WebInputEventResult::NotHandled; |
| } |
| +bool WebViewImpl::selectWordIfAnyAtCoordinates(float x, float y) |
| +{ |
| + IntPoint position(x, y); |
| + |
| + // Find the right target frame. See issue 1186900. |
|
Rick Byers
2015/12/21 16:31:09
This comment seems to used elsewhere in android-sp
spqchan
2016/01/06 22:52:31
I removed it but I'm a bit confused by what you me
|
| + HitTestResult result = hitTestResultForRootFramePos(position); |
| + Frame* targetFrame; |
| + if (result.innerNodeOrImageMapImage()) |
| + targetFrame = result.innerNodeOrImageMapImage()->document().frame(); |
| + else |
| + targetFrame = m_page->focusController().focusedOrMainFrame(); |
| + |
| + if (!targetFrame->isLocalFrame()) |
| + return false; |
| + |
| + LocalFrame* localFrame = toLocalFrame(targetFrame); |
| + |
| + LayoutPoint positionInContents = mainFrameImpl()->frameView()->rootFrameToContents(position); |
| + |
| + return localFrame->eventHandler().selectionController().selectWordAtPositionIfAny(flooredIntPoint(positionInContents)); |
| +} |
| + |
| void WebViewImpl::setCursorVisibilityState(bool isVisible) |
| { |
| if (m_page) |