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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 PassOwnPtr<ScrollingCoordinator> ScrollingCoordinator::create(Page* page) | 78 PassOwnPtr<ScrollingCoordinator> ScrollingCoordinator::create(Page* page) |
79 { | 79 { |
80 return adoptPtr(new ScrollingCoordinator(page)); | 80 return adoptPtr(new ScrollingCoordinator(page)); |
81 } | 81 } |
82 | 82 |
83 ScrollingCoordinator::ScrollingCoordinator(Page* page) | 83 ScrollingCoordinator::ScrollingCoordinator(Page* page) |
84 : m_page(page) | 84 : m_page(page) |
85 , m_scrollGestureRegionIsDirty(false) | 85 , m_scrollGestureRegionIsDirty(false) |
86 , m_touchEventTargetRectsAreDirty(false) | 86 , m_touchEventTargetRectsAreDirty(false) |
87 , m_shouldScrollOnMainThreadDirty(false) | 87 , m_shouldScrollOnMainThreadDirty(false) |
88 , m_wasFrameScrollable(false) | |
89 { | 88 { |
90 } | 89 } |
91 | 90 |
92 ScrollingCoordinator::~ScrollingCoordinator() | 91 ScrollingCoordinator::~ScrollingCoordinator() |
93 { | 92 { |
94 } | 93 } |
95 | 94 |
96 void ScrollingCoordinator::setShouldHandleScrollGestureOnMainThreadRegion(const
Region& region) | 95 void ScrollingCoordinator::setShouldHandleScrollGestureOnMainThreadRegion(const
Region& region) |
97 { | 96 { |
98 if (WebLayer* scrollLayer = toWebLayer(m_page->mainFrame()->view()->layerFor
Scrolling())) { | 97 if (WebLayer* scrollLayer = toWebLayer(m_page->mainFrame()->view()->layerFor
Scrolling())) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 Region shouldHandleScrollGestureOnMainThreadRegion = computeShouldHandle
ScrollGestureOnMainThreadRegion(m_page->mainFrame(), IntPoint()); | 129 Region shouldHandleScrollGestureOnMainThreadRegion = computeShouldHandle
ScrollGestureOnMainThreadRegion(m_page->mainFrame(), IntPoint()); |
131 setShouldHandleScrollGestureOnMainThreadRegion(shouldHandleScrollGesture
OnMainThreadRegion); | 130 setShouldHandleScrollGestureOnMainThreadRegion(shouldHandleScrollGesture
OnMainThreadRegion); |
132 m_scrollGestureRegionIsDirty = false; | 131 m_scrollGestureRegionIsDirty = false; |
133 } | 132 } |
134 | 133 |
135 if (m_touchEventTargetRectsAreDirty) { | 134 if (m_touchEventTargetRectsAreDirty) { |
136 updateTouchEventTargetRectsIfNeeded(); | 135 updateTouchEventTargetRectsIfNeeded(); |
137 m_touchEventTargetRectsAreDirty = false; | 136 m_touchEventTargetRectsAreDirty = false; |
138 } | 137 } |
139 | 138 |
140 FrameView* frameView = m_page->mainFrame()->view(); | |
141 m_wasFrameScrollable = frameView && frameView->isScrollable(); | |
142 | |
143 // The mainFrame view doesn't get included in the FrameTree below, so we | 139 // The mainFrame view doesn't get included in the FrameTree below, so we |
144 // update its size separately. | 140 // update its size separately. |
| 141 FrameView* frameView = m_page->mainFrame()->view(); |
145 if (WebLayer* scrollingWebLayer = frameView ? toWebLayer(frameView->layerFor
Scrolling()) : 0) { | 142 if (WebLayer* scrollingWebLayer = frameView ? toWebLayer(frameView->layerFor
Scrolling()) : 0) { |
146 scrollingWebLayer->setBounds(frameView->size()); | 143 scrollingWebLayer->setBounds(frameView->size()); |
147 } | 144 } |
148 } | 145 } |
149 | 146 |
150 void ScrollingCoordinator::willDestroyScrollableArea(ScrollableArea* scrollableA
rea) | 147 void ScrollingCoordinator::willDestroyScrollableArea(ScrollableArea* scrollableA
rea) |
151 { | 148 { |
152 removeWebScrollbarLayer(scrollableArea, HorizontalScrollbar); | 149 removeWebScrollbarLayer(scrollableArea, HorizontalScrollbar); |
153 removeWebScrollbarLayer(scrollableArea, VerticalScrollbar); | 150 removeWebScrollbarLayer(scrollableArea, VerticalScrollbar); |
154 } | 151 } |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 void ScrollingCoordinator::reset() | 409 void ScrollingCoordinator::reset() |
413 { | 410 { |
414 for (ScrollbarMap::iterator it = m_horizontalScrollbars.begin(); it != m_hor
izontalScrollbars.end(); ++it) | 411 for (ScrollbarMap::iterator it = m_horizontalScrollbars.begin(); it != m_hor
izontalScrollbars.end(); ++it) |
415 GraphicsLayer::unregisterContentsLayer(it->value->layer()); | 412 GraphicsLayer::unregisterContentsLayer(it->value->layer()); |
416 for (ScrollbarMap::iterator it = m_verticalScrollbars.begin(); it != m_verti
calScrollbars.end(); ++it) | 413 for (ScrollbarMap::iterator it = m_verticalScrollbars.begin(); it != m_verti
calScrollbars.end(); ++it) |
417 GraphicsLayer::unregisterContentsLayer(it->value->layer()); | 414 GraphicsLayer::unregisterContentsLayer(it->value->layer()); |
418 | 415 |
419 m_horizontalScrollbars.clear(); | 416 m_horizontalScrollbars.clear(); |
420 m_verticalScrollbars.clear(); | 417 m_verticalScrollbars.clear(); |
421 m_layersWithTouchRects.clear(); | 418 m_layersWithTouchRects.clear(); |
422 m_wasFrameScrollable = false; | |
423 } | 419 } |
424 | 420 |
425 // Note that in principle this could be called more often than computeTouchEvent
TargetRects, for | 421 // Note that in principle this could be called more often than computeTouchEvent
TargetRects, for |
426 // example during a non-composited scroll (although that's not yet implemented -
crbug.com/261307). | 422 // example during a non-composited scroll (although that's not yet implemented -
crbug.com/261307). |
427 void ScrollingCoordinator::setTouchEventTargetRects(LayerHitTestRects& layerRect
s) | 423 void ScrollingCoordinator::setTouchEventTargetRects(LayerHitTestRects& layerRect
s) |
428 { | 424 { |
429 TRACE_EVENT0("input", "ScrollingCoordinator::setTouchEventTargetRects"); | 425 TRACE_EVENT0("input", "ScrollingCoordinator::setTouchEventTargetRects"); |
430 | 426 |
431 // Update the list of layers with touch hit rects. | 427 // Update the list of layers with touch hit rects. |
432 HashSet<const RenderLayer*> oldLayersWithTouchRects; | 428 HashSet<const RenderLayer*> oldLayersWithTouchRects; |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 } | 668 } |
673 #endif | 669 #endif |
674 | 670 |
675 bool ScrollingCoordinator::frameViewIsDirty() const | 671 bool ScrollingCoordinator::frameViewIsDirty() const |
676 { | 672 { |
677 // FIXME(sky): Remove | 673 // FIXME(sky): Remove |
678 return false; | 674 return false; |
679 } | 675 } |
680 | 676 |
681 } // namespace blink | 677 } // namespace blink |
OLD | NEW |