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

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: More concise. 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 bool coordinatesScrollingForFrameView(FrameView*) const; 62 bool coordinatesScrollingForFrameView(FrameView*) const;
63 63
64 // Called when any frame has done its layout. 64 // Called when any frame has done its layout.
65 void notifyLayoutUpdated(); 65 void notifyLayoutUpdated();
66 66
67 // Should be called after compositing has been updated. 67 // Should be called after compositing has been updated.
68 void updateAfterCompositingChange(); 68 void updateAfterCompositingChange();
69 69
70 bool needsToUpdateAfterCompositingChange() const { return m_scrollGestureReg ionIsDirty || m_touchEventTargetRectsAreDirty || frameViewIsDirty(); } 70 bool needsToUpdateAfterCompositingChange() const { return m_scrollGestureReg ionIsDirty || m_touchEventTargetRectsAreDirty || frameViewIsDirty(); }
71 71
72 // Should be called whenever a wheel event handler is added or removed in th e 72 void updateHaveWheelEventHandlers();
73 // frame view's underlying document. 73 void updateHaveScrollEventHandlers();
74 void frameViewWheelEventHandlerCountChanged(FrameView*);
75 74
76 // Should be called whenever the slow repaint objects counter changes betwee n zero and one. 75 // Should be called whenever the slow repaint objects counter changes betwee n zero and one.
77 void frameViewHasSlowRepaintObjectsDidChange(FrameView*); 76 void frameViewHasSlowRepaintObjectsDidChange(FrameView*);
78 77
79 // Should be called whenever the set of fixed objects changes. 78 // Should be called whenever the set of fixed objects changes.
80 void frameViewFixedObjectsDidChange(FrameView*); 79 void frameViewFixedObjectsDidChange(FrameView*);
81 80
82 // Should be called whenever the root layer for the given frame view changes . 81 // Should be called whenever the root layer for the given frame view changes .
83 void frameViewRootLayerDidChange(FrameView*); 82 void frameViewRootLayerDidChange(FrameView*);
84 83
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 117
119 // For testing purposes only. This ScrollingCoordinator is reused between la yout test, and must be reset 118 // For testing purposes only. This ScrollingCoordinator is reused between la yout test, and must be reset
120 // for the results to be valid. 119 // for the results to be valid.
121 void reset(); 120 void reset();
122 121
123 protected: 122 protected:
124 explicit ScrollingCoordinator(Page*); 123 explicit ScrollingCoordinator(Page*);
125 124
126 bool isForMainFrame(ScrollableArea*) const; 125 bool isForMainFrame(ScrollableArea*) const;
127 126
128 unsigned computeCurrentWheelEventHandlerCount();
129 GraphicsLayer* scrollLayerForFrameView(FrameView*); 127 GraphicsLayer* scrollLayerForFrameView(FrameView*);
130 GraphicsLayer* counterScrollingLayerForFrameView(FrameView*); 128 GraphicsLayer* counterScrollingLayerForFrameView(FrameView*);
131 129
132 Page* m_page; 130 Page* m_page;
133 131
134 // 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.
135 bool m_scrollGestureRegionIsDirty; 133 bool m_scrollGestureRegionIsDirty;
136 bool m_touchEventTargetRectsAreDirty; 134 bool m_touchEventTargetRectsAreDirty;
137 bool m_shouldScrollOnMainThreadDirty; 135 bool m_shouldScrollOnMainThreadDirty;
138 136
139 private: 137 private:
140 void recomputeWheelEventHandlerCountForFrameView(FrameView*);
141 void setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReaso ns); 138 void setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReaso ns);
142 139
143 bool hasVisibleSlowRepaintViewportConstrainedObjects(FrameView*) const; 140 bool hasVisibleSlowRepaintViewportConstrainedObjects(FrameView*) const;
144 141
145 bool touchHitTestingEnabled() const; 142 bool touchHitTestingEnabled() const;
146 void setShouldHandleScrollGestureOnMainThreadRegion(const Region&); 143 void setShouldHandleScrollGestureOnMainThreadRegion(const Region&);
147 void setTouchEventTargetRects(LayerHitTestRects&); 144 void setTouchEventTargetRects(LayerHitTestRects&);
148 void computeTouchEventTargetRects(LayerHitTestRects&); 145 void computeTouchEventTargetRects(LayerHitTestRects&);
149 void setWheelEventHandlerCount(unsigned);
150 146
151 blink::WebScrollbarLayer* addWebScrollbarLayer(ScrollableArea*, ScrollbarOri entation, PassOwnPtr<blink::WebScrollbarLayer>); 147 blink::WebScrollbarLayer* addWebScrollbarLayer(ScrollableArea*, ScrollbarOri entation, PassOwnPtr<blink::WebScrollbarLayer>);
152 blink::WebScrollbarLayer* getWebScrollbarLayer(ScrollableArea*, ScrollbarOri entation); 148 blink::WebScrollbarLayer* getWebScrollbarLayer(ScrollableArea*, ScrollbarOri entation);
153 void removeWebScrollbarLayer(ScrollableArea*, ScrollbarOrientation); 149 void removeWebScrollbarLayer(ScrollableArea*, ScrollbarOrientation);
154 150
155 bool frameViewIsDirty() const; 151 bool frameViewIsDirty() const;
156 152
157 typedef HashMap<ScrollableArea*, OwnPtr<blink::WebScrollbarLayer> > Scrollba rMap; 153 typedef HashMap<ScrollableArea*, OwnPtr<blink::WebScrollbarLayer> > Scrollba rMap;
158 ScrollbarMap m_horizontalScrollbars; 154 ScrollbarMap m_horizontalScrollbars;
159 ScrollbarMap m_verticalScrollbars; 155 ScrollbarMap m_verticalScrollbars;
160 HashSet<const RenderLayer*> m_layersWithTouchRects; 156 HashSet<const RenderLayer*> m_layersWithTouchRects;
161 bool m_wasFrameScrollable; 157 bool m_wasFrameScrollable;
162 158
163 // This is retained for testing. 159 // This is retained for testing.
164 MainThreadScrollingReasons m_lastMainThreadScrollingReasons; 160 MainThreadScrollingReasons m_lastMainThreadScrollingReasons;
165 }; 161 };
166 162
167 } // namespace WebCore 163 } // namespace WebCore
168 164
169 #endif // ScrollingCoordinator_h 165 #endif // ScrollingCoordinator_h
OLDNEW
« no previous file with comments | « Source/core/dom/WheelController.cpp ('k') | Source/core/page/scrolling/ScrollingCoordinator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698