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 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1396 if (std::isnan(scrollToOptions.top())) | 1396 if (std::isnan(scrollToOptions.top())) |
1397 return; | 1397 return; |
1398 scaledY = scrollToOptions.top() * frame()->pageZoomFactor(); | 1398 scaledY = scrollToOptions.top() * frame()->pageZoomFactor(); |
1399 } | 1399 } |
1400 | 1400 |
1401 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; | 1401 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; |
1402 ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), scrollB ehavior); | 1402 ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), scrollB ehavior); |
1403 scrollViewportTo(frame(), DoublePoint(scaledX, scaledY), scrollBehavior); | 1403 scrollViewportTo(frame(), DoublePoint(scaledX, scaledY), scrollBehavior); |
1404 } | 1404 } |
1405 | 1405 |
1406 void LocalDOMWindow::moveBy(int x, int y) const | 1406 void LocalDOMWindow::moveBy(int x, int y, bool hasX, bool hasY) const |
1407 { | 1407 { |
1408 if (!hasX || !hasY) | |
1409 UseCounter::count(document(), UseCounter::WindowMoveResizeMissingArgumen ts); | |
philipj_slow
2015/02/05 10:13:58
It could well be that there's only a single 1-argu
Jens Widell
2015/02/05 10:19:52
I reasoned that the possible outcomes were to eith
| |
1410 | |
1408 if (!frame() || !frame()->isMainFrame()) | 1411 if (!frame() || !frame()->isMainFrame()) |
1409 return; | 1412 return; |
1410 | 1413 |
1411 FrameHost* host = frame()->host(); | 1414 FrameHost* host = frame()->host(); |
1412 if (!host) | 1415 if (!host) |
1413 return; | 1416 return; |
1414 | 1417 |
1415 IntRect windowRect = host->chrome().windowRect(); | 1418 IntRect windowRect = host->chrome().windowRect(); |
1416 windowRect.move(x, y); | 1419 windowRect.move(x, y); |
1417 // Security check (the spec talks about UniversalBrowserWrite to disable thi s check...) | 1420 // Security check (the spec talks about UniversalBrowserWrite to disable thi s check...) |
1418 host->chrome().setWindowRect(adjustWindowRect(*frame(), windowRect)); | 1421 host->chrome().setWindowRect(adjustWindowRect(*frame(), windowRect)); |
1419 } | 1422 } |
1420 | 1423 |
1421 void LocalDOMWindow::moveTo(int x, int y, bool hasX, bool hasY) const | 1424 void LocalDOMWindow::moveTo(int x, int y, bool hasX, bool hasY) const |
1422 { | 1425 { |
1426 if (!hasX || !hasY) | |
1427 UseCounter::count(document(), UseCounter::WindowMoveResizeMissingArgumen ts); | |
1428 | |
1423 if (!frame() || !frame()->isMainFrame()) | 1429 if (!frame() || !frame()->isMainFrame()) |
1424 return; | 1430 return; |
1425 | 1431 |
1426 FrameHost* host = frame()->host(); | 1432 FrameHost* host = frame()->host(); |
1427 if (!host) | 1433 if (!host) |
1428 return; | 1434 return; |
1429 | 1435 |
1430 IntRect windowRect = host->chrome().windowRect(); | 1436 IntRect windowRect = host->chrome().windowRect(); |
1431 windowRect.setLocation(IntPoint(hasX ? x : windowRect.x(), hasY ? y : window Rect.y())); | 1437 windowRect.setLocation(IntPoint(hasX ? x : windowRect.x(), hasY ? y : window Rect.y())); |
1432 // Security check (the spec talks about UniversalBrowserWrite to disable thi s check...) | 1438 // Security check (the spec talks about UniversalBrowserWrite to disable thi s check...) |
1433 host->chrome().setWindowRect(adjustWindowRect(*frame(), windowRect)); | 1439 host->chrome().setWindowRect(adjustWindowRect(*frame(), windowRect)); |
1434 } | 1440 } |
1435 | 1441 |
1436 void LocalDOMWindow::resizeBy(int x, int y) const | 1442 void LocalDOMWindow::resizeBy(int x, int y, bool hasX, bool hasY) const |
1437 { | 1443 { |
1444 if (!hasX || !hasY) | |
1445 UseCounter::count(document(), UseCounter::WindowMoveResizeMissingArgumen ts); | |
1446 | |
1438 if (!frame() || !frame()->isMainFrame()) | 1447 if (!frame() || !frame()->isMainFrame()) |
1439 return; | 1448 return; |
1440 | 1449 |
1441 FrameHost* host = frame()->host(); | 1450 FrameHost* host = frame()->host(); |
1442 if (!host) | 1451 if (!host) |
1443 return; | 1452 return; |
1444 | 1453 |
1445 IntRect fr = host->chrome().windowRect(); | 1454 IntRect fr = host->chrome().windowRect(); |
1446 IntSize dest = fr.size() + IntSize(x, y); | 1455 IntSize dest = fr.size() + IntSize(x, y); |
1447 IntRect update(fr.location(), dest); | 1456 IntRect update(fr.location(), dest); |
1448 host->chrome().setWindowRect(adjustWindowRect(*frame(), update)); | 1457 host->chrome().setWindowRect(adjustWindowRect(*frame(), update)); |
1449 } | 1458 } |
1450 | 1459 |
1451 void LocalDOMWindow::resizeTo(int width, int height, bool hasWidth, bool hasHeig ht) const | 1460 void LocalDOMWindow::resizeTo(int width, int height, bool hasWidth, bool hasHeig ht) const |
1452 { | 1461 { |
1462 if (!hasWidth || !hasHeight) | |
1463 UseCounter::count(document(), UseCounter::WindowMoveResizeMissingArgumen ts); | |
1464 | |
1453 if (!frame() || !frame()->isMainFrame()) | 1465 if (!frame() || !frame()->isMainFrame()) |
1454 return; | 1466 return; |
1455 | 1467 |
1456 FrameHost* host = frame()->host(); | 1468 FrameHost* host = frame()->host(); |
1457 if (!host) | 1469 if (!host) |
1458 return; | 1470 return; |
1459 | 1471 |
1460 IntRect fr = host->chrome().windowRect(); | 1472 IntRect fr = host->chrome().windowRect(); |
1461 IntSize dest = IntSize(hasWidth ? width : fr.width(), hasHeight ? height : f r.height()); | 1473 IntSize dest = IntSize(hasWidth ? width : fr.width(), hasHeight ? height : f r.height()); |
1462 IntRect update(fr.location(), dest); | 1474 IntRect update(fr.location(), dest); |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1835 return m_frameObserver->frame(); | 1847 return m_frameObserver->frame(); |
1836 } | 1848 } |
1837 | 1849 |
1838 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate) | 1850 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate) |
1839 { | 1851 { |
1840 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. | 1852 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. |
1841 return v8::Handle<v8::Object>(); | 1853 return v8::Handle<v8::Object>(); |
1842 } | 1854 } |
1843 | 1855 |
1844 } // namespace blink | 1856 } // namespace blink |
OLD | NEW |