зеркало из https://github.com/mozilla/gecko-dev.git
Bug 729831 - Don't expose CSS-based object attributes on not in tree accessible and accessible having no DOM element, r=marcoz
This commit is contained in:
Родитель
faacb3c669
Коммит
762ddc766a
|
@ -1450,6 +1450,23 @@ nsAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
||||||
if (!mContent->IsElement())
|
if (!mContent->IsElement())
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
|
// Expose draggable object attribute?
|
||||||
|
nsCOMPtr<nsIDOMHTMLElement> htmlElement = do_QueryInterface(mContent);
|
||||||
|
if (htmlElement) {
|
||||||
|
bool draggable = false;
|
||||||
|
htmlElement->GetDraggable(&draggable);
|
||||||
|
if (draggable) {
|
||||||
|
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::draggable,
|
||||||
|
NS_LITERAL_STRING("true"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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
|
||||||
|
// primary for node (like list bullet or XUL tree items).
|
||||||
|
if (!mContent->GetPrimaryFrame() || !IsPrimaryForNode())
|
||||||
|
return NS_OK;
|
||||||
|
|
||||||
// CSS style based object attributes.
|
// CSS style based object attributes.
|
||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
StyleInfo styleInfo(mContent->AsElement(), mDoc->PresShell());
|
StyleInfo styleInfo(mContent->AsElement(), mDoc->PresShell());
|
||||||
|
@ -1482,17 +1499,6 @@ nsAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
||||||
styleInfo.MarginBottom(value);
|
styleInfo.MarginBottom(value);
|
||||||
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::marginBottom, value);
|
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::marginBottom, value);
|
||||||
|
|
||||||
// Expose draggable object attribute?
|
|
||||||
nsCOMPtr<nsIDOMHTMLElement> htmlElement = do_QueryInterface(mContent);
|
|
||||||
if (htmlElement) {
|
|
||||||
bool draggable = false;
|
|
||||||
htmlElement->GetDraggable(&draggable);
|
|
||||||
if (draggable) {
|
|
||||||
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::draggable,
|
|
||||||
NS_LITERAL_STRING("true"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,23 @@ function testCSSAttrs(aID)
|
||||||
testAttrs(aID, attrs, true);
|
testAttrs(aID, attrs, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the accessible that it doesn't have CSS-based object attributes.
|
||||||
|
*/
|
||||||
|
function testAbsentCSSAttrs(aID)
|
||||||
|
{
|
||||||
|
var attrs = {
|
||||||
|
"display": "",
|
||||||
|
"text-align": "",
|
||||||
|
"text-indent": "",
|
||||||
|
"margin-left": "",
|
||||||
|
"margin-right": "",
|
||||||
|
"margin-top": "",
|
||||||
|
"margin-bottom": ""
|
||||||
|
};
|
||||||
|
testAbsentAttrs(aID, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test group object attributes (posinset, setsize and level) and
|
* Test group object attributes (posinset, setsize and level) and
|
||||||
* nsIAccessible::groupPosition() method.
|
* nsIAccessible::groupPosition() method.
|
||||||
|
|
|
@ -82,6 +82,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=689540
|
||||||
testCSSAttrs("tr");
|
testCSSAttrs("tr");
|
||||||
testCSSAttrs("td");
|
testCSSAttrs("td");
|
||||||
|
|
||||||
|
// no CSS-based object attributes
|
||||||
|
testAbsentCSSAttrs(getAccessible("listitem").firstChild);
|
||||||
|
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,6 +114,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=689540
|
||||||
title="Don't use GetComputedStyle for object attribute calculation">
|
title="Don't use GetComputedStyle for object attribute calculation">
|
||||||
Mozilla Bug 714579
|
Mozilla Bug 714579
|
||||||
</a>
|
</a>
|
||||||
|
<a target="_blank"
|
||||||
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=729831"
|
||||||
|
title="Don't expose CSS-based object attributes on not in tree accessible and accessible having no DOM element">
|
||||||
|
Mozilla Bug 729831
|
||||||
|
</a>
|
||||||
|
|
||||||
<p id="display"></p>
|
<p id="display"></p>
|
||||||
<div id="content" style="display: none"></div>
|
<div id="content" style="display: none"></div>
|
||||||
|
@ -189,5 +197,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=689540
|
||||||
<td id="td">td</td>
|
<td id="td">td</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li id="listitem">item
|
||||||
|
</ul>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче