[Laszlo-checkins] r14291 - in openlaszlo/branches/4.4: . WEB-INF/lps/lfc/kernel/dhtml test

ptw@openlaszlo.org ptw at openlaszlo.org
Wed Jul 8 10:51:20 PDT 2009


Author: ptw
Date: 2009-07-08 10:51:15 -0700 (Wed, 08 Jul 2009)
New Revision: 14291

Added:
   openlaszlo/branches/4.4/test/testIframeLinks/
Modified:
   openlaszlo/branches/4.4/
   openlaszlo/branches/4.4/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
   openlaszlo/branches/4.4/WEB-INF/lps/lfc/kernel/dhtml/LzMouseKernel.js
   openlaszlo/branches/4.4/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
Log:
Merged revisions 14183,14185-14188,14190-14191,14195-14199,14201-14206,14210-14215,14218,14220-14225,14227-14228,14230-14234,14236,14238-14261,14264-14265,14267-14268,14270-14272,14274-14282,14284-14290 via svnmerge from 
http://svn.openlaszlo.org/openlaszlo/trunk

.......
  r14183 | hqm | 2009-06-17 21:10:16 -0400 (Wed, 17 Jun 2009) | 39 lines
  
  Change 20090617-hqm-c by hqm at badtzmaru.home on 2009-06-17 14:39:12 EDT
      in /Users/hqm/openlaszlo/trunk5
      for http://svn.openlaszlo.org/openlaszlo/trunk
  
  Summary: further fixes for text selection in DHTML
  
  New Features:
  
  Bugs Fixed: LPP-8252
  
  Technical Reviewer: andre
  QA Reviewer: max
  Doc Reviewer: (pending)
  
  Documentation:
  
  Release Notes:
  
  Details:
  
  + fix for getSelectedText to return proper string value 
  
  + conditionalized binding of document.onselectstart to custom function for IE
      
  Tests:
  
  + first test case in bug report
     Open the component sample application [2], mouse down in upper left corner and move cursor to lower right corner.
     Expected: no selection on <img> elements
     Actual: Firefox/Safari shows selection
     Fix: apply changes for "getSelectedText()" as described above 
  
  + second test case in bug report
     Also open the component sampler, mouse down and then move cursor while still holding the mouse button.
     Expected: no text selection
     Actual: text selection for all text elements 
.......
  r14290 | hqm | 2009-07-08 07:51:58 -0400 (Wed, 08 Jul 2009) | 35 lines
  
  Change 20090706-hqm-L by hqm at badtzmaru.home on 2009-07-06 10:51:16 EDT
      in /Users/hqm/openlaszlo/trunk-diamond
      for http://svn.openlaszlo.org/openlaszlo/trunk
  
  Summary: 
  
  New Features:
  
  Bugs Fixed: LPP-8303, LPP-8306
  
  Technical Reviewer: max
  QA Reviewer: ptw
  Doc Reviewer: (pending)
  
  Documentation:
  
  Release Notes:
  
  Details:
      
  + make the conditional code which prevents excessive object selection
  for IE into a real quirk, quirks.prevent_selection, in all the places
  it is called, instead of a conditional on the presence of 'IE' browser
  
  + Do not cancel the default browser behavior for mouse clicks, just cancel
  bubbling.
  
  
  Tests:
  
  + see testcase test/testIframeLinks/select.jsp
  + smokecheck dhtml
  + examples/components/component_sampler.lzx
.......



