I have a couple of comments:

o Should we be browser-switching in getSelectedText, rather than probing for functions? If we do probe for functions, are we doing it in the right order (which to me would be: 1) DOM2 Standard, 2) IE, 3) Firefox, 4) etc.

o Similarly, should we use browser-switching to insert the appropriate browser-specific CSS, rather than just shoving them all in there? I can imagine there might be a performance penalty for stray styles, or even a confusion if a browser tries to emulate another.

o I'm confused as to why we have both Khtml- and Webkit- specific styles. I thought Webkit was the new Khtml? Is there still a Khtml browser that is not Webkit?

o Can you put a comment where you removed "// FIXME: [20090602 anba]", explaining what is being done, so future generations will not be mystified? (e.g., "We have handled the event, so we stop propagation to outer divs, but, we still want the browser default action (e.g., select in an input text) to occur, so we _don't_ return false.") Even better, to my mind, would be to use the actual DOM2 interface to the event and call `.stopPropagation()`, but not `.preventDefault()`.

On 2009-06-03, at 22:56EDT, Henry Minsky wrote:

Change 20090603-hqm-U by [email protected] on 2009-06-03 22:27:28 EDT
   in /Users/hqm/openlaszlo/trunk5
   for http://svn.openlaszlo.org/openlaszlo/trunk

Summary:  fix for text selection in DHTML

New Features:

Bugs Fixed: LPP-8200

Technical Reviewer: max
QA Reviewer: andre
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:

+ LzSprite.js: only toggle the focus in focus_on_mouseover quirk when there is some text selected.

+ LzKeyboardKernel.js: Instead of cancelling a mouse event completely,
 just cancel bubbling. This lets the div handle the event, and allows
 text selection to work, but should disable it from propagating to
 global handlers.

+ LzMouseKernel.js: don't cancel event with keyCode == 0 entirely, just cancel bubbling.

+ LzTextSprite.js: use correct CSS properties for toggling selectability, in Safari

+ LzInputTextSprite.js: do not bind the global document.onselectstart handler, that prevents
text selection from working in some browsers

+ LzText.lzs: add the 'onselectable' event, not required for this
patch, but I noticed it was missing when writing a test case

Tests:

+ added lpp-8200.lzx test, try selecting a region in each the text
fields, except for the last (non-selectable) one.

+ text selection should work in DHTML on selectable text or input text, all
browsers

+ NOTE: there is a bug in IE7 text selection [maybe related to
(LPP-8249) "IE7 DHTML text letter spacing looks bad"], where in the
test case lpp-8200, if you try to drag the mouse to select the text in
the <text> view which says "This is selectable text", you cannot use
the mouse to select the last word ('text'). I think that maybe the
letter spacing setting causes the browser to miscalulate the text
width?

Files:
A      test/lfc/lpp-8200.lzx
M      WEB-INF/lps/lfc/kernel/dhtml/LzKeyboardKernel.js
M      WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
M      WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
M      WEB-INF/lps/lfc/kernel/dhtml/LzMouseKernel.js
M      WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
M      WEB-INF/lps/lfc/views/LzText.lzs

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20090603-hqm-U.tar

Reply via email to