[csswg-drafts] [resize-observer] ResizeObserver callback order. (#4518)

emilio has just created a new issue for https://github.com/w3c/csswg-drafts:

== [resize-observer] ResizeObserver callback order. ==
The specification has a well-defined callback order, however it requires keeping alive observers for too long (see [this firefox bug](https://bugzilla.mozilla.org/show_bug.cgi?id=1596992)).

It seems that WebKit is doing the same thing I'm going to do in Gecko (add to the `Document.resizeObservers` slot on `observe()`, and remove on the last `unobserve()` call).

It seems Blink uses [a hash set](https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/resize_observer/resize_observer_controller.h?l=51&rcl=47bf0c9c1c4532aafac244de9ee0784a576d36c4) so I don't even know if the iteration order there is well defined for them.

I'm going to align with WebKit for now as it seems simpler to implement and doesn't create an insert-only list / set.

Doing this creates an issue, which is that the observers can be removed when delivering observations. This was already a problem for additions, but explicitly copying the contents of the slot before iteration in the spec may be clearer.

cc @smfr @atotic 

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4518 using your GitHub account

Received on Tuesday, 19 November 2019 14:50:46 UTC