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

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

Issue 2228313002: Make a function to query whether a CSSPropertyID is valid and whether it has a name. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@asan
Patch Set: Revert spurious change Created 4 years, 2 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // The last keyframe specified at a given offset is used. 122 // The last keyframe specified at a given offset is used.
123 for (size_t j = 1; j < offsets.size(); ++j) { 123 for (size_t j = 1; j < offsets.size(); ++j) {
124 keyframes.append( 124 keyframes.append(
125 toStringKeyframe(keyframe->cloneWithOffset(offsets[j]).get())); 125 toStringKeyframe(keyframe->cloneWithOffset(offsets[j]).get()));
126 } 126 }
127 } 127 }
128 128
129 DEFINE_STATIC_LOCAL(SparseHistogram, propertyHistogram, 129 DEFINE_STATIC_LOCAL(SparseHistogram, propertyHistogram,
130 ("WebCore.Animation.CSSProperties")); 130 ("WebCore.Animation.CSSProperties"));
131 for (CSSPropertyID property : specifiedPropertiesForUseCounter) { 131 for (CSSPropertyID property : specifiedPropertiesForUseCounter) {
132 DCHECK_NE(property, CSSPropertyInvalid); 132 DCHECK(isValidCSSPropertyID(property));
133 propertyHistogram.sample( 133 propertyHistogram.sample(
134 UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(property)); 134 UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(property));
135 } 135 }
136 136
137 // Merge duplicate keyframes. 137 // Merge duplicate keyframes.
138 std::stable_sort(keyframes.begin(), keyframes.end(), 138 std::stable_sort(keyframes.begin(), keyframes.end(),
139 Keyframe::compareOffsets); 139 Keyframe::compareOffsets);
140 size_t targetIndex = 0; 140 size_t targetIndex = 0;
141 for (size_t i = 1; i < keyframes.size(); i++) { 141 for (size_t i = 1; i < keyframes.size(); i++) {
142 if (keyframes[i]->offset() == keyframes[targetIndex]->offset()) { 142 if (keyframes[i]->offset() == keyframes[targetIndex]->offset()) {
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 element, model, inertAnimation->specifiedTiming(), 618 element, model, inertAnimation->specifiedTiming(),
619 KeyframeEffect::TransitionPriority, eventDelegate); 619 KeyframeEffect::TransitionPriority, eventDelegate);
620 Animation* animation = element->document().timeline().play(transition); 620 Animation* animation = element->document().timeline().play(transition);
621 animation->setId(getPropertyName(newTransition.id)); 621 animation->setId(getPropertyName(newTransition.id));
622 // Set the current time as the start time for retargeted transitions 622 // Set the current time as the start time for retargeted transitions
623 if (retargetedCompositorTransitions.contains(id)) 623 if (retargetedCompositorTransitions.contains(id))
624 animation->setStartTime(element->document().timeline().currentTime()); 624 animation->setStartTime(element->document().timeline().currentTime());
625 animation->update(TimingUpdateOnDemand); 625 animation->update(TimingUpdateOnDemand);
626 runningTransition.animation = animation; 626 runningTransition.animation = animation;
627 m_transitions.set(id, runningTransition); 627 m_transitions.set(id, runningTransition);
628 DCHECK_NE(id, CSSPropertyInvalid); 628 DCHECK(isValidCSSPropertyID(id));
629 629
630 DEFINE_STATIC_LOCAL(SparseHistogram, propertyHistogram, 630 DEFINE_STATIC_LOCAL(SparseHistogram, propertyHistogram,
631 ("WebCore.Animation.CSSProperties")); 631 ("WebCore.Animation.CSSProperties"));
632 propertyHistogram.sample( 632 propertyHistogram.sample(
633 UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(id)); 633 UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(id));
634 } 634 }
635 clearPendingUpdate(); 635 clearPendingUpdate();
636 } 636 }
637 637
638 void CSSAnimations::calculateTransitionUpdateForProperty( 638 void CSSAnimations::calculateTransitionUpdateForProperty(
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 return toShadowRoot(treeScope.rootNode()).host() == element; 1084 return toShadowRoot(treeScope.rootNode()).host() == element;
1085 } 1085 }
1086 1086
1087 DEFINE_TRACE(CSSAnimations) { 1087 DEFINE_TRACE(CSSAnimations) {
1088 visitor->trace(m_transitions); 1088 visitor->trace(m_transitions);
1089 visitor->trace(m_pendingUpdate); 1089 visitor->trace(m_pendingUpdate);
1090 visitor->trace(m_runningAnimations); 1090 visitor->trace(m_runningAnimations);
1091 } 1091 }
1092 1092
1093 } // namespace blink 1093 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698