Property changes on: openlaszlo/branches/4.4
___________________________________________________________________
Name: svnmerge-integrated
   - /openlaszlo/branches/4.1:1-10153 /openlaszlo/branches/4.2:1-12154,12181,13205,13778 /openlaszlo/branches/devildog:1-8432 /openlaszlo/branches/pagan-deities:1-7955,8825,10756-10920,10922-10928,10930-10935,11151,11207,11554,13476,13629 /openlaszlo/branches/paperpie:1-6504,6506-6574,6576-7135,7137-7235 /openlaszlo/branches/wafflecone:1-5746,5818-6068,6070-6205,6207-6213,6216-6265,6267-6368,6370-6431,6433-6450,6497,6509,6661,7097,7872 /openlaszlo/trunk:1-13938,13940-13945,13947-13952,13954-13968,13970,13972-13980,13982-13985,13987-14015,14017-14032,14034,14036-14069,14071-14109,14116,14124,14127,14129,14146-14156,14159,14165,14167-14171,14173-14182,14184-14206,14210-14215,14217-14273,14283
   + /openlaszlo/branches/4.1:1-10153 /openlaszlo/branches/4.2:1-12154,12181,13205,13778 /openlaszlo/branches/devildog:1-8432 /openlaszlo/branches/pagan-deities:1-7955,8825,10756-10920,10922-10928,10930-10935,11151,11207,11554,13476,13629 /openlaszlo/branches/paperpie:1-6504,6506-6574,6576-7135,7137-7235 /openlaszlo/branches/wafflecone:1-5746,5818-6068,6070-6205,6207-6213,6216-6265,6267-6368,6370-6431,6433-6450,6497,6509,6661,7097,7872 /openlaszlo/trunk:1-13938,13940-13945,13947-13952,13954-13968,13970,13972-13980,13982-13985,13987-14015,14017-14032,14034,14036-14069,14071-14109,14116,14124,14127,14129,14146-14156,14159,14165,14167-14171,14173-14206,14210-14215,14217-14290

Modified: openlaszlo/branches/4.4/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
===================================================================
--- openlaszlo/branches/4.4/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js	2009-07-08 11:51:58 UTC (rev 14290)
+++ openlaszlo/branches/4.4/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js	2009-07-08 17:51:15 UTC (rev 14291)
@@ -265,7 +265,7 @@
     //Debug.warn('__show', this.owner);
     // turn on text selection in IE
     // can't use lz.embed.attachEventHandler because we need to cancel events selectively
-    if (lz.embed.browser.isIE) {
+    if (LzSprite.prototype.quirks.prevent_selection) {
         //this.__LZdiv.onselectstart = null;
         this.__LZdiv.onselectstart = null;
     }
@@ -368,7 +368,7 @@
     // turn off text selection in IE
     // can't use lz.embed.attachEventHandler because we need to cancel events selectively
     if (LzInputTextSprite.prototype.__lastshown == null) {
-        if (lz.embed.browser.isIE) {
+        if (LzSprite.prototype.quirks.prevent_selection) {
             this.__LZdiv.onselectstart = LzTextSprite.prototype.__cancelhandler
         }
     }
@@ -1123,3 +1123,21 @@
     }
 }
 
+// prevent text selection in IE
+// can't use lz.embed.attachEventHandler because we need to cancel events
+
+if (LzSprite.prototype.quirks.prevent_selection) {
+    document.onselectstart = function () {
+        var src = window.event.srcElement;
+        if (src.owner instanceof LzTextSprite) {
+            if (! src.owner.selectable) {
+                //Debug.write("prevent selection on non-selectable text")
+                return false;
+            }
+        } else {
+            //Debug.write("prevent selection on non-text")
+            return false;
+        }
+    }
+}
+

Modified: openlaszlo/branches/4.4/WEB-INF/lps/lfc/kernel/dhtml/LzMouseKernel.js
===================================================================
--- openlaszlo/branches/4.4/WEB-INF/lps/lfc/kernel/dhtml/LzMouseKernel.js	2009-07-08 11:51:58 UTC (rev 14290)
+++ openlaszlo/branches/4.4/WEB-INF/lps/lfc/kernel/dhtml/LzMouseKernel.js	2009-07-08 17:51:15 UTC (rev 14291)
@@ -32,8 +32,6 @@
             LzKeyboardKernel.__updateControlKeys(e);
         }
 
