mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 454211 - ISimpleDOMNode functions get_computedStyleForProperties and get_computedStyle functions appear to always return the COM error code 0x80004005 (E_FAIL), r=aaronlev, marcoz
This commit is contained in:
parent
b1553e0a7b
commit
c0b37d2110
@ -608,16 +608,17 @@ nsAccessNode::GetChildNodeAt(PRInt32 aChildNum, nsIAccessNode **aAccessNode)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessNode::GetComputedStyleValue(const nsAString& aPseudoElt, const nsAString& aPropertyName, nsAString& aValue)
|
||||
nsAccessNode::GetComputedStyleValue(const nsAString& aPseudoElt,
|
||||
const nsAString& aPropertyName,
|
||||
nsAString& aValue)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(mDOMNode));
|
||||
if (!domElement) {
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> styleDecl;
|
||||
GetComputedStyleDeclaration(aPseudoElt, domElement, getter_AddRefs(styleDecl));
|
||||
GetComputedStyleDeclaration(aPseudoElt, mDOMNode, getter_AddRefs(styleDecl));
|
||||
NS_ENSURE_TRUE(styleDecl, NS_ERROR_FAILURE);
|
||||
|
||||
|
||||
return styleDecl->GetPropertyValue(aPropertyName, aValue);
|
||||
}
|
||||
|
||||
@ -627,15 +628,13 @@ nsAccessNode::GetComputedStyleCSSValue(const nsAString& aPseudoElt,
|
||||
nsIDOMCSSPrimitiveValue **aCSSValue)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCSSValue);
|
||||
|
||||
*aCSSValue = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(mDOMNode));
|
||||
if (!domElement)
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> styleDecl;
|
||||
GetComputedStyleDeclaration(aPseudoElt, domElement,
|
||||
GetComputedStyleDeclaration(aPseudoElt, mDOMNode,
|
||||
getter_AddRefs(styleDecl));
|
||||
NS_ENSURE_STATE(styleDecl);
|
||||
|
||||
@ -646,28 +645,29 @@ nsAccessNode::GetComputedStyleCSSValue(const nsAString& aPseudoElt,
|
||||
return CallQueryInterface(cssValue, aCSSValue);
|
||||
}
|
||||
|
||||
void nsAccessNode::GetComputedStyleDeclaration(const nsAString& aPseudoElt,
|
||||
nsIDOMElement *aElement,
|
||||
nsIDOMCSSStyleDeclaration **aCssDecl)
|
||||
void
|
||||
nsAccessNode::GetComputedStyleDeclaration(const nsAString& aPseudoElt,
|
||||
nsIDOMNode *aNode,
|
||||
nsIDOMCSSStyleDeclaration **aCssDecl)
|
||||
{
|
||||
*aCssDecl = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> domElement = nsAccUtils::GetDOMElementFor(aNode);
|
||||
if (!domElement)
|
||||
return;
|
||||
|
||||
// Returns number of items in style declaration
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
|
||||
if (!content) {
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(domElement);
|
||||
nsCOMPtr<nsIDocument> doc = content->GetDocument();
|
||||
if (!doc) {
|
||||
if (!doc)
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMViewCSS> viewCSS(do_QueryInterface(doc->GetWindow()));
|
||||
if (!viewCSS) {
|
||||
if (!viewCSS)
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> cssDecl;
|
||||
viewCSS->GetComputedStyle(aElement, aPseudoElt, getter_AddRefs(cssDecl));
|
||||
viewCSS->GetComputedStyle(domElement, aPseudoElt, getter_AddRefs(cssDecl));
|
||||
NS_IF_ADDREF(*aCssDecl = cssDecl);
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ class nsAccessNode: public nsIAccessNode,
|
||||
static already_AddRefed<nsIPresShell> GetPresShellFor(nsIDOMNode *aStartNode);
|
||||
|
||||
static void GetComputedStyleDeclaration(const nsAString& aPseudoElt,
|
||||
nsIDOMElement *aElement,
|
||||
nsIDOMNode *aNode,
|
||||
nsIDOMCSSStyleDeclaration **aCssDecl);
|
||||
|
||||
already_AddRefed<nsRootAccessible> GetRootAccessible();
|
||||
|
@ -1138,10 +1138,12 @@ NS_IMETHODIMP nsHTMLTableAccessible::IsProbablyForLayout(PRBool *aIsProbablyForL
|
||||
for (PRInt32 rowCount = 0; rowCount < rows; rowCount ++) {
|
||||
nsCOMPtr<nsIDOMNode> rowNode;
|
||||
nodeList->Item(rowCount, getter_AddRefs(rowNode));
|
||||
nsCOMPtr<nsIDOMElement> rowElement = do_QueryInterface(rowNode);
|
||||
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> styleDecl;
|
||||
GetComputedStyleDeclaration(EmptyString(), rowElement, getter_AddRefs(styleDecl));
|
||||
GetComputedStyleDeclaration(EmptyString(), rowNode,
|
||||
getter_AddRefs(styleDecl));
|
||||
NS_ENSURE_TRUE(styleDecl, NS_ERROR_FAILURE);
|
||||
|
||||
lastRowColor = color;
|
||||
styleDecl->GetPropertyValue(NS_LITERAL_STRING("background-color"), color);
|
||||
if (rowCount > 0 && PR_FALSE == lastRowColor.Equals(color)) {
|
||||
|
@ -310,13 +310,13 @@ STDMETHODIMP nsAccessNodeWrap::get_computedStyle(
|
||||
/* [out] */ unsigned short __RPC_FAR *aNumStyleProperties)
|
||||
{
|
||||
__try{
|
||||
nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(mDOMNode));
|
||||
if (!domElement)
|
||||
return E_FAIL;
|
||||
|
||||
*aNumStyleProperties = 0;
|
||||
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> cssDecl;
|
||||
GetComputedStyleDeclaration(EmptyString(), domElement, getter_AddRefs(cssDecl));
|
||||
GetComputedStyleDeclaration(EmptyString(), mDOMNode, getter_AddRefs(cssDecl));
|
||||
NS_ENSURE_TRUE(cssDecl, E_FAIL);
|
||||
|
||||
PRUint32 length;
|
||||
@ -347,12 +347,11 @@ STDMETHODIMP nsAccessNodeWrap::get_computedStyleForProperties(
|
||||
/* [length_is][size_is][out] */ BSTR __RPC_FAR *aStyleValues)
|
||||
{
|
||||
__try {
|
||||
nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(mDOMNode));
|
||||
if (!domElement)
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> cssDecl;
|
||||
GetComputedStyleDeclaration(EmptyString(), domElement, getter_AddRefs(cssDecl));
|
||||
GetComputedStyleDeclaration(EmptyString(), mDOMNode, getter_AddRefs(cssDecl));
|
||||
NS_ENSURE_TRUE(cssDecl, E_FAIL);
|
||||
|
||||
PRUint32 index;
|
||||
|
@ -78,6 +78,7 @@ _TEST_FILES =\
|
||||
test_nsIAccessibleTable_3.html \
|
||||
test_nsIAccessibleTable_4.html \
|
||||
test_nsIAccessibleTable_listboxes.xul \
|
||||
test_nsIAccessNode_utils.html \
|
||||
test_nsOuterDocAccessible.html \
|
||||
test_textattrs.html \
|
||||
test_textboxes.html \
|
||||
|
@ -77,16 +77,16 @@ function getAccessible(aAccOrElmOrID, aInterfaces, aElmObj)
|
||||
acc = gAccRetrieval.getAccessibleFor(elm);
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
|
||||
if (!acc) {
|
||||
ok(false, "Can't get accessible for " + aID);
|
||||
ok(false, "Can't get accessible for " + aAccOrElmOrID);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!aInterfaces)
|
||||
return acc;
|
||||
|
||||
|
||||
if (aInterfaces instanceof Array) {
|
||||
for (var index = 0; index < aInterfaces.length; index++) {
|
||||
try {
|
||||
|
55
accessible/tests/mochitest/test_nsIAccessNode_utils.html
Normal file
55
accessible/tests/mochitest/test_nsIAccessNode_utils.html
Normal file
@ -0,0 +1,55 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>nsIAccessNode util methods testing</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function doTest()
|
||||
{
|
||||
var elmObj = {};
|
||||
var acc = getAccessible("span", [nsIAccessNode], elmObj);
|
||||
computedStyle = document.defaultView.getComputedStyle(elmObj.value, "");
|
||||
|
||||
// html:span element
|
||||
is(acc.getComputedStyleValue("", "color"), computedStyle.color,
|
||||
"Wrong color for element with ID 'span'");
|
||||
|
||||
// text child of html:span element
|
||||
acc = getAccessible(acc.firstChild, [nsIAccessNode]);
|
||||
is(acc.getComputedStyleValue("", "color"), computedStyle.color,
|
||||
"Wrong color for text child of element with ID 'span'");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(doTest);
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=454211"
|
||||
title="nsIAccessNode util methods testing">
|
||||
Mozilla Bug 454211
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<span role="description" style="color: red" id="span">text</span>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user