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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 typedef unsigned MainThreadScrollingReasons; | 43 typedef unsigned MainThreadScrollingReasons; |
44 | 44 |
45 class LocalFrame; | 45 class LocalFrame; |
46 class FrameView; | 46 class FrameView; |
47 class GraphicsLayer; | 47 class GraphicsLayer; |
48 class Page; | 48 class Page; |
49 class Region; | 49 class Region; |
50 class ScrollableArea; | 50 class ScrollableArea; |
51 | 51 |
52 class CORE_EXPORT ScrollingCoordinator { | 52 class CORE_EXPORT ScrollingCoordinator final : public NoBaseWillBeGarbageCollect
edFinalized<ScrollingCoordinator> { |
53 WTF_MAKE_NONCOPYABLE(ScrollingCoordinator); | 53 WTF_MAKE_NONCOPYABLE(ScrollingCoordinator); |
54 public: | 54 public: |
| 55 static PassOwnPtrWillBeRawPtr<ScrollingCoordinator> create(Page*); |
| 56 |
55 ~ScrollingCoordinator(); | 57 ~ScrollingCoordinator(); |
56 | 58 DECLARE_TRACE(); |
57 static PassOwnPtr<ScrollingCoordinator> create(Page*); | |
58 | 59 |
59 void willBeDestroyed(); | 60 void willBeDestroyed(); |
60 | 61 |
61 // Return whether this scrolling coordinator handles scrolling for the given
frame view. | 62 // Return whether this scrolling coordinator handles scrolling for the given
frame view. |
62 bool coordinatesScrollingForFrameView(FrameView*) const; | 63 bool coordinatesScrollingForFrameView(FrameView*) const; |
63 | 64 |
64 // Called when any frame has done its layout. | 65 // Called when any frame has done its layout. |
65 void notifyLayoutUpdated(); | 66 void notifyLayoutUpdated(); |
66 | 67 |
67 void updateAfterCompositingChangeIfNeeded(); | 68 void updateAfterCompositingChangeIfNeeded(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // for the results to be valid. | 120 // for the results to be valid. |
120 void reset(); | 121 void reset(); |
121 | 122 |
122 protected: | 123 protected: |
123 explicit ScrollingCoordinator(Page*); | 124 explicit ScrollingCoordinator(Page*); |
124 | 125 |
125 bool isForRootLayer(ScrollableArea*) const; | 126 bool isForRootLayer(ScrollableArea*) const; |
126 bool isForMainFrame(ScrollableArea*) const; | 127 bool isForMainFrame(ScrollableArea*) const; |
127 bool isForViewport(ScrollableArea*) const; | 128 bool isForViewport(ScrollableArea*) const; |
128 | 129 |
129 Page* m_page; | 130 RawPtrWillBeMember<Page> m_page; |
130 | 131 |
131 // Dirty flags used to idenfity what really needs to be computed after compo
siting is updated. | 132 // Dirty flags used to idenfity what really needs to be computed after compo
siting is updated. |
132 bool m_scrollGestureRegionIsDirty; | 133 bool m_scrollGestureRegionIsDirty; |
133 bool m_touchEventTargetRectsAreDirty; | 134 bool m_touchEventTargetRectsAreDirty; |
134 bool m_shouldScrollOnMainThreadDirty; | 135 bool m_shouldScrollOnMainThreadDirty; |
135 | 136 |
136 private: | 137 private: |
137 bool shouldUpdateAfterCompositingChange() const { return m_scrollGestureRegi
onIsDirty || m_touchEventTargetRectsAreDirty || m_shouldScrollOnMainThreadDirty
|| frameViewIsDirty(); } | 138 bool shouldUpdateAfterCompositingChange() const { return m_scrollGestureRegi
onIsDirty || m_touchEventTargetRectsAreDirty || m_shouldScrollOnMainThreadDirty
|| frameViewIsDirty(); } |
138 | 139 |
139 void setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReaso
ns); | 140 void setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReaso
ns); |
140 | 141 |
141 bool hasVisibleSlowRepaintViewportConstrainedObjects(FrameView*) const; | 142 bool hasVisibleSlowRepaintViewportConstrainedObjects(FrameView*) const; |
142 | 143 |
143 void setShouldHandleScrollGestureOnMainThreadRegion(const Region&); | 144 void setShouldHandleScrollGestureOnMainThreadRegion(const Region&); |
144 void setTouchEventTargetRects(LayerHitTestRects&); | 145 void setTouchEventTargetRects(LayerHitTestRects&); |
145 void computeTouchEventTargetRects(LayerHitTestRects&); | 146 void computeTouchEventTargetRects(LayerHitTestRects&); |
146 | 147 |
147 WebScrollbarLayer* addWebScrollbarLayer(ScrollableArea*, ScrollbarOrientatio
n, PassOwnPtr<WebScrollbarLayer>); | 148 WebScrollbarLayer* addWebScrollbarLayer(ScrollableArea*, ScrollbarOrientatio
n, PassOwnPtr<WebScrollbarLayer>); |
148 WebScrollbarLayer* getWebScrollbarLayer(ScrollableArea*, ScrollbarOrientatio
n); | 149 WebScrollbarLayer* getWebScrollbarLayer(ScrollableArea*, ScrollbarOrientatio
n); |
149 void removeWebScrollbarLayer(ScrollableArea*, ScrollbarOrientation); | 150 void removeWebScrollbarLayer(ScrollableArea*, ScrollbarOrientation); |
150 | 151 |
151 bool frameViewIsDirty() const; | 152 bool frameViewIsDirty() const; |
152 | 153 |
153 using ScrollbarMap = HashMap<ScrollableArea*, OwnPtr<WebScrollbarLayer>>; | 154 using ScrollbarMap = WillBeHeapHashMap<RawPtrWillBeMember<ScrollableArea>, O
wnPtr<WebScrollbarLayer>>; |
154 ScrollbarMap m_horizontalScrollbars; | 155 ScrollbarMap m_horizontalScrollbars; |
155 ScrollbarMap m_verticalScrollbars; | 156 ScrollbarMap m_verticalScrollbars; |
156 HashSet<const DeprecatedPaintLayer*> m_layersWithTouchRects; | 157 HashSet<const DeprecatedPaintLayer*> m_layersWithTouchRects; |
157 bool m_wasFrameScrollable; | 158 bool m_wasFrameScrollable; |
158 | 159 |
159 MainThreadScrollingReasons m_lastMainThreadScrollingReasons; | 160 MainThreadScrollingReasons m_lastMainThreadScrollingReasons; |
160 }; | 161 }; |
161 | 162 |
162 } // namespace blink | 163 } // namespace blink |
163 | 164 |
164 #endif // ScrollingCoordinator_h | 165 #endif // ScrollingCoordinator_h |
OLD | NEW |