Chromium Code Reviews| Index: Source/web/WebViewImpl.cpp |
| diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp |
| index bfa58740ba092e1c5f066fa3e5c83eb3814519c0..4245cb43b0380017598a0c5d87e5dcdf7dc0d1c3 100644 |
| --- a/Source/web/WebViewImpl.cpp |
| +++ b/Source/web/WebViewImpl.cpp |
| @@ -2144,6 +2144,33 @@ bool WebViewImpl::selectionBounds(WebRect& anchor, WebRect& focus) const |
| return true; |
| } |
| +bool WebViewImpl::selectionRootBounds(WebRect& bounds) const |
| +{ |
| + const LocalFrame* frame = focusedWebCoreFrame(); |
| + if (!frame) |
| + return false; |
| + |
| + Element* root = frame->selection().rootEditableElementOrDocumentElement(); |
| + if (!root) |
| + return false; |
| + |
| + // If the selection is inside a form control, the root will be a <div> that |
|
timvolodine
2014/03/06 17:02:02
What about textarea elements? Could you list all c
mlamouri (slow - plz ping)
2014/03/10 16:05:59
Done.
|
| + // behaves as the editor but we want to return the actual element's bounds. |
| + if (root->shadowHost() |
| + && (root->shadowHost()->hasTagName(HTMLNames::textareaTag) |
| + || (root->shadowHost()->hasTagName(HTMLNames::inputTag) |
| + && toHTMLInputElement(root->shadowHost())->isText()))) { |
|
timvolodine
2014/03/05 19:41:02
no single-line brackets
mlamouri (slow - plz ping)
2014/03/06 13:45:31
Given the size of the condition, I think having br
timvolodine
2014/03/06 17:02:02
I was actually referring to: http://dev.chromium.o
mlamouri (slow - plz ping)
2014/03/10 16:05:59
I fixed the brackets. Switching to root->shadowHos
timvolodine
2014/03/10 17:50:00
The more I look at this now the more I am for putt
|
| + root = root->shadowHost(); |
| + } |
| + |
| + IntRect boundingBox = root->pixelSnappedBoundingBox(); |
| + boundingBox = root->document().frame()->view()->contentsToWindow(boundingBox); |
| + boundingBox.scale(pageScaleFactor()); |
| + bounds = boundingBox; |
| + |
| + return true; |
| +} |
| + |
| InputMethodContext* WebViewImpl::inputMethodContext() |
| { |
| if (!m_imeAcceptEvents) |