| 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 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 #include "core/StylePropertyShorthand.h" | 34 #include "core/StylePropertyShorthand.h" |
| 35 #include "core/animation/ActiveAnimations.h" | 35 #include "core/animation/ActiveAnimations.h" |
| 36 #include "core/animation/AnimationTimeline.h" | 36 #include "core/animation/AnimationTimeline.h" |
| 37 #include "core/animation/CompositorAnimations.h" | 37 #include "core/animation/CompositorAnimations.h" |
| 38 #include "core/animation/KeyframeEffectModel.h" | 38 #include "core/animation/KeyframeEffectModel.h" |
| 39 #include "core/animation/LegacyStyleInterpolation.h" | 39 #include "core/animation/LegacyStyleInterpolation.h" |
| 40 #include "core/animation/css/CSSAnimatableValueFactory.h" | 40 #include "core/animation/css/CSSAnimatableValueFactory.h" |
| 41 #include "core/animation/css/CSSPropertyEquality.h" | 41 #include "core/animation/css/CSSPropertyEquality.h" |
| 42 #include "core/css/CSSKeyframeRule.h" | 42 #include "core/css/CSSKeyframeRule.h" |
| 43 #include "core/css/CSSPropertyMetadata.h" | |
| 44 #include "core/css/resolver/CSSToStyleMap.h" | 43 #include "core/css/resolver/CSSToStyleMap.h" |
| 45 #include "core/css/resolver/StyleResolver.h" | 44 #include "core/css/resolver/StyleResolver.h" |
| 46 #include "core/dom/Element.h" | 45 #include "core/dom/Element.h" |
| 47 #include "core/dom/PseudoElement.h" | 46 #include "core/dom/PseudoElement.h" |
| 48 #include "core/dom/StyleEngine.h" | 47 #include "core/dom/StyleEngine.h" |
| 49 #include "core/events/TransitionEvent.h" | 48 #include "core/events/TransitionEvent.h" |
| 50 #include "core/events/WebKitAnimationEvent.h" | 49 #include "core/events/WebKitAnimationEvent.h" |
| 51 #include "core/frame/UseCounter.h" | 50 #include "core/frame/UseCounter.h" |
| 52 #include "core/rendering/RenderLayer.h" | 51 #include "core/rendering/RenderLayer.h" |
| 53 #include "core/rendering/RenderObject.h" | 52 #include "core/rendering/RenderObject.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 if (property == CSSPropertyWebkitAnimationTimingFunction || property
== CSSPropertyAnimationTimingFunction) { | 111 if (property == CSSPropertyWebkitAnimationTimingFunction || property
== CSSPropertyAnimationTimingFunction) { |
| 113 CSSValue* value = properties.propertyAt(j).value(); | 112 CSSValue* value = properties.propertyAt(j).value(); |
| 114 RefPtr<TimingFunction> timingFunction; | 113 RefPtr<TimingFunction> timingFunction; |
| 115 if (value->isInheritedValue() && parentStyle->animations()) | 114 if (value->isInheritedValue() && parentStyle->animations()) |
| 116 timingFunction = parentStyle->animations()->timingFunctionLi
st()[0]; | 115 timingFunction = parentStyle->animations()->timingFunctionLi
st()[0]; |
| 117 else if (value->isInheritedValue() || value->isInitialValue()) | 116 else if (value->isInheritedValue() || value->isInitialValue()) |
| 118 timingFunction = CSSTimingData::initialTimingFunction(); | 117 timingFunction = CSSTimingData::initialTimingFunction(); |
| 119 else | 118 else |
| 120 timingFunction = CSSToStyleMap::mapAnimationTimingFunction(t
oCSSValueList(value)->item(0)); | 119 timingFunction = CSSToStyleMap::mapAnimationTimingFunction(t
oCSSValueList(value)->item(0)); |
| 121 keyframe->setEasing(timingFunction.release()); | 120 keyframe->setEasing(timingFunction.release()); |
| 122 } else if (CSSPropertyMetadata::isAnimatableProperty(property)) { | 121 } else if (CSSAnimations::isAnimatableProperty(property)) { |
| 123 keyframe->setPropertyValue(property, CSSAnimatableValueFactory::
create(property, *keyframeStyle).get()); | 122 keyframe->setPropertyValue(property, CSSAnimatableValueFactory::
create(property, *keyframeStyle).get()); |
| 124 } | 123 } |
| 125 } | 124 } |
| 126 keyframes.append(keyframe); | 125 keyframes.append(keyframe); |
| 127 // The last keyframe specified at a given offset is used. | 126 // The last keyframe specified at a given offset is used. |
| 128 for (size_t j = 1; j < offsets.size(); ++j) { | 127 for (size_t j = 1; j < offsets.size(); ++j) { |
| 129 keyframes.append(toAnimatableValueKeyframe(keyframe->cloneWithOffset
(offsets[j]).get())); | 128 keyframes.append(toAnimatableValueKeyframe(keyframe->cloneWithOffset
(offsets[j]).get())); |
| 130 } | 129 } |
| 131 } | 130 } |
| 132 ASSERT(!keyframes.isEmpty()); | 131 ASSERT(!keyframes.isEmpty()); |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 if (animateAll) | 484 if (animateAll) |
| 486 anyTransitionHadTransitionAll = true; | 485 anyTransitionHadTransitionAll = true; |
| 487 const StylePropertyShorthand& propertyList = animateAll ? CSSAnimati
ons::animatableProperties() : shorthandForProperty(property); | 486 const StylePropertyShorthand& propertyList = animateAll ? CSSAnimati
ons::animatableProperties() : shorthandForProperty(property); |
| 488 // If not a shorthand we only execute one iteration of this loop, an
d refer to the property directly. | 487 // If not a shorthand we only execute one iteration of this loop, an
d refer to the property directly. |
| 489 for (unsigned j = 0; !j || j < propertyList.length(); ++j) { | 488 for (unsigned j = 0; !j || j < propertyList.length(); ++j) { |
| 490 CSSPropertyID id = propertyList.length() ? propertyList.properti
es()[j] : property; | 489 CSSPropertyID id = propertyList.length() ? propertyList.properti
es()[j] : property; |
| 491 CSSPropertyID eventId = id; | 490 CSSPropertyID eventId = id; |
| 492 | 491 |
| 493 if (!animateAll) { | 492 if (!animateAll) { |
| 494 id = propertyForAnimation(id); | 493 id = propertyForAnimation(id); |
| 495 if (CSSPropertyMetadata::isAnimatableProperty(id)) | 494 if (CSSAnimations::isAnimatableProperty(id)) |
| 496 listedProperties.set(id); | 495 listedProperties.set(id); |
| 497 else | 496 else |
| 498 continue; | 497 continue; |
| 499 } | 498 } |
| 500 | 499 |
| 501 // FIXME: We should transition if an !important property changes
even when an animation is running, | 500 // FIXME: We should transition if an !important property changes
even when an animation is running, |
| 502 // but this is a bit hard to do with the current applyMatchedPro
perties system. | 501 // but this is a bit hard to do with the current applyMatchedPro
perties system. |
| 503 if (!update->activeInterpolationsForAnimations().contains(id) | 502 if (!update->activeInterpolationsForAnimations().contains(id) |
| 504 && (!activeAnimations || !activeAnimations->cssAnimations().
m_previousActiveInterpolationsForAnimations.contains(id))) { | 503 && (!activeAnimations || !activeAnimations->cssAnimations().
m_previousActiveInterpolationsForAnimations.contains(id))) { |
| 505 calculateTransitionUpdateForProperty(id, eventId, *transitio
nData, i, oldStyle, style, activeTransitions, update, element); | 504 calculateTransitionUpdateForProperty(id, eventId, *transitio
nData, i, oldStyle, style, activeTransitions, update, element); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 | 652 |
| 654 m_previousPhase = currentPhase; | 653 m_previousPhase = currentPhase; |
| 655 } | 654 } |
| 656 | 655 |
| 657 void CSSAnimations::TransitionEventDelegate::trace(Visitor* visitor) | 656 void CSSAnimations::TransitionEventDelegate::trace(Visitor* visitor) |
| 658 { | 657 { |
| 659 visitor->trace(m_target); | 658 visitor->trace(m_target); |
| 660 AnimationNode::EventDelegate::trace(visitor); | 659 AnimationNode::EventDelegate::trace(visitor); |
| 661 } | 660 } |
| 662 | 661 |
| 662 bool CSSAnimations::isAnimatableProperty(CSSPropertyID property) |
| 663 { |
| 664 switch (property) { |
| 665 case CSSPropertyBackgroundColor: |
| 666 case CSSPropertyBackgroundImage: |
| 667 case CSSPropertyBackgroundPositionX: |
| 668 case CSSPropertyBackgroundPositionY: |
| 669 case CSSPropertyBackgroundSize: |
| 670 case CSSPropertyBaselineShift: |
| 671 case CSSPropertyBorderBottomColor: |
| 672 case CSSPropertyBorderBottomLeftRadius: |
| 673 case CSSPropertyBorderBottomRightRadius: |
| 674 case CSSPropertyBorderBottomWidth: |
| 675 case CSSPropertyBorderImageOutset: |
| 676 case CSSPropertyBorderImageSlice: |
| 677 case CSSPropertyBorderImageSource: |
| 678 case CSSPropertyBorderImageWidth: |
| 679 case CSSPropertyBorderLeftColor: |
| 680 case CSSPropertyBorderLeftWidth: |
| 681 case CSSPropertyBorderRightColor: |
| 682 case CSSPropertyBorderRightWidth: |
| 683 case CSSPropertyBorderTopColor: |
| 684 case CSSPropertyBorderTopLeftRadius: |
| 685 case CSSPropertyBorderTopRightRadius: |
| 686 case CSSPropertyBorderTopWidth: |
| 687 case CSSPropertyBottom: |
| 688 case CSSPropertyBoxShadow: |
| 689 case CSSPropertyClip: |
| 690 case CSSPropertyColor: |
| 691 case CSSPropertyFill: |
| 692 case CSSPropertyFillOpacity: |
| 693 case CSSPropertyFlexBasis: |
| 694 case CSSPropertyFlexGrow: |
| 695 case CSSPropertyFlexShrink: |
| 696 case CSSPropertyFloodColor: |
| 697 case CSSPropertyFloodOpacity: |
| 698 case CSSPropertyFontSize: |
| 699 case CSSPropertyFontWeight: |
| 700 case CSSPropertyHeight: |
| 701 case CSSPropertyLeft: |
| 702 case CSSPropertyLetterSpacing: |
| 703 case CSSPropertyLightingColor: |
| 704 case CSSPropertyLineHeight: |
| 705 case CSSPropertyListStyleImage: |
| 706 case CSSPropertyMarginBottom: |
| 707 case CSSPropertyMarginLeft: |
| 708 case CSSPropertyMarginRight: |
| 709 case CSSPropertyMarginTop: |
| 710 case CSSPropertyMaxHeight: |
| 711 case CSSPropertyMaxWidth: |
| 712 case CSSPropertyMinHeight: |
| 713 case CSSPropertyMinWidth: |
| 714 case CSSPropertyObjectPosition: |
| 715 case CSSPropertyOpacity: |
| 716 case CSSPropertyOrphans: |
| 717 case CSSPropertyOutlineColor: |
| 718 case CSSPropertyOutlineOffset: |
| 719 case CSSPropertyOutlineWidth: |
| 720 case CSSPropertyPaddingBottom: |
| 721 case CSSPropertyPaddingLeft: |
| 722 case CSSPropertyPaddingRight: |
| 723 case CSSPropertyPaddingTop: |
| 724 case CSSPropertyRight: |
| 725 case CSSPropertyStopColor: |
| 726 case CSSPropertyStopOpacity: |
| 727 case CSSPropertyStroke: |
| 728 case CSSPropertyStrokeDasharray: |
| 729 case CSSPropertyStrokeDashoffset: |
| 730 case CSSPropertyStrokeMiterlimit: |
| 731 case CSSPropertyStrokeOpacity: |
| 732 case CSSPropertyStrokeWidth: |
| 733 case CSSPropertyTextDecorationColor: |
| 734 case CSSPropertyTextIndent: |
| 735 case CSSPropertyTextShadow: |
| 736 case CSSPropertyTop: |
| 737 case CSSPropertyVerticalAlign: |
| 738 case CSSPropertyVisibility: |
| 739 case CSSPropertyWebkitBackgroundSize: |
| 740 case CSSPropertyWebkitBorderHorizontalSpacing: |
| 741 case CSSPropertyWebkitBorderVerticalSpacing: |
| 742 case CSSPropertyWebkitBoxShadow: |
| 743 case CSSPropertyWebkitClipPath: |
| 744 case CSSPropertyWebkitColumnCount: |
| 745 case CSSPropertyWebkitColumnGap: |
| 746 case CSSPropertyWebkitColumnRuleColor: |
| 747 case CSSPropertyWebkitColumnRuleWidth: |
| 748 case CSSPropertyWebkitColumnWidth: |
| 749 case CSSPropertyWebkitFilter: |
| 750 case CSSPropertyWebkitMaskBoxImageOutset: |
| 751 case CSSPropertyWebkitMaskBoxImageSlice: |
| 752 case CSSPropertyWebkitMaskBoxImageSource: |
| 753 case CSSPropertyWebkitMaskBoxImageWidth: |
| 754 case CSSPropertyWebkitMaskImage: |
| 755 case CSSPropertyWebkitMaskPositionX: |
| 756 case CSSPropertyWebkitMaskPositionY: |
| 757 case CSSPropertyWebkitMaskSize: |
| 758 case CSSPropertyPerspective: |
| 759 case CSSPropertyPerspectiveOrigin: |
| 760 case CSSPropertyShapeOutside: |
| 761 case CSSPropertyShapeMargin: |
| 762 case CSSPropertyShapeImageThreshold: |
| 763 case CSSPropertyWebkitTextStrokeColor: |
| 764 case CSSPropertyTransform: |
| 765 case CSSPropertyTransformOrigin: |
| 766 case CSSPropertyWidows: |
| 767 case CSSPropertyWidth: |
| 768 case CSSPropertyWordSpacing: |
| 769 case CSSPropertyZIndex: |
| 770 case CSSPropertyZoom: |
| 771 return true; |
| 772 default: |
| 773 return false; |
| 774 } |
| 775 } |
| 776 |
| 663 const StylePropertyShorthand& CSSAnimations::animatableProperties() | 777 const StylePropertyShorthand& CSSAnimations::animatableProperties() |
| 664 { | 778 { |
| 665 DEFINE_STATIC_LOCAL(Vector<CSSPropertyID>, properties, ()); | 779 DEFINE_STATIC_LOCAL(Vector<CSSPropertyID>, properties, ()); |
| 666 DEFINE_STATIC_LOCAL(StylePropertyShorthand, propertyShorthand, ()); | 780 DEFINE_STATIC_LOCAL(StylePropertyShorthand, propertyShorthand, ()); |
| 667 if (properties.isEmpty()) { | 781 if (properties.isEmpty()) { |
| 668 for (int i = firstCSSProperty; i < lastCSSProperty; ++i) { | 782 for (int i = firstCSSProperty; i < lastCSSProperty; ++i) { |
| 669 CSSPropertyID id = convertToCSSPropertyID(i); | 783 CSSPropertyID id = convertToCSSPropertyID(i); |
| 670 if (CSSPropertyMetadata::isAnimatableProperty(id)) | 784 if (isAnimatableProperty(id)) |
| 671 properties.append(id); | 785 properties.append(id); |
| 672 } | 786 } |
| 673 propertyShorthand = StylePropertyShorthand(CSSPropertyInvalid, propertie
s.begin(), properties.size()); | 787 propertyShorthand = StylePropertyShorthand(CSSPropertyInvalid, propertie
s.begin(), properties.size()); |
| 674 } | 788 } |
| 675 return propertyShorthand; | 789 return propertyShorthand; |
| 676 } | 790 } |
| 677 | 791 |
| 678 // Animation properties are not allowed to be affected by Web Animations. | 792 // Animation properties are not allowed to be affected by Web Animations. |
| 679 // http://dev.w3.org/fxtf/web-animations/#not-animatable | 793 // http://dev.w3.org/fxtf/web-animations/#not-animatable |
| 680 bool CSSAnimations::isAllowedAnimation(CSSPropertyID property) | 794 bool CSSAnimations::isAllowedAnimation(CSSPropertyID property) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 #if ENABLE(OILPAN) | 844 #if ENABLE(OILPAN) |
| 731 visitor->trace(m_newTransitions); | 845 visitor->trace(m_newTransitions); |
| 732 visitor->trace(m_activeInterpolationsForAnimations); | 846 visitor->trace(m_activeInterpolationsForAnimations); |
| 733 visitor->trace(m_activeInterpolationsForTransitions); | 847 visitor->trace(m_activeInterpolationsForTransitions); |
| 734 visitor->trace(m_newAnimations); | 848 visitor->trace(m_newAnimations); |
| 735 visitor->trace(m_cancelledAnimationPlayers); | 849 visitor->trace(m_cancelledAnimationPlayers); |
| 736 #endif | 850 #endif |
| 737 } | 851 } |
| 738 | 852 |
| 739 } // namespace blink | 853 } // namespace blink |
| OLD | NEW |