Backed out changeset 4f0f7fe10716 - (leak test had an assertion and the leaktest harness failed to deal with it).

This commit is contained in:
Antonio Gomes 2009-01-22 12:25:35 -04:00
Родитель 3d8cc9c1a9
Коммит 7413b38e41
3 изменённых файлов: 22 добавлений и 43 удалений

Просмотреть файл

@ -126,52 +126,26 @@ function _onInputKeyPress (event, callback) {
return; return;
} }
// if it is a single-line input fields ... if ((target instanceof Ci.nsIDOMHTMLInputElement && (target.type == "text" || target.type == "password")) ||
if (target instanceof Ci.nsIDOMHTMLInputElement && target instanceof Ci.nsIDOMHTMLTextAreaElement ) {
(target.type == "text" || target.type == "password")) {
// if there is any selection at all, just ignore
// up/down should not care and just move.
if (key != PrefObserver['keyCodeUp'] &&
key != PrefObserver['keyCodeDown']) {
// if there is any selection at all, just ignore
if (target.selectionEnd - target.selectionStart > 0)
return;
// if there is no text, there is nothing special to do.
if (target.textLength > 0)
if (key == PrefObserver['keyCodeLeft']) {
// if there is text, there it isn't okay to move
if (target.selectionStart != 0)
return;
}
else if (key == PrefObserver['keyCodeRight']) {
// we are moving forward into the document
if (target.textLength != target.selectionEnd)
return;
}
}
}
// if it is a multi-line input field ...
else if (target instanceof Ci.nsIDOMHTMLTextAreaElement) {
// if there is any selection at all, again just ignore
if (target.selectionEnd - target.selectionStart > 0) if (target.selectionEnd - target.selectionStart > 0)
return; return;
// if there is no text, there is nothing special to do. // if there is no text, there is nothing special to do.
if (target.textLength > 0) { if (target.textLength > 0) {
if (key == PrefObserver['keyCodeUp'] || if (key == PrefObserver['keyCodeRight'] ||
key == PrefObserver['keyCodeLeft']) { key == PrefObserver['keyCodeDown'] ) {
// if there is text, there it isn't okay to move // we are moving forward into the document
if (target.selectionStart != 0) if (target.textLength != target.selectionEnd)
return; return;
} }
else { else
if (key == PrefObserver['keyCodeDown'] || {
key == PrefObserver['keyCodeRight']) // we are at the start of the text, okay to move
if (target.selectionEnd != target.textLength) if (target.selectionStart != 0)
return; return;
} }
} }
} }

Просмотреть файл

@ -50,10 +50,11 @@ MOCHI_TESTS = chrome/test_snav.xul \
chrome/test_snav_selects.xul \ chrome/test_snav_selects.xul \
chrome/test_snav_prefDisabled.xul \ chrome/test_snav_prefDisabled.xul \
chrome/test_snav_prefKeyCode.xul \ chrome/test_snav_prefKeyCode.xul \
chrome/test_snav_textFields.xul \
chrome/SpatialNavUtils.js \ chrome/SpatialNavUtils.js \
$(NULL) $(NULL)
# bug 447671 chrome/test_snav_textFields.xul \
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk
libs:: $(MOCHI_TESTS) $(MOCHI_CONTENT) libs:: $(MOCHI_TESTS) $(MOCHI_CONTENT)

Просмотреть файл

@ -6,7 +6,7 @@
https://bugzilla.mozilla.org/show_bug.cgi?id=436084 https://bugzilla.mozilla.org/show_bug.cgi?id=436084
--> -->
<window title="Mozilla Bug 436084" <window title="Mozilla Bug 288254"
xmlns:html="http://www.w3.org/1999/xhtml" xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="onLoad();"> onload="onLoad();">
@ -36,21 +36,25 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=436084
</body> </body>
<script class="testbody" type="application/javascript"> <script class="testbody" type="application/javascript">
<![CDATA[ <![CDATA[
Components.utils.import("resource://gre/modules/SpatialNavigation.js"); Components.utils.import("resource://gre/modules/SpatialNavigation.js");
var moveTable = [ var moveTable = [
["DOWN", "textinput"], ["DOWN", "textinput"],
["DOWN", "textinput"],
["DOWN", "textarea"], ["DOWN", "textarea"],
["DOWN", "textarea"], ["DOWN", "textarea"],
["DOWN", "end"], ["DOWN", "end"],
["UP", "textarea"], ["UP", "textarea"],
["UP", "textarea"], ["UP", "textarea"],
["UP", "textinput"], ["UP", "textinput"],
["UP", "textinput"],
["UP", "start"], ["UP", "start"],
["DOWN", "textinput"], ["DOWN", "textinput"],
["HOME", "textinput"], ["LEFT", "textinput"],
["RIGHT", "textinput"], ["RIGHT", "textinput"],
["RIGHT", "textinput"], ["RIGHT", "textinput"],
@ -79,7 +83,7 @@ var moveTable = [
["RIGHT", "textinput"], ["RIGHT", "textinput"],
["RIGHT", "textinput"], ["RIGHT", "textinput"],
["RIGHT", "textarea"], ["RIGHT", "textarea"],
["HOME", "textarea"], ["LEFT", "textarea"],
["RIGHT", "textarea"], ["RIGHT", "textarea"],
["RIGHT", "textarea"], ["RIGHT", "textarea"],
["RIGHT", "textarea"], ["RIGHT", "textarea"],