https://bugs.webkit.org/show_bug.cgi?id=79133
Reviewed by Dimitri Glazkov.
Source/WebCore:
This notifies the chromium compositor of changes to the number of wheel event handlers via ScrollingCoordinator
instead of through ChromeClient/WebViewImpl. This is the path we'll use for other properties in the future and
is more extensible for handling things other than the root layer.
Property behavior is covered by new unit tests in LayerChromiumTests and CCLayerTreeHostImplTest.
* page/scrolling/ScrollingCoordinator.cpp:
* page/scrolling/ScrollingCoordinator.h:
(WebCore):
(ScrollingCoordinator):
Add a ScrollingCoordinatorPrivate so implementations can tack on additional data without having to #ifdef up
ScrollingCoordinator.h/cpp
* page/scrolling/ScrollingCoordinatorNone.cpp:
(WebCore):
(WebCore::ScrollingCoordinator::~ScrollingCoordinator):
* page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:
(ScrollingCoordinatorPrivate):
ScrollingCoordinatorPrivate in the chromium implementation keeps a reference to the scroll layer.
(WebCore::ScrollingCoordinatorPrivate::ScrollingCoordinatorPrivate):
(WebCore::ScrollingCoordinatorPrivate::~ScrollingCoordinatorPrivate):
(WebCore::ScrollingCoordinatorPrivate::setScrollLayer):
(WebCore::ScrollingCoordinatorPrivate::scrollLayer):
(WebCore):
(WebCore::ScrollingCoordinator::create):
(WebCore::ScrollingCoordinator::~ScrollingCoordinator):
(WebCore::ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange):
(WebCore::ScrollingCoordinator::frameViewVerticalScrollbarLayerDidChange):
(WebCore::ScrollingCoordinator::setScrollLayer):
(WebCore::ScrollingCoordinator::setNonFastScrollableRegion):
(WebCore::ScrollingCoordinator::setScrollParameters):
(WebCore::ScrollingCoordinator::setWheelEventHandlerCount):
(WebCore::ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread):
* page/scrolling/mac/ScrollingCoordinatorMac.mm:
(WebCore):
(WebCore::ScrollingCoordinator::~ScrollingCoordinator):
* platform/graphics/chromium/LayerChromium.cpp:
(WebCore::LayerChromium::LayerChromium):
(WebCore::LayerChromium::setHaveWheelEventHandlers):
(WebCore):
(WebCore::LayerChromium::pushPropertiesTo):
* platform/graphics/chromium/LayerChromium.h:
(LayerChromium):
* platform/graphics/chromium/cc/CCInputHandler.h:
* platform/graphics/chromium/cc/CCLayerImpl.cpp:
(WebCore::CCLayerImpl::CCLayerImpl):
* platform/graphics/chromium/cc/CCLayerImpl.h:
(WebCore::CCLayerImpl::haveWheelEventHandlers):
(WebCore::CCLayerImpl::setHaveWheelEventHandlers):
(CCLayerImpl):
* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
(WebCore::CCLayerTreeHost::CCLayerTreeHost):
(WebCore::CCLayerTreeHost::finishCommitOnImplThread):
* platform/graphics/chromium/cc/CCLayerTreeHost.h:
(CCLayerTreeHost):
* platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
(WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl):
(WebCore::CCLayerTreeHostImpl::scrollBegin):
* platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
(CCLayerTreeHostImpl):
Source/WebKit/chromium:
Rips out old wheel event notification and adds unit tests for new LayerChromium property.
* src/NonCompositedContentHost.cpp:
(WebKit::NonCompositedContentHost::setViewport):
* src/WebCompositorInputHandlerImpl.cpp:
(WebKit::WebCompositorInputHandlerImpl::handleInputEvent):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::numberOfWheelEventHandlersChanged):
(WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
* src/WebViewImpl.h:
* tests/CCLayerTreeHostImplTest.cpp:
(WebKit::TEST_F):
(WebKit):
* tests/LayerChromiumTest.cpp:
* tests/WebCompositorInputHandlerImplTest.cpp:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108698
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-02-21 James Robinson <jamesr@chromium.org>
+
+ [chromium] Notify compositor of wheel event registration via ScrollingCoordinator
+ https://bugs.webkit.org/show_bug.cgi?id=79133
+
+ Reviewed by Dimitri Glazkov.
+
+ This notifies the chromium compositor of changes to the number of wheel event handlers via ScrollingCoordinator
+ instead of through ChromeClient/WebViewImpl. This is the path we'll use for other properties in the future and
+ is more extensible for handling things other than the root layer.
+
+ Property behavior is covered by new unit tests in LayerChromiumTests and CCLayerTreeHostImplTest.
+
+ * page/scrolling/ScrollingCoordinator.cpp:
+ * page/scrolling/ScrollingCoordinator.h:
+ (WebCore):
+ (ScrollingCoordinator):
+ Add a ScrollingCoordinatorPrivate so implementations can tack on additional data without having to #ifdef up
+ ScrollingCoordinator.h/cpp
+ * page/scrolling/ScrollingCoordinatorNone.cpp:
+ (WebCore):
+ (WebCore::ScrollingCoordinator::~ScrollingCoordinator):
+ * page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:
+ (ScrollingCoordinatorPrivate):
+ ScrollingCoordinatorPrivate in the chromium implementation keeps a reference to the scroll layer.
+ (WebCore::ScrollingCoordinatorPrivate::ScrollingCoordinatorPrivate):
+ (WebCore::ScrollingCoordinatorPrivate::~ScrollingCoordinatorPrivate):
+ (WebCore::ScrollingCoordinatorPrivate::setScrollLayer):
+ (WebCore::ScrollingCoordinatorPrivate::scrollLayer):
+ (WebCore):
+ (WebCore::ScrollingCoordinator::create):
+ (WebCore::ScrollingCoordinator::~ScrollingCoordinator):
+ (WebCore::ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange):
+ (WebCore::ScrollingCoordinator::frameViewVerticalScrollbarLayerDidChange):
+ (WebCore::ScrollingCoordinator::setScrollLayer):
+ (WebCore::ScrollingCoordinator::setNonFastScrollableRegion):
+ (WebCore::ScrollingCoordinator::setScrollParameters):
+ (WebCore::ScrollingCoordinator::setWheelEventHandlerCount):
+ (WebCore::ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread):
+ * page/scrolling/mac/ScrollingCoordinatorMac.mm:
+ (WebCore):
+ (WebCore::ScrollingCoordinator::~ScrollingCoordinator):
+ * platform/graphics/chromium/LayerChromium.cpp:
+ (WebCore::LayerChromium::LayerChromium):
+ (WebCore::LayerChromium::setHaveWheelEventHandlers):
+ (WebCore):
+ (WebCore::LayerChromium::pushPropertiesTo):
+ * platform/graphics/chromium/LayerChromium.h:
+ (LayerChromium):
+ * platform/graphics/chromium/cc/CCInputHandler.h:
+ * platform/graphics/chromium/cc/CCLayerImpl.cpp:
+ (WebCore::CCLayerImpl::CCLayerImpl):
+ * platform/graphics/chromium/cc/CCLayerImpl.h:
+ (WebCore::CCLayerImpl::haveWheelEventHandlers):
+ (WebCore::CCLayerImpl::setHaveWheelEventHandlers):
+ (CCLayerImpl):
+ * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+ (WebCore::CCLayerTreeHost::CCLayerTreeHost):
+ (WebCore::CCLayerTreeHost::finishCommitOnImplThread):
+ * platform/graphics/chromium/cc/CCLayerTreeHost.h:
+ (CCLayerTreeHost):
+ * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
+ (WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl):
+ (WebCore::CCLayerTreeHostImpl::scrollBegin):
+ * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
+ (CCLayerTreeHostImpl):
+
2012-02-23 No'am Rosenthal <noam.rosenthal@nokia.com>
[Qt][WK2] Clipping is broken
{
}
-ScrollingCoordinator::~ScrollingCoordinator()
-{
- ASSERT(!m_page);
-#if ENABLE(THREADED_SCROLLING)
- ASSERT(!m_scrollingTree);
-#endif
-}
-
void ScrollingCoordinator::pageDestroyed()
{
ASSERT(m_page);
class Page;
class PlatformWheelEvent;
class Region;
+class ScrollingCoordinatorPrivate;
class ScrollingTreeState;
#if ENABLE(THREADED_SCROLLING)
RefPtr<ScrollingTree> m_scrollingTree;
Timer<ScrollingCoordinator> m_scrollingTreeStateCommitterTimer;
#endif
+
+ ScrollingCoordinatorPrivate* m_private;
};
} // namespace WebCore
namespace WebCore {
+class ScrollingCoordinatorPrivate {
+};
+
#if !ENABLE(THREADED_SCROLLING)
PassRefPtr<ScrollingCoordinator> ScrollingCoordinator::create(Page* page)
{
return adoptRef(new ScrollingCoordinator(page));
}
+ScrollingCoordinator::~ScrollingCoordinator()
+{
+ ASSERT(!m_page);
+}
+
void ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange(FrameView*, GraphicsLayer*)
{
}
#include "ScrollingCoordinator.h"
+#include "LayerChromium.h"
+#include "Region.h"
+
namespace WebCore {
+class ScrollingCoordinatorPrivate {
+WTF_MAKE_NONCOPYABLE(ScrollingCoordinatorPrivate);
+public:
+ ScrollingCoordinatorPrivate() { }
+ ~ScrollingCoordinatorPrivate() { }
+
+ void setScrollLayer(LayerChromium* layer) { m_scrollLayer = layer; }
+ LayerChromium* scrollLayer() const { return m_scrollLayer.get(); }
+
+private:
+ RefPtr<LayerChromium> m_scrollLayer;
+};
+
PassRefPtr<ScrollingCoordinator> ScrollingCoordinator::create(Page* page)
{
- return adoptRef(new ScrollingCoordinator(page));
+ RefPtr<ScrollingCoordinator> coordinator(adoptRef(new ScrollingCoordinator(page)));
+ coordinator->m_private = new ScrollingCoordinatorPrivate;
+ return coordinator.release();
+}
+
+ScrollingCoordinator::~ScrollingCoordinator()
+{
+ ASSERT(!m_page);
+ delete m_private;
}
void ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange(FrameView*, GraphicsLayer* horizontalScrollbarLayer)
void ScrollingCoordinator::setScrollLayer(GraphicsLayer* scrollLayer)
{
- // FIXME: Implement!
+ m_private->setScrollLayer(scrollLayer ? scrollLayer->platformLayer() : 0);
}
void ScrollingCoordinator::setNonFastScrollableRegion(const Region&)
// FIXME: Implement!
}
-void ScrollingCoordinator::setWheelEventHandlerCount(unsigned)
+void ScrollingCoordinator::setWheelEventHandlerCount(unsigned wheelEventHandlerCount)
{
- // FIXME: Implement!
+ if (LayerChromium* layer = m_private->scrollLayer())
+ layer->setHaveWheelEventHandlers(wheelEventHandlerCount > 0);
}
-void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(bool)
+void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(bool should)
{
// FIXME: Implement!
}
namespace WebCore {
+class ScrollingCoordinatorPrivate {
+};
+
PassRefPtr<ScrollingCoordinator> ScrollingCoordinator::create(Page* page)
{
return adoptRef(new ScrollingCoordinator(page));
}
+ScrollingCoordinator::~ScrollingCoordinator()
+{
+ ASSERT(!m_page);
+ ASSERT(!m_scrollingTree);
+}
void ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange(FrameView* frameView, GraphicsLayer*)
{
, m_parent(0)
, m_layerAnimationController(CCLayerAnimationController::create())
, m_scrollable(false)
+ , m_haveWheelEventHandlers(false)
, m_anchorPoint(0.5, 0.5)
, m_backgroundColor(0, 0, 0, 0)
, m_backgroundCoversViewport(false)
setNeedsCommit();
}
+void LayerChromium::setHaveWheelEventHandlers(bool haveWheelEventHandlers)
+{
+ if (m_haveWheelEventHandlers == haveWheelEventHandlers)
+ return;
+ m_haveWheelEventHandlers = haveWheelEventHandlers;
+ setNeedsCommit();
+}
+
void LayerChromium::setDoubleSided(bool doubleSided)
{
if (m_doubleSided == doubleSided)
layer->setIsNonCompositedContent(m_isNonCompositedContent);
layer->setMasksToBounds(m_masksToBounds);
layer->setScrollable(m_scrollable);
+ layer->setHaveWheelEventHandlers(m_haveWheelEventHandlers);
layer->setName(m_name);
layer->setOpaque(m_opaque);
layer->setOpacity(m_opacity);
const IntPoint& scrollPosition() const { return m_scrollPosition; }
void setScrollable(bool);
- bool scrollable() const { return m_scrollable; }
+ void setHaveWheelEventHandlers(bool);
IntSize scrollDelta() const { return IntSize(); }
IntRect m_visibleLayerRect;
IntPoint m_scrollPosition;
bool m_scrollable;
+ bool m_haveWheelEventHandlers;
FloatPoint m_position;
FloatPoint m_anchorPoint;
Color m_backgroundColor;
virtual void setNeedsRedraw() = 0;
enum ScrollStatus { ScrollFailed, ScrollStarted, ScrollIgnored };
+ enum ScrollInputType { Gesture, Wheel };
// Attempt to start scrolling a layer at a given point in window
// coordinates. Returns ScrollStarted if the layer at the coordinates can
// be scrolled, ScrollFailed if the scroll event should instead be
// delegated to the main thread, or ScrollIgnored if there is nothing to
// be scrolled at the given coordinates.
- virtual ScrollStatus scrollBegin(const IntPoint&) = 0;
+ virtual ScrollStatus scrollBegin(const IntPoint&, ScrollInputType) = 0;
// Scroll the layer selected with scrollBegin(). If there is no room to
// move the layer in the requested direction, its first ancestor layer that
// called if scrollBegin() returned ScrollStarted.
virtual void scrollEnd() = 0;
- virtual bool haveWheelEventHandlers() = 0;
virtual void pinchGestureBegin() = 0;
virtual void pinchGestureUpdate(float magnifyDelta, const IntPoint& anchor) = 0;
virtual void pinchGestureEnd() = 0;
, m_anchorPoint(0.5, 0.5)
, m_anchorPointZ(0)
, m_scrollable(false)
+ , m_haveWheelEventHandlers(false)
, m_backgroundCoversViewport(false)
, m_doubleSided(true)
, m_layerPropertyChanged(false)
bool scrollable() const { return m_scrollable; }
void setScrollable(bool scrollable) { m_scrollable = scrollable; }
+ bool haveWheelEventHandlers() const { return m_haveWheelEventHandlers; }
+ void setHaveWheelEventHandlers(bool haveWheelEventHandlers) { m_haveWheelEventHandlers = haveWheelEventHandlers; }
+
const IntRect& visibleLayerRect() const { return m_visibleLayerRect; }
void setVisibleLayerRect(const IntRect& visibleLayerRect) { m_visibleLayerRect = visibleLayerRect; }
IntSize m_contentBounds;
IntPoint m_scrollPosition;
bool m_scrollable;
+ bool m_haveWheelEventHandlers;
Color m_backgroundColor;
bool m_backgroundCoversViewport;
, m_layerRendererInitialized(false)
, m_settings(settings)
, m_visible(true)
- , m_haveWheelEventHandlers(false)
, m_pageScaleFactor(1)
, m_minPageScaleFactor(1)
, m_maxPageScaleFactor(1)
hostImpl->setRootLayer(0);
hostImpl->setSourceFrameNumber(frameNumber());
- hostImpl->setHaveWheelEventHandlers(m_haveWheelEventHandlers);
hostImpl->setViewportSize(viewportSize());
hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFactor, m_maxPageScaleFactor);
hostImpl->setRootLayer(0);
}
-void CCLayerTreeHost::setHaveWheelEventHandlers(bool haveWheelEventHandlers)
-{
- if (m_haveWheelEventHandlers == haveWheelEventHandlers)
- return;
- m_haveWheelEventHandlers = haveWheelEventHandlers;
- m_proxy->setNeedsCommit();
-}
-
void CCLayerTreeHost::startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec)
{
m_proxy->startPageScaleAnimation(targetPosition, useAnchor, scale, durationSec);
bool visible() const { return m_visible; }
void setVisible(bool);
- void setHaveWheelEventHandlers(bool);
-
// Returns false if we should abort this frame due to initialization failure.
bool updateLayers();
IntSize m_viewportSize;
bool m_visible;
- bool m_haveWheelEventHandlers;
typedef HashMap<GraphicsContext3D*, RefPtr<RateLimiter> > RateLimiterMap;
RateLimiterMap m_rateLimiters;
, m_frameNumber(0)
, m_settings(settings)
, m_visible(true)
- , m_haveWheelEventHandlers(false)
, m_pageScale(1)
, m_pageScaleDelta(1)
, m_sentPageScaleDelta(1)
m_client->setNeedsRedrawOnImplThread();
}
-CCInputHandlerClient::ScrollStatus CCLayerTreeHostImpl::scrollBegin(const IntPoint&)
+CCInputHandlerClient::ScrollStatus CCLayerTreeHostImpl::scrollBegin(const IntPoint& point, CCInputHandlerClient::ScrollInputType type)
{
// TODO: Check for scrollable sublayers.
- if (!m_scrollLayerImpl || !m_scrollLayerImpl->scrollable())
+ if (!m_scrollLayerImpl || !m_scrollLayerImpl->scrollable()) {
+ TRACE_EVENT("scrollBegin Ignored no scrollable", this, 0);
return ScrollIgnored;
+ }
+
+ if (type == CCInputHandlerClient::Wheel && m_scrollLayerImpl->haveWheelEventHandlers()) {
+ TRACE_EVENT("scrollBegin Failed wheelEventHandlers", this, 0);
+ return ScrollFailed;
+ }
return ScrollStarted;
}
{
}
-bool CCLayerTreeHostImpl::haveWheelEventHandlers()
-{
- return m_haveWheelEventHandlers;
-}
-
void CCLayerTreeHostImpl::pinchGestureBegin()
{
m_pinchGestureActive = true;
// CCInputHandlerClient implementation
virtual void setNeedsRedraw();
- virtual CCInputHandlerClient::ScrollStatus scrollBegin(const IntPoint&);
+ virtual CCInputHandlerClient::ScrollStatus scrollBegin(const IntPoint&, CCInputHandlerClient::ScrollInputType);
virtual void scrollBy(const IntSize&);
virtual void scrollEnd();
- virtual bool haveWheelEventHandlers();
virtual void pinchGestureBegin();
virtual void pinchGestureUpdate(float, const IntPoint&);
virtual void pinchGestureEnd();
bool visible() const { return m_visible; }
void setVisible(bool);
- void setHaveWheelEventHandlers(bool haveWheelEventHandlers) { m_haveWheelEventHandlers = haveWheelEventHandlers; }
int sourceFrameNumber() const { return m_sourceFrameNumber; }
void setSourceFrameNumber(int frameNumber) { m_sourceFrameNumber = frameNumber; }
CCSettings m_settings;
IntSize m_viewportSize;
bool m_visible;
- bool m_haveWheelEventHandlers;
float m_pageScale;
float m_pageScaleDelta;
+2012-02-21 James Robinson <jamesr@chromium.org>
+
+ [chromium] Notify compositor of wheel event registration via ScrollingCoordinator
+ https://bugs.webkit.org/show_bug.cgi?id=79133
+
+ Reviewed by Dimitri Glazkov.
+
+ Rips out old wheel event notification and adds unit tests for new LayerChromium property.
+
+ * src/NonCompositedContentHost.cpp:
+ (WebKit::NonCompositedContentHost::setViewport):
+ * src/WebCompositorInputHandlerImpl.cpp:
+ (WebKit::WebCompositorInputHandlerImpl::handleInputEvent):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::numberOfWheelEventHandlersChanged):
+ (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+ * src/WebViewImpl.h:
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (WebKit::TEST_F):
+ (WebKit):
+ * tests/LayerChromiumTest.cpp:
+ * tests/WebCompositorInputHandlerImplTest.cpp:
+
2012-02-23 Adrienne Walker <enne@google.com>
Unreviewed, rolling out r108666.
ASSERT(CCProxy::isImplThread());
ASSERT(m_client);
- if (event.type == WebInputEvent::MouseWheel && !m_inputHandlerClient->haveWheelEventHandlers()) {
+ if (event.type == WebInputEvent::MouseWheel) {
const WebMouseWheelEvent& wheelEvent = *static_cast<const WebMouseWheelEvent*>(&event);
- CCInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(IntPoint(wheelEvent.x, wheelEvent.y));
+ CCInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(IntPoint(wheelEvent.x, wheelEvent.y), CCInputHandlerClient::Wheel);
switch (scrollStatus) {
case CCInputHandlerClient::ScrollStarted:
m_inputHandlerClient->scrollBy(IntSize(-wheelEvent.deltaX, -wheelEvent.deltaY));
m_expectScrollUpdateEnd = true;
#endif
const WebGestureEvent& gestureEvent = *static_cast<const WebGestureEvent*>(&event);
- CCInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(IntPoint(gestureEvent.x, gestureEvent.y));
+ CCInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(IntPoint(gestureEvent.x, gestureEvent.y), CCInputHandlerClient::Gesture);
switch (scrollStatus) {
case CCInputHandlerClient::ScrollStarted:
m_scrollStarted = true;
void WebViewImpl::numberOfWheelEventHandlersChanged(unsigned numberOfWheelHandlers)
{
- m_haveWheelEventHandlers = numberOfWheelHandlers > 0;
if (m_client)
m_client->numberOfWheelEventHandlersChanged(numberOfWheelHandlers);
-#if USE(ACCELERATED_COMPOSITING)
- if (m_layerTreeHost)
- m_layerTreeHost->setHaveWheelEventHandlers(m_haveWheelEventHandlers);
-#endif
}
void WebViewImpl::numberOfTouchEventHandlersChanged(unsigned numberOfTouchHandlers)
m_layerTreeHost = CCLayerTreeHost::create(this, ccSettings);
if (m_layerTreeHost) {
- m_layerTreeHost->setHaveWheelEventHandlers(m_haveWheelEventHandlers);
m_layerTreeHost->setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor);
updateLayerTreeViewport();
m_client->didActivateCompositor(m_layerTreeHost->compositorIdentifier());
// If true, the graphics context is being restored.
bool m_recreatingGraphicsContext;
#endif
- bool m_haveWheelEventHandlers;
static const WebInputEvent* m_currentInputEvent;
#if ENABLE(INPUT_SPEECH)
root->setScrollPosition(IntPoint(0, 0));
root->setMaxScrollPosition(IntSize(100, 100));
m_hostImpl->setRootLayer(root);
- EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0)), CCInputHandlerClient::ScrollStarted);
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted);
m_hostImpl->scrollBy(IntSize(0, 10));
m_hostImpl->scrollEnd();
EXPECT_TRUE(m_didRequestRedraw);
EXPECT_TRUE(m_didRequestCommit);
}
+TEST_F(CCLayerTreeHostImplTest, wheelEventHandlers)
+{
+ RefPtr<CCLayerImpl> root = CCLayerImpl::create(0);
+ root->setScrollable(true);
+ root->setScrollPosition(IntPoint(0, 0));
+ root->setMaxScrollPosition(IntSize(100, 100));
+ m_hostImpl->setRootLayer(root);
+ root->setHaveWheelEventHandlers(true);
+ // With registered event handlers, wheel scrolls have to go to the main thread.
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollFailed);
+
+ // But gesture scrolls can still be handled.
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollStarted);
+}
+
TEST_F(CCLayerTreeHostImplTest, pinchGesture)
{
setupScrollAndContentsLayers(IntSize(100, 100));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setReplicaLayer(dummyLayer.get()));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setSublayerTransform(TransformationMatrix(0, 0, 0, 0, 0, 0)));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setScrollable(true));
+ EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setHaveWheelEventHandlers(true));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setScrollPosition(IntPoint(10, 10)));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setTransform(TransformationMatrix(0, 0, 0, 0, 0, 0)));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setDoubleSided(false));
private:
virtual void setNeedsRedraw() OVERRIDE { }
- virtual ScrollStatus scrollBegin(const WebCore::IntPoint&) OVERRIDE
+ virtual ScrollStatus scrollBegin(const WebCore::IntPoint&, WebCore::CCInputHandlerClient::ScrollInputType) OVERRIDE
{
return m_scrollStatus;
}
virtual void scrollBy(const WebCore::IntSize&) OVERRIDE { }
virtual void scrollEnd() OVERRIDE { }
- virtual bool haveWheelEventHandlers() OVERRIDE { return false; }
virtual void pinchGestureBegin() OVERRIDE
{
m_pinchStarted = true;