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 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 clipParentWebLayer = toWebLayer(parent->compositedLayerMapping()->parent
ForSublayers()); | 640 clipParentWebLayer = toWebLayer(parent->compositedLayerMapping()->parent
ForSublayers()); |
641 | 641 |
642 child->setClipParent(clipParentWebLayer); | 642 child->setClipParent(clipParentWebLayer); |
643 } | 643 } |
644 | 644 |
645 void ScrollingCoordinator::willDestroyRenderLayer(RenderLayer* layer) | 645 void ScrollingCoordinator::willDestroyRenderLayer(RenderLayer* layer) |
646 { | 646 { |
647 m_layersWithTouchRects.remove(layer); | 647 m_layersWithTouchRects.remove(layer); |
648 } | 648 } |
649 | 649 |
650 void ScrollingCoordinator::setWheelEventHandlerCount(unsigned count) | 650 void ScrollingCoordinator::updateHaveWheelEventHandlers() |
651 { | 651 { |
652 if (WebLayer* scrollLayer = toWebLayer(m_page->mainFrame()->view()->layerFor
Scrolling())) | 652 ASSERT(isMainThread()); |
653 scrollLayer->setHaveWheelEventHandlers(count > 0); | 653 ASSERT(m_page); |
| 654 |
| 655 if (WebLayer* scrollLayer = toWebLayer(m_page->mainFrame()->view()->layerFor
Scrolling())) { |
| 656 unsigned wheelEventHandlerCount = 0; |
| 657 |
| 658 for (LocalFrame* frame = m_page->mainFrame(); frame; frame = frame->tree
().traverseNext()) { |
| 659 wheelEventHandlerCount += WheelController::from(*frame->document())-
>wheelEventHandlerCount(); |
| 660 } |
| 661 |
| 662 scrollLayer->setHaveWheelEventHandlers(wheelEventHandlerCount); |
| 663 } |
654 } | 664 } |
655 | 665 |
656 void ScrollingCoordinator::recomputeWheelEventHandlerCountForFrameView(FrameView
*) | 666 void ScrollingCoordinator::updateHaveScrollEventHandlers() |
657 { | 667 { |
658 setWheelEventHandlerCount(computeCurrentWheelEventHandlerCount()); | 668 ASSERT(isMainThread()); |
| 669 ASSERT(m_page); |
| 670 |
| 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 } |
659 } | 679 } |
660 | 680 |
661 void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(MainTh
readScrollingReasons reasons) | 681 void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(MainTh
readScrollingReasons reasons) |
662 { | 682 { |
663 if (WebLayer* scrollLayer = toWebLayer(m_page->mainFrame()->view()->layerFor
Scrolling())) { | 683 if (WebLayer* scrollLayer = toWebLayer(m_page->mainFrame()->view()->layerFor
Scrolling())) { |
664 m_lastMainThreadScrollingReasons = reasons; | 684 m_lastMainThreadScrollingReasons = reasons; |
665 scrollLayer->setShouldScrollOnMainThread(reasons); | 685 scrollLayer->setShouldScrollOnMainThread(reasons); |
666 } | 686 } |
667 } | 687 } |
668 | 688 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 TRACE_EVENT0("input", "ScrollingCoordinator::computeTouchEventTargetRects"); | 832 TRACE_EVENT0("input", "ScrollingCoordinator::computeTouchEventTargetRects"); |
813 ASSERT(touchHitTestingEnabled()); | 833 ASSERT(touchHitTestingEnabled()); |
814 | 834 |
815 Document* document = m_page->mainFrame()->document(); | 835 Document* document = m_page->mainFrame()->document(); |
816 if (!document || !document->view()) | 836 if (!document || !document->view()) |
817 return; | 837 return; |
818 | 838 |
819 accumulateDocumentTouchEventTargetRects(rects, document); | 839 accumulateDocumentTouchEventTargetRects(rects, document); |
820 } | 840 } |
821 | 841 |
822 unsigned ScrollingCoordinator::computeCurrentWheelEventHandlerCount() | |
823 { | |
824 unsigned wheelEventHandlerCount = 0; | |
825 | |
826 for (LocalFrame* frame = m_page->mainFrame(); frame; frame = frame->tree().t
raverseNext()) { | |
827 if (frame->document()) | |
828 wheelEventHandlerCount += WheelController::from(*frame->document())-
>wheelEventHandlerCount(); | |
829 } | |
830 | |
831 return wheelEventHandlerCount; | |
832 } | |
833 | |
834 void ScrollingCoordinator::frameViewWheelEventHandlerCountChanged(FrameView* fra
meView) | |
835 { | |
836 ASSERT(isMainThread()); | |
837 ASSERT(m_page); | |
838 | |
839 recomputeWheelEventHandlerCountForFrameView(frameView); | |
840 } | |
841 | |
842 void ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange(FrameView* fr
ameView) | 842 void ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange(FrameView* fr
ameView) |
843 { | 843 { |
844 ASSERT(isMainThread()); | 844 ASSERT(isMainThread()); |
845 ASSERT(m_page); | 845 ASSERT(m_page); |
846 | 846 |
847 if (!coordinatesScrollingForFrameView(frameView)) | 847 if (!coordinatesScrollingForFrameView(frameView)) |
848 return; | 848 return; |
849 | 849 |
850 m_shouldScrollOnMainThreadDirty = true; | 850 m_shouldScrollOnMainThreadDirty = true; |
851 } | 851 } |
(...skipping 29 matching lines...) Expand all Loading... |
881 | 881 |
882 void ScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView) | 882 void ScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView) |
883 { | 883 { |
884 ASSERT(isMainThread()); | 884 ASSERT(isMainThread()); |
885 ASSERT(m_page); | 885 ASSERT(m_page); |
886 | 886 |
887 if (!coordinatesScrollingForFrameView(frameView)) | 887 if (!coordinatesScrollingForFrameView(frameView)) |
888 return; | 888 return; |
889 | 889 |
890 notifyLayoutUpdated(); | 890 notifyLayoutUpdated(); |
891 recomputeWheelEventHandlerCountForFrameView(frameView); | 891 updateHaveWheelEventHandlers(); |
| 892 updateHaveScrollEventHandlers(); |
892 } | 893 } |
893 | 894 |
894 #if OS(MACOSX) | 895 #if OS(MACOSX) |
895 void ScrollingCoordinator::handleWheelEventPhase(PlatformWheelEventPhase phase) | 896 void ScrollingCoordinator::handleWheelEventPhase(PlatformWheelEventPhase phase) |
896 { | 897 { |
897 ASSERT(isMainThread()); | 898 ASSERT(isMainThread()); |
898 | 899 |
899 if (!m_page) | 900 if (!m_page) |
900 return; | 901 return; |
901 | 902 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 bool frameIsScrollable = frameView && frameView->isScrollable(); | 978 bool frameIsScrollable = frameView && frameView->isScrollable(); |
978 if (frameIsScrollable != m_wasFrameScrollable) | 979 if (frameIsScrollable != m_wasFrameScrollable) |
979 return true; | 980 return true; |
980 | 981 |
981 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : 0) | 982 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : 0) |
982 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); | 983 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); |
983 return false; | 984 return false; |
984 } | 985 } |
985 | 986 |
986 } // namespace WebCore | 987 } // namespace WebCore |
OLD | NEW |