| OLD | NEW |
| 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 30 matching lines...) Expand all Loading... |
| 41 #include "sky/engine/core/css/CSSPropertyMetadata.h" | 41 #include "sky/engine/core/css/CSSPropertyMetadata.h" |
| 42 #include "sky/engine/core/css/CSSValueList.h" | 42 #include "sky/engine/core/css/CSSValueList.h" |
| 43 #include "sky/engine/core/css/StyleKeyframe.h" | 43 #include "sky/engine/core/css/StyleKeyframe.h" |
| 44 #include "sky/engine/core/css/StyleRuleKeyframes.h" | 44 #include "sky/engine/core/css/StyleRuleKeyframes.h" |
| 45 #include "sky/engine/core/css/resolver/CSSToStyleMap.h" | 45 #include "sky/engine/core/css/resolver/CSSToStyleMap.h" |
| 46 #include "sky/engine/core/css/resolver/StyleResolver.h" | 46 #include "sky/engine/core/css/resolver/StyleResolver.h" |
| 47 #include "sky/engine/core/dom/Element.h" | 47 #include "sky/engine/core/dom/Element.h" |
| 48 #include "sky/engine/core/dom/StyleEngine.h" | 48 #include "sky/engine/core/dom/StyleEngine.h" |
| 49 #include "sky/engine/core/events/AnimationEvent.h" | 49 #include "sky/engine/core/events/AnimationEvent.h" |
| 50 #include "sky/engine/core/events/TransitionEvent.h" | 50 #include "sky/engine/core/events/TransitionEvent.h" |
| 51 #include "sky/engine/core/frame/UseCounter.h" | |
| 52 #include "sky/engine/core/rendering/RenderLayer.h" | 51 #include "sky/engine/core/rendering/RenderLayer.h" |
| 53 #include "sky/engine/core/rendering/RenderObject.h" | 52 #include "sky/engine/core/rendering/RenderObject.h" |
| 54 #include "sky/engine/core/rendering/style/KeyframeList.h" | 53 #include "sky/engine/core/rendering/style/KeyframeList.h" |
| 55 #include "sky/engine/platform/animation/TimingFunction.h" | 54 #include "sky/engine/platform/animation/TimingFunction.h" |
| 56 #include "sky/engine/public/platform/Platform.h" | 55 #include "sky/engine/public/platform/Platform.h" |
| 57 #include "sky/engine/wtf/BitArray.h" | 56 #include "sky/engine/wtf/BitArray.h" |
| 58 #include "sky/engine/wtf/HashSet.h" | 57 #include "sky/engine/wtf/HashSet.h" |
| 59 | 58 |
| 60 namespace blink { | 59 namespace blink { |
| 61 | 60 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 88 const Element* elementForScoping = element ? element : &parentElement; | 87 const Element* elementForScoping = element ? element : &parentElement; |
| 89 const StyleRuleKeyframes* keyframesRule = CSSAnimations::matchScopedKeyframe
sRule(resolver, elementForScoping, name); | 88 const StyleRuleKeyframes* keyframesRule = CSSAnimations::matchScopedKeyframe
sRule(resolver, elementForScoping, name); |
| 90 if (!keyframesRule) | 89 if (!keyframesRule) |
| 91 return; | 90 return; |
| 92 | 91 |
| 93 const Vector<RefPtr<StyleKeyframe> >& styleKeyframes = keyframesRule->keyfra
mes(); | 92 const Vector<RefPtr<StyleKeyframe> >& styleKeyframes = keyframesRule->keyfra
mes(); |
| 94 if (styleKeyframes.isEmpty()) | 93 if (styleKeyframes.isEmpty()) |
| 95 return; | 94 return; |
| 96 | 95 |
| 97 // Construct and populate the style for each keyframe | 96 // Construct and populate the style for each keyframe |
| 98 PropertySet specifiedPropertiesForUseCounter; | |
| 99 for (size_t i = 0; i < styleKeyframes.size(); ++i) { | 97 for (size_t i = 0; i < styleKeyframes.size(); ++i) { |
| 100 const StyleKeyframe* styleKeyframe = styleKeyframes[i].get(); | 98 const StyleKeyframe* styleKeyframe = styleKeyframes[i].get(); |
| 101 // It's OK to pass a null element here. | 99 // It's OK to pass a null element here. |
| 102 RefPtr<RenderStyle> keyframeStyle = resolver->styleForKeyframe(element,
style, parentStyle, styleKeyframe, name); | 100 RefPtr<RenderStyle> keyframeStyle = resolver->styleForKeyframe(element,
style, parentStyle, styleKeyframe, name); |
| 103 RefPtr<AnimatableValueKeyframe> keyframe = AnimatableValueKeyframe::crea
te(); | 101 RefPtr<AnimatableValueKeyframe> keyframe = AnimatableValueKeyframe::crea
te(); |
| 104 const Vector<double>& offsets = styleKeyframe->keys(); | 102 const Vector<double>& offsets = styleKeyframe->keys(); |
| 105 ASSERT(!offsets.isEmpty()); | 103 ASSERT(!offsets.isEmpty()); |
| 106 keyframe->setOffset(offsets[0]); | 104 keyframe->setOffset(offsets[0]); |
| 107 keyframe->setEasing(defaultTimingFunction); | 105 keyframe->setEasing(defaultTimingFunction); |
| 108 const StylePropertySet& properties = styleKeyframe->properties(); | 106 const StylePropertySet& properties = styleKeyframe->properties(); |
| 109 for (unsigned j = 0; j < properties.propertyCount(); j++) { | 107 for (unsigned j = 0; j < properties.propertyCount(); j++) { |
| 110 specifiedPropertiesForUseCounter.add(properties.propertyAt(j).id()); | |
| 111 CSSPropertyID property = propertyForAnimation(properties.propertyAt(
j).id()); | 108 CSSPropertyID property = propertyForAnimation(properties.propertyAt(
j).id()); |
| 112 if (property == CSSPropertyAnimationTimingFunction) { | 109 if (property == CSSPropertyAnimationTimingFunction) { |
| 113 CSSValue* value = properties.propertyAt(j).value(); | 110 CSSValue* value = properties.propertyAt(j).value(); |
| 114 RefPtr<TimingFunction> timingFunction; | 111 RefPtr<TimingFunction> timingFunction; |
| 115 if (value->isInheritedValue() && parentStyle->animations()) | 112 if (value->isInheritedValue() && parentStyle->animations()) |
| 116 timingFunction = parentStyle->animations()->timingFunctionLi
st()[0]; | 113 timingFunction = parentStyle->animations()->timingFunctionLi
st()[0]; |
| 117 else if (value->isInheritedValue() || value->isInitialValue()) | 114 else if (value->isInheritedValue() || value->isInitialValue()) |
| 118 timingFunction = CSSTimingData::initialTimingFunction(); | 115 timingFunction = CSSTimingData::initialTimingFunction(); |
| 119 else | 116 else |
| 120 timingFunction = CSSToStyleMap::mapAnimationTimingFunction(t
oCSSValueList(value)->item(0)); | 117 timingFunction = CSSToStyleMap::mapAnimationTimingFunction(t
oCSSValueList(value)->item(0)); |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 case CSSPropertyTransitionDuration: | 634 case CSSPropertyTransitionDuration: |
| 638 case CSSPropertyTransitionProperty: | 635 case CSSPropertyTransitionProperty: |
| 639 case CSSPropertyTransitionTimingFunction: | 636 case CSSPropertyTransitionTimingFunction: |
| 640 return false; | 637 return false; |
| 641 default: | 638 default: |
| 642 return true; | 639 return true; |
| 643 } | 640 } |
| 644 } | 641 } |
| 645 | 642 |
| 646 } // namespace blink | 643 } // namespace blink |
| OLD | NEW |