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 ee4687e1f71b73a5efc3c2b904af7ac300937da7..64fe038cf6176b2bcffa5404861e50577a86e809 100644 |
| --- a/third_party/WebKit/Source/web/ChromeClientImpl.cpp |
| +++ b/third_party/WebKit/Source/web/ChromeClientImpl.cpp |
| @@ -545,13 +545,24 @@ void ChromeClientImpl::scheduleAnimation(Widget* widget) |
| } |
| } |
| -IntRect ChromeClientImpl::viewportToScreen(const IntRect& rectInViewport) const |
| +IntRect ChromeClientImpl::viewportToScreen(const IntRect& rectInViewport, const Widget* widget) const |
| { |
| WebRect screenRect(rectInViewport); |
| - if (m_webView->client()) { |
| - m_webView->client()->convertViewportToWindow(&screenRect); |
| - WebRect windowRect = m_webView->client()->windowRect(); |
| + ASSERT(widget->isFrameView()); |
| + const FrameView* view = toFrameView(widget); |
| + LocalFrame* frame = view->frame().localFrameRoot(); |
| + WebWidgetClient* client = nullptr; |
| + |
| + if (WebLocalFrameImpl::fromFrame(frame) && WebLocalFrameImpl::fromFrame(frame)->frameWidget()) { |
| + client = toWebFrameWidgetImpl(WebLocalFrameImpl::fromFrame(frame)->frameWidget())->client(); |
| + } else { |
|
bokan
2016/03/18 19:25:42
Nit: no braces on single line if/else
kenrb
2016/03/18 20:03:19
Done.
|
| + client = m_webView->client(); |
| + } |
| + |
| + if (client) { |
| + client->convertViewportToWindow(&screenRect); |
| + WebRect windowRect = client->windowRect(); |
| screenRect.x += windowRect.x; |
| screenRect.y += windowRect.y; |
| } |