Bug 1553584 Comment 14 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

(In reply to Maja Frydrychowicz :maja_zf (she/her) (UTC-4) (maja@mozilla.com) from comment #12)
> dholbert, do you have any idea why the transaction IDs might be off like this, or what can be done to flush the layout further? All the harness does now is call [getBoundingClientRect()](https://searchfox.org/mozilla-central/rev/7556a400affa9eb99e522d2d17c40689fa23a729/testing/marionette/listener.js#1579)

One idea:
getBoundingClientRect flushes layout (per its use of [`FlushType::Layout`](https://searchfox.org/mozilla-central/rev/153172de0c5bfca31ef861bd8fc0995f44cada6a/dom/base/Element.cpp#1026)), and it doesn't flush painting -- so if there's some async pending paint and we snapshot immediately after the layout flush, it's conceivable that we'll get an out-of-date rendering.  (I'm hand-waving a bit here, because I'm not sure about timing of paints, particularly on Android. But it's conceivable to me that this might be the problem.)

So, if we want to flush more thoroughly, we might want to use a function that flushes with [`FlushType::Display`](https://searchfox.org/mozilla-central/rev/153172de0c5bfca31ef861bd8fc0995f44cada6a/dom/base/FlushType.h#38).  One option for that is the nsIDOMWindowUtils method [`updateLayerTree()`](https://searchfox.org/mozilla-central/rev/153172de0c5bfca31ef861bd8fc0995f44cada6a/dom/interfaces/base/nsIDOMWindowUtils.idl#106-110) (which [flushes Display here](https://searchfox.org/mozilla-central/rev/153172de0c5bfca31ef861bd8fc0995f44cada6a/dom/base/nsDOMWindowUtils.cpp#378-379)).  It looks like that's what we use in the normal reftest harness, actually: https://searchfox.org/mozilla-central/rev/153172de0c5bfca31ef861bd8fc0995f44cada6a/layout/tools/reftest/reftest-content.js#1121,1137
(In reply to Maja Frydrychowicz :maja_zf (she/her) (UTC-4) (maja@mozilla.com) from comment #12)
> dholbert, do you have any idea why the transaction IDs might be off like this, or what can be done to flush the layout further? All the harness does now is call [getBoundingClientRect()](https://searchfox.org/mozilla-central/rev/7556a400affa9eb99e522d2d17c40689fa23a729/testing/marionette/listener.js#1579)

One idea: so, your trigger-a-flush function `getBoundingClientRect()` just flushes layout (per its use of [`FlushType::Layout`](https://searchfox.org/mozilla-central/rev/153172de0c5bfca31ef861bd8fc0995f44cada6a/dom/base/Element.cpp#1026)), and it doesn't flush painting -- so if there's some async pending paint and we snapshot immediately after the layout flush, it's conceivable that we'll get an out-of-date rendering.  (I'm hand-waving a bit here, because I'm not sure about timing of paints, particularly on Android. But it's conceivable to me that this might be the problem.)

So, if we want to flush more thoroughly, we might want to use a function that flushes with [`FlushType::Display`](https://searchfox.org/mozilla-central/rev/153172de0c5bfca31ef861bd8fc0995f44cada6a/dom/base/FlushType.h#38).  One option for that is the nsIDOMWindowUtils method [`updateLayerTree()`](https://searchfox.org/mozilla-central/rev/153172de0c5bfca31ef861bd8fc0995f44cada6a/dom/interfaces/base/nsIDOMWindowUtils.idl#106-110) (which [flushes Display here](https://searchfox.org/mozilla-central/rev/153172de0c5bfca31ef861bd8fc0995f44cada6a/dom/base/nsDOMWindowUtils.cpp#378-379)).  It looks like that's what we use in the normal reftest harness, actually: https://searchfox.org/mozilla-central/rev/153172de0c5bfca31ef861bd8fc0995f44cada6a/layout/tools/reftest/reftest-content.js#1121,1137

Back to Bug 1553584 Comment 14