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

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

Issue 886463010: Make arguments to window.{move,resize}{To,By} non-optional (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 FrameHost* host = frame()->host(); 1407 FrameHost* host = frame()->host();
1408 if (!host) 1408 if (!host)
1409 return; 1409 return;
1410 1410
1411 IntRect windowRect = host->chrome().windowRect(); 1411 IntRect windowRect = host->chrome().windowRect();
1412 windowRect.move(x, y); 1412 windowRect.move(x, y);
1413 // Security check (the spec talks about UniversalBrowserWrite to disable thi s check...) 1413 // Security check (the spec talks about UniversalBrowserWrite to disable thi s check...)
1414 host->chrome().setWindowRect(adjustWindowRect(*frame(), windowRect)); 1414 host->chrome().setWindowRect(adjustWindowRect(*frame(), windowRect));
1415 } 1415 }
1416 1416
1417 void LocalDOMWindow::moveTo(int x, int y, bool hasX, bool hasY) const 1417 void LocalDOMWindow::moveTo(int x, int y) const
1418 { 1418 {
1419 if (!frame() || !frame()->isMainFrame()) 1419 if (!frame() || !frame()->isMainFrame())
1420 return; 1420 return;
1421 1421
1422 FrameHost* host = frame()->host(); 1422 FrameHost* host = frame()->host();
1423 if (!host) 1423 if (!host)
1424 return; 1424 return;
1425 1425
1426 IntRect windowRect = host->chrome().windowRect(); 1426 IntRect windowRect = host->chrome().windowRect();
1427 windowRect.setLocation(IntPoint(hasX ? x : windowRect.x(), hasY ? y : window Rect.y())); 1427 windowRect.setLocation(IntPoint(x, y));
1428 // Security check (the spec talks about UniversalBrowserWrite to disable thi s check...) 1428 // Security check (the spec talks about UniversalBrowserWrite to disable thi s check...)
1429 host->chrome().setWindowRect(adjustWindowRect(*frame(), windowRect)); 1429 host->chrome().setWindowRect(adjustWindowRect(*frame(), windowRect));
1430 } 1430 }
1431 1431
1432 void LocalDOMWindow::resizeBy(int x, int y) const 1432 void LocalDOMWindow::resizeBy(int x, int y) const
1433 { 1433 {
1434 if (!frame() || !frame()->isMainFrame()) 1434 if (!frame() || !frame()->isMainFrame())
1435 return; 1435 return;
1436 1436
1437 FrameHost* host = frame()->host(); 1437 FrameHost* host = frame()->host();
1438 if (!host) 1438 if (!host)
1439 return; 1439 return;
1440 1440
1441 IntRect fr = host->chrome().windowRect(); 1441 IntRect fr = host->chrome().windowRect();
1442 IntSize dest = fr.size() + IntSize(x, y); 1442 IntSize dest = fr.size() + IntSize(x, y);
1443 IntRect update(fr.location(), dest); 1443 IntRect update(fr.location(), dest);
1444 host->chrome().setWindowRect(adjustWindowRect(*frame(), update)); 1444 host->chrome().setWindowRect(adjustWindowRect(*frame(), update));
1445 } 1445 }
1446 1446
1447 void LocalDOMWindow::resizeTo(int width, int height, bool hasWidth, bool hasHeig ht) const 1447 void LocalDOMWindow::resizeTo(int width, int height) const
1448 { 1448 {
1449 if (!frame() || !frame()->isMainFrame()) 1449 if (!frame() || !frame()->isMainFrame())
1450 return; 1450 return;
1451 1451
1452 FrameHost* host = frame()->host(); 1452 FrameHost* host = frame()->host();
1453 if (!host) 1453 if (!host)
1454 return; 1454 return;
1455 1455
1456 IntRect fr = host->chrome().windowRect(); 1456 IntRect fr = host->chrome().windowRect();
1457 IntSize dest = IntSize(hasWidth ? width : fr.width(), hasHeight ? height : f r.height()); 1457 IntSize dest = IntSize(width, height);
1458 IntRect update(fr.location(), dest); 1458 IntRect update(fr.location(), dest);
1459 host->chrome().setWindowRect(adjustWindowRect(*frame(), update)); 1459 host->chrome().setWindowRect(adjustWindowRect(*frame(), update));
1460 } 1460 }
1461 1461
1462 int LocalDOMWindow::requestAnimationFrame(RequestAnimationFrameCallback* callbac k) 1462 int LocalDOMWindow::requestAnimationFrame(RequestAnimationFrameCallback* callbac k)
1463 { 1463 {
1464 callback->m_useLegacyTimeBase = false; 1464 callback->m_useLegacyTimeBase = false;
1465 if (Document* d = document()) 1465 if (Document* d = document())
1466 return d->requestAnimationFrame(callback); 1466 return d->requestAnimationFrame(callback);
1467 return 0; 1467 return 0;
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
1831 return m_frameObserver->frame(); 1831 return m_frameObserver->frame();
1832 } 1832 }
1833 1833
1834 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate) 1834 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate)
1835 { 1835 {
1836 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. 1836 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8].
1837 return v8::Handle<v8::Object>(); 1837 return v8::Handle<v8::Object>();
1838 } 1838 }
1839 1839
1840 } // namespace blink 1840 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698