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

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: change CHECK to a DCHECK 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 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 { 875 {
876 if (!frame()) 876 if (!frame())
877 return 0; 877 return 0;
878 878
879 FrameHost* host = frame()->host(); 879 FrameHost* host = frame()->host();
880 if (!host) 880 if (!host)
881 return 0; 881 return 0;
882 882
883 ChromeClient& chromeClient = host->chromeClient(); 883 ChromeClient& chromeClient = host->chromeClient();
884 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) 884 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk())
885 return lroundf(chromeClient.windowRect().height() * chromeClient.screenI nfo().deviceScaleFactor); 885 return lroundf(chromeClient.rootWindowRect().height() * chromeClient.scr eenInfo().deviceScaleFactor);
886 return chromeClient.windowRect().height(); 886 return chromeClient.rootWindowRect().height();
887 } 887 }
888 888
889 int LocalDOMWindow::outerWidth() const 889 int LocalDOMWindow::outerWidth() const
890 { 890 {
891 if (!frame()) 891 if (!frame())
892 return 0; 892 return 0;
893 893
894 FrameHost* host = frame()->host(); 894 FrameHost* host = frame()->host();
895 if (!host) 895 if (!host)
896 return 0; 896 return 0;
897 897
898 ChromeClient& chromeClient = host->chromeClient(); 898 ChromeClient& chromeClient = host->chromeClient();
899 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) 899 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk())
900 return lroundf(chromeClient.windowRect().width() * chromeClient.screenIn fo().deviceScaleFactor); 900 return lroundf(chromeClient.rootWindowRect().width() * chromeClient.scre enInfo().deviceScaleFactor);
901 901
902 return chromeClient.windowRect().width(); 902 return chromeClient.rootWindowRect().width();
903 } 903 }
904 904
905 FloatSize LocalDOMWindow::getViewportSize(IncludeScrollbarsInRect scrollbarInclu sion) const 905 FloatSize LocalDOMWindow::getViewportSize(IncludeScrollbarsInRect scrollbarInclu sion) const
906 { 906 {
907 if (!frame()) 907 if (!frame())
908 return FloatSize(); 908 return FloatSize();
909 909
910 FrameView* view = frame()->view(); 910 FrameView* view = frame()->view();
911 if (!view) 911 if (!view)
912 return FloatSize(); 912 return FloatSize();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 { 955 {
956 if (!frame()) 956 if (!frame())
957 return 0; 957 return 0;
958 958
959 FrameHost* host = frame()->host(); 959 FrameHost* host = frame()->host();
960 if (!host) 960 if (!host)
961 return 0; 961 return 0;
962 962
963 ChromeClient& chromeClient = host->chromeClient(); 963 ChromeClient& chromeClient = host->chromeClient();
964 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) 964 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk())
965 return lroundf(chromeClient.windowRect().x() * chromeClient.screenInfo() .deviceScaleFactor); 965 return lroundf(chromeClient.rootWindowRect().x() * chromeClient.screenIn fo().deviceScaleFactor);
966 return chromeClient.windowRect().x(); 966 return chromeClient.rootWindowRect().x();
967 } 967 }
968 968
969 int LocalDOMWindow::screenY() const 969 int LocalDOMWindow::screenY() const
970 { 970 {
971 if (!frame()) 971 if (!frame())
972 return 0; 972 return 0;
973 973
974 FrameHost* host = frame()->host(); 974 FrameHost* host = frame()->host();
975 if (!host) 975 if (!host)
976 return 0; 976 return 0;
977 977
978 ChromeClient& chromeClient = host->chromeClient(); 978 ChromeClient& chromeClient = host->chromeClient();
979 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) 979 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk())
980 return lroundf(chromeClient.windowRect().y() * chromeClient.screenInfo() .deviceScaleFactor); 980 return lroundf(chromeClient.rootWindowRect().y() * chromeClient.screenIn fo().deviceScaleFactor);
981 return chromeClient.windowRect().y(); 981 return chromeClient.rootWindowRect().y();
982 } 982 }
983 983
984 double LocalDOMWindow::scrollX() const 984 double LocalDOMWindow::scrollX() const
985 { 985 {
986 if (!frame() || !frame()->host()) 986 if (!frame() || !frame()->host())
987 return 0; 987 return 0;
988 988
989 if (!frame()->host()->settings().inertVisualViewport()) 989 if (!frame()->host()->settings().inertVisualViewport())
990 return m_visualViewport->pageX(); 990 return m_visualViewport->pageX();
991 991
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 1231
1232 void LocalDOMWindow::moveBy(int x, int y) const 1232 void LocalDOMWindow::moveBy(int x, int y) const
1233 { 1233 {
1234 if (!frame() || !frame()->isMainFrame()) 1234 if (!frame() || !frame()->isMainFrame())
1235 return; 1235 return;
1236 1236
1237 FrameHost* host = frame()->host(); 1237 FrameHost* host = frame()->host();
1238 if (!host) 1238 if (!host)
1239 return; 1239 return;
1240 1240
1241 IntRect windowRect = host->chromeClient().windowRect(); 1241 IntRect windowRect = host->chromeClient().rootWindowRect();
1242 windowRect.move(x, y); 1242 windowRect.move(x, y);
1243 // Security check (the spec talks about UniversalBrowserWrite to disable thi s check...) 1243 // Security check (the spec talks about UniversalBrowserWrite to disable thi s check...)
1244 host->chromeClient().setWindowRectWithAdjustment(windowRect); 1244 host->chromeClient().setWindowRectWithAdjustment(windowRect, frame());
1245 } 1245 }
1246 1246
1247 void LocalDOMWindow::moveTo(int x, int y) const 1247 void LocalDOMWindow::moveTo(int x, int y) const
1248 { 1248 {
1249 if (!frame() || !frame()->isMainFrame()) 1249 if (!frame() || !frame()->isMainFrame())
1250 return; 1250 return;
1251 1251
1252 FrameHost* host = frame()->host(); 1252 FrameHost* host = frame()->host();
1253 if (!host) 1253 if (!host)
1254 return; 1254 return;
1255 1255
1256 IntRect windowRect = host->chromeClient().windowRect(); 1256 IntRect windowRect = host->chromeClient().rootWindowRect();
1257 windowRect.setLocation(IntPoint(x, y)); 1257 windowRect.setLocation(IntPoint(x, y));
1258 // Security check (the spec talks about UniversalBrowserWrite to disable thi s check...) 1258 // Security check (the spec talks about UniversalBrowserWrite to disable thi s check...)
1259 host->chromeClient().setWindowRectWithAdjustment(windowRect); 1259 host->chromeClient().setWindowRectWithAdjustment(windowRect, frame());
1260 } 1260 }
1261 1261
1262 void LocalDOMWindow::resizeBy(int x, int y) const 1262 void LocalDOMWindow::resizeBy(int x, int y) const
1263 { 1263 {
1264 if (!frame() || !frame()->isMainFrame()) 1264 if (!frame() || !frame()->isMainFrame())
1265 return; 1265 return;
1266 1266
1267 FrameHost* host = frame()->host(); 1267 FrameHost* host = frame()->host();
1268 if (!host) 1268 if (!host)
1269 return; 1269 return;
1270 1270
1271 IntRect fr = host->chromeClient().windowRect(); 1271 IntRect fr = host->chromeClient().rootWindowRect();
1272 IntSize dest = fr.size() + IntSize(x, y); 1272 IntSize dest = fr.size() + IntSize(x, y);
1273 IntRect update(fr.location(), dest); 1273 IntRect update(fr.location(), dest);
1274 host->chromeClient().setWindowRectWithAdjustment(update); 1274 host->chromeClient().setWindowRectWithAdjustment(update, frame());
1275 } 1275 }
1276 1276
1277 void LocalDOMWindow::resizeTo(int width, int height) const 1277 void LocalDOMWindow::resizeTo(int width, int height) const
1278 { 1278 {
1279 if (!frame() || !frame()->isMainFrame()) 1279 if (!frame() || !frame()->isMainFrame())
1280 return; 1280 return;
1281 1281
1282 FrameHost* host = frame()->host(); 1282 FrameHost* host = frame()->host();
1283 if (!host) 1283 if (!host)
1284 return; 1284 return;
1285 1285
1286 IntRect fr = host->chromeClient().windowRect(); 1286 IntRect fr = host->chromeClient().rootWindowRect();
1287 IntSize dest = IntSize(width, height); 1287 IntSize dest = IntSize(width, height);
1288 IntRect update(fr.location(), dest); 1288 IntRect update(fr.location(), dest);
1289 host->chromeClient().setWindowRectWithAdjustment(update); 1289 host->chromeClient().setWindowRectWithAdjustment(update, frame());
1290 } 1290 }
1291 1291
1292 int LocalDOMWindow::requestAnimationFrame(FrameRequestCallback* callback) 1292 int LocalDOMWindow::requestAnimationFrame(FrameRequestCallback* callback)
1293 { 1293 {
1294 callback->m_useLegacyTimeBase = false; 1294 callback->m_useLegacyTimeBase = false;
1295 if (Document* doc = document()) 1295 if (Document* doc = document())
1296 return doc->requestAnimationFrame(callback); 1296 return doc->requestAnimationFrame(callback);
1297 return 0; 1297 return 0;
1298 } 1298 }
1299 1299
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 { 1543 {
1544 // If the LocalDOMWindow still has a frame reference, that frame must point 1544 // If the LocalDOMWindow still has a frame reference, that frame must point
1545 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation 1545 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation
1546 // where script execution leaks between different LocalDOMWindows. 1546 // where script execution leaks between different LocalDOMWindows.
1547 if (m_frameObserver->frame()) 1547 if (m_frameObserver->frame())
1548 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() = = this); 1548 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() = = this);
1549 return m_frameObserver->frame(); 1549 return m_frameObserver->frame();
1550 } 1550 }
1551 1551
1552 } // namespace blink 1552 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698