From 04a1f6c49d104de8ba2d4c60db27f66c4a8d2e1f Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 26 Aug 2010 21:01:50 -0400 Subject: [PATCH] Some 'strictfocus' tweaks. --- common/content/buffer.js | 6 +++--- common/content/events.js | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/common/content/buffer.js b/common/content/buffer.js index be2362bf..7315f2f1 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -578,8 +578,8 @@ const Buffer = Module("buffer", { let offsetX = 1; let offsetY = 1; - if (elem instanceof HTMLFrameElement || elem instanceof HTMLIFrameElement) { - elem.contentWindow.focus(); + if (isinstance(elem [HTMLFrameElement, HTMLIFrameElement])) { + buffer.focusElement(elem); return; } else if (elem instanceof HTMLAreaElement) { // for imagemap @@ -608,7 +608,7 @@ const Buffer = Module("buffer", { liberator.log("Invalid where argument for followLink()", 0); } - elem.focus(); + buffer.focusElement(elem); options.withContext(function () { options.setPref("browser.tabs.loadInBackground", true); diff --git a/common/content/events.js b/common/content/events.js index 4ec214d2..c9860b82 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -735,13 +735,15 @@ const Events = Module("events", { } }, + // TODO: Merge with onFocusChange onFocus: function (event) { function hasHTMLDocument(win) win && win.document && win.document instanceof HTMLDocument let elem = event.originalTarget; let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem; - if (hasHTMLDocument(win) && !buffer.focusAllowed(win)) + if (hasHTMLDocument(win) && !buffer.focusAllowed(win) + && isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement])) elem.blur(); },