-        // check source.owner of event, see if textfield and selectable, then don't cancel event
-
         var lzinputproto = window['LzInputTextSprite'] && LzInputTextSprite.prototype;
         if (lzinputproto && lzinputproto.__lastshown != null) {
             if (LzSprite.prototype.quirks.fix_ie_clickable) {

Modified: openlaszlo/branches/4.4/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
===================================================================
--- openlaszlo/branches/4.4/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js	2009-07-08 11:51:58 UTC (rev 14290)
+++ openlaszlo/branches/4.4/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js	2009-07-08 17:51:15 UTC (rev 14291)
@@ -101,7 +101,7 @@
             div.mouseisover = false;
             div.onmouseover = function(e) {
                 if (LzSprite.prototype.quirks.focus_on_mouseover) {
-                    if (LzSprite.prototype.getSelectedText() == null) {
+                    if (LzSprite.prototype.getSelectedText() != "") {
                         div.focus();
                     }
                 }
@@ -146,7 +146,7 @@
                     }
                     if (quirks.focus_on_mouseover) {
                         if (LzInputTextSprite.prototype.__lastshown == null) {
-                            if (LzSprite.prototype.getSelectedText() == null) {
+                            if (LzSprite.prototype.getSelectedText() == "") {
                                 div.focus();
                             }
                         }
@@ -158,7 +158,7 @@
                 } else {
                     if (quirks.focus_on_mouseover) {
                         if (LzInputTextSprite.prototype.__lastshown == null) {
-                            if (LzSprite.prototype.getSelectedText() == null) {
+                            if (LzSprite.prototype.getSelectedText() == "") {
                                 div.blur();
                             }
                         }
@@ -476,6 +476,7 @@
     ,fix_ie_clickable: false
     ,ie_alpha_image_loader: false
     ,ie_leak_prevention: false
+    ,prevent_selection: false
     ,ie_elementfrompoint: false
     ,invisible_parent_image_sizing_fix: false
     ,emulate_flash_font_metrics: true
@@ -574,6 +575,7 @@
                 // prevent duplicate image loads - see http://support.microsoft.com/?scid=kb;en-us;823727&spid=2073&sid=global and http://misterpixel.blogspot.com/2006/09/forensic-analysis-of-ie6.html
                 quirks['ie6_improve_memory_performance'] = true;
             } else {
+                quirks['prevent_selection'] = true;
                 quirks['invisible_parent_image_sizing_fix'] = true;
                 if (browser.osversion >= 6) {
                     // IE7 on Vista (osversion=6) needs the alpha image loader
@@ -1193,6 +1195,7 @@
 LzSprite.prototype.__clickDispatcher = function(e) {
     // capture events in IE
     if (!e) e = window.event;
+
     this.owner.__mouseEvent(e);
     return false;
 }
@@ -1210,10 +1213,8 @@
         if (LzKeyboardKernel && LzKeyboardKernel['__updateControlKeys']) {
             LzKeyboardKernel.__updateControlKeys(e);
 
-            // FIXME: [20090602 anba] this prevents text selection, see LPP-8200
             if (LzKeyboardKernel.__cancelKeys && e.keyCode == 0) {
-                e.cancelBubble = true;
-                e.returnValue = false;
+                  e.cancelBubble = true;
             }
         }
     }
@@ -1246,7 +1247,6 @@
         e.cancelBubble = true;
         this.__mouseisdown = true;
         LzMouseKernel.__lastMouseDown = this;
-
     } else if (eventname == 'onmouseup') {
         e.cancelBubble = false;
         // only send the event if this is same sprite the mouse button went down on
@@ -2392,9 +2392,9 @@
 LzSprite.prototype.getSelectedText = function () {
     var txt = '';
     if (window.getSelection) { // FF/Safari/Opera/Chrome
-        return window.getSelection();
+        return window.getSelection().toString();
     } else if (document.selection) { // IE7
-        return document.selection.createRange().text;
+        return document.selection.createRange().text.toString();
     } else if (document.getSelection) { // others
         return document.getSelection();
     } else {
@@ -2472,6 +2472,7 @@
 LzSprite.prototype.aafocus = function( ){
     try {
         if  (this.__LZdiv != null) {
+            this.__LZdiv.blur();
             this.__LZdiv.focus();
         }
     } catch (e) {

Copied: openlaszlo/branches/4.4/test/testIframeLinks (from rev 14290, openlaszlo/trunk/test/testIframeLinks)



More information about the Laszlo-checkins mailing list