Author: ben
Date: 2007-09-14 14:01:53 -0700 (Fri, 14 Sep 2007)
New Revision: 6481

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 20070914-ben-X by [EMAIL PROTECTED] on 2007-09-14 13:38:35 PDT
    in /Users/ben/src/svn/openlaszlo/branches/legals-merge
    for http://svn.openlaszlo.org/openlaszlo/branches/legals

Summary: Backing out change 6464, DHTML inputtext text measurement

New Features:

Bugs Fixed:

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

Documentation:
This change backs out change r6464, which fixed LPP-4658 - 
DHTML inputtext is the incorrect height. We need to back
out this change to make the merge from wafflecone work
better. 

After the merge from wafflecone is complete, this change
can and should be re-applied. Watch out that it doesn't
break lzunit, though. 

Release Notes:

Details:
This change is just exactly this: 
$ svn merge -r6464:6463 .

Tests:
http://localhost:8080/legals-merge/test/lztest/lztest-textheight.lzx?lzr=dhtml&debug=true
now fails,
but smokecheck in dhtml still passes. 



Modified: 
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
===================================================================
--- 
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js    
    2007-09-14 20:42:00 UTC (rev 6480)
+++ 
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js    
    2007-09-14 21:01:53 UTC (rev 6481)
@@ -409,11 +409,3 @@
     if (testheight) this.text = '';
     return h;
 }
-
-LzInputTextSprite.prototype.getTextHeight = function () {
-    var h = this.getTextfieldHeight();
-    if (this.quirks.emulate_flash_font_metrics) {
-        h -= 4;
-    }    
-    return h;
-}

Modified: openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js 
2007-09-14 20:42:00 UTC (rev 6480)
+++ openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js 
2007-09-14 21:01:53 UTC (rev 6481)
@@ -226,7 +226,6 @@
     ,set_height_for_multiline_inputtext: false
     ,ie_offset_position_by_2: false
     ,ie_opacity: false
-    ,text_measurement_use_insertadjacenthtml: false
 }
 
 LzSprite.prototype.capabilities = {
@@ -289,9 +288,6 @@
                 // IE 7 offsets div positions by 2 px.  See LPP-4176. 
                 this.quirks['ie_offset_position_by_2'] = true;
             }
-
-            // text size measurement uses insertAdjacentHTML()
-            this.quirks['text_measurement_use_insertadjacenthtml'] = 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
@@ -653,7 +649,7 @@
   */
 LzSprite.prototype.__mouseEvent = function ( e ){
     if (!e) e = window.event;
-    if (LzKeyboardKernel && LzKeyboardKernel['__keyboardEvent']) 
LzKeyboardKernel.__keyboardEvent(e);
+    if (window['LzKeyboardKernel'] && 
window['LzKeyboardKernel'].__keyboardEvent) LzKeyboardKernel.__keyboardEvent(e);
     var skipevent = false;
     var eventname = 'on' + e.type;
     if (window['LzInputTextSprite'] && eventname == 'onmouseover' && 
LzInputTextSprite.prototype.__lastshown != null) 
LzInputTextSprite.prototype.__hideIfNotFocused();
@@ -673,7 +669,7 @@
     }
 
     //Debug.write('__mouseEvent', eventname, this.owner);
-    if (skipevent == false && this.owner.mouseevent && LzModeManager && 
LzModeManager['handleMouseButton']) LzModeManager.handleMouseButton(this.owner, 
eventname);
+    if (skipevent == false && this.owner.mouseevent) 
LzModeManager.handleMouseButton(this.owner, eventname);
 }
 
 // called by LzMouseKernel when mouse goes up on another sprite

