| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 , m_keyframes(o.m_keyframes) | 45 , m_keyframes(o.m_keyframes) |
| 46 , m_name(o.m_name) | 46 , m_name(o.m_name) |
| 47 , m_isPrefixed(o.m_isPrefixed) | 47 , m_isPrefixed(o.m_isPrefixed) |
| 48 { | 48 { |
| 49 } | 49 } |
| 50 | 50 |
| 51 StyleRuleKeyframes::~StyleRuleKeyframes() | 51 StyleRuleKeyframes::~StyleRuleKeyframes() |
| 52 { | 52 { |
| 53 } | 53 } |
| 54 | 54 |
| 55 void StyleRuleKeyframes::parserAppendKeyframe(PassRefPtr<StyleKeyframe> keyframe
) | 55 void StyleRuleKeyframes::parserAppendKeyframe(PassRefPtrWillBeRawPtr<StyleKeyfra
me> keyframe) |
| 56 { | 56 { |
| 57 if (!keyframe) | 57 if (!keyframe) |
| 58 return; | 58 return; |
| 59 m_keyframes.append(keyframe); | 59 m_keyframes.append(keyframe); |
| 60 } | 60 } |
| 61 | 61 |
| 62 void StyleRuleKeyframes::wrapperAppendKeyframe(PassRefPtr<StyleKeyframe> keyfram
e) | 62 void StyleRuleKeyframes::wrapperAppendKeyframe(PassRefPtrWillBeRawPtr<StyleKeyfr
ame> keyframe) |
| 63 { | 63 { |
| 64 m_keyframes.append(keyframe); | 64 m_keyframes.append(keyframe); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void StyleRuleKeyframes::wrapperRemoveKeyframe(unsigned index) | 67 void StyleRuleKeyframes::wrapperRemoveKeyframe(unsigned index) |
| 68 { | 68 { |
| 69 m_keyframes.remove(index); | 69 m_keyframes.remove(index); |
| 70 } | 70 } |
| 71 | 71 |
| 72 int StyleRuleKeyframes::findKeyframeIndex(const String& key) const | 72 int StyleRuleKeyframes::findKeyframeIndex(const String& key) const |
| 73 { | 73 { |
| 74 String percentageString; | 74 String percentageString; |
| 75 if (equalIgnoringCase(key, "from")) | 75 if (equalIgnoringCase(key, "from")) |
| 76 percentageString = "0%"; | 76 percentageString = "0%"; |
| 77 else if (equalIgnoringCase(key, "to")) | 77 else if (equalIgnoringCase(key, "to")) |
| 78 percentageString = "100%"; | 78 percentageString = "100%"; |
| 79 else | 79 else |
| 80 percentageString = key; | 80 percentageString = key; |
| 81 | 81 |
| 82 for (unsigned i = 0; i < m_keyframes.size(); ++i) { | 82 for (unsigned i = 0; i < m_keyframes.size(); ++i) { |
| 83 if (m_keyframes[i]->keyText() == percentageString) | 83 if (m_keyframes[i]->keyText() == percentageString) |
| 84 return i; | 84 return i; |
| 85 } | 85 } |
| 86 return -1; | 86 return -1; |
| 87 } | 87 } |
| 88 | 88 |
| 89 void StyleRuleKeyframes::traceAfterDispatch(Visitor* visitor) |
| 90 { |
| 91 visitor->trace(m_keyframes); |
| 92 StyleRuleBase::traceAfterDispatch(visitor); |
| 93 } |
| 94 |
| 89 CSSKeyframesRule::CSSKeyframesRule(StyleRuleKeyframes* keyframesRule, CSSStyleSh
eet* parent) | 95 CSSKeyframesRule::CSSKeyframesRule(StyleRuleKeyframes* keyframesRule, CSSStyleSh
eet* parent) |
| 90 : CSSRule(parent) | 96 : CSSRule(parent) |
| 91 , m_keyframesRule(keyframesRule) | 97 , m_keyframesRule(keyframesRule) |
| 92 , m_childRuleCSSOMWrappers(keyframesRule->keyframes().size()) | 98 , m_childRuleCSSOMWrappers(keyframesRule->keyframes().size()) |
| 93 , m_isPrefixed(keyframesRule->isVendorPrefixed()) | 99 , m_isPrefixed(keyframesRule->isVendorPrefixed()) |
| 94 { | 100 { |
| 95 } | 101 } |
| 96 | 102 |
| 97 CSSKeyframesRule::~CSSKeyframesRule() | 103 CSSKeyframesRule::~CSSKeyframesRule() |
| 98 { | 104 { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 112 m_keyframesRule->setName(name); | 118 m_keyframesRule->setName(name); |
| 113 } | 119 } |
| 114 | 120 |
| 115 void CSSKeyframesRule::insertRule(const String& ruleText) | 121 void CSSKeyframesRule::insertRule(const String& ruleText) |
| 116 { | 122 { |
| 117 ASSERT(m_childRuleCSSOMWrappers.size() == m_keyframesRule->keyframes().size(
)); | 123 ASSERT(m_childRuleCSSOMWrappers.size() == m_keyframesRule->keyframes().size(
)); |
| 118 | 124 |
| 119 CSSStyleSheet* styleSheet = parentStyleSheet(); | 125 CSSStyleSheet* styleSheet = parentStyleSheet(); |
| 120 CSSParserContext context(parserContext(), UseCounter::getFrom(styleSheet)); | 126 CSSParserContext context(parserContext(), UseCounter::getFrom(styleSheet)); |
| 121 BisonCSSParser parser(context); | 127 BisonCSSParser parser(context); |
| 122 RefPtr<StyleKeyframe> keyframe = parser.parseKeyframeRule(styleSheet ? style
Sheet->contents() : 0, ruleText); | 128 RefPtrWillBeRawPtr<StyleKeyframe> keyframe = parser.parseKeyframeRule(styleS
heet ? styleSheet->contents() : 0, ruleText); |
| 123 if (!keyframe) | 129 if (!keyframe) |
| 124 return; | 130 return; |
| 125 | 131 |
| 126 CSSStyleSheet::RuleMutationScope mutationScope(this); | 132 CSSStyleSheet::RuleMutationScope mutationScope(this); |
| 127 | 133 |
| 128 m_keyframesRule->wrapperAppendKeyframe(keyframe); | 134 m_keyframesRule->wrapperAppendKeyframe(keyframe); |
| 129 | 135 |
| 130 m_childRuleCSSOMWrappers.grow(length()); | 136 m_childRuleCSSOMWrappers.grow(length()); |
| 131 } | 137 } |
| 132 | 138 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 { | 214 { |
| 209 CSSRule::trace(visitor); | 215 CSSRule::trace(visitor); |
| 210 #if ENABLE(OILPAN) | 216 #if ENABLE(OILPAN) |
| 211 visitor->trace(m_childRuleCSSOMWrappers); | 217 visitor->trace(m_childRuleCSSOMWrappers); |
| 212 #endif | 218 #endif |
| 213 visitor->trace(m_keyframesRule); | 219 visitor->trace(m_keyframesRule); |
| 214 visitor->trace(m_ruleListCSSOMWrapper); | 220 visitor->trace(m_ruleListCSSOMWrapper); |
| 215 } | 221 } |
| 216 | 222 |
| 217 } // namespace WebCore | 223 } // namespace WebCore |
| OLD | NEW |