| 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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 if (animatingElement->document().printing() || | 749 if (animatingElement->document().printing() || |
| 750 animatingElement->document().wasPrinting()) | 750 animatingElement->document().wasPrinting()) |
| 751 return; | 751 return; |
| 752 | 752 |
| 753 ElementAnimations* elementAnimations = animatingElement->elementAnimations(); | 753 ElementAnimations* elementAnimations = animatingElement->elementAnimations(); |
| 754 const TransitionMap* activeTransitions = | 754 const TransitionMap* activeTransitions = |
| 755 elementAnimations ? &elementAnimations->cssAnimations().m_transitions | 755 elementAnimations ? &elementAnimations->cssAnimations().m_transitions |
| 756 : nullptr; | 756 : nullptr; |
| 757 const CSSTransitionData* transitionData = style.transitions(); | 757 const CSSTransitionData* transitionData = style.transitions(); |
| 758 | 758 |
| 759 #if DCHECK_IS_ON() | |
| 760 // In debug builds we verify that it would have been safe to avoid populating | |
| 761 // and testing listedProperties if the style recalc is due to animation. | |
| 762 const bool animationStyleRecalc = false; | |
| 763 #else | |
| 764 // In release builds we avoid the cost of checking for new and interrupted | |
| 765 // transitions if the style recalc is due to animation. | |
| 766 const bool animationStyleRecalc = | 759 const bool animationStyleRecalc = |
| 767 elementAnimations && elementAnimations->isAnimationStyleChange(); | 760 elementAnimations && elementAnimations->isAnimationStyleChange(); |
| 768 #endif | |
| 769 | 761 |
| 770 std::bitset<numCSSProperties> listedProperties; | 762 std::bitset<numCSSProperties> listedProperties; |
| 771 bool anyTransitionHadTransitionAll = false; | 763 bool anyTransitionHadTransitionAll = false; |
| 772 const LayoutObject* layoutObject = animatingElement->layoutObject(); | 764 const LayoutObject* layoutObject = animatingElement->layoutObject(); |
| 773 if (!animationStyleRecalc && style.display() != EDisplay::None && | 765 if (!animationStyleRecalc && style.display() != EDisplay::None && |
| 774 layoutObject && layoutObject->style() && transitionData) { | 766 layoutObject && layoutObject->style() && transitionData) { |
| 775 const ComputedStyle& oldStyle = *layoutObject->style(); | 767 const ComputedStyle& oldStyle = *layoutObject->style(); |
| 776 | 768 |
| 777 for (size_t i = 0; i < transitionData->propertyList().size(); ++i) { | 769 for (size_t i = 0; i < transitionData->propertyList().size(); ++i) { |
| 778 const CSSTransitionData::TransitionProperty& transitionProperty = | 770 const CSSTransitionData::TransitionProperty& transitionProperty = |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 } | 810 } |
| 819 } | 811 } |
| 820 } | 812 } |
| 821 } | 813 } |
| 822 | 814 |
| 823 if (activeTransitions) { | 815 if (activeTransitions) { |
| 824 for (const auto& entry : *activeTransitions) { | 816 for (const auto& entry : *activeTransitions) { |
| 825 CSSPropertyID id = entry.key; | 817 CSSPropertyID id = entry.key; |
| 826 if (!anyTransitionHadTransitionAll && !animationStyleRecalc && | 818 if (!anyTransitionHadTransitionAll && !animationStyleRecalc && |
| 827 !listedProperties.test(id - firstCSSProperty)) { | 819 !listedProperties.test(id - firstCSSProperty)) { |
| 828 // TODO(crbug.com/365507): Figure out why this fails on Chrome OS login | |
| 829 // page. | |
| 830 // DCHECK(animation.playStateInternal() == Animation::Finished || | |
| 831 // !(elementAnimations && | |
| 832 // elementAnimations->isAnimationStyleChange())); | |
| 833 update.cancelTransition(id); | 820 update.cancelTransition(id); |
| 834 } else if (entry.value.animation->finishedInternal()) { | 821 } else if (entry.value.animation->finishedInternal()) { |
| 835 update.finishTransition(id); | 822 update.finishTransition(id); |
| 836 } | 823 } |
| 837 } | 824 } |
| 838 } | 825 } |
| 839 } | 826 } |
| 840 | 827 |
| 841 void CSSAnimations::cancel() { | 828 void CSSAnimations::cancel() { |
| 842 for (const auto& runningAnimation : m_runningAnimations) { | 829 for (const auto& runningAnimation : m_runningAnimations) { |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 return toShadowRoot(treeScope.rootNode()).host() == element; | 1084 return toShadowRoot(treeScope.rootNode()).host() == element; |
| 1098 } | 1085 } |
| 1099 | 1086 |
| 1100 DEFINE_TRACE(CSSAnimations) { | 1087 DEFINE_TRACE(CSSAnimations) { |
| 1101 visitor->trace(m_transitions); | 1088 visitor->trace(m_transitions); |
| 1102 visitor->trace(m_pendingUpdate); | 1089 visitor->trace(m_pendingUpdate); |
| 1103 visitor->trace(m_runningAnimations); | 1090 visitor->trace(m_runningAnimations); |
| 1104 } | 1091 } |
| 1105 | 1092 |
| 1106 } // namespace blink | 1093 } // namespace blink |
| OLD | NEW |