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..07afe72fd5b3124449dd5f9b760aef4bce043b79 100644 |
--- a/Source/core/page/scrolling/ScrollingCoordinator.cpp |
+++ b/Source/core/page/scrolling/ScrollingCoordinator.cpp |
@@ -29,8 +29,8 @@ |
#include "RuntimeEnabledFeatures.h" |
#include "core/dom/Document.h" |
+#include "core/dom/EventHandlerRegistry.h" |
#include "core/dom/Node.h" |
-#include "core/dom/WheelController.h" |
#include "core/html/HTMLElement.h" |
#include "core/frame/FrameView.h" |
#include "core/frame/LocalFrame.h" |
@@ -623,11 +623,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*) |
Rick Byers
2014/03/24 14:27:59
What you're doing here seems conceptually similar
|
+{ |
+ setScrollEventHandlerCount(computeCurrentScrollEventHandlerCount()); |
+} |
+ |
void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReasons reasons) |
{ |
if (WebLayer* scrollLayer = toWebLayer(m_page->mainFrame()->view()->layerForScrolling())) { |
@@ -791,12 +802,24 @@ unsigned ScrollingCoordinator::computeCurrentWheelEventHandlerCount() |
for (LocalFrame* frame = m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) { |
if (frame->document()) |
- wheelEventHandlerCount += WheelController::from(*frame->document())->wheelEventHandlerCount(); |
+ wheelEventHandlerCount += EventHandlerRegistry::from(*frame->document())->wheelEventHandlerCount(); |
} |
return wheelEventHandlerCount; |
} |
+unsigned ScrollingCoordinator::computeCurrentScrollEventHandlerCount() |
+{ |
+ unsigned scrollEventHandlerCount = 0; |
+ |
+ for (LocalFrame* frame = m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) { |
+ if (frame->document()) |
+ scrollEventHandlerCount += EventHandlerRegistry::from(*frame->document())->scrollEventHandlerCount(); |
+ } |
+ |
+ return scrollEventHandlerCount; |
+} |
+ |
void ScrollingCoordinator::frameViewWheelEventHandlerCountChanged(FrameView* frameView) |
{ |
ASSERT(isMainThread()); |
@@ -805,6 +828,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 +886,7 @@ void ScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView) |
notifyLayoutUpdated(); |
recomputeWheelEventHandlerCountForFrameView(frameView); |
+ recomputeScrollEventHandlerCountForFrameView(frameView); |
} |
#if OS(MACOSX) |