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

Side by Side Diff: third_party/WebKit/Source/core/animation/EffectInput.cpp

Issue 1867803002: Add use counters for function values of easing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and update UseCounters again Created 4 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 } 189 }
190 190
191 String compositeString; 191 String compositeString;
192 DictionaryHelper::get(keyframeDictionary, "composite", compositeString); 192 DictionaryHelper::get(keyframeDictionary, "composite", compositeString);
193 if (compositeString == "add") 193 if (compositeString == "add")
194 keyframe->setComposite(EffectModel::CompositeAdd); 194 keyframe->setComposite(EffectModel::CompositeAdd);
195 // TODO(alancutter): Support "accumulate" keyframe composition. 195 // TODO(alancutter): Support "accumulate" keyframe composition.
196 196
197 String timingFunctionString; 197 String timingFunctionString;
198 if (DictionaryHelper::get(keyframeDictionary, "easing", timingFunctionSt ring)) { 198 if (DictionaryHelper::get(keyframeDictionary, "easing", timingFunctionSt ring)) {
199 if (RefPtr<TimingFunction> timingFunction = AnimationInputHelpers::p arseTimingFunction(timingFunctionString)) 199 if (RefPtr<TimingFunction> timingFunction = AnimationInputHelpers::p arseTimingFunction(timingFunctionString, &element.document()))
200 keyframe->setEasing(timingFunction); 200 keyframe->setEasing(timingFunction);
201 } 201 }
202 202
203 Vector<String> keyframeProperties; 203 Vector<String> keyframeProperties;
204 keyframeDictionary.getPropertyNames(keyframeProperties); 204 keyframeDictionary.getPropertyNames(keyframeProperties);
205 for (const auto& property : keyframeProperties) { 205 for (const auto& property : keyframeProperties) {
206 if (property == "offset" 206 if (property == "offset"
207 || property == "composite" 207 || property == "composite"
208 || property == "easing") { 208 || property == "easing") {
209 continue; 209 continue;
(...skipping 20 matching lines...) Expand all
230 } 230 }
231 231
232 EffectModel* EffectInput::convertObjectForm(Element& element, const Dictionary& keyframeDictionary, ExceptionState& exceptionState) 232 EffectModel* EffectInput::convertObjectForm(Element& element, const Dictionary& keyframeDictionary, ExceptionState& exceptionState)
233 { 233 {
234 StringKeyframeVector keyframes; 234 StringKeyframeVector keyframes;
235 bool encounteredCompositableProperty = false; 235 bool encounteredCompositableProperty = false;
236 236
237 String timingFunctionString; 237 String timingFunctionString;
238 RefPtr<TimingFunction> timingFunction = nullptr; 238 RefPtr<TimingFunction> timingFunction = nullptr;
239 if (DictionaryHelper::get(keyframeDictionary, "easing", timingFunctionString )) 239 if (DictionaryHelper::get(keyframeDictionary, "easing", timingFunctionString ))
240 timingFunction = AnimationInputHelpers::parseTimingFunction(timingFuncti onString); 240 timingFunction = AnimationInputHelpers::parseTimingFunction(timingFuncti onString, &element.document());
241 241
242 ScriptValue scriptValue; 242 ScriptValue scriptValue;
243 bool frameHasOffset = DictionaryHelper::get(keyframeDictionary, "offset", sc riptValue) && !scriptValue.isNull(); 243 bool frameHasOffset = DictionaryHelper::get(keyframeDictionary, "offset", sc riptValue) && !scriptValue.isNull();
244 double offset = 0.0; 244 double offset = 0.0;
245 if (frameHasOffset && !getAndCheckOffset(keyframeDictionary, offset, 0.0, ex ceptionState)) 245 if (frameHasOffset && !getAndCheckOffset(keyframeDictionary, offset, 0.0, ex ceptionState))
246 return nullptr; 246 return nullptr;
247 247
248 String compositeString; 248 String compositeString;
249 DictionaryHelper::get(keyframeDictionary, "composite", compositeString); 249 DictionaryHelper::get(keyframeDictionary, "composite", compositeString);
250 250
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 keyframes.append(keyframe); 287 keyframes.append(keyframe);
288 } 288 }
289 } 289 }
290 290
291 std::sort(keyframes.begin(), keyframes.end(), compareKeyframes); 291 std::sort(keyframes.begin(), keyframes.end(), compareKeyframes);
292 292
293 return createEffectModelFromKeyframes(element, keyframes, encounteredComposi tableProperty, exceptionState); 293 return createEffectModelFromKeyframes(element, keyframes, encounteredComposi tableProperty, exceptionState);
294 } 294 }
295 295
296 } // namespace blink 296 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698