зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1686839 - Apply MustPrune dynamically and not at creation time. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D101853
This commit is contained in:
Родитель
3f05d24fad
Коммит
720902efa2
|
@ -71,17 +71,10 @@ mozAccessible* AccessibleWrap::GetNativeObject() {
|
|||
// We don't creat OSX accessibles for xul tooltips, defunct accessibles,
|
||||
// <br> (whitespace) elements, or pruned children.
|
||||
//
|
||||
// We also don't create a native object if we're child of a "flat"
|
||||
// accessible; for example, on OS X buttons shouldn't have any children,
|
||||
// because that makes the OS confused.
|
||||
//
|
||||
// To maintain a scripting environment where the XPCOM accessible hierarchy
|
||||
// look the same on all platforms, we still let the C++ objects be created
|
||||
// though.
|
||||
Accessible* parent = Parent();
|
||||
bool mustBePruned = parent && nsAccUtils::MustPrune(parent);
|
||||
if (!IsXULTooltip() && !IsDefunct() && !mustBePruned &&
|
||||
Role() != roles::WHITESPACE) {
|
||||
if (!IsXULTooltip() && !IsDefunct() && Role() != roles::WHITESPACE) {
|
||||
mNativeObject = [[GetNativeType() alloc] initWithAccessible:this];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,9 +41,7 @@ void PlatformInit() {}
|
|||
void PlatformShutdown() {}
|
||||
|
||||
void ProxyCreated(ProxyAccessible* aProxy, uint32_t) {
|
||||
ProxyAccessible* parent = aProxy->Parent();
|
||||
if ((parent && nsAccUtils::MustPrune(parent)) ||
|
||||
aProxy->Role() == roles::WHITESPACE) {
|
||||
if (aProxy->Role() == roles::WHITESPACE) {
|
||||
// We don't create a native object if we're child of a "flat" accessible;
|
||||
// for example, on OS X buttons shouldn't have any children, because that
|
||||
// makes the OS confused. We also don't create accessibles for <br>
|
||||
|
|
|
@ -96,7 +96,7 @@ using namespace mozilla::a11y;
|
|||
}
|
||||
|
||||
- (BOOL)moxIgnoreChild:(mozAccessible*)child {
|
||||
return NO;
|
||||
return nsAccUtils::MustPrune(mGeckoAccessible);
|
||||
}
|
||||
|
||||
- (id)childAt:(uint32_t)i {
|
||||
|
|
|
@ -27,3 +27,49 @@ addAccessibleTask(
|
|||
is(index, 1, "link is second child");
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Test textbox with more than one child
|
||||
*/
|
||||
addAccessibleTask(
|
||||
`<div id="textbox" role="textbox">Hello <a href="#">strange</a> world</div>`,
|
||||
(browser, accDoc) => {
|
||||
let textbox = getNativeInterface(accDoc, "textbox");
|
||||
|
||||
is(
|
||||
textbox.getAttributeValue("AXChildren").length,
|
||||
3,
|
||||
"textbox has 3 children"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Test textbox with one child
|
||||
*/
|
||||
addAccessibleTask(
|
||||
`<div id="textbox" role="textbox">Hello </div>`,
|
||||
async (browser, accDoc) => {
|
||||
let textbox = getNativeInterface(accDoc, "textbox");
|
||||
|
||||
is(
|
||||
textbox.getAttributeValue("AXChildren").length,
|
||||
0,
|
||||
"textbox with one child is pruned"
|
||||
);
|
||||
|
||||
let reorder = waitForEvent(EVENT_REORDER, "textbox");
|
||||
await SpecialPowers.spawn(browser, [], () => {
|
||||
let link = content.document.createElement("a");
|
||||
link.textContent = "World";
|
||||
content.document.getElementById("textbox").appendChild(link);
|
||||
});
|
||||
await reorder;
|
||||
|
||||
is(
|
||||
textbox.getAttributeValue("AXChildren").length,
|
||||
2,
|
||||
"textbox with two child is not pruned"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
|
Загрузка…
Ссылка в новой задаче