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

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

Issue 1133513002: Animations: Port ProgrammaticScrollAnimator to use compositor timelines (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@linkhigh
Patch Set: Rebase. Created 5 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
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "platform/exported/WebScrollbarThemeGeometryNative.h" 49 #include "platform/exported/WebScrollbarThemeGeometryNative.h"
50 #include "platform/geometry/Region.h" 50 #include "platform/geometry/Region.h"
51 #include "platform/geometry/TransformState.h" 51 #include "platform/geometry/TransformState.h"
52 #include "platform/graphics/GraphicsLayer.h" 52 #include "platform/graphics/GraphicsLayer.h"
53 #if OS(MACOSX) 53 #if OS(MACOSX)
54 #include "platform/mac/ScrollAnimatorMac.h" 54 #include "platform/mac/ScrollAnimatorMac.h"
55 #endif 55 #endif
56 #include "platform/scroll/ScrollAnimator.h" 56 #include "platform/scroll/ScrollAnimator.h"
57 #include "platform/scroll/ScrollbarTheme.h" 57 #include "platform/scroll/ScrollbarTheme.h"
58 #include "public/platform/Platform.h" 58 #include "public/platform/Platform.h"
59 #include "public/platform/WebCompositorAnimationTimeline.h"
59 #include "public/platform/WebCompositorSupport.h" 60 #include "public/platform/WebCompositorSupport.h"
60 #include "public/platform/WebLayerPositionConstraint.h" 61 #include "public/platform/WebLayerPositionConstraint.h"
61 #include "public/platform/WebScrollbarLayer.h" 62 #include "public/platform/WebScrollbarLayer.h"
62 #include "public/platform/WebScrollbarThemeGeometry.h" 63 #include "public/platform/WebScrollbarThemeGeometry.h"
63 #include "public/platform/WebScrollbarThemePainter.h" 64 #include "public/platform/WebScrollbarThemePainter.h"
64 #include "wtf/text/StringBuilder.h" 65 #include "wtf/text/StringBuilder.h"
65 66
66 using blink::WebLayer; 67 using blink::WebLayer;
67 using blink::WebLayerPositionConstraint; 68 using blink::WebLayerPositionConstraint;
68 using blink::WebRect; 69 using blink::WebRect;
(...skipping 17 matching lines...) Expand all
86 } 87 }
87 88
88 ScrollingCoordinator::ScrollingCoordinator(Page* page) 89 ScrollingCoordinator::ScrollingCoordinator(Page* page)
89 : m_page(page) 90 : m_page(page)
90 , m_scrollGestureRegionIsDirty(false) 91 , m_scrollGestureRegionIsDirty(false)
91 , m_touchEventTargetRectsAreDirty(false) 92 , m_touchEventTargetRectsAreDirty(false)
92 , m_shouldScrollOnMainThreadDirty(false) 93 , m_shouldScrollOnMainThreadDirty(false)
93 , m_wasFrameScrollable(false) 94 , m_wasFrameScrollable(false)
94 , m_lastMainThreadScrollingReasons(0) 95 , m_lastMainThreadScrollingReasons(0)
95 { 96 {
97 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled() && Platfor m::current()->compositorSupport()) {
Ian Vollick 2015/07/10 03:06:45 AFAICT, most of the time we assume that compositor
loyso (OOO) 2015/07/22 05:24:23 Done.
98 ASSERT(m_page);
99 ASSERT(m_page->mainFrame()->isLocalFrame());
100 m_programmaticScrollAnimatorTimeline = adoptPtr(Platform::current()->com positorSupport()->createAnimationTimeline());
101 m_page->chromeClient().attachCompositorAnimationTimeline(m_programmaticS crollAnimatorTimeline.get(), toLocalFrame(m_page->mainFrame()));
102 }
96 } 103 }
97 104
98 ScrollingCoordinator::~ScrollingCoordinator() 105 ScrollingCoordinator::~ScrollingCoordinator()
99 { 106 {
100 ASSERT(!m_page); 107 ASSERT(!m_page);
101 } 108 }
102 109
103 DEFINE_TRACE(ScrollingCoordinator) 110 DEFINE_TRACE(ScrollingCoordinator)
104 { 111 {
105 visitor->trace(m_page); 112 visitor->trace(m_page);
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 if (WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea, VerticalScrollbar)) { 435 if (WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea, VerticalScrollbar)) {
429 GraphicsLayer* verticalScrollbarLayer = scrollableArea->layerForVertical Scrollbar(); 436 GraphicsLayer* verticalScrollbarLayer = scrollableArea->layerForVertical Scrollbar();
430 if (verticalScrollbarLayer) 437 if (verticalScrollbarLayer)
431 setupScrollbarLayer(verticalScrollbarLayer, scrollbarLayer, webLayer , containerLayer); 438 setupScrollbarLayer(verticalScrollbarLayer, scrollbarLayer, webLayer , containerLayer);
432 } 439 }
433 440
434 // Update the viewport layer registration if the outer viewport may have cha nged. 441 // Update the viewport layer registration if the outer viewport may have cha nged.
435 if (m_page->settings().rootLayerScrolls() && isForRootLayer(scrollableArea)) 442 if (m_page->settings().rootLayerScrolls() && isForRootLayer(scrollableArea))
436 m_page->chromeClient().registerViewportLayers(); 443 m_page->chromeClient().registerViewportLayers();
437 444
438 scrollableArea->layerForScrollingDidChange(); 445 scrollableArea->layerForScrollingDidChange(m_programmaticScrollAnimatorTimel ine.get());
439 446
440 return !!webLayer; 447 return !!webLayer;
441 } 448 }
442 449
443 using GraphicsLayerHitTestRects = WTF::HashMap<const GraphicsLayer*, Vector<Layo utRect>>; 450 using GraphicsLayerHitTestRects = WTF::HashMap<const GraphicsLayer*, Vector<Layo utRect>>;
444 451
445 // In order to do a DFS cross-frame walk of the Layer tree, we need to know whic h 452 // In order to do a DFS cross-frame walk of the Layer tree, we need to know whic h
446 // Layers have child frames inside of them. This computes a mapping for the 453 // Layers have child frames inside of them. This computes a mapping for the
447 // current frame which we can consult while walking the layers of that frame. 454 // current frame which we can consult while walking the layers of that frame.
448 // Whenever we descend into a new frame, a new map will be created. 455 // Whenever we descend into a new frame, a new map will be created.
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 return; 723 return;
717 if (WebLayer* scrollLayer = toWebLayer(m_page->deprecatedLocalMainFrame()->v iew()->layerForScrolling())) { 724 if (WebLayer* scrollLayer = toWebLayer(m_page->deprecatedLocalMainFrame()->v iew()->layerForScrolling())) {
718 m_lastMainThreadScrollingReasons = reasons; 725 m_lastMainThreadScrollingReasons = reasons;
719 scrollLayer->setShouldScrollOnMainThread(reasons); 726 scrollLayer->setShouldScrollOnMainThread(reasons);
720 } 727 }
721 } 728 }
722 729
723 void ScrollingCoordinator::willBeDestroyed() 730 void ScrollingCoordinator::willBeDestroyed()
724 { 731 {
725 ASSERT(m_page); 732 ASSERT(m_page);
733
734 if (m_programmaticScrollAnimatorTimeline) {
735 ASSERT(m_page->mainFrame()->isLocalFrame());
736 m_page->chromeClient().detachCompositorAnimationTimeline(m_programmaticS crollAnimatorTimeline.get(), toLocalFrame(m_page->mainFrame()));
737 m_programmaticScrollAnimatorTimeline.clear();
738 }
739
726 m_page = nullptr; 740 m_page = nullptr;
727 for (const auto& scrollbar : m_horizontalScrollbars) 741 for (const auto& scrollbar : m_horizontalScrollbars)
728 GraphicsLayer::unregisterContentsLayer(scrollbar.value->layer()); 742 GraphicsLayer::unregisterContentsLayer(scrollbar.value->layer());
729 for (const auto& scrollbar : m_verticalScrollbars) 743 for (const auto& scrollbar : m_verticalScrollbars)
730 GraphicsLayer::unregisterContentsLayer(scrollbar.value->layer()); 744 GraphicsLayer::unregisterContentsLayer(scrollbar.value->layer());
731 } 745 }
732 746
733 bool ScrollingCoordinator::coordinatesScrollingForFrameView(FrameView* frameView ) const 747 bool ScrollingCoordinator::coordinatesScrollingForFrameView(FrameView* frameView ) const
734 { 748 {
735 ASSERT(isMainThread()); 749 ASSERT(isMainThread());
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 bool frameIsScrollable = frameView && frameView->isScrollable(); 1075 bool frameIsScrollable = frameView && frameView->isScrollable();
1062 if (frameIsScrollable != m_wasFrameScrollable) 1076 if (frameIsScrollable != m_wasFrameScrollable)
1063 return true; 1077 return true;
1064 1078
1065 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : nullptr) 1079 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : nullptr)
1066 return WebSize(frameView->contentsSize()) != scrollLayer->bounds(); 1080 return WebSize(frameView->contentsSize()) != scrollLayer->bounds();
1067 return false; 1081 return false;
1068 } 1082 }
1069 1083
1070 } // namespace blink 1084 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698