OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 void ScrollingCoordinatorChromium::frameViewLayoutUpdated(FrameView*) | 109 void ScrollingCoordinatorChromium::frameViewLayoutUpdated(FrameView*) |
110 { | 110 { |
111 ASSERT(m_page); | 111 ASSERT(m_page); |
112 | 112 |
113 // Compute the region of the page that we can't do fast scrolling for. This
currently includes | 113 // Compute the region of the page that we can't do fast scrolling for. This
currently includes |
114 // all scrollable areas, such as subframes, overflow divs and list boxes. We
need to do this even if the | 114 // all scrollable areas, such as subframes, overflow divs and list boxes. We
need to do this even if the |
115 // frame view whose layout was updated is not the main frame. | 115 // frame view whose layout was updated is not the main frame. |
116 Region nonFastScrollableRegion = computeNonFastScrollableRegion(m_page->main
Frame(), IntPoint()); | 116 Region nonFastScrollableRegion = computeNonFastScrollableRegion(m_page->main
Frame(), IntPoint()); |
117 setNonFastScrollableRegion(nonFastScrollableRegion); | 117 setNonFastScrollableRegion(nonFastScrollableRegion); |
118 #if ENABLE(TOUCH_EVENT_TRACKING) | |
119 Vector<IntRect> touchEventTargetRects; | |
120 computeAbsoluteTouchEventTargetRects(m_page->mainFrame()->document(), touchE
ventTargetRects); | |
121 setTouchEventTargetRects(touchEventTargetRects); | |
122 #endif | |
123 } | |
124 | |
125 void ScrollingCoordinatorChromium::touchEventTargetRectsDidChange(const Document
* document) | |
126 { | |
127 #if ENABLE(TOUCH_EVENT_TRACKING) | |
128 // Wait until after layout to update. | |
129 if (m_page->mainFrame()->view()->needsLayout()) | |
130 return; | |
131 | |
132 // We won't necessarily get a setScrollLayer() call before this one, so grab
the root ourselves. | |
133 setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view())); | |
134 if (m_private->scrollLayer()) { | |
135 Vector<IntRect> touchEventTargetRects; | |
136 computeAbsoluteTouchEventTargetRects(document, touchEventTargetRects); | |
137 setTouchEventTargetRects(touchEventTargetRects); | |
138 } | |
139 #else | |
140 UNUSED_PARAM(document); | |
141 #endif | |
142 } | 118 } |
143 | 119 |
144 void ScrollingCoordinatorChromium::frameViewRootLayerDidChange(FrameView* frameV
iew) | 120 void ScrollingCoordinatorChromium::frameViewRootLayerDidChange(FrameView* frameV
iew) |
145 { | 121 { |
146 ScrollingCoordinator::frameViewRootLayerDidChange(frameView); | 122 ScrollingCoordinator::frameViewRootLayerDidChange(frameView); |
147 setScrollLayer(scrollLayerForFrameView(frameView)); | 123 setScrollLayer(scrollLayerForFrameView(frameView)); |
148 } | 124 } |
149 | 125 |
150 static WebLayer* scrollableLayerForGraphicsLayer(GraphicsLayer* layer) | 126 static WebLayer* scrollableLayerForGraphicsLayer(GraphicsLayer* layer) |
151 { | 127 { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view())); | 202 setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view())); |
227 if (m_private->scrollLayer()) { | 203 if (m_private->scrollLayer()) { |
228 Vector<IntRect> rects = region.rects(); | 204 Vector<IntRect> rects = region.rects(); |
229 WebVector<WebRect> webRects(rects.size()); | 205 WebVector<WebRect> webRects(rects.size()); |
230 for (size_t i = 0; i < rects.size(); ++i) | 206 for (size_t i = 0; i < rects.size(); ++i) |
231 webRects[i] = rects[i]; | 207 webRects[i] = rects[i]; |
232 m_private->scrollLayer()->setNonFastScrollableRegion(webRects); | 208 m_private->scrollLayer()->setNonFastScrollableRegion(webRects); |
233 } | 209 } |
234 } | 210 } |
235 | 211 |
236 void ScrollingCoordinatorChromium::setTouchEventTargetRects(const Vector<IntRect
>& absoluteHitTestRects) | |
237 { | |
238 // We won't necessarily get a setScrollLayer() call before this one, so grab
the root ourselves. | |
239 setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view())); | |
240 if (m_private->scrollLayer()) { | |
241 WebVector<WebRect> webRects(absoluteHitTestRects.size()); | |
242 for (size_t i = 0; i < absoluteHitTestRects.size(); ++i) | |
243 webRects[i] = absoluteHitTestRects[i]; | |
244 m_private->scrollLayer()->setTouchEventHandlerRegion(webRects); | |
245 } | |
246 } | |
247 | |
248 void ScrollingCoordinatorChromium::setWheelEventHandlerCount(unsigned wheelEvent
HandlerCount) | 212 void ScrollingCoordinatorChromium::setWheelEventHandlerCount(unsigned wheelEvent
HandlerCount) |
249 { | 213 { |
250 // We won't necessarily get a setScrollLayer() call before this one, so grab
the root ourselves. | 214 // We won't necessarily get a setScrollLayer() call before this one, so grab
the root ourselves. |
251 setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view())); | 215 setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view())); |
252 if (m_private->scrollLayer()) | 216 if (m_private->scrollLayer()) |
253 m_private->scrollLayer()->setHaveWheelEventHandlers(wheelEventHandlerCou
nt > 0); | 217 m_private->scrollLayer()->setHaveWheelEventHandlers(wheelEventHandlerCou
nt > 0); |
254 } | 218 } |
255 | 219 |
256 void ScrollingCoordinatorChromium::setShouldUpdateScrollLayerPositionOnMainThrea
d(MainThreadScrollingReasons reasons) | 220 void ScrollingCoordinatorChromium::setShouldUpdateScrollLayerPositionOnMainThrea
d(MainThreadScrollingReasons reasons) |
257 { | 221 { |
(...skipping 29 matching lines...) Expand all Loading... |
287 } | 251 } |
288 } | 252 } |
289 | 253 |
290 void ScrollingCoordinatorChromium::recomputeWheelEventHandlerCountForFrameView(F
rameView* frameView) | 254 void ScrollingCoordinatorChromium::recomputeWheelEventHandlerCountForFrameView(F
rameView* frameView) |
291 { | 255 { |
292 UNUSED_PARAM(frameView); | 256 UNUSED_PARAM(frameView); |
293 setWheelEventHandlerCount(computeCurrentWheelEventHandlerCount()); | 257 setWheelEventHandlerCount(computeCurrentWheelEventHandlerCount()); |
294 } | 258 } |
295 | 259 |
296 } | 260 } |
OLD | NEW |