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 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
645 clipParentWebLayer = toWebLayer(parent->compositedLayerMapping()->parent ForSublayers()); | 645 clipParentWebLayer = toWebLayer(parent->compositedLayerMapping()->parent ForSublayers()); |
646 | 646 |
647 child->setClipParent(clipParentWebLayer); | 647 child->setClipParent(clipParentWebLayer); |
648 } | 648 } |
649 | 649 |
650 void ScrollingCoordinator::willDestroyRenderLayer(RenderLayer* layer) | 650 void ScrollingCoordinator::willDestroyRenderLayer(RenderLayer* layer) |
651 { | 651 { |
652 m_layersWithTouchRects.remove(layer); | 652 m_layersWithTouchRects.remove(layer); |
653 } | 653 } |
654 | 654 |
655 void ScrollingCoordinator::setWheelEventHandlerCount(unsigned count) | 655 void ScrollingCoordinator::updateHaveWheelEventHandlers() |
656 { | 656 { |
657 if (WebLayer* scrollLayer = toWebLayer(m_page->mainFrame()->view()->layerFor Scrolling())) | 657 if (WebLayer* scrollLayer = toWebLayer(m_page->mainFrame()->view()->layerFor Scrolling())) { |
658 scrollLayer->setHaveWheelEventHandlers(count > 0); | 658 unsigned wheelEventHandlerCount = 0; |
659 | |
660 for (LocalFrame* frame = m_page->mainFrame(); frame; frame = frame->tree ().traverseNext()) { | |
661 if (frame->document()) | |
abarth-chromium
2014/04/11 18:53:38
Can frame->document() actually be zero here? That
| |
662 wheelEventHandlerCount += WheelController::from(*frame->document ())->wheelEventHandlerCount(); | |
663 } | |
664 | |
665 scrollLayer->setHaveWheelEventHandlers(wheelEventHandlerCount); | |
666 } | |
659 } | 667 } |
660 | 668 |
661 void ScrollingCoordinator::recomputeWheelEventHandlerCountForFrameView(FrameView *) | 669 void ScrollingCoordinator::updateHaveScrollEventHandlers() |
662 { | 670 { |
663 setWheelEventHandlerCount(computeCurrentWheelEventHandlerCount()); | 671 // Currently the compositor only cares whether there are scroll handlers any where on the page |
672 // instead on a per-layer basis. We therefore only update this information f or the root | |
673 // scrolling layer. | |
674 if (WebLayer* scrollLayer = toWebLayer(m_page->mainFrame()->view()->layerFor Scrolling())) { | |
675 // TODO(skyostil): Hook this up. | |
676 bool haveHandlers = false; | |
677 scrollLayer->setHaveScrollEventHandlers(haveHandlers); | |
678 } | |
664 } | 679 } |
665 | 680 |
666 void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(MainTh readScrollingReasons reasons) | 681 void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(MainTh readScrollingReasons reasons) |
667 { | 682 { |
668 if (WebLayer* scrollLayer = toWebLayer(m_page->mainFrame()->view()->layerFor Scrolling())) { | 683 if (WebLayer* scrollLayer = toWebLayer(m_page->mainFrame()->view()->layerFor Scrolling())) { |
669 m_lastMainThreadScrollingReasons = reasons; | 684 m_lastMainThreadScrollingReasons = reasons; |
670 scrollLayer->setShouldScrollOnMainThread(reasons); | 685 scrollLayer->setShouldScrollOnMainThread(reasons); |
671 } | 686 } |
672 } | 687 } |
673 | 688 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
813 TRACE_EVENT0("input", "ScrollingCoordinator::computeTouchEventTargetRects"); | 828 TRACE_EVENT0("input", "ScrollingCoordinator::computeTouchEventTargetRects"); |
814 ASSERT(touchHitTestingEnabled()); | 829 ASSERT(touchHitTestingEnabled()); |
815 | 830 |
816 Document* document = m_page->mainFrame()->document(); | 831 Document* document = m_page->mainFrame()->document(); |
817 if (!document || !document->view()) | 832 if (!document || !document->view()) |
818 return; | 833 return; |
819 | 834 |
820 accumulateDocumentTouchEventTargetRects(rects, document); | 835 accumulateDocumentTouchEventTargetRects(rects, document); |
821 } | 836 } |
822 | 837 |
823 unsigned ScrollingCoordinator::computeCurrentWheelEventHandlerCount() | 838 void ScrollingCoordinator::haveWheelEventHandlersChangedForPage() |
824 { | |
825 unsigned wheelEventHandlerCount = 0; | |
826 | |
827 for (LocalFrame* frame = m_page->mainFrame(); frame; frame = frame->tree().t raverseNext()) { | |
828 if (frame->document()) | |
829 wheelEventHandlerCount += WheelController::from(*frame->document())- >wheelEventHandlerCount(); | |
830 } | |
831 | |
832 return wheelEventHandlerCount; | |
833 } | |
834 | |
835 void ScrollingCoordinator::frameViewWheelEventHandlerCountChanged(FrameView* fra meView) | |
836 { | 839 { |
837 ASSERT(isMainThread()); | 840 ASSERT(isMainThread()); |
838 ASSERT(m_page); | 841 ASSERT(m_page); |
839 | 842 |
840 recomputeWheelEventHandlerCountForFrameView(frameView); | 843 updateHaveWheelEventHandlers(); |
844 } | |
abarth-chromium
2014/04/11 18:53:38
Why not have the callers of this function just cal
| |
845 | |
846 void ScrollingCoordinator::haveScrollEventHandlersChangedForPage() | |
847 { | |
848 ASSERT(isMainThread()); | |
849 ASSERT(m_page); | |
850 | |
851 updateHaveScrollEventHandlers(); | |
841 } | 852 } |
abarth-chromium
2014/04/11 18:53:38
ditto
| |
842 | 853 |
843 void ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange(FrameView* fr ameView) | 854 void ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange(FrameView* fr ameView) |
844 { | 855 { |
845 ASSERT(isMainThread()); | 856 ASSERT(isMainThread()); |
846 ASSERT(m_page); | 857 ASSERT(m_page); |
847 | 858 |
848 if (!coordinatesScrollingForFrameView(frameView)) | 859 if (!coordinatesScrollingForFrameView(frameView)) |
849 return; | 860 return; |
850 | 861 |
851 m_shouldScrollOnMainThreadDirty = true; | 862 m_shouldScrollOnMainThreadDirty = true; |
(...skipping 30 matching lines...) Expand all Loading... | |
882 | 893 |
883 void ScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView) | 894 void ScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView) |
884 { | 895 { |
885 ASSERT(isMainThread()); | 896 ASSERT(isMainThread()); |
886 ASSERT(m_page); | 897 ASSERT(m_page); |
887 | 898 |
888 if (!coordinatesScrollingForFrameView(frameView)) | 899 if (!coordinatesScrollingForFrameView(frameView)) |
889 return; | 900 return; |
890 | 901 |
891 notifyLayoutUpdated(); | 902 notifyLayoutUpdated(); |
892 recomputeWheelEventHandlerCountForFrameView(frameView); | 903 updateHaveWheelEventHandlers(); |
904 updateHaveScrollEventHandlers(); | |
893 } | 905 } |
894 | 906 |
895 #if OS(MACOSX) | 907 #if OS(MACOSX) |
896 void ScrollingCoordinator::handleWheelEventPhase(PlatformWheelEventPhase phase) | 908 void ScrollingCoordinator::handleWheelEventPhase(PlatformWheelEventPhase phase) |
897 { | 909 { |
898 ASSERT(isMainThread()); | 910 ASSERT(isMainThread()); |
899 | 911 |
900 if (!m_page) | 912 if (!m_page) |
901 return; | 913 return; |
902 | 914 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
978 bool frameIsScrollable = frameView && frameView->isScrollable(); | 990 bool frameIsScrollable = frameView && frameView->isScrollable(); |
979 if (frameIsScrollable != m_wasFrameScrollable) | 991 if (frameIsScrollable != m_wasFrameScrollable) |
980 return true; | 992 return true; |
981 | 993 |
982 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : 0) | 994 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : 0) |
983 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( ); | 995 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( ); |
984 return false; | 996 return false; |
985 } | 997 } |
986 | 998 |
987 } // namespace WebCore | 999 } // namespace WebCore |
OLD | NEW |