Chromium Code Reviews| Index: third_party/WebKit/Source/web/ChromeClientImpl.cpp |
| diff --git a/third_party/WebKit/Source/web/ChromeClientImpl.cpp b/third_party/WebKit/Source/web/ChromeClientImpl.cpp |
| index c3acd08f5f04e4e600fdc4107904a0f8568faeb9..03f19518d0827daf5c716d0caf13ac11b59c1281 100644 |
| --- a/third_party/WebKit/Source/web/ChromeClientImpl.cpp |
| +++ b/third_party/WebKit/Source/web/ChromeClientImpl.cpp |
| @@ -565,20 +565,28 @@ IntRect ChromeClientImpl::viewportToScreen(const IntRect& rectInViewport, const |
| DCHECK(widget->isFrameView()); |
| const FrameView* view = toFrameView(widget); |
| LocalFrame* frame = view->frame().localFrameRoot(); |
| - WebWidgetClient* client = nullptr; |
| // TODO(kenrb): Consolidate this to a single case when WebViewFrameWidget refactor is complete. |
| - if (WebLocalFrameImpl::fromFrame(frame) && WebLocalFrameImpl::fromFrame(frame)->frameWidget() && WebLocalFrameImpl::fromFrame(frame)->frameWidget()->forSubframe()) |
| - client = toWebFrameWidgetImpl(WebLocalFrameImpl::fromFrame(frame)->frameWidget())->client(); |
| - else |
| - client = m_webView->client(); |
| + if (WebLocalFrameImpl::fromFrame(frame) && WebLocalFrameImpl::fromFrame(frame)->frameWidget() && WebLocalFrameImpl::fromFrame(frame)->frameWidget()->forSubframe()) { |
|
dcheng
2016/04/27 23:55:04
I previously tried to remove this and failed, beca
lfg
2016/04/28 17:04:33
I removed the branch but had to add a virtual to W
|
| + WebWidgetClient* client = toWebFrameWidgetImpl(WebLocalFrameImpl::fromFrame(frame)->frameWidget())->client(); |
| + |
| + if (client) { |
| + client->convertViewportToWindow(&screenRect); |
| + WebRect windowRect = client->windowRect(); |
| + screenRect.x += windowRect.x; |
| + screenRect.y += windowRect.y; |
| + } |
| + } else { |
| + WebViewClient* client = m_webView->client(); |
| - if (client) { |
| - client->convertViewportToWindow(&screenRect); |
| - WebRect windowRect = client->windowRect(); |
| - screenRect.x += windowRect.x; |
| - screenRect.y += windowRect.y; |
| + if (client) { |
| + client->convertViewportToWindow(&screenRect); |
| + WebRect windowRect = client->windowRect(); |
| + screenRect.x += windowRect.x; |
| + screenRect.y += windowRect.y; |
| + } |
| } |
| + |
| return screenRect; |
| } |