mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Backed out 3 changesets (bug 1796734) for causing multiple Accessible related test crashes. CLOSED TREE
Backed out changeset 871e7fe357a6 (bug 1796734) Backed out changeset 01e00626303a (bug 1796734) Backed out changeset cfb43833d08b (bug 1796734)
This commit is contained in:
parent
a1987e0653
commit
5563067d62
@ -77,6 +77,28 @@ Accessible* FocusManager::FocusedAccessible() const {
|
||||
return focusedDoc ? focusedDoc->GetFocusedAcc() : nullptr;
|
||||
}
|
||||
|
||||
bool FocusManager::IsFocused(const LocalAccessible* 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
|
||||
// FocusedLocalAccessible() 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 FocusManager::IsFocusWithin(const Accessible* aContainer) const {
|
||||
Accessible* child = FocusedAccessible();
|
||||
while (child) {
|
||||
|
@ -43,9 +43,7 @@ class FocusManager {
|
||||
/**
|
||||
* Return true if given accessible is focused.
|
||||
*/
|
||||
bool IsFocused(const Accessible* aAccessible) const {
|
||||
return FocusedAccessible() == aAccessible;
|
||||
}
|
||||
bool IsFocused(const LocalAccessible* aAccessible) const;
|
||||
|
||||
/**
|
||||
* Return true if the given accessible is an active item, i.e. an item that
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "nsAccUtils.h"
|
||||
#include "Relation.h"
|
||||
#include "States.h"
|
||||
#include "mozilla/a11y/FocusManager.h"
|
||||
#include "mozilla/a11y/HyperTextAccessibleBase.h"
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/Components.h"
|
||||
@ -492,10 +491,6 @@ nsAtom* Accessible::LandmarkRole() const {
|
||||
}
|
||||
|
||||
void Accessible::ApplyImplicitState(uint64_t& aState) const {
|
||||
if (FocusMgr()->IsFocused(this)) {
|
||||
aState |= states::FOCUSED;
|
||||
}
|
||||
|
||||
// If this is an ARIA item of the selectable widget and if it's focused and
|
||||
// not marked unselected explicitly (i.e. aria-selected="false") then expose
|
||||
// it as selected to make ARIA widget authors life easier.
|
||||
|
@ -492,25 +492,10 @@ void DocAccessible::Shutdown() {
|
||||
for (auto iter = mAccessibleCache.Iter(); !iter.Done(); iter.Next()) {
|
||||
LocalAccessible* accessible = iter.Data();
|
||||
MOZ_ASSERT(accessible);
|
||||
if (accessible) {
|
||||
// This might have been focused with FocusManager::ActiveItemChanged. In
|
||||
// that case, we must notify FocusManager so that it clears the active
|
||||
// item. Otherwise, it will hold on to a defunct Accessible. Normally,
|
||||
// this happens in UnbindFromDocument, but we don't call that when the
|
||||
// whole document shuts down.
|
||||
if (FocusMgr()->WasLastFocused(accessible)) {
|
||||
FocusMgr()->ActiveItemChanged(nullptr);
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eFocus)) {
|
||||
logging::ActiveItemChangeCausedBy("doc shutdown", accessible);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (!accessible->IsDefunct()) {
|
||||
// Unlink parent to avoid its cleaning overhead in shutdown.
|
||||
accessible->mParent = nullptr;
|
||||
accessible->Shutdown();
|
||||
}
|
||||
if (accessible && !accessible->IsDefunct()) {
|
||||
// Unlink parent to avoid its cleaning overhead in shutdown.
|
||||
accessible->mParent = nullptr;
|
||||
accessible->Shutdown();
|
||||
}
|
||||
iter.Remove();
|
||||
}
|
||||
|
@ -401,6 +401,7 @@ uint64_t LocalAccessible::NativeState() const {
|
||||
}
|
||||
|
||||
state |= NativeInteractiveState();
|
||||
if (FocusMgr()->IsFocused(this)) state |= states::FOCUSED;
|
||||
}
|
||||
|
||||
// Gather states::INVISIBLE and states::OFFSCREEN flags for this object.
|
||||
|
@ -1088,6 +1088,13 @@ uint64_t RemoteAccessibleBase<Derived>::State() {
|
||||
}
|
||||
}
|
||||
|
||||
auto* browser = static_cast<dom::BrowserParent*>(Document()->Manager());
|
||||
if (browser == dom::BrowserParent::GetFocused()) {
|
||||
if (this == Document()->GetFocusedAcc()) {
|
||||
state |= states::FOCUSED;
|
||||
}
|
||||
}
|
||||
|
||||
ApplyImplicitState(state);
|
||||
|
||||
auto* cbc = mDoc->GetBrowsingContext();
|
||||
|
@ -212,27 +212,6 @@ addAccessibleTask(
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Test caching of the focused state in iframes.
|
||||
*/
|
||||
addAccessibleTask(
|
||||
`
|
||||
<button id="button">button</button>
|
||||
`,
|
||||
async function(browser, iframeDocAcc, topDocAcc) {
|
||||
testStates(topDocAcc, STATE_FOCUSED);
|
||||
const button = findAccessibleChildByID(iframeDocAcc, "button");
|
||||
testStates(button, 0, 0, STATE_FOCUSED);
|
||||
let focused = waitForEvent(EVENT_FOCUS, button);
|
||||
info("Focusing button in iframe");
|
||||
button.takeFocus();
|
||||
await focused;
|
||||
testStates(topDocAcc, 0, 0, STATE_FOCUSED);
|
||||
testStates(button, STATE_FOCUSED);
|
||||
},
|
||||
{ topLevel: false, iframe: true, remoteIframe: true }
|
||||
);
|
||||
|
||||
function checkOpacity(acc, present) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
let [_, extraState] = getStates(acc);
|
||||
|
Loading…
Reference in New Issue
Block a user