[Laszlo-checkins] r3811 - in openlaszlo/branches/legals: WEB-INF/lps/lfc/services lps/components/utils/traits test/style/neighborhood
max@openlaszlo.org
max at openlaszlo.org
Tue Feb 13 19:31:17 PST 2007
Author: max
Date: 2007-02-13 19:31:16 -0800 (Tue, 13 Feb 2007)
New Revision: 3811
Modified:
openlaszlo/branches/legals/WEB-INF/lps/lfc/services/LzCSSStyle.js
openlaszlo/branches/legals/lps/components/utils/traits/cssable.lzx
openlaszlo/branches/legals/test/style/neighborhood/neighborhoodclasses.lzx
Log:
Change 20070213-maxcarlson-q by maxcarlson at max-carlsons-computer.local on 2007-02-13 16:56:02 PST
in /Users/maxcarlson/openlaszlo/legals
Summary: Fix CSS in legals
New Features:
Bugs Fixed: LPP-3422 - CSS port to OL4
Technical Reviewer: promanik
QA Reviewer: bshine
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details: neighborhoodclasses.lzx - Use 'with' instead of 'traits'
LzCSSStyle.js - Use old value lookup (which works) and look for 'canvas' in getPropertyValueFor(). Look in 'lz' instead of 'ConstructorMap' in __compareSpecificity(). Look in 'lz' instead of 'ConstructorMap', look for 'canvas' explicitly in _selectorApplies().
cssable.lzx - Add cssable trait implementation in script immediate block until <mixin/> is available.
Tests: http://localhost:8080/legals/test/style/descendantselector/complex-descendant-selector-test.lzx, http://localhost:8080/legals/test/style/descendantselector/descendantselector-test.lzx and http://localhost:8080/legals/test/style/descendantselector/simplerdescendant-test.lzx now pass in swf.
Files:
M test/style/neighborhood/neighborhoodclasses.lzx
M WEB-INF/lps/lfc/services/LzCSSStyle.js
M lps/components/utils/traits/cssable.lzx
Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20070213-maxcarlson-q.tar
Modified: openlaszlo/branches/legals/WEB-INF/lps/lfc/services/LzCSSStyle.js
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/lfc/services/LzCSSStyle.js 2007-02-14 03:26:51 UTC (rev 3810)
+++ openlaszlo/branches/legals/WEB-INF/lps/lfc/services/LzCSSStyle.js 2007-02-14 03:31:16 UTC (rev 3811)
@@ -84,7 +84,7 @@
//LzCSSStyle.time1 = 0;
LzCSSStyle.getPropertyValueFor = function ( node , pname ){
- //_root.Debug.format("node: %w, pname: %w, rules: %w\n", node, pname, this._rules);
+ //Debug.warn("node: %w, pname: %w, rules: %w\n", node, pname, this._rules);
//var t = getTimer();
var uid = node.getUID();
@@ -128,12 +128,13 @@
var pv = null;
var i = 0;
while ( i < l ) {
- pv = rules[i++].properties;
- if (pv in properties) { return pv[pname]; }
+ // TODO: [2007-01-02 ptw] In Legal's you can ask `pname in properties`
+ pv = rules[ i++ ].properties[ pname ];
+ if ( pv !== void 0 ) return pv;
}
////this.time1 += getTimer() - t;
- if ( node == _root.canvas ) return null;
+ if ( node == canvas ) return null;
else {
return this.getPropertyValueFor(node.immediateparent, pname );
}
@@ -202,8 +203,8 @@
continue;
}
- var rac = ConstructorMap[ rA.parsed[ i ].classname ];
- var rbc = ConstructorMap[ rB.parsed[ i ].classname ];
+ var rac = lz[ rA.parsed[ i ].classname ];
+ var rbc = lz[ rB.parsed[ i ].classname ];
return rac.prototype instanceof rbc ? -1 : 1;
@@ -213,8 +214,8 @@
if ( ( rA.parsed.classname && rB.parsed.classname ) &&
( rA.parsed.classname != rB.parsed.classname ) ){
- var rac = ConstructorMap[ rA.parsed.classname ];
- var rbc = ConstructorMap[ rB.parsed.classname ];
+ var rac = lz[ rA.parsed.classname ];
+ var rbc = lz[ rB.parsed.classname ];
return rac.prototype instanceof rbc ? -1 : 1;
@@ -242,7 +243,7 @@
return node.id == rp.id;
case (this._selTypes.tag ):
- return node instanceof ConstructorMap[ rp.classname ];
+ return node instanceof lz[ rp.classname ];
case (this._selTypes.compound ):
var curnode = node;
@@ -263,7 +264,7 @@
return false;
}
- //assumes parent of canvas is null
+ if (curnode == canvas) break;
curnode = curnode.parent;
firstone = false;
}
@@ -274,7 +275,7 @@
case (this._selTypes.tagAndAttr ):
if (node[ rp.attrname ] == rp.attrvalue) {
- return node instanceof ConstructorMap[ rp.classname ];
+ return node instanceof lz[ rp.classname ];
}
return false;
}
Modified: openlaszlo/branches/legals/lps/components/utils/traits/cssable.lzx
===================================================================
--- openlaszlo/branches/legals/lps/components/utils/traits/cssable.lzx 2007-02-14 03:26:51 UTC (rev 3810)
+++ openlaszlo/branches/legals/lps/components/utils/traits/cssable.lzx 2007-02-14 03:31:16 UTC (rev 3811)
@@ -1,16 +1,21 @@
-<!-- Copyright 2006 Laszlo Systems -->
+<!-- Copyright 2007 Laszlo Systems -->
<library>
+<!-- [todo: max 2-13-2007] moved to bottom of LzNode until <mixin/> is available-->
+<script when="immediate">
+trait cssable {
-<trait name="cssable">
- <!-- Attributes are supported -->
- <attribute name="cssPropertyMap" value="null"/>
- <attribute name="cssStyle" value="null" />
- <attribute name="fontcolor" value="0" type="number" /> <!-- Special attribute for fontcolor -->
-
- <!-- Declaring this here should work, but doesn't. See LPP-2490 -->
- <handler name="onconstruct" method="_applyCSS" />
-
- <method name="_applyCSS">
+static function initialize (prototype) {
+ this._applyCSS();
+}
+DeclareEvent(prototype, 'cssPropertyMap' );
+DeclareEvent(prototype, 'cssStyle' );
+DeclareEvent(prototype, 'fontcolor' );
+
+var cssPropertyMap = null;
+var cssStyle = null;
+var fontcolor = null;
+
+function _applyCSS () {
// Look up the style
this.cssStyle = LzCSSStyle.getComputedStyle( this );
var st = this.cssStyle; // put it in a register
@@ -40,6 +45,7 @@
}
}
}
- </method>
-</trait>
-</library>
\ No newline at end of file
+}
+}
+</script>
+</library>
Modified: openlaszlo/branches/legals/test/style/neighborhood/neighborhoodclasses.lzx
===================================================================
--- openlaszlo/branches/legals/test/style/neighborhood/neighborhoodclasses.lzx 2007-02-14 03:26:51 UTC (rev 3810)
+++ openlaszlo/branches/legals/test/style/neighborhood/neighborhoodclasses.lzx 2007-02-14 03:31:16 UTC (rev 3811)
@@ -1,4 +1,4 @@
-<library> <!-- Copyright 2006 Laszlo Systems -->
+<library> <!-- Copyright 2007 Laszlo Systems -->
<!-- A bunch of silly classes for testing only. The general idea
is that a house is a child of street, people are children of houses,
children are children of their their parents, and pets are children
@@ -12,7 +12,7 @@
<attribute name="misc" type="string" value="(none)" />
</class>
-<class name="cat" extends="animal" traits="cssable">
+<class name="cat" extends="animal" with="cssable">
<!-- List the attributes which will be styled by CSS -->
<attribute name="cssPropertyMap"
value="{furcolor:'furcolor',meowsound:'meowsound', misc:'misc'}" />
@@ -27,7 +27,7 @@
<attribute name="furcolor" value="white" />
</class>
-<class name="house" bgcolor="0xFFFFFF" traits="cssable">
+<class name="house" bgcolor="0xFFFFFF" with="cssable">
<simplelayout axis="x" spacing="2" />
<attribute name="paintcolor" value="0xFFFFFF" />
<attribute name="streetaddress" value="123" />
@@ -36,7 +36,7 @@
<handler name="onconstruct" method="_applyCSS" />
</class>
-<class name="street" bgcolor="0x8888AA" traits="cssable">
+<class name="street" bgcolor="0x8888AA" with="cssable">
<simplelayout axis="x" spacing="30" />
<attribute name="cssPropertyMap"
value="{streetname: 'streetname', streettype: 'streettype'}" />
@@ -53,7 +53,7 @@
<handler name="onconstruct" method="_applyCSS" />
</class>
-<class name="person" width="100" traits="cssable">
+<class name="person" width="100" with="cssable">
<simplelayout axis="y" spacing="5" />
<attribute name="fullname" type="string" value="Unnamed Person" />
<attribute name="shortname" type="string" value="Peep" />
@@ -69,4 +69,4 @@
value="{ occupation: 'occupation', favoritecolor: 'favoritecolor'}" />
<handler name="onconstruct" method="_applyCSS" />
</class>
-</library>
\ No newline at end of file
+</library>
More information about the Laszlo-checkins
mailing list