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

Side by Side Diff: Source/core/page/scrolling/ScrollingCoordinator.cpp

Issue 1131833002: [Sketch] Animations: Torpedo the old intrusive animation system. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@scroll
Patch Set: Delete more. Created 5 years, 7 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) 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 89
90 ScrollingCoordinator::ScrollingCoordinator(Page* page) 90 ScrollingCoordinator::ScrollingCoordinator(Page* page)
91 : m_page(page) 91 : m_page(page)
92 , m_scrollGestureRegionIsDirty(false) 92 , m_scrollGestureRegionIsDirty(false)
93 , m_touchEventTargetRectsAreDirty(false) 93 , m_touchEventTargetRectsAreDirty(false)
94 , m_shouldScrollOnMainThreadDirty(false) 94 , m_shouldScrollOnMainThreadDirty(false)
95 , m_wasFrameScrollable(false) 95 , m_wasFrameScrollable(false)
96 , m_lastMainThreadScrollingReasons(0) 96 , m_lastMainThreadScrollingReasons(0)
97 { 97 {
98 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled() && Platfor m::current()->compositorSupport()) { 98 ASSERT(m_page);
99 ASSERT(m_page); 99 ASSERT(m_page->mainFrame()->isLocalFrame());
100 ASSERT(m_page->mainFrame()->isLocalFrame()); 100 m_programmaticScrollAnimatorTimeline = adoptPtr(Platform::current()->composi torSupport()->createAnimationTimeline());
101 m_programmaticScrollAnimatorTimeline = adoptPtr(Platform::current()->com positorSupport()->createAnimationTimeline()); 101 m_page->chrome().client().attachCompositorAnimationTimeline(m_programmaticSc rollAnimatorTimeline.get(), toLocalFrame(m_page->mainFrame()));
102 m_page->chrome().client().attachCompositorAnimationTimeline(m_programmat icScrollAnimatorTimeline.get(), toLocalFrame(m_page->mainFrame()));
103 }
104 } 102 }
105 103
106 ScrollingCoordinator::~ScrollingCoordinator() 104 ScrollingCoordinator::~ScrollingCoordinator()
107 { 105 {
108 } 106 }
109 107
110 void ScrollingCoordinator::setShouldHandleScrollGestureOnMainThreadRegion(const Region& region) 108 void ScrollingCoordinator::setShouldHandleScrollGestureOnMainThreadRegion(const Region& region)
111 { 109 {
112 if (!m_page->mainFrame()->isLocalFrame()) 110 if (!m_page->mainFrame()->isLocalFrame())
113 return; 111 return;
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 return; 704 return;
707 if (WebLayer* scrollLayer = toWebLayer(m_page->deprecatedLocalMainFrame()->v iew()->layerForScrolling())) { 705 if (WebLayer* scrollLayer = toWebLayer(m_page->deprecatedLocalMainFrame()->v iew()->layerForScrolling())) {
708 m_lastMainThreadScrollingReasons = reasons; 706 m_lastMainThreadScrollingReasons = reasons;
709 scrollLayer->setShouldScrollOnMainThread(reasons); 707 scrollLayer->setShouldScrollOnMainThread(reasons);
710 } 708 }
711 } 709 }
712 710
713 void ScrollingCoordinator::willBeDestroyed() 711 void ScrollingCoordinator::willBeDestroyed()
714 { 712 {
715 ASSERT(m_page); 713 ASSERT(m_page);
716 714 ASSERT(m_page->mainFrame()->isLocalFrame());
717 if (m_programmaticScrollAnimatorTimeline) { 715 m_page->chrome().client().detachCompositorAnimationTimeline(m_programmaticSc rollAnimatorTimeline.get(), toLocalFrame(m_page->mainFrame()));
718 ASSERT(m_page->mainFrame()->isLocalFrame());
719 m_page->chrome().client().detachCompositorAnimationTimeline(m_programmat icScrollAnimatorTimeline.get(), toLocalFrame(m_page->mainFrame()));
720 m_programmaticScrollAnimatorTimeline.clear();
721 }
722 716
723 m_page = nullptr; 717 m_page = nullptr;
724 for (const auto& scrollbar : m_horizontalScrollbars) 718 for (const auto& scrollbar : m_horizontalScrollbars)
725 GraphicsLayer::unregisterContentsLayer(scrollbar.value->layer()); 719 GraphicsLayer::unregisterContentsLayer(scrollbar.value->layer());
726 for (const auto& scrollbar : m_verticalScrollbars) 720 for (const auto& scrollbar : m_verticalScrollbars)
727 GraphicsLayer::unregisterContentsLayer(scrollbar.value->layer()); 721 GraphicsLayer::unregisterContentsLayer(scrollbar.value->layer());
728 } 722 }
729 723
730 bool ScrollingCoordinator::coordinatesScrollingForFrameView(FrameView* frameView ) const 724 bool ScrollingCoordinator::coordinatesScrollingForFrameView(FrameView* frameView ) const
731 { 725 {
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 bool frameIsScrollable = frameView && frameView->isScrollable(); 1052 bool frameIsScrollable = frameView && frameView->isScrollable();
1059 if (frameIsScrollable != m_wasFrameScrollable) 1053 if (frameIsScrollable != m_wasFrameScrollable)
1060 return true; 1054 return true;
1061 1055
1062 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : nullptr) 1056 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : nullptr)
1063 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( ); 1057 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( );
1064 return false; 1058 return false;
1065 } 1059 }
1066 1060
1067 } // namespace blink 1061 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/compositing/CompositedDeprecatedPaintLayerMapping.cpp ('k') | Source/platform/RuntimeEnabledFeatures.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698