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 |
118 } | 142 } |
119 | 143 |
120 void ScrollingCoordinatorChromium::frameViewRootLayerDidChange(FrameView* frameV
iew) | 144 void ScrollingCoordinatorChromium::frameViewRootLayerDidChange(FrameView* frameV
iew) |
121 { | 145 { |
122 ScrollingCoordinator::frameViewRootLayerDidChange(frameView); | 146 ScrollingCoordinator::frameViewRootLayerDidChange(frameView); |
123 setScrollLayer(scrollLayerForFrameView(frameView)); | 147 setScrollLayer(scrollLayerForFrameView(frameView)); |
124 } | 148 } |
125 | 149 |
126 static WebLayer* scrollableLayerForGraphicsLayer(GraphicsLayer* layer) | 150 static WebLayer* scrollableLayerForGraphicsLayer(GraphicsLayer* layer) |
127 { | 151 { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view())); | 226 setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view())); |
203 if (m_private->scrollLayer()) { | 227 if (m_private->scrollLayer()) { |
204 Vector<IntRect> rects = region.rects(); | 228 Vector<IntRect> rects = region.rects(); |
205 WebVector<WebRect> webRects(rects.size()); | 229 WebVector<WebRect> webRects(rects.size()); |
206 for (size_t i = 0; i < rects.size(); ++i) | 230 for (size_t i = 0; i < rects.size(); ++i) |
207 webRects[i] = rects[i]; | 231 webRects[i] = rects[i]; |
208 m_private->scrollLayer()->setNonFastScrollableRegion(webRects); | 232 m_private->scrollLayer()->setNonFastScrollableRegion(webRects); |
209 } | 233 } |
210 } | 234 } |
211 | 235 |
| 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 |
212 void ScrollingCoordinatorChromium::setWheelEventHandlerCount(unsigned wheelEvent
HandlerCount) | 248 void ScrollingCoordinatorChromium::setWheelEventHandlerCount(unsigned wheelEvent
HandlerCount) |
213 { | 249 { |
214 // We won't necessarily get a setScrollLayer() call before this one, so grab
the root ourselves. | 250 // We won't necessarily get a setScrollLayer() call before this one, so grab
the root ourselves. |
215 setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view())); | 251 setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view())); |
216 if (m_private->scrollLayer()) | 252 if (m_private->scrollLayer()) |
217 m_private->scrollLayer()->setHaveWheelEventHandlers(wheelEventHandlerCou
nt > 0); | 253 m_private->scrollLayer()->setHaveWheelEventHandlers(wheelEventHandlerCou
nt > 0); |
218 } | 254 } |
219 | 255 |
220 void ScrollingCoordinatorChromium::setShouldUpdateScrollLayerPositionOnMainThrea
d(MainThreadScrollingReasons reasons) | 256 void ScrollingCoordinatorChromium::setShouldUpdateScrollLayerPositionOnMainThrea
d(MainThreadScrollingReasons reasons) |
221 { | 257 { |
(...skipping 29 matching lines...) Expand all Loading... |
251 } | 287 } |
252 } | 288 } |
253 | 289 |
254 void ScrollingCoordinatorChromium::recomputeWheelEventHandlerCountForFrameView(F
rameView* frameView) | 290 void ScrollingCoordinatorChromium::recomputeWheelEventHandlerCountForFrameView(F
rameView* frameView) |
255 { | 291 { |
256 UNUSED_PARAM(frameView); | 292 UNUSED_PARAM(frameView); |
257 setWheelEventHandlerCount(computeCurrentWheelEventHandlerCount()); | 293 setWheelEventHandlerCount(computeCurrentWheelEventHandlerCount()); |
258 } | 294 } |
259 | 295 |
260 } | 296 } |
OLD | NEW |