OLD | NEW |
---|---|
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 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1221 scaledX = ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.left( )) * frame()->pageZoomFactor(); | 1221 scaledX = ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.left( )) * frame()->pageZoomFactor(); |
1222 | 1222 |
1223 if (scrollToOptions.hasTop()) | 1223 if (scrollToOptions.hasTop()) |
1224 scaledY = ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.top() ) * frame()->pageZoomFactor(); | 1224 scaledY = ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.top() ) * frame()->pageZoomFactor(); |
1225 | 1225 |
1226 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; | 1226 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; |
1227 ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), scrollB ehavior); | 1227 ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), scrollB ehavior); |
1228 view->scrollableArea()->setScrollPosition(DoublePoint(scaledX, scaledY), Pro grammaticScroll, scrollBehavior); | 1228 view->scrollableArea()->setScrollPosition(DoublePoint(scaledX, scaledY), Pro grammaticScroll, scrollBehavior); |
1229 } | 1229 } |
1230 | 1230 |
1231 void LocalDOMWindow::moveBy(int x, int y, bool hasX, bool hasY) const | 1231 void LocalDOMWindow::moveBy(int x, int y) const |
1232 { | 1232 { |
1233 if (!hasX || !hasY) | |
1234 UseCounter::count(document(), UseCounter::WindowMoveResizeMissingArgumen ts); | |
philipj_slow
2015/06/12 09:16:04
Oh wait, can you remove the now-unused counters?
philipj_slow
2015/06/12 09:23:13
Too late, but no need for a follow-up if you don't
| |
1235 | |
1236 if (!frame() || !frame()->isMainFrame()) | 1233 if (!frame() || !frame()->isMainFrame()) |
1237 return; | 1234 return; |
1238 | 1235 |
1239 FrameHost* host = frame()->host(); | 1236 FrameHost* host = frame()->host(); |
1240 if (!host) | 1237 if (!host) |
1241 return; | 1238 return; |
1242 | 1239 |
1243 IntRect windowRect = host->chromeClient().windowRect(); | 1240 IntRect windowRect = host->chromeClient().windowRect(); |
1244 windowRect.move(x, y); | 1241 windowRect.move(x, y); |
1245 // Security check (the spec talks about UniversalBrowserWrite to disable thi s check...) | 1242 // Security check (the spec talks about UniversalBrowserWrite to disable thi s check...) |
1246 host->chromeClient().setWindowRectWithAdjustment(windowRect); | 1243 host->chromeClient().setWindowRectWithAdjustment(windowRect); |
1247 } | 1244 } |
1248 | 1245 |
1249 void LocalDOMWindow::moveTo(int x, int y, bool hasX, bool hasY) const | 1246 void LocalDOMWindow::moveTo(int x, int y) const |
1250 { | 1247 { |
1251 if (!hasX || !hasY) | |
1252 UseCounter::count(document(), UseCounter::WindowMoveResizeMissingArgumen ts); | |
1253 | |
1254 if (!frame() || !frame()->isMainFrame()) | 1248 if (!frame() || !frame()->isMainFrame()) |
1255 return; | 1249 return; |
1256 | 1250 |
1257 FrameHost* host = frame()->host(); | 1251 FrameHost* host = frame()->host(); |
1258 if (!host) | 1252 if (!host) |
1259 return; | 1253 return; |
1260 | 1254 |
1261 IntRect windowRect = host->chromeClient().windowRect(); | 1255 IntRect windowRect = host->chromeClient().windowRect(); |
1262 windowRect.setLocation(IntPoint(hasX ? x : windowRect.x(), hasY ? y : window Rect.y())); | 1256 windowRect.setLocation(IntPoint(x, y)); |
1263 // Security check (the spec talks about UniversalBrowserWrite to disable thi s check...) | 1257 // Security check (the spec talks about UniversalBrowserWrite to disable thi s check...) |
1264 host->chromeClient().setWindowRectWithAdjustment(windowRect); | 1258 host->chromeClient().setWindowRectWithAdjustment(windowRect); |
1265 } | 1259 } |
1266 | 1260 |
1267 void LocalDOMWindow::resizeBy(int x, int y, bool hasX, bool hasY) const | 1261 void LocalDOMWindow::resizeBy(int x, int y) const |
1268 { | 1262 { |
1269 if (!hasX || !hasY) | |
1270 UseCounter::count(document(), UseCounter::WindowMoveResizeMissingArgumen ts); | |
1271 | |
1272 if (!frame() || !frame()->isMainFrame()) | 1263 if (!frame() || !frame()->isMainFrame()) |
1273 return; | 1264 return; |
1274 | 1265 |
1275 FrameHost* host = frame()->host(); | 1266 FrameHost* host = frame()->host(); |
1276 if (!host) | 1267 if (!host) |
1277 return; | 1268 return; |
1278 | 1269 |
1279 IntRect fr = host->chromeClient().windowRect(); | 1270 IntRect fr = host->chromeClient().windowRect(); |
1280 IntSize dest = fr.size() + IntSize(x, y); | 1271 IntSize dest = fr.size() + IntSize(x, y); |
1281 IntRect update(fr.location(), dest); | 1272 IntRect update(fr.location(), dest); |
1282 host->chromeClient().setWindowRectWithAdjustment(update); | 1273 host->chromeClient().setWindowRectWithAdjustment(update); |
1283 } | 1274 } |
1284 | 1275 |
1285 void LocalDOMWindow::resizeTo(int width, int height, bool hasWidth, bool hasHeig ht) const | 1276 void LocalDOMWindow::resizeTo(int width, int height) const |
1286 { | 1277 { |
1287 if (!hasWidth || !hasHeight) | |
1288 UseCounter::count(document(), UseCounter::WindowMoveResizeMissingArgumen ts); | |
1289 | |
1290 if (!frame() || !frame()->isMainFrame()) | 1278 if (!frame() || !frame()->isMainFrame()) |
1291 return; | 1279 return; |
1292 | 1280 |
1293 FrameHost* host = frame()->host(); | 1281 FrameHost* host = frame()->host(); |
1294 if (!host) | 1282 if (!host) |
1295 return; | 1283 return; |
1296 | 1284 |
1297 IntRect fr = host->chromeClient().windowRect(); | 1285 IntRect fr = host->chromeClient().windowRect(); |
1298 IntSize dest = IntSize(hasWidth ? width : fr.width(), hasHeight ? height : f r.height()); | 1286 IntSize dest = IntSize(width, height); |
1299 IntRect update(fr.location(), dest); | 1287 IntRect update(fr.location(), dest); |
1300 host->chromeClient().setWindowRectWithAdjustment(update); | 1288 host->chromeClient().setWindowRectWithAdjustment(update); |
1301 } | 1289 } |
1302 | 1290 |
1303 int LocalDOMWindow::requestAnimationFrame(FrameRequestCallback* callback) | 1291 int LocalDOMWindow::requestAnimationFrame(FrameRequestCallback* callback) |
1304 { | 1292 { |
1305 callback->m_useLegacyTimeBase = false; | 1293 callback->m_useLegacyTimeBase = false; |
1306 if (Document* d = document()) | 1294 if (Document* d = document()) |
1307 return d->requestAnimationFrame(callback); | 1295 return d->requestAnimationFrame(callback); |
1308 return 0; | 1296 return 0; |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1533 DOMWindow::trace(visitor); | 1521 DOMWindow::trace(visitor); |
1534 DOMWindowLifecycleNotifier::trace(visitor); | 1522 DOMWindowLifecycleNotifier::trace(visitor); |
1535 } | 1523 } |
1536 | 1524 |
1537 LocalFrame* LocalDOMWindow::frame() const | 1525 LocalFrame* LocalDOMWindow::frame() const |
1538 { | 1526 { |
1539 return m_frameObserver->frame(); | 1527 return m_frameObserver->frame(); |
1540 } | 1528 } |
1541 | 1529 |
1542 } // namespace blink | 1530 } // namespace blink |
OLD | NEW |