mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Backed out changeset 0a9ecb630db6 (bug 1234121) for Marionette-e10s crashes on Linux in test_accessibility.py TestAccessibility.test_click_raises_no_exceptions. r=backout on a CLOSED TREE
This commit is contained in:
parent
c77c3ae876
commit
589be256a0
@ -27,6 +27,46 @@ FocusManager::~FocusManager()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Accessible*
|
||||||
|
FocusManager::FocusedAccessible() const
|
||||||
|
{
|
||||||
|
if (mActiveItem)
|
||||||
|
return mActiveItem;
|
||||||
|
|
||||||
|
nsINode* focusedNode = FocusedDOMNode();
|
||||||
|
if (focusedNode) {
|
||||||
|
DocAccessible* doc =
|
||||||
|
GetAccService()->GetDocAccessible(focusedNode->OwnerDoc());
|
||||||
|
return doc ? doc->GetAccessibleEvenIfNotInMapOrContainer(focusedNode) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
FocusManager::IsFocused(const Accessible* aAccessible) const
|
||||||
|
{
|
||||||
|
if (mActiveItem)
|
||||||
|
return mActiveItem == aAccessible;
|
||||||
|
|
||||||
|
nsINode* focusedNode = FocusedDOMNode();
|
||||||
|
if (focusedNode) {
|
||||||
|
// XXX: Before getting an accessible for node having a DOM focus make sure
|
||||||
|
// they belong to the same document because it can trigger unwanted document
|
||||||
|
// accessible creation for temporary about:blank document. Without this
|
||||||
|
// peculiarity we would end up with plain implementation based on
|
||||||
|
// FocusedAccessible() method call. Make sure this issue is fixed in
|
||||||
|
// bug 638465.
|
||||||
|
if (focusedNode->OwnerDoc() == aAccessible->GetNode()->OwnerDoc()) {
|
||||||
|
DocAccessible* doc =
|
||||||
|
GetAccService()->GetDocAccessible(focusedNode->OwnerDoc());
|
||||||
|
return aAccessible ==
|
||||||
|
(doc ? doc->GetAccessibleEvenIfNotInMapOrContainer(focusedNode) : nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
FocusManager::IsFocusWithin(const Accessible* aContainer) const
|
FocusManager::IsFocusWithin(const Accessible* aContainer) const
|
||||||
{
|
{
|
||||||
@ -153,23 +193,9 @@ FocusManager::ActiveItemChanged(Accessible* aItem, bool aCheckIfActive)
|
|||||||
// If active item is changed then fire accessible focus event on it, otherwise
|
// If active item is changed then fire accessible focus event on it, otherwise
|
||||||
// if there's no an active item then fire focus event to accessible having
|
// if there's no an active item then fire focus event to accessible having
|
||||||
// DOM focus.
|
// DOM focus.
|
||||||
Accessible* target = nullptr;
|
Accessible* target = FocusedAccessible();
|
||||||
if (aItem) {
|
if (target)
|
||||||
target = aItem;
|
|
||||||
} else {
|
|
||||||
nsINode* focusedNode = FocusedDOMNode();
|
|
||||||
if (focusedNode) {
|
|
||||||
DocAccessible* doc =
|
|
||||||
GetAccService()->GetDocAccessible(focusedNode->OwnerDoc());
|
|
||||||
if (doc) {
|
|
||||||
target = doc->GetAccessibleEvenIfNotInMapOrContainer(focusedNode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (target) {
|
|
||||||
DispatchFocusEvent(target->Document(), target);
|
DispatchFocusEvent(target->Document(), target);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -270,9 +296,6 @@ FocusManager::ProcessFocusEvent(AccEvent* aEvent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mFocusedAcc = target;
|
|
||||||
mFocusedProxy = nullptr;
|
|
||||||
|
|
||||||
// Fire menu start/end events for ARIA menus.
|
// Fire menu start/end events for ARIA menus.
|
||||||
if (target->IsARIARole(nsGkAtoms::menuitem)) {
|
if (target->IsARIARole(nsGkAtoms::menuitem)) {
|
||||||
// The focus was moved into menu.
|
// The focus was moved into menu.
|
||||||
|
@ -16,7 +16,6 @@ namespace a11y {
|
|||||||
|
|
||||||
class AccEvent;
|
class AccEvent;
|
||||||
class Accessible;
|
class Accessible;
|
||||||
class ProxyAccessible;
|
|
||||||
class DocAccessible;
|
class DocAccessible;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,18 +29,13 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Return a focused accessible.
|
* Return a focused accessible.
|
||||||
*/
|
*/
|
||||||
Accessible* FocusedAccessible() const { return mFocusedAcc; }
|
Accessible* FocusedAccessible() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Return remote focused accessible.
|
|
||||||
*/
|
|
||||||
ProxyAccessible* FocusedRemoteAccessible() const { return mFocusedProxy; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if given accessible is focused.
|
* Return true if given accessible is focused.
|
||||||
*/
|
*/
|
||||||
bool IsFocused(const Accessible* aAccessible) const
|
bool IsFocused(const Accessible* aAccessible) const;
|
||||||
{ return aAccessible == mFocusedAcc; }
|
|
||||||
/**
|
/**
|
||||||
* Return true if the given accessible is an active item, i.e. an item that
|
* Return true if the given accessible is an active item, i.e. an item that
|
||||||
* is current within the active widget.
|
* is current within the active widget.
|
||||||
@ -91,11 +85,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
void ActiveItemChanged(Accessible* aItem, bool aCheckIfActive = true);
|
void ActiveItemChanged(Accessible* aItem, bool aCheckIfActive = true);
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when focused item in child process is changed.
|
|
||||||
*/
|
|
||||||
void RemoteFocusChanged(ProxyAccessible* aProxy) { mFocusedProxy = aProxy; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatch delayed focus event for the current focus accessible.
|
* Dispatch delayed focus event for the current focus accessible.
|
||||||
*/
|
*/
|
||||||
@ -135,8 +124,6 @@ private:
|
|||||||
nsIDocument* FocusedDOMDocument() const;
|
nsIDocument* FocusedDOMDocument() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RefPtr<Accessible> mFocusedAcc;
|
|
||||||
ProxyAccessible* mFocusedProxy;
|
|
||||||
RefPtr<Accessible> mActiveItem;
|
RefPtr<Accessible> mActiveItem;
|
||||||
RefPtr<Accessible> mActiveARIAMenubar;
|
RefPtr<Accessible> mActiveARIAMenubar;
|
||||||
};
|
};
|
||||||
|
@ -1888,6 +1888,24 @@ DocAccessibleChild::RecvEmbeddedChildAt(const uint64_t& aID,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
DocAccessibleChild::RecvFocusedChild(const uint64_t& aID,
|
||||||
|
uint64_t* aChild,
|
||||||
|
bool* aOk)
|
||||||
|
{
|
||||||
|
*aChild = 0;
|
||||||
|
*aOk = false;
|
||||||
|
Accessible* acc = IdToAccessible(aID);
|
||||||
|
if (acc) {
|
||||||
|
Accessible* child = acc->FocusedChild();
|
||||||
|
if (child) {
|
||||||
|
*aChild = reinterpret_cast<uint64_t>(child->UniqueID());
|
||||||
|
*aOk = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DocAccessibleChild::RecvLanguage(const uint64_t& aID,
|
DocAccessibleChild::RecvLanguage(const uint64_t& aID,
|
||||||
nsString* aLocale)
|
nsString* aLocale)
|
||||||
|
@ -464,6 +464,10 @@ public:
|
|||||||
virtual bool RecvEmbeddedChildAt(const uint64_t& aID, const uint32_t& aIdx,
|
virtual bool RecvEmbeddedChildAt(const uint64_t& aID, const uint32_t& aIdx,
|
||||||
uint64_t* aChildID) override final;
|
uint64_t* aChildID) override final;
|
||||||
|
|
||||||
|
virtual bool RecvFocusedChild(const uint64_t& aID,
|
||||||
|
uint64_t* aChild,
|
||||||
|
bool* aOk) override;
|
||||||
|
|
||||||
virtual bool RecvLanguage(const uint64_t& aID, nsString* aLocale) override;
|
virtual bool RecvLanguage(const uint64_t& aID, nsString* aLocale) override;
|
||||||
virtual bool RecvDocType(const uint64_t& aID, nsString* aType) override;
|
virtual bool RecvDocType(const uint64_t& aID, nsString* aType) override;
|
||||||
virtual bool RecvTitle(const uint64_t& aID, nsString* aTitle) override;
|
virtual bool RecvTitle(const uint64_t& aID, nsString* aTitle) override;
|
||||||
|
@ -147,14 +147,6 @@ DocAccessibleParent::RecvEvent(const uint64_t& aID, const uint32_t& aEventType)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(aEventType) {
|
|
||||||
case nsIAccessibleEvent::EVENT_FOCUS:
|
|
||||||
FocusMgr()->RemoteFocusChanged(proxy);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ProxyEvent(proxy, aEventType);
|
ProxyEvent(proxy, aEventType);
|
||||||
|
|
||||||
if (!nsCoreUtils::AccEventObserversExist()) {
|
if (!nsCoreUtils::AccEventObserversExist()) {
|
||||||
|
@ -242,6 +242,8 @@ child:
|
|||||||
returns(uint32_t childIdx);
|
returns(uint32_t childIdx);
|
||||||
prio(high) sync EmbeddedChildAt(uint64_t aID, uint32_t aChildIdx)
|
prio(high) sync EmbeddedChildAt(uint64_t aID, uint32_t aChildIdx)
|
||||||
returns(uint64_t aChild);
|
returns(uint64_t aChild);
|
||||||
|
prio(high) sync FocusedChild(uint64_t aID)
|
||||||
|
returns(uint64_t aChild, bool aOk);
|
||||||
|
|
||||||
prio(high) sync Language(uint64_t aID) returns(nsString aLocale);
|
prio(high) sync Language(uint64_t aID) returns(nsString aLocale);
|
||||||
prio(high) sync DocType(uint64_t aID) returns(nsString aType);
|
prio(high) sync DocType(uint64_t aID) returns(nsString aType);
|
||||||
|
@ -1068,16 +1068,10 @@ ProxyAccessible::EmbeddedChildAt(size_t aChildIdx)
|
|||||||
ProxyAccessible*
|
ProxyAccessible*
|
||||||
ProxyAccessible::FocusedChild()
|
ProxyAccessible::FocusedChild()
|
||||||
{
|
{
|
||||||
ProxyAccessible* focus = FocusMgr()->FocusedRemoteAccessible();
|
uint64_t childID = 0;
|
||||||
if (IsDoc()) {
|
bool ok = false;
|
||||||
return focus;
|
Unused << mDoc->SendFocusedChild(mID, &childID, &ok);
|
||||||
}
|
return ok ? mDoc->GetAccessible(childID) : nullptr;
|
||||||
|
|
||||||
if (focus && (focus == this || focus->Parent() == this)) {
|
|
||||||
return focus;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProxyAccessible*
|
ProxyAccessible*
|
||||||
|
Loading…
Reference in New Issue
Block a user