Author: pbr
Date: 2008-02-14 19:24:39 -0800 (Thu, 14 Feb 2008)
New Revision: 8034
Modified:
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
Log:
Change 20080214-Philip-4 by [EMAIL PROTECTED] on 2008-02-14 08:54:44 EST
in /cygdrive/f/laszlo/svn/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Access text cache as LzTextSprite.prototype._sizecache
New Features:
Bugs Fixed: LPP-5390
Technical Reviewer: max
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
The code used to access the global cache through 'this'. However, once the cache
is full and is cleared, access through 'this' it not reliable. I changed
this._ sizecache to LzTextSprite.prototype._sizecache. Although I only need to
do this for the line that actually resets the cache, I changed all references
to make it
clear this is a global.
Tests:
See test in LPP-5390. This is slow to run since you need to wait until the
_size cache.counter reaches 1000. During testing I set the cache size to 100
(ie. LzTe xtSprite.prototype.__sizecacheupperbound = 100) to verify the bug and
the fix.
Files:
M WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20080214-Philip-4.tar
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
2008-02-15 03:18:15 UTC (rev 8033)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
2008-02-15 03:24:39 UTC (rev 8034)
@@ -271,13 +271,13 @@
// Empty the cache when full, but do not reset the counter because
// IE holds onto the object.
- if (this._sizecache.counter > 0 && this._sizecache.counter %
this.__sizecacheupperbound == 0) {
- this._sizecache = {counter: this._sizecache.counter};
+ if (LzTextSprite.prototype._sizecache.counter > 0 &&
LzTextSprite.prototype._sizecache.counter %
LzTextSprite.prototype.__sizecacheupperbound == 0) {
+ LzTextSprite.prototype._sizecache = {counter:
LzTextSprite.prototype._sizecache.counter};
if (root) {
root.innerHTML = '';
}
}
- if (this._sizecache[style] == null) this._sizecache[style] = {};
+ if (LzTextSprite.prototype._sizecache[style] == null)
LzTextSprite.prototype._sizecache[style] = {};
if (! root) {
root = document.createElement('div');
@@ -286,7 +286,7 @@
document.body.appendChild(root);
}
- var _textsizecache = this._sizecache[style];
+ var _textsizecache = LzTextSprite.prototype._sizecache[style];
if (! _textsizecache[string]) {
var size = {};
@@ -297,13 +297,13 @@
var tagname = 'span';
var mdiv = _textsizecache['lzdiv~~~' + tagname];
if (mdiv == null) {
- var html = '<' + tagname + ' id="testSpan' +
this._sizecache.counter + '"';
+ var html = '<' + tagname + ' id="testSpan' +
LzTextSprite.prototype._sizecache.counter + '"';
html += ' style="' + style + '">';
html += string;
html += '</' + tagname + '>';
root.insertAdjacentHTML('beforeEnd', html);
- mdiv = document.all['testSpan' + this._sizecache.counter];
+ mdiv = document.all['testSpan' +
LzTextSprite.prototype._sizecache.counter];
_textsizecache['lzdiv~~~' + tagname] = mdiv;
}
} else {
@@ -342,7 +342,7 @@
}
}
_textsizecache[string] = size;
- this._sizecache.counter++;
+ LzTextSprite.prototype._sizecache.counter++;
}
return _textsizecache[string];
}
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins