PDA

View Full Version : User-triggered window resize required to force correct layout of container hierarchy



stahlman
28 Oct 2011, 1:34 PM
I've noticed a number of scenarios in which a view comes up initially blank - or if not completely blank, with much of its content missing. The display is fixed the first time I resize the window. I haven't debugged in detail, but it appears that in such cases, the width and/or height properties of parent containers aren't getting set during the initial layout, with the result that overflowing child components are hidden.

dongryphon
28 Oct 2011, 2:22 PM
I haven't seen that behavior before, but your guess as to the root cause certainly fits the symptoms. Any chance that can be reproduced in a small example?

stahlman
31 Oct 2011, 5:07 AM
Although it happens on a number of screens, the application is large and complex, and I haven't yet been able to isolate a small test case. Will post if I do...

This may be unrelated, but I also get a number of exceptions from the following line in Ext.layout.component.Component.beginLayoutCycle:

ownerContext.setWidth(me.lastComponentSize.width, false, true);

The problem is that me.lastComponentSize is undefined the first time this method is called for the component (firstCycle == true). I haven't really investigated to see how this property is supposed to be "bootstrapped", but apparently, it doesn't happen the way it should in some cases...

Thanks,
Brett S.

dongryphon
31 Oct 2011, 9:11 AM
The root cause of this exception is improper "scoping" of the layout. While it is tempting to add a null check and default in some values, that will just produce a garbage layout result...

<tmi>
When a component is told to layout, if a dimension is calculated by its ownerLayout (width/heightAuthority==2), but the ownerLayout is not in scope for this run ("isTopLevel") then we pull the size information from the last layout run ("lastComponentSize"). If the component has never been sized, it will not have a "lastComponentSize" and so the layout scope *must* include its ownerLayout... sadly if "lastComponentSize" is null in this case, then this requirement is being violated.
</tmi>
:)

Thanks for digging in on the build - much appreciated.

stahlman
31 Oct 2011, 9:16 AM
Don,
Thanks. I appreciate the explanation.
Brett S.

johnnywengluu
10 Dec 2011, 1:21 AM
I am getting the error "me.lastComponentSize is undefined" in FireFox and "TypeError: Cannot convert 'me.lastComponentSize' to object" in Opera.

It works great in Safari and Chrome.

Will this be fixed for the next release?

dongryphon
10 Dec 2011, 3:13 PM
I am getting the error "me.lastComponentSize is undefined" in FireFox and "TypeError: Cannot convert 'me.lastComponentSize' to object" in Opera.

It works great in Safari and Chrome.

Will this be fixed for the next release?

This is much improved for the next release, yes.