[webkit-changes] [WebKit/WebKit] 2861d8: [ResizeObserver] The initial last reported size of...

cathiechen noreply at github.com
Wed Feb 1 02:51:32 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2861d8c4e29ca8c3384e47f260a0d0e1823c29ae
      https://github.com/WebKit/WebKit/commit/2861d8c4e29ca8c3384e47f260a0d0e1823c29ae
  Author: Cathie Chen <cathiechen at igalia.com>
  Date:   2023-02-01 (Wed, 01 Feb 2023)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/resize-observer/notify-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/resize-observer/observe-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/resize-observer/svg-expected.txt
    A LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/resize-observer/notify-expected.txt
    M LayoutTests/platform/mac/imported/w3c/web-platform-tests/resize-observer/svg-expected.txt
    M Source/WebCore/page/ResizeObservation.cpp
    M Source/WebCore/page/ResizeObserver.cpp
    M Source/WebCore/page/ResizeObserver.h

  Log Message:
  -----------
  [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] https://github.com/w3c/csswg-drafts/issues/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




More information about the webkit-changes mailing list