Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 25 matching lines...) Expand all Loading... | |
| 36 #include "core/animation/css/CSSAnimations.h" | 36 #include "core/animation/css/CSSAnimations.h" |
| 37 #include "core/dom/DOMNodeIds.h" | 37 #include "core/dom/DOMNodeIds.h" |
| 38 #include "core/dom/Document.h" | 38 #include "core/dom/Document.h" |
| 39 #include "core/dom/ExceptionCode.h" | 39 #include "core/dom/ExceptionCode.h" |
| 40 #include "core/dom/ExecutionContext.h" | 40 #include "core/dom/ExecutionContext.h" |
| 41 #include "core/dom/StyleChangeReason.h" | 41 #include "core/dom/StyleChangeReason.h" |
| 42 #include "core/dom/TaskRunnerHelper.h" | 42 #include "core/dom/TaskRunnerHelper.h" |
| 43 #include "core/events/AnimationPlaybackEvent.h" | 43 #include "core/events/AnimationPlaybackEvent.h" |
| 44 #include "core/frame/UseCounter.h" | 44 #include "core/frame/UseCounter.h" |
| 45 #include "core/inspector/InspectorTraceEvents.h" | 45 #include "core/inspector/InspectorTraceEvents.h" |
| 46 #include "core/paint/PaintLayer.h" | |
| 46 #include "core/probe/CoreProbes.h" | 47 #include "core/probe/CoreProbes.h" |
| 47 #include "platform/RuntimeEnabledFeatures.h" | 48 #include "platform/RuntimeEnabledFeatures.h" |
| 48 #include "platform/ScriptForbiddenScope.h" | 49 #include "platform/ScriptForbiddenScope.h" |
| 49 #include "platform/WebTaskRunner.h" | 50 #include "platform/WebTaskRunner.h" |
| 50 #include "platform/animation/CompositorAnimationPlayer.h" | 51 #include "platform/animation/CompositorAnimationPlayer.h" |
| 51 #include "platform/heap/Persistent.h" | 52 #include "platform/heap/Persistent.h" |
| 52 #include "platform/instrumentation/tracing/TraceEvent.h" | 53 #include "platform/instrumentation/tracing/TraceEvent.h" |
| 53 #include "platform/wtf/MathExtras.h" | 54 #include "platform/wtf/MathExtras.h" |
| 54 #include "platform/wtf/PtrUtil.h" | 55 #include "platform/wtf/PtrUtil.h" |
| 55 #include "public/platform/Platform.h" | 56 #include "public/platform/Platform.h" |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 745 | 746 |
| 746 // If the optional element id set has no value we must be in SPv1 mode in | 747 // If the optional element id set has no value we must be in SPv1 mode in |
| 747 // which case we trust the compositing logic will create a layer if needed. | 748 // which case we trust the compositing logic will create a layer if needed. |
| 748 if (composited_element_ids.has_value()) { | 749 if (composited_element_ids.has_value()) { |
| 749 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 750 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 750 Element* target_element = | 751 Element* target_element = |
| 751 ToKeyframeEffectReadOnly(content_.Get())->Target(); | 752 ToKeyframeEffectReadOnly(content_.Get())->Target(); |
| 752 if (!target_element) | 753 if (!target_element) |
| 753 return false; | 754 return false; |
| 754 | 755 |
| 755 CompositorElementId target_element_id = CompositorElementIdFromDOMNodeId( | 756 if (target_element->GetLayoutObject() && |
|
wkorman
2017/05/18 00:45:58
nit: pulling target_element->GetLayoutObject() int
| |
| 756 DOMNodeIds::IdForNode(target_element), | 757 target_element->GetLayoutObject()->IsBoxModelObject() && |
| 757 CompositorElementIdNamespace::kPrimary); | 758 target_element->GetLayoutObject()->HasLayer()) { |
| 758 if (!composited_element_ids->Contains(target_element_id)) | 759 PaintLayer* paint_layer = |
| 760 ToLayoutBoxModelObject(target_element->GetLayoutObject())->Layer(); | |
| 761 CompositorElementId target_element_id = | |
| 762 CompositorElementIdFromPaintLayerId( | |
| 763 paint_layer->UniqueId(), CompositorElementIdNamespace::kPrimary); | |
| 764 if (!composited_element_ids->Contains(target_element_id)) | |
| 765 return false; | |
| 766 } else { | |
|
wkorman
2017/05/18 00:45:58
nit: maybe more readable if we add
if (!composite
| |
| 759 return false; | 767 return false; |
| 768 } | |
| 760 } | 769 } |
| 761 | 770 |
| 762 return Playing(); | 771 return Playing(); |
| 763 } | 772 } |
| 764 | 773 |
| 765 bool Animation::IsCandidateForAnimationOnCompositor( | 774 bool Animation::IsCandidateForAnimationOnCompositor( |
| 766 const Optional<CompositorElementIdSet>& composited_element_ids) const { | 775 const Optional<CompositorElementIdSet>& composited_element_ids) const { |
| 767 if (!CanStartAnimationOnCompositor(composited_element_ids)) | 776 if (!CanStartAnimationOnCompositor(composited_element_ids)) |
| 768 return false; | 777 return false; |
| 769 | 778 |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1201 DCHECK(!compositor_player_); | 1210 DCHECK(!compositor_player_); |
| 1202 } | 1211 } |
| 1203 | 1212 |
| 1204 void Animation::CompositorAnimationPlayerHolder::Detach() { | 1213 void Animation::CompositorAnimationPlayerHolder::Detach() { |
| 1205 DCHECK(compositor_player_); | 1214 DCHECK(compositor_player_); |
| 1206 compositor_player_->SetAnimationDelegate(nullptr); | 1215 compositor_player_->SetAnimationDelegate(nullptr); |
| 1207 animation_ = nullptr; | 1216 animation_ = nullptr; |
| 1208 compositor_player_.reset(); | 1217 compositor_player_.reset(); |
| 1209 } | 1218 } |
| 1210 } // namespace blink | 1219 } // namespace blink |
| OLD | NEW |