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

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

Issue 134443003: Implement CSSOM Smooth Scroll API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 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 | Annotate | Revision Log
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 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after
1409 if (!isCurrentlyDisplayedInFrame()) 1409 if (!isCurrentlyDisplayedInFrame())
1410 return; 1410 return;
1411 1411
1412 document()->updateLayoutIgnorePendingStylesheets(); 1412 document()->updateLayoutIgnorePendingStylesheets();
1413 1413
1414 FrameView* view = m_frame->view(); 1414 FrameView* view = m_frame->view();
1415 if (!view) 1415 if (!view)
1416 return; 1416 return;
1417 1417
1418 IntSize scaledOffset(x * m_frame->pageZoomFactor(), y * m_frame->pageZoomFac tor()); 1418 IntSize scaledOffset(x * m_frame->pageZoomFactor(), y * m_frame->pageZoomFac tor());
1419 // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instant ly. 1419 view->scrollBy(scaledOffset, scrollBehavior);
1420 view->scrollBy(scaledOffset);
1421 } 1420 }
1422 1421
1423 void DOMWindow::scrollTo(int x, int y, const Dictionary& scrollOptions, Exceptio nState& exceptionState) const 1422 void DOMWindow::scrollTo(int x, int y, const Dictionary& scrollOptions, Exceptio nState& exceptionState) const
1424 { 1423 {
1425 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; 1424 ScrollBehavior scrollBehavior = ScrollBehaviorAuto;
1426 if (RuntimeEnabledFeatures::cssomSmoothScrollEnabled() && !scrollBehaviorFro mScrollOptions(scrollOptions, scrollBehavior, exceptionState)) 1425 if (RuntimeEnabledFeatures::cssomSmoothScrollEnabled() && !scrollBehaviorFro mScrollOptions(scrollOptions, scrollBehavior, exceptionState))
1427 return; 1426 return;
1428 1427
1429 if (!isCurrentlyDisplayedInFrame()) 1428 if (!isCurrentlyDisplayedInFrame())
1430 return; 1429 return;
1431 1430
1432 document()->updateLayoutIgnorePendingStylesheets(); 1431 document()->updateLayoutIgnorePendingStylesheets();
1433 1432
1434 RefPtr<FrameView> view = m_frame->view(); 1433 RefPtr<FrameView> view = m_frame->view();
1435 if (!view) 1434 if (!view)
1436 return; 1435 return;
1437 1436
1438 IntPoint layoutPos(x * m_frame->pageZoomFactor(), y * m_frame->pageZoomFacto r()); 1437 IntPoint layoutPos(x * m_frame->pageZoomFactor(), y * m_frame->pageZoomFacto r());
1439 // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instant ly. 1438 view->setScrollPosition(layoutPos, scrollBehavior);
1440 view->setScrollPosition(layoutPos);
1441 } 1439 }
1442 1440
1443 void DOMWindow::moveBy(float x, float y) const 1441 void DOMWindow::moveBy(float x, float y) const
1444 { 1442 {
1445 if (!m_frame || !m_frame->isMainFrame()) 1443 if (!m_frame || !m_frame->isMainFrame())
1446 return; 1444 return;
1447 1445
1448 FrameHost* host = m_frame->host(); 1446 FrameHost* host = m_frame->host();
1449 if (!host) 1447 if (!host)
1450 return; 1448 return;
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1890 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<DOMWindow>: :lifecycleNotifier()); 1888 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<DOMWindow>: :lifecycleNotifier());
1891 } 1889 }
1892 1890
1893 PassOwnPtr<LifecycleNotifier<DOMWindow> > DOMWindow::createLifecycleNotifier() 1891 PassOwnPtr<LifecycleNotifier<DOMWindow> > DOMWindow::createLifecycleNotifier()
1894 { 1892 {
1895 return DOMWindowLifecycleNotifier::create(this); 1893 return DOMWindowLifecycleNotifier::create(this);
1896 } 1894 }
1897 1895
1898 1896
1899 } // namespace WebCore 1897 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698