Chromium Code Reviews| Index: cc/animation/property_animation_state.cc |
| diff --git a/cc/animation/property_animation_state.cc b/cc/animation/property_animation_state.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1691744b294e5ce0b293ebf4a5d07bcff87ea1b0 |
| --- /dev/null |
| +++ b/cc/animation/property_animation_state.cc |
| @@ -0,0 +1,83 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "cc/animation/property_animation_state.h" |
| + |
| +#include "base/logging.h" |
| + |
| +namespace cc { |
| + |
| +bool PropertyAnimationState::operator==( |
| + const PropertyAnimationState& other) const { |
| + return currently_running_for_active_elements == |
| + other.currently_running_for_active_elements && |
| + currently_running_for_pending_elements == |
| + other.currently_running_for_pending_elements && |
| + potentially_animating_for_active_elements == |
| + other.potentially_animating_for_active_elements && |
| + potentially_animating_for_pending_elements == |
| + other.potentially_animating_for_pending_elements; |
| +} |
| + |
| +bool PropertyAnimationState::operator!=( |
| + const PropertyAnimationState& other) const { |
| + return !operator==(other); |
| +} |
| + |
| +PropertyAnimationState& PropertyAnimationState::operator|=( |
| + const PropertyAnimationState& other) { |
| + currently_running_for_active_elements |= |
| + other.currently_running_for_active_elements; |
| + currently_running_for_pending_elements |= |
| + other.currently_running_for_pending_elements; |
| + potentially_animating_for_active_elements |= |
| + other.potentially_animating_for_active_elements; |
| + potentially_animating_for_pending_elements |= |
| + other.potentially_animating_for_pending_elements; |
| + |
| + return *this; |
| +} |
| + |
| +PropertyAnimationState& PropertyAnimationState::operator^=( |
| + const PropertyAnimationState& other) { |
| + currently_running_for_active_elements ^= |
| + other.currently_running_for_active_elements; |
| + currently_running_for_pending_elements ^= |
| + other.currently_running_for_pending_elements; |
| + potentially_animating_for_active_elements ^= |
| + other.potentially_animating_for_active_elements; |
| + potentially_animating_for_pending_elements ^= |
| + other.potentially_animating_for_pending_elements; |
| + |
| + return *this; |
| +} |
| + |
| +PropertyAnimationState operator^(const PropertyAnimationState& lhs, |
| + const PropertyAnimationState& rhs) { |
| + PropertyAnimationState result = lhs; |
| + result ^= rhs; |
| + return result; |
| +} |
| + |
| +bool PropertyAnimationState::IsValid() const { |
| + // currently_running must be a subset for potentially_animating. |
| + // currently <= potentially. |
| + DCHECK_LE(currently_running_for_active_elements, |
| + potentially_animating_for_active_elements); |
| + DCHECK_LE(currently_running_for_pending_elements, |
| + potentially_animating_for_pending_elements); |
| + return currently_running_for_active_elements <= |
|
ajuma
2016/09/16 16:50:52
Code after a DCHECK should assume that the DCHECK
loyso (OOO)
2016/09/19 02:45:35
Done.
|
| + potentially_animating_for_active_elements && |
| + currently_running_for_pending_elements <= |
| + potentially_animating_for_pending_elements; |
| +} |
| + |
| +void PropertyAnimationState::Clear() { |
| + currently_running_for_active_elements = false; |
| + currently_running_for_pending_elements = false; |
| + potentially_animating_for_active_elements = false; |
| + potentially_animating_for_pending_elements = false; |
| +} |
| + |
| +} // namespace cc |