⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 287635 in webkit


Ignore:
Timestamp:
Jan 5, 2022, 10:21:31 AM (5 years ago)
Author:
Russell Epstein
Message:

Cherry-pick r287593. rdar://problem/86910670

"canceled" wheel events to non-zero deltas cause scrolling jumps in PDFs and CodeMirror
​https://bugs.webkit.org/show_bug.cgi?id=234825

Reviewed by Tim Horton.

Source/WebKit:

On some macOS versions, interrupting a momentum scroll via a two-finger tap on the trackpad can
result in the following sequence of wheel events: momentumPhase:end -> phase:mayBegin -> phase:cancelled,
and that last canceled event can have non-zero deltas (rdar://86653042).

Protect against this by zeroing out the deltas for cancelled wheel events when constructing WebEvents
from NSEvents. Code in Element::dispatchWheelEvent() ensures that we don't dispatch wheel events with
zero deltas to script, fixing CodeMirror.

Jumps only affected PDFs (and scrollable selects) because those are the code paths that don't go via
ScrollingEffectsController, which already ignores Cancelled events.

Test: fast/scrolling/mac/canceled-event-with-non-zero-deltas.html

  • Shared/mac/WebEventFactory.mm: (WebKit::WebEventFactory::createWebWheelEvent):

LayoutTests:

  • fast/scrolling/mac/canceled-event-with-non-zero-deltas-expected.txt: Added.
  • fast/scrolling/mac/canceled-event-with-non-zero-deltas.html: Added.

git-svn-id: ​https://svn.webkit.org/repository/webkit/trunk@287593 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-612-branch
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-612-branch/LayoutTests/ChangeLog

    r287633 r287635  
     12022-01-05  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r287593. rdar://problem/86910670
     4
     5    "canceled" wheel events to non-zero deltas cause scrolling jumps in PDFs and CodeMirror
     6    https://bugs.webkit.org/show_bug.cgi?id=234825
     7   
     8    Reviewed by Tim Horton.
     9   
     10    Source/WebKit:
     11   
     12    On some macOS versions, interrupting a momentum scroll via a two-finger tap on the trackpad can
     13    result in the following sequence of wheel events: momentumPhase:end -> phase:mayBegin -> phase:cancelled,
     14    and that last canceled event can have non-zero deltas (rdar://86653042).
     15   
     16    Protect against this by zeroing out the deltas for cancelled wheel events when constructing WebEvents
     17    from NSEvents. Code in Element::dispatchWheelEvent() ensures that we don't dispatch wheel events with
     18    zero deltas to script, fixing CodeMirror.
     19   
     20    Jumps only affected PDFs (and scrollable selects) because those are the code paths that don't go via
     21    ScrollingEffectsController, which already ignores Cancelled events.
     22   
     23    Test: fast/scrolling/mac/canceled-event-with-non-zero-deltas.html
     24   
     25    * Shared/mac/WebEventFactory.mm:
     26    (WebKit::WebEventFactory::createWebWheelEvent):
     27   
     28    LayoutTests:
     29   
     30    * fast/scrolling/mac/canceled-event-with-non-zero-deltas-expected.txt: Added.
     31    * fast/scrolling/mac/canceled-event-with-non-zero-deltas.html: Added.
     32   
     33   
     34    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@287593 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     35
     36    2022-01-04  Simon Fraser  <simon.fraser@apple.com>
     37
     38            "canceled" wheel events to non-zero deltas cause scrolling jumps in PDFs and CodeMirror
     39            https://bugs.webkit.org/show_bug.cgi?id=234825
     40
     41            Reviewed by Tim Horton.
     42
     43            * fast/scrolling/mac/canceled-event-with-non-zero-deltas-expected.txt: Added.
     44            * fast/scrolling/mac/canceled-event-with-non-zero-deltas.html: Added.
     45
    1462022-01-05  Russell Epstein  <repstein@apple.com>
    247
  • branches/safari-612-branch/Source/WebKit/ChangeLog

    r287634 r287635  
     12022-01-05  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r287593. rdar://problem/86910670
     4
     5    "canceled" wheel events to non-zero deltas cause scrolling jumps in PDFs and CodeMirror
     6    https://bugs.webkit.org/show_bug.cgi?id=234825
     7   
     8    Reviewed by Tim Horton.
     9   
     10    Source/WebKit:
     11   
     12    On some macOS versions, interrupting a momentum scroll via a two-finger tap on the trackpad can
     13    result in the following sequence of wheel events: momentumPhase:end -> phase:mayBegin -> phase:cancelled,
     14    and that last canceled event can have non-zero deltas (rdar://86653042).
     15   
     16    Protect against this by zeroing out the deltas for cancelled wheel events when constructing WebEvents
     17    from NSEvents. Code in Element::dispatchWheelEvent() ensures that we don't dispatch wheel events with
     18    zero deltas to script, fixing CodeMirror.
     19   
     20    Jumps only affected PDFs (and scrollable selects) because those are the code paths that don't go via
     21    ScrollingEffectsController, which already ignores Cancelled events.
     22   
     23    Test: fast/scrolling/mac/canceled-event-with-non-zero-deltas.html
     24   
     25    * Shared/mac/WebEventFactory.mm:
     26    (WebKit::WebEventFactory::createWebWheelEvent):
     27   
     28    LayoutTests:
     29   
     30    * fast/scrolling/mac/canceled-event-with-non-zero-deltas-expected.txt: Added.
     31    * fast/scrolling/mac/canceled-event-with-non-zero-deltas.html: Added.
     32   
     33   
     34    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@287593 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     35
     36    2022-01-04  Simon Fraser  <simon.fraser@apple.com>
     37
     38            "canceled" wheel events to non-zero deltas cause scrolling jumps in PDFs and CodeMirror
     39            https://bugs.webkit.org/show_bug.cgi?id=234825
     40
     41            Reviewed by Tim Horton.
     42
     43            On some macOS versions, interrupting a momentum scroll via a two-finger tap on the trackpad can
     44            result in the following sequence of wheel events: momentumPhase:end -> phase:mayBegin -> phase:cancelled,
     45            and that last canceled event can have non-zero deltas (rdar://86653042).
     46
     47            Protect against this by zeroing out the deltas for cancelled wheel events when constructing WebEvents
     48            from NSEvents. Code in Element::dispatchWheelEvent() ensures that we don't dispatch wheel events with
     49            zero deltas to script, fixing CodeMirror.
     50
     51            Jumps only affected PDFs (and scrollable selects) because those are the code paths that don't go via
     52            ScrollingEffectsController, which already ignores Cancelled events.
     53
     54            Test: fast/scrolling/mac/canceled-event-with-non-zero-deltas.html
     55
     56            * Shared/mac/WebEventFactory.mm:
     57            (WebKit::WebEventFactory::createWebWheelEvent):
     58
    1592022-01-05  Russell Epstein  <repstein@apple.com>
    260
  • branches/safari-612-branch/Source/WebKit/Shared/mac/WebEventFactory.mm

    r286679 r287635  
    439439    auto ioHIDEventWallTime = WebCore::eventTimeStampSince1970(ioHIDEventTimestamp);
    440440
     441    if (phase == WebWheelEvent::PhaseCancelled) {
     442        deltaX = 0;
     443        deltaY = 0;
     444        wheelTicksX = 0;
     445        wheelTicksY = 0;
     446        unacceleratedScrollingDelta = { };
     447        rawPlatformDelta = std::nullopt;
     448    }
     449
    441450    return WebWheelEvent(WebEvent::Wheel, WebCore::IntPoint(position), WebCore::IntPoint(globalPosition), WebCore::FloatSize(deltaX, deltaY), WebCore::FloatSize(wheelTicksX, wheelTicksY),
    442451        granularity, directionInvertedFromDevice, phase, momentumPhase, hasPreciseScrollingDeltas,
Note: See TracChangeset for help on using the changeset viewer.