resources: fix loading sequence of layout=fill and intersection-observer#30167
resources: fix loading sequence of layout=fill and intersection-observer#30167samouri merged 1 commit intoampproject:masterfrom
Conversation
| } | ||
|
|
||
| .i-amphtml-layout-fill, | ||
| .i-amphtml-layout-fill.i-amphtml-notbuilt, |
There was a problem hiding this comment.
Please add a comment that this is specifically needed to give higher specificity to this ruleset (vs the .i-amphtml-notbuilt ruleset which is declared later and will win if this uses the same specificity).
kristoferbaxter
left a comment
There was a problem hiding this comment.
Additionally, let's see if we can add a test to cover this scenario so we do not regress.
dvoytenko
left a comment
There was a problem hiding this comment.
Changes LG, but let's add tests.
|
What kind of test? My first instinct is thinking an e2e test that goes through every relevant extension and ensures it has a nonzero width/height before calling |
|
Good sleuthing! |
|
@samouri E2e might be hard since you need to catch pre-built state. IMHO, just a simple test with |
|
I added an integration test for something similar in test-css.js, but I think a visual test might be more understandable. You can simulate unbuilt component by breaking the extension script URL. |
summary
Fixes #29398.
Before the IO path of
resources-impl, we would build then measure. In the IO branch, the order is measure then build. For most layout types this shouldn't matter, butlayout=fillhas a clash withi-amphtml-notbuilt. In order forlayout=fillto be sized correctly, it must haveposition: absolutebut thenotbuiltgives it relative position.Not ready to be merged as-is, need to research to see if there are other edge cases (layout types) to consider. Notable, all elements must have correct width/height before being built, unless they explicitly request remeasure later (e.g. via mutateElement method)