Modified: 
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js     
2007-09-14 20:42:00 UTC (rev 6480)
+++ openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js     
2007-09-14 21:01:53 UTC (rev 6481)
@@ -240,6 +240,7 @@
     } else {
         var style = 'position: absolute';
         style += ';visibility: hidden';
+        style += ';top: 4000px';
         style += ';font-size: ' + this._fontSize;
         style += ';font-style: ' + this._fontStyle;
         style += ';font-weight: ' + this._fontWeight;
@@ -248,13 +249,13 @@
         if (this.multiline && ignorewidth != true) {
             if (this.width) style += ';width: ' + this.width + 'px';
         }
-        if (this.quirks['text_measurement_use_insertadjacenthtml']) {
+        if (document.all && document.body.insertAdjacentHTML) {
             if (this.__LzInputDiv != null) {
                 style += ';white-space: pre';
             } else {
                 style += ';white-space: ' + this._whiteSpace;
             }
-        } else {
+        }  else if (document.getElementById && document.createElement) {
             if (this.__LzInputDiv != null) {
                 style += ';white-space: pre';
             } else {
@@ -269,20 +270,10 @@
     if (this._sizecache.counter > this.__sizecacheupperbound) this._sizecache 
= {counter: 0};
     if (this._sizecache[style] == null) this._sizecache[style] = {};
 
-    var root = document.getElementById('lzTextSizeCache');
-
-    if (! root) {
-        root = document.createElement('div');
-        root.setAttribute('id', 'lzTextSizeCache');
-        root.setAttribute('style', 'top: 4000px;');
-        document.body.appendChild(root);
-    }
-
     var _textsizecache = this._sizecache[style];
     if (! _textsizecache[string]) {
-        var size = {};
-
-        if (this.quirks['text_measurement_use_insertadjacenthtml']) {
+        var dim = {};
+        if (document.all && document.body.insertAdjacentHTML) {
             if (this.multiline && string && 
this.quirks['inner_html_strips_newlines']) {
                 string = string.replace(this.inner_html_strips_newlines_re, 
'<br />');
             }
@@ -293,12 +284,12 @@
                 html += ' style="' + style + '">';
                 html += string;
                 html += '</' + tagname + '>';
-                root.insertAdjacentHTML('beforeEnd', html);
+                document.body.insertAdjacentHTML('beforeEnd', html);
 
                 mdiv = document.all['testSpan' + this._sizecache.counter];
                 _textsizecache[tagname] = mdiv;
             }
-        } else {
+        } else if (document.getElementById && document.createElement) {
             if (this.__LzInputDiv == null) {
                 if (this.multiline && string && 
this.quirks['inner_html_strips_newlines']) {
                     string = 
string.replace(this.inner_html_strips_newlines_re, '<br />');
@@ -309,7 +300,7 @@
             if (mdiv == null) {
                 mdiv = document.createElement(tagname);
                 mdiv.setAttribute('style', style);
-                root.appendChild(mdiv);
+                document.body.appendChild(mdiv);
                 _textsizecache[tagname] = mdiv;
             }
         } 
@@ -319,21 +310,21 @@
 
         mdiv.innerHTML = string;
         mdiv.style.display = 'block';
-        size.width = mdiv.offsetWidth;
-        size.height = mdiv.offsetHeight;
+        dim.width = mdiv.offsetWidth;
+        dim.height = mdiv.offsetHeight;
         mdiv.style.display = 'none';
 
         if (this.quirks.emulate_flash_font_metrics) {
             // Fix to make equivalent across swf and DHTML
-            size.height = Math.floor(size.height * 1.0000002) + 
(this.multiline ? 0 : this.__hpadding);
-            size.width = size.width + (this.multiline ? 0 : this.__wpadding);
+            dim.height = Math.floor(dim.height * 1.0000002) + (this.multiline 
? 0 : this.__hpadding);
+            dim.width = dim.width + (this.multiline ? 0 : this.__wpadding);
             if (this._whiteSpace == 'normal') {
                 if (this.multiline) {
-                    size.width += this.__wpadding;
+                    dim.width += this.__wpadding;
                 }
             }
         }    
-        _textsizecache[string] = size;
+        _textsizecache[string] = dim;
         this._sizecache.counter++;
     }
     return _textsizecache[string];


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

Reply via email to