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

Side by Side 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, 5 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 1207
1208 void Animation::DisableCompositedAnimationForTesting() { 1208 void Animation::DisableCompositedAnimationForTesting() {
1209 is_composited_animation_disabled_for_testing_ = true; 1209 is_composited_animation_disabled_for_testing_ = true;
1210 CancelAnimationOnCompositor(); 1210 CancelAnimationOnCompositor();
1211 } 1211 }
1212 1212
1213 void Animation::InvalidateKeyframeEffect(const TreeScope& tree_scope) { 1213 void Animation::InvalidateKeyframeEffect(const TreeScope& tree_scope) {
1214 if (!content_ || !content_->IsKeyframeEffectReadOnly()) 1214 if (!content_ || !content_->IsKeyframeEffectReadOnly())
1215 return; 1215 return;
1216 1216
1217 Element& target = *ToKeyframeEffectReadOnly(content_.Get())->Target(); 1217 Element* target = ToKeyframeEffectReadOnly(content_.Get())->Target();
1218 1218
1219 if (CSSAnimations::IsAffectedByKeyframesFromScope(target, tree_scope)) 1219 // TODO(alancutter): Remove dependency of this function on CSSAnimations.
1220 target.SetNeedsStyleRecalc(kLocalStyleChange, 1220 // This function makes the incorrect assumption that the animation uses
1221 StyleChangeReasonForTracing::Create( 1221 // @keyframes for its effect model when it may instead be using JS provided
1222 StyleChangeReason::kStyleSheetChange)); 1222 // keyframes.
1223 if (target &&
1224 CSSAnimations::IsAffectedByKeyframesFromScope(*target, tree_scope)) {
1225 target->SetNeedsStyleRecalc(kLocalStyleChange,
1226 StyleChangeReasonForTracing::Create(
1227 StyleChangeReason::kStyleSheetChange));
1228 }
1223 } 1229 }
1224 1230
1225 void Animation::ResolvePromiseMaybeAsync(AnimationPromise* promise) { 1231 void Animation::ResolvePromiseMaybeAsync(AnimationPromise* promise) {
1226 if (ScriptForbiddenScope::IsScriptForbidden()) { 1232 if (ScriptForbiddenScope::IsScriptForbidden()) {
1227 TaskRunnerHelper::Get(TaskType::kDOMManipulation, GetExecutionContext()) 1233 TaskRunnerHelper::Get(TaskType::kDOMManipulation, GetExecutionContext())
1228 ->PostTask(BLINK_FROM_HERE, 1234 ->PostTask(BLINK_FROM_HERE,
1229 WTF::Bind(&AnimationPromise::Resolve<Animation*>, 1235 WTF::Bind(&AnimationPromise::Resolve<Animation*>,
1230 WrapPersistent(promise), WrapPersistent(this))); 1236 WrapPersistent(promise), WrapPersistent(this)));
1231 } else { 1237 } else {
1232 promise->Resolve(this); 1238 promise->Resolve(this);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 DCHECK(!compositor_player_); 1287 DCHECK(!compositor_player_);
1282 } 1288 }
1283 1289
1284 void Animation::CompositorAnimationPlayerHolder::Detach() { 1290 void Animation::CompositorAnimationPlayerHolder::Detach() {
1285 DCHECK(compositor_player_); 1291 DCHECK(compositor_player_);
1286 compositor_player_->SetAnimationDelegate(nullptr); 1292 compositor_player_->SetAnimationDelegate(nullptr);
1287 animation_ = nullptr; 1293 animation_ = nullptr;
1288 compositor_player_.reset(); 1294 compositor_player_.reset();
1289 } 1295 }
1290 } // namespace blink 1296 } // namespace blink
OLDNEW
« 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