Changeset 108698 in webkit


Ignore:
Timestamp:
Feb 23, 2012 4:29:53 PM (12 years ago)
Author:
jamesr@google.com
Message:

[chromium] Notify compositor of wheel event registration via ScrollingCoordinator
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:
Location:
trunk/Source
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r108696 r108698  
     12012-02-21  James Robinson  <jamesr@chromium.org>
     2
     3        [chromium] Notify compositor of wheel event registration via ScrollingCoordinator
     4        https://bugs.webkit.org/show_bug.cgi?id=79133
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        This notifies the chromium compositor of changes to the number of wheel event handlers via ScrollingCoordinator
     9        instead of through ChromeClient/WebViewImpl. This is the path we'll use for other properties in the future and
     10        is more extensible for handling things other than the root layer.
     11
     12        Property behavior is covered by new unit tests in LayerChromiumTests and CCLayerTreeHostImplTest.
     13
     14        * page/scrolling/ScrollingCoordinator.cpp:
     15        * page/scrolling/ScrollingCoordinator.h:
     16        (WebCore):
     17        (ScrollingCoordinator):
     18            Add a ScrollingCoordinatorPrivate so implementations can tack on additional data without having to #ifdef up
     19            ScrollingCoordinator.h/cpp
     20        * page/scrolling/ScrollingCoordinatorNone.cpp:
     21        (WebCore):
     22        (WebCore::ScrollingCoordinator::~ScrollingCoordinator):
     23        * page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:
     24        (ScrollingCoordinatorPrivate):
     25            ScrollingCoordinatorPrivate in the chromium implementation keeps a reference to the scroll layer.
     26        (WebCore::ScrollingCoordinatorPrivate::ScrollingCoordinatorPrivate):
     27        (WebCore::ScrollingCoordinatorPrivate::~ScrollingCoordinatorPrivate):
     28        (WebCore::ScrollingCoordinatorPrivate::setScrollLayer):
     29        (WebCore::ScrollingCoordinatorPrivate::scrollLayer):
     30        (WebCore):
     31        (WebCore::ScrollingCoordinator::create):
     32        (WebCore::ScrollingCoordinator::~ScrollingCoordinator):
     33        (WebCore::ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange):
     34        (WebCore::ScrollingCoordinator::frameViewVerticalScrollbarLayerDidChange):
     35        (WebCore::ScrollingCoordinator::setScrollLayer):
     36        (WebCore::ScrollingCoordinator::setNonFastScrollableRegion):
     37        (WebCore::ScrollingCoordinator::setScrollParameters):
     38        (WebCore::ScrollingCoordinator::setWheelEventHandlerCount):
     39        (WebCore::ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread):
     40        * page/scrolling/mac/ScrollingCoordinatorMac.mm:
     41        (WebCore):
     42        (WebCore::ScrollingCoordinator::~ScrollingCoordinator):
     43        * platform/graphics/chromium/LayerChromium.cpp:
     44        (WebCore::LayerChromium::LayerChromium):
     45        (WebCore::LayerChromium::setHaveWheelEventHandlers):
     46        (WebCore):
     47        (WebCore::LayerChromium::pushPropertiesTo):
     48        * platform/graphics/chromium/LayerChromium.h:
     49        (LayerChromium):
     50        * platform/graphics/chromium/cc/CCInputHandler.h:
     51        * platform/graphics/chromium/cc/CCLayerImpl.cpp:
     52        (WebCore::CCLayerImpl::CCLayerImpl):
     53        * platform/graphics/chromium/cc/CCLayerImpl.h:
     54        (WebCore::CCLayerImpl::haveWheelEventHandlers):
     55        (WebCore::CCLayerImpl::setHaveWheelEventHandlers):
     56        (CCLayerImpl):
     57        * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
     58        (WebCore::CCLayerTreeHost::CCLayerTreeHost):
     59        (WebCore::CCLayerTreeHost::finishCommitOnImplThread):
     60        * platform/graphics/chromium/cc/CCLayerTreeHost.h:
     61        (CCLayerTreeHost):
     62        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
     63        (WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl):
     64        (WebCore::CCLayerTreeHostImpl::scrollBegin):
     65        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
     66        (CCLayerTreeHostImpl):
     67
    1682012-02-23  No'am Rosenthal  <noam.rosenthal@nokia.com>
    269
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp

    r108579 r108698  
    6262}
    6363
    64 ScrollingCoordinator::~ScrollingCoordinator()
    65 {
    66     ASSERT(!m_page);
    67 #if ENABLE(THREADED_SCROLLING)
    68     ASSERT(!m_scrollingTree);
    69 #endif
    70 }
    71 
    7264void ScrollingCoordinator::pageDestroyed()
    7365{
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h

    r108485 r108698  
    4949class PlatformWheelEvent;
    5050class Region;
     51class ScrollingCoordinatorPrivate;
    5152class ScrollingTreeState;
    5253
     
    134135    Timer<ScrollingCoordinator> m_scrollingTreeStateCommitterTimer;
    135136#endif
     137
     138    ScrollingCoordinatorPrivate* m_private;
    136139};
    137140
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinatorNone.cpp

    r108202 r108698  
    3030namespace WebCore {
    3131
     32class ScrollingCoordinatorPrivate {
     33};
     34
    3235#if !ENABLE(THREADED_SCROLLING)
    3336PassRefPtr<ScrollingCoordinator> ScrollingCoordinator::create(Page* page)
    3437{
    3538    return adoptRef(new ScrollingCoordinator(page));
     39}
     40
     41ScrollingCoordinator::~ScrollingCoordinator()
     42{
     43    ASSERT(!m_page);
    3644}
    3745
  • trunk/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp

    r108422 r108698  
    2828#include "ScrollingCoordinator.h"
    2929
     30#include "LayerChromium.h"
     31#include "Region.h"
     32
    3033namespace WebCore {
     34
     35class ScrollingCoordinatorPrivate {
     36WTF_MAKE_NONCOPYABLE(ScrollingCoordinatorPrivate);
     37public:
     38    ScrollingCoordinatorPrivate() { }
     39    ~ScrollingCoordinatorPrivate() { }
     40
     41    void setScrollLayer(LayerChromium* layer) { m_scrollLayer = layer; }
     42    LayerChromium* scrollLayer() const { return m_scrollLayer.get(); }
     43
     44private:
     45    RefPtr<LayerChromium> m_scrollLayer;
     46};
    3147
    3248PassRefPtr<ScrollingCoordinator> ScrollingCoordinator::create(Page* page)
    3349{
    34     return adoptRef(new ScrollingCoordinator(page));
     50    RefPtr<ScrollingCoordinator> coordinator(adoptRef(new ScrollingCoordinator(page)));
     51    coordinator->m_private = new ScrollingCoordinatorPrivate;
     52    return coordinator.release();
     53}
     54
     55ScrollingCoordinator::~ScrollingCoordinator()
     56{
     57    ASSERT(!m_page);
     58    delete m_private;
    3559}
    3660
     
    4771void ScrollingCoordinator::setScrollLayer(GraphicsLayer* scrollLayer)
    4872{
    49     // FIXME: Implement!
     73    m_private->setScrollLayer(scrollLayer ? scrollLayer->platformLayer() : 0);
    5074}
    5175
     
    6286}
    6387
    64 void ScrollingCoordinator::setWheelEventHandlerCount(unsigned)
     88void ScrollingCoordinator::setWheelEventHandlerCount(unsigned wheelEventHandlerCount)
    6589{
    66     // FIXME: Implement!
     90    if (LayerChromium* layer = m_private->scrollLayer())
     91        layer->setHaveWheelEventHandlers(wheelEventHandlerCount > 0);
    6792}
    6893
    69 void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(bool)
     94void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(bool should)
    7095{
    7196    // FIXME: Implement!
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm

    r108202 r108698  
    4343namespace WebCore {
    4444
     45class ScrollingCoordinatorPrivate {
     46};
     47
    4548PassRefPtr<ScrollingCoordinator> ScrollingCoordinator::create(Page* page)
    4649{
     
    4851}
    4952
     53ScrollingCoordinator::~ScrollingCoordinator()
     54{
     55    ASSERT(!m_page);
     56    ASSERT(!m_scrollingTree);
     57}
    5058
    5159void ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange(FrameView* frameView, GraphicsLayer*)
  • trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp

    r108581 r108698  
    6363    , m_layerAnimationController(CCLayerAnimationController::create())
    6464    , m_scrollable(false)
     65    , m_haveWheelEventHandlers(false)
    6566    , m_anchorPoint(0.5, 0.5)
    6667    , m_backgroundColor(0, 0, 0, 0)
     
    413414}
    414415
     416void LayerChromium::setHaveWheelEventHandlers(bool haveWheelEventHandlers)
     417{
     418    if (m_haveWheelEventHandlers == haveWheelEventHandlers)
     419        return;
     420    m_haveWheelEventHandlers = haveWheelEventHandlers;
     421    setNeedsCommit();
     422}
     423
    415424void LayerChromium::setDoubleSided(bool doubleSided)
    416425{
     
    467476    layer->setMasksToBounds(m_masksToBounds);
    468477    layer->setScrollable(m_scrollable);
     478    layer->setHaveWheelEventHandlers(m_haveWheelEventHandlers);
    469479    layer->setName(m_name);
    470480    layer->setOpaque(m_opaque);
  • trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h

    r108581 r108698  
    132132
    133133    void setScrollable(bool);
    134     bool scrollable() const { return m_scrollable; }
     134    void setHaveWheelEventHandlers(bool);
    135135
    136136    IntSize scrollDelta() const { return IntSize(); }
     
    276276    IntPoint m_scrollPosition;
    277277    bool m_scrollable;
     278    bool m_haveWheelEventHandlers;
    278279    FloatPoint m_position;
    279280    FloatPoint m_anchorPoint;
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCInputHandler.h

    r105566 r108698  
    4747
    4848    enum ScrollStatus { ScrollFailed, ScrollStarted, ScrollIgnored };
     49    enum ScrollInputType { Gesture, Wheel };
    4950
    5051    // Attempt to start scrolling a layer at a given point in window
     
    5354    // delegated to the main thread, or ScrollIgnored if there is nothing to
    5455    // be scrolled at the given coordinates.
    55     virtual ScrollStatus scrollBegin(const IntPoint&) = 0;
     56    virtual ScrollStatus scrollBegin(const IntPoint&, ScrollInputType) = 0;
    5657
    5758    // Scroll the layer selected with scrollBegin(). If there is no room to
     
    6566    virtual void scrollEnd() = 0;
    6667
    67     virtual bool haveWheelEventHandlers() = 0;
    6868    virtual void pinchGestureBegin() = 0;
    6969    virtual void pinchGestureUpdate(float magnifyDelta, const IntPoint& anchor) = 0;
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp

    r108581 r108698  
    4747    , m_anchorPointZ(0)
    4848    , m_scrollable(false)
     49    , m_haveWheelEventHandlers(false)
    4950    , m_backgroundCoversViewport(false)
    5051    , m_doubleSided(true)
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h

    r108581 r108698  
    182182    void setScrollable(bool scrollable) { m_scrollable = scrollable; }
    183183
     184    bool haveWheelEventHandlers() const { return m_haveWheelEventHandlers; }
     185    void setHaveWheelEventHandlers(bool haveWheelEventHandlers) { m_haveWheelEventHandlers = haveWheelEventHandlers; }
     186
    184187    const IntRect& visibleLayerRect() const { return m_visibleLayerRect; }
    185188    void setVisibleLayerRect(const IntRect& visibleLayerRect) { m_visibleLayerRect = visibleLayerRect; }
     
    246249    IntPoint m_scrollPosition;
    247250    bool m_scrollable;
     251    bool m_haveWheelEventHandlers;
    248252    Color m_backgroundColor;
    249253    bool m_backgroundCoversViewport;
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp

    r108581 r108698  
    6969    , m_settings(settings)
    7070    , m_visible(true)
    71     , m_haveWheelEventHandlers(false)
    7271    , m_pageScaleFactor(1)
    7372    , m_minPageScaleFactor(1)
     
    180179
    181180    hostImpl->setSourceFrameNumber(frameNumber());
    182     hostImpl->setHaveWheelEventHandlers(m_haveWheelEventHandlers);
    183181    hostImpl->setViewportSize(viewportSize());
    184182    hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFactor, m_maxPageScaleFactor);
     
    350348    } else
    351349        hostImpl->setRootLayer(0);
    352 }
    353 
    354 void CCLayerTreeHost::setHaveWheelEventHandlers(bool haveWheelEventHandlers)
    355 {
    356     if (m_haveWheelEventHandlers == haveWheelEventHandlers)
    357         return;
    358     m_haveWheelEventHandlers = haveWheelEventHandlers;
    359     m_proxy->setNeedsCommit();
    360350}
    361351
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h

    r108581 r108698  
    186186    void setVisible(bool);
    187187
    188     void setHaveWheelEventHandlers(bool);
    189 
    190188    // Returns false if we should abort this frame due to initialization failure.
    191189    bool updateLayers();
     
    241239    IntSize m_viewportSize;
    242240    bool m_visible;
    243     bool m_haveWheelEventHandlers;
    244241    typedef HashMap<GraphicsContext3D*, RefPtr<RateLimiter> > RateLimiterMap;
    245242    RateLimiterMap m_rateLimiters;
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp

    r108581 r108698  
    5353    , m_settings(settings)
    5454    , m_visible(true)
    55     , m_haveWheelEventHandlers(false)
    5655    , m_pageScale(1)
    5756    , m_pageScaleDelta(1)
     
    487486}
    488487
    489 CCInputHandlerClient::ScrollStatus CCLayerTreeHostImpl::scrollBegin(const IntPoint&)
     488CCInputHandlerClient::ScrollStatus CCLayerTreeHostImpl::scrollBegin(const IntPoint& point, CCInputHandlerClient::ScrollInputType type)
    490489{
    491490    // TODO: Check for scrollable sublayers.
    492     if (!m_scrollLayerImpl || !m_scrollLayerImpl->scrollable())
     491    if (!m_scrollLayerImpl || !m_scrollLayerImpl->scrollable()) {
     492        TRACE_EVENT("scrollBegin Ignored no scrollable", this, 0);
    493493        return ScrollIgnored;
     494    }
     495
     496    if (type == CCInputHandlerClient::Wheel && m_scrollLayerImpl->haveWheelEventHandlers()) {
     497        TRACE_EVENT("scrollBegin Failed wheelEventHandlers", this, 0);
     498        return ScrollFailed;
     499    }
    494500
    495501    return ScrollStarted;
     
    509515void CCLayerTreeHostImpl::scrollEnd()
    510516{
    511 }
    512 
    513 bool CCLayerTreeHostImpl::haveWheelEventHandlers()
    514 {
    515     return m_haveWheelEventHandlers;
    516517}
    517518
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h

    r108581 r108698  
    6363    // CCInputHandlerClient implementation
    6464    virtual void setNeedsRedraw();
    65     virtual CCInputHandlerClient::ScrollStatus scrollBegin(const IntPoint&);
     65    virtual CCInputHandlerClient::ScrollStatus scrollBegin(const IntPoint&, CCInputHandlerClient::ScrollInputType);
    6666    virtual void scrollBy(const IntSize&);
    6767    virtual void scrollEnd();
    68     virtual bool haveWheelEventHandlers();
    6968    virtual void pinchGestureBegin();
    7069    virtual void pinchGestureUpdate(float, const IntPoint&);
     
    102101    bool visible() const { return m_visible; }
    103102    void setVisible(bool);
    104     void setHaveWheelEventHandlers(bool haveWheelEventHandlers) { m_haveWheelEventHandlers = haveWheelEventHandlers; }
    105103
    106104    int sourceFrameNumber() const { return m_sourceFrameNumber; }
     
    161159    IntSize m_viewportSize;
    162160    bool m_visible;
    163     bool m_haveWheelEventHandlers;
    164161
    165162    float m_pageScale;
  • trunk/Source/WebKit/chromium/ChangeLog

    r108679 r108698  
     12012-02-21  James Robinson  <jamesr@chromium.org>
     2
     3        [chromium] Notify compositor of wheel event registration via ScrollingCoordinator
     4        https://bugs.webkit.org/show_bug.cgi?id=79133
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        Rips out old wheel event notification and adds unit tests for new LayerChromium property.
     9
     10        * src/NonCompositedContentHost.cpp:
     11        (WebKit::NonCompositedContentHost::setViewport):
     12        * src/WebCompositorInputHandlerImpl.cpp:
     13        (WebKit::WebCompositorInputHandlerImpl::handleInputEvent):
     14        * src/WebViewImpl.cpp:
     15        (WebKit::WebViewImpl::numberOfWheelEventHandlersChanged):
     16        (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
     17        * src/WebViewImpl.h:
     18        * tests/CCLayerTreeHostImplTest.cpp:
     19        (WebKit::TEST_F):
     20        (WebKit):
     21        * tests/LayerChromiumTest.cpp:
     22        * tests/WebCompositorInputHandlerImplTest.cpp:
     23
    1242012-02-23  Adrienne Walker  <enne@google.com>
    225
  • trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp

    r107125 r108698  
    122122    ASSERT(m_client);
    123123
    124     if (event.type == WebInputEvent::MouseWheel && !m_inputHandlerClient->haveWheelEventHandlers()) {
     124    if (event.type == WebInputEvent::MouseWheel) {
    125125        const WebMouseWheelEvent& wheelEvent = *static_cast<const WebMouseWheelEvent*>(&event);
    126         CCInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(IntPoint(wheelEvent.x, wheelEvent.y));
     126        CCInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(IntPoint(wheelEvent.x, wheelEvent.y), CCInputHandlerClient::Wheel);
    127127        switch (scrollStatus) {
    128128        case CCInputHandlerClient::ScrollStarted:
     
    144144#endif
    145145        const WebGestureEvent& gestureEvent = *static_cast<const WebGestureEvent*>(&event);
    146         CCInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(IntPoint(gestureEvent.x, gestureEvent.y));
     146        CCInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(IntPoint(gestureEvent.x, gestureEvent.y), CCInputHandlerClient::Gesture);
    147147        switch (scrollStatus) {
    148148        case CCInputHandlerClient::ScrollStarted:
  • trunk/Source/WebKit/chromium/src/WebViewImpl.cpp

    r108679 r108698  
    949949void WebViewImpl::numberOfWheelEventHandlersChanged(unsigned numberOfWheelHandlers)
    950950{
    951     m_haveWheelEventHandlers = numberOfWheelHandlers > 0;
    952951    if (m_client)
    953952        m_client->numberOfWheelEventHandlersChanged(numberOfWheelHandlers);
    954 #if USE(ACCELERATED_COMPOSITING)
    955     if (m_layerTreeHost)
    956         m_layerTreeHost->setHaveWheelEventHandlers(m_haveWheelEventHandlers);
    957 #endif
    958953}
    959954
     
    31793174        m_layerTreeHost = CCLayerTreeHost::create(this, ccSettings);
    31803175        if (m_layerTreeHost) {
    3181             m_layerTreeHost->setHaveWheelEventHandlers(m_haveWheelEventHandlers);
    31823176            m_layerTreeHost->setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor);
    31833177            updateLayerTreeViewport();
  • trunk/Source/WebKit/chromium/src/WebViewImpl.h

    r108027 r108698  
    693693    bool m_recreatingGraphicsContext;
    694694#endif
    695     bool m_haveWheelEventHandlers;
    696695    static const WebInputEvent* m_currentInputEvent;
    697696
  • trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp

    r108679 r108698  
    166166    root->setMaxScrollPosition(IntSize(100, 100));
    167167    m_hostImpl->setRootLayer(root);
    168     EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0)), CCInputHandlerClient::ScrollStarted);
     168    EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted);
    169169    m_hostImpl->scrollBy(IntSize(0, 10));
    170170    m_hostImpl->scrollEnd();
    171171    EXPECT_TRUE(m_didRequestRedraw);
    172172    EXPECT_TRUE(m_didRequestCommit);
     173}
     174
     175TEST_F(CCLayerTreeHostImplTest, wheelEventHandlers)
     176{
     177    RefPtr<CCLayerImpl> root = CCLayerImpl::create(0);
     178    root->setScrollable(true);
     179    root->setScrollPosition(IntPoint(0, 0));
     180    root->setMaxScrollPosition(IntSize(100, 100));
     181    m_hostImpl->setRootLayer(root);
     182    root->setHaveWheelEventHandlers(true);
     183    // With registered event handlers, wheel scrolls have to go to the main thread.
     184    EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollFailed);
     185
     186    // But gesture scrolls can still be handled.
     187    EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollStarted);
    173188}
    174189
  • trunk/Source/WebKit/chromium/tests/LayerChromiumTest.cpp

    r108025 r108698  
    516516    EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setSublayerTransform(TransformationMatrix(0, 0, 0, 0, 0, 0)));
    517517    EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setScrollable(true));
     518    EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setHaveWheelEventHandlers(true));
    518519    EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setScrollPosition(IntPoint(10, 10)));
    519520    EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setTransform(TransformationMatrix(0, 0, 0, 0, 0, 0)));
  • trunk/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp

    r107187 r108698  
    6868private:
    6969    virtual void setNeedsRedraw() OVERRIDE { }
    70     virtual ScrollStatus scrollBegin(const WebCore::IntPoint&) OVERRIDE
     70    virtual ScrollStatus scrollBegin(const WebCore::IntPoint&, WebCore::CCInputHandlerClient::ScrollInputType) OVERRIDE
    7171    {
    7272        return m_scrollStatus;
     
    7575    virtual void scrollEnd() OVERRIDE { }
    7676
    77     virtual bool haveWheelEventHandlers() OVERRIDE { return false; }
    7877    virtual void pinchGestureBegin() OVERRIDE
    7978    {
Note: See TracChangeset for help on using the changeset viewer.