[Laszlo-checkins] r13858 - openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml
bargull@openlaszlo.org
bargull at openlaszlo.org
Mon May 11 05:56:58 PDT 2009
Author: bargull
Date: 2009-05-11 05:56:55 -0700 (Mon, 11 May 2009)
New Revision: 13858
Modified:
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
Log:
Change 20090511-bargull-3V1 by bargull at dell--p4--2-53 on 2009-05-11 10:48:26
in /home/Admin/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: size-cache bug in DHTML
New Features:
Bugs Fixed: LPP-8180 (DHTML: sizecache doesn't get cleared)
Technical Reviewer: ptw
QA Reviewer: max
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
Also update the size-cache on the LzTextSprite.prototype object.
Tests:
see bugreport
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js 2009-05-11 12:53:57 UTC (rev 13857)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js 2009-05-11 12:56:55 UTC (rev 13858)
@@ -388,8 +388,6 @@
var string = this.text;
// Ignore the width if we are measuring width, or lineheight
var width = 'auto';
- var scrolldiv = this.scrolldiv;
- var sds = scrolldiv.style;
switch (dimension) {
case 'lineheight':
// no need to measure if we've set the lineHeight directly...
@@ -413,6 +411,7 @@
// NOTE: Quick check inlined at getTextWidth, getLineHeight,
// getTextfieldHeight
////
+ var scrolldiv = this.scrolldiv;
var className = scrolldiv.className;
var style = scrolldiv.style.cssText;
var styleKey = className + "/" + style;
@@ -433,6 +432,7 @@
// Now create a cache key limited to the styles that can affect the
// height/width
// Turn off `overflow: scroll; width: 100%; height:100%` so that does not interfere with measurements
+ var sds = scrolldiv.style;
style = ("overflow: visible; width: " + width + "; height: auto; " +
((sds.fontSize) ? ("font-size: " + sds.fontSize + "; ") : "") +
((sds.fontWeight) ? ("font-weight: " + sds.fontWeight + "; ") : "") +
@@ -453,10 +453,10 @@
// Otherwise, compute from scratch
var root = document.getElementById('lzTextSizeCache');
if ((_sizecache.counter > 0) && ((_sizecache.counter % this.__sizecacheupperbound) == 0)) {
- _sizecache = {counter: 0};
+ ltsp._sizecache = _sizecache = {counter: 0};
cv = null;
if (LzSprite.prototype.quirks.ie_leak_prevention) {
- LzTextSprite.prototype.__cleanupdivs();
+ ltsp.__cleanupdivs();
}
if (root) { root.innerHTML = ''; }
}
@@ -484,13 +484,13 @@
} else {
// create new div
if (this.quirks['text_measurement_use_insertadjacenthtml']) {
- var html = '<' + tagname + ' id="testSpan' + ltsp._sizecache.counter + '"';
+ var html = '<' + tagname + ' id="testSpan' + _sizecache.counter + '"';
html += ' class="' + className + '"';
html += ' style="' + style + '">';
html += string;
html += '</' + tagname + '>';
root.insertAdjacentHTML('beforeEnd', html);
- var mdiv = document.all['testSpan' + ltsp._sizecache.counter];
+ var mdiv = document.all['testSpan' + _sizecache.counter];
if (this.quirks.ie_leak_prevention) {
ltsp.__divstocleanup.push(mdiv);
}
@@ -510,7 +510,7 @@
// NOTE: clientHeight for both height and lineheight
cv[dimension] = (dimension == 'width') ? mdiv.clientWidth : mdiv.clientHeight;
mdiv.style.display = 'none';
- LzTextSprite.prototype._sizecache.counter++;
+ _sizecache.counter++;
// Debug.debug("%w %w %d", this, cacheFullKey, lineHeight);
return cv[dimension];
}
More information about the Laszlo-checkins
mailing list