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

Side by Side Diff: third_party/WebKit/Source/web/ChromeClientImpl.cpp

Issue 2290233007: Move convertViewportToWindow and convertWindowToViewport from (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 if (client) { 585 if (client) {
586 client->convertViewportToWindow(&screenRect); 586 client->convertViewportToWindow(&screenRect);
587 WebRect windowRect = client->windowRect(); 587 WebRect windowRect = client->windowRect();
588 screenRect.x += windowRect.x; 588 screenRect.x += windowRect.x;
589 screenRect.y += windowRect.y; 589 screenRect.y += windowRect.y;
590 } 590 }
591 591
592 return screenRect; 592 return screenRect;
593 } 593 }
594 594
595 float ChromeClientImpl::windowToViewportScalar(const float scalarValue) const 595 float ChromeClientImpl::windowToViewportScalar(const float scalarValue, const Wi dget* widget) const
596 { 596 {
597 if (!m_webView->client()) 597 DCHECK(widget->isFrameView());
598 const FrameView* view = toFrameView(widget);
599 LocalFrame* frame = view->frame().localFrameRoot();
600
601 WebWidgetClient* client = WebLocalFrameImpl::fromFrame(frame)->frameWidget() ->client();
602 if (!client)
598 return scalarValue; 603 return scalarValue;
604
599 WebFloatRect viewportRect(0, 0, scalarValue, 0); 605 WebFloatRect viewportRect(0, 0, scalarValue, 0);
600 m_webView->client()->convertWindowToViewport(&viewportRect); 606 client->convertWindowToViewport(&viewportRect);
601 return viewportRect.width; 607 return viewportRect.width;
602 } 608 }
603 609
604 WebScreenInfo ChromeClientImpl::screenInfo() const 610 WebScreenInfo ChromeClientImpl::screenInfo() const
605 { 611 {
606 return m_webView->client() ? m_webView->client()->screenInfo() : WebScreenIn fo(); 612 return m_webView->client() ? m_webView->client()->screenInfo() : WebScreenIn fo();
607 } 613 }
608 614
609 void ChromeClientImpl::contentsSizeChanged(LocalFrame* frame, const IntSize& siz e) const 615 void ChromeClientImpl::contentsSizeChanged(LocalFrame* frame, const IntSize& siz e) const
610 { 616 {
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 ScreenOrientationController::provideTo(frame, client ? client->webScreenOrie ntationClient() : nullptr); 1142 ScreenOrientationController::provideTo(frame, client ? client->webScreenOrie ntationClient() : nullptr);
1137 if (RuntimeEnabledFeatures::presentationEnabled()) 1143 if (RuntimeEnabledFeatures::presentationEnabled())
1138 PresentationController::provideTo(frame, client ? client->presentationCl ient() : nullptr); 1144 PresentationController::provideTo(frame, client ? client->presentationCl ient() : nullptr);
1139 if (RuntimeEnabledFeatures::audioOutputDevicesEnabled()) 1145 if (RuntimeEnabledFeatures::audioOutputDevicesEnabled())
1140 provideAudioOutputDeviceClientTo(frame, AudioOutputDeviceClientImpl::cre ate()); 1146 provideAudioOutputDeviceClientTo(frame, AudioOutputDeviceClientImpl::cre ate());
1141 if (RuntimeEnabledFeatures::installedAppEnabled()) 1147 if (RuntimeEnabledFeatures::installedAppEnabled())
1142 InstalledAppController::provideTo(frame, client ? client->installedAppCl ient() : nullptr); 1148 InstalledAppController::provideTo(frame, client ? client->installedAppCl ient() : nullptr);
1143 } 1149 }
1144 1150
1145 } // namespace blink 1151 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698