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

Side by Side Diff: third_party/WebKit/Source/core/animation/Animation.cpp

Issue 2961573002: Fix nullptr deref in InvalidateKeyframeEffect (Closed)
Patch Set: 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
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 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 1160
1161 void Animation::DisableCompositedAnimationForTesting() { 1161 void Animation::DisableCompositedAnimationForTesting() {
1162 is_composited_animation_disabled_for_testing_ = true; 1162 is_composited_animation_disabled_for_testing_ = true;
1163 CancelAnimationOnCompositor(); 1163 CancelAnimationOnCompositor();
1164 } 1164 }
1165 1165
1166 void Animation::InvalidateKeyframeEffect(const TreeScope& tree_scope) { 1166 void Animation::InvalidateKeyframeEffect(const TreeScope& tree_scope) {
1167 if (!content_ || !content_->IsKeyframeEffectReadOnly()) 1167 if (!content_ || !content_->IsKeyframeEffectReadOnly())
1168 return; 1168 return;
1169 1169
1170 Element& target = *ToKeyframeEffectReadOnly(content_.Get())->Target(); 1170 Element* target = ToKeyframeEffectReadOnly(content_.Get())->Target();
1171 1171
1172 if (CSSAnimations::IsAffectedByKeyframesFromScope(target, tree_scope)) 1172 if (target &&
1173 target.SetNeedsStyleRecalc(kLocalStyleChange, 1173 CSSAnimations::IsAffectedByKeyframesFromScope(*target, tree_scope)) {
alancutter (OOO until 2018) 2017/06/26 04:38:47 Please add a TODO to remove the use of CSSAnimatio
suzyh_UTC10 (ex-contributor) 2017/06/27 05:12:15 Done.
1174 StyleChangeReasonForTracing::Create( 1174 target->SetNeedsStyleRecalc(kLocalStyleChange,
1175 StyleChangeReason::kStyleSheetChange)); 1175 StyleChangeReasonForTracing::Create(
1176 StyleChangeReason::kStyleSheetChange));
1177 }
1176 } 1178 }
1177 1179
1178 void Animation::ResolvePromiseMaybeAsync(AnimationPromise* promise) { 1180 void Animation::ResolvePromiseMaybeAsync(AnimationPromise* promise) {
1179 if (ScriptForbiddenScope::IsScriptForbidden()) { 1181 if (ScriptForbiddenScope::IsScriptForbidden()) {
1180 TaskRunnerHelper::Get(TaskType::kDOMManipulation, GetExecutionContext()) 1182 TaskRunnerHelper::Get(TaskType::kDOMManipulation, GetExecutionContext())
1181 ->PostTask(BLINK_FROM_HERE, 1183 ->PostTask(BLINK_FROM_HERE,
1182 WTF::Bind(&AnimationPromise::Resolve<Animation*>, 1184 WTF::Bind(&AnimationPromise::Resolve<Animation*>,
1183 WrapPersistent(promise), WrapPersistent(this))); 1185 WrapPersistent(promise), WrapPersistent(this)));
1184 } else { 1186 } else {
1185 promise->Resolve(this); 1187 promise->Resolve(this);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 DCHECK(!compositor_player_); 1236 DCHECK(!compositor_player_);
1235 } 1237 }
1236 1238
1237 void Animation::CompositorAnimationPlayerHolder::Detach() { 1239 void Animation::CompositorAnimationPlayerHolder::Detach() {
1238 DCHECK(compositor_player_); 1240 DCHECK(compositor_player_);
1239 compositor_player_->SetAnimationDelegate(nullptr); 1241 compositor_player_->SetAnimationDelegate(nullptr);
1240 animation_ = nullptr; 1242 animation_ = nullptr;
1241 compositor_player_.reset(); 1243 compositor_player_.reset();
1242 } 1244 }
1243 } // namespace blink 1245 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698