Bug 228693

Summary: Calling unobserve on ResizeObserver should not clear existing observations in active targets
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: DOMAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Normal CC: a, cathiechen, cdumez, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=157743
https://bugs.webkit.org/show_bug.cgi?id=228679
Bug Depends on: 227194    
Bug Blocks:    
Attachments:
Description Flags
Patch cdumez: review+, cdumez: commit-queue-

Description Ryosuke Niwa 2021-08-01 17:47:29 PDT
According to the spec https://drafts.csswg.org/resize-observer/#dom-resizeobserver-unobserve,
we should not be clearing the active targets when unobserve is called.
Comment 1 Ryosuke Niwa 2021-08-01 17:49:36 PDT
Looks like Chrome has the same bug so that's a bit concerning...
Comment 2 Ryosuke Niwa 2021-08-01 18:10:04 PDT
Created attachment 434729 [details]
Patch
Comment 3 Chris Dumez 2021-08-02 08:19:41 PDT
Comment on attachment 434729 [details]
Patch

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

r=me with changelog fix.

> LayoutTests/ChangeLog:13
> +2021-08-01  Ryosuke Niwa  <rniwa@webkit.org>

double change log.
Comment 4 Ryosuke Niwa 2021-08-02 13:01:49 PDT
Comment on attachment 434729 [details]
Patch

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

>> LayoutTests/ChangeLog:13
>> +2021-08-01  Ryosuke Niwa  <rniwa@webkit.org>
> 
> double change log.

Weird. Not sure what happened here. Will fix before landing.
Comment 5 Ryosuke Niwa 2021-08-02 13:03:19 PDT
Committed r280551 (240178@main): <https://commits.webkit.org/240178@main>
Comment 6 Radar WebKit Bug Importer 2021-08-02 13:04:24 PDT
<rdar://problem/81425446>
Comment 7 Aleksandar Totic 2021-08-03 23:44:27 PDT
This might be a spec misunderstanding:

From the spec:

[[activeTargets]] represents all Elements whose size has changed since last observation broadcast that are eligible for broadcast.

What makes an element eligible is not explicitly defined. 
My intuition is that calling "unobserve" on an elment should make it inelligible.
Comment 8 Aleksandar Totic 2021-08-03 23:48:13 PDT
Filed spec bug: https://github.com/w3c/csswg-drafts/issues/6493