Index: Source/core/page/scrolling/ScrollingCoordinator.cpp |
diff --git a/Source/core/page/scrolling/ScrollingCoordinator.cpp b/Source/core/page/scrolling/ScrollingCoordinator.cpp |
index c09c01c5755f87eab0487d5af1a31e37ae6fe59b..bfb9b25d2e7c2bef6a47e49b89a107253cac8d16 100644 |
--- a/Source/core/page/scrolling/ScrollingCoordinator.cpp |
+++ b/Source/core/page/scrolling/ScrollingCoordinator.cpp |
@@ -30,6 +30,7 @@ |
#include "RuntimeEnabledFeatures.h" |
#include "core/dom/Document.h" |
#include "core/dom/Node.h" |
+#include "core/dom/ScrollEventHandlerController.h" |
#include "core/dom/WheelController.h" |
#include "core/html/HTMLElement.h" |
#include "core/frame/FrameView.h" |
@@ -623,11 +624,22 @@ void ScrollingCoordinator::setWheelEventHandlerCount(unsigned count) |
scrollLayer->setHaveWheelEventHandlers(count > 0); |
} |
+void ScrollingCoordinator::setScrollEventHandlerCount(unsigned count) |
+{ |
+ if (WebLayer* scrollLayer = toWebLayer(m_page->mainFrame()->view()->layerForScrolling())) |
+ scrollLayer->setHaveScrollEventHandlers(count > 0); |
+} |
+ |
void ScrollingCoordinator::recomputeWheelEventHandlerCountForFrameView(FrameView*) |
{ |
setWheelEventHandlerCount(computeCurrentWheelEventHandlerCount()); |
} |
+void ScrollingCoordinator::recomputeScrollEventHandlerCountForFrameView(FrameView*) |
+{ |
+ setScrollEventHandlerCount(computeCurrentScrollEventHandlerCount()); |
+} |
+ |
void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReasons reasons) |
{ |
if (WebLayer* scrollLayer = toWebLayer(m_page->mainFrame()->view()->layerForScrolling())) { |
@@ -797,6 +809,18 @@ unsigned ScrollingCoordinator::computeCurrentWheelEventHandlerCount() |
return wheelEventHandlerCount; |
} |
+unsigned ScrollingCoordinator::computeCurrentScrollEventHandlerCount() |
+{ |
+ unsigned scrollEventHandlerCount = 0; |
+ |
+ for (LocalFrame* frame = m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) { |
+ if (frame->document()) |
+ scrollEventHandlerCount += ScrollEventHandlerController::from(*frame->document())->scrollEventHandlerCount(); |
+ } |
+ |
+ return scrollEventHandlerCount; |
+} |
+ |
void ScrollingCoordinator::frameViewWheelEventHandlerCountChanged(FrameView* frameView) |
{ |
ASSERT(isMainThread()); |
@@ -805,6 +829,14 @@ void ScrollingCoordinator::frameViewWheelEventHandlerCountChanged(FrameView* fra |
recomputeWheelEventHandlerCountForFrameView(frameView); |
} |
+void ScrollingCoordinator::frameViewScrollEventHandlerCountChanged(FrameView* frameView) |
+{ |
+ ASSERT(isMainThread()); |
+ ASSERT(m_page); |
+ |
+ recomputeScrollEventHandlerCountForFrameView(frameView); |
+} |
+ |
void ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange(FrameView* frameView) |
{ |
ASSERT(isMainThread()); |
@@ -855,6 +887,7 @@ void ScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView) |
notifyLayoutUpdated(); |
recomputeWheelEventHandlerCountForFrameView(frameView); |
+ recomputeScrollEventHandlerCountForFrameView(frameView); |
} |
#if OS(MACOSX) |