Changeset 245695 in webkit


Ignore:
Timestamp:
May 23, 2019 11:02:13 AM (5 years ago)
Author:
commit-queue@webkit.org
Message:

[Pointer Events] The mouseover, mouseout, mouseenter, and mouseleave events should not be prevented while the pointer is down
https://bugs.webkit.org/show_bug.cgi?id=198177

Patch by Antoine Quint <Antoine Quint> on 2019-05-23
Reviewed by Dean Jackson.

Source/WebCore:

Test: pointerevents/mouse/compatibility-mouse-events-prevention-mouse-pressed.html

The Pointer Event spec, in https://www.w3.org/TR/pointerevents/#compatibility-mapping-with-mouse-events, says that "the mouseover,
mouseout, mouseenter, and mouseleave events are never prevented (even if the pointer is down)." We add a new static function which
indicates what is "compatibility" mouse event since those should be excluded, along with "click", which we already excluded.

  • dom/Element.cpp:

(WebCore::isCompatibilityMouseEvent):
(WebCore::Element::dispatchMouseEvent):

LayoutTests:

Add a test that listens to all mouse events and checks which are dispatched in the case preventDefault() is called when handling
"pointerdown" and when it isn't.

  • platform/mac-wk1/TestExpectations: Skipping the test on WK1 where the sequence of dispatched mouse events does not match.
  • pointerevents/mouse/compatibility-mouse-events-prevention-mouse-pressed-expected.txt: Added.
  • pointerevents/mouse/compatibility-mouse-events-prevention-mouse-pressed.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r245693 r245695  
     12019-05-23  Antoine Quint  <graouts@apple.com>
     2
     3        [Pointer Events] The mouseover, mouseout, mouseenter, and mouseleave events should not be prevented while the pointer is down
     4        https://bugs.webkit.org/show_bug.cgi?id=198177
     5
     6        Reviewed by Dean Jackson.
     7
     8        Add a test that listens to all mouse events and checks which are dispatched in the case preventDefault() is called when handling
     9        "pointerdown" and when it isn't.
     10
     11        * platform/mac-wk1/TestExpectations: Skipping the test on WK1 where the sequence of dispatched mouse events does not match.
     12        * pointerevents/mouse/compatibility-mouse-events-prevention-mouse-pressed-expected.txt: Added.
     13        * pointerevents/mouse/compatibility-mouse-events-prevention-mouse-pressed.html: Added.
     14
    1152019-05-23  Truitt Savell  <tsavell@apple.com>
    216
  • trunk/LayoutTests/platform/mac-wk1/TestExpectations

    r245257 r245695  
    700700webkit.org/b/195623 http/tests/cache/link-prefetch-main-resource.html [ Skip ]
    701701webkit.org/b/195623 http/tests/cache/link-prefetch-main-resource-iframe.html [ Skip ]
     702
     703webkit.org/b/198177 pointerevents/mouse/compatibility-mouse-events-prevention-mouse-pressed.html [ Skip ]
  • trunk/Source/WebCore/ChangeLog

    r245694 r245695  
     12019-05-23  Antoine Quint  <graouts@apple.com>
     2
     3        [Pointer Events] The mouseover, mouseout, mouseenter, and mouseleave events should not be prevented while the pointer is down
     4        https://bugs.webkit.org/show_bug.cgi?id=198177
     5
     6        Reviewed by Dean Jackson.
     7
     8        Test: pointerevents/mouse/compatibility-mouse-events-prevention-mouse-pressed.html
     9
     10        The Pointer Event spec, in https://www.w3.org/TR/pointerevents/#compatibility-mapping-with-mouse-events, says that "the mouseover,
     11        mouseout, mouseenter, and mouseleave events are never prevented (even if the pointer is down)." We add a new static function which
     12        indicates what is "compatibility" mouse event since those should be excluded, along with "click", which we already excluded.
     13
     14        * dom/Element.cpp:
     15        (WebCore::isCompatibilityMouseEvent):
     16        (WebCore::Element::dispatchMouseEvent):
     17
    1182019-05-23  Jon Davis  <jond@apple.com>
    219
  • trunk/Source/WebCore/dom/Element.cpp

    r245642 r245695  
    289289}
    290290
     291static bool isCompatibilityMouseEvent(const MouseEvent& mouseEvent)
     292{
     293    // https://www.w3.org/TR/pointerevents/#compatibility-mapping-with-mouse-events
     294    const auto& type = mouseEvent.type();
     295    return type != eventNames().clickEvent && type != eventNames().mouseoverEvent && type != eventNames().mouseoutEvent && type != eventNames().mouseenterEvent && type != eventNames().mouseleaveEvent;
     296}
     297
    291298bool Element::dispatchMouseEvent(const PlatformMouseEvent& platformEvent, const AtomicString& eventType, int detail, Element* relatedTarget)
    292299{
     
    315322            if (auto* page = document().page()) {
    316323                page->pointerCaptureController().dispatchEvent(*pointerEvent, this);
    317                 if (mouseEvent->type() != eventNames().clickEvent && page->pointerCaptureController().preventsCompatibilityMouseEventsForIdentifier(pointerEvent->pointerId()))
     324                if (isCompatibilityMouseEvent(mouseEvent) && page->pointerCaptureController().preventsCompatibilityMouseEventsForIdentifier(pointerEvent->pointerId()))
    318325                    return false;
    319326            }
Note: See TracChangeset for help on using the changeset viewer.