[Laszlo-checkins] r9370 - openlaszlo/trunk/WEB-INF/lps/lfc/views

bargull@openlaszlo.org bargull at openlaszlo.org
Thu May 29 09:37:52 PDT 2008


Author: bargull
Date: 2008-05-29 09:37:48 -0700 (Thu, 29 May 2008)
New Revision: 9370

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/views/LzText.lzs
Log:
Change 20080524-bargull-KxK by bargull at dell--p4--2-53 on 2008-05-24 23:55:34
    in /home/Admin/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: make font-attributes constrainable again

New Features:

Bugs Fixed: LPP-6038

Technical Reviewer: ptw
QA Reviewer: promanik
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
Font attribute (fontname, fontsize, fontstyle) are special cased in "LzText#construct(..)". And since constraints are no longer held in the
$refs object, the special casing need to be adjusted.
    

Tests:



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/views/LzText.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/views/LzText.lzs	2008-05-29 13:07:03 UTC (rev 9369)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/views/LzText.lzs	2008-05-29 16:37:48 UTC (rev 9370)
@@ -285,22 +285,34 @@
     super.construct.apply(this, arguments);
 
     this.sizeToHeight = false;
-
-    this.fontname  = ('font' in args)       ? args.font      : this.searchParents( "fontname"  ).fontname ;
-    this.fontsize  = ('fontsize' in args)   ? args.fontsize  : this.searchParents( "fontsize"  ).fontsize ;
-    this.fontstyle = ('fontstyle' in args)  ? args.fontstyle : this.searchParents( "fontstyle" ).fontstyle ;
-
-    args.font = this.fontname;
-    args.fontsize = this.fontsize;
-    args.fontstyle = this.fontstyle;
+    
+    var fontMap:Object = {font:'fontname', fontsize:'fontsize', fontstyle:'fontstyle'};
+    var fontCpy:Object = {};
+    for (var key:String in fontMap) {
+        var hasArg:Boolean = (key in args) ? true : false;//can't just write "key in args" in swf9..
+        var initExpr:Boolean = hasArg && args[key] is LzInitExpr;
+        fontCpy[key] = initExpr ? args[key] : LzNode._ignoreAttribute;
+        if (hasArg && !initExpr) {
+            // a normal value, just install it
+            this[fontMap[key]] = args[key];
+        } else {
+            // font-attribute wasn't specified or it was a constraint, 
+            // need to lookup for initial font-attribute
+            var val:String = fontMap[key];
+            this[val] = args[key] = this.searchParents( val )[ val ];
+        }
+    }
+    
     var tsprite:LzTextSprite = (this.sprite cast LzTextSprite);    
     tsprite.__initTextProperties(args);
+    
+    for (var key:String in fontCpy) {
+        // if font-attribute was a constraint, copy it back, 
+        // else set it to LzNode._ignoreAttribute, 
+        // so it won't be processed by LzNode#__LZapplyArgs(..)
+        args[key] = fontCpy[key];
+    }
 
-    args.font      = LzNode._ignoreAttribute;
-    args.fontsize  = LzNode._ignoreAttribute;
-    args.fontstyle = LzNode._ignoreAttribute;
-
-    //this.callInherited( "construct", arguments.callee ,  parent , args );
     this.yscroll = 0;
     this.xscroll = 0;
 



More information about the Laszlo-checkins mailing list