Title: [103844] trunk
Revision
103844
Author
kl...@webkit.org
Date
2011-12-30 09:32:12 -0800 (Fri, 30 Dec 2011)

Log Message

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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (103843 => 103844)


--- trunk/LayoutTests/ChangeLog	2011-12-30 17:01:20 UTC (rev 103843)
+++ trunk/LayoutTests/ChangeLog	2011-12-30 17:32:12 UTC (rev 103844)
@@ -1,3 +1,13 @@
+2011-12-30  Andreas Kling  <awesomekl...@apple.com>
+
+        WebKitCSSKeyframeRule.style.parentRule should point to the keyframe rule.
+        <http://webkit.org/b/75336>
+
+        Reviewed by Antti Koivisto.
+
+        * fast/css/css-keyframe-style-parentRule-expected.txt: Added.
+        * fast/css/css-keyframe-style-parentRule.html: Added.
+
 2011-12-30  Mikhail Naganov  <mnaga...@chromium.org>
 
         [Chromium] Unreviewed test expectations change for nested-reflection tests.

Added: trunk/LayoutTests/fast/css/css-keyframe-style-parentRule-expected.txt (0 => 103844)


--- trunk/LayoutTests/fast/css/css-keyframe-style-parentRule-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/css-keyframe-style-parentRule-expected.txt	2011-12-30 17:32:12 UTC (rev 103844)
@@ -0,0 +1,11 @@
+This test verifies that a keyframe rule's 'parentRule' points back to the keyframe rule.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS rules[0][0].parentRule is rules[0]
+PASS rules[0][0].style.parentRule is rules[0][0]
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/css/css-keyframe-style-parentRule.html (0 => 103844)


--- trunk/LayoutTests/fast/css/css-keyframe-style-parentRule.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/css-keyframe-style-parentRule.html	2011-12-30 17:32:12 UTC (rev 103844)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+<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=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (103843 => 103844)


--- trunk/Source/WebCore/ChangeLog	2011-12-30 17:01:20 UTC (rev 103843)
+++ trunk/Source/WebCore/ChangeLog	2011-12-30 17:32:12 UTC (rev 103844)
@@ -1,3 +1,31 @@
+2011-12-30  Andreas Kling  <awesomekl...@apple.com>
+
+        WebKitCSSKeyframeRule.style.parentRule should point to the keyframe rule.
+        <http://webkit.org/b/75336>
+
+        Reviewed by Antti Koivisto.
+
+        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.
+
 2011-12-30  Yury Semikhatsky  <yu...@chromium.org>
 
         Web Inspector: use typed front-end API in the memory agent

Modified: trunk/Source/WebCore/css/CSSParser.cpp (103843 => 103844)


--- trunk/Source/WebCore/css/CSSParser.cpp	2011-12-30 17:01:20 UTC (rev 103843)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2011-12-30 17:32:12 UTC (rev 103844)
@@ -7829,7 +7829,7 @@
 
     RefPtr<WebKitCSSKeyframeRule> keyframe = WebKitCSSKeyframeRule::create(m_styleSheet);
     keyframe->setKeyText(keyString);
-    keyframe->setDeclaration(CSSMutableStyleDeclaration::create(0, m_parsedProperties, m_numParsedProperties));
+    keyframe->setDeclaration(CSSMutableStyleDeclaration::create(keyframe.get(), m_parsedProperties, m_numParsedProperties));
 
     clearProperties();
 

Modified: trunk/Source/WebCore/css/WebKitCSSKeyframeRule.cpp (103843 => 103844)


--- trunk/Source/WebCore/css/WebKitCSSKeyframeRule.cpp	2011-12-30 17:01:20 UTC (rev 103843)
+++ trunk/Source/WebCore/css/WebKitCSSKeyframeRule.cpp	2011-12-30 17:32:12 UTC (rev 103844)
@@ -54,8 +54,8 @@
 
 void WebKitCSSKeyframeRule::setDeclaration(PassRefPtr<CSSMutableStyleDeclaration> style)
 {
+    ASSERT(style->parentRule() == this);
     m_style = style;
-    m_style->setParentRule(this);
 }
 
 /* static */

Modified: trunk/Source/WebCore/css/WebKitCSSKeyframesRule.cpp (103843 => 103844)


--- trunk/Source/WebCore/css/WebKitCSSKeyframesRule.cpp	2011-12-30 17:01:20 UTC (rev 103843)
+++ trunk/Source/WebCore/css/WebKitCSSKeyframesRule.cpp	2011-12-30 17:32:12 UTC (rev 103844)
@@ -44,8 +44,6 @@
 {
     for (unsigned i = 0; i < length(); ++i) {
         WebKitCSSKeyframeRule* rule = item(i);
-        if (CSSMutableStyleDeclaration* style = rule->style())
-            style->setParentRule(0);
         rule->setParentRule(0);
     }
 }
@@ -81,9 +79,6 @@
 
     m_lstCSSRules->append(rule);
     rule->setParentRule(this);
-
-    if (CSSMutableStyleDeclaration* style = rule->style())
-        style->setParentRule(this);
 }
 
 void WebKitCSSKeyframesRule::insertRule(const String& rule)
@@ -101,9 +96,6 @@
         return;
 
     WebKitCSSKeyframeRule* rule = item(i);
-    if (CSSMutableStyleDeclaration* style = rule->style())
-        style->setParentRule(0);
-
     rule->setParentRule(0);
     m_lstCSSRules->deleteRule(i);
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to