OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 81 } |
82 | 82 |
83 const WebKitCSSKeyframeRule* WebKitCSSKeyframesRule::item(unsigned index) const | 83 const WebKitCSSKeyframeRule* WebKitCSSKeyframesRule::item(unsigned index) const |
84 { | 84 { |
85 CSSRule* rule = m_lstCSSRules.get()->item(index); | 85 CSSRule* rule = m_lstCSSRules.get()->item(index); |
86 return (rule && rule->isKeyframeRule()) ? static_cast<const WebKitCSSKeyfram
eRule*>(rule) : 0; | 86 return (rule && rule->isKeyframeRule()) ? static_cast<const WebKitCSSKeyfram
eRule*>(rule) : 0; |
87 } | 87 } |
88 | 88 |
89 void WebKitCSSKeyframesRule::append(WebKitCSSKeyframeRule* rule) | 89 void WebKitCSSKeyframesRule::append(WebKitCSSKeyframeRule* rule) |
90 { | 90 { |
91 m_lstCSSRules.get()->append(rule); | 91 if (!rule) |
| 92 return; |
| 93 |
| 94 m_lstCSSRules->append(rule); |
| 95 rule->setParent(this); |
| 96 |
| 97 if (CSSMutableStyleDeclaration* style = rule->style()) |
| 98 style->setParent(this); |
92 } | 99 } |
93 | 100 |
94 void WebKitCSSKeyframesRule::insertRule(const String& rule) | 101 void WebKitCSSKeyframesRule::insertRule(const String& rule) |
95 { | 102 { |
96 CSSParser p(useStrictParsing()); | 103 CSSParser p(useStrictParsing()); |
97 RefPtr<CSSRule> newRule = p.parseKeyframeRule(parentStyleSheet(), rule); | 104 RefPtr<CSSRule> newRule = p.parseKeyframeRule(parentStyleSheet(), rule); |
98 if (newRule.get() && newRule.get()->isKeyframeRule()) | 105 if (newRule.get() && newRule.get()->isKeyframeRule()) |
99 append(static_cast<WebKitCSSKeyframeRule*>(newRule.get())); | 106 append(static_cast<WebKitCSSKeyframeRule*>(newRule.get())); |
100 } | 107 } |
101 | 108 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 result += m_lstCSSRules->item(i)->cssText(); | 150 result += m_lstCSSRules->item(i)->cssText(); |
144 result += "\n"; | 151 result += "\n"; |
145 } | 152 } |
146 } | 153 } |
147 | 154 |
148 result += "}"; | 155 result += "}"; |
149 return result; | 156 return result; |
150 } | 157 } |
151 | 158 |
152 } // namespace WebCore | 159 } // namespace WebCore |
OLD | NEW |