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

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

Issue 329303009: Cleanup [RuntimeEnabled] use in Window (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix typo Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/frame/DOMWindow.h ('k') | Source/core/frame/Window.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 return true; 1379 return true;
1380 } 1380 }
1381 1381
1382 if (ScrollableArea::scrollBehaviorFromString(scrollBehaviorString, scrollBeh avior)) 1382 if (ScrollableArea::scrollBehaviorFromString(scrollBehaviorString, scrollBeh avior))
1383 return true; 1383 return true;
1384 1384
1385 exceptionState.throwTypeError("The ScrollBehavior provided is invalid."); 1385 exceptionState.throwTypeError("The ScrollBehavior provided is invalid.");
1386 return false; 1386 return false;
1387 } 1387 }
1388 1388
1389 void DOMWindow::scrollBy(int x, int y, const Dictionary& scrollOptions, Exceptio nState &exceptionState) const 1389 void DOMWindow::scrollBy(int x, int y) const
1390 { 1390 {
1391 ScrollBehavior scrollBehavior = ScrollBehaviorAuto;
1392 if (RuntimeEnabledFeatures::cssomSmoothScrollEnabled() && !scrollBehaviorFro mScrollOptions(scrollOptions, scrollBehavior, exceptionState))
1393 return;
1394
1395 if (!isCurrentlyDisplayedInFrame()) 1391 if (!isCurrentlyDisplayedInFrame())
1396 return; 1392 return;
1397 1393
1398 document()->updateLayoutIgnorePendingStylesheets(); 1394 document()->updateLayoutIgnorePendingStylesheets();
1399 1395
1400 FrameView* view = m_frame->view(); 1396 FrameView* view = m_frame->view();
1401 if (!view) 1397 if (!view)
1402 return; 1398 return;
1403 1399
1404 IntSize scaledOffset(x * m_frame->pageZoomFactor(), y * m_frame->pageZoomFac tor()); 1400 IntSize scaledOffset(x * m_frame->pageZoomFactor(), y * m_frame->pageZoomFac tor());
1405 // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instant ly. 1401 // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instant ly.
1406 view->scrollBy(scaledOffset); 1402 view->scrollBy(scaledOffset);
1407 } 1403 }
1408 1404
1409 void DOMWindow::scrollTo(int x, int y, const Dictionary& scrollOptions, Exceptio nState& exceptionState) const 1405 void DOMWindow::scrollBy(int x, int y, const Dictionary& scrollOptions, Exceptio nState &exceptionState) const
1410 { 1406 {
1411 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; 1407 ScrollBehavior scrollBehavior = ScrollBehaviorAuto;
1412 if (RuntimeEnabledFeatures::cssomSmoothScrollEnabled() && !scrollBehaviorFro mScrollOptions(scrollOptions, scrollBehavior, exceptionState)) 1408 if (!scrollBehaviorFromScrollOptions(scrollOptions, scrollBehavior, exceptio nState))
1413 return; 1409 return;
1410 scrollBy(x, y);
1411 }
1414 1412
1413 void DOMWindow::scrollTo(int x, int y) const
1414 {
1415 if (!isCurrentlyDisplayedInFrame()) 1415 if (!isCurrentlyDisplayedInFrame())
1416 return; 1416 return;
1417 1417
1418 document()->updateLayoutIgnorePendingStylesheets(); 1418 document()->updateLayoutIgnorePendingStylesheets();
1419 1419
1420 RefPtr<FrameView> view = m_frame->view(); 1420 RefPtr<FrameView> view = m_frame->view();
1421 if (!view) 1421 if (!view)
1422 return; 1422 return;
1423 1423
1424 IntPoint layoutPos(x * m_frame->pageZoomFactor(), y * m_frame->pageZoomFacto r()); 1424 IntPoint layoutPos(x * m_frame->pageZoomFactor(), y * m_frame->pageZoomFacto r());
1425 // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instant ly. 1425 // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instant ly.
1426 view->setScrollPosition(layoutPos); 1426 view->setScrollPosition(layoutPos);
1427 } 1427 }
1428 1428
1429 void DOMWindow::scrollTo(int x, int y, const Dictionary& scrollOptions, Exceptio nState& exceptionState) const
1430 {
1431 ScrollBehavior scrollBehavior = ScrollBehaviorAuto;
1432 if (!scrollBehaviorFromScrollOptions(scrollOptions, scrollBehavior, exceptio nState))
1433 return;
1434 scrollTo(x, y);
1435 }
1436
1429 void DOMWindow::moveBy(float x, float y) const 1437 void DOMWindow::moveBy(float x, float y) const
1430 { 1438 {
1431 if (!m_frame || !m_frame->isMainFrame()) 1439 if (!m_frame || !m_frame->isMainFrame())
1432 return; 1440 return;
1433 1441
1434 FrameHost* host = m_frame->host(); 1442 FrameHost* host = m_frame->host();
1435 if (!host) 1443 if (!host)
1436 return; 1444 return;
1437 1445
1438 FloatRect windowRect = host->chrome().windowRect(); 1446 FloatRect windowRect = host->chrome().windowRect();
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1922 visitor->trace(m_localStorage); 1930 visitor->trace(m_localStorage);
1923 visitor->trace(m_applicationCache); 1931 visitor->trace(m_applicationCache);
1924 visitor->trace(m_performance); 1932 visitor->trace(m_performance);
1925 visitor->trace(m_css); 1933 visitor->trace(m_css);
1926 visitor->trace(m_eventQueue); 1934 visitor->trace(m_eventQueue);
1927 WillBeHeapSupplementable<DOMWindow>::trace(visitor); 1935 WillBeHeapSupplementable<DOMWindow>::trace(visitor);
1928 EventTargetWithInlineData::trace(visitor); 1936 EventTargetWithInlineData::trace(visitor);
1929 } 1937 }
1930 1938
1931 } // namespace WebCore 1939 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/frame/DOMWindow.h ('k') | Source/core/frame/Window.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698