immersive-web / webxr

Repository for the WebXR Device API Specification.
https://immersive-web.github.io/webxr/
Other
2.98k stars 382 forks source link

ResizeObserver? #1281

Open krpano opened 2 years ago

krpano commented 2 years ago

After entering WebXR mode the ResizeObserver doesn't run / get called anymore...

Is this intentional or a bug?

eXponenta commented 2 years ago

Same as and window.requestAnimationFrame.

It not fired because there are not contents that should be synchronised with page draw - page not draw more.

Looks like as optimization. Browser supress any elements reflow.

krpano commented 2 years ago

So that's intentional? If yes, then this behavior should be documented in some spec, or?!

Working around that is not a big problem, but when that behavior might change in future it could become a problem!

Here more information for better understanding the usage-case/problem: in my case I'm rendering dynamic html-textfields to canvas for using them as textures in WebGL (and further also in WebXR). And for tracking dynamic changes the ResizeObserver is a nice tool here. As workaround for ResizeObserver not getting called I'm checking at the moment if WebXR is enabled and then do a manual size-change tracking and checking in the WebXR frameloop.

So if one day ResizeObserver would start running also when in WebXR mode, this could case conflicts...

Therefore it would be good know what's the actual and intended state here and if it keeps as it is! (even when others eventually notice that problem later too and request changes)

eXponenta commented 2 years ago

Following to spec this is normally. ResizeObeserver called in:

Recalc styles

Update layout

Paint

https://www.w3.org/TR/resize-observer/#html-event-loop

In XR state there are not Paint at all, and other reconciling states (how i know).