зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1211038 - Fix focus issue with debugger searchbox using CodeMirror upstream patch;r=jryans
--HG-- extra : commitid : DKG9VrpGIyG
This commit is contained in:
Родитель
9475037ade
Коммит
99dff533b4
|
@ -25,8 +25,15 @@ function test() {
|
|||
}
|
||||
|
||||
function performTest() {
|
||||
// Make sure that the search box becomes focused when pressing ctrl+f - Bug 1211038
|
||||
gEditor.focus();
|
||||
synthesizeKeyFromKeyTag(gDebugger.document.getElementById("tokenSearchKey"));
|
||||
let focusedEl = Services.focus.focusedElement;
|
||||
focusedEl = focusedEl.ownerDocument.getBindingParent(focusedEl) || focusedEl;
|
||||
is(focusedEl, gDebugger.document.getElementById("searchbox"), "Searchbox is focused");
|
||||
|
||||
setText(gSearchBox, "#html");
|
||||
|
||||
|
||||
EventUtils.synthesizeKey("VK_RETURN", { shiftKey: true }, gDebugger);
|
||||
is(gFiltering.searchData.toSource(), '["#", ["", "html"]]',
|
||||
"The searchbox data wasn't parsed correctly.");
|
||||
|
@ -44,7 +51,7 @@ function performTest() {
|
|||
"The searchbox data wasn't parsed correctly.");
|
||||
ok(isCaretPos(gPanel, 3, 15),
|
||||
"The editor didn't jump to the correct line.");
|
||||
|
||||
|
||||
setText(gSearchBox, ":12");
|
||||
is(gFiltering.searchData.toSource(), '[":", ["", 12]]',
|
||||
"The searchbox data wasn't parsed correctly.");
|
||||
|
|
|
@ -1215,3 +1215,30 @@ function getSplitConsole(toolbox, win) {
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
// This can be removed once debugger uses shared-head.js (bug 1181838)
|
||||
function synthesizeKeyFromKeyTag(key) {
|
||||
is(key && key.tagName, "key", "Successfully retrieved the <key> node");
|
||||
|
||||
let modifiersAttr = key.getAttribute("modifiers");
|
||||
|
||||
let name = null;
|
||||
|
||||
if (key.getAttribute("keycode"))
|
||||
name = key.getAttribute("keycode");
|
||||
else if (key.getAttribute("key"))
|
||||
name = key.getAttribute("key");
|
||||
|
||||
isnot(name, null, "Successfully retrieved keycode/key");
|
||||
|
||||
let modifiers = {
|
||||
shiftKey: !!modifiersAttr.match("shift"),
|
||||
ctrlKey: !!modifiersAttr.match("control"),
|
||||
altKey: !!modifiersAttr.match("alt"),
|
||||
metaKey: !!modifiersAttr.match("meta"),
|
||||
accelKey: !!modifiersAttr.match("accel")
|
||||
};
|
||||
|
||||
info("Synthesizing key " + name + " " + JSON.stringify(modifiers));
|
||||
EventUtils.synthesizeKey(name, modifiers);
|
||||
}
|
||||
|
|
|
@ -3091,7 +3091,8 @@
|
|||
|
||||
if (cm.state.focused && op.updateInput)
|
||||
cm.display.input.reset(op.typing);
|
||||
if (op.focus && op.focus == activeElt()) ensureFocus(op.cm);
|
||||
if (op.focus && op.focus == activeElt() && (!document.hasFocus || document.hasFocus()))
|
||||
ensureFocus(op.cm);
|
||||
}
|
||||
|
||||
function endOperation_finish(op) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче