Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1227)

Unified Diff: third_party/WebKit/Source/web/ChromeClientImpl.cpp

Issue 2290233007: Move convertViewportToWindow and convertWindowToViewport from (Closed)
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 c8625a81c818c6900c53bd9e13dd7e66ae9c03c3..b8655350670976e1cadfc1fd72a90dbfaf3a0f95 100644
--- a/third_party/WebKit/Source/web/ChromeClientImpl.cpp
+++ b/third_party/WebKit/Source/web/ChromeClientImpl.cpp
@@ -592,12 +592,18 @@ IntRect ChromeClientImpl::viewportToScreen(const IntRect& rectInViewport, const
return screenRect;
}
-float ChromeClientImpl::windowToViewportScalar(const float scalarValue) const
+float ChromeClientImpl::windowToViewportScalar(const float scalarValue, const Widget* widget) const
{
- if (!m_webView->client())
+ DCHECK(widget->isFrameView());
+ const FrameView* view = toFrameView(widget);
+ LocalFrame* frame = view->frame().localFrameRoot();
+
+ WebWidgetClient* client = WebLocalFrameImpl::fromFrame(frame)->frameWidget()->client();
+ if (!client)
return scalarValue;
+
WebFloatRect viewportRect(0, 0, scalarValue, 0);
- m_webView->client()->convertWindowToViewport(&viewportRect);
+ client->convertWindowToViewport(&viewportRect);
return viewportRect.width;
}

Powered by Google App Engine
This is Rietveld 408576698