зеркало из https://github.com/mozilla/pjs.git
Bug 757418 - Do Presenter.tabSelected when tab's window receives focus.
This commit is contained in:
Родитель
dd01817d8a
Коммит
498347b70f
|
@ -74,6 +74,7 @@ var AccessFu = {
|
|||
this.chromeWin.addEventListener('resize', this, true);
|
||||
this.chromeWin.addEventListener('scroll', this, true);
|
||||
this.chromeWin.addEventListener('TabOpen', this, true);
|
||||
this.chromeWin.addEventListener('focus', this, true);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -96,6 +97,7 @@ var AccessFu = {
|
|||
this.chromeWin.removeEventListener('resize', this, true);
|
||||
this.chromeWin.removeEventListener('scroll', this, true);
|
||||
this.chromeWin.removeEventListener('TabOpen', this, true);
|
||||
this.chromeWin.removeEventListener('focus', this, true);
|
||||
},
|
||||
|
||||
_processPreferences: function _processPreferences(aPref) {
|
||||
|
@ -130,6 +132,19 @@ var AccessFu = {
|
|||
|
||||
handleEvent: function handleEvent(aEvent) {
|
||||
switch (aEvent.type) {
|
||||
case 'focus':
|
||||
{
|
||||
if (aEvent.target instanceof Ci.nsIDOMWindow) {
|
||||
let docAcc = getAccessible(aEvent.target.document);
|
||||
let docContext = new PresenterContext(docAcc, null);
|
||||
let cursorable = docAcc.QueryInterface(Ci.nsIAccessibleCursorable);
|
||||
let vcContext = new PresenterContext(
|
||||
(cursorable) ? cursorable.virtualCursor.position : null, null);
|
||||
this.presenters.forEach(
|
||||
function(p) { p.tabSelected(docContext, vcContext); });
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'TabOpen':
|
||||
{
|
||||
let browser = aEvent.target.linkedBrowser || aEvent.target;
|
||||
|
@ -308,20 +323,6 @@ var AccessFu = {
|
|||
);
|
||||
break;
|
||||
}
|
||||
case Ci.nsIAccessibleEvent.EVENT_FOCUS:
|
||||
{
|
||||
if (this._isBrowserDoc(aEvent.accessible)) {
|
||||
// The document recieved focus, call tabSelected to present current tab.
|
||||
let docContext = new PresenterContext(aEvent.accessible, null);
|
||||
let cursorable = aEvent.accessible.
|
||||
QueryInterface(Ci.nsIAccessibleCursorable);
|
||||
let vcContext = new PresenterContext(
|
||||
(cursorable) ? cursorable.virtualCursor.position : null, null);
|
||||
this.presenters.forEach(
|
||||
function(p) { p.tabSelected(docContext, vcContext); });
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Ci.nsIAccessibleEvent.EVENT_TEXT_INSERTED:
|
||||
case Ci.nsIAccessibleEvent.EVENT_TEXT_REMOVED:
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче