Changeset 233004 in webkit
- Timestamp:
- Jun 20, 2018 12:07:34 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r232993 r233004 1 2018-06-19 Antoine Quint <graouts@apple.com> 2 3 [Web Animations] Make imported/mozilla/css-animations/test_pseudoElement-get-animations.html pass reliably 4 https://bugs.webkit.org/show_bug.cgi?id=183818 5 <rdar://problem/40997015> 6 7 Reviewed by Dean Jackson. 8 9 This test now passes reliably. 10 11 * TestExpectations: 12 1 13 2018-06-19 Per Arne Vollan <pvollan@apple.com> 2 14 -
trunk/LayoutTests/TestExpectations
r232978 r233004 1927 1927 webkit.org/b/181888 imported/w3c/web-platform-tests/web-animations/timing-model/animation-effects/current-iteration.html [ Pass Failure ] 1928 1928 1929 webkit.org/b/183818 imported/mozilla/css-animations/test_pseudoElement-get-animations.html [ Pass Failure Timeout ]1930 1929 webkit.org/b/183826 imported/mozilla/css-animations/test_animation-pausing.html [ Pass Failure Timeout ] 1931 1930 webkit.org/b/183830 imported/mozilla/css-animations/test_animation-ready.html [ Pass Failure Timeout ] -
trunk/LayoutTests/imported/mozilla/ChangeLog
r232978 r233004 1 2018-06-19 Antoine Quint <graouts@apple.com> 2 3 [Web Animations] Make imported/mozilla/css-animations/test_pseudoElement-get-animations.html pass reliably 4 https://bugs.webkit.org/show_bug.cgi?id=183818 5 <rdar://problem/40997015> 6 7 Reviewed by Dean Jackson. 8 9 Mark progressions in the Mozilla CSS Transitions and CSS Animations tests. 10 11 * css-animations/test_pseudoElement-get-animations-expected.txt: 12 * css-transitions/test_element-get-animations-expected.txt: 13 1 14 2018-06-19 Antoine Quint <graouts@apple.com> 2 15 -
trunk/LayoutTests/imported/mozilla/css-animations/test_pseudoElement-get-animations-expected.txt
r229809 r233004 1 1 2 2 PASS getAnimations returns CSSAnimation objects 3 FAIL getAnimations returns css transitions/animations, and script-generated animations in the expected order assert_equals: Got expected number of animations/trnasitions running on ::after pseudo element expected 5 but got 2 3 PASS getAnimations returns css transitions/animations, and script-generated animations in the expected order 4 4 -
trunk/LayoutTests/imported/mozilla/css-transitions/test_element-get-animations-expected.txt
r229888 r233004 5 5 FAIL getAnimations for transition on non-animatable property assert_equals: getAnimations returns an empty sequence for a transition of a non-animatable property expected 0 but got 1 6 6 PASS getAnimations for transition on unsupported property 7 FAIL getAnimations sorts simultaneous transitions by name assert_equals: expected "border-bottom-width" but got "border-left-width" 7 PASS getAnimations sorts simultaneous transitions by name 8 8 PASS getAnimations sorts transitions by when they were generated 9 9 -
trunk/Source/WebCore/ChangeLog
r233002 r233004 1 2018-06-19 Antoine Quint <graouts@apple.com> 2 3 [Web Animations] Make imported/mozilla/css-animations/test_pseudoElement-get-animations.html pass reliably 4 https://bugs.webkit.org/show_bug.cgi?id=183818 5 <rdar://problem/40997015> 6 7 Reviewed by Dean Jackson. 8 9 We add a new opt-in flag to return sorted animations when calling AnimationTimeline::animationsForElement() so that 10 Element::getAnimations() can opt into returning animations sorted by the rules defined by the CSS Transitions spec. 11 The rule is that CSS Transitions must be sorted prior to CSS Animations and regular Web Animations, and then sorted 12 by the time they were generated and, if generated at the same time, sorted alphabetically based on the transitioned 13 property. To be able to accomodate this, we add a new generationTime() method to CSSTransition. 14 15 * animation/AnimationTimeline.cpp: 16 (WebCore::AnimationTimeline::animationsForElement const): 17 (WebCore::AnimationTimeline::updateCSSTransitionsForElement): 18 * animation/AnimationTimeline.h: 19 * animation/CSSTransition.cpp: 20 (WebCore::CSSTransition::create): 21 (WebCore::CSSTransition::CSSTransition): 22 * animation/CSSTransition.h: 23 * dom/Element.cpp: 24 (WebCore::Element::getAnimations): 25 1 26 2018-06-19 Basuke Suzuki <Basuke.Suzuki@sony.com> 2 27 -
trunk/Source/WebCore/animation/AnimationTimeline.cpp
r232960 r233004 143 143 } 144 144 145 Vector<RefPtr<WebAnimation>> AnimationTimeline::animationsForElement(Element& element ) const145 Vector<RefPtr<WebAnimation>> AnimationTimeline::animationsForElement(Element& element, Ordering ordering) const 146 146 { 147 147 Vector<RefPtr<WebAnimation>> animations; 148 148 if (m_elementToCSSTransitionsMap.contains(&element)) { 149 149 const auto& cssTransitions = m_elementToCSSTransitionsMap.get(&element); 150 animations.appendRange(cssTransitions.begin(), cssTransitions.end()); 150 if (ordering == Ordering::Sorted) { 151 Vector<RefPtr<WebAnimation>> sortedCSSTransitions; 152 sortedCSSTransitions.appendRange(cssTransitions.begin(), cssTransitions.end()); 153 std::sort(sortedCSSTransitions.begin(), sortedCSSTransitions.end(), [](auto& lhs, auto& rhs) { 154 // Sort transitions first by their generation time, and then by transition-property. 155 // https://drafts.csswg.org/css-transitions-2/#animation-composite-order 156 auto* lhsTransition = downcast<CSSTransition>(lhs.get()); 157 auto* rhsTransition = downcast<CSSTransition>(rhs.get()); 158 if (lhsTransition->generationTime() != rhsTransition->generationTime()) 159 return lhsTransition->generationTime() < rhsTransition->generationTime(); 160 return lhsTransition->transitionProperty().utf8() < rhsTransition->transitionProperty().utf8(); 161 }); 162 animations.appendVector(sortedCSSTransitions); 163 } else 164 animations.appendRange(cssTransitions.begin(), cssTransitions.end()); 151 165 } 152 166 if (m_elementToCSSAnimationsMap.contains(&element)) { … … 301 315 }).iterator->value; 302 316 317 auto generationTime = MonotonicTime::now(); 318 303 319 auto numberOfProperties = CSSPropertyAnimation::getNumProperties(); 304 320 for (int propertyIndex = 0; propertyIndex < numberOfProperties; ++propertyIndex) { … … 349 365 auto& reversingAdjustedStartStyle = beforeChangeStyle; 350 366 auto reversingShorteningFactor = 1; 351 runningTransitionsByProperty.set(property, CSSTransition::create(element, property, *matchingBackingAnimation, &beforeChangeStyle, afterChangeStyle, delay, duration, reversingAdjustedStartStyle, reversingShorteningFactor));367 runningTransitionsByProperty.set(property, CSSTransition::create(element, property, generationTime, *matchingBackingAnimation, &beforeChangeStyle, afterChangeStyle, delay, duration, reversingAdjustedStartStyle, reversingShorteningFactor)); 352 368 } else if (completedTransitionsByProperty.contains(property) && !propertyInStyleMatchesValueForTransitionInMap(property, afterChangeStyle, completedTransitionsByProperty)) { 353 369 // 2. Otherwise, if the element has a completed transition for the property and the end value of the completed transition is different from … … 402 418 auto delay = matchingBackingAnimation->delay() < 0 ? Seconds(matchingBackingAnimation->delay()) * reversingShorteningFactor : Seconds(matchingBackingAnimation->delay()); 403 419 auto duration = Seconds(matchingBackingAnimation->duration()) * reversingShorteningFactor; 404 runningTransitionsByProperty.set(property, CSSTransition::create(element, property, *matchingBackingAnimation, &previouslyRunningTransitionCurrentStyle, afterChangeStyle, delay, duration, reversingAdjustedStartStyle, reversingShorteningFactor));420 runningTransitionsByProperty.set(property, CSSTransition::create(element, property, generationTime, *matchingBackingAnimation, &previouslyRunningTransitionCurrentStyle, afterChangeStyle, delay, duration, reversingAdjustedStartStyle, reversingShorteningFactor)); 405 421 } else { 406 422 // 4. Otherwise, implementations must cancel the running transition … … 418 434 auto& reversingAdjustedStartStyle = currentStyle; 419 435 auto reversingShorteningFactor = 1; 420 runningTransitionsByProperty.set(property, CSSTransition::create(element, property, *matchingBackingAnimation, &previouslyRunningTransitionCurrentStyle, afterChangeStyle, delay, duration, reversingAdjustedStartStyle, reversingShorteningFactor));436 runningTransitionsByProperty.set(property, CSSTransition::create(element, property, generationTime, *matchingBackingAnimation, &previouslyRunningTransitionCurrentStyle, afterChangeStyle, delay, duration, reversingAdjustedStartStyle, reversingShorteningFactor)); 421 437 } 422 438 } -
trunk/Source/WebCore/animation/AnimationTimeline.h
r232960 r233004 58 58 virtual void timingModelDidChange() { }; 59 59 60 enum class Ordering { Sorted, Unsorted }; 60 61 const ListHashSet<RefPtr<WebAnimation>>& animations() const { return m_animations; } 61 Vector<RefPtr<WebAnimation>> animationsForElement(Element& ) const;62 Vector<RefPtr<WebAnimation>> animationsForElement(Element&, Ordering ordering = Ordering::Unsorted) const; 62 63 void removeAnimationsForElement(Element&); 63 64 void cancelDeclarativeAnimationsForElement(Element&); -
trunk/Source/WebCore/animation/CSSTransition.cpp
r232946 r233004 33 33 namespace WebCore { 34 34 35 Ref<CSSTransition> CSSTransition::create(Element& target, CSSPropertyID property, const Animation& backingAnimation, const RenderStyle* oldStyle, const RenderStyle& newStyle, Seconds delay, Seconds duration, const RenderStyle& reversingAdjustedStartStyle, double reversingShorteningFactor)35 Ref<CSSTransition> CSSTransition::create(Element& target, CSSPropertyID property, MonotonicTime generationTime, const Animation& backingAnimation, const RenderStyle* oldStyle, const RenderStyle& newStyle, Seconds delay, Seconds duration, const RenderStyle& reversingAdjustedStartStyle, double reversingShorteningFactor) 36 36 { 37 auto result = adoptRef(*new CSSTransition(target, property, backingAnimation, newStyle, reversingAdjustedStartStyle, reversingShorteningFactor));37 auto result = adoptRef(*new CSSTransition(target, property, generationTime, backingAnimation, newStyle, reversingAdjustedStartStyle, reversingShorteningFactor)); 38 38 result->initialize(target, oldStyle, newStyle); 39 39 result->setTimingProperties(delay, duration); … … 41 41 } 42 42 43 CSSTransition::CSSTransition(Element& element, CSSPropertyID property, const Animation& backingAnimation, const RenderStyle& targetStyle, const RenderStyle& reversingAdjustedStartStyle, double reversingShorteningFactor)43 CSSTransition::CSSTransition(Element& element, CSSPropertyID property, MonotonicTime generationTime, const Animation& backingAnimation, const RenderStyle& targetStyle, const RenderStyle& reversingAdjustedStartStyle, double reversingShorteningFactor) 44 44 : DeclarativeAnimation(element, backingAnimation) 45 45 , m_property(property) 46 , m_generationTime(generationTime) 46 47 , m_targetStyle(RenderStyle::clonePtr(targetStyle)) 47 48 , m_reversingAdjustedStartStyle(RenderStyle::clonePtr(reversingAdjustedStartStyle)) -
trunk/Source/WebCore/animation/CSSTransition.h
r232946 r233004 38 38 class CSSTransition final : public DeclarativeAnimation { 39 39 public: 40 static Ref<CSSTransition> create(Element&, CSSPropertyID, const Animation&, const RenderStyle* oldStyle, const RenderStyle& newStyle, Seconds delay, Seconds duration, const RenderStyle& reversingAdjustedStartStyle, double);40 static Ref<CSSTransition> create(Element&, CSSPropertyID, MonotonicTime generationTime, const Animation&, const RenderStyle* oldStyle, const RenderStyle& newStyle, Seconds delay, Seconds duration, const RenderStyle& reversingAdjustedStartStyle, double); 41 41 ~CSSTransition() = default; 42 42 … … 44 44 String transitionProperty() const { return getPropertyNameString(m_property); } 45 45 CSSPropertyID property() const { return m_property; } 46 MonotonicTime generationTime() const { return m_generationTime; } 46 47 const RenderStyle& targetStyle() const { return *m_targetStyle; } 47 48 const RenderStyle& currentStyle() const { return *m_currentStyle; } … … 53 54 54 55 private: 55 CSSTransition(Element&, CSSPropertyID, const Animation&, const RenderStyle& targetStyle, const RenderStyle& reversingAdjustedStartStyle, double);56 CSSTransition(Element&, CSSPropertyID, MonotonicTime generationTime, const Animation&, const RenderStyle& targetStyle, const RenderStyle& reversingAdjustedStartStyle, double); 56 57 void setTimingProperties(Seconds delay, Seconds duration); 57 58 58 59 CSSPropertyID m_property; 60 MonotonicTime m_generationTime; 59 61 std::unique_ptr<RenderStyle> m_targetStyle; 60 62 std::unique_ptr<RenderStyle> m_currentStyle; -
trunk/Source/WebCore/dom/Element.cpp
r232185 r233004 3834 3834 Vector<RefPtr<WebAnimation>> animations; 3835 3835 if (auto timeline = document().existingTimeline()) { 3836 for (auto& animation : timeline->animationsForElement(*this )) {3836 for (auto& animation : timeline->animationsForElement(*this, AnimationTimeline::Ordering::Sorted)) { 3837 3837 if (animation->canBeListed()) 3838 3838 animations.append(animation);
Note: See TracChangeset
for help on using the changeset viewer.