mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 736059 - do some cleanups of nsAccessible::GetAttributesInternal, r=tbsaunde
This commit is contained in:
parent
724c186aec
commit
cd624df4bc
@ -1352,17 +1352,13 @@ nsAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
|
|||||||
nsresult
|
nsresult
|
||||||
nsAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
nsAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
||||||
{
|
{
|
||||||
|
// Don't calculate content based object attributes for not primary for the
|
||||||
|
// DOM node accessible (like list bullet or XUL tree items).
|
||||||
|
if (!IsPrimaryForNode())
|
||||||
|
return NS_OK;
|
||||||
|
|
||||||
// Attributes set by this method will not be used to override attributes on a sub-document accessible
|
// Attributes set by this method will not be used to override attributes on a sub-document accessible
|
||||||
// when there is a <frame>/<iframe> element that spawned the sub-document
|
// when there is a <frame>/<iframe> element that spawned the sub-document
|
||||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mContent));
|
|
||||||
|
|
||||||
nsAutoString tagName;
|
|
||||||
element->GetTagName(tagName);
|
|
||||||
if (!tagName.IsEmpty()) {
|
|
||||||
nsAutoString oldValueUnused;
|
|
||||||
aAttributes->SetStringProperty(NS_LITERAL_CSTRING("tag"), tagName,
|
|
||||||
oldValueUnused);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsEventShell::GetEventAttributes(GetNode(), aAttributes);
|
nsEventShell::GetEventAttributes(GetNode(), aAttributes);
|
||||||
|
|
||||||
@ -1378,12 +1374,13 @@ nsAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
|||||||
// The inner nodes can be used to override live region behavior on more general outer nodes
|
// The inner nodes can be used to override live region behavior on more general outer nodes
|
||||||
// However, nodes in outer documents override nodes in inner documents:
|
// However, nodes in outer documents override nodes in inner documents:
|
||||||
// Outer doc author may want to override properties on a widget they used in an iframe
|
// Outer doc author may want to override properties on a widget they used in an iframe
|
||||||
nsIContent *startContent = mContent;
|
nsIContent* startContent = mContent;
|
||||||
while (true) {
|
while (startContent) {
|
||||||
NS_ENSURE_STATE(startContent);
|
nsIDocument* doc = startContent->GetDocument();
|
||||||
nsIDocument *doc = startContent->GetDocument();
|
|
||||||
nsIContent* rootContent = nsCoreUtils::GetRoleContent(doc);
|
nsIContent* rootContent = nsCoreUtils::GetRoleContent(doc);
|
||||||
NS_ENSURE_STATE(rootContent);
|
if (!rootContent)
|
||||||
|
return NS_OK;
|
||||||
|
|
||||||
nsAccUtils::SetLiveContainerAttributes(aAttributes, startContent,
|
nsAccUtils::SetLiveContainerAttributes(aAttributes, startContent,
|
||||||
rootContent);
|
rootContent);
|
||||||
|
|
||||||
@ -1409,6 +1406,11 @@ nsAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
|||||||
if (!mContent->IsElement())
|
if (!mContent->IsElement())
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
|
// Expose tag.
|
||||||
|
nsAutoString tagName;
|
||||||
|
mContent->NodeInfo()->GetName(tagName);
|
||||||
|
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::tag, tagName);
|
||||||
|
|
||||||
// Expose draggable object attribute?
|
// Expose draggable object attribute?
|
||||||
nsCOMPtr<nsIDOMHTMLElement> htmlElement = do_QueryInterface(mContent);
|
nsCOMPtr<nsIDOMHTMLElement> htmlElement = do_QueryInterface(mContent);
|
||||||
if (htmlElement) {
|
if (htmlElement) {
|
||||||
@ -1421,9 +1423,8 @@ nsAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Don't calculate CSS-based object attributes when no frame (i.e.
|
// Don't calculate CSS-based object attributes when no frame (i.e.
|
||||||
// the accessible is not unattached form three) or when the accessible is not
|
// the accessible is unattached from the three).
|
||||||
// primary for node (like list bullet or XUL tree items).
|
if (!mContent->GetPrimaryFrame())
|
||||||
if (!mContent->GetPrimaryFrame() || !IsPrimaryForNode())
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
// CSS style based object attributes.
|
// CSS style based object attributes.
|
||||||
|
@ -105,6 +105,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
|
|||||||
}
|
}
|
||||||
testAttrs(getApplicationAccessible(), attrs, false);
|
testAttrs(getApplicationAccessible(), attrs, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// no object attributes
|
||||||
|
testAbsentAttrs(getAccessible("listitem").firstChild, { "tag": "" });
|
||||||
|
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,5 +197,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
|
|||||||
<th id="th2" abbr="SS#" axis="social">Social Security Number</th>
|
<th id="th2" abbr="SS#" axis="social">Social Security Number</th>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li id="listitem">item
|
||||||
|
</ul>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
<html>
|
<html>
|
||||||
<!--
|
|
||||||
https://bugzilla.mozilla.org/show_bug.cgi?id=439566
|
|
||||||
https://bugzilla.mozilla.org/show_bug.cgi?id=460932
|
|
||||||
https://bugzilla.mozilla.org/show_bug.cgi?id=689540
|
|
||||||
-->
|
|
||||||
<head>
|
<head>
|
||||||
<title>CSS-like attributes tests</title>
|
<title>CSS-like attributes tests</title>
|
||||||
<link rel="stylesheet" type="text/css"
|
<link rel="stylesheet" type="text/css"
|
||||||
@ -16,8 +11,37 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=689540
|
|||||||
src="../common.js"></script>
|
src="../common.js"></script>
|
||||||
<script type="application/javascript"
|
<script type="application/javascript"
|
||||||
src="../attributes.js"></script>
|
src="../attributes.js"></script>
|
||||||
|
<script type="application/javascript"
|
||||||
|
src="../events.js"></script>
|
||||||
|
|
||||||
<script type="application/javascript">
|
<script type="application/javascript">
|
||||||
|
var gQueue = null;
|
||||||
|
|
||||||
|
function removeElm(aID)
|
||||||
|
{
|
||||||
|
this.node = getNode(aID);
|
||||||
|
this.accessible = getAccessible(aID);
|
||||||
|
|
||||||
|
this.eventSeq = [
|
||||||
|
new invokerChecker(EVENT_HIDE, this.accessible)
|
||||||
|
];
|
||||||
|
|
||||||
|
this.invoke = function removeElm_invoke()
|
||||||
|
{
|
||||||
|
this.node.parentNode.removeChild(this.node);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.check = function removeElm_check()
|
||||||
|
{
|
||||||
|
testAbsentCSSAttrs(this.accessible);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getID = function removeElm_getID()
|
||||||
|
{
|
||||||
|
return "test CSS-based attributes on removed accessible";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function doTest()
|
function doTest()
|
||||||
{
|
{
|
||||||
// CSS display
|
// CSS display
|
||||||
@ -85,7 +109,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=689540
|
|||||||
// no CSS-based object attributes
|
// no CSS-based object attributes
|
||||||
testAbsentCSSAttrs(getAccessible("listitem").firstChild);
|
testAbsentCSSAttrs(getAccessible("listitem").firstChild);
|
||||||
|
|
||||||
SimpleTest.finish();
|
gQueue = new eventQueue();
|
||||||
|
gQueue.push(new removeElm("div"));
|
||||||
|
gQueue.invoke(); // SimpleTest.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
@ -34,12 +34,12 @@
|
|||||||
testAttrs("main", {"xml-roles" : "main"}, true); // ARIA override
|
testAttrs("main", {"xml-roles" : "main"}, true); // ARIA override
|
||||||
|
|
||||||
// And some AT may look for this
|
// And some AT may look for this
|
||||||
testAttrs("nav", {"tag" : "NAV"}, true);
|
testAttrs("nav", {"tag" : "nav"}, true);
|
||||||
testAttrs("header", {"tag" : "HEADER"}, true);
|
testAttrs("header", {"tag" : "header"}, true);
|
||||||
testAttrs("footer", {"tag" : "FOOTER"}, true);
|
testAttrs("footer", {"tag" : "footer"}, true);
|
||||||
testAttrs("article", {"tag" : "ARTICLE"}, true);
|
testAttrs("article", {"tag" : "article"}, true);
|
||||||
testAttrs("aside", {"tag" : "ASIDE"}, true);
|
testAttrs("aside", {"tag" : "aside"}, true);
|
||||||
testAttrs("main", {"tag" : "ARTICLE"}, true); // no override expected
|
testAttrs("main", {"tag" : "article"}, true); // no override expected
|
||||||
|
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=441737
|
|||||||
|
|
||||||
// attributes should contain tag:body
|
// attributes should contain tag:body
|
||||||
attributes = docAcc.attributes;
|
attributes = docAcc.attributes;
|
||||||
is(attributes.getStringProperty("tag"), "BODY",
|
is(attributes.getStringProperty("tag"), "body",
|
||||||
"Wrong attribute on document!");
|
"Wrong attribute on document!");
|
||||||
|
|
||||||
// nsIAccessibleDocument
|
// nsIAccessibleDocument
|
||||||
|
Loading…
Reference in New Issue
Block a user