Author: ptw
Date: 2008-01-03 09:57:35 -0800 (Thu, 03 Jan 2008)
New Revision: 7717
Modified:
openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs
openlaszlo/trunk/WEB-INF/lps/lfc/services/LzCSSStyle.js
Log:
Change 20080103-maxcarlson-H by [EMAIL PROTECTED] on 2008-01-03 00:01:55 PST
in /Users/maxcarlson/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Fix memory leaks for CSS-styled elements
New Features:
Bugs Fixed: LPP-5321 - Serious memory leak for CSS styled nodes
Technical Reviewer: ptw
QA Reviewer: mdemmon
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details: Attach style caches to the relevant nodes, instead of keeping global
copies. This way, they're destroyed along with the nodes.
Tests: See LPP-5321. /trunk/test/style/metasuite.lzx continues to pass.
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs 2008-01-03 17:38:11 UTC
(rev 7716)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs 2008-01-03 17:57:35 UTC
(rev 7717)
@@ -306,6 +306,10 @@
/** @access private */
var __LZUID = null;
/** @access private */
+var __LZPropertyCache = null;
+/** @access private */
+var __LZRuleCache = null;
+/** @access private */
var __LZdelegates = null;
/** @access private */
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/services/LzCSSStyle.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/services/LzCSSStyle.js 2008-01-03
17:38:11 UTC (rev 7716)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/services/LzCSSStyle.js 2008-01-03
17:57:35 UTC (rev 7717)
@@ -1,6 +1,6 @@
/**
*
- * @copyright Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved.
+ * @copyright Copyright 2001-2008 Laszlo Systems, Inc. All Rights Reserved.
* Use is subject to license terms.
*
* @affects lzcssstyle lzcssstylerule
@@ -80,11 +80,6 @@
return csssd;
}
-/** @access private */
-LzCSSStyle.__LZRuleCache = {};
-LzCSSStyle.__LZPropertyCache = {};
-
-
//LzCSSStyle.time1 = 0;
LzCSSStyle.getPropertyValueFor = function ( initialnode , pname ){
//Debug.warn("node: %w, pname: %w, rules: %w\n", node, pname, this._rules);
@@ -94,11 +89,14 @@
var node = initialnode;
while (node != canvas) {
- var uid = node.__LZUID;
- var val = this.__LZPropertyCache[uid + pname];
- if (val != null) return val;
+ if (! node.__LZPropertyCache) {
+ node.__LZPropertyCache = {};
+ } else {
+ var val = node.__LZPropertyCache[pname];
+ if (val != null) return val;
+ }
- var rules = this.__LZRuleCache[ uid ];
+ var rules = node.__LZRuleCache;
if ( !rules ) {
rules = new Array();
var r;
@@ -211,7 +209,7 @@
rules.sort(this.__compareSpecificity);
- this.__LZRuleCache[ uid ] = rules;
+ node.__LZRuleCache = rules;
}
//Debug.write("About to print rule array.")
@@ -223,7 +221,7 @@
var props = rules[i++].properties;
if (pname in props) {
val = props[pname];
- this.__LZPropertyCache[uid + pname] = val;
+ node.__LZPropertyCache[pname] = val;
break;
}
}
@@ -248,7 +246,7 @@
// Go through all the selectors in the selector, keeping a running
// count of various kinds of selectors:
/*
- count 1 if the selector is a ’style’ attribute rather than a selector,
+ count 1 if the selector is a `style` attribute rather than a selector,
0 otherwise (= a)
count the number of ID attributes in the selector (= b)
count the number of other attributes and pseudo-classes in the selector (=
c)
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins