[ResizeObserver 3/3] ResizeObserver Web API implementation - #57723
Open
paradowstack wants to merge 37 commits into
Open
[ResizeObserver 3/3] ResizeObserver Web API implementation#57723paradowstack wants to merge 37 commits into
paradowstack wants to merge 37 commits into
Conversation
paradowstack
force-pushed
the
feat/resize-observer
branch
from
July 28, 2026 15:58
a7e8c72 to
d9da0c1
Compare
paradowstack
marked this pull request as ready for review
July 28, 2026 16:00
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Implements the
ResizeObserverWeb API for the New Architecture, behind theenableResizeObserverByDefaultflag (off by default).The motivation is Web compatibility, and it's more capable than
onLayout: callers pick which box to observe (content-box,border-box,device-pixel-content-box) and the sizes for those boxes are delivered in the notification.The design is as follows: JS
ResizeObserver/ResizeObserverEntry/ResizeObserverSizeon top of a manager singleton and theNativeResizeObserverTurboModule, using the same notify +takeRecordspull model. In C++,ResizeObserverManagercollects observed targets whose layout changed at commit time (viashadowTreeDidCommit) and then computes and delivers observations in the event loop's "update the rendering" step (RuntimeSchedulerResizeObserverDelegate::runResizeObservations), as the spec requires. Requires bridgeless + the modern event loop; the legacy scheduler gets a no-op delegate.Known deviations from the spec (each pinned by a test):
ResizeObserver loop completed with undelivered notificationserror is never emitted; a callback that triggers a resize is delivered on the next tick.observe()algorithm.observe()order rather than construction order.Changelog:
[GENERAL] [ADDED] - Add the
ResizeObserverAPI, behind theenableResizeObserverByDefaultfeature flagTest Plan:
ResizeObserver-itest.jscovers many test scenarios.ResizeObserverexamples (box sizes, text, visibility); verified initial, resize, and animation-driven delivery there.