mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1211122 - ensuring that we check position against an actual doc/dialog on doc load event. r=marcoz
This commit is contained in:
parent
eef4977b53
commit
7d922096c5
@ -287,8 +287,12 @@ this.EventManager.prototype = {
|
||||
case Events.DOCUMENT_LOAD_COMPLETE:
|
||||
{
|
||||
let position = this.contentControl.vc.position;
|
||||
// Check if position is in the subtree of the DOCUMENT_LOAD_COMPLETE
|
||||
// event's dialog accesible or accessible document
|
||||
let subtreeRoot = aEvent.accessible.role === Roles.DIALOG ?
|
||||
aEvent.accessible : aEvent.accessibleDocument;
|
||||
if (aEvent.accessible === aEvent.accessibleDocument ||
|
||||
(position && Utils.isInSubtree(position, aEvent.accessible))) {
|
||||
(position && Utils.isInSubtree(position, subtreeRoot))) {
|
||||
// Do not automove into the document if the virtual cursor is already
|
||||
// positioned inside it.
|
||||
break;
|
||||
|
@ -345,6 +345,21 @@ this.Utils = { // jshint ignore:line
|
||||
|
||||
isInSubtree: function isInSubtree(aAccessible, aSubTreeRoot) {
|
||||
let acc = aAccessible;
|
||||
|
||||
// If aSubTreeRoot is an accessible document, we will only walk up the
|
||||
// ancestry of documents and skip everything else.
|
||||
if (aSubTreeRoot instanceof Ci.nsIAccessibleDocument) {
|
||||
while (acc) {
|
||||
let parentDoc = acc instanceof Ci.nsIAccessibleDocument ?
|
||||
acc.parentDocument : acc.document;
|
||||
if (parentDoc === aSubTreeRoot) {
|
||||
return true;
|
||||
}
|
||||
acc = parentDoc;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
while (acc) {
|
||||
if (acc == aSubTreeRoot) {
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user