Author: max
Date: 2007-06-15 20:21:28 -0700 (Fri, 15 Jun 2007)
New Revision: 5440

Modified:
   openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
   openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
   openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
Log:
Change 20070615-maxcarlson-8 by [EMAIL PROTECTED] on 2007-06-15 15:57:12 PDT
    in /Users/maxcarlson/openlaszlo/legals-clean
    for http://svn.openlaszlo.org/openlaszlo/branches/legals

Summary: Fix vacation-survey example in IE DHTML while still allowing negative 
CSS values

New Features:

Bugs Fixed: LPP-3880 - IE/dhtml: vacation survey crashes when run

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

Documentation:

Release Notes:

Details: LzSprite.js - Move quirks setting code from global scope to the 
__updateQuirks() method.  Remove bad test from CSSDimension().

LzTextSprite.js - Prevent negative values for text clipping in 
setWidth/Height().  Add more robust argument checking from 
LzSprite.setWidth/Height().

LzInputTextSprite.js - Add more robust argument checking from 
LzSprite.setWidth/Height().

    

Tests: lztest-textheight.lzx and lztest-view.lzx in DHTML and SWF are 
consistent with previous behavior.  vacation survey runs in IE DHTML.



Modified: 
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
===================================================================
--- 
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js    
    2007-06-16 00:38:31 UTC (rev 5439)
+++ 
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js    
    2007-06-16 03:21:28 UTC (rev 5440)
@@ -293,6 +293,7 @@
 }
 
 LzInputTextSprite.prototype.setWidth = function (w) {
+    if (w == null || w < 0 || isNaN(w) || this.width == w) return;
     // call LzSprite.setWidth();
     this.__setWidth(w - this.____wpadding);
     if (this.quirks.fix_clickable) {
@@ -303,6 +304,7 @@
 }
 
 LzInputTextSprite.prototype.setHeight = function (h) {
+    if (h == null || h < 0 || isNaN(h) || this.height == h) return;
     // call LzSprite.setHeight();
     this.__setHeight(h);
     if (this.quirks.fix_clickable) {

Modified: openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js 
2007-06-16 00:38:31 UTC (rev 5439)
+++ openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js 
2007-06-16 03:21:28 UTC (rev 5440)
@@ -219,92 +219,94 @@
     ,htmlinputtext: false
 }
 
-if (window['Lz'] && Lz.__BrowserDetect) {
-    Lz.__BrowserDetect.init();
-    if (LzSprite.prototype.quirks['inner_html_strips_newlines'] == true) {
-        LzSprite.prototype.inner_html_strips_newlines_re = RegExp('$', 'mg');
-    }
+LzSprite.prototype.__updateQuirks = function(){
+    if (window['Lz'] && Lz.__BrowserDetect) {
+        Lz.__BrowserDetect.init();
+        if (this.quirks['inner_html_strips_newlines'] == true) {
+            LzSprite.prototype.inner_html_strips_newlines_re = RegExp('$', 
'mg');
+        }
 
-    // Divs intercept clicks if physically placed on top of an element
-    // that's not a parent. See LPP-2680.
-    // off for now
-    //LzSprite.prototype.quirks['fix_clickable'] = true;
-    if (Lz.__BrowserDetect.isIE) {
-        // Provide IE PNG/opacity support
-        LzSprite.prototype.quirks['ie_alpha_image_loader'] = true;
+        // Divs intercept clicks if physically placed on top of an element
+        // that's not a parent. See LPP-2680.
+        // off for now
+        //this.quirks['fix_clickable'] = true;
+        if (Lz.__BrowserDetect.isIE) {
+            // Provide IE PNG/opacity support
+            this.quirks['ie_alpha_image_loader'] = true;
 
-        // IE DOM leak prevention
-        LzSprite.prototype.quirks['ie_leak_prevention'] = true;
+            // IE DOM leak prevention
+            this.quirks['ie_leak_prevention'] = true;
 
-        // Use images to force click tree to work in IE
-        LzSprite.prototype.quirks['fix_ie_clickable'] = true;
+            // Use images to force click tree to work in IE
+            this.quirks['fix_ie_clickable'] = true;
 
-        // workaround for IE refusing to respect divs with small heights when
-        // no image is attached
-        LzSprite.prototype.quirks['fix_ie_background_height'] = true;
+            // workaround for IE refusing to respect divs with small heights 
when
+            // no image is attached
+            this.quirks['fix_ie_background_height'] = true;
 
-        // workaround for IE not supporting &apos; in innerHTML
-        LzSprite.prototype.quirks['inner_html_no_entity_apos'] = true;
+            // workaround for IE not supporting &apos; in innerHTML
+            this.quirks['inner_html_no_entity_apos'] = true;
 
-        // workaround for IE not supporting clip in divs containing inputtext
-        LzSprite.prototype.quirks['inputtext_parents_cannot_contain_clip'] = 
true;
+            // workaround for IE not supporting clip in divs containing 
inputtext
+            this.quirks['inputtext_parents_cannot_contain_clip'] = true;
 
-        // flag for components (basefocusview for now) to minimize opacity 
changes
-        LzSprite.prototype.quirks['minimize_opacity_changes'] = true;
+            // flag for components (basefocusview for now) to minimize opacity 
changes
+            this.quirks['minimize_opacity_changes'] = true;
 
-        // multiline inputtext height must be set directly - height: 100% does 
not work.  See LPP-4119
-        LzSprite.prototype.quirks['set_height_for_multiline_inputtext'] = true;
-    } else if (Lz.__BrowserDetect.isSafari) {
-        // Fix bug in where if any parent of an image is hidden the size is 0
-        // TODO: Tucker claims this is fixed in the latest version of webkit
-        LzSprite.prototype.quirks['invisible_parent_image_sizing_fix'] = true;
+            // multiline inputtext height must be set directly - height: 100% 
does not work.  See LPP-4119
+            this.quirks['set_height_for_multiline_inputtext'] = true;
+        } else if (Lz.__BrowserDetect.isSafari) {
+            // Fix bug in where if any parent of an image is hidden the size 
is 0
+            // TODO: Tucker claims this is fixed in the latest version of 
webkit
+            this.quirks['invisible_parent_image_sizing_fix'] = true;
 
-        // Remap alt/option key also sends control since control-click shows 
context menu (see LPP-2584 - Lzpix: problem with multi-selecting images in 
Safari 2.0.4, dhtml)
-        LzSprite.prototype.quirks['alt_key_sends_control'] = true;
+            // Remap alt/option key also sends control since control-click 
shows context menu (see LPP-2584 - Lzpix: problem with multi-selecting images 
in Safari 2.0.4, dhtml)
+            this.quirks['alt_key_sends_control'] = true;
 
-        // Safari scrollHeight needs to subtract scrollbar height
-        LzSprite.prototype.quirks['safari_textarea_subtract_scrollbar_height'] 
= true;
+            // Safari scrollHeight needs to subtract scrollbar height
+            this.quirks['safari_textarea_subtract_scrollbar_height'] = true;
 
-        // Safari doesn't like clipped or placed input text fields.
-        LzSprite.prototype.quirks['safari_avoid_clip_position_input_text'] = 
true;
-        // Safari won't show canvas tags whose parent is display: none
-        LzSprite.prototype.quirks['safari_visibility_instead_of_display'] = 
true;
-        LzSprite.prototype.quirks['absolute_position_accounts_for_offset'] = 
true;
-        LzSprite.prototype.quirks['canvas_div_cannot_be_clipped'] = true;
-    } else if (Lz.__BrowserDetect.isOpera) {
-        // Fix bug in where if any parent of an image is hidden the size is 0
-        LzSprite.prototype.quirks['invisible_parent_image_sizing_fix'] = true;
-        // reverse mouse wheel
-        LzSprite.prototype.quirks['reverse_mouse_wheel'] = true;
-        LzSprite.prototype.quirks['no_cursor_colresize'] = true;
-        LzSprite.prototype.quirks['absolute_position_accounts_for_offset'] = 
true;
-        LzSprite.prototype.quirks['canvas_div_cannot_be_clipped'] = true;
-    } else if (Lz.__BrowserDetect.isFirefox && Lz.__BrowserDetect.version < 2) 
{
-        // see 
http://groups.google.ca/group/netscape.public.mozilla.dom/browse_thread/thread/821271ca11a1bdbf/46c87b49c026246f?lnk=st&q=+focus+nsIAutoCompletePopup+selectedIndex&rnum=1
-        LzSprite.prototype.quirks['firefox_autocomplete_bug'] = true;
+            // Safari doesn't like clipped or placed input text fields.
+            this.quirks['safari_avoid_clip_position_input_text'] = true;
+            // Safari won't show canvas tags whose parent is display: none
+            this.quirks['safari_visibility_instead_of_display'] = true;
+            this.quirks['absolute_position_accounts_for_offset'] = true;
+            this.quirks['canvas_div_cannot_be_clipped'] = true;
+        } else if (Lz.__BrowserDetect.isOpera) {
+            // Fix bug in where if any parent of an image is hidden the size 
is 0
+            this.quirks['invisible_parent_image_sizing_fix'] = true;
+            // reverse mouse wheel
+            this.quirks['reverse_mouse_wheel'] = true;
+            this.quirks['no_cursor_colresize'] = true;
+            this.quirks['absolute_position_accounts_for_offset'] = true;
+            this.quirks['canvas_div_cannot_be_clipped'] = true;
+        } else if (Lz.__BrowserDetect.isFirefox && Lz.__BrowserDetect.version 
< 2) {
+            // see 
http://groups.google.ca/group/netscape.public.mozilla.dom/browse_thread/thread/821271ca11a1bdbf/46c87b49c026246f?lnk=st&q=+focus+nsIAutoCompletePopup+selectedIndex&rnum=1
+            this.quirks['firefox_autocomplete_bug'] = true;
+        }
     }
-}
 
-if (LzSprite.prototype.quirks['safari_avoid_clip_position_input_text']) {
-    LzSprite.prototype.__defaultStyles.lzswfinputtext.marginTop = '-2px';
-    LzSprite.prototype.__defaultStyles.lzswfinputtext.marginLeft = '-2px';
-    LzSprite.prototype.__defaultStyles.lzswfinputtextmultiline.marginTop = 
'-2px';
-    LzSprite.prototype.__defaultStyles.lzswfinputtextmultiline.marginLeft = 
'-2px';
-}
+    if (this.quirks['safari_avoid_clip_position_input_text']) {
+        LzSprite.prototype.__defaultStyles.lzswfinputtext.marginTop = '-2px';
+        LzSprite.prototype.__defaultStyles.lzswfinputtext.marginLeft = '-2px';
+        LzSprite.prototype.__defaultStyles.lzswfinputtextmultiline.marginTop = 
'-2px';
+        LzSprite.prototype.__defaultStyles.lzswfinputtextmultiline.marginLeft 
= '-2px';
+    }
 
-if (LzSprite.prototype.quirks['css_hide_canvas_during_init']) {
-    if (LzSprite.prototype.quirks['safari_visibility_instead_of_display']) {
-        LzSprite.prototype.__defaultStyles.lzcanvasdiv.visibility = 'hidden';
-    } else {
-        LzSprite.prototype.__defaultStyles.lzcanvasdiv.display = 'none';
+    if (this.quirks['css_hide_canvas_during_init']) {
+        if (this.quirks['safari_visibility_instead_of_display']) {
+            LzSprite.prototype.__defaultStyles.lzcanvasdiv.visibility = 
'hidden';
+        } else {
+            LzSprite.prototype.__defaultStyles.lzcanvasdiv.display = 'none';
+        }
+        LzSprite.prototype.__defaultStyles.lzcanvasclickdiv.display = 'none';
     }
-    LzSprite.prototype.__defaultStyles.lzcanvasclickdiv.display = 'none';
-}
 
-if (LzSprite.prototype.quirks['hand_pointer_for_clickable']) {
-    LzSprite.prototype.__defaultStyles.lzclickdiv.cursor = 'pointer';
+    if (this.quirks['hand_pointer_for_clickable']) {
+        LzSprite.prototype.__defaultStyles.lzclickdiv.cursor = 'pointer';
+    }
 }
-
+LzSprite.prototype.__updateQuirks();
 LzSprite.prototype.__defaultStyles.writeCSS();
 
 /**
@@ -446,7 +448,6 @@
 }
 
 LzSprite.prototype.CSSDimension = function (value, units) {
-    if (value < 0) value = 0; 
     return Math.floor(value) + (units ? units : 'px');
 }
 

Modified: 
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js     
2007-06-16 00:38:31 UTC (rev 5439)
+++ openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js     
2007-06-16 03:21:28 UTC (rev 5440)
@@ -397,22 +397,20 @@
 
 LzTextSprite.prototype.__setWidth = LzSprite.prototype.setWidth;
 LzTextSprite.prototype.setWidth = function (w){
-    if (w > 0) {
-        var wp = this.CSSDimension(w - this.__wpadding);
-        this.__LZtextdiv.style.width = wp;
-        this.__LZtextdiv.style.clip = 'rect(0px ' + wp + ' ' + 
this.CSSDimension(this.height - this.__hpadding) + ' 0px)';
-    }
+    if (w == null || w < 0 || isNaN(w) || this.width == w) return;
+    var wp = this.CSSDimension(w >= this.__wpadding ? w - this.__wpadding : 0);
+    this.__LZtextdiv.style.width = wp;
+    this.__LZtextdiv.style.clip = 'rect(0px ' + wp + ' ' + 
this.CSSDimension(this.height >= this.__hpadding ? this.height - 
this.__hpadding : 0) + ' 0px)';
     this.__setWidth(w);
     this._styledirty = true;
 }
 
 LzTextSprite.prototype.__setHeight = LzSprite.prototype.setHeight;
 LzTextSprite.prototype.setHeight = function (h){
-    if (h > 0) {
-        var hp = this.CSSDimension(h - this.__hpadding);
-        this.__LZtextdiv.style.height = hp;
-        this.__LZtextdiv.style.clip = 'rect(0px ' + 
this.CSSDimension(this.width - this.__wpadding) + ' ' + hp + ' 0px)';
-    }
+    if (h == null || h < 0 || isNaN(h) || this.height == h) return;
+    var hp = this.CSSDimension(h >= this.__hpadding ? h - this.__hpadding : 0);
+    this.__LZtextdiv.style.height = hp;
+    this.__LZtextdiv.style.clip = 'rect(0px ' + this.CSSDimension(this.width 
>= this.__wpadding ? this.width - this.__wpadding : 0) + ' ' + hp + ' 0px)';
     this.__setHeight(h);
     if (this.multiline) this._styledirty = true;
 }


_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Reply via email to