Changeset 85808 in webkit


Ignore:
Timestamp:
May 4, 2011 4:49:36 PM (13 years ago)
Author:
jeffm@apple.com
Message:

2011-05-04 Jeff Miller <jeffm@apple.com>

Reviewed by Darin Adler.

Send unhandled wheel events to parent window on Windows
https://bugs.webkit.org/show_bug.cgi?id=60220

Keep track of wheel events using NativeWebWheelEvent instead of WebWheelEvent in WebPageProxy
so we can send the native event to the parent window if WebKit doesn't handle it.

  • UIProcess/API/mac/WKView.mm: Use NativeWebWheelEvent instead of WebWheelEvent.
  • UIProcess/API/qt/qwkpage.cpp: (QWKPagePrivate::wheelEvent): Use NativeWebWheelEvent instead of WebWheelEvent.
  • UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::WebPageProxy): Removed initialization of obsolete m_processingWheelEvent member variable. (WebKit::coalesceWheelEvents): Use NativeWebWheelEvent instead of WebWheelEvent and add a note that this won't work if we ever enable MERGE_WHEEL_EVENTS. (WebKit::WebPageProxy::handleWheelEvent): Use NativeWebWheelEvent instead of WebWheelEvent, keep track of the current event in m_currentlyProcessedWheelEvent. (WebKit::WebPageProxy::didReceiveEvent): Call wheelEventNotHandled() on Windows if wheel event is not handled. (WebKit::WebPageProxy::processDidCrash): Clear out m_currentlyProcessedWheelEvent.
  • UIProcess/WebPageProxy.h: Change handleWheelEvent() to take a NativeWebWheelEvent, added wheelEventNotHandled() on Windows, remove m_processingWheelEvent, add m_currentlyProcessedWheelEvent.
  • UIProcess/win/WebPageProxyWin.cpp: (WebKit::WebPageProxy::wheelEventNotHandled): Added.


  • UIProcess/win/WebView.cpp: (WebKit::WebView::onWheelEvent): Use NativeWebWheelEvent instead of WebWheelEvent.
