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

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

Issue 2290233007: Move convertViewportToWindow and convertWindowToViewport from (Closed)
Patch Set: add client to WebSharedWorkerImpl Created 4 years, 2 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 Widget& widget, const float scalarValue) const
596 { 596 {
597 if (!m_webView->client()) 597 DCHECK(widget.isFrameView());
598 return scalarValue; 598 const FrameView* view = toFrameView(&widget);
599 LocalFrame* frame = view->frame().localFrameRoot();
600
599 WebFloatRect viewportRect(0, 0, scalarValue, 0); 601 WebFloatRect viewportRect(0, 0, scalarValue, 0);
600 m_webView->client()->convertWindowToViewport(&viewportRect); 602 WebLocalFrameImpl::fromFrame(frame)->frameWidget()->client()->convertWindowT oViewport(&viewportRect);
601 return viewportRect.width; 603 return viewportRect.width;
602 } 604 }
603 605
604 WebScreenInfo ChromeClientImpl::screenInfo() const 606 WebScreenInfo ChromeClientImpl::screenInfo() const
605 { 607 {
606 return m_webView->client() ? m_webView->client()->screenInfo() : WebScreenIn fo(); 608 return m_webView->client() ? m_webView->client()->screenInfo() : WebScreenIn fo();
607 } 609 }
608 610
609 WTF::Optional<IntRect> ChromeClientImpl::visibleContentRectForPainting() const 611 WTF::Optional<IntRect> ChromeClientImpl::visibleContentRectForPainting() const
610 { 612 {
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 ScreenOrientationController::provideTo(frame, client ? client->webScreenOrie ntationClient() : nullptr); 1153 ScreenOrientationController::provideTo(frame, client ? client->webScreenOrie ntationClient() : nullptr);
1152 if (RuntimeEnabledFeatures::presentationEnabled()) 1154 if (RuntimeEnabledFeatures::presentationEnabled())
1153 PresentationController::provideTo(frame, client ? client->presentationCl ient() : nullptr); 1155 PresentationController::provideTo(frame, client ? client->presentationCl ient() : nullptr);
1154 if (RuntimeEnabledFeatures::audioOutputDevicesEnabled()) 1156 if (RuntimeEnabledFeatures::audioOutputDevicesEnabled())
1155 provideAudioOutputDeviceClientTo(frame, AudioOutputDeviceClientImpl::cre ate()); 1157 provideAudioOutputDeviceClientTo(frame, AudioOutputDeviceClientImpl::cre ate());
1156 if (RuntimeEnabledFeatures::installedAppEnabled()) 1158 if (RuntimeEnabledFeatures::installedAppEnabled())
1157 InstalledAppController::provideTo(frame, client ? client->installedAppCl ient() : nullptr); 1159 InstalledAppController::provideTo(frame, client ? client->installedAppCl ient() : nullptr);
1158 } 1160 }
1159 1161
1160 } // namespace blink 1162 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/ChromeClientImpl.h ('k') | third_party/WebKit/Source/web/DateTimeChooserImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698