Title: [288641] trunk/Source/WebCore
- Revision
- 288641
- Author
- [email protected]
- Date
- 2022-01-26 12:10:39 -0800 (Wed, 26 Jan 2022)
Log Message
Add an iterator to KeyframeList
https://bugs.webkit.org/show_bug.cgi?id=235652
Reviewed by Darin Adler.
Add an iterator for KeyframeList and remove the keyframes() method which serves no purpose now.
* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::getKeyframes):
(WebCore::KeyframeEffect::computeCSSAnimationBlendingKeyframes):
(WebCore::KeyframeEffect::computedNeedsForcedLayout):
(WebCore::KeyframeEffect::computeSomeKeyframesUseStepsTimingFunction):
(WebCore::KeyframeEffect::setAnimatedPropertiesInStyle):
(WebCore::KeyframeEffect::computeExtentOfTransformAnimation const):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::startAnimation):
* rendering/style/KeyframeList.cpp:
(WebCore::KeyframeList::copyKeyframes):
* rendering/style/KeyframeList.h:
(WebCore::KeyframeList::operator[] const):
(WebCore::KeyframeList::begin const):
(WebCore::KeyframeList::end const):
(WebCore::KeyframeList::keyframes const): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (288640 => 288641)
--- trunk/Source/WebCore/ChangeLog 2022-01-26 20:10:15 UTC (rev 288640)
+++ trunk/Source/WebCore/ChangeLog 2022-01-26 20:10:39 UTC (rev 288641)
@@ -1,3 +1,29 @@
+2022-01-26 Antoine Quint <[email protected]>
+
+ Add an iterator to KeyframeList
+ https://bugs.webkit.org/show_bug.cgi?id=235652
+
+ Reviewed by Darin Adler.
+
+ Add an iterator for KeyframeList and remove the keyframes() method which serves no purpose now.
+
+ * animation/KeyframeEffect.cpp:
+ (WebCore::KeyframeEffect::getKeyframes):
+ (WebCore::KeyframeEffect::computeCSSAnimationBlendingKeyframes):
+ (WebCore::KeyframeEffect::computedNeedsForcedLayout):
+ (WebCore::KeyframeEffect::computeSomeKeyframesUseStepsTimingFunction):
+ (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle):
+ (WebCore::KeyframeEffect::computeExtentOfTransformAnimation const):
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::startAnimation):
+ * rendering/style/KeyframeList.cpp:
+ (WebCore::KeyframeList::copyKeyframes):
+ * rendering/style/KeyframeList.h:
+ (WebCore::KeyframeList::operator[] const):
+ (WebCore::KeyframeList::begin const):
+ (WebCore::KeyframeList::end const):
+ (WebCore::KeyframeList::keyframes const): Deleted.
+
2022-01-26 Alexey Shvayka <[email protected]>
globalThis.queueMicrotask() should report thrown exceptions
Modified: trunk/Source/WebCore/animation/KeyframeEffect.cpp (288640 => 288641)
--- trunk/Source/WebCore/animation/KeyframeEffect.cpp 2022-01-26 20:10:15 UTC (rev 288640)
+++ trunk/Source/WebCore/animation/KeyframeEffect.cpp 2022-01-26 20:10:39 UTC (rev 288641)
@@ -647,7 +647,7 @@
auto _oneKeyframeProperties_ = computedKeyframeList.properties();
zeroKeyframeProperties.remove(CSSPropertyCustom);
oneKeyframeProperties.remove(CSSPropertyCustom);
- for (auto& keyframe : computedKeyframeList.keyframes()) {
+ for (auto& keyframe : computedKeyframeList) {
if (!keyframe.key()) {
for (auto cssPropertyId : keyframe.properties())
zeroKeyframeProperties.remove(cssPropertyId);
@@ -657,7 +657,7 @@
}
}
- for (auto& keyframe : computedKeyframeList.keyframes()) {
+ for (auto& keyframe : computedKeyframeList) {
auto& style = *keyframe.style();
auto* keyframeRule = keyframeRuleForKey(keyframe.key());
@@ -1050,7 +1050,7 @@
styleScope->resolver().keyframeStylesForAnimation(*m_target, &unanimatedStyle, resolutionContext, keyframeList);
// Ensure resource loads for all the frames.
- for (auto& keyframe : keyframeList.keyframes()) {
+ for (auto& keyframe : keyframeList) {
if (auto* style = const_cast<RenderStyle*>(keyframe.style()))
Style::loadPendingResources(*style, *document(), m_target.get());
}
@@ -1094,9 +1094,8 @@
if (is<CSSTransition>(animation()) || !m_blendingKeyframes.containsProperty(CSSPropertyTransform))
return;
- size_t numberOfKeyframes = m_blendingKeyframes.size();
- for (size_t i = 0; i < numberOfKeyframes; i++) {
- auto* keyframeStyle = m_blendingKeyframes[i].style();
+ for (auto& keyframe : m_blendingKeyframes) {
+ auto* keyframeStyle = keyframe.style();
if (!keyframeStyle) {
ASSERT_NOT_REACHED();
continue;
@@ -1349,14 +1348,12 @@
{
m_someKeyframesUseStepsTimingFunction = false;
- size_t numberOfKeyframes = m_blendingKeyframes.size();
-
// If we're dealing with a CSS Animation and it specifies a default steps() timing function,
// we need to check that any of the specified keyframes either does not have an explicit timing
// function or specifies an explicit steps() timing function.
if (is<CSSAnimation>(animation()) && is<StepsTimingFunction>(downcast<DeclarativeAnimation>(*animation()).backingAnimation().timingFunction())) {
- for (size_t i = 0; i < numberOfKeyframes; i++) {
- auto* timingFunction = m_blendingKeyframes[i].timingFunction();
+ for (auto& keyframe : m_blendingKeyframes) {
+ auto* timingFunction = keyframe.timingFunction();
if (!timingFunction || is<StepsTimingFunction>(timingFunction)) {
m_someKeyframesUseStepsTimingFunction = true;
return;
@@ -1367,8 +1364,8 @@
// For any other type of animation, we just need to check whether any of the keyframes specify
// an explicit steps() timing function.
- for (size_t i = 0; i < numberOfKeyframes; i++) {
- if (is<StepsTimingFunction>(m_blendingKeyframes[i].timingFunction())) {
+ for (auto& keyframe : m_blendingKeyframes) {
+ if (is<StepsTimingFunction>(keyframe.timingFunction())) {
m_someKeyframesUseStepsTimingFunction = true;
return;
}
@@ -1450,8 +1447,7 @@
unsigned numberOfKeyframesWithZeroOffset = 0;
unsigned numberOfKeyframesWithOneOffset = 0;
Vector<const KeyframeValue*> propertySpecificKeyframes;
- for (size_t i = 0; i < m_blendingKeyframes.size(); ++i) {
- auto& keyframe = m_blendingKeyframes[i];
+ for (auto& keyframe : m_blendingKeyframes) {
auto offset = keyframe.key();
if (!keyframe.containsProperty(cssPropertyId)) {
// If we're dealing with a CSS animation, we consider the first and last keyframes to always have the property listed
@@ -1948,7 +1944,7 @@
return true;
};
- for (const auto& keyframe : m_blendingKeyframes.keyframes()) {
+ for (const auto& keyframe : m_blendingKeyframes) {
const auto* keyframeStyle = keyframe.style();
// FIXME: maybe for declarative animations we always say it's true for the first and last keyframe.
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (288640 => 288641)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2022-01-26 20:10:15 UTC (rev 288640)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2022-01-26 20:10:39 UTC (rev 288641)
@@ -3683,9 +3683,7 @@
KeyframeValueList backdropFilterVector(AnimatedPropertyWebkitBackdropFilter);
#endif
- size_t numKeyframes = keyframes.size();
- for (size_t i = 0; i < numKeyframes; ++i) {
- const KeyframeValue& currentKeyframe = keyframes[i];
+ for (auto& currentKeyframe : keyframes) {
const RenderStyle* keyframeStyle = currentKeyframe.style();
double key = currentKeyframe.key();
Modified: trunk/Source/WebCore/rendering/style/KeyframeList.cpp (288640 => 288641)
--- trunk/Source/WebCore/rendering/style/KeyframeList.cpp 2022-01-26 20:10:15 UTC (rev 288640)
+++ trunk/Source/WebCore/rendering/style/KeyframeList.cpp 2022-01-26 20:10:39 UTC (rev 288641)
@@ -84,7 +84,7 @@
void KeyframeList::copyKeyframes(KeyframeList& other)
{
- for (auto& keyframe : other.keyframes()) {
+ for (auto& keyframe : other) {
KeyframeValue keyframeValue(keyframe.key(), RenderStyle::clonePtr(*keyframe.style()));
for (auto propertyId : keyframe.properties())
keyframeValue.addProperty(propertyId);
Modified: trunk/Source/WebCore/rendering/style/KeyframeList.h (288640 => 288641)
--- trunk/Source/WebCore/rendering/style/KeyframeList.h 2022-01-26 20:10:15 UTC (rev 288640)
+++ trunk/Source/WebCore/rendering/style/KeyframeList.h 2022-01-26 20:10:39 UTC (rev 288641)
@@ -97,12 +97,14 @@
bool isEmpty() const { return m_keyframes.isEmpty(); }
size_t size() const { return m_keyframes.size(); }
const KeyframeValue& operator[](size_t index) const { return m_keyframes[index]; }
- const Vector<KeyframeValue>& keyframes() const { return m_keyframes; }
void copyKeyframes(KeyframeList&);
bool hasImplicitKeyframes() const;
void fillImplicitKeyframes(const Element&, Style::Resolver&, const RenderStyle* elementStyle, const RenderStyle* parentElementStyle);
+ auto begin() const { return m_keyframes.begin(); }
+ auto end() const { return m_keyframes.end(); }
+
private:
AtomString m_animationName;
Vector<KeyframeValue> m_keyframes; // Kept sorted by key.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes