WebKitCSSKeyframeRule.style.parentRule should point to the keyframe rule.
<http://webkit.org/b/75336>
Reviewed by Antti Koivisto.
Source/WebCore:
Let CSS animation keyframe rules .style.parentRule point back to the keyframe
board, rather than the keyframes rule containing it.
Test: fast/css/css-keyframe-style-parentRule.html
* css/CSSParser.cpp:
(WebCore::CSSParser::createKeyframeRule):
* css/WebKitCSSKeyframeRule.cpp:
(WebCore::WebKitCSSKeyframeRule::setDeclaration):
Set the CSSMutableStyleDeclaration's parent rule when creating it instead
of in WebKitCSSKeyframeRule::setDeclaration(). Add assertion to make sure
it's only called with declarations already parented to the keyframe rule.
* css/WebKitCSSKeyframesRule.cpp:
(WebCore::WebKitCSSKeyframesRule::~WebKitCSSKeyframesRule):
(WebCore::WebKitCSSKeyframesRule::append):
(WebCore::WebKitCSSKeyframesRule::deleteRule):
Stop reparenting keyframe rules' style declarations to the keyframes rule.
LayoutTests:
* fast/css/css-keyframe-style-parentRule-expected.txt: Added.
* fast/css/css-keyframe-style-parentRule.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@103844 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/fast/css/css-keyframe-style-parentRule.html b/LayoutTests/fast/css/css-keyframe-style-parentRule.html
new file mode 100644
index 0000000..89e7416
--- /dev/null
+++ b/LayoutTests/fast/css/css-keyframe-style-parentRule.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../js/resources/js-test-pre.js"></script>
+<style>
+ @-webkit-keyframes anim {
+ from {
+ color: green;
+ }
+ }
+</style>
+</head>
+<body>
+<script>
+
+description("This test verifies that a keyframe rule's 'parentRule' points back to the keyframe rule.");
+
+var rules = document.styleSheets[1].cssRules;
+
+shouldBe("rules[0][0].parentRule", "rules[0]");
+shouldBe("rules[0][0].style.parentRule", "rules[0][0]");
+
+</script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>