Changeset 274091 in webkit


Ignore:
Timestamp:
Mar 8, 2021 12:16:20 PM (17 months ago)
Author:
Simon Fraser
Message:

Trackpad scrolling in the web inspector timeline is broken
https://bugs.webkit.org/show_bug.cgi?id=222853
rdar://73509018

Reviewed by Sam Weinig.
Source/WebCore:

Commit r266333 or thereabouts broke trackpad scrolling in the inspector timeline.

This scrolling works via a wheel event handler on a non-scrollable element that
dispatches a copy of the wheel event to a proxy overflow:scroll in script. This
broke the default wheel event handling path.

Fix by having EventHandler::defaultWheelEventHandler() only respect latching and
m_currentWheelEventAllowsScrolling (which is set based on WheelEventProcessingSteps
from the scrolling thread) for user events, i.e. those with an underlying native event.

Also make Event loggable, and add some braces.

Test: fast/events/wheel/redispatched-wheel-event.html

  • dom/Event.cpp:

(WebCore::Event::debugDescription const):
(WebCore::operator<<):

  • dom/Event.h:
  • dom/EventDispatcher.cpp:

(WebCore::EventDispatcher::dispatchEvent):

  • dom/Node.cpp:

(WebCore::Node::defaultEventHandler): This clause needs braces.

  • page/EventHandler.cpp:

(WebCore::EventHandler::defaultWheelEventHandler):

LayoutTests:

  • fast/events/wheel/redispatched-wheel-event-expected.txt: Added.
  • fast/events/wheel/redispatched-wheel-event.html: Added.
Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r274088 r274091  
     12021-03-08  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Trackpad scrolling in the web inspector timeline is broken
     4        https://bugs.webkit.org/show_bug.cgi?id=222853
     5        rdar://73509018
     6
     7        Reviewed by Sam Weinig.
     8
     9        * fast/events/wheel/redispatched-wheel-event-expected.txt: Added.
     10        * fast/events/wheel/redispatched-wheel-event.html: Added.
     11
    1122021-03-08  ChangSeok Oh  <changseok@webkit.org>
    213
  • trunk/Source/WebCore/ChangeLog

    r274087 r274091  
     12021-03-08  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Trackpad scrolling in the web inspector timeline is broken
     4        https://bugs.webkit.org/show_bug.cgi?id=222853
     5        rdar://73509018
     6
     7        Reviewed by Sam Weinig.
     8       
     9        Commit r266333 or thereabouts broke trackpad scrolling in the inspector timeline.
     10
     11        This scrolling works via a wheel event handler on a non-scrollable element that
     12        dispatches a copy of the wheel event to a proxy overflow:scroll in script. This
     13        broke the default wheel event handling path.
     14       
     15        Fix by having EventHandler::defaultWheelEventHandler() only respect latching and
     16        m_currentWheelEventAllowsScrolling (which is set based on WheelEventProcessingSteps
     17        from the scrolling thread) for user events, i.e. those with an underlying native event.
     18       
     19        Also make Event loggable, and add some braces.
     20
     21        Test: fast/events/wheel/redispatched-wheel-event.html
     22
     23        * dom/Event.cpp:
     24        (WebCore::Event::debugDescription const):
     25        (WebCore::operator<<):
     26        * dom/Event.h:
     27        * dom/EventDispatcher.cpp:
     28        (WebCore::EventDispatcher::dispatchEvent):
     29        * dom/Node.cpp:
     30        (WebCore::Node::defaultEventHandler): This clause needs braces.
     31        * page/EventHandler.cpp:
     32        (WebCore::EventHandler::defaultWheelEventHandler):
     33
    1342021-03-08  John Wilander  <wilander@apple.com>
    235
  • trunk/Source/WebCore/dom/Event.cpp

    r269500 r274091  
    3333#include "UserGestureIndicator.h"
    3434#include "WorkerGlobalScope.h"
     35#include <wtf/HexNumber.h>
    3536#include <wtf/IsoMallocInlines.h>
     37#include <wtf/text/StringBuilder.h>
     38#include <wtf/text/TextStream.h>
    3639
    3740namespace WebCore {
     
    182185}
    183186
     187String Event::debugDescription() const
     188{
     189    return makeString(type(), " phase ", eventPhase(), bubbles() ? " bubbles " : " ", cancelable() ? "cancelable " : " ", "0x"_s, hex(reinterpret_cast<uintptr_t>(this), Lowercase));
     190}
     191
     192TextStream& operator<<(TextStream& ts, const Event& event)
     193{
     194    ts << event.debugDescription();
     195    return ts;
     196}
     197
    184198} // namespace WebCore
  • trunk/Source/WebCore/dom/Event.h

    r269546 r274091  
    3232#include <wtf/TypeCasts.h>
    3333#include <wtf/text/AtomString.h>
     34
     35namespace WTF {
     36class TextStream;
     37}
    3438
    3539namespace WebCore {
     
    144148    virtual void setRelatedTarget(EventTarget*) { }
    145149
     150    virtual String debugDescription() const;
     151
    146152protected:
    147153    explicit Event(IsTrusted = IsTrusted::No);
     
    209215}
    210216
     217WTF::TextStream& operator<<(WTF::TextStream&, const Event&);
     218
    211219} // namespace WebCore
    212220
  • trunk/Source/WebCore/dom/EventDispatcher.cpp

    r273477 r274091  
    4444#include "TextEvent.h"
    4545#include "TouchEvent.h"
     46#include <wtf/text/TextStream.h>
    4647
    4748namespace WebCore {
     
    145146    ASSERT_WITH_SECURITY_IMPLICATION(ScriptDisallowedScope::InMainThread::isEventDispatchAllowedInSubtree(node));
    146147   
    147     LOG(Events, "EventDispatcher::dispatchEvent %s on node %s", event.type().string().utf8().data(), node.nodeName().utf8().data());
     148    LOG_WITH_STREAM(Events, stream << "EventDispatcher::dispatchEvent " << event << " on node " << node);
    148149
    149150    auto protectedNode = makeRef(node);
  • trunk/Source/WebCore/dom/Node.cpp

    r273477 r274091  
    24672467            startNode = startNode->parentOrShadowHostNode();
    24682468       
    2469         if (startNode && startNode->renderer())
     2469        if (startNode && startNode->renderer()) {
    24702470            if (Frame* frame = document().frame())
    24712471                frame->eventHandler().defaultWheelEventHandler(startNode, downcast<WheelEvent>(event));
     2472        }
    24722473#if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY)
    24732474    } else if (is<TouchEvent>(event) && eventNames().isTouchRelatedEventType(document(), eventType)) {
  • trunk/Source/WebCore/page/EventHandler.cpp

    r273812 r274091  
    30763076        return;
    30773077
    3078     if (!m_currentWheelEventAllowsScrolling)
     3078    auto platformEvent = wheelEvent.underlyingPlatformEvent();
     3079    bool isUserEvent = platformEvent.hasValue();
     3080
     3081    if (isUserEvent && !m_currentWheelEventAllowsScrolling)
    30793082        return;
    30803083
     
    31023105        return;
    31033106
    3104     if (latchedScroller) {
     3107    if (isUserEvent && latchedScroller) {
    31053108        if (latchedScroller == m_frame.view()) {
    31063109            // FrameView scrolling is handled via processWheelEventForScrolling().
     
    31083111        }
    31093112
    3110         auto platformEvent = wheelEvent.underlyingPlatformEvent();
    31113113        if (platformEvent) {
    31123114            auto copiedEvent = platformEvent->copyWithDeltasAndVelocity(filteredPlatformDelta.width(), filteredPlatformDelta.height(), filteredVelocity);
Note: See TracChangeset for help on using the changeset viewer.