Changeset 287762 in webkit
- Timestamp:
- Jan 7, 2022, 10:48:40 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
-
ChangeLog (modified) (1 diff)
-
animation/WebAnimationUtilities.cpp (modified) (1 diff)
-
css/CSSComputedStyleDeclaration.cpp (modified) (2 diffs)
-
css/makeprop.pl (modified) (1 diff)
-
platform/animation/AnimationList.h (modified) (1 diff)
-
style/Styleable.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r287761 r287762 1 2022-01-07 Antoine Quint <graouts@webkit.org> 2 3 Expose iterators on AnimationList 4 https://bugs.webkit.org/show_bug.cgi?id=234957 5 6 Reviewed by Antti Koivisto. 7 8 * animation/WebAnimationUtilities.cpp: 9 (WebCore::compareCSSAnimations): 10 * css/CSSComputedStyleDeclaration.cpp: 11 (WebCore::valueListForAnimationOrTransitionProperty): 12 (WebCore::animationShorthandValue): 13 * css/makeprop.pl: 14 (generateAnimationPropertyInitialValueSetter): 15 * platform/animation/AnimationList.h: 16 (WebCore::AnimationList::begin const): 17 (WebCore::AnimationList::end const): 18 (WebCore::AnimationList::rbegin const): 19 (WebCore::AnimationList::rend const): 20 * style/Styleable.cpp: 21 (WebCore::Styleable::updateCSSAnimations const): 22 (WebCore::compileTransitionPropertiesInStyle): 23 (WebCore::updateCSSTransitionsForStyleableAndProperty): 24 1 25 2022-01-07 Antoine Quint <graouts@webkit.org> 2 26 -
trunk/Source/WebCore/animation/WebAnimationUtilities.cpp
r284312 r287762 133 133 auto& aBackingAnimation = a.backingAnimation(); 134 134 auto& bBackingAnimation = b.backingAnimation(); 135 for (size_t i = 0; i < cssAnimationList->size(); ++i) { 136 auto& animation = cssAnimationList->animation(i); 137 if (&animation == &aBackingAnimation) 135 for (auto& animation : *cssAnimationList) { 136 if (animation.ptr() == &aBackingAnimation) 138 137 return true; 139 if ( &animation== &bBackingAnimation)138 if (animation.ptr() == &bBackingAnimation) 140 139 return false; 141 140 } -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r287712 r287762 1475 1475 auto list = CSSValueList::createCommaSeparated(); 1476 1476 if (animationList) { 1477 for ( size_t i = 0; i < animationList->size(); ++i)1478 ComputedStyleExtractor::addValueForAnimationPropertyToList(list.get(), property, &animationList->animation(i));1477 for (const auto& animation : *animationList) 1478 ComputedStyleExtractor::addValueForAnimationPropertyToList(list.get(), property, animation.ptr()); 1479 1479 } else 1480 1480 ComputedStyleExtractor::addValueForAnimationPropertyToList(list.get(), property, nullptr); … … 1486 1486 auto parentList = CSSValueList::createCommaSeparated(); 1487 1487 if (animationList) { 1488 for (size_t i = 0; i < animationList->size(); ++i) { 1489 const auto& animation = animationList->animation(i); 1488 for (const auto& animation : *animationList) { 1490 1489 auto childList = CSSValueList::createSpaceSeparated(); 1491 1490 for (auto longhand : shorthandForProperty(property)) 1492 ComputedStyleExtractor::addValueForAnimationPropertyToList(childList.get(), longhand, &animation);1491 ComputedStyleExtractor::addValueForAnimationPropertyToList(childList.get(), longhand, animation.ptr()); 1493 1492 parentList->append(childList); 1494 1493 } -
trunk/Source/WebCore/css/makeprop.pl
r284857 r287762 1068 1068 my $initial = $propertiesWithStyleBuilderOptions{$name}{"initial"}; 1069 1069 $setterContent .= $indent . "list.animation(0)." . $setter . "(Animation::" . $initial . "());\n"; 1070 $setterContent .= $indent . "for ( size_t i = 1; i < list.size(); ++i)\n";1071 $setterContent .= $indent . " list.animation(i)." . getClearFunction($name) . "();\n";1070 $setterContent .= $indent . "for (auto& animation : list)\n"; 1071 $setterContent .= $indent . " animation->" . getClearFunction($name) . "();\n"; 1072 1072 1073 1073 return $setterContent; -
trunk/Source/WebCore/platform/animation/AnimationList.h
r286532 r287762 55 55 Animation& animation(size_t i) { return m_animations[i].get(); } 56 56 const Animation& animation(size_t i) const { return m_animations[i].get(); } 57 57 58 auto begin() const { return m_animations.begin(); } 59 auto end() const { return m_animations.end(); } 60 61 using const_reverse_iterator = Vector<Ref<Animation>>::const_reverse_iterator; 62 const_reverse_iterator rbegin() const { return m_animations.rbegin(); } 63 const_reverse_iterator rend() const { return m_animations.rend(); } 64 58 65 private: 59 66 AnimationList(); -
trunk/Source/WebCore/style/Styleable.cpp
r287707 r287762 247 247 // first item in the list. 248 248 if (currentAnimationList) { 249 for (size_t i = currentAnimationList->size(); i > 0; --i) { 250 auto& currentAnimation = currentAnimationList->animation(i - 1); 251 if (!shouldConsiderAnimation(this->element, currentAnimation)) 249 for (auto& currentAnimation : makeReversedRange(*currentAnimationList)) { 250 if (!shouldConsiderAnimation(this->element, currentAnimation.get())) 252 251 continue; 253 252 254 253 bool foundMatchingAnimation = false; 255 254 for (auto& previousAnimation : previousAnimations) { 256 if (previousAnimation->animationName() == currentAnimation .name().string) {255 if (previousAnimation->animationName() == currentAnimation->name().string) { 257 256 // Timing properties or play state may have changed so we need to update the backing animation with 258 257 // the Animation found in the current style. 259 previousAnimation->setBackingAnimation(currentAnimation );258 previousAnimation->setBackingAnimation(currentAnimation.get()); 260 259 // Keyframes may have been cleared if the @keyframes rules was changed since 261 260 // the last style update, so we must ensure keyframes are picked up. … … 270 269 271 270 if (!foundMatchingAnimation) 272 newAnimations.add(CSSAnimation::create(*this, currentAnimation , currentStyle, newStyle, resolutionContext));271 newAnimations.add(CSSAnimation::create(*this, currentAnimation.get(), currentStyle, newStyle, resolutionContext)); 273 272 } 274 273 } … … 343 342 return; 344 343 345 for (size_t i = 0; i < transitions->size(); ++i) { 346 const auto& animation = transitions->animation(i); 347 auto mode = animation.property().mode; 344 for (const auto& animation : *transitions) { 345 auto mode = animation->property().mode; 348 346 if (mode == Animation::TransitionMode::SingleProperty) { 349 auto property = animation .property().id;347 auto property = animation->property().id; 350 348 if (isShorthandCSSProperty(property)) { 351 349 for (auto longhand : shorthandForProperty(property)) … … 376 374 const Animation* matchingBackingAnimation = nullptr; 377 375 if (auto* transitions = newStyle.transitions()) { 378 for (size_t i = 0; i < transitions->size(); ++i) { 379 auto& backingAnimation = transitions->animation(i); 380 if (transitionMatchesProperty(backingAnimation, property)) 381 matchingBackingAnimation = &backingAnimation; 376 for (auto& backingAnimation : *transitions) { 377 if (transitionMatchesProperty(backingAnimation.get(), property)) 378 matchingBackingAnimation = backingAnimation.ptr(); 382 379 } 383 380 }
Note:
See TracChangeset
for help on using the changeset viewer.