mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 23:47:58 +01:00
Merge branch default.
--HG-- branch : bootstrapped
This commit is contained in:
@@ -161,6 +161,9 @@ const Buffer = Module("buffer", {
|
||||
},
|
||||
|
||||
_triggerLoadAutocmd: function _triggerLoadAutocmd(name, doc, uri) {
|
||||
if (!(uri || doc.location))
|
||||
return;
|
||||
|
||||
uri = uri || util.newURI(doc.location.href);
|
||||
let args = {
|
||||
url: { toString: function () uri.spec, valueOf: function () uri },
|
||||
@@ -248,12 +251,9 @@ const Buffer = Module("buffer", {
|
||||
|
||||
buffer._triggerLoadAutocmd("PageLoadPre", webProgress.DOMWindow.document);
|
||||
|
||||
// don't reset mode if a frame of the frameset gets reloaded which
|
||||
// is not the focused frame
|
||||
if (document.commandDispatcher.focusedWindow == webProgress.DOMWindow && this.loadCount++) {
|
||||
if (document.commandDispatcher.focusedWindow == webProgress.DOMWindow && this.loadCount++)
|
||||
util.timeout(function () { modes.reset(false); },
|
||||
dactyl.mode == modes.HINTS ? 500 : 0);
|
||||
}
|
||||
dactyl.mode == modes.HINTS ? 500 : 0);
|
||||
}
|
||||
else if (flags & Ci.nsIWebProgressListener.STATE_STOP) {
|
||||
// Workaround for bugs 591425 and 606877, dactyl bug #81
|
||||
@@ -292,8 +292,8 @@ const Buffer = Module("buffer", {
|
||||
onLocationChange.superapply(this, arguments);
|
||||
statusline.updateUrl();
|
||||
statusline.updateProgress(webProgress.DOMWindow || content);
|
||||
for (let frame in values(buffer.allFrames()))
|
||||
frame.dactylFocusAllowed = false;
|
||||
for (let frame in values(buffer.allFrames(webProgress.DOMWindow || content)))
|
||||
frame.document.dactylFocusAllowed = false;
|
||||
|
||||
// Workaround for bugs 591425 and 606877, dactyl bug #81
|
||||
let collapse = uri && uri.scheme === "dactyl" && webProgress.isLoadingDocument;
|
||||
@@ -372,9 +372,9 @@ const Buffer = Module("buffer", {
|
||||
* tab.
|
||||
*/
|
||||
get localStore() {
|
||||
if (!content.dactylStore)
|
||||
content.dactylStore = {};
|
||||
return content.dactylStore;
|
||||
if (!content.document.dactylStore)
|
||||
content.document.dactylStore = {};
|
||||
return content.document.dactylStore;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -524,8 +524,8 @@ const Buffer = Module("buffer", {
|
||||
focusAllowed: function (elem) {
|
||||
if (elem instanceof Window && !Editor.getEditor(window))
|
||||
return true;
|
||||
let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem;
|
||||
return !options["strictfocus"] || win.dactylFocusAllowed;
|
||||
let doc = elem.ownerDocument || elem.document || elem;
|
||||
return !options["strictfocus"] || doc.dactylFocusAllowed;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -537,11 +537,12 @@ const Buffer = Module("buffer", {
|
||||
*/
|
||||
focusElement: function (elem) {
|
||||
let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem;
|
||||
win.dactylFocusAllowed = true;
|
||||
win.document.dactylFocusAllowed = true;
|
||||
|
||||
if (isinstance(elem, [HTMLFrameElement, HTMLIFrameElement]))
|
||||
elem = elem.contentWindow;
|
||||
elem.dactylFocusAllowed = true;
|
||||
if (elem.document)
|
||||
elem.document.dactylFocusAllowed = true;
|
||||
|
||||
if (elem instanceof HTMLInputElement && elem.type == "file") {
|
||||
Buffer.openUploadPrompt(elem);
|
||||
|
||||
@@ -389,13 +389,14 @@ const Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
||||
return res;
|
||||
},
|
||||
|
||||
focus: function (elem, flags) {
|
||||
focus: function focus(elem, flags) {
|
||||
flags = flags || services.focus.FLAG_BYMOUSE;
|
||||
util.dumpStack();
|
||||
try {
|
||||
if (elem instanceof Document)
|
||||
elem = elem.defaultView;
|
||||
if (elem instanceof Window)
|
||||
services.focus.clearFocus(elem);
|
||||
services.focus.focusedWindow = elem;
|
||||
else
|
||||
services.focus.setFocus(elem, flags);
|
||||
} catch (e) {
|
||||
@@ -410,7 +411,7 @@ const Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
||||
* @param {boolean} clearFocusedElement Remove focus from any focused
|
||||
* element.
|
||||
*/
|
||||
focusContent: function (clearFocusedElement) {
|
||||
focusContent: function focusContent(clearFocusedElement) {
|
||||
if (window != services.windowWatcher.activeWindow)
|
||||
return;
|
||||
|
||||
@@ -433,7 +434,8 @@ const Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
||||
catch (e) {}
|
||||
|
||||
if (clearFocusedElement) {
|
||||
services.focus.clearFocus(window);
|
||||
if (dactyl.focusedElement)
|
||||
dactyl.focusedElement.blur();
|
||||
if (win && Editor.getEditor(win)) {
|
||||
win.blur();
|
||||
if (win.frameElement)
|
||||
@@ -450,6 +452,7 @@ const Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
||||
|
||||
/** @property {Element} The currently focused element. */
|
||||
get focusedElement() services.focus.getFocusedElementForWindow(window, true, {}),
|
||||
set focusedElement(elem) dactyl.focus(elem),
|
||||
|
||||
/**
|
||||
* Returns whether this Dactyl extension supports *feature*.
|
||||
|
||||
@@ -962,7 +962,7 @@ const Events = Module("events", {
|
||||
let elem = event.target;
|
||||
let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem;
|
||||
for (; win; win = win != win.parent && win.parent)
|
||||
win.dactylFocusAllowed = true;
|
||||
win.document.dactylFocusAllowed = true;
|
||||
},
|
||||
|
||||
onPopupShown: function onPopupShown(event) {
|
||||
|
||||
@@ -286,6 +286,7 @@ const Modes = Module("modes", {
|
||||
},
|
||||
|
||||
push: function push(mainMode, extendedMode, params) {
|
||||
util.dumpStack();
|
||||
this.set(mainMode, extendedMode, params, { push: this.topOfStack });
|
||||
},
|
||||
|
||||
|
||||
@@ -964,7 +964,7 @@ const Tabs = Module("tabs", {
|
||||
"See 'showtabline' option.");
|
||||
tabs.tabStyle.enabled = false;
|
||||
}
|
||||
if (value != 1)
|
||||
if (value != 1 || !dactyl.has("Gecko2"))
|
||||
config.tabStrip.collapsed = false;
|
||||
return value;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user