Chromium Code Reviews| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 { | 85 { |
| 86 return adoptPtrWillBeNoop(new ScrollingCoordinator(page)); | 86 return adoptPtrWillBeNoop(new ScrollingCoordinator(page)); |
| 87 } | 87 } |
| 88 | 88 |
| 89 ScrollingCoordinator::ScrollingCoordinator(Page* page) | 89 ScrollingCoordinator::ScrollingCoordinator(Page* page) |
| 90 : m_page(page) | 90 : m_page(page) |
| 91 , m_scrollGestureRegionIsDirty(false) | 91 , m_scrollGestureRegionIsDirty(false) |
| 92 , m_touchEventTargetRectsAreDirty(false) | 92 , m_touchEventTargetRectsAreDirty(false) |
| 93 , m_shouldScrollOnMainThreadDirty(false) | 93 , m_shouldScrollOnMainThreadDirty(false) |
| 94 , m_wasFrameScrollable(false) | 94 , m_wasFrameScrollable(false) |
| 95 , m_webLayerTreeView(nullptr) | |
| 95 , m_lastMainThreadScrollingReasons(0) | 96 , m_lastMainThreadScrollingReasons(0) |
| 96 { | 97 { |
| 97 } | 98 } |
| 98 | 99 |
| 99 ScrollingCoordinator::~ScrollingCoordinator() | 100 ScrollingCoordinator::~ScrollingCoordinator() |
| 100 { | 101 { |
| 101 ASSERT(!m_page); | 102 ASSERT(!m_page); |
| 102 } | 103 } |
| 103 | 104 |
| 104 DEFINE_TRACE(ScrollingCoordinator) | 105 DEFINE_TRACE(ScrollingCoordinator) |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 677 | 678 |
| 678 void ScrollingCoordinator::willDestroyLayer(PaintLayer* layer) | 679 void ScrollingCoordinator::willDestroyLayer(PaintLayer* layer) |
| 679 { | 680 { |
| 680 m_layersWithTouchRects.remove(layer); | 681 m_layersWithTouchRects.remove(layer); |
| 681 } | 682 } |
| 682 | 683 |
| 683 void ScrollingCoordinator::updateHaveWheelEventHandlers() | 684 void ScrollingCoordinator::updateHaveWheelEventHandlers() |
| 684 { | 685 { |
| 685 ASSERT(isMainThread()); | 686 ASSERT(isMainThread()); |
| 686 ASSERT(m_page); | 687 ASSERT(m_page); |
| 687 if (!m_page->mainFrame()->isLocalFrame() || !m_page->deprecatedLocalMainFram e()->view()) | 688 if (!m_webLayerTreeView) |
| 688 return; | 689 return; |
| 689 | 690 |
| 690 if (WebLayer* scrollLayer = toWebLayer(m_page->deprecatedLocalMainFrame()->v iew()->layerForScrolling())) { | 691 m_webLayerTreeView->setHaveWheelEventHandlers(m_page->frameHost().eventHandl erRegistry().hasEventHandlers(EventHandlerRegistry::WheelEvent)); |
| 691 bool haveHandlers = m_page->frameHost().eventHandlerRegistry().hasEventH andlers(EventHandlerRegistry::WheelEvent); | |
| 692 scrollLayer->setHaveWheelEventHandlers(haveHandlers); | |
| 693 } | |
| 694 } | 692 } |
| 695 | 693 |
| 696 void ScrollingCoordinator::updateHaveScrollEventHandlers() | 694 void ScrollingCoordinator::updateHaveScrollEventHandlers() |
| 697 { | 695 { |
| 698 ASSERT(isMainThread()); | 696 ASSERT(isMainThread()); |
| 699 ASSERT(m_page); | 697 ASSERT(m_page); |
| 700 if (!m_page->mainFrame()->isLocalFrame() || !m_page->deprecatedLocalMainFram e()->view()) | 698 if (!m_page->mainFrame()->isLocalFrame() || !m_page->deprecatedLocalMainFram e()->view()) |
| 701 return; | 699 return; |
| 702 | 700 |
| 703 // Currently the compositor only cares whether there are scroll handlers any where on the page | 701 // Currently the compositor only cares whether there are scroll handlers any where on the page |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 722 } | 720 } |
| 723 } | 721 } |
| 724 | 722 |
| 725 void ScrollingCoordinator::layerTreeViewInitialized(WebLayerTreeView& layerTreeV iew) | 723 void ScrollingCoordinator::layerTreeViewInitialized(WebLayerTreeView& layerTreeV iew) |
| 726 { | 724 { |
| 727 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled() && Platfor m::current()->isThreadedAnimationEnabled()) { | 725 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled() && Platfor m::current()->isThreadedAnimationEnabled()) { |
| 728 ASSERT(Platform::current()->compositorSupport()); | 726 ASSERT(Platform::current()->compositorSupport()); |
| 729 m_programmaticScrollAnimatorTimeline = adoptPtr(Platform::current()->com positorSupport()->createAnimationTimeline()); | 727 m_programmaticScrollAnimatorTimeline = adoptPtr(Platform::current()->com positorSupport()->createAnimationTimeline()); |
| 730 layerTreeView.attachCompositorAnimationTimeline(m_programmaticScrollAnim atorTimeline.get()); | 728 layerTreeView.attachCompositorAnimationTimeline(m_programmaticScrollAnim atorTimeline.get()); |
| 731 } | 729 } |
| 730 m_webLayerTreeView = &layerTreeView; | |
|
aelias_OOO_until_Jul13
2016/01/27 23:55:46
I don't think we should make ScrollingCoordinator
dtapuska
2016/01/28 16:23:06
Done.
| |
| 732 } | 731 } |
| 733 | 732 |
| 734 void ScrollingCoordinator::willCloseLayerTreeView(WebLayerTreeView& layerTreeVie w) | 733 void ScrollingCoordinator::willCloseLayerTreeView(WebLayerTreeView& layerTreeVie w) |
| 735 { | 734 { |
| 736 if (m_programmaticScrollAnimatorTimeline) { | 735 if (m_programmaticScrollAnimatorTimeline) { |
| 737 layerTreeView.detachCompositorAnimationTimeline(m_programmaticScrollAnim atorTimeline.get()); | 736 layerTreeView.detachCompositorAnimationTimeline(m_programmaticScrollAnim atorTimeline.get()); |
| 738 m_programmaticScrollAnimatorTimeline.clear(); | 737 m_programmaticScrollAnimatorTimeline.clear(); |
| 739 } | 738 } |
| 739 m_webLayerTreeView = nullptr; | |
| 740 } | 740 } |
| 741 | 741 |
| 742 void ScrollingCoordinator::willBeDestroyed() | 742 void ScrollingCoordinator::willBeDestroyed() |
| 743 { | 743 { |
| 744 ASSERT(m_page); | 744 ASSERT(m_page); |
| 745 | 745 |
| 746 m_page = nullptr; | 746 m_page = nullptr; |
| 747 for (const auto& scrollbar : m_horizontalScrollbars) | 747 for (const auto& scrollbar : m_horizontalScrollbars) |
| 748 GraphicsLayer::unregisterContentsLayer(scrollbar.value->layer()); | 748 GraphicsLayer::unregisterContentsLayer(scrollbar.value->layer()); |
| 749 for (const auto& scrollbar : m_verticalScrollbars) | 749 for (const auto& scrollbar : m_verticalScrollbars) |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1082 bool frameIsScrollable = frameView && frameView->isScrollable(); | 1082 bool frameIsScrollable = frameView && frameView->isScrollable(); |
| 1083 if (frameIsScrollable != m_wasFrameScrollable) | 1083 if (frameIsScrollable != m_wasFrameScrollable) |
| 1084 return true; | 1084 return true; |
| 1085 | 1085 |
| 1086 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : nullptr) | 1086 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : nullptr) |
| 1087 return WebSize(frameView->contentsSize()) != scrollLayer->bounds(); | 1087 return WebSize(frameView->contentsSize()) != scrollLayer->bounds(); |
| 1088 return false; | 1088 return false; |
| 1089 } | 1089 } |
| 1090 | 1090 |
| 1091 } // namespace blink | 1091 } // namespace blink |
| OLD | NEW |