Changeset 163645 in webkit


Ignore:
Timestamp:
Feb 7, 2014 2:01:38 PM (10 years ago)
Author:
benjamin@webkit.org
Message:

[WK2] Fitler touch events only based on touch start
https://bugs.webkit.org/show_bug.cgi?id=128354

Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-02-07
Reviewed by Simon Fraser.

Touch Events track their target, we should not test the touch regions
again after a touch sequence starts.

This patch adds a boolean flag to know if we are sending events to the WebProcess
(m_isTrackingTouchEvents). The flag is updated every time a touch sequence starts.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::shouldStartTrackingTouchEvents):
(WebKit::WebPageProxy::handleTouchEvent):

  • UIProcess/WebPageProxy.h:
Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r163644 r163645  
     12014-02-07  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        [WK2] Fitler touch events only based on touch start
     4        https://bugs.webkit.org/show_bug.cgi?id=128354
     5
     6        Reviewed by Simon Fraser.
     7
     8        Touch Events track their target, we should not test the touch regions
     9        again after a touch sequence starts.
     10
     11        This patch adds a boolean flag to know if we are sending events to the WebProcess
     12        (m_isTrackingTouchEvents). The flag is updated every time a touch sequence starts.
     13
     14        * UIProcess/WebPageProxy.cpp:
     15        (WebKit::WebPageProxy::WebPageProxy):
     16        (WebKit::WebPageProxy::shouldStartTrackingTouchEvents):
     17        (WebKit::WebPageProxy::handleTouchEvent):
     18        * UIProcess/WebPageProxy.h:
     19
    1202014-02-07  Anders Carlsson  <andersca@apple.com>
    221
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r163609 r163645  
    298298    , m_syncNavigationActionPolicyDownloadID(0)
    299299    , m_processingMouseMoveEvent(false)
     300#if ENABLE(TOUCH_EVENTS)
     301    , m_isTrackingTouchEvents(false)
     302#endif
    300303    , m_pageID(pageID)
    301304    , m_session(session)
     
    13831386
    13841387#if ENABLE(TOUCH_EVENTS)
     1388
     1389bool WebPageProxy::shouldStartTrackingTouchEvents(const WebTouchEvent& touchStartEvent) const
     1390{
    13851391#if ENABLE(ASYNC_SCROLLING)
    1386 static bool anyTouchIsInNonFastScrollableRegion(RemoteScrollingCoordinatorProxy& scrollingCoordinator, const WebTouchEvent& event)
    1387 {
    1388     for (auto touchPoint : event.touchPoints()) {
    1389         if (scrollingCoordinator.isPointInNonFastScrollableRegion(touchPoint.location()))
     1392    for (auto touchPoint : touchStartEvent.touchPoints()) {
     1393        if (m_scrollingCoordinatorProxy->isPointInNonFastScrollableRegion(touchPoint.location()))
    13901394            return true;
    13911395    }
    13921396
    13931397    return false;
    1394 }
    13951398#endif // ENABLE(ASYNC_SCROLLING)
     1399    return true;
     1400}
    13961401
    13971402void WebPageProxy::handleTouchEvent(const NativeWebTouchEvent& event)
    13981403{
    13991404    if (!isValid())
     1405        return;
     1406
     1407    if (event.type() == WebEvent::TouchStart)
     1408        m_isTrackingTouchEvents = shouldStartTrackingTouchEvents(event);
     1409
     1410    if (!m_isTrackingTouchEvents)
    14001411        return;
    14011412
     
    14041415    // we do not send any of the events to the page even if is has listeners.
    14051416    if (!m_isPageSuspended) {
    1406 
    1407 #if ENABLE(ASYNC_SCROLLING)
    1408         // FIXME: we should only do this check for the start of a touch gesture.
    1409         if (!anyTouchIsInNonFastScrollableRegion(*m_scrollingCoordinatorProxy, event))
    1410             return;
    1411 #endif
    1412 
    14131417        m_touchEventQueue.append(event);
    14141418        m_process->responsivenessTimer()->start();
     
    14301434        }
    14311435    }
     1436
     1437    if (event.type() == WebEvent::TouchEnd || event.type() == WebEvent::TouchCancel)
     1438        m_isTrackingTouchEvents = false;
    14321439}
    14331440#endif // ENABLE(TOUCH_EVENTS)
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r163600 r163645  
    10101010#endif
    10111011
    1012 #if ENABLE(TOUCH_EVENTS)
    1013     void needTouchEvents(bool);
    1014 #endif
    1015 
    10161012#if ENABLE(INPUT_TYPE_COLOR)
    10171013    void showColorPicker(const WebCore::Color& initialColor, const WebCore::IntRect&);
     
    11751171    void sendWheelEvent(const WebWheelEvent&);
    11761172
     1173#if ENABLE(TOUCH_EVENTS)
     1174    bool shouldStartTrackingTouchEvents(const WebTouchEvent&) const;
     1175#endif
     1176
    11771177#if ENABLE(NETSCAPE_PLUGIN_API)
    11781178    void findPlugin(const String& mimeType, uint32_t processType, const String& urlString, const String& frameURLString, const String& pageURLString, bool allowOnlyApplicationPlugins, uint64_t& pluginProcessToken, String& newMIMEType, uint32_t& pluginLoadPolicy, String& unavailabilityDescription);
     
    13321332
    13331333#if ENABLE(TOUCH_EVENTS)
     1334    bool m_isTrackingTouchEvents;
    13341335    Deque<QueuedTouchEvents> m_touchEventQueue;
    13351336#endif
Note: See TracChangeset for help on using the changeset viewer.