Author: max
Date: 2007-07-22 21:00:59 -0700 (Sun, 22 Jul 2007)
New Revision: 5747
Modified:
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzMouseKernel.js
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
Log:
Change 20070722-maxcarlson-g by [EMAIL PROTECTED] on 2007-07-22 12:13:31 PDT
in /Users/maxcarlson/openlaszlo/legals-checkin
for http://svn.openlaszlo.org/openlaszlo/branches/legals
Summary: Fix inputtext focus and blurring in IE
New Features:
Bugs Fixed: LPP-4244 - Mouse handling busted in R5588 IE7 DHTML
Technical Reviewer: promanik
QA Reviewer: hminsky
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details: LzSprite.js - setWidth/Height() return new width value if changed.
Optimize setOpacity.
LzMouseKernel.js - Pass eventname and target into
LzInputTextSprite.__hideIfNotFocused(), but only when fix_ie_clickable quirk is
on. Otherwise, act the same as before.
LzInputTextSprite.js - Add __setglobalclickable() method and call it instead of
calling __setCSSClassProperty() directly. Turn global ckickability on when
mousing out of inputtext, and off again when mousing back over the inputtext.
This makes clickable views function they way they should without interfering
with the inputtext. setWidth/Height() use values returned from
LzSprite.setWidth/Height().
Tests: ant lztest, LPP-4244 pass.
Modified:
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
===================================================================
---
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
2007-07-23 02:48:38 UTC (rev 5746)
+++
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
2007-07-23 04:00:59 UTC (rev 5747)
@@ -74,6 +74,7 @@
this.__LZinputclickdiv.className = 'lzclickdiv';
this.__LZinputclickdiv.owner = this;
this.__LZinputclickdiv.onmouseover = function () {
+ LzInputTextSprite.prototype.__setglobalclickable(false);
this.owner.__show();
}
this.__LZclickdiv.appendChild(this.__LZinputclickdiv);
@@ -110,19 +111,41 @@
}
if (this.quirks.fix_ie_clickable) {
this.__LZclickdiv.appendChild(this.__LzInputDiv);
- this.__setCSSClassProperty('.lzclickdiv', 'display', 'none');
+ this.__setglobalclickable(false);
} else {
this.__LZinputclickdiv.appendChild(this.__LzInputDiv);
}
//Debug.write('show');
}
-LzInputTextSprite.prototype.__hideIfNotFocused = function() {
+LzInputTextSprite.prototype.__hideIfNotFocused = function(eventname, target) {
if (LzInputTextSprite.prototype.__lastshown == null) return;
- if (LzInputTextSprite.prototype.__focusedSprite !=
LzInputTextSprite.prototype.__lastshown) {
- LzInputTextSprite.prototype.__lastshown.__hide();
+ if (LzSprite.prototype.quirks.fix_ie_clickable && eventname ==
'onmousemove') {
+ // track mouse position for inputtext when global clickable is false
+ if (LzInputTextSprite.prototype.__globalclickable == false &&
LzInputTextSprite.prototype.__focusedSprite && target) {
+ if (target.owner != LzInputTextSprite.prototype.__focusedSprite) {
+ LzInputTextSprite.prototype.__setglobalclickable(true);
+ } else {
+ LzInputTextSprite.prototype.__setglobalclickable(false);
+ }
+ }
+ } else {
+ if (eventname != null && LzInputTextSprite.prototype.__globalclickable
== true) {
+ LzInputTextSprite.prototype.__setglobalclickable(false);
+ }
+ if (LzInputTextSprite.prototype.__focusedSprite !=
LzInputTextSprite.prototype.__lastshown) {
+ LzInputTextSprite.prototype.__lastshown.__hide();
+ }
}
+
}
+LzInputTextSprite.prototype.__setglobalclickable = function(c) {
+ if (! LzSprite.prototype.quirks.fix_ie_clickable) return;
+ if (c != LzInputTextSprite.prototype.__globalclickable) {
+ LzInputTextSprite.prototype.__globalclickable = c;
+ LzInputTextSprite.prototype.__setCSSClassProperty('.lzclickdiv',
'display', c ? '' : 'none');
+ }
+}
LzInputTextSprite.prototype.__hide = function() {
if (this.__shown != true || this.disabled == true) return;
@@ -146,7 +169,7 @@
// and make the click be displayed or not by whether it is before or
after the (input) div?
// [max 1-18-2007] IE requires different nesting rules for inputtext.
Also, if there are _any_ clickable divs behind the inputtext they'll grab
clicks. This is the reason I temporarily hide all clickable divs when the
inputtext is selected - and the reason the inputtext can't be a child of the
clickable view.
- this.__setCSSClassProperty('.lzclickdiv', 'display', '');
+ this.__setglobalclickable(true);
this.__LzInputDiv = this.__LZclickdiv.removeChild(this.__LzInputDiv);
} else {
this.__LzInputDiv =
this.__LZinputclickdiv.removeChild(this.__LzInputDiv);
@@ -179,6 +202,7 @@
if (c) {
this.__LzInputDiv.onblur = function (e) { this.owner.__textEvent(e,
'onblur') }
this.__LzInputDiv.onmousedown = function (e) {
this.owner.__textEvent(e, 'onmousedown') }
+ this.__LzInputDiv.onmouseout = function (e) {
this.owner.__textEvent(e, 'onmouseout') }
this.__LzInputDiv.onfocus = function (e) { this.owner.__textEvent(e,
'onfocus') }
this.__LzInputDiv.onclick = function (e) { this.owner.__textEvent(e,
'onclick') }
this.__LzInputDiv.onkeyup = function (e) { this.owner.__textEvent(e,
'onkeyup') }
@@ -201,6 +225,9 @@
if (this.destroyed == true) return;
var keycode = e ? e.keyCode : event.keyCode;
if (eventname == 'onfocus' || eventname == 'onmousedown') {
+ if (eventname == 'onfocus') {
+ LzInputTextSprite.prototype.__setglobalclickable(false);
+ }
LzInputTextSprite.prototype.__focusedSprite = this;
this.__show();
if (eventname == 'onfocus' && this._cancelfocus) {
@@ -218,7 +245,9 @@
this._cancelblur = false;
return;
}
- }
+ } else if (eventname == 'onmouseout') {
+ this.__setglobalclickable(true);
+ }
//Debug.info('__textEvent', eventname, keycode);
if (this.owner) {
@@ -304,24 +333,26 @@
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) {
- var w = this.CSSDimension(this.width);
- this.__LZclickdiv.style.width = w;
- this.__LZinputclickdiv.style.width = w;
+ var nw = this.__setWidth(w - this.____wpadding);
+ if (this.quirks.fix_clickable && nw != null) {
+ this.__LZclickdiv.style.width = nw;
+ this.__LZinputclickdiv.style.width = nw;
}
}
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) {
- var h = this.CSSDimension(this.height);
- this.__LZclickdiv.style.height = h;
- this.__LZinputclickdiv.style.height = h;
+ var nh = this.__setHeight(h);
+ if (this.quirks.fix_clickable && nh != null) {
+ this.__LZclickdiv.style.height = nh;
+ this.__LZinputclickdiv.style.height = nh;
if (this.multiline && this.quirks.set_height_for_multiline_inputtext) {
- this.__LzInputDiv.style.height = this.CSSDimension(this.height -
(this.____hpadding * 2));
+ h = this.CSSDimension(h - (this.____hpadding * 2));
+ if (h != this._multilineheight) {
+ this._multilineheight = h;
+ this.__LzInputDiv.style.height = h
+ }
}
}
}
Modified:
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzMouseKernel.js
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzMouseKernel.js
2007-07-23 02:48:38 UTC (rev 5746)
+++ openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzMouseKernel.js
2007-07-23 04:00:59 UTC (rev 5747)
@@ -21,8 +21,15 @@
,__mouseEvent: function(e) {
if (!e) e = window.event;
var eventname = 'on' + e.type;
- if (window['LzKeyboardKernel']) LzKeyboardKernel.__keyboardEvent(e);
- if (window['LzInputTextSprite'] && eventname != 'onmousemove' &&
LzInputTextSprite.prototype.__lastshown != null)
LzInputTextSprite.prototype.__hideIfNotFocused();
+ var targ = e.srcElement ? e.srcElement : e.target;
+ if (window['LzKeyboardKernel'] && LzKeyboardKernel['__keyboardEvent'])
LzKeyboardKernel.__keyboardEvent(e);
+ if (window['LzInputTextSprite']) {
+ if (LzSprite.prototype.quirks.fix_ie_clickable) {
+ LzInputTextSprite.prototype.__hideIfNotFocused(eventname,
targ);
+ } else if (eventname != 'onmousemove' &&
LzInputTextSprite.prototype.__lastshown != null) {
+ LzInputTextSprite.prototype.__hideIfNotFocused();
+ }
+ }
if (eventname == 'onmouseup' && LzMouseKernel.__lastMouseDown != null)
{
// call mouseup on the sprite that got the last mouse down
LzMouseKernel.__lastMouseDown.__globalmouseup(e);
@@ -38,7 +45,6 @@
if (LzMouseKernel.__callback) {
if (e.button == 2 && eventname != 'oncontextmenu') return;
if (eventname == 'oncontextmenu') {
- var targ = e.srcElement ? e.srcElement : e.target;
if (targ && targ.owner && targ.owner.__contextmenu) {
targ.owner.__contextmenu.__show();
return targ.owner.__contextmenu.showbuiltins;
Modified: openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
2007-07-23 02:48:38 UTC (rev 5746)
+++ openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
2007-07-23 04:00:59 UTC (rev 5747)
@@ -682,6 +682,7 @@
if (this.clip) this.__updateClip();
if (this.stretches) this.__updateStretches();
if (this.__LZclick) this.__LZclick.style.width = w;
+ return w;
}
}
@@ -712,6 +713,7 @@
if (this.clip) this.__updateClip();
if (this.stretches) this.__updateStretches();
if (this.__LZclick) this.__LZclick.style.height = h;
+ return h;
}
}
@@ -777,11 +779,14 @@
if (this.opacity == o || o < 0) return;
//Debug.info('setOpacity', o);
this.opacity = o;
- if (o < .001) o = 0;
- if (this.quirks.ie_alpha_image_loader) {
- this.__LZdiv.style.filter = "alpha(opacity="+(o * 100)+")";
- } else {
- this.__LZdiv.style.opacity = o;
+ o = parseInt(o * 100) / 100;
+ if (o != this._opacity) {
+ this._opacity = o;
+ if (this.quirks.ie_alpha_image_loader) {
+ this.__LZdiv.style.filter = "alpha(opacity=" + parseInt(o * 100) +
")";
+ } else {
+ this.__LZdiv.style.opacity = o;
+ }
}
}
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins