Title: [294276] branches/safari-613-branch/Source/WebCore

Diff

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (294275 => 294276)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-05-16 23:03:23 UTC (rev 294275)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-05-16 23:13:31 UTC (rev 294276)
@@ -1,3 +1,32 @@
+2022-05-16  Alan Coon  <alanc...@apple.com>
+
+        Apply patch. rdar://problem/88408231
+
+    2022-02-02  Antoine Quint  <grao...@webkit.org>
+
+            Keyframe resolution methods should use reference instead of pointer parameters
+            https://bugs.webkit.org/show_bug.cgi?id=236020
+
+            Reviewed by Dean Jackson.
+
+            The Style::Resolver::styleForKeyframe() method would take in a `const RenderStyle*`
+            and a `const StyleRuleKeyframe*` but these parameters were used without null checks.
+            This patch changes this method signature to take in references instead, which involves
+            also changing the signature for Style::Resolver::keyframeStylesForAnimation().
+
+            * animation/KeyframeEffect.cpp:
+            (WebCore::KeyframeEffect::getKeyframes):
+            (WebCore::KeyframeEffect::updateBlendingKeyframes):
+            (WebCore::KeyframeEffect::computeCSSAnimationBlendingKeyframes):
+            (WebCore::KeyframeEffect::applyPendingAcceleratedActions):
+            * rendering/style/KeyframeList.cpp:
+            (WebCore::KeyframeList::fillImplicitKeyframes):
+            * rendering/style/KeyframeList.h:
+            * style/StyleResolver.cpp:
+            (WebCore::Style::Resolver::styleForKeyframe):
+            (WebCore::Style::Resolver::keyframeStylesForAnimation):
+            * style/StyleResolver.h:
+
 2022-05-03  Sihui Liu  <sihui_...@apple.com>
 
         StorageMap::removeItem may fail to remove item from map

Modified: branches/safari-613-branch/Source/WebCore/animation/KeyframeEffect.cpp (294275 => 294276)


--- branches/safari-613-branch/Source/WebCore/animation/KeyframeEffect.cpp	2022-05-16 23:03:23 UTC (rev 294275)
+++ branches/safari-613-branch/Source/WebCore/animation/KeyframeEffect.cpp	2022-05-16 23:13:31 UTC (rev 294276)
@@ -637,12 +637,13 @@
         auto* target = m_target.get();
         auto* renderer = this->renderer();
         auto* lastStyleChangeEventStyle = targetStyleable()->lastStyleChangeEventStyle();
+        auto& elementStyle = lastStyleChangeEventStyle ? *lastStyleChangeEventStyle : currentStyle();
 
         auto computedStyleExtractor = ComputedStyleExtractor(target, false, m_pseudoId);
 
         KeyframeList computedKeyframes(m_blendingKeyframes.animationName());
         computedKeyframes.copyKeyframes(m_blendingKeyframes);
-        computedKeyframes.fillImplicitKeyframes(*m_target, m_target->styleResolver(), lastStyleChangeEventStyle, nullptr);
+        computedKeyframes.fillImplicitKeyframes(*m_target, m_target->styleResolver(), elementStyle, nullptr);
 
         auto keyframeRules = [&]() -> const Vector<Ref<StyleRuleKeyframe>> {
             if (!is<CSSAnimation>(animation()))
@@ -947,7 +948,7 @@
             keyframeList.addProperty(styleProperties->propertyAt(i).id());
 
         auto keyframeRule = StyleRuleKeyframe::create(WTFMove(styleProperties));
-        keyframeValue.setStyle(styleResolver.styleForKeyframe(*m_target, &elementStyle, resolutionContext, keyframeRule.ptr(), keyframeValue));
+        keyframeValue.setStyle(styleResolver.styleForKeyframe(*m_target, elementStyle, resolutionContext, keyframeRule.get(), keyframeValue));
         keyframeList.insert(WTFMove(keyframeValue));
     }
 
@@ -1143,7 +1144,7 @@
 
     KeyframeList keyframeList(backingAnimation.name().string);
     if (auto* styleScope = Style::Scope::forOrdinal(*m_target, backingAnimation.nameStyleScopeOrdinal()))
-        styleScope->resolver().keyframeStylesForAnimation(*m_target, &unanimatedStyle, resolutionContext, keyframeList);
+        styleScope->resolver().keyframeStylesForAnimation(*m_target, unanimatedStyle, resolutionContext, keyframeList);
 
     // Ensure resource loads for all the frames.
     for (auto& keyframe : keyframeList.keyframes()) {
@@ -1899,7 +1900,7 @@
 
         KeyframeList explicitKeyframes(m_blendingKeyframes.animationName());
         explicitKeyframes.copyKeyframes(m_blendingKeyframes);
-        explicitKeyframes.fillImplicitKeyframes(*m_target, m_target->styleResolver(), underlyingStyle.get(), nullptr);
+        explicitKeyframes.fillImplicitKeyframes(*m_target, m_target->styleResolver(), *underlyingStyle, nullptr);
         return renderer->startAnimation(timeOffset, backingAnimationForCompositedRenderer(), explicitKeyframes) ? RunningAccelerated::Yes : RunningAccelerated::No;
     };
 

Modified: branches/safari-613-branch/Source/WebCore/rendering/style/KeyframeList.cpp (294275 => 294276)


--- branches/safari-613-branch/Source/WebCore/rendering/style/KeyframeList.cpp	2022-05-16 23:03:23 UTC (rev 294275)
+++ branches/safari-613-branch/Source/WebCore/rendering/style/KeyframeList.cpp	2022-05-16 23:13:31 UTC (rev 294276)
@@ -116,13 +116,13 @@
     return rule.get().get();
 }
 
-void KeyframeList::fillImplicitKeyframes(const Element& element, Style::Resolver& styleResolver, const RenderStyle* elementStyle, const RenderStyle* parentElementStyle)
+void KeyframeList::fillImplicitKeyframes(const Element& element, Style::Resolver& styleResolver, const RenderStyle& elementStyle, const RenderStyle* parentElementStyle)
 {
     // If the 0% keyframe is missing, create it (but only if there is at least one other keyframe).
     auto initialSize = size();
     if (initialSize > 0 && m_keyframes[0].key()) {
         KeyframeValue keyframeValue(0, nullptr);
-        keyframeValue.setStyle(styleResolver.styleForKeyframe(element, elementStyle, { parentElementStyle }, &zeroPercentKeyframe(), keyframeValue));
+        keyframeValue.setStyle(styleResolver.styleForKeyframe(element, elementStyle, { parentElementStyle }, zeroPercentKeyframe(), keyframeValue));
         insert(WTFMove(keyframeValue));
     }
 
@@ -129,7 +129,7 @@
     // If the 100% keyframe is missing, create it (but only if there is at least one other keyframe).
     if (initialSize > 0 && (m_keyframes[size() - 1].key() != 1)) {
         KeyframeValue keyframeValue(1, nullptr);
-        keyframeValue.setStyle(styleResolver.styleForKeyframe(element, elementStyle, { parentElementStyle }, &hundredPercentKeyframe(), keyframeValue));
+        keyframeValue.setStyle(styleResolver.styleForKeyframe(element, elementStyle, { parentElementStyle }, hundredPercentKeyframe(), keyframeValue));
         insert(WTFMove(keyframeValue));
     }
 }

Modified: branches/safari-613-branch/Source/WebCore/rendering/style/KeyframeList.h (294275 => 294276)


--- branches/safari-613-branch/Source/WebCore/rendering/style/KeyframeList.h	2022-05-16 23:03:23 UTC (rev 294275)
+++ branches/safari-613-branch/Source/WebCore/rendering/style/KeyframeList.h	2022-05-16 23:13:31 UTC (rev 294276)
@@ -101,7 +101,7 @@
 
     void copyKeyframes(KeyframeList&);
     bool hasImplicitKeyframes() const;
-    void fillImplicitKeyframes(const Element&, Style::Resolver&, const RenderStyle* elementStyle, const RenderStyle* parentElementStyle);
+    void fillImplicitKeyframes(const Element&, Style::Resolver&, const RenderStyle& elementStyle, const RenderStyle* parentElementStyle);
 
 private:
     AtomString m_animationName;

Modified: branches/safari-613-branch/Source/WebCore/style/StyleResolver.cpp (294275 => 294276)


--- branches/safari-613-branch/Source/WebCore/style/StyleResolver.cpp	2022-05-16 23:03:23 UTC (rev 294275)
+++ branches/safari-613-branch/Source/WebCore/style/StyleResolver.cpp	2022-05-16 23:13:31 UTC (rev 294276)
@@ -273,15 +273,15 @@
     return { state.takeStyle(), WTFMove(elementStyleRelations) };
 }
 
-std::unique_ptr<RenderStyle> Resolver::styleForKeyframe(const Element& element, const RenderStyle* elementStyle, const ResolutionContext& context, const StyleRuleKeyframe* keyframe, KeyframeValue& keyframeValue)
+std::unique_ptr<RenderStyle> Resolver::styleForKeyframe(const Element& element, const RenderStyle& elementStyle, const ResolutionContext& context, const StyleRuleKeyframe& keyframe, KeyframeValue& keyframeValue)
 {
     MatchResult result;
-    result.authorDeclarations.append({ &keyframe->properties(), SelectorChecker::MatchAll, propertyAllowlistForPseudoId(elementStyle->styleType()) });
+    result.authorDeclarations.append({ &keyframe.properties(), SelectorChecker::MatchAll, propertyAllowlistForPseudoId(elementStyle.styleType()) });
 
     auto state = State(element, nullptr, context.documentElementStyle);
 
-    state.setStyle(RenderStyle::clonePtr(*elementStyle));
-    state.setParentStyle(RenderStyle::clonePtr(context.parentStyle ? *context.parentStyle : *elementStyle));
+    state.setStyle(RenderStyle::clonePtr(elementStyle));
+    state.setParentStyle(RenderStyle::clonePtr(context.parentStyle ? *context.parentStyle : elementStyle));
 
     Builder builder(*state.style(), builderContext(state), result, CascadeLevel::Author);
     builder.applyAllProperties();
@@ -290,9 +290,9 @@
     adjuster.adjust(*state.style(), state.userAgentAppearanceStyle());
 
     // Add all the animating properties to the keyframe.
-    unsigned propertyCount = keyframe->properties().propertyCount();
+    unsigned propertyCount = keyframe.properties().propertyCount();
     for (unsigned i = 0; i < propertyCount; ++i) {
-        CSSPropertyID property = keyframe->properties().propertyAt(i).id();
+        CSSPropertyID property = keyframe.properties().propertyAt(i).id();
         // Timing-function within keyframes is special, because it is not animated; it just
         // describes the timing function between this keyframe and the next.
         if (property != CSSPropertyAnimationTimingFunction)
@@ -379,7 +379,7 @@
     return deduplicatedKeyframes;
 }
 
-void Resolver::keyframeStylesForAnimation(const Element& element, const RenderStyle* elementStyle, const ResolutionContext& context, KeyframeList& list)
+void Resolver::keyframeStylesForAnimation(const Element& element, const RenderStyle& elementStyle, const ResolutionContext& context, KeyframeList& list)
 {
     list.clear();
 
@@ -392,7 +392,7 @@
         // Add this keyframe style to all the indicated key times
         for (auto key : keyframeRule->keys()) {
             KeyframeValue keyframeValue(0, nullptr);
-            keyframeValue.setStyle(styleForKeyframe(element, elementStyle, context, keyframeRule.ptr(), keyframeValue));
+            keyframeValue.setStyle(styleForKeyframe(element, elementStyle, context, keyframeRule.get(), keyframeValue));
             keyframeValue.setKey(key);
             if (auto timingFunctionCSSValue = keyframeRule->properties().getPropertyCSSValue(CSSPropertyAnimationTimingFunction))
                 keyframeValue.setTimingFunction(TimingFunction::createFromCSSValue(*timingFunctionCSSValue.get()));

Modified: branches/safari-613-branch/Source/WebCore/style/StyleResolver.h (294275 => 294276)


--- branches/safari-613-branch/Source/WebCore/style/StyleResolver.h	2022-05-16 23:03:23 UTC (rev 294275)
+++ branches/safari-613-branch/Source/WebCore/style/StyleResolver.h	2022-05-16 23:13:31 UTC (rev 294276)
@@ -98,7 +98,7 @@
 
     ElementStyle styleForElement(const Element&, const ResolutionContext&, RuleMatchingBehavior = RuleMatchingBehavior::MatchAllRules);
 
-    void keyframeStylesForAnimation(const Element&, const RenderStyle* elementStyle, const ResolutionContext&, KeyframeList&);
+    void keyframeStylesForAnimation(const Element&, const RenderStyle& elementStyle, const ResolutionContext&, KeyframeList&);
 
     WEBCORE_EXPORT std::unique_ptr<RenderStyle> pseudoStyleForElement(const Element&, const PseudoElementRequest&, const ResolutionContext&);
 
@@ -118,7 +118,7 @@
 
     void addCurrentSVGFontFaceRules();
 
-    std::unique_ptr<RenderStyle> styleForKeyframe(const Element&, const RenderStyle* elementStyle, const ResolutionContext&, const StyleRuleKeyframe*, KeyframeValue&);
+    std::unique_ptr<RenderStyle> styleForKeyframe(const Element&, const RenderStyle& elementStyle, const ResolutionContext&, const StyleRuleKeyframe&, KeyframeValue&);
     bool isAnimationNameValid(const String&);
 
     // These methods will give back the set of rules that matched for a given element (or a pseudo-element).
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to