- Revision
- 109237
- Author
- [email protected]
- Date
- 2012-02-29 11:51:54 -0800 (Wed, 29 Feb 2012)
Log Message
https://bugs.webkit.org/show_bug.cgi?id=79868
Overlay scrollbars should respond to AppKit's NSEventPhaseMayBegin
-and corresponding-
<rdar://problem/10688637>
Reviewed by Anders Carlsson.
Scrollbars are currently drawn on the main thread even when scrolling happens
on the scrolling thread, so we have to call back to the main thread for the
time being to make the right drawing calls for NSEventPhaseMayBegin.
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::handleWheelEventPhase):
(WebCore):
* page/scrolling/ScrollingCoordinator.h:
(ScrollingCoordinator):
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::handleWheelEventPhase):
(WebCore):
* page/scrolling/ScrollingTree.h:
* page/scrolling/mac/ScrollingTreeNodeMac.mm:
(WebCore::ScrollingTreeNodeMac::handleWheelEvent):
* platform/ScrollAnimator.h:
(WebCore::ScrollAnimator::handleWheelEventPhase):
(ScrollAnimator):
Call into AppKit on NSEventPhaseMayBegin.
* platform/mac/ScrollAnimatorMac.h:
(ScrollAnimatorMac):
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::mayBeginScrollGesture):
(WebCore):
(WebCore::ScrollAnimatorMac::handleWheelEventPhase):
(WebCore::ScrollAnimatorMac::handleWheelEvent):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (109236 => 109237)
--- trunk/Source/WebCore/ChangeLog 2012-02-29 19:51:11 UTC (rev 109236)
+++ trunk/Source/WebCore/ChangeLog 2012-02-29 19:51:54 UTC (rev 109237)
@@ -1,3 +1,39 @@
+2012-02-28 Beth Dakin <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=79868
+ Overlay scrollbars should respond to AppKit's NSEventPhaseMayBegin
+ -and corresponding-
+ <rdar://problem/10688637>
+
+ Reviewed by Anders Carlsson.
+
+ Scrollbars are currently drawn on the main thread even when scrolling happens
+ on the scrolling thread, so we have to call back to the main thread for the
+ time being to make the right drawing calls for NSEventPhaseMayBegin.
+ * page/scrolling/ScrollingCoordinator.cpp:
+ (WebCore::ScrollingCoordinator::handleWheelEventPhase):
+ (WebCore):
+ * page/scrolling/ScrollingCoordinator.h:
+ (ScrollingCoordinator):
+ * page/scrolling/ScrollingTree.cpp:
+ (WebCore::ScrollingTree::handleWheelEventPhase):
+ (WebCore):
+ * page/scrolling/ScrollingTree.h:
+ * page/scrolling/mac/ScrollingTreeNodeMac.mm:
+ (WebCore::ScrollingTreeNodeMac::handleWheelEvent):
+ * platform/ScrollAnimator.h:
+ (WebCore::ScrollAnimator::handleWheelEventPhase):
+ (ScrollAnimator):
+
+ Call into AppKit on NSEventPhaseMayBegin.
+ * platform/mac/ScrollAnimatorMac.h:
+ (ScrollAnimatorMac):
+ * platform/mac/ScrollAnimatorMac.mm:
+ (WebCore::ScrollAnimatorMac::mayBeginScrollGesture):
+ (WebCore):
+ (WebCore::ScrollAnimatorMac::handleWheelEventPhase):
+ (WebCore::ScrollAnimatorMac::handleWheelEvent):
+
2012-02-28 Jer Noble <[email protected]>
Full screen video volume slider has "progress bar"
Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (109236 => 109237)
--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp 2012-02-29 19:51:11 UTC (rev 109236)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp 2012-02-29 19:51:54 UTC (rev 109237)
@@ -279,6 +279,22 @@
#endif
}
+#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN))
+void ScrollingCoordinator::handleWheelEventPhase(PlatformWheelEventPhase phase)
+{
+ ASSERT(isMainThread());
+
+ if (!m_page)
+ return;
+
+ FrameView* frameView = m_page->mainFrame()->view();
+ if (!frameView)
+ return;
+
+ frameView->scrollAnimator()->handleWheelEventPhase(phase);
+}
+#endif
+
void ScrollingCoordinator::recomputeWheelEventHandlerCount()
{
unsigned wheelEventHandlerCount = 0;
Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (109236 => 109237)
--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h 2012-02-29 19:51:11 UTC (rev 109236)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h 2012-02-29 19:51:54 UTC (rev 109237)
@@ -28,6 +28,7 @@
#include "GraphicsLayer.h"
#include "IntRect.h"
+#include "PlatformWheelEvent.h"
#include "ScrollTypes.h"
#include "Timer.h"
#include <wtf/Forward.h>
@@ -46,7 +47,6 @@
class FrameView;
class GraphicsLayer;
class Page;
-class PlatformWheelEvent;
class Region;
class ScrollingCoordinatorPrivate;
class ScrollingTreeState;
@@ -107,6 +107,11 @@
// Dispatched by the scrolling tree whenever the main frame scroll position changes and the scroll layer position needs to be updated as well.
void updateMainFrameScrollPositionAndScrollLayerPosition(const IntPoint&);
+#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN))
+ // Dispatched by the scrolling tree during handleWheelEvent. This is required as long as scrollbars are painted on the main thread.
+ void handleWheelEventPhase(PlatformWheelEventPhase);
+#endif
+
private:
explicit ScrollingCoordinator(Page*);
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (109236 => 109237)
--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp 2012-02-29 19:51:11 UTC (rev 109236)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp 2012-02-29 19:51:54 UTC (rev 109237)
@@ -174,6 +174,16 @@
callOnMainThread(bind(&ScrollingCoordinator::updateMainFrameScrollPositionAndScrollLayerPosition, m_scrollingCoordinator.get(), scrollPosition));
}
+#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN))
+void ScrollingTree::handleWheelEventPhase(PlatformWheelEventPhase phase)
+{
+ if (!m_scrollingCoordinator)
+ return;
+
+ callOnMainThread(bind(&ScrollingCoordinator::handleWheelEventPhase, m_scrollingCoordinator.get(), phase));
+}
+#endif
+
bool ScrollingTree::canGoBack()
{
MutexLocker lock(m_swipeStateMutex);
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.h (109236 => 109237)
--- trunk/Source/WebCore/page/scrolling/ScrollingTree.h 2012-02-29 19:51:11 UTC (rev 109236)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.h 2012-02-29 19:51:54 UTC (rev 109237)
@@ -28,6 +28,7 @@
#if ENABLE(THREADED_SCROLLING)
+#include "PlatformWheelEvent.h"
#include "Region.h"
#include <wtf/Functional.h>
#include <wtf/OwnPtr.h>
@@ -39,7 +40,6 @@
namespace WebCore {
class IntPoint;
-class PlatformWheelEvent;
class ScrollingCoordinator;
class ScrollingTreeNode;
class ScrollingTreeState;
@@ -80,6 +80,10 @@
void updateMainFrameScrollPosition(const IntPoint& scrollPosition);
void updateMainFrameScrollPositionAndScrollLayerPosition(const IntPoint& scrollPosition);
+#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN))
+ void handleWheelEventPhase(PlatformWheelEventPhase);
+#endif
+
bool canGoBack();
bool canGoForward();
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm (109236 => 109237)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm 2012-02-29 19:51:11 UTC (rev 109236)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm 2012-02-29 19:51:54 UTC (rev 109237)
@@ -65,6 +65,7 @@
void ScrollingTreeNodeMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
{
m_scrollElasticityController.handleWheelEvent(wheelEvent);
+ scrollingTree()->handleWheelEventPhase(wheelEvent.phase());
}
void ScrollingTreeNodeMac::setScrollPosition(const IntPoint& scrollPosition)
Modified: trunk/Source/WebCore/platform/ScrollAnimator.h (109236 => 109237)
--- trunk/Source/WebCore/platform/ScrollAnimator.h 2012-02-29 19:51:11 UTC (rev 109236)
+++ trunk/Source/WebCore/platform/ScrollAnimator.h 2012-02-29 19:51:54 UTC (rev 109237)
@@ -31,13 +31,13 @@
#ifndef ScrollAnimator_h
#define ScrollAnimator_h
+#include "PlatformWheelEvent.h"
#include "ScrollTypes.h"
#include <wtf/Forward.h>
namespace WebCore {
class FloatPoint;
-class PlatformWheelEvent;
class ScrollableArea;
class Scrollbar;
@@ -65,6 +65,10 @@
virtual bool handleWheelEvent(const PlatformWheelEvent&);
+#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN))
+ virtual void handleWheelEventPhase(PlatformWheelEventPhase) { }
+#endif
+
void setCurrentPosition(const FloatPoint&);
FloatPoint currentPosition() const;
Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h (109236 => 109237)
--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h 2012-02-29 19:51:11 UTC (rev 109236)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h 2012-02-29 19:51:54 UTC (rev 109237)
@@ -86,6 +86,8 @@
virtual bool handleWheelEvent(const PlatformWheelEvent&) OVERRIDE;
#endif
+ virtual void handleWheelEventPhase(PlatformWheelEventPhase) OVERRIDE;
+
virtual void cancelAnimations();
virtual void setIsActive();
@@ -103,6 +105,7 @@
virtual void contentAreaDidHide() const;
void didBeginScrollGesture() const;
void didEndScrollGesture() const;
+ void mayBeginScrollGesture() const;
virtual void didAddVerticalScrollbar(Scrollbar*);
virtual void willRemoveVerticalScrollbar(Scrollbar*);
Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (109236 => 109237)
--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2012-02-29 19:51:11 UTC (rev 109236)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2012-02-29 19:51:54 UTC (rev 109237)
@@ -779,6 +779,17 @@
[m_scrollbarPainterController.get() endScrollGesture];
}
+void ScrollAnimatorMac::mayBeginScrollGesture() const
+{
+ if (!scrollableArea()->isOnActivePage())
+ return;
+ if (!isScrollbarOverlayAPIAvailable())
+ return;
+
+ [m_scrollbarPainterController.get() beginScrollGesture];
+ [m_scrollbarPainterController.get() contentAreaScrolled];
+}
+
void ScrollAnimatorMac::didAddVerticalScrollbar(Scrollbar* scrollbar)
{
if (!isScrollbarOverlayAPIAvailable())
@@ -889,6 +900,16 @@
}
}
+void ScrollAnimatorMac::handleWheelEventPhase(PlatformWheelEventPhase phase)
+{
+ if (phase == PlatformWheelEventPhaseBegan)
+ didBeginScrollGesture();
+ else if (phase == PlatformWheelEventPhaseEnded || phase == PlatformWheelEventPhaseCancelled)
+ didEndScrollGesture();
+ else if (phase == PlatformWheelEventPhaseMayBegin)
+ mayBeginScrollGesture();
+}
+
#if ENABLE(RUBBER_BANDING)
bool ScrollAnimatorMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
{
@@ -911,12 +932,8 @@
bool didHandleEvent = m_scrollElasticityController.handleWheelEvent(wheelEvent);
- if (didHandleEvent) {
- if (wheelEvent.phase() == PlatformWheelEventPhaseBegan)
- didBeginScrollGesture();
- else if (wheelEvent.phase() == PlatformWheelEventPhaseEnded)
- didEndScrollGesture();
- }
+ if (didHandleEvent)
+ handleWheelEventPhase(wheelEvent.phase());
return didHandleEvent;
}