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

Side by Side Diff: Source/core/page/scrolling/ScrollingCoordinator.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) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 GraphicsLayer* horizontalScrollbarLayer = horizontalScrollbarLayerForScr ollableArea(scrollableArea); 373 GraphicsLayer* horizontalScrollbarLayer = horizontalScrollbarLayerForScr ollableArea(scrollableArea);
374 if (horizontalScrollbarLayer) 374 if (horizontalScrollbarLayer)
375 setupScrollbarLayer(horizontalScrollbarLayer, scrollbarLayer, webLay er, containerLayer); 375 setupScrollbarLayer(horizontalScrollbarLayer, scrollbarLayer, webLay er, containerLayer);
376 } 376 }
377 if (WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea, VerticalScrollbar)) { 377 if (WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea, VerticalScrollbar)) {
378 GraphicsLayer* verticalScrollbarLayer = verticalScrollbarLayerForScrolla bleArea(scrollableArea); 378 GraphicsLayer* verticalScrollbarLayer = verticalScrollbarLayerForScrolla bleArea(scrollableArea);
379 if (verticalScrollbarLayer) 379 if (verticalScrollbarLayer)
380 setupScrollbarLayer(verticalScrollbarLayer, scrollbarLayer, webLayer , containerLayer); 380 setupScrollbarLayer(verticalScrollbarLayer, scrollbarLayer, webLayer , containerLayer);
381 } 381 }
382 382
383 scrollableArea->layerForScrollingDidChange();
383 return !!webLayer; 384 return !!webLayer;
384 } 385 }
385 386
386 // In order to do a DFS cross-frame walk of the RenderLayer tree, we need to kno w which 387 // In order to do a DFS cross-frame walk of the RenderLayer tree, we need to kno w which
387 // RenderLayers have child frames inside of them. This computes a mapping for th e 388 // RenderLayers have child frames inside of them. This computes a mapping for th e
388 // current frame which we can consult while walking the layers of that frame. 389 // current frame which we can consult while walking the layers of that frame.
389 // Whenever we descend into a new frame, a new map will be created. 390 // Whenever we descend into a new frame, a new map will be created.
390 typedef HashMap<const RenderLayer*, Vector<const Frame*> > LayerFrameMap; 391 typedef HashMap<const RenderLayer*, Vector<const Frame*> > LayerFrameMap;
391 static void makeLayerChildFrameMap(const Frame* currentFrame, LayerFrameMap* map ) 392 static void makeLayerChildFrameMap(const Frame* currentFrame, LayerFrameMap* map )
392 { 393 {
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 631
631 void ScrollingCoordinator::recomputeWheelEventHandlerCountForFrameView(FrameView *) 632 void ScrollingCoordinator::recomputeWheelEventHandlerCountForFrameView(FrameView *)
632 { 633 {
633 setWheelEventHandlerCount(computeCurrentWheelEventHandlerCount()); 634 setWheelEventHandlerCount(computeCurrentWheelEventHandlerCount());
634 } 635 }
635 636
636 void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(MainTh readScrollingReasons reasons) 637 void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(MainTh readScrollingReasons reasons)
637 { 638 {
638 if (WebLayer* scrollLayer = scrollingWebLayerForScrollableArea(m_page->mainF rame()->view())) { 639 if (WebLayer* scrollLayer = scrollingWebLayerForScrollableArea(m_page->mainF rame()->view())) {
639 m_lastMainThreadScrollingReasons = reasons; 640 m_lastMainThreadScrollingReasons = reasons;
640 scrollLayer->setShouldScrollOnMainThread(reasons); 641 bool shouldScrollOnMainThread = reasons;
642 if (shouldScrollOnMainThread != scrollLayer->shouldScrollOnMainThread()) {
643 scrollLayer->setShouldScrollOnMainThread(reasons);
644 m_page->mainFrame()->view()->requiresMainThreadScrollingDidChange();
645 }
641 } 646 }
642 } 647 }
643 648
644 void ScrollingCoordinator::pageDestroyed() 649 void ScrollingCoordinator::pageDestroyed()
645 { 650 {
646 ASSERT(m_page); 651 ASSERT(m_page);
647 m_page = 0; 652 m_page = 0;
648 } 653 }
649 654
650 bool ScrollingCoordinator::coordinatesScrollingForFrameView(FrameView* frameView ) const 655 bool ScrollingCoordinator::coordinatesScrollingForFrameView(FrameView* frameView ) const
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 bool frameIsScrollable = frameView && frameView->isScrollable(); 973 bool frameIsScrollable = frameView && frameView->isScrollable();
969 if (frameIsScrollable != m_wasFrameScrollable) 974 if (frameIsScrollable != m_wasFrameScrollable)
970 return true; 975 return true;
971 976
972 if (WebLayer* scrollLayer = frameView ? scrollingWebLayerForScrollableArea(f rameView) : 0) 977 if (WebLayer* scrollLayer = frameView ? scrollingWebLayerForScrollableArea(f rameView) : 0)
973 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( ); 978 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( );
974 return false; 979 return false;
975 } 980 }
976 981
977 } // namespace WebCore 982 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698