Location:
trunk/Source/WebKit2
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r85806 r85808  
     12011-05-04  Jeff Miller  <jeffm@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Send unhandled wheel events to parent window on Windows
     6        https://bugs.webkit.org/show_bug.cgi?id=60220
     7
     8        Keep track of wheel events using NativeWebWheelEvent instead of WebWheelEvent in WebPageProxy
     9        so we can send the native event to the parent window if WebKit doesn't handle it.
     10
     11        * UIProcess/API/mac/WKView.mm: Use NativeWebWheelEvent instead of WebWheelEvent.
     12
     13        * UIProcess/API/qt/qwkpage.cpp:
     14        (QWKPagePrivate::wheelEvent): Use NativeWebWheelEvent instead of WebWheelEvent.
     15
     16        * UIProcess/WebPageProxy.cpp:
     17        (WebKit::WebPageProxy::WebPageProxy): Removed initialization of obsolete m_processingWheelEvent member variable.
     18        (WebKit::coalesceWheelEvents): Use NativeWebWheelEvent instead of WebWheelEvent and add a note that this won't work if we ever enable MERGE_WHEEL_EVENTS.
     19        (WebKit::WebPageProxy::handleWheelEvent): Use NativeWebWheelEvent instead of WebWheelEvent, keep track of the current event in m_currentlyProcessedWheelEvent.
     20        (WebKit::WebPageProxy::didReceiveEvent): Call wheelEventNotHandled() on Windows if wheel event is not handled.
     21        (WebKit::WebPageProxy::processDidCrash): Clear out m_currentlyProcessedWheelEvent.
     22        * UIProcess/WebPageProxy.h: Change handleWheelEvent() to take a NativeWebWheelEvent, added wheelEventNotHandled() on Windows, remove m_processingWheelEvent, add m_currentlyProcessedWheelEvent.
     23
     24        * UIProcess/win/WebPageProxyWin.cpp:
     25        (WebKit::WebPageProxy::wheelEventNotHandled): Added.
     26       
     27        * UIProcess/win/WebView.cpp:
     28        (WebKit::WebView::onWheelEvent): Use NativeWebWheelEvent instead of WebWheelEvent.
     29
    1302011-05-04  Anders Carlsson  <andersca@apple.com>
    231
  • trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm

    r85515 r85808  
    3838#import "NativeWebKeyboardEvent.h"
    3939#import "NativeWebMouseEvent.h"
     40#import "NativeWebWheelEvent.h"
    4041#import "PDFViewController.h"
    4142#import "PageClientImpl.h"
     
    995996#undef NATIVE_MOUSE_EVENT_HANDLER
    996997
    997 #define EVENT_HANDLER(Selector, Type) \
     998#define NATIVE_EVENT_HANDLER(Selector, Type) \
    998999    - (void)Selector:(NSEvent *)theEvent \
    9991000    { \
    1000         Web##Type##Event webEvent = WebEventFactory::createWeb##Type##Event(theEvent, self); \
     1001        NativeWeb##Type##Event webEvent = NativeWeb##Type##Event(theEvent, self); \
    10011002        _data->_page->handle##Type##Event(webEvent); \
    10021003    }
    10031004
    1004 EVENT_HANDLER(scrollWheel, Wheel)
    1005 
    1006 #undef EVENT_HANDLER
     1005NATIVE_EVENT_HANDLER(scrollWheel, Wheel)
     1006
     1007#undef NATIVE_EVENT_HANDLER
    10071008
    10081009- (void)mouseMoved:(NSEvent *)event
  • trunk/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp

    r85584 r85808  
    3737#include "NativeWebKeyboardEvent.h"
    3838#include "NativeWebMouseEvent.h"
     39#include "NativeWebWheelEvent.h"
    3940#include "NotImplemented.h"
    4041#include "Region.h"
     
    339340void QWKPagePrivate::wheelEvent(QGraphicsSceneWheelEvent* ev)
    340341{
    341     WebWheelEvent wheelEvent = WebEventFactory::createWebWheelEvent(ev);
    342     page->handleWheelEvent(wheelEvent);
     342    page->handleWheelEvent(NativeWebWheelEvent(ev));
    343343}
    344344
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r85746 r85808  
    3636#include "NativeWebKeyboardEvent.h"
    3737#include "NativeWebMouseEvent.h"
     38#include "NativeWebWheelEvent.h"
    3839#include "PageClient.h"
    3940#include "PrintInfo.h"
     
    139140    , m_syncNavigationActionPolicyAction(PolicyUse)
    140141    , m_syncNavigationActionPolicyDownloadID(0)
    141     , m_processingWheelEvent(false)
    142142    , m_processingMouseMoveEvent(false)
    143143    , m_pageID(pageID)
     
    870870}
    871871
    872 static PassOwnPtr<WebWheelEvent> coalesceWheelEvents(WebWheelEvent* oldNextWheelEvent, const WebWheelEvent& newWheelEvent)
     872static PassOwnPtr<NativeWebWheelEvent> coalesceWheelEvents(NativeWebWheelEvent* oldNextWheelEvent, const NativeWebWheelEvent& newWheelEvent)
    873873{
    874874#if MERGE_WHEEL_EVENTS
    875875    // Merge model: Combine wheel event deltas (and wheel ticks) into a single wheel event.
    876876    if (!oldNextWheelEvent)
    877         return adoptPtr(new WebWheelEvent(newWheelEvent));
     877        return adoptPtr(new NativeWebWheelEvent(newWheelEvent));
    878878
    879879    if (oldNextWheelEvent->position() != newWheelEvent.position() || oldNextWheelEvent->modifiers() != newWheelEvent.modifiers() || oldNextWheelEvent->granularity() != newWheelEvent.granularity())
    880         return adoptPtr(new WebWheelEvent(newWheelEvent));
     880        return adoptPtr(new NativeWebWheelEvent(newWheelEvent));
    881881
    882882    FloatSize mergedDelta = oldNextWheelEvent->delta() + newWheelEvent.delta();
    883883    FloatSize mergedWheelTicks = oldNextWheelEvent->wheelTicks() + newWheelEvent.wheelTicks();
    884884
    885     return adoptPtr(new WebWheelEvent(WebEvent::Wheel, newWheelEvent.position(), newWheelEvent.globalPosition(), mergedDelta, mergedWheelTicks, newWheelEvent.granularity(), newWheelEvent.modifiers(), newWheelEvent.timestamp()));
     885    // FIXME: This won't compile, if we ever turn on MERGE_WHEEL_EVENTS we'll have to generate a NativeWebWheelEvent synthetically for each platform.
     886    return adoptPtr(new NativeWebWheelEvent(WebEvent::Wheel, newWheelEvent.position(), newWheelEvent.globalPosition(), mergedDelta, mergedWheelTicks, newWheelEvent.granularity(), newWheelEvent.modifiers(), newWheelEvent.timestamp()));
    886887#else
    887888    // Simple model: Just keep the last event, dropping all interim events.
    888     return adoptPtr(new WebWheelEvent(newWheelEvent));
    889 #endif
    890 }
    891 
    892 void WebPageProxy::handleWheelEvent(const WebWheelEvent& event)
    893 {
    894     if (!isValid())
    895         return;
    896 
    897     if (m_processingWheelEvent) {
     889    return adoptPtr(new NativeWebWheelEvent(newWheelEvent));
     890#endif
     891}
     892
     893void WebPageProxy::handleWheelEvent(const NativeWebWheelEvent& event)
     894{
     895    if (!isValid())
     896        return;
     897
     898    if (m_currentlyProcessedWheelEvent) {
    898899        m_nextWheelEvent = coalesceWheelEvents(m_nextWheelEvent.get(), event);
    899900        return;
    900901    }
     902   
     903    m_currentlyProcessedWheelEvent = adoptPtr(new NativeWebWheelEvent(event));
    901904
    902905    process()->responsivenessTimer()->start();
    903906    process()->send(Messages::WebPage::WheelEvent(event), m_pageID);
    904     m_processingWheelEvent = true;
    905907}
    906908
     
    26242626
    26252627    case WebEvent::Wheel: {
    2626         m_processingWheelEvent = false;
     2628        ASSERT(m_currentlyProcessedWheelEvent);
     2629
     2630#if PLATFORM(WIN)
     2631        if (!handled && m_currentlyProcessedWheelEvent)
     2632            wheelEventNotHandled(*m_currentlyProcessedWheelEvent);
     2633#endif
     2634
     2635        m_currentlyProcessedWheelEvent = nullptr;
    26272636        if (m_nextWheelEvent) {
    26282637            handleWheelEvent(*m_nextWheelEvent);
     
    28422851    m_keyEventQueue.clear();
    28432852    m_nextWheelEvent = nullptr;
     2853    m_currentlyProcessedWheelEvent = nullptr;
    28442854    m_nextMouseMoveEvent = nullptr;
    28452855    m_currentlyProcessedMouseDownEvent = nullptr;
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r85795 r85808  
    8888class NativeWebKeyboardEvent;
    8989class NativeWebMouseEvent;
     90class NativeWebWheelEvent;
    9091class PageClient;
    9192class PlatformCertificateInfo;
     
    307308
    308309    void handleMouseEvent(const NativeWebMouseEvent&);
    309     void handleWheelEvent(const WebWheelEvent&);
     310    void handleWheelEvent(const NativeWebWheelEvent&);
    310311    void handleKeyboardEvent(const NativeWebKeyboardEvent&);
    311312#if ENABLE(GESTURE_EVENTS)
     
    692693    void stopResponsivenessTimer();
    693694
     695#if PLATFORM(WIN)
     696    void wheelEventNotHandled(NativeWebWheelEvent&) const;
     697#endif
     698
    694699    void voidCallback(uint64_t);
    695700    void dataCallback(const CoreIPC::DataReference&, uint64_t);
     
    834839    Deque<NativeWebKeyboardEvent> m_keyEventQueue;
    835840    bool m_processingWheelEvent;
    836     OwnPtr<WebWheelEvent> m_nextWheelEvent;
     841    OwnPtr<NativeWebWheelEvent> m_currentlyProcessedWheelEvent;
     842    OwnPtr<NativeWebWheelEvent> m_nextWheelEvent;
    837843
    838844    bool m_processingMouseMoveEvent;
  • trunk/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp

    r85795 r85808  
    2727#include "WebPageProxy.h"
    2828
     29#include "NativeWebWheelEvent.h"
    2930#include "PageClient.h"
    3031#include "WebPopupMenuProxyWin.h"
     
    7677}
    7778
     79void WebPageProxy::wheelEventNotHandled(NativeWebWheelEvent& event) const
     80{
     81    const MSG* msg = event.nativeEvent();
     82    ::PostMessage(::GetParent(nativeWindow()), msg->message, msg->wParam, msg->lParam);
     83}
     84
    7885} // namespace WebKit
  • trunk/Source/WebKit2/UIProcess/win/WebView.cpp

    r85795 r85808  
    3333#include "NativeWebKeyboardEvent.h"
    3434#include "NativeWebMouseEvent.h"
     35#include "NativeWebWheelEvent.h"
    3536#include "Region.h"
    3637#include "RunLoop.h"
     
    435436LRESULT WebView::onWheelEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled)
    436437{
    437     WebWheelEvent wheelEvent = WebEventFactory::createWebWheelEvent(hWnd, message, wParam, lParam);
     438    NativeWebWheelEvent wheelEvent(hWnd, message, wParam, lParam);
    438439    if (wheelEvent.controlKey()) {
    439440        // We do not want WebKit to handle Control + Wheel, this should be handled by the client application
Note: See TracChangeset for help on using the changeset viewer.