Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[ResizeObserver] The initial last reported size of ResizeObservation …
…should be -1x-1 which always notify observed elements https://bugs.webkit.org/show_bug.cgi?id=251015 Reviewed by Oriol Brufau and Ryosuke Niwa. This patch initializes the lastReportedSize of ResizeObservation to -1 x -1, which is the conclusion of [1], it indicates that -1 x -1 is the initial size when first observing an element with ResizeObserver. The previous change makes every ResizeObservation be delivered at least once, even if the target is a disconnected element. When GC happens between observe and gather ResizeObservations, JSC::Weak<JSC::JSObject> m_callback inside JSCallbackDataWeak could be released, and the element and JSResizeObserver might not be released, for they are not strong connected, this scenario would trigger the ASSERT in ResizeObserver::deliverObservations. To fix it, this patch adds m_targetsWaitingForFirstObservation to extend the life cycle of ResizeObserver to the first time of deliverObservations. The fix is similar to what IntersectionObserver does in bug 231235. The test6 of resize-observer/notify.html still fails in mac-wk1, because updaterendering is not triggered properly. Filed [2] to track it. [1] w3c/csswg-drafts#3664 [2] https://bugs.webkit.org/show_bug.cgi?id=250900 * LayoutTests/imported/w3c/web-platform-tests/resize-observer/notify-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/resize-observer/observe-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/resize-observer/svg-expected.txt: * LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/resize-observer/notify-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/resize-observer/notify-expected.txt. * LayoutTests/platform/mac/imported/w3c/web-platform-tests/resize-observer/svg-expected.txt: * Source/WebCore/page/ResizeObservation.cpp: * Source/WebCore/page/ResizeObserver.cpp: (WebCore::ResizeObserver::observe): (WebCore::ResizeObserver::deliverObservations): (WebCore::ResizeObserver::isReachableFromOpaqueRoots const): (WebCore::ResizeObserver::removeAllTargets): (WebCore::ResizeObserver::removeObservation): * Source/WebCore/page/ResizeObserver.h: Canonical link: https://commits.webkit.org/259673@main
- Loading branch information
1 parent
ad178f9
commit 2861d8c
Showing
8 changed files
with
61 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...ests/platform/mac-wk1/imported/w3c/web-platform-tests/resize-observer/notify-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
ResizeObserver tests | ||
|
||
t1 | ||
t2 | ||
t3 | ||
inline | ||
|
||
PASS ResizeObserver implemented | ||
PASS guard | ||
PASS test0: notification ordering | ||
PASS test1: display:none triggers notification | ||
PASS test2: remove/appendChild trigger notification | ||
PASS test3: dimensions match | ||
PASS test4: transform do not cause notifications | ||
PASS test5: moving an element does not trigger notifications | ||
FAIL test6: inline element notifies once with 0x0. assert_unreached: Timed out waiting for notification. (1000ms) Reached unreachable code | ||
PASS test7: unobserve inside notify callback | ||
PASS test8: observe inside notify callback | ||
PASS test9: disconnect inside notify callback | ||
PASS test10: element notifies when parent removed | ||
PASS test11: display:none element should be notified | ||
PASS test12: element sized 0x0 should be notified | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters