Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp

Issue 1646603004: Move scroll event handlers from layer to layer tree view. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_cc_listeners
Patch Set: Rebase Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 clipParentWebLayer = toWebLayer(parent->compositedLayerMapping()->parent ForSublayers()); 673 clipParentWebLayer = toWebLayer(parent->compositedLayerMapping()->parent ForSublayers());
674 674
675 child->setClipParent(clipParentWebLayer); 675 child->setClipParent(clipParentWebLayer);
676 } 676 }
677 677
678 void ScrollingCoordinator::willDestroyLayer(PaintLayer* layer) 678 void ScrollingCoordinator::willDestroyLayer(PaintLayer* layer)
679 { 679 {
680 m_layersWithTouchRects.remove(layer); 680 m_layersWithTouchRects.remove(layer);
681 } 681 }
682 682
683 void ScrollingCoordinator::updateHaveScrollEventHandlers()
684 {
685 ASSERT(isMainThread());
686 ASSERT(m_page);
687 if (!m_page->mainFrame()->isLocalFrame() || !m_page->deprecatedLocalMainFram e()->view())
688 return;
689
690 // Currently the compositor only cares whether there are scroll handlers any where on the page
691 // instead on a per-layer basis. We therefore only update this information f or the root
692 // scrolling layer.
693 if (WebLayer* scrollLayer = toWebLayer(m_page->deprecatedLocalMainFrame()->v iew()->layerForScrolling())) {
694 bool haveHandlers = m_page->frameHost().eventHandlerRegistry().hasEventH andlers(EventHandlerRegistry::ScrollEvent);
695 scrollLayer->setHaveScrollEventHandlers(haveHandlers);
696 }
697 }
698
699 void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(MainTh readScrollingReasons mainThreadScrollingReasons) 683 void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(MainTh readScrollingReasons mainThreadScrollingReasons)
700 { 684 {
701 if (!m_page->mainFrame()->isLocalFrame() || !m_page->deprecatedLocalMainFram e()->view()) 685 if (!m_page->mainFrame()->isLocalFrame() || !m_page->deprecatedLocalMainFram e()->view())
702 return; 686 return;
703 if (WebLayer* scrollLayer = toWebLayer(m_page->deprecatedLocalMainFrame()->v iew()->layerForScrolling())) { 687 if (WebLayer* scrollLayer = toWebLayer(m_page->deprecatedLocalMainFrame()->v iew()->layerForScrolling())) {
704 m_lastMainThreadScrollingReasons = mainThreadScrollingReasons; 688 m_lastMainThreadScrollingReasons = mainThreadScrollingReasons;
705 if (mainThreadScrollingReasons) 689 if (mainThreadScrollingReasons)
706 scrollLayer->addMainThreadScrollingReasons(mainThreadScrollingReason s); 690 scrollLayer->addMainThreadScrollingReasons(mainThreadScrollingReason s);
707 else 691 else
708 scrollLayer->clearMainThreadScrollingReasons(); 692 scrollLayer->clearMainThreadScrollingReasons();
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 924
941 void ScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView) 925 void ScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView)
942 { 926 {
943 ASSERT(isMainThread()); 927 ASSERT(isMainThread());
944 ASSERT(m_page); 928 ASSERT(m_page);
945 929
946 if (!coordinatesScrollingForFrameView(frameView)) 930 if (!coordinatesScrollingForFrameView(frameView))
947 return; 931 return;
948 932
949 notifyGeometryChanged(); 933 notifyGeometryChanged();
950 updateHaveScrollEventHandlers();
951 } 934 }
952 935
953 #if OS(MACOSX) 936 #if OS(MACOSX)
954 void ScrollingCoordinator::handleWheelEventPhase(PlatformWheelEventPhase phase) 937 void ScrollingCoordinator::handleWheelEventPhase(PlatformWheelEventPhase phase)
955 { 938 {
956 ASSERT(isMainThread()); 939 ASSERT(isMainThread());
957 940
958 if (!m_page) 941 if (!m_page)
959 return; 942 return;
960 943
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 bool frameIsScrollable = frameView && frameView->isScrollable(); 1051 bool frameIsScrollable = frameView && frameView->isScrollable();
1069 if (frameIsScrollable != m_wasFrameScrollable) 1052 if (frameIsScrollable != m_wasFrameScrollable)
1070 return true; 1053 return true;
1071 1054
1072 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : nullptr) 1055 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : nullptr)
1073 return WebSize(frameView->contentsSize()) != scrollLayer->bounds(); 1056 return WebSize(frameView->contentsSize()) != scrollLayer->bounds();
1074 return false; 1057 return false;
1075 } 1058 }
1076 1059
1077 } // namespace blink 1060 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.h ('k') | third_party/WebKit/Source/web/ChromeClientImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698