[Laszlo-dev] [Laszlo-checkins] r6042 - in openlaszlo/branches/wafflecone/WEB-INF/lps/lfc: services views
Benjamin Shine
ben at laszlosystems.com
Mon Aug 13 20:23:03 PDT 2007
Approved.
On Aug 13, 2007, at 4:52 PM, max at openlaszlo.org wrote:
> Author: max
> Date: 2007-08-13 16:52:08 -0700 (Mon, 13 Aug 2007)
> New Revision: 6042
>
> Modified:
> openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/services/
> LzCSSStyle.js
> openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LaszloView.lzs
> Log:
> Change 20070813-maxcarlson-b by maxcarlson at plastik on 2007-08-13
> 16:24:27 PDT
> in /Users/maxcarlson/openlaszlo/wafflecone
> for http://svn.openlaszlo.org/openlaszlo/branches/wafflecone
>
> Summary: UPDATED: performance improvements
>
> New Features:
>
> Bugs Fixed: LPP-4394 - "LzGlobalMouse.onmousemove" is way to slow
> for "LzView.prototype.getMouse.dependencies" in SWF, LPP-4414 -
> Improve startup performance (partial)
>
> Technical Reviewer: promanik
> QA Reviewer: ben
> Doc Reviewer: (pending)
>
> Documentation:
>
> Release Notes:
>
> Details: LzCSSStyle.js - Inlined getSpecificity() and
> getSelectorSpecificity() in __compareSpecificity(). Swf 7 profiler
> shows 2217 fewer function calls.
>
> LaszloView.lzs - Fix per LPP-4394, cache setVisible() and
> setVisibility() values.
>
> Tests: Swf 7 profiler shows 2217 fewer calls to getSpecificity()
> and getSelectorSpecificity() and 47 fewer calls to __LZupdateShown
> (). Also passes http://localhost:8080/wafflecone/test/style/
> metasuite.lzx?lzr=swf8&debug=true
>
>
>
> Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/services/
> LzCSSStyle.js
> ===================================================================
> --- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/services/
> LzCSSStyle.js 2007-08-13 23:51:55 UTC (rev 6041)
> +++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/services/
> LzCSSStyle.js 2007-08-13 23:52:08 UTC (rev 6042)
> @@ -21,6 +21,8 @@
> LzCSSStyleRule.prototype.selector = null;
> //No rule has a specificity of zero
> LzCSSStyleRule.prototype.specificity = 0;
> +
> +// this is inlined in __compareSpecificity() - keep in sync
> LzCSSStyleRule.prototype.getSpecificity = function () {
>
> // Only calculate this once. Store it after we've calculated
> it once.
> @@ -241,6 +243,7 @@
> }
> }
>
> +// this is inlined in __compareSpecificity() - keep in sync
> LzCSSStyle.getSelectorSpecificity = function ( parsedsel ){
> // Go through all the selectors in the selector, keeping a
> running
> // count of various kinds of selectors:
> @@ -272,8 +275,117 @@
> // if rA specificity is less than rB specifity, return -1
> // if they're equal specificity, return 0
> // if rB specifitity is less than rA specificity, return 1
> - var specificityA = rA.getSpecificity();
> - var specificityB = rB.getSpecificity();
> + if (! rA.specificity) {
> + //inline: rA.getSpecificity();
> + // Only calculate this once. Store it after we've
> calculated it once.
> + // No rule has a specificity of 0
> + if ( !rA.specificity ) {
> + //need to treat compound selectors differently
> +
> + if ( rA.parsed.type == LzCSSStyle._sel_compound ){
> + for ( var i = 0; i < rA.parsed.length; i++ ){
> + //inline: rA.specificity +=
> LzCSSStyle.getSelectorSpecificity( rA.parsed[ i ] );
> + switch ( rA.parsed[i].type ){
> + case (LzCSSStyle._sel_tag ):
> + case (LzCSSStyle._sel_star ):
> + rA.specificity += 1;
> + break;
> +
> + case (LzCSSStyle._sel_id ):
> + rA.specificity += 100;
> + break;
> +
> + case (LzCSSStyle._sel_attribute ):
> + rA.specificity += 10;
> + break;
> +
> + case (LzCSSStyle._sel_tagAndAttr ):
> + rA.specificity += 11;
> + break;
> + }
> + }
> + } else {
> + //inline: rA.specificity =
> LzCSSStyle.getSelectorSpecificity( rA.parsed );
> + switch ( rA.parsed.type ){
> + case (LzCSSStyle._sel_tag ):
> + case (LzCSSStyle._sel_star ):
> + rA.specificity = 1;
> + break;
> +
> + case (LzCSSStyle._sel_id ):
> + rA.specificity = 100;
> + break;
> +
> + case (LzCSSStyle._sel_attribute ):
> + rA.specificity = 10;
> + break;
> +
> + case (LzCSSStyle._sel_tagAndAttr ):
> + rA.specificity = 11;
> + break;
> + }
> + }
> +
> + //Debug.write( 'specificity for' , this ,
> this.specificity );
> + }
> + }
> + if (! rB.specificity) {
> + //inline: rB.getSpecificity();
> + // Only calculate this once. Store it after we've
> calculated it once.
> + // No rule has a specificity of 0
> + if ( !rB.specificity ) {
> + //need to treat compound selectors differently
> +
> + if ( rB.parsed.type == LzCSSStyle._sel_compound ){
> + for ( var i = 0; i < rB.parsed.length; i++ ){
> + //inline: rB.specificity +=
> LzCSSStyle.getSelectorSpecificity( rB.parsed[ i ] );
> + switch ( rB.parsed[i].type ){
> + case (LzCSSStyle._sel_tag ):
> + case (LzCSSStyle._sel_star ):
> + rB.specificity += 1;
> + break;
> +
> + case (LzCSSStyle._sel_id ):
> + rB.specificity += 100;
> + break;
> +
> + case (LzCSSStyle._sel_attribute ):
> + rB.specificity += 10;
> + break;
> +
> + case (LzCSSStyle._sel_tagAndAttr ):
> + rB.specificity += 11;
> + break;
> + }
> + }
> + } else {
> + //inline: rB.specificity =
> LzCSSStyle.getSelectorSpecificity( rB.parsed );
> + switch ( rB.parsed.type ){
> + case (LzCSSStyle._sel_tag ):
> + case (LzCSSStyle._sel_star ):
> + rB.specificity = 1;
> + break;
> +
> + case (LzCSSStyle._sel_id ):
> + rB.specificity = 100;
> + break;
> +
> + case (LzCSSStyle._sel_attribute ):
> + rB.specificity = 10;
> + break;
> +
> + case (LzCSSStyle._sel_tagAndAttr ):
> + rB.specificity = 11;
> + break;
> + }
> + }
> +
> + //Debug.write( 'specificity for' , this ,
> this.specificity );
> + }
> + }
> +
> + var specificityA = rA.specificity;
> + var specificityB = rB.specificity;
> //Debug.write( rA, specificityA );
> //Debug.write( rB, specificityB );
>
>
> Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/
> LaszloView.lzs
> ===================================================================
> --- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/
> LaszloView.lzs 2007-08-13 23:51:55 UTC (rev 6041)
> +++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/
> LaszloView.lzs 2007-08-13 23:52:08 UTC (rev 6042)
> @@ -1082,17 +1082,21 @@
> * @param Boolean amVisible: boolean for visibility of view
> */
> function setVisible( amVisible ) {
> + if (this._visible == amVisible) return;
> + this._visible = amVisible;
> +
> // make us compatible with the new 'visibility' attribute
> if (amVisible) {
> - this.visibility = "visible";
> + var v = "visible";
> } else if (amVisible == null) {
> - this.visibility = "collapse";
> + var v = "collapse";
> if ($debug) {
> Debug.warn("setVisible(null) is deprecated, use
> setVisibility('collapse') instead");
> }
> } else {
> - this.visibility = "hidden";
> + var v = "hidden";
> }
> + this.visibility = v;
> //
> if (this.onvisibility.ready) this.onvisibility.sendEvent
> ( this.visibility );
>
> @@ -1112,6 +1116,7 @@
> * @param String amVisible: visibility of view
> */
> function setVisibility( amVisible ) {
> + if (this.visibility == amVisible) return;
> this.visibility = amVisible;
> if ($debug) {
> if (! (amVisible == "visible" || amVisible == "hidden" ||
> amVisible == "collapse")) {
> @@ -1984,7 +1989,7 @@
> }
>
> prototype.getMouse.dependencies = function( ) {
> - return [ LzGlobalMouse, "mousemove" ];
> + return [ LzIdle, "idle" ];
> }
>
> /**
>
>
> _______________________________________________
> Laszlo-checkins mailing list
> Laszlo-checkins at openlaszlo.org
> http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins
More information about the Laszlo-dev
mailing list