⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 98778 in webkit


Ignore:
Timestamp:
Oct 28, 2011, 4:30:07 PM (15 years ago)
Author:
jamesr@google.com
Message:

[chromium] Track wheel event handler registration and pass to input filter
https://bugs.webkit.org/show_bug.cgi?id=71078

Reviewed by Kenneth Russell.

Source/WebCore:

This propagates mouse wheel registration notifications to the compositor input filter. If there are any handlers
registered, which includes JS handlers and scrollable areas other than the main view, the input filter will pass
mouse wheel events to the widget. Otherwise when threaded compositing is enabled the input filter translates
wheel events into root layer scrolling.

Only changes behavior with an off-by-default flag enabled, so no tests.

  • platform/graphics/chromium/cc/CCLayerTreeHost.cpp:

(WebCore::CCLayerTreeHost::CCLayerTreeHost):
(WebCore::CCLayerTreeHost::finishCommitOnImplThread):
(WebCore::CCLayerTreeHost::setHaveWheelEventHandlers):

  • platform/graphics/chromium/cc/CCLayerTreeHost.h:
  • platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:

(WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl):
(WebCore::CCLayerTreeHostImpl::haveWheelEventHandlers):

  • platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:

(WebCore::CCLayerTreeHostImpl::setHaveWheelEventHandlers):

  • platform/graphics/chromium/cc/CCScrollController.h:

Source/WebKit/chromium:

Pushes mouse wheel event handler notifications to CCLayerTreeHost when compositing.

  • src/ChromeClientImpl.cpp:

(WebKit::ChromeClientImpl::numWheelEventHandlersChanged):

  • src/WebCompositorImpl.cpp:

(WebKit::WebCompositorImpl::handleInputEvent):

  • src/WebViewImpl.cpp:

(WebKit::WebViewImpl::numberOfWheelEventHandlersChanged):
(WebKit::WebViewImpl::setIsAcceleratedCompositingActive):

  • src/WebViewImpl.h:
Location:
trunk/Source
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r98777 r98778  
     12011-10-28  James Robinson  <jamesr@chromium.org>
     2
     3        [chromium] Track wheel event handler registration and pass to input filter
     4        https://bugs.webkit.org/show_bug.cgi?id=71078
     5
     6        Reviewed by Kenneth Russell.
     7
     8        This propagates mouse wheel registration notifications to the compositor input filter. If there are any handlers
     9        registered, which includes JS handlers and scrollable areas other than the main view, the input filter will pass
     10        mouse wheel events to the widget. Otherwise when threaded compositing is enabled the input filter translates
     11        wheel events into root layer scrolling.
     12
     13        Only changes behavior with an off-by-default flag enabled, so no tests.
     14
     15        * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
     16        (WebCore::CCLayerTreeHost::CCLayerTreeHost):
     17        (WebCore::CCLayerTreeHost::finishCommitOnImplThread):
     18        (WebCore::CCLayerTreeHost::setHaveWheelEventHandlers):
     19        * platform/graphics/chromium/cc/CCLayerTreeHost.h:
     20        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
     21        (WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl):
     22        (WebCore::CCLayerTreeHostImpl::haveWheelEventHandlers):
     23        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
     24        (WebCore::CCLayerTreeHostImpl::setHaveWheelEventHandlers):
     25        * platform/graphics/chromium/cc/CCScrollController.h:
     26
    1272011-10-28  Tim Horton  <timothy_horton@apple.com>
    228
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp

    r98771 r98778  
    5757    , m_settings(settings)
    5858    , m_visible(true)
     59    , m_haveWheelEventHandlers(false)
    5960{
    6061    CCMainThread::initialize();
     
    129130    hostImpl->setSourceFrameNumber(frameNumber());
    130131    hostImpl->setVisible(m_visible);
     132    hostImpl->setHaveWheelEventHandlers(m_haveWheelEventHandlers);
    131133    hostImpl->setZoomAnimatorTransform(m_zoomAnimatorTransform);
    132134    hostImpl->setViewport(viewportSize());
     
    236238    }
    237239}
     240
     241void CCLayerTreeHost::setHaveWheelEventHandlers(bool haveWheelEventHandlers)
     242{
     243    if (m_haveWheelEventHandlers == haveWheelEventHandlers)
     244        return;
     245    m_haveWheelEventHandlers = haveWheelEventHandlers;
     246    m_proxy->setNeedsCommit();
     247}
     248
    238249
    239250void CCLayerTreeHost::loseCompositorContext(int numTimes)
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h

    r98471 r98778  
    158158
    159159    void setVisible(bool);
     160    void setHaveWheelEventHandlers(bool);
    160161
    161162    void updateLayers();
     
    165166    void startRateLimiter(GraphicsContext3D*);
    166167    void stopRateLimiter(GraphicsContext3D*);
     168
    167169protected:
    168170    CCLayerTreeHost(CCLayerTreeHostClient*, PassRefPtr<LayerChromium> rootLayer, const CCSettings&);
     
    199201    TransformationMatrix m_zoomAnimatorTransform;
    200202    bool m_visible;
     203    bool m_haveWheelEventHandlers;
    201204    typedef HashMap<GraphicsContext3D*, RefPtr<RateLimiter> > RateLimiterMap;
    202205    RateLimiterMap m_rateLimiters;
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp

    r98392 r98778  
    5050    , m_settings(settings)
    5151    , m_visible(true)
     52    , m_haveWheelEventHandlers(false)
    5253{
    5354    ASSERT(CCProxy::isImplThread());
     
    180181    m_client->setNeedsCommitOnImplThread();
    181182    m_client->setNeedsRedrawOnImplThread();
     183}
     184
     185bool CCLayerTreeHostImpl::haveWheelEventHandlers()
     186{
     187    return m_haveWheelEventHandlers;
    182188}
    183189
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h

    r98392 r98778  
    6161    // CCScrollController implementation
    6262    virtual void scrollRootLayer(const IntSize&);
     63    virtual bool haveWheelEventHandlers();
    6364
    6465    // Virtual for testing
     
    8788
    8889    void setVisible(bool);
     90    void setHaveWheelEventHandlers(bool haveWheelEventHandlers) { m_haveWheelEventHandlers = haveWheelEventHandlers; }
    8991
    9092    int sourceFrameNumber() const { return m_sourceFrameNumber; }
     
    111113    IntSize m_viewportSize;
    112114    bool m_visible;
     115    bool m_haveWheelEventHandlers;
    113116};
    114117
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollController.h

    r96736 r98778  
    3636public:
    3737    virtual void scrollRootLayer(const IntSize&) = 0;
     38    virtual bool haveWheelEventHandlers() = 0;
    3839
    3940protected:
  • trunk/Source/WebKit/chromium/ChangeLog

    r98730 r98778  
     12011-10-28  James Robinson  <jamesr@chromium.org>
     2
     3        [chromium] Track wheel event handler registration and pass to input filter
     4        https://bugs.webkit.org/show_bug.cgi?id=71078
     5
     6        Reviewed by Kenneth Russell.
     7
     8        Pushes mouse wheel event handler notifications to CCLayerTreeHost when compositing.
     9
     10        * src/ChromeClientImpl.cpp:
     11        (WebKit::ChromeClientImpl::numWheelEventHandlersChanged):
     12        * src/WebCompositorImpl.cpp:
     13        (WebKit::WebCompositorImpl::handleInputEvent):
     14        * src/WebViewImpl.cpp:
     15        (WebKit::WebViewImpl::numberOfWheelEventHandlersChanged):
     16        (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
     17        * src/WebViewImpl.h:
     18
    1192011-10-28  Jochen Eisinger  <jochen@chromium.org>
    220
  • trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp

    r97922 r98778  
    10001000void ChromeClientImpl::numWheelEventHandlersChanged(unsigned numberOfWheelHandlers)
    10011001{
    1002     if (m_webView->client())
    1003         m_webView->client()->numberOfWheelEventHandlersChanged(numberOfWheelHandlers);
     1002    m_webView->numberOfWheelEventHandlersChanged(numberOfWheelHandlers);
    10041003}
    10051004
  • trunk/Source/WebKit/chromium/src/WebCompositorImpl.cpp

    r98445 r98778  
    117117    ASSERT(CCProxy::isImplThread());
    118118    ASSERT(m_client);
    119     // FIXME: Do something interesting with this input event like inform our m_scrollController.
     119
     120    if (event.type == WebInputEvent::MouseWheel && !m_scrollController->haveWheelEventHandlers()) {
     121        const WebMouseWheelEvent& wheelEvent = *static_cast<const WebMouseWheelEvent*>(&event);
     122        m_scrollController->scrollRootLayer(IntSize(-wheelEvent.deltaX, -wheelEvent.deltaY));
     123        m_client->didHandleInputEvent();
     124        return;
     125    }
    120126    m_client->didNotHandleInputEvent(true /* sendToWidget */);
    121127}
  • trunk/Source/WebKit/chromium/src/WebViewImpl.cpp

    r98669 r98778  
    782782#endif
    783783
     784void WebViewImpl::numberOfWheelEventHandlersChanged(unsigned numberOfWheelHandlers)
     785{
     786    m_haveWheelEventHandlers = numberOfWheelHandlers > 0;
     787    if (m_client)
     788        m_client->numberOfWheelEventHandlersChanged(numberOfWheelHandlers);
     789#if USE(ACCELERATED_COMPOSITING)
     790    if (m_layerTreeHost)
     791        m_layerTreeHost->setHaveWheelEventHandlers(m_haveWheelEventHandlers);
     792#endif
     793}
     794
    784795#if !OS(DARWIN)
    785796// Mac has no way to open a context menu based on a keyboard event.
     
    26132624        m_layerTreeHost = CCLayerTreeHost::create(this, m_nonCompositedContentHost->topLevelRootLayer()->platformLayer(), ccSettings);
    26142625        if (m_layerTreeHost) {
     2626            m_layerTreeHost->setHaveWheelEventHandlers(m_haveWheelEventHandlers);
    26152627            updateLayerTreeViewport();
    26162628            m_client->didActivateCompositor(m_layerTreeHost->compositorIdentifier());
  • trunk/Source/WebKit/chromium/src/WebViewImpl.h

    r98669 r98778  
    295295    bool touchEvent(const WebTouchEvent&);
    296296
     297    void numberOfWheelEventHandlersChanged(unsigned);
     298
    297299    // Handles context menu events orignated via the the keyboard. These
    298300    // include the VK_APPS virtual key and the Shift+F10 combine. Code is
     
    579581    bool m_recreatingGraphicsContext;
    580582#endif
     583    bool m_haveWheelEventHandlers;
    581584    static const WebInputEvent* m_currentInputEvent;
    582585
Note: See TracChangeset for help on using the changeset viewer.