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

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

Issue 134443003: Implement CSSOM Smooth Scroll API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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/LocalDOMWindow.h ('k') | Source/core/html/HTMLBodyElement.h » ('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 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 return true; 1377 return true;
1378 } 1378 }
1379 1379
1380 if (ScrollableArea::scrollBehaviorFromString(scrollBehaviorString, scrollBeh avior)) 1380 if (ScrollableArea::scrollBehaviorFromString(scrollBehaviorString, scrollBeh avior))
1381 return true; 1381 return true;
1382 1382
1383 exceptionState.throwTypeError("The ScrollBehavior provided is invalid."); 1383 exceptionState.throwTypeError("The ScrollBehavior provided is invalid.");
1384 return false; 1384 return false;
1385 } 1385 }
1386 1386
1387 void LocalDOMWindow::scrollBy(int x, int y) const 1387 void LocalDOMWindow::scrollBy(int x, int y, ScrollBehavior scrollBehavior) const
1388 { 1388 {
1389 if (!isCurrentlyDisplayedInFrame()) 1389 if (!isCurrentlyDisplayedInFrame())
1390 return; 1390 return;
1391 1391
1392 document()->updateLayoutIgnorePendingStylesheets(); 1392 document()->updateLayoutIgnorePendingStylesheets();
1393 1393
1394 FrameView* view = m_frame->view(); 1394 FrameView* view = m_frame->view();
1395 if (!view) 1395 if (!view)
1396 return; 1396 return;
1397 1397
1398 IntSize scaledOffset(x * m_frame->pageZoomFactor(), y * m_frame->pageZoomFac tor()); 1398 IntSize scaledOffset(x * m_frame->pageZoomFactor(), y * m_frame->pageZoomFac tor());
1399 // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instant ly. 1399 // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instant ly.
1400 view->scrollBy(scaledOffset); 1400 view->scrollBy(scaledOffset, scrollBehavior);
1401 } 1401 }
1402 1402
1403 void LocalDOMWindow::scrollBy(int x, int y, const Dictionary& scrollOptions, Exc eptionState &exceptionState) const 1403 void LocalDOMWindow::scrollBy(int x, int y, const Dictionary& scrollOptions, Exc eptionState &exceptionState) const
1404 { 1404 {
1405 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; 1405 ScrollBehavior scrollBehavior = ScrollBehaviorAuto;
1406 if (!scrollBehaviorFromScrollOptions(scrollOptions, scrollBehavior, exceptio nState)) 1406 if (!scrollBehaviorFromScrollOptions(scrollOptions, scrollBehavior, exceptio nState))
1407 return; 1407 return;
1408 scrollBy(x, y); 1408 scrollBy(x, y, scrollBehavior);
1409 } 1409 }
1410 1410
1411 void LocalDOMWindow::scrollTo(int x, int y) const 1411 void LocalDOMWindow::scrollTo(int x, int y, ScrollBehavior scrollBehavior) const
1412 { 1412 {
1413 if (!isCurrentlyDisplayedInFrame()) 1413 if (!isCurrentlyDisplayedInFrame())
1414 return; 1414 return;
1415 1415
1416 document()->updateLayoutIgnorePendingStylesheets(); 1416 document()->updateLayoutIgnorePendingStylesheets();
1417 1417
1418 RefPtr<FrameView> view = m_frame->view(); 1418 RefPtr<FrameView> view = m_frame->view();
1419 if (!view) 1419 if (!view)
1420 return; 1420 return;
1421 1421
1422 IntPoint layoutPos(x * m_frame->pageZoomFactor(), y * m_frame->pageZoomFacto r()); 1422 IntPoint layoutPos(x * m_frame->pageZoomFactor(), y * m_frame->pageZoomFacto r());
1423 // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instant ly. 1423 // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instant ly.
1424 view->setScrollPosition(layoutPos); 1424 view->setScrollPosition(layoutPos, scrollBehavior);
1425 } 1425 }
1426 1426
1427 void LocalDOMWindow::scrollTo(int x, int y, const Dictionary& scrollOptions, Exc eptionState& exceptionState) const 1427 void LocalDOMWindow::scrollTo(int x, int y, const Dictionary& scrollOptions, Exc eptionState& exceptionState) const
1428 { 1428 {
1429 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; 1429 ScrollBehavior scrollBehavior = ScrollBehaviorAuto;
1430 if (!scrollBehaviorFromScrollOptions(scrollOptions, scrollBehavior, exceptio nState)) 1430 if (!scrollBehaviorFromScrollOptions(scrollOptions, scrollBehavior, exceptio nState))
1431 return; 1431 return;
1432 scrollTo(x, y); 1432 scrollTo(x, y, scrollBehavior);
1433 } 1433 }
1434 1434
1435 void LocalDOMWindow::moveBy(float x, float y) const 1435 void LocalDOMWindow::moveBy(float x, float y) const
1436 { 1436 {
1437 if (!m_frame || !m_frame->isMainFrame()) 1437 if (!m_frame || !m_frame->isMainFrame())
1438 return; 1438 return;
1439 1439
1440 FrameHost* host = m_frame->host(); 1440 FrameHost* host = m_frame->host();
1441 if (!host) 1441 if (!host)
1442 return; 1442 return;
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
1942 visitor->trace(m_localStorage); 1942 visitor->trace(m_localStorage);
1943 visitor->trace(m_applicationCache); 1943 visitor->trace(m_applicationCache);
1944 visitor->trace(m_performance); 1944 visitor->trace(m_performance);
1945 visitor->trace(m_css); 1945 visitor->trace(m_css);
1946 visitor->trace(m_eventQueue); 1946 visitor->trace(m_eventQueue);
1947 WillBeHeapSupplementable<LocalDOMWindow>::trace(visitor); 1947 WillBeHeapSupplementable<LocalDOMWindow>::trace(visitor);
1948 EventTargetWithInlineData::trace(visitor); 1948 EventTargetWithInlineData::trace(visitor);
1949 } 1949 }
1950 1950
1951 } // namespace WebCore 1951 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/frame/LocalDOMWindow.h ('k') | Source/core/html/HTMLBodyElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698