Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(449)

Side by Side Diff: third_party/WebKit/Source/core/css/CSSKeyframesRule.cpp

Issue 2776203002: Migrate WTF::Vector::remove() to ::erase() (Closed)
Patch Set: rebase, repatch VectorTest Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 return; 52 return;
53 m_keyframes.push_back(keyframe); 53 m_keyframes.push_back(keyframe);
54 } 54 }
55 55
56 void StyleRuleKeyframes::wrapperAppendKeyframe(StyleRuleKeyframe* keyframe) { 56 void StyleRuleKeyframes::wrapperAppendKeyframe(StyleRuleKeyframe* keyframe) {
57 m_keyframes.push_back(keyframe); 57 m_keyframes.push_back(keyframe);
58 styleChanged(); 58 styleChanged();
59 } 59 }
60 60
61 void StyleRuleKeyframes::wrapperRemoveKeyframe(unsigned index) { 61 void StyleRuleKeyframes::wrapperRemoveKeyframe(unsigned index) {
62 m_keyframes.remove(index); 62 m_keyframes.erase(index);
63 styleChanged(); 63 styleChanged();
64 } 64 }
65 65
66 int StyleRuleKeyframes::findKeyframeIndex(const String& key) const { 66 int StyleRuleKeyframes::findKeyframeIndex(const String& key) const {
67 std::unique_ptr<Vector<double>> keys = CSSParser::parseKeyframeKeyList(key); 67 std::unique_ptr<Vector<double>> keys = CSSParser::parseKeyframeKeyList(key);
68 if (!keys) 68 if (!keys)
69 return -1; 69 return -1;
70 for (size_t i = m_keyframes.size(); i--;) { 70 for (size_t i = m_keyframes.size(); i--;) {
71 if (m_keyframes[i]->keys() == *keys) 71 if (m_keyframes[i]->keys() == *keys)
72 return i; 72 return i;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 int i = m_keyframesRule->findKeyframeIndex(s); 119 int i = m_keyframesRule->findKeyframeIndex(s);
120 if (i < 0) 120 if (i < 0)
121 return; 121 return;
122 122
123 CSSStyleSheet::RuleMutationScope mutationScope(this); 123 CSSStyleSheet::RuleMutationScope mutationScope(this);
124 124
125 m_keyframesRule->wrapperRemoveKeyframe(i); 125 m_keyframesRule->wrapperRemoveKeyframe(i);
126 126
127 if (m_childRuleCSSOMWrappers[i]) 127 if (m_childRuleCSSOMWrappers[i])
128 m_childRuleCSSOMWrappers[i]->setParentRule(0); 128 m_childRuleCSSOMWrappers[i]->setParentRule(0);
129 m_childRuleCSSOMWrappers.remove(i); 129 m_childRuleCSSOMWrappers.erase(i);
130 } 130 }
131 131
132 CSSKeyframeRule* CSSKeyframesRule::findRule(const String& s) { 132 CSSKeyframeRule* CSSKeyframesRule::findRule(const String& s) {
133 int i = m_keyframesRule->findKeyframeIndex(s); 133 int i = m_keyframesRule->findKeyframeIndex(s);
134 return (i >= 0) ? item(i) : nullptr; 134 return (i >= 0) ? item(i) : nullptr;
135 } 135 }
136 136
137 String CSSKeyframesRule::cssText() const { 137 String CSSKeyframesRule::cssText() const {
138 StringBuilder result; 138 StringBuilder result;
139 if (isVendorPrefixed()) 139 if (isVendorPrefixed())
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 195 }
196 196
197 DEFINE_TRACE(CSSKeyframesRule) { 197 DEFINE_TRACE(CSSKeyframesRule) {
198 CSSRule::trace(visitor); 198 CSSRule::trace(visitor);
199 visitor->trace(m_childRuleCSSOMWrappers); 199 visitor->trace(m_childRuleCSSOMWrappers);
200 visitor->trace(m_keyframesRule); 200 visitor->trace(m_keyframesRule);
201 visitor->trace(m_ruleListCSSOMWrapper); 201 visitor->trace(m_ruleListCSSOMWrapper);
202 } 202 }
203 203
204 } // namespace blink 204 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSGroupingRule.cpp ('k') | third_party/WebKit/Source/core/css/CSSStyleSheet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698