[Laszlo-checkins] r9450 - openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml

max@openlaszlo.org max at openlaszlo.org
Tue Jun 3 18:32:38 PDT 2008


Author: max
Date: 2008-06-03 18:32:29 -0700 (Tue, 03 Jun 2008)
New Revision: 9450

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
Log:
Change 20080603-maxcarlson-T by maxcarlson at Roboto on 2008-06-03 14:15:49 PDT
    in /Users/maxcarlson/openlaszlo/trunk-clean
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Clean up DHTML image loading

Bugs Fixed: LPP-4910 - Images sometimes ignore view boundaries while loading in DHTML w/ latest trunk build 6836

Technical Reviewer: promanik
QA Reviewer: hminsky
Doc Reviewer: (pending)

Release Notes:

Details: Use __destroyImage() for image destruction to prevent DOM leakage.  Show images after load in __imgonload() if this was a setSource() call.  Hide images before load in __getImage().
    

Tests: Testcase for LPP-4910 now runs well in DHTML.  demos/lzpix/app.lzx?lzt=html&lzr=dhtml looks good.



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js	2008-06-04 00:16:51 UTC (rev 9449)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js	2008-06-04 01:32:29 UTC (rev 9450)
@@ -582,6 +582,7 @@
         if (this.__ImgPool) {
             this.__ImgPool.flush(this.resource);
         }
+        this.__destroyImage(null, this.__LZimg);
         this.__LZimg = null;
     }
 
@@ -1101,8 +1102,17 @@
         this.__imgtimoutid = null;
     }
     this.loading = false;
-    this.resourceWidth = (cacheHit && '__LZreswidth' in i ? i.__LZreswidth : i.width);
-    this.resourceHeight = (cacheHit && '__LZresheight' in i ? i.__LZresheight : i.height);
+    // show image div
+    if (! cacheHit) {
+        if (this.quirks.ie_alpha_image_loader) {
+            i._parent.style.display = '';
+        } else {
+            i.style.display = '';
+        }
+    }
+
+    this.resourceWidth = (cacheHit && i['__LZreswidth']) ? i.__LZreswidth : i.width;
+    this.resourceHeight = (cacheHit && i['__LZresheight']) ? i.__LZresheight : i.height;
     
     if (!cacheHit) {
         if (this.quirks.invisible_parent_image_sizing_fix && this.resourceWidth == 0) {
@@ -1294,6 +1304,8 @@
             this.owner.__imgtimoutid = setTimeout(callback, canvas.medialoadtimeout);
             im.sizer.src = url;
         }
+        // show again in onload
+        if (! skiploader) im.style.display = 'none'
         if (this.owner.stretches) {
             im.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + url + "',sizingMethod='scale')";
         } else {
@@ -1302,6 +1314,8 @@
     } else {
         var im = document.createElement('img');
         im.className = 'lzdiv';
+        // show again in onload
+        if (! skiploader) im.style.display = 'none'
         if (this.owner && skiploader != true) {
             //Debug.info('sizer', skiploader == true, skiploader != true, skiploader);
             im.owner = this.owner;
@@ -1754,8 +1768,10 @@
         this.__ImgPool.destroy();
         this.__ImgPool = null;
     }
-    if (this.__LZimg) this.__discardElement(this.__LZimg);
-    this.__LZimg = null;
+    if (this.__LZimg) {
+        this.__destroyImage(null, this.__LZimg);
+        this.__LZimg = null;
+    }
 }
 
 /**



More information about the Laszlo-checkins mailing list