Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[resize-observer-1] Invoke callback with observer as 2nd argument and this value #5383

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shvaikalesh
Copy link
Contributor

@shvaikalesh shvaikalesh commented Aug 1, 2020

This PR aligns ResizeObserver spec (step 2.4) with implementations (WPT: test, results) and other observers:

Passing observer to callback enables users to reuse a single callback function, which invokes unobserve with entry's target, for multiple ResizeObserver instances.

@shvaikalesh
Copy link
Contributor Author

cc @atotic @gregwhitworth

@atotic
Copy link
Contributor

atotic commented Aug 8, 2020

Neither me nor greg are working on ResizeObserver right now, you should pick a current reviewer.

ashkulz pushed a commit to qtwebkit/webkit-mirror that referenced this pull request Aug 8, 2020
…is` value

https://bugs.webkit.org/show_bug.cgi?id=215162

Reviewed by Geoffrey Garen.

LayoutTests/imported/w3c:

* web-platform-tests/intersection-observer/observer-callback-arguments-expected.txt:
* web-platform-tests/performance-timeline/po-observe.any-expected.txt:
* web-platform-tests/performance-timeline/po-observe.any.worker-expected.txt:
* web-platform-tests/resize-observer/eventloop-expected.txt:
* web-platform-tests/resize-observer/observe-expected.txt:

Source/WebCore:

This change utilizes CallbackThisObject] IDL attribute to invoke a callback of
IntersectionObserver [1], ResizeObserver [2], and PerformanceObserver [3] with
correct `this` value of its observer, aligning WebKit with Blink and Gecko.

Tests: imported/w3c/web-platform-tests/intersection-observer/observer-callback-arguments.html
       imported/w3c/web-platform-tests/resize-observer/observe.html
       imported/w3c/web-platform-tests/performance-timeline/po-observe.any.js

[1] https://w3c.github.io/IntersectionObserver/#notify-intersection-observers-algo (step 3.4)
[2] w3c/csswg-drafts#5383
[3] https://w3c.github.io/performance-timeline/#queue-the-performanceobserver-task (step 3.3.5)

* html/LazyLoadImageObserver.cpp:
* page/IntersectionObserver.cpp:
(WebCore::IntersectionObserver::notify):
* page/IntersectionObserverCallback.h:
* page/IntersectionObserverCallback.idl:
* page/PerformanceObserver.cpp:
(WebCore::PerformanceObserver::deliver):
* page/PerformanceObserverCallback.h:
* page/PerformanceObserverCallback.idl:
* page/ResizeObserver.cpp:
(WebCore::ResizeObserver::deliverObservations):
* page/ResizeObserverCallback.h:
* page/ResizeObserverCallback.idl:

LayoutTests:

* performance-api/performance-observer-basic-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@265397 268f45cc-cd09-0410-ab3c-d52691b4dbfc
@shvaikalesh
Copy link
Contributor Author

cc @sahirv @tabatkins

Base automatically changed from master to main February 2, 2021 19:45
@w3cbot
Copy link

w3cbot commented May 18, 2021

shvaikalesh marked as non substantive for IPR from ash-nazg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants