OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2012 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 25 matching lines...) Expand all Loading... |
36 | 36 |
37 StyleRuleKeyframes::StyleRuleKeyframes() | 37 StyleRuleKeyframes::StyleRuleKeyframes() |
38 : StyleRuleBase(Keyframes) | 38 : StyleRuleBase(Keyframes) |
39 { | 39 { |
40 } | 40 } |
41 | 41 |
42 StyleRuleKeyframes::StyleRuleKeyframes(const StyleRuleKeyframes& o) | 42 StyleRuleKeyframes::StyleRuleKeyframes(const StyleRuleKeyframes& o) |
43 : StyleRuleBase(o) | 43 : StyleRuleBase(o) |
44 , m_keyframes(o.m_keyframes) | 44 , m_keyframes(o.m_keyframes) |
45 , m_name(o.m_name) | 45 , m_name(o.m_name) |
| 46 , m_isPrefixed(o.m_isPrefixed) |
46 { | 47 { |
47 } | 48 } |
48 | 49 |
49 StyleRuleKeyframes::~StyleRuleKeyframes() | 50 StyleRuleKeyframes::~StyleRuleKeyframes() |
50 { | 51 { |
51 } | 52 } |
52 | 53 |
53 void StyleRuleKeyframes::parserAppendKeyframe(PassRefPtr<StyleKeyframe> keyframe
) | 54 void StyleRuleKeyframes::parserAppendKeyframe(PassRefPtr<StyleKeyframe> keyframe
) |
54 { | 55 { |
55 if (!keyframe) | 56 if (!keyframe) |
(...skipping 25 matching lines...) Expand all Loading... |
81 if (m_keyframes[i]->keyText() == percentageString) | 82 if (m_keyframes[i]->keyText() == percentageString) |
82 return i; | 83 return i; |
83 } | 84 } |
84 return -1; | 85 return -1; |
85 } | 86 } |
86 | 87 |
87 CSSKeyframesRule::CSSKeyframesRule(StyleRuleKeyframes* keyframesRule, CSSStyleSh
eet* parent) | 88 CSSKeyframesRule::CSSKeyframesRule(StyleRuleKeyframes* keyframesRule, CSSStyleSh
eet* parent) |
88 : CSSRule(parent) | 89 : CSSRule(parent) |
89 , m_keyframesRule(keyframesRule) | 90 , m_keyframesRule(keyframesRule) |
90 , m_childRuleCSSOMWrappers(keyframesRule->keyframes().size()) | 91 , m_childRuleCSSOMWrappers(keyframesRule->keyframes().size()) |
| 92 , m_isPrefixed(keyframesRule->isVendorPrefixed()) |
91 { | 93 { |
92 } | 94 } |
93 | 95 |
94 CSSKeyframesRule::~CSSKeyframesRule() | 96 CSSKeyframesRule::~CSSKeyframesRule() |
95 { | 97 { |
96 ASSERT(m_childRuleCSSOMWrappers.size() == m_keyframesRule->keyframes().size(
)); | 98 ASSERT(m_childRuleCSSOMWrappers.size() == m_keyframesRule->keyframes().size(
)); |
97 | 99 |
98 for (unsigned i = 0; i < m_childRuleCSSOMWrappers.size(); ++i) { | 100 for (unsigned i = 0; i < m_childRuleCSSOMWrappers.size(); ++i) { |
99 if (m_childRuleCSSOMWrappers[i]) | 101 if (m_childRuleCSSOMWrappers[i]) |
100 m_childRuleCSSOMWrappers[i]->setParentRule(0); | 102 m_childRuleCSSOMWrappers[i]->setParentRule(0); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 146 |
145 CSSKeyframeRule* CSSKeyframesRule::findRule(const String& s) | 147 CSSKeyframeRule* CSSKeyframesRule::findRule(const String& s) |
146 { | 148 { |
147 int i = m_keyframesRule->findKeyframeIndex(s); | 149 int i = m_keyframesRule->findKeyframeIndex(s); |
148 return (i >= 0) ? item(i) : 0; | 150 return (i >= 0) ? item(i) : 0; |
149 } | 151 } |
150 | 152 |
151 String CSSKeyframesRule::cssText() const | 153 String CSSKeyframesRule::cssText() const |
152 { | 154 { |
153 StringBuilder result; | 155 StringBuilder result; |
154 result.append("@-webkit-keyframes "); | 156 if (isVendorPrefixed()) |
| 157 result.append("@-webkit-keyframes "); |
| 158 else |
| 159 result.append("@keyframes "); |
155 result.append(name()); | 160 result.append(name()); |
156 result.append(" { \n"); | 161 result.append(" { \n"); |
157 | 162 |
158 unsigned size = length(); | 163 unsigned size = length(); |
159 for (unsigned i = 0; i < size; ++i) { | 164 for (unsigned i = 0; i < size; ++i) { |
160 result.append(" "); | 165 result.append(" "); |
161 result.append(m_keyframesRule->keyframes()[i]->cssText()); | 166 result.append(m_keyframesRule->keyframes()[i]->cssText()); |
162 result.append("\n"); | 167 result.append("\n"); |
163 } | 168 } |
164 result.append("}"); | 169 result.append("}"); |
(...skipping 26 matching lines...) Expand all Loading... |
191 } | 196 } |
192 | 197 |
193 void CSSKeyframesRule::reattach(StyleRuleBase* rule) | 198 void CSSKeyframesRule::reattach(StyleRuleBase* rule) |
194 { | 199 { |
195 ASSERT(rule); | 200 ASSERT(rule); |
196 ASSERT_WITH_SECURITY_IMPLICATION(rule->isKeyframesRule()); | 201 ASSERT_WITH_SECURITY_IMPLICATION(rule->isKeyframesRule()); |
197 m_keyframesRule = static_cast<StyleRuleKeyframes*>(rule); | 202 m_keyframesRule = static_cast<StyleRuleKeyframes*>(rule); |
198 } | 203 } |
199 | 204 |
200 } // namespace WebCore | 205 } // namespace WebCore |
OLD | NEW |