Changeset 247152 in webkit


Ignore:
Timestamp:
Jul 5, 2019 7:18:46 AM (5 years ago)
Author:
Antti Koivisto
Message:

REGRESSION(r244218): desmos.com: Cannot scroll formulas region when region is scrollable
https://bugs.webkit.org/show_bug.cgi?id=199508
<rdar://problem/50925173>

Reviewed by Zalan Bujtas.

The page invokes preventDefault on simulated mouse events which stops scrolling.
To fix, add a quirk that turns simulated mouse events non-cancelable.

  • dom/MouseEvent.h:
  • dom/ios/MouseEventIOS.cpp:

(WebCore::MouseEvent::create):

  • page/Quirks.cpp:

(WebCore::Quirks::simulatedMouseEventTypeForTarget const):
(WebCore::Quirks::shouldDispatchSimulatedMouseEventsOnTarget const): Deleted.

To avoid adding more similar functions, and for future flexibility, make this one return the type too.

  • page/Quirks.h:
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r247151 r247152  
     12019-07-05  Antti Koivisto  <antti@apple.com>
     2
     3        REGRESSION(r244218): desmos.com: Cannot scroll formulas region when region is scrollable
     4        https://bugs.webkit.org/show_bug.cgi?id=199508
     5        <rdar://problem/50925173>
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        The page invokes preventDefault on simulated mouse events which stops scrolling.
     10        To fix, add a quirk that turns simulated mouse events non-cancelable.
     11
     12        * dom/MouseEvent.h:
     13        * dom/ios/MouseEventIOS.cpp:
     14        (WebCore::MouseEvent::create):
     15        * page/Quirks.cpp:
     16        (WebCore::Quirks::simulatedMouseEventTypeForTarget const):
     17        (WebCore::Quirks::shouldDispatchSimulatedMouseEventsOnTarget const): Deleted.
     18
     19        To avoid adding more similar functions, and for future flexibility, make this one return the type too.
     20
     21        * page/Quirks.h:
     22
    1232019-07-05  Zalan Bujtas  <zalan@apple.com>
    224
  • trunk/Source/WebCore/dom/MouseEvent.h

    r246490 r247152  
    5555
    5656#if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY)
    57     static Ref<MouseEvent> create(const PlatformTouchEvent&, unsigned touchIndex, Ref<WindowProxy>&&);
     57    static Ref<MouseEvent> create(const PlatformTouchEvent&, unsigned touchIndex, Ref<WindowProxy>&&, IsCancelable = IsCancelable::Yes);
    5858#endif
    5959
  • trunk/Source/WebCore/dom/ios/MouseEventIOS.cpp

    r246490 r247152  
    4949}
    5050
    51 Ref<MouseEvent> MouseEvent::create(const PlatformTouchEvent& event, unsigned index, Ref<WindowProxy>&& view)
     51Ref<MouseEvent> MouseEvent::create(const PlatformTouchEvent& event, unsigned index, Ref<WindowProxy>&& view, IsCancelable cancelable)
    5252{
    53     return adoptRef(*new MouseEvent(mouseEventType(event.touchPhaseAtIndex(index)), CanBubble::Yes, IsCancelable::Yes, IsComposed::Yes, event.timestamp().approximateMonotonicTime(), WTFMove(view), 0, event.touchLocationAtIndex(index), event.touchLocationAtIndex(index), { }, event.modifiers(), 0, 0, nullptr, 0, 0, nullptr, IsSimulated::No, IsTrusted::Yes));
     53    return adoptRef(*new MouseEvent(mouseEventType(event.touchPhaseAtIndex(index)), CanBubble::Yes, cancelable, IsComposed::Yes, event.timestamp().approximateMonotonicTime(), WTFMove(view), 0, event.touchLocationAtIndex(index), event.touchLocationAtIndex(index), { }, event.modifiers(), 0, 0, nullptr, 0, 0, nullptr, IsSimulated::No, IsTrusted::Yes));
    5454}
    5555
  • trunk/Source/WebCore/page/Quirks.cpp

    r247145 r247152  
    300300}
    301301
    302 bool Quirks::shouldDispatchSimulatedMouseEventsOnTarget(EventTarget* target) const
     302Optional<Event::IsCancelable> Quirks::simulatedMouseEventTypeForTarget(EventTarget* target) const
    303303{
    304304    if (!needsQuirks() || !shouldDispatchSimulatedMouseEvents())
    305         return false;
     305        return { };
    306306
    307307    // On Google Maps, we want to limit simulated mouse events to dragging the little man that allows entering into Street View.
    308308    auto& url = m_document->topDocument().url();
    309309    auto host = url.host();
    310     if (equalLettersIgnoringASCIICase(host, "www.google.com") && url.path().startsWithIgnoringASCIICase("/maps/"))
    311         return is<Element>(target) && downcast<Element>(target)->getAttribute("class") == "widget-expand-button-pegman-icon";
    312     return true;
    313 }
     310    if (equalLettersIgnoringASCIICase(host, "www.google.com") && url.path().startsWithIgnoringASCIICase("/maps/")) {
     311        if (is<Element>(target) && downcast<Element>(target)->getAttribute("class") == "widget-expand-button-pegman-icon")
     312            return Event::IsCancelable::Yes;
     313        return { };
     314    }
     315
     316    if (equalLettersIgnoringASCIICase(host, "desmos.com") || host.endsWithIgnoringASCIICase(".desmos.com"))
     317        return Event::IsCancelable::No;
     318
     319    return Event::IsCancelable::Yes;
     320}   
    314321#endif
    315322
  • trunk/Source/WebCore/page/Quirks.h

    r247145 r247152  
    2626#pragma once
    2727
     28#include "Event.h"
    2829#include <wtf/WeakPtr.h>
    2930
     
    5253#if ENABLE(TOUCH_EVENTS)
    5354    bool shouldDispatchSimulatedMouseEvents() const;
    54     bool shouldDispatchSimulatedMouseEventsOnTarget(EventTarget*) const;
     55    Optional<Event::IsCancelable> simulatedMouseEventTypeForTarget(EventTarget*) const;
    5556#endif
    5657    bool shouldDisablePointerEventsQuirk() const;
Note: See TracChangeset for help on using the changeset viewer.