Bug 1295852 - Part 2: Check for generated content containers correctly in Element.getAnimations(). r=boris

MozReview-Commit-ID: E6HkQED2ND8

--HG--
extra : rebase_source : 780677c7fddc2c69b89e3bfbbb99d88c57fe1a3e
This commit is contained in:
Cameron McCormack 2016-08-19 11:16:52 +08:00
Родитель 039ea8d7a5
Коммит ef76cd4cfc
3 изменённых файлов: 22 добавлений и 3 удалений

Просмотреть файл

@ -3436,11 +3436,10 @@ Element::GetAnimations(const AnimationFilter& filter,
CSSPseudoElementType pseudoType = CSSPseudoElementType::NotPseudo;
// For animations on generated-content elements, the animations are stored
// on the parent element.
nsIAtom* name = NodeInfo()->NameAtom();
if (name == nsGkAtoms::mozgeneratedcontentbefore) {
if (IsGeneratedContentContainerForBefore()) {
elem = GetParentElement();
pseudoType = CSSPseudoElementType::before;
} else if (name == nsGkAtoms::mozgeneratedcontentafter) {
} else if (IsGeneratedContentContainerForAfter()) {
elem = GetParentElement();
pseudoType = CSSPseudoElementType::after;
}

Просмотреть файл

@ -633,6 +633,7 @@ skip-if = buildapp == 'b2g'
[test_bug1268962.html]
[test_bug1274806.html]
[test_bug1281963.html]
[test_bug1295852.html]
[test_caretPositionFromPoint.html]
[test_change_policy.html]
skip-if = buildapp == 'b2g' #no ssl support

Просмотреть файл

@ -0,0 +1,19 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Bug 1295852</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
<body>
<script>
var names = [
"span", "_moz_generated_content_before", "_moz_generated_content_after"
];
names.forEach(name => {
var element = document.createElement(name);
element.animate({ "color": ["red", "blue"] }, { duration: 1000 });
is(element.getAnimations().length, 1);
});
</script>