OLD | NEW |
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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/ScrollAnimatorBase.h" | 56 #include "platform/scroll/ScrollAnimatorBase.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/WebCompositorAnimationTimeline.h" |
60 #include "public/platform/WebCompositorSupport.h" | 60 #include "public/platform/WebCompositorSupport.h" |
61 #include "public/platform/WebLayerPositionConstraint.h" | 61 #include "public/platform/WebLayerPositionConstraint.h" |
| 62 #include "public/platform/WebLayerTreeView.h" |
62 #include "public/platform/WebScrollbarLayer.h" | 63 #include "public/platform/WebScrollbarLayer.h" |
63 #include "public/platform/WebScrollbarThemeGeometry.h" | 64 #include "public/platform/WebScrollbarThemeGeometry.h" |
64 #include "public/platform/WebScrollbarThemePainter.h" | 65 #include "public/platform/WebScrollbarThemePainter.h" |
65 #include "wtf/text/StringBuilder.h" | 66 #include "wtf/text/StringBuilder.h" |
66 | 67 |
67 using blink::WebLayer; | 68 using blink::WebLayer; |
68 using blink::WebLayerPositionConstraint; | 69 using blink::WebLayerPositionConstraint; |
69 using blink::WebRect; | 70 using blink::WebRect; |
70 using blink::WebScrollbarLayer; | 71 using blink::WebScrollbarLayer; |
71 using blink::WebVector; | 72 using blink::WebVector; |
(...skipping 15 matching lines...) Expand all Loading... |
87 } | 88 } |
88 | 89 |
89 ScrollingCoordinator::ScrollingCoordinator(Page* page) | 90 ScrollingCoordinator::ScrollingCoordinator(Page* page) |
90 : m_page(page) | 91 : m_page(page) |
91 , m_scrollGestureRegionIsDirty(false) | 92 , m_scrollGestureRegionIsDirty(false) |
92 , m_touchEventTargetRectsAreDirty(false) | 93 , m_touchEventTargetRectsAreDirty(false) |
93 , m_shouldScrollOnMainThreadDirty(false) | 94 , m_shouldScrollOnMainThreadDirty(false) |
94 , m_wasFrameScrollable(false) | 95 , m_wasFrameScrollable(false) |
95 , m_lastMainThreadScrollingReasons(0) | 96 , m_lastMainThreadScrollingReasons(0) |
96 { | 97 { |
97 createProgrammaticScrollAnimatorTimeline(); | |
98 } | 98 } |
99 | 99 |
100 ScrollingCoordinator::~ScrollingCoordinator() | 100 ScrollingCoordinator::~ScrollingCoordinator() |
101 { | 101 { |
102 ASSERT(!m_page); | 102 ASSERT(!m_page); |
103 } | 103 } |
104 | 104 |
105 DEFINE_TRACE(ScrollingCoordinator) | 105 DEFINE_TRACE(ScrollingCoordinator) |
106 { | 106 { |
107 visitor->trace(m_page); | 107 visitor->trace(m_page); |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(MainTh
readScrollingReasons reasons) | 713 void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(MainTh
readScrollingReasons reasons) |
714 { | 714 { |
715 if (!m_page->mainFrame()->isLocalFrame() || !m_page->deprecatedLocalMainFram
e()->view()) | 715 if (!m_page->mainFrame()->isLocalFrame() || !m_page->deprecatedLocalMainFram
e()->view()) |
716 return; | 716 return; |
717 if (WebLayer* scrollLayer = toWebLayer(m_page->deprecatedLocalMainFrame()->v
iew()->layerForScrolling())) { | 717 if (WebLayer* scrollLayer = toWebLayer(m_page->deprecatedLocalMainFrame()->v
iew()->layerForScrolling())) { |
718 m_lastMainThreadScrollingReasons = reasons; | 718 m_lastMainThreadScrollingReasons = reasons; |
719 scrollLayer->setShouldScrollOnMainThread(reasons); | 719 scrollLayer->setShouldScrollOnMainThread(reasons); |
720 } | 720 } |
721 } | 721 } |
722 | 722 |
723 void ScrollingCoordinator::willCloseLayerTreeView() | 723 void ScrollingCoordinator::layerTreeViewInitialized(WebLayerTreeView& layerTreeV
iew) |
724 { | 724 { |
725 destroyProgrammaticScrollAnimatorTimeline(); | 725 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled() && Platfor
m::current()->isThreadedAnimationEnabled()) { |
| 726 ASSERT(Platform::current()->compositorSupport()); |
| 727 m_programmaticScrollAnimatorTimeline = adoptPtr(Platform::current()->com
positorSupport()->createAnimationTimeline()); |
| 728 layerTreeView.attachCompositorAnimationTimeline(m_programmaticScrollAnim
atorTimeline.get()); |
| 729 } |
| 730 } |
| 731 |
| 732 void ScrollingCoordinator::willCloseLayerTreeView(WebLayerTreeView& layerTreeVie
w) |
| 733 { |
| 734 if (m_programmaticScrollAnimatorTimeline) { |
| 735 layerTreeView.detachCompositorAnimationTimeline(m_programmaticScrollAnim
atorTimeline.get()); |
| 736 m_programmaticScrollAnimatorTimeline.clear(); |
| 737 } |
726 } | 738 } |
727 | 739 |
728 void ScrollingCoordinator::willBeDestroyed() | 740 void ScrollingCoordinator::willBeDestroyed() |
729 { | 741 { |
730 ASSERT(m_page); | 742 ASSERT(m_page); |
731 | 743 |
732 destroyProgrammaticScrollAnimatorTimeline(); | |
733 | |
734 m_page = nullptr; | 744 m_page = nullptr; |
735 for (const auto& scrollbar : m_horizontalScrollbars) | 745 for (const auto& scrollbar : m_horizontalScrollbars) |
736 GraphicsLayer::unregisterContentsLayer(scrollbar.value->layer()); | 746 GraphicsLayer::unregisterContentsLayer(scrollbar.value->layer()); |
737 for (const auto& scrollbar : m_verticalScrollbars) | 747 for (const auto& scrollbar : m_verticalScrollbars) |
738 GraphicsLayer::unregisterContentsLayer(scrollbar.value->layer()); | 748 GraphicsLayer::unregisterContentsLayer(scrollbar.value->layer()); |
739 } | 749 } |
740 | 750 |
741 bool ScrollingCoordinator::coordinatesScrollingForFrameView(FrameView* frameView
) const | 751 bool ScrollingCoordinator::coordinatesScrollingForFrameView(FrameView* frameView
) const |
742 { | 752 { |
743 ASSERT(isMainThread()); | 753 ASSERT(isMainThread()); |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 FrameView* frameView = m_page->mainFrame()->isLocalFrame() ? m_page->depreca
tedLocalMainFrame()->view() : nullptr; | 1078 FrameView* frameView = m_page->mainFrame()->isLocalFrame() ? m_page->depreca
tedLocalMainFrame()->view() : nullptr; |
1069 bool frameIsScrollable = frameView && frameView->isScrollable(); | 1079 bool frameIsScrollable = frameView && frameView->isScrollable(); |
1070 if (frameIsScrollable != m_wasFrameScrollable) | 1080 if (frameIsScrollable != m_wasFrameScrollable) |
1071 return true; | 1081 return true; |
1072 | 1082 |
1073 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : nullptr) | 1083 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : nullptr) |
1074 return WebSize(frameView->contentsSize()) != scrollLayer->bounds(); | 1084 return WebSize(frameView->contentsSize()) != scrollLayer->bounds(); |
1075 return false; | 1085 return false; |
1076 } | 1086 } |
1077 | 1087 |
1078 void ScrollingCoordinator::createProgrammaticScrollAnimatorTimeline() | |
1079 { | |
1080 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled() && Platfor
m::current()->isThreadedAnimationEnabled()) { | |
1081 ASSERT(m_page); | |
1082 if (m_page->mainFrame()->isLocalFrame()) { | |
1083 ASSERT(Platform::current()->compositorSupport()); | |
1084 m_programmaticScrollAnimatorTimeline = adoptPtr(Platform::current()-
>compositorSupport()->createAnimationTimeline()); | |
1085 m_page->chromeClient().attachCompositorAnimationTimeline(m_programma
ticScrollAnimatorTimeline.get(), toLocalFrame(m_page->mainFrame())); | |
1086 } | |
1087 } | |
1088 } | |
1089 | |
1090 void ScrollingCoordinator::destroyProgrammaticScrollAnimatorTimeline() | |
1091 { | |
1092 if (m_programmaticScrollAnimatorTimeline) { | |
1093 ASSERT(m_page); | |
1094 ASSERT(m_page->mainFrame()->isLocalFrame()); | |
1095 m_page->chromeClient().detachCompositorAnimationTimeline(m_programmaticS
crollAnimatorTimeline.get(), toLocalFrame(m_page->mainFrame())); | |
1096 m_programmaticScrollAnimatorTimeline.clear(); | |
1097 } | |
1098 } | |
1099 | |
1100 } // namespace blink | 1088 } // namespace blink |
OLD | NEW |