I'm replying to this post even if it isn't the latest because it has the most discussion items in it. First, though, thank you for working on this and digging up related posts and information.
Responses inline. Grabbing two discussion items from a later post: 1) is requestAnimationFrame deployed everywhere? I think caniuse.com said it wasn't on my version of Safari. 2) Did AMP say they set style.width or just that they set width in CSS possibly via class selectors and other selectors? On 3/25/18, 1:59 AM, "Harbs" <[email protected]> wrote: >Wow. That’s a long email. :-) > >I’m going to take one of the Royale examples and use that to address >these points. That will give us a concrete point of reference for >discussion. > >In the meantime, here’s the simplified issue: > >LayoutBase needs to have some way of caching the width and height of a >host to know if it was resized by it’s children to let the parent know >that it needs to be resized. I'm still wondering why LayoutBase needs to have some way of caching width/height. I would think many apps just need to set up a responsive DOM tree and can let the browser deal with it after that. And if that's true, then only the layouts that need to cache it should cache it. That's PAYG. Don't cache it just-in-case. Or use deferred rendering just-in-case. > >Currently, somewhere up the tree, there’s going to be a component which >has a size set explicitly — even if it’s the application. Now it’s >possible that the size of the application does not need to be explicitly >set in all situations. I’m actually not sure why it’s being set… >To facilitate the reflowing of the parent when the host is resized by its >children, the original sizes need to be cached and then compared against >the new sizes. The problem is due to layouts being recursively called as >components are added to their parents. PAYG would say that the layouts who care about the parent size run the code to figure out what they need and cache sizes they need. We have some methods like isWidthSizedToContent already. > >You are right that we don’t need to cache these values when there’s only >things like (simple) vertical and horizontal layouts being used, but I’m >not sure how a layout is supposed to know what the layouts of all its >ancestors are to know whether to trigger a resize. I think the above paragraph is key: the PAYG way is to not cache values for simple layouts and have the more complex layouts cache and compute what they need. If you have time, I would like to see numbers if all you do is move the caching to the layouts that need it. My 2 cents, -Alex >
