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

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

Issue 234913005: Refactor wheel event handler registration in ScrollingCoordinator (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 bool coordinatesScrollingForFrameView(FrameView*) const; 61 bool coordinatesScrollingForFrameView(FrameView*) const;
62 62
63 // Called when any frame has done its layout. 63 // Called when any frame has done its layout.
64 void notifyLayoutUpdated(); 64 void notifyLayoutUpdated();
65 65
66 // Should be called after compositing has been updated. 66 // Should be called after compositing has been updated.
67 void updateAfterCompositingChange(); 67 void updateAfterCompositingChange();
68 68
69 bool needsToUpdateAfterCompositingChange() const { return m_scrollGestureReg ionIsDirty || m_touchEventTargetRectsAreDirty || frameViewIsDirty(); } 69 bool needsToUpdateAfterCompositingChange() const { return m_scrollGestureReg ionIsDirty || m_touchEventTargetRectsAreDirty || frameViewIsDirty(); }
70 70
71 // Should be called whenever a wheel event handler is added or removed in th e 71 // Should be called whenever the presence of wheel event handlers in the pag e changes.
72 // frame view's underlying document. 72 void haveWheelEventHandlersChangedForPage();
73 void frameViewWheelEventHandlerCountChanged(FrameView*); 73
74 // Should be called whenever the presence of scroll event handlers in the pa ge changes.
75 void haveScrollEventHandlersChangedForPage();
abarth-chromium 2014/04/11 18:53:38 I'd skip these comments. didChangeScrollEventHand
74 76
75 // Should be called whenever the slow repaint objects counter changes betwee n zero and one. 77 // Should be called whenever the slow repaint objects counter changes betwee n zero and one.
76 void frameViewHasSlowRepaintObjectsDidChange(FrameView*); 78 void frameViewHasSlowRepaintObjectsDidChange(FrameView*);
77 79
78 // Should be called whenever the set of fixed objects changes. 80 // Should be called whenever the set of fixed objects changes.
79 void frameViewFixedObjectsDidChange(FrameView*); 81 void frameViewFixedObjectsDidChange(FrameView*);
80 82
81 // Should be called whenever the root layer for the given frame view changes . 83 // Should be called whenever the root layer for the given frame view changes .
82 void frameViewRootLayerDidChange(FrameView*); 84 void frameViewRootLayerDidChange(FrameView*);
83 85
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 119
118 // For testing purposes only. This ScrollingCoordinator is reused between la yout test, and must be reset 120 // For testing purposes only. This ScrollingCoordinator is reused between la yout test, and must be reset
119 // for the results to be valid. 121 // for the results to be valid.
120 void reset(); 122 void reset();
121 123
122 protected: 124 protected:
123 explicit ScrollingCoordinator(Page*); 125 explicit ScrollingCoordinator(Page*);
124 126
125 bool isForMainFrame(ScrollableArea*) const; 127 bool isForMainFrame(ScrollableArea*) const;
126 128
127 unsigned computeCurrentWheelEventHandlerCount();
128 GraphicsLayer* scrollLayerForFrameView(FrameView*); 129 GraphicsLayer* scrollLayerForFrameView(FrameView*);
129 GraphicsLayer* counterScrollingLayerForFrameView(FrameView*); 130 GraphicsLayer* counterScrollingLayerForFrameView(FrameView*);
130 131
131 Page* m_page; 132 Page* m_page;
132 133
133 // Dirty flags used to idenfity what really needs to be computed after compo siting is updated. 134 // Dirty flags used to idenfity what really needs to be computed after compo siting is updated.
134 bool m_scrollGestureRegionIsDirty; 135 bool m_scrollGestureRegionIsDirty;
135 bool m_touchEventTargetRectsAreDirty; 136 bool m_touchEventTargetRectsAreDirty;
136 bool m_shouldScrollOnMainThreadDirty; 137 bool m_shouldScrollOnMainThreadDirty;
137 138
138 private: 139 private:
139 void recomputeWheelEventHandlerCountForFrameView(FrameView*); 140 void updateHaveWheelEventHandlers();
141 void updateHaveScrollEventHandlers();
140 void setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReaso ns); 142 void setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReaso ns);
141 143
142 bool hasVisibleSlowRepaintViewportConstrainedObjects(FrameView*) const; 144 bool hasVisibleSlowRepaintViewportConstrainedObjects(FrameView*) const;
143 145
144 bool touchHitTestingEnabled() const; 146 bool touchHitTestingEnabled() const;
145 void setShouldHandleScrollGestureOnMainThreadRegion(const Region&); 147 void setShouldHandleScrollGestureOnMainThreadRegion(const Region&);
146 void setTouchEventTargetRects(LayerHitTestRects&); 148 void setTouchEventTargetRects(LayerHitTestRects&);
147 void computeTouchEventTargetRects(LayerHitTestRects&); 149 void computeTouchEventTargetRects(LayerHitTestRects&);
148 void setWheelEventHandlerCount(unsigned);
149 150
150 blink::WebScrollbarLayer* addWebScrollbarLayer(ScrollableArea*, ScrollbarOri entation, PassOwnPtr<blink::WebScrollbarLayer>); 151 blink::WebScrollbarLayer* addWebScrollbarLayer(ScrollableArea*, ScrollbarOri entation, PassOwnPtr<blink::WebScrollbarLayer>);
151 blink::WebScrollbarLayer* getWebScrollbarLayer(ScrollableArea*, ScrollbarOri entation); 152 blink::WebScrollbarLayer* getWebScrollbarLayer(ScrollableArea*, ScrollbarOri entation);
152 void removeWebScrollbarLayer(ScrollableArea*, ScrollbarOrientation); 153 void removeWebScrollbarLayer(ScrollableArea*, ScrollbarOrientation);
153 154
154 bool frameViewIsDirty() const; 155 bool frameViewIsDirty() const;
155 156
156 typedef HashMap<ScrollableArea*, OwnPtr<blink::WebScrollbarLayer> > Scrollba rMap; 157 typedef HashMap<ScrollableArea*, OwnPtr<blink::WebScrollbarLayer> > Scrollba rMap;
157 ScrollbarMap m_horizontalScrollbars; 158 ScrollbarMap m_horizontalScrollbars;
158 ScrollbarMap m_verticalScrollbars; 159 ScrollbarMap m_verticalScrollbars;
159 HashSet<const RenderLayer*> m_layersWithTouchRects; 160 HashSet<const RenderLayer*> m_layersWithTouchRects;
160 bool m_wasFrameScrollable; 161 bool m_wasFrameScrollable;
161 162
162 // This is retained for testing. 163 // This is retained for testing.
163 MainThreadScrollingReasons m_lastMainThreadScrollingReasons; 164 MainThreadScrollingReasons m_lastMainThreadScrollingReasons;
164 }; 165 };
165 166
166 } // namespace WebCore 167 } // namespace WebCore
167 168
168 #endif // ScrollingCoordinator_h 169 #endif // ScrollingCoordinator_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698