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

Side by Side Diff: third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp

Issue 2177333002: Move setWindowRect and windowRect calls from WebViewClient to WebWidgetClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: switch to refs 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple 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 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 { 871 {
872 if (!frame()) 872 if (!frame())
873 return 0; 873 return 0;
874 874
875 FrameHost* host = frame()->host(); 875 FrameHost* host = frame()->host();
876 if (!host) 876 if (!host)
877 return 0; 877 return 0;
878 878
879 ChromeClient& chromeClient = host->chromeClient(); 879 ChromeClient& chromeClient = host->chromeClient();
880 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) 880 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk())
881 return lroundf(chromeClient.windowRect().height() * chromeClient.screenI nfo().deviceScaleFactor); 881 return lroundf(chromeClient.rootWindowRect().height() * chromeClient.scr eenInfo().deviceScaleFactor);
882 return chromeClient.windowRect().height(); 882 return chromeClient.rootWindowRect().height();
883 } 883 }
884 884
885 int LocalDOMWindow::outerWidth() const 885 int LocalDOMWindow::outerWidth() const
886 { 886 {
887 if (!frame()) 887 if (!frame())
888 return 0; 888 return 0;
889 889
890 FrameHost* host = frame()->host(); 890 FrameHost* host = frame()->host();
891 if (!host) 891 if (!host)
892 return 0; 892 return 0;
893 893
894 ChromeClient& chromeClient = host->chromeClient(); 894 ChromeClient& chromeClient = host->chromeClient();
895 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) 895 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk())
896 return lroundf(chromeClient.windowRect().width() * chromeClient.screenIn fo().deviceScaleFactor); 896 return lroundf(chromeClient.rootWindowRect().width() * chromeClient.scre enInfo().deviceScaleFactor);
897 897
898 return chromeClient.windowRect().width(); 898 return chromeClient.rootWindowRect().width();
899 } 899 }
900 900
901 FloatSize LocalDOMWindow::getViewportSize(IncludeScrollbarsInRect scrollbarInclu sion) const 901 FloatSize LocalDOMWindow::getViewportSize(IncludeScrollbarsInRect scrollbarInclu sion) const
902 { 902 {
903 if (!frame()) 903 if (!frame())
904 return FloatSize(); 904 return FloatSize();
905 905
906 FrameView* view = frame()->view(); 906 FrameView* view = frame()->view();
907 if (!view) 907 if (!view)
908 return FloatSize(); 908 return FloatSize();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 { 951 {
952 if (!frame()) 952 if (!frame())
953 return 0; 953 return 0;
954 954
955 FrameHost* host = frame()->host(); 955 FrameHost* host = frame()->host();
956 if (!host) 956 if (!host)
957 return 0; 957 return 0;
958 958
959 ChromeClient& chromeClient = host->chromeClient(); 959 ChromeClient& chromeClient = host->chromeClient();
960 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) 960 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk())
961 return lroundf(chromeClient.windowRect().x() * chromeClient.screenInfo() .deviceScaleFactor); 961 return lroundf(chromeClient.rootWindowRect().x() * chromeClient.screenIn fo().deviceScaleFactor);
962 return chromeClient.windowRect().x(); 962 return chromeClient.rootWindowRect().x();
963 } 963 }
964 964
965 int LocalDOMWindow::screenY() const 965 int LocalDOMWindow::screenY() const
966 { 966 {
967 if (!frame()) 967 if (!frame())
968 return 0; 968 return 0;
969 969
970 FrameHost* host = frame()->host(); 970 FrameHost* host = frame()->host();
971 if (!host) 971 if (!host)
972 return 0; 972 return 0;
973 973
974 ChromeClient& chromeClient = host->chromeClient(); 974 ChromeClient& chromeClient = host->chromeClient();
975 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) 975 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk())
976 return lroundf(chromeClient.windowRect().y() * chromeClient.screenInfo() .deviceScaleFactor); 976 return lroundf(chromeClient.rootWindowRect().y() * chromeClient.screenIn fo().deviceScaleFactor);
977 return chromeClient.windowRect().y(); 977 return chromeClient.rootWindowRect().y();
978 } 978 }
979 979
980 double LocalDOMWindow::scrollX() const 980 double LocalDOMWindow::scrollX() const
981 { 981 {
982 if (!frame() || !frame()->host()) 982 if (!frame() || !frame()->host())
983 return 0; 983 return 0;
984 984
985 if (!frame()->host()->settings().inertVisualViewport()) 985 if (!frame()->host()->settings().inertVisualViewport())
986 return m_visualViewport->pageX(); 986 return m_visualViewport->pageX();
987 987
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 1225
1226 void LocalDOMWindow::moveBy(int x, int y) const 1226 void LocalDOMWindow::moveBy(int x, int y) const
1227 { 1227 {
1228 if (!frame() || !frame()->isMainFrame()) 1228 if (!frame() || !frame()->isMainFrame())
1229 return; 1229 return;
1230 1230
1231 FrameHost* host = frame()->host(); 1231 FrameHost* host = frame()->host();
1232 if (!host) 1232 if (!host)
1233 return; 1233 return;
1234 1234
1235 IntRect windowRect = host->chromeClient().windowRect(); 1235 IntRect windowRect = host->chromeClient().rootWindowRect();
1236 windowRect.move(x, y); 1236 windowRect.move(x, y);
1237 // Security check (the spec talks about UniversalBrowserWrite to disable thi s check...) 1237 // Security check (the spec talks about UniversalBrowserWrite to disable thi s check...)
1238 host->chromeClient().setWindowRectWithAdjustment(windowRect); 1238 host->chromeClient().setWindowRectWithAdjustment(windowRect, *frame());
1239 } 1239 }
1240 1240
1241 void LocalDOMWindow::moveTo(int x, int y) const 1241 void LocalDOMWindow::moveTo(int x, int y) const
1242 { 1242 {
1243 if (!frame() || !frame()->isMainFrame()) 1243 if (!frame() || !frame()->isMainFrame())
1244 return; 1244 return;
1245 1245
1246 FrameHost* host = frame()->host(); 1246 FrameHost* host = frame()->host();
1247 if (!host) 1247 if (!host)
1248 return; 1248 return;
1249 1249
1250 IntRect windowRect = host->chromeClient().windowRect(); 1250 IntRect windowRect = host->chromeClient().rootWindowRect();
1251 windowRect.setLocation(IntPoint(x, y)); 1251 windowRect.setLocation(IntPoint(x, y));
1252 // Security check (the spec talks about UniversalBrowserWrite to disable thi s check...) 1252 // Security check (the spec talks about UniversalBrowserWrite to disable thi s check...)
1253 host->chromeClient().setWindowRectWithAdjustment(windowRect); 1253 host->chromeClient().setWindowRectWithAdjustment(windowRect, *frame());
1254 } 1254 }
1255 1255
1256 void LocalDOMWindow::resizeBy(int x, int y) const 1256 void LocalDOMWindow::resizeBy(int x, int y) const
1257 { 1257 {
1258 if (!frame() || !frame()->isMainFrame()) 1258 if (!frame() || !frame()->isMainFrame())
1259 return; 1259 return;
1260 1260
1261 FrameHost* host = frame()->host(); 1261 FrameHost* host = frame()->host();
1262 if (!host) 1262 if (!host)
1263 return; 1263 return;
1264 1264
1265 IntRect fr = host->chromeClient().windowRect(); 1265 IntRect fr = host->chromeClient().rootWindowRect();
1266 IntSize dest = fr.size() + IntSize(x, y); 1266 IntSize dest = fr.size() + IntSize(x, y);
1267 IntRect update(fr.location(), dest); 1267 IntRect update(fr.location(), dest);
1268 host->chromeClient().setWindowRectWithAdjustment(update); 1268 host->chromeClient().setWindowRectWithAdjustment(update, *frame());
1269 } 1269 }
1270 1270
1271 void LocalDOMWindow::resizeTo(int width, int height) const 1271 void LocalDOMWindow::resizeTo(int width, int height) const
1272 { 1272 {
1273 if (!frame() || !frame()->isMainFrame()) 1273 if (!frame() || !frame()->isMainFrame())
1274 return; 1274 return;
1275 1275
1276 FrameHost* host = frame()->host(); 1276 FrameHost* host = frame()->host();
1277 if (!host) 1277 if (!host)
1278 return; 1278 return;
1279 1279
1280 IntRect fr = host->chromeClient().windowRect(); 1280 IntRect fr = host->chromeClient().rootWindowRect();
1281 IntSize dest = IntSize(width, height); 1281 IntSize dest = IntSize(width, height);
1282 IntRect update(fr.location(), dest); 1282 IntRect update(fr.location(), dest);
1283 host->chromeClient().setWindowRectWithAdjustment(update); 1283 host->chromeClient().setWindowRectWithAdjustment(update, *frame());
1284 } 1284 }
1285 1285
1286 int LocalDOMWindow::requestAnimationFrame(FrameRequestCallback* callback) 1286 int LocalDOMWindow::requestAnimationFrame(FrameRequestCallback* callback)
1287 { 1287 {
1288 callback->m_useLegacyTimeBase = false; 1288 callback->m_useLegacyTimeBase = false;
1289 if (Document* doc = document()) 1289 if (Document* doc = document())
1290 return doc->requestAnimationFrame(callback); 1290 return doc->requestAnimationFrame(callback);
1291 return 0; 1291 return 0;
1292 } 1292 }
1293 1293
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 { 1542 {
1543 // If the LocalDOMWindow still has a frame reference, that frame must point 1543 // If the LocalDOMWindow still has a frame reference, that frame must point
1544 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation 1544 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation
1545 // where script execution leaks between different LocalDOMWindows. 1545 // where script execution leaks between different LocalDOMWindows.
1546 if (m_frameObserver->frame()) 1546 if (m_frameObserver->frame())
1547 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() = = this); 1547 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() = = this);
1548 return m_frameObserver->frame(); 1548 return m_frameObserver->frame();
1549 } 1549 }
1550 1550
1551 } // namespace blink 1551 } // namespace blink
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | third_party/WebKit/Source/core/loader/EmptyClients.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698