Changeset 63807 in webkit


Ignore:
Timestamp:
Jul 21, 2010 2:19:02 AM (14 years ago)
Author:
benm@google.com
Message:

Touch events do not affect the :active CSS state
https://bugs.webkit.org/show_bug.cgi?id=39493

Reviewed by Steve Block.

WebCore:

Test: fast/events/touch/touch-active-state.html

  • WebCore.exp.in: Update exports for new signature of

hitTestResultAtPoint.

  • WebCore.order: ditto.
  • page/EventHandler.cpp:

(WebCore::EventHandler::EventHandler):
(WebCore::EventHandler::hitTestResultAtPoint): Pass the type

of the hit test to perform as a parameter with a default
value rather than harcoding it in the function body.

(WebCore::EventHandler::handleMouseMoveEvent): Do not modiify

the active element during a mouse move if the user is
touching the screen.

(WebCore::EventHandler::handleTouchEvent): Set the correct

type of hit test to perform depending on the type of the
touch event we are handling.

  • page/EventHandler.h: Update the signature of hitTestResultAtPoint.

LayoutTests:

  • fast/events/touch/touch-active-state-expected.txt: Added.
  • fast/events/touch/touch-active-state.html: Added.
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r63805 r63807  
     12010-07-20  Ben Murdoch  <benm@google.com>
     2
     3        Reviewed by Steve Block.
     4
     5        Touch events do not affect the :active CSS state
     6        https://bugs.webkit.org/show_bug.cgi?id=39493
     7
     8        * fast/events/touch/touch-active-state-expected.txt: Added.
     9        * fast/events/touch/touch-active-state.html: Added.
     10
    1112010-07-20  Yury Semikhatsky  <yurys@chromium.org>
    212
  • trunk/WebCore/ChangeLog

    r63805 r63807  
     12010-07-20  Ben Murdoch  <benm@google.com>
     2
     3        Reviewed by Steve Block.
     4
     5        Touch events do not affect the :active CSS state
     6        https://bugs.webkit.org/show_bug.cgi?id=39493
     7
     8        Test: fast/events/touch/touch-active-state.html
     9
     10        * WebCore.exp.in: Update exports for new signature of
     11            hitTestResultAtPoint.
     12        * WebCore.order: ditto.
     13        * page/EventHandler.cpp:
     14        (WebCore::EventHandler::EventHandler):
     15        (WebCore::EventHandler::hitTestResultAtPoint): Pass the type
     16            of the hit test to perform as a parameter with a default
     17            value rather than harcoding it in the function body.
     18        (WebCore::EventHandler::handleMouseMoveEvent): Do not modiify
     19            the active element during a mouse move if the user is
     20            touching the screen.
     21        (WebCore::EventHandler::handleTouchEvent): Set the correct
     22            type of hit test to perform depending on the type of the
     23            touch event we are handling.
     24        * page/EventHandler.h: Update the signature of hitTestResultAtPoint.
     25
    1262010-07-20  Yury Semikhatsky  <yurys@chromium.org>
    227
  • trunk/WebCore/WebCore.exp.in

    r63794 r63807  
    217217__ZN7WebCore12EventHandler16handleWheelEventERNS_18PlatformWheelEventE
    218218__ZN7WebCore12EventHandler20handleTextInputEventERKNS_6StringEPNS_5EventEbb
    219 __ZN7WebCore12EventHandler20hitTestResultAtPointERKNS_8IntPointEbbNS_17HitTestScrollbarsE
     219__ZN7WebCore12EventHandler20hitTestResultAtPointERKNS_8IntPointEbbNS_17HitTestScrollbarsEi
    220220__ZN7WebCore12EventHandler21handleMousePressEventERKNS_18PlatformMouseEventE
    221221__ZN7WebCore12EventHandler23handleMouseReleaseEventERKNS_18PlatformMouseEventE
  • trunk/WebCore/WebCore.order

    r59514 r63807  
    30003000__ZNK7WebCore14RenderThemeMac20supportsControlTintsEv
    30013001__ZN7WebCore15GraphicsContext23setUpdatingControlTintsEb
    3002 __ZN7WebCore12EventHandler20hitTestResultAtPointERKNS_8IntPointEbbNS_17HitTestScrollbarsE
     3002__ZN7WebCore12EventHandler20hitTestResultAtPointERKNS_8IntPointEbbNS_17HitTestScrollbarsEi
    30033003__ZNK7WebCore13HitTestResult10isSelectedEv
    30043004__ZN7WebCore19SelectionController8containsERKNS_8IntPointE
  • trunk/WebCore/page/EventHandler.cpp

    r63731 r63807  
    191191    , m_activationEventNumber(0)
    192192#endif
     193#if ENABLE(TOUCH_EVENTS)
     194    , m_touchPressed(false)
     195#endif
    193196{
    194197}
     
    860863#endif // ENABLE(DRAG_SUPPORT)
    861864   
    862 HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool allowShadowContent, bool ignoreClipping, HitTestScrollbars testScrollbars)
     865HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool allowShadowContent, bool ignoreClipping, HitTestScrollbars testScrollbars, int hitType)
    863866{
    864867    HitTestResult result(point);
    865868    if (!m_frame->contentRenderer())
    866869        return result;
    867     int hitType = HitTestRequest::ReadOnly | HitTestRequest::Active;
    868870    if (ignoreClipping)
    869871        hitType |= HitTestRequest::IgnoreClipping;
     
    14421444    if (m_mousePressed)
    14431445        hitType |= HitTestRequest::Active;
     1446
     1447#if ENABLE(TOUCH_EVENTS)
     1448    // Treat any mouse move events as readonly if the user is currently touching the screen.
     1449    if (m_touchPressed)
     1450        hitType |= HitTestRequest::Active | HitTestRequest::ReadOnly;
     1451#endif
    14441452    HitTestRequest request(hitType);
    14451453    MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent);
     
    28392847        const PlatformTouchPoint& point = points[i];
    28402848        IntPoint pagePoint = documentPointForWindowPoint(m_frame, point.pos());
    2841         HitTestResult result = hitTestResultAtPoint(pagePoint, /*allowShadowContent*/ false);
     2849
     2850        int hitType = HitTestRequest::Active | HitTestRequest::ReadOnly;
     2851        // The HitTestRequest types used for mouse events map quite adequately
     2852        // to touch events. Note that in addition to meaning that the hit test
     2853        // should affect the active state of the current node if necessary,
     2854        // HitTestRequest::Active signifies that the hit test is taking place
     2855        // with the mouse (or finger in this case) being pressed.
     2856        switch (point.state()) {
     2857        case PlatformTouchPoint::TouchPressed:
     2858            hitType = HitTestRequest::Active;
     2859            break;
     2860        case PlatformTouchPoint::TouchMoved:
     2861            hitType = HitTestRequest::Active | HitTestRequest::MouseMove | HitTestRequest::ReadOnly;
     2862            break;
     2863        case PlatformTouchPoint::TouchReleased:
     2864        case PlatformTouchPoint::TouchCancelled:
     2865            hitType = HitTestRequest::MouseUp;
     2866            break;
     2867        default:
     2868            break;
     2869        }
     2870
     2871        HitTestResult result = hitTestResultAtPoint(pagePoint, /*allowShadowContent*/ false, false, DontHitTestScrollbars, hitType);
    28422872        Node* target = result.innerNode();
    28432873
     
    29022932    }
    29032933
     2934    m_touchPressed = touches->length() > 0;
     2935
    29042936    bool defaultPrevented = false;
    29052937    Touch* changedTouch = 0;
  • trunk/WebCore/page/EventHandler.h

    r62447 r63807  
    2929#include "DragActions.h"
    3030#include "FocusDirection.h"
     31#include "HitTestRequest.h"
    3132#include "PlatformMouseEvent.h"
    3233#include "ScrollTypes.h"
     
    106107    void dispatchFakeMouseMoveEventSoonInQuad(const FloatQuad&);
    107108
    108     HitTestResult hitTestResultAtPoint(const IntPoint&, bool allowShadowContent, bool ignoreClipping = false, HitTestScrollbars scrollbars = DontHitTestScrollbars);
     109    HitTestResult hitTestResultAtPoint(const IntPoint&, bool allowShadowContent, bool ignoreClipping = false, HitTestScrollbars scrollbars = DontHitTestScrollbars, int hitType = HitTestRequest::ReadOnly | HitTestRequest::Active);
    109110
    110111    bool mousePressed() const { return m_mousePressed; }
     
    432433    typedef HashMap<int, RefPtr<EventTarget> > TouchTargetMap;
    433434    TouchTargetMap m_originatingTouchPointTargets;
     435    bool m_touchPressed;
    434436#endif
    435437};
Note: See TracChangeset for help on using the changeset viewer.