Bug 148384 - Wheel events stop propagating when target element is removed from DOM
Summary: Wheel events stop propagating when target element is removed from DOM
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brent Fulgham
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-08-24 11:57 PDT by Brent Fulgham
Modified: 2015-08-25 11:03 PDT (History)
5 users (show)

See Also:


Attachments
Patch (2.54 KB, patch)
2015-08-24 12:01 PDT, Brent Fulgham
no flags Details | Formatted Diff | Diff
Patch (3.57 KB, patch)
2015-08-24 15:46 PDT, Brent Fulgham
no flags Details | Formatted Diff | Diff
Patch (11.22 KB, patch)
2015-08-24 17:35 PDT, Brent Fulgham
hyatt: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Fulgham 2015-08-24 11:57:06 PDT
When listening to the ‘wheel’ or ‘mousewheel’ event on the document, if the event’s original target element is removed from the DOM the wheel event is no longer dispatched. 

1. Add a listener for ‘wheel’ on the document that removes the target of the event from the DOM. Have this happen after the element moves a specific amount or a certain number of events is received.
2. Scroll on the page (over the relevant element)
3. Keep scrolling

You will observe that the DOM event is no longer dispatched.
Comment 1 Brent Fulgham 2015-08-24 11:57:48 PDT
<rdar://problem/19732211>
Comment 2 Brent Fulgham 2015-08-24 12:01:31 PDT
Created attachment 259762 [details]
Patch
Comment 3 Tim Horton 2015-08-24 12:08:02 PDT
Comment on attachment 259762 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=259762&action=review

> Source/WebCore/page/mac/EventHandlerMac.mm:919
> +        return false;

Frames can be removed...

> Source/WebCore/page/mac/EventHandlerMac.mm:922
> +        return true;

Anonymous nodes can't be scrollable? (probably true)

> Source/WebCore/page/mac/EventHandlerMac.mm:925
> +        return true;

What if a node is moved around in the DOM? (removed and reinserted before we get here) Is that OK?
Comment 4 Brent Fulgham 2015-08-24 14:00:15 PDT
Comment on attachment 259762 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=259762&action=review

>> Source/WebCore/page/mac/EventHandlerMac.mm:925
>> +        return true;
> 
> What if a node is moved around in the DOM? (removed and reinserted before we get here) Is that OK?

It does seem like it would be a problem if we removed a node from one scrolling container, and inserted it into a new location. In that case, even with this code, we would start our event handling with this "migrated" node.

Maybe it would be better to just break the caching state in Element::removedFrom.
Comment 5 Brent Fulgham 2015-08-24 15:46:01 PDT
Created attachment 259786 [details]
Patch
Comment 6 Brent Fulgham 2015-08-24 17:35:06 PDT
Created attachment 259797 [details]
Patch
Comment 7 Dave Hyatt 2015-08-25 10:54:02 PDT
Comment on attachment 259797 [details]
Patch

r=me
Comment 8 Brent Fulgham 2015-08-25 11:03:12 PDT
Committed r188920: <http://trac.webkit.org/changeset/188920>