| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 , m_lastMainThreadScrollingReasons(0) | 92 , m_lastMainThreadScrollingReasons(0) |
| 93 { | 93 { |
| 94 } | 94 } |
| 95 | 95 |
| 96 ScrollingCoordinator::~ScrollingCoordinator() | 96 ScrollingCoordinator::~ScrollingCoordinator() |
| 97 { | 97 { |
| 98 } | 98 } |
| 99 | 99 |
| 100 bool ScrollingCoordinator::touchHitTestingEnabled() const | 100 bool ScrollingCoordinator::touchHitTestingEnabled() const |
| 101 { | 101 { |
| 102 RenderView* contentRenderer = m_page->mainFrame()->contentRenderer(); | 102 if (!m_page->mainFrame()->isLocalFrame()) |
| 103 Settings* settings = m_page->mainFrame()->document()->settings(); | 103 return false; |
| 104 RenderView* contentRenderer = m_page->deprecatedLocalMainFrame()->contentRen
derer(); |
| 105 Settings* settings = m_page->mainFrame()->settings(); |
| 104 return RuntimeEnabledFeatures::touchEnabled() && settings->compositorTouchHi
tTesting() && contentRenderer && contentRenderer->usesCompositing(); | 106 return RuntimeEnabledFeatures::touchEnabled() && settings->compositorTouchHi
tTesting() && contentRenderer && contentRenderer->usesCompositing(); |
| 105 } | 107 } |
| 106 | 108 |
| 107 void ScrollingCoordinator::setShouldHandleScrollGestureOnMainThreadRegion(const
Region& region) | 109 void ScrollingCoordinator::setShouldHandleScrollGestureOnMainThreadRegion(const
Region& region) |
| 108 { | 110 { |
| 109 if (WebLayer* scrollLayer = toWebLayer(m_page->mainFrame()->view()->layerFor
Scrolling())) { | 111 if (!m_page->mainFrame()->isLocalFrame()) |
| 112 return; |
| 113 if (WebLayer* scrollLayer = toWebLayer(m_page->deprecatedLocalMainFrame()->v
iew()->layerForScrolling())) { |
| 110 Vector<IntRect> rects = region.rects(); | 114 Vector<IntRect> rects = region.rects(); |
| 111 WebVector<WebRect> webRects(rects.size()); | 115 WebVector<WebRect> webRects(rects.size()); |
| 112 for (size_t i = 0; i < rects.size(); ++i) | 116 for (size_t i = 0; i < rects.size(); ++i) |
| 113 webRects[i] = rects[i]; | 117 webRects[i] = rects[i]; |
| 114 scrollLayer->setNonFastScrollableRegion(webRects); | 118 scrollLayer->setNonFastScrollableRegion(webRects); |
| 115 } | 119 } |
| 116 } | 120 } |
| 117 | 121 |
| 118 void ScrollingCoordinator::notifyLayoutUpdated() | 122 void ScrollingCoordinator::notifyLayoutUpdated() |
| 119 { | 123 { |
| 120 m_scrollGestureRegionIsDirty = true; | 124 m_scrollGestureRegionIsDirty = true; |
| 121 m_touchEventTargetRectsAreDirty = true; | 125 m_touchEventTargetRectsAreDirty = true; |
| 122 m_shouldScrollOnMainThreadDirty = true; | 126 m_shouldScrollOnMainThreadDirty = true; |
| 123 } | 127 } |
| 124 | 128 |
| 125 void ScrollingCoordinator::updateAfterCompositingChangeIfNeeded() | 129 void ScrollingCoordinator::updateAfterCompositingChangeIfNeeded() |
| 126 { | 130 { |
| 131 if (!m_page->mainFrame()->isLocalFrame()) |
| 132 return; |
| 133 |
| 127 if (!shouldUpdateAfterCompositingChange()) | 134 if (!shouldUpdateAfterCompositingChange()) |
| 128 return; | 135 return; |
| 129 | 136 |
| 130 TRACE_EVENT0("input", "ScrollingCoordinator::updateAfterCompositingChangeIfN
eeded"); | 137 TRACE_EVENT0("input", "ScrollingCoordinator::updateAfterCompositingChangeIfN
eeded"); |
| 131 | 138 |
| 132 if (m_scrollGestureRegionIsDirty) { | 139 if (m_scrollGestureRegionIsDirty) { |
| 133 // Compute the region of the page where we can't handle scroll gestures
and mousewheel events | 140 // Compute the region of the page where we can't handle scroll gestures
and mousewheel events |
| 134 // on the impl thread. This currently includes: | 141 // on the impl thread. This currently includes: |
| 135 // 1. All scrollable areas, such as subframes, overflow divs and list bo
xes, whose composited | 142 // 1. All scrollable areas, such as subframes, overflow divs and list bo
xes, whose composited |
| 136 // scrolling are not enabled. We need to do this even if the frame view
whose layout was updated | 143 // scrolling are not enabled. We need to do this even if the frame view
whose layout was updated |
| 137 // is not the main frame. | 144 // is not the main frame. |
| 138 // 2. Resize control areas, e.g. the small rect at the right bottom of d
iv/textarea/iframe when | 145 // 2. Resize control areas, e.g. the small rect at the right bottom of d
iv/textarea/iframe when |
| 139 // CSS property "resize" is enabled. | 146 // CSS property "resize" is enabled. |
| 140 // 3. Plugin areas. | 147 // 3. Plugin areas. |
| 141 Region shouldHandleScrollGestureOnMainThreadRegion = computeShouldHandle
ScrollGestureOnMainThreadRegion(m_page->mainFrame(), IntPoint()); | 148 Region shouldHandleScrollGestureOnMainThreadRegion = computeShouldHandle
ScrollGestureOnMainThreadRegion(m_page->deprecatedLocalMainFrame(), IntPoint()); |
| 142 setShouldHandleScrollGestureOnMainThreadRegion(shouldHandleScrollGesture
OnMainThreadRegion); | 149 setShouldHandleScrollGestureOnMainThreadRegion(shouldHandleScrollGesture
OnMainThreadRegion); |
| 143 m_scrollGestureRegionIsDirty = false; | 150 m_scrollGestureRegionIsDirty = false; |
| 144 } | 151 } |
| 145 | 152 |
| 146 if (m_touchEventTargetRectsAreDirty) { | 153 if (m_touchEventTargetRectsAreDirty) { |
| 147 updateTouchEventTargetRectsIfNeeded(); | 154 updateTouchEventTargetRectsIfNeeded(); |
| 148 m_touchEventTargetRectsAreDirty = false; | 155 m_touchEventTargetRectsAreDirty = false; |
| 149 } | 156 } |
| 150 | 157 |
| 151 FrameView* frameView = m_page->mainFrame()->view(); | 158 FrameView* frameView = m_page->deprecatedLocalMainFrame()->view(); |
| 152 bool frameIsScrollable = frameView && frameView->isScrollable(); | 159 bool frameIsScrollable = frameView && frameView->isScrollable(); |
| 153 if (m_shouldScrollOnMainThreadDirty || m_wasFrameScrollable != frameIsScroll
able) { | 160 if (m_shouldScrollOnMainThreadDirty || m_wasFrameScrollable != frameIsScroll
able) { |
| 154 setShouldUpdateScrollLayerPositionOnMainThread(mainThreadScrollingReason
s()); | 161 setShouldUpdateScrollLayerPositionOnMainThread(mainThreadScrollingReason
s()); |
| 155 m_shouldScrollOnMainThreadDirty = false; | 162 m_shouldScrollOnMainThreadDirty = false; |
| 156 } | 163 } |
| 157 m_wasFrameScrollable = frameIsScrollable; | 164 m_wasFrameScrollable = frameIsScrollable; |
| 158 | 165 |
| 159 // The mainFrame view doesn't get included in the FrameTree below, so we | 166 // The mainFrame view doesn't get included in the FrameTree below, so we |
| 160 // update its size separately. | 167 // update its size separately. |
| 161 if (WebLayer* scrollingWebLayer = frameView ? toWebLayer(frameView->layerFor
Scrolling()) : 0) { | 168 if (WebLayer* scrollingWebLayer = frameView ? toWebLayer(frameView->layerFor
Scrolling()) : 0) { |
| 162 scrollingWebLayer->setBounds(frameView->contentsSize()); | 169 scrollingWebLayer->setBounds(frameView->contentsSize()); |
| 163 // If there is a fullscreen element, set the scroll clip layer to 0 so m
ain frame won't scroll. | 170 // If there is a fullscreen element, set the scroll clip layer to 0 so m
ain frame won't scroll. |
| 164 Document* mainFrameDocument = m_page->mainFrame()->document(); | 171 Document* mainFrameDocument = m_page->deprecatedLocalMainFrame()->docume
nt(); |
| 165 Element* fullscreenElement = FullscreenElementStack::fullscreenElementFr
om(*mainFrameDocument); | 172 Element* fullscreenElement = FullscreenElementStack::fullscreenElementFr
om(*mainFrameDocument); |
| 166 if (fullscreenElement && fullscreenElement != mainFrameDocument->documen
tElement()) | 173 if (fullscreenElement && fullscreenElement != mainFrameDocument->documen
tElement()) |
| 167 scrollingWebLayer->setScrollClipLayer(0); | 174 scrollingWebLayer->setScrollClipLayer(0); |
| 168 else | 175 else |
| 169 scrollingWebLayer->setScrollClipLayer(toWebLayer(frameView->layerFor
Container())); | 176 scrollingWebLayer->setScrollClipLayer(toWebLayer(frameView->layerFor
Container())); |
| 170 } | 177 } |
| 171 | 178 |
| 172 const FrameTree& tree = m_page->mainFrame()->tree(); | 179 const FrameTree& tree = m_page->mainFrame()->tree(); |
| 173 for (const Frame* child = tree.firstChild(); child; child = child->tree().ne
xtSibling()) { | 180 for (const Frame* child = tree.firstChild(); child; child = child->tree().ne
xtSibling()) { |
| 174 if (!child->isLocalFrame()) | 181 if (!child->isLocalFrame()) |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 | 323 |
| 317 if (scrollbarGraphicsLayer) { | 324 if (scrollbarGraphicsLayer) { |
| 318 Scrollbar* scrollbar = orientation == HorizontalScrollbar ? scrollableAr
ea->horizontalScrollbar() : scrollableArea->verticalScrollbar(); | 325 Scrollbar* scrollbar = orientation == HorizontalScrollbar ? scrollableAr
ea->horizontalScrollbar() : scrollableArea->verticalScrollbar(); |
| 319 if (scrollbar->isCustomScrollbar()) { | 326 if (scrollbar->isCustomScrollbar()) { |
| 320 detachScrollbarLayer(scrollbarGraphicsLayer); | 327 detachScrollbarLayer(scrollbarGraphicsLayer); |
| 321 return; | 328 return; |
| 322 } | 329 } |
| 323 | 330 |
| 324 WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea,
orientation); | 331 WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea,
orientation); |
| 325 if (!scrollbarLayer) { | 332 if (!scrollbarLayer) { |
| 326 Settings* settings = m_page->mainFrame()->document()->settings(); | 333 Settings* settings = m_page->mainFrame()->settings(); |
| 327 | 334 |
| 328 OwnPtr<WebScrollbarLayer> webScrollbarLayer; | 335 OwnPtr<WebScrollbarLayer> webScrollbarLayer; |
| 329 if (settings->useSolidColorScrollbars()) { | 336 if (settings->useSolidColorScrollbars()) { |
| 330 ASSERT(RuntimeEnabledFeatures::overlayScrollbarsEnabled()); | 337 ASSERT(RuntimeEnabledFeatures::overlayScrollbarsEnabled()); |
| 331 webScrollbarLayer = createSolidColorScrollbarLayer(orientation,
scrollbar->theme()->thumbThickness(scrollbar), scrollbar->theme()->trackPosition
(scrollbar), scrollableArea->shouldPlaceVerticalScrollbarOnLeft()); | 338 webScrollbarLayer = createSolidColorScrollbarLayer(orientation,
scrollbar->theme()->thumbThickness(scrollbar), scrollbar->theme()->trackPosition
(scrollbar), scrollableArea->shouldPlaceVerticalScrollbarOnLeft()); |
| 332 } else { | 339 } else { |
| 333 webScrollbarLayer = createScrollbarLayer(scrollbar); | 340 webScrollbarLayer = createScrollbarLayer(scrollbar); |
| 334 } | 341 } |
| 335 scrollbarLayer = addWebScrollbarLayer(scrollableArea, orientation, w
ebScrollbarLayer.release()); | 342 scrollbarLayer = addWebScrollbarLayer(scrollableArea, orientation, w
ebScrollbarLayer.release()); |
| 336 } | 343 } |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 | 610 |
| 604 // Ensure we have an entry for each composited layer that previously had rec
ts (so that old | 611 // Ensure we have an entry for each composited layer that previously had rec
ts (so that old |
| 605 // ones will get cleared out). Note that ideally we'd track this on Graphics
Layer instead of | 612 // ones will get cleared out). Note that ideally we'd track this on Graphics
Layer instead of |
| 606 // RenderLayer, but we have no good hook into the lifetime of a GraphicsLaye
r. | 613 // RenderLayer, but we have no good hook into the lifetime of a GraphicsLaye
r. |
| 607 for (HashSet<const RenderLayer*>::iterator it = oldLayersWithTouchRects.begi
n(); it != oldLayersWithTouchRects.end(); ++it) { | 614 for (HashSet<const RenderLayer*>::iterator it = oldLayersWithTouchRects.begi
n(); it != oldLayersWithTouchRects.end(); ++it) { |
| 608 if (!layerRects.contains(*it)) | 615 if (!layerRects.contains(*it)) |
| 609 layerRects.add(*it, Vector<LayoutRect>()); | 616 layerRects.add(*it, Vector<LayoutRect>()); |
| 610 } | 617 } |
| 611 | 618 |
| 612 GraphicsLayerHitTestRects graphicsLayerRects; | 619 GraphicsLayerHitTestRects graphicsLayerRects; |
| 613 projectRectsToGraphicsLayerSpace(m_page->mainFrame(), layerRects, graphicsLa
yerRects); | 620 projectRectsToGraphicsLayerSpace(m_page->deprecatedLocalMainFrame(), layerRe
cts, graphicsLayerRects); |
| 614 | 621 |
| 615 for (GraphicsLayerHitTestRects::const_iterator iter = graphicsLayerRects.beg
in(); iter != graphicsLayerRects.end(); ++iter) { | 622 for (GraphicsLayerHitTestRects::const_iterator iter = graphicsLayerRects.beg
in(); iter != graphicsLayerRects.end(); ++iter) { |
| 616 const GraphicsLayer* graphicsLayer = iter->key; | 623 const GraphicsLayer* graphicsLayer = iter->key; |
| 617 WebVector<WebRect> webRects(iter->value.size()); | 624 WebVector<WebRect> webRects(iter->value.size()); |
| 618 for (size_t i = 0; i < iter->value.size(); ++i) | 625 for (size_t i = 0; i < iter->value.size(); ++i) |
| 619 webRects[i] = enclosingIntRect(iter->value[i]); | 626 webRects[i] = enclosingIntRect(iter->value[i]); |
| 620 graphicsLayer->platformLayer()->setTouchEventHandlerRegion(webRects); | 627 graphicsLayer->platformLayer()->setTouchEventHandlerRegion(webRects); |
| 621 } | 628 } |
| 622 } | 629 } |
| 623 | 630 |
| 624 void ScrollingCoordinator::touchEventTargetRectsDidChange() | 631 void ScrollingCoordinator::touchEventTargetRectsDidChange() |
| 625 { | 632 { |
| 626 if (!touchHitTestingEnabled()) | 633 if (!touchHitTestingEnabled()) |
| 627 return; | 634 return; |
| 628 | 635 |
| 629 // Wait until after layout to update. | 636 // Wait until after layout to update. |
| 630 if (!m_page->mainFrame()->view() || m_page->mainFrame()->view()->needsLayout
()) | 637 if (!m_page->deprecatedLocalMainFrame()->view() || m_page->deprecatedLocalMa
inFrame()->view()->needsLayout()) |
| 631 return; | 638 return; |
| 632 | 639 |
| 633 // FIXME: scheduleAnimation() is just a method of forcing the compositor to
realize that it | 640 // FIXME: scheduleAnimation() is just a method of forcing the compositor to
realize that it |
| 634 // needs to commit here. We should expose a cleaner API for this. | 641 // needs to commit here. We should expose a cleaner API for this. |
| 635 RenderView* renderView = m_page->mainFrame()->contentRenderer(); | 642 RenderView* renderView = m_page->deprecatedLocalMainFrame()->contentRenderer
(); |
| 636 if (renderView && renderView->compositor() && renderView->compositor()->stal
eInCompositingMode()) | 643 if (renderView && renderView->compositor() && renderView->compositor()->stal
eInCompositingMode()) |
| 637 m_page->mainFrame()->view()->scheduleAnimation(); | 644 m_page->deprecatedLocalMainFrame()->view()->scheduleAnimation(); |
| 638 | 645 |
| 639 m_touchEventTargetRectsAreDirty = true; | 646 m_touchEventTargetRectsAreDirty = true; |
| 640 } | 647 } |
| 641 | 648 |
| 642 void ScrollingCoordinator::updateScrollParentForGraphicsLayer(GraphicsLayer* chi
ld, RenderLayer* parent) | 649 void ScrollingCoordinator::updateScrollParentForGraphicsLayer(GraphicsLayer* chi
ld, RenderLayer* parent) |
| 643 { | 650 { |
| 644 WebLayer* scrollParentWebLayer = 0; | 651 WebLayer* scrollParentWebLayer = 0; |
| 645 if (parent && parent->hasCompositedLayerMapping()) | 652 if (parent && parent->hasCompositedLayerMapping()) |
| 646 scrollParentWebLayer = toWebLayer(parent->compositedLayerMapping()->pare
ntForSublayers()); | 653 scrollParentWebLayer = toWebLayer(parent->compositedLayerMapping()->pare
ntForSublayers()); |
| 647 | 654 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 659 | 666 |
| 660 void ScrollingCoordinator::willDestroyRenderLayer(RenderLayer* layer) | 667 void ScrollingCoordinator::willDestroyRenderLayer(RenderLayer* layer) |
| 661 { | 668 { |
| 662 m_layersWithTouchRects.remove(layer); | 669 m_layersWithTouchRects.remove(layer); |
| 663 } | 670 } |
| 664 | 671 |
| 665 void ScrollingCoordinator::updateHaveWheelEventHandlers() | 672 void ScrollingCoordinator::updateHaveWheelEventHandlers() |
| 666 { | 673 { |
| 667 ASSERT(isMainThread()); | 674 ASSERT(isMainThread()); |
| 668 ASSERT(m_page); | 675 ASSERT(m_page); |
| 669 if (!m_page->mainFrame()->view()) | 676 if (!m_page->mainFrame()->isLocalFrame() || !m_page->deprecatedLocalMainFram
e()->view()) |
| 670 return; | 677 return; |
| 671 | 678 |
| 672 if (WebLayer* scrollLayer = toWebLayer(m_page->mainFrame()->view()->layerFor
Scrolling())) { | 679 if (WebLayer* scrollLayer = toWebLayer(m_page->deprecatedLocalMainFrame()->v
iew()->layerForScrolling())) { |
| 673 bool haveHandlers = m_page->frameHost().eventHandlerRegistry().hasEventH
andlers(EventHandlerRegistry::WheelEvent); | 680 bool haveHandlers = m_page->frameHost().eventHandlerRegistry().hasEventH
andlers(EventHandlerRegistry::WheelEvent); |
| 674 scrollLayer->setHaveWheelEventHandlers(haveHandlers); | 681 scrollLayer->setHaveWheelEventHandlers(haveHandlers); |
| 675 } | 682 } |
| 676 } | 683 } |
| 677 | 684 |
| 678 void ScrollingCoordinator::updateHaveScrollEventHandlers() | 685 void ScrollingCoordinator::updateHaveScrollEventHandlers() |
| 679 { | 686 { |
| 680 ASSERT(isMainThread()); | 687 ASSERT(isMainThread()); |
| 681 ASSERT(m_page); | 688 ASSERT(m_page); |
| 682 if (!m_page->mainFrame()->view()) | 689 if (!m_page->mainFrame()->isLocalFrame() || !m_page->deprecatedLocalMainFram
e()->view()) |
| 683 return; | 690 return; |
| 684 | 691 |
| 685 // Currently the compositor only cares whether there are scroll handlers any
where on the page | 692 // Currently the compositor only cares whether there are scroll handlers any
where on the page |
| 686 // instead on a per-layer basis. We therefore only update this information f
or the root | 693 // instead on a per-layer basis. We therefore only update this information f
or the root |
| 687 // scrolling layer. | 694 // scrolling layer. |
| 688 if (WebLayer* scrollLayer = toWebLayer(m_page->mainFrame()->view()->layerFor
Scrolling())) { | 695 if (WebLayer* scrollLayer = toWebLayer(m_page->deprecatedLocalMainFrame()->v
iew()->layerForScrolling())) { |
| 689 bool haveHandlers = m_page->frameHost().eventHandlerRegistry().hasEventH
andlers(EventHandlerRegistry::ScrollEvent); | 696 bool haveHandlers = m_page->frameHost().eventHandlerRegistry().hasEventH
andlers(EventHandlerRegistry::ScrollEvent); |
| 690 scrollLayer->setHaveScrollEventHandlers(haveHandlers); | 697 scrollLayer->setHaveScrollEventHandlers(haveHandlers); |
| 691 } | 698 } |
| 692 } | 699 } |
| 693 | 700 |
| 694 void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(MainTh
readScrollingReasons reasons) | 701 void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(MainTh
readScrollingReasons reasons) |
| 695 { | 702 { |
| 696 if (WebLayer* scrollLayer = toWebLayer(m_page->mainFrame()->view()->layerFor
Scrolling())) { | 703 if (!m_page->mainFrame()->isLocalFrame()) |
| 704 return; |
| 705 if (WebLayer* scrollLayer = toWebLayer(m_page->deprecatedLocalMainFrame()->v
iew()->layerForScrolling())) { |
| 697 m_lastMainThreadScrollingReasons = reasons; | 706 m_lastMainThreadScrollingReasons = reasons; |
| 698 scrollLayer->setShouldScrollOnMainThread(reasons); | 707 scrollLayer->setShouldScrollOnMainThread(reasons); |
| 699 } | 708 } |
| 700 } | 709 } |
| 701 | 710 |
| 702 void ScrollingCoordinator::willBeDestroyed() | 711 void ScrollingCoordinator::willBeDestroyed() |
| 703 { | 712 { |
| 704 ASSERT(m_page); | 713 ASSERT(m_page); |
| 705 m_page = 0; | 714 m_page = 0; |
| 706 for (ScrollbarMap::iterator it = m_horizontalScrollbars.begin(); it != m_hor
izontalScrollbars.end(); ++it) | 715 for (ScrollbarMap::iterator it = m_horizontalScrollbars.begin(); it != m_hor
izontalScrollbars.end(); ++it) |
| 707 GraphicsLayer::unregisterContentsLayer(it->value->layer()); | 716 GraphicsLayer::unregisterContentsLayer(it->value->layer()); |
| 708 for (ScrollbarMap::iterator it = m_verticalScrollbars.begin(); it != m_verti
calScrollbars.end(); ++it) | 717 for (ScrollbarMap::iterator it = m_verticalScrollbars.begin(); it != m_verti
calScrollbars.end(); ++it) |
| 709 GraphicsLayer::unregisterContentsLayer(it->value->layer()); | 718 GraphicsLayer::unregisterContentsLayer(it->value->layer()); |
| 710 } | 719 } |
| 711 | 720 |
| 712 bool ScrollingCoordinator::coordinatesScrollingForFrameView(FrameView* frameView
) const | 721 bool ScrollingCoordinator::coordinatesScrollingForFrameView(FrameView* frameView
) const |
| 713 { | 722 { |
| 714 ASSERT(isMainThread()); | 723 ASSERT(isMainThread()); |
| 715 ASSERT(m_page); | 724 ASSERT(m_page); |
| 716 | 725 |
| 717 // We currently only handle the main frame. | 726 // We currently only handle the main frame. |
| 718 if (&frameView->frame() != m_page->mainFrame()) | 727 if (&frameView->frame() != m_page->mainFrame()) |
| 719 return false; | 728 return false; |
| 720 | 729 |
| 730 if (!m_page->mainFrame()->isLocalFrame()) |
| 731 return false; |
| 732 |
| 721 // We currently only support composited mode. | 733 // We currently only support composited mode. |
| 722 RenderView* renderView = m_page->mainFrame()->contentRenderer(); | 734 RenderView* renderView = m_page->deprecatedLocalMainFrame()->contentRenderer
(); |
| 723 if (!renderView) | 735 if (!renderView) |
| 724 return false; | 736 return false; |
| 725 return renderView->usesCompositing(); | 737 return renderView->usesCompositing(); |
| 726 } | 738 } |
| 727 | 739 |
| 728 Region ScrollingCoordinator::computeShouldHandleScrollGestureOnMainThreadRegion(
const LocalFrame* frame, const IntPoint& frameLocation) const | 740 Region ScrollingCoordinator::computeShouldHandleScrollGestureOnMainThreadRegion(
const LocalFrame* frame, const IntPoint& frameLocation) const |
| 729 { | 741 { |
| 730 Region shouldHandleScrollGestureOnMainThreadRegion; | 742 Region shouldHandleScrollGestureOnMainThreadRegion; |
| 731 FrameView* frameView = frame->view(); | 743 FrameView* frameView = frame->view(); |
| 732 if (!frameView) | 744 if (!frameView) |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 } | 857 } |
| 846 } | 858 } |
| 847 | 859 |
| 848 } | 860 } |
| 849 | 861 |
| 850 void ScrollingCoordinator::computeTouchEventTargetRects(LayerHitTestRects& rects
) | 862 void ScrollingCoordinator::computeTouchEventTargetRects(LayerHitTestRects& rects
) |
| 851 { | 863 { |
| 852 TRACE_EVENT0("input", "ScrollingCoordinator::computeTouchEventTargetRects"); | 864 TRACE_EVENT0("input", "ScrollingCoordinator::computeTouchEventTargetRects"); |
| 853 ASSERT(touchHitTestingEnabled()); | 865 ASSERT(touchHitTestingEnabled()); |
| 854 | 866 |
| 855 Document* document = m_page->mainFrame()->document(); | 867 Document* document = m_page->deprecatedLocalMainFrame()->document(); |
| 856 if (!document || !document->view()) | 868 if (!document || !document->view()) |
| 857 return; | 869 return; |
| 858 | 870 |
| 859 accumulateDocumentTouchEventTargetRects(rects, document); | 871 accumulateDocumentTouchEventTargetRects(rects, document); |
| 860 } | 872 } |
| 861 | 873 |
| 862 void ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange(FrameView* fr
ameView) | 874 void ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange(FrameView* fr
ameView) |
| 863 { | 875 { |
| 864 ASSERT(isMainThread()); | 876 ASSERT(isMainThread()); |
| 865 ASSERT(m_page); | 877 ASSERT(m_page); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 876 ASSERT(m_page); | 888 ASSERT(m_page); |
| 877 | 889 |
| 878 if (!coordinatesScrollingForFrameView(frameView)) | 890 if (!coordinatesScrollingForFrameView(frameView)) |
| 879 return; | 891 return; |
| 880 | 892 |
| 881 m_shouldScrollOnMainThreadDirty = true; | 893 m_shouldScrollOnMainThreadDirty = true; |
| 882 } | 894 } |
| 883 | 895 |
| 884 bool ScrollingCoordinator::isForMainFrame(ScrollableArea* scrollableArea) const | 896 bool ScrollingCoordinator::isForMainFrame(ScrollableArea* scrollableArea) const |
| 885 { | 897 { |
| 886 return scrollableArea == m_page->mainFrame()->view(); | 898 return m_page->mainFrame()->isLocalFrame() ? scrollableArea == m_page->depre
catedLocalMainFrame()->view() : false; |
| 887 } | 899 } |
| 888 | 900 |
| 889 void ScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView) | 901 void ScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView) |
| 890 { | 902 { |
| 891 ASSERT(isMainThread()); | 903 ASSERT(isMainThread()); |
| 892 ASSERT(m_page); | 904 ASSERT(m_page); |
| 893 | 905 |
| 894 if (!coordinatesScrollingForFrameView(frameView)) | 906 if (!coordinatesScrollingForFrameView(frameView)) |
| 895 return; | 907 return; |
| 896 | 908 |
| 897 notifyLayoutUpdated(); | 909 notifyLayoutUpdated(); |
| 898 updateHaveWheelEventHandlers(); | 910 updateHaveWheelEventHandlers(); |
| 899 updateHaveScrollEventHandlers(); | 911 updateHaveScrollEventHandlers(); |
| 900 } | 912 } |
| 901 | 913 |
| 902 #if OS(MACOSX) | 914 #if OS(MACOSX) |
| 903 void ScrollingCoordinator::handleWheelEventPhase(PlatformWheelEventPhase phase) | 915 void ScrollingCoordinator::handleWheelEventPhase(PlatformWheelEventPhase phase) |
| 904 { | 916 { |
| 905 ASSERT(isMainThread()); | 917 ASSERT(isMainThread()); |
| 906 | 918 |
| 907 if (!m_page) | 919 if (!m_page) |
| 908 return; | 920 return; |
| 909 | 921 |
| 910 FrameView* frameView = m_page->mainFrame()->view(); | 922 FrameView* frameView = m_page->deprecatedLocalMainFrame()->view(); |
| 911 if (!frameView) | 923 if (!frameView) |
| 912 return; | 924 return; |
| 913 | 925 |
| 914 frameView->scrollAnimator()->handleWheelEventPhase(phase); | 926 frameView->scrollAnimator()->handleWheelEventPhase(phase); |
| 915 } | 927 } |
| 916 #endif | 928 #endif |
| 917 | 929 |
| 918 bool ScrollingCoordinator::hasVisibleSlowRepaintViewportConstrainedObjects(Frame
View* frameView) const | 930 bool ScrollingCoordinator::hasVisibleSlowRepaintViewportConstrainedObjects(Frame
View* frameView) const |
| 919 { | 931 { |
| 920 const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects =
frameView->viewportConstrainedObjects(); | 932 const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects =
frameView->viewportConstrainedObjects(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 936 return true; | 948 return true; |
| 937 } | 949 } |
| 938 return false; | 950 return false; |
| 939 } | 951 } |
| 940 | 952 |
| 941 MainThreadScrollingReasons ScrollingCoordinator::mainThreadScrollingReasons() co
nst | 953 MainThreadScrollingReasons ScrollingCoordinator::mainThreadScrollingReasons() co
nst |
| 942 { | 954 { |
| 943 // The main thread scrolling reasons are applicable to scrolls of the main | 955 // The main thread scrolling reasons are applicable to scrolls of the main |
| 944 // frame. If it does not exist or if it is not scrollable, there is no | 956 // frame. If it does not exist or if it is not scrollable, there is no |
| 945 // reason to force main thread scrolling. | 957 // reason to force main thread scrolling. |
| 946 FrameView* frameView = m_page->mainFrame()->view(); | 958 if (!m_page->mainFrame()->isLocalFrame()) |
| 959 return static_cast<MainThreadScrollingReasons>(0); |
| 960 FrameView* frameView = m_page->deprecatedLocalMainFrame()->view(); |
| 947 if (!frameView) | 961 if (!frameView) |
| 948 return static_cast<MainThreadScrollingReasons>(0); | 962 return static_cast<MainThreadScrollingReasons>(0); |
| 949 | 963 |
| 950 MainThreadScrollingReasons mainThreadScrollingReasons = (MainThreadScrolling
Reasons)0; | 964 MainThreadScrollingReasons mainThreadScrollingReasons = (MainThreadScrolling
Reasons)0; |
| 951 | 965 |
| 952 if (frameView->hasSlowRepaintObjects()) | 966 if (frameView->hasSlowRepaintObjects()) |
| 953 mainThreadScrollingReasons |= HasSlowRepaintObjects; | 967 mainThreadScrollingReasons |= HasSlowRepaintObjects; |
| 954 if (hasVisibleSlowRepaintViewportConstrainedObjects(frameView)) | 968 if (hasVisibleSlowRepaintViewportConstrainedObjects(frameView)) |
| 955 mainThreadScrollingReasons |= HasNonLayerViewportConstrainedObjects; | 969 mainThreadScrollingReasons |= HasNonLayerViewportConstrainedObjects; |
| 956 | 970 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 968 if (reasons & ScrollingCoordinator::HasNonLayerViewportConstrainedObjects) | 982 if (reasons & ScrollingCoordinator::HasNonLayerViewportConstrainedObjects) |
| 969 stringBuilder.append("Has non-layer viewport-constrained objects, "); | 983 stringBuilder.append("Has non-layer viewport-constrained objects, "); |
| 970 | 984 |
| 971 if (stringBuilder.length()) | 985 if (stringBuilder.length()) |
| 972 stringBuilder.resize(stringBuilder.length() - 2); | 986 stringBuilder.resize(stringBuilder.length() - 2); |
| 973 return stringBuilder.toString(); | 987 return stringBuilder.toString(); |
| 974 } | 988 } |
| 975 | 989 |
| 976 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const | 990 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const |
| 977 { | 991 { |
| 978 ASSERT(m_page->mainFrame()->document()->lifecycle().state() >= DocumentLifec
ycle::CompositingClean); | 992 ASSERT(m_page->deprecatedLocalMainFrame()->document()->lifecycle().state() >
= DocumentLifecycle::CompositingClean); |
| 979 return mainThreadScrollingReasonsAsText(m_lastMainThreadScrollingReasons); | 993 return mainThreadScrollingReasonsAsText(m_lastMainThreadScrollingReasons); |
| 980 } | 994 } |
| 981 | 995 |
| 982 bool ScrollingCoordinator::frameViewIsDirty() const | 996 bool ScrollingCoordinator::frameViewIsDirty() const |
| 983 { | 997 { |
| 984 FrameView* frameView = m_page->mainFrame()->view(); | 998 FrameView* frameView = m_page->mainFrame()->isLocalFrame() ? m_page->depreca
tedLocalMainFrame()->view() : 0; |
| 985 bool frameIsScrollable = frameView && frameView->isScrollable(); | 999 bool frameIsScrollable = frameView && frameView->isScrollable(); |
| 986 if (frameIsScrollable != m_wasFrameScrollable) | 1000 if (frameIsScrollable != m_wasFrameScrollable) |
| 987 return true; | 1001 return true; |
| 988 | 1002 |
| 989 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : 0) | 1003 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : 0) |
| 990 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); | 1004 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); |
| 991 return false; | 1005 return false; |
| 992 } | 1006 } |
| 993 | 1007 |
| 994 } // namespace WebCore | 1008 } // namespace WebCore |
| OLD | NEW |