[Laszlo-dev] optimiziation for inheriting fontsize/name properties
P T Withington
ptw at openlaszlo.org
Fri Mar 31 12:51:56 EST 2006
a) Is the font really determined by the immediate (dynamic) parent?
That's annoying because it means you can't compute it at compile time.
b) If css properties like this _are_ determined by the immediate
parent, then perhaps the props should all be stored in a separate css
attribute and we could use proto-based inheritance to do the lookup.
E.g., css would be an attribute of view that is a hash, and the
hash's __proto__ would be the immediate parent's css hash.
On 2006-03-31 09:41 EST, Henry Minsky wrote:
> The text class calls
>
> this.fontname = this.searchParents( "fontname" ).fontname;
>
> for font name/size/style properties
>
> searchParents is implemented as
>
> LzView.prototype.searchParents = function ( prop ){
> var sview = this;
> do{
> sview = sview.immediateparent;
> if (sview[ prop ] != null ){
> return sview;
> }
> }while ( sview != canvas );
> }
>
> Would it be more efficient if the searchParents function set the
> properties
> all the way back down the parent
> chain when it found one, so that other calls wouldn't have to
> search up past
> their first parent? It seems like with the
> way the value is filled in now, that wouldn't change the behavior
> because in
> the current code the font style attributes which are null at
> runtime are
> found and cached on a text element, and then modifying the parent
> has no
> subsequent effect on the text font style. So caching the parent
> values as
> well wouldn't change things anyway.
>
>
> --
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com
> _______________________________________________
> Laszlo-dev mailing list
> Laszlo-dev at openlaszlo.org
> http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
More information about the Laszlo-dev
mailing list