| Index: Source/web/WebViewImpl.cpp
|
| diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
|
| index 8836341267581ea88fede135a0af516a7b3bfb95..7b0c25a081b0537a5b11fe90465b1d1fca799109 100644
|
| --- a/Source/web/WebViewImpl.cpp
|
| +++ b/Source/web/WebViewImpl.cpp
|
| @@ -840,6 +840,33 @@ void WebViewImpl::setShowScrollBottleneckRects(bool show)
|
| m_showScrollBottleneckRects = show;
|
| }
|
|
|
| +void WebViewImpl::getSelectionRootBounds(WebRect& bounds) const
|
| +{
|
| + const LocalFrame* frame = focusedWebCoreFrame();
|
| + if (!frame)
|
| + return;
|
| +
|
| + Element* root = frame->selection().rootEditableElementOrDocumentElement();
|
| + if (!root)
|
| + return;
|
| +
|
| + // If the selection is inside a form control, the root will be a <div> that
|
| + // behaves as the editor but we want to return the actual element's bounds.
|
| + // In practice, that means <textarea> and <input> controls that behave like
|
| + // a text field.
|
| + Element* shadowHost = root->shadowHost();
|
| + if (shadowHost
|
| + && (shadowHost->hasTagName(HTMLNames::textareaTag)
|
| + || (shadowHost->hasTagName(HTMLNames::inputTag)
|
| + && toHTMLInputElement(shadowHost)->isText())))
|
| + root = shadowHost;
|
| +
|
| + IntRect boundingBox = root->pixelSnappedBoundingBox();
|
| + boundingBox = root->document().frame()->view()->contentsToWindow(boundingBox);
|
| + boundingBox.scale(pageScaleFactor());
|
| + bounds = boundingBox;
|
| +}
|
| +
|
| bool WebViewImpl::handleKeyEvent(const WebKeyboardEvent& event)
|
| {
|
| ASSERT((event.type == WebInputEvent::RawKeyDown)
|
|
|