Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Unified Diff: third_party/WebKit/Source/core/animation/Animation.cpp

Issue 2961573002: Fix nullptr deref in InvalidateKeyframeEffect (Closed)
Patch Set: Response to review Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/animations/keyframeeffect-no-target-crash-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/animation/Animation.cpp
diff --git a/third_party/WebKit/Source/core/animation/Animation.cpp b/third_party/WebKit/Source/core/animation/Animation.cpp
index bd3225a61e3d3554eb391a103b7f23fc5a7bb609..dc8a9c30edbea651c5c4956918a14fbae96daa5a 100644
--- a/third_party/WebKit/Source/core/animation/Animation.cpp
+++ b/third_party/WebKit/Source/core/animation/Animation.cpp
@@ -1214,12 +1214,18 @@ void Animation::InvalidateKeyframeEffect(const TreeScope& tree_scope) {
if (!content_ || !content_->IsKeyframeEffectReadOnly())
return;
- Element& target = *ToKeyframeEffectReadOnly(content_.Get())->Target();
-
- if (CSSAnimations::IsAffectedByKeyframesFromScope(target, tree_scope))
- target.SetNeedsStyleRecalc(kLocalStyleChange,
- StyleChangeReasonForTracing::Create(
- StyleChangeReason::kStyleSheetChange));
+ Element* target = ToKeyframeEffectReadOnly(content_.Get())->Target();
+
+ // TODO(alancutter): Remove dependency of this function on CSSAnimations.
+ // This function makes the incorrect assumption that the animation uses
+ // @keyframes for its effect model when it may instead be using JS provided
+ // keyframes.
+ if (target &&
+ CSSAnimations::IsAffectedByKeyframesFromScope(*target, tree_scope)) {
+ target->SetNeedsStyleRecalc(kLocalStyleChange,
+ StyleChangeReasonForTracing::Create(
+ StyleChangeReason::kStyleSheetChange));
+ }
}
void Animation::ResolvePromiseMaybeAsync(AnimationPromise* promise) {
« no previous file with comments | « third_party/WebKit/LayoutTests/animations/keyframeeffect-no-target-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698