blob: 92f4b99d8514062233622497d619047a6d308bde [file] [log] [blame]
// 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/trees/property_animation_state.h"
#include "base/logging.h"
namespace cc {
PropertyAnimationState::PropertyAnimationState() {}
PropertyAnimationState::PropertyAnimationState(
const PropertyAnimationState& rhs)
: currently_running(rhs.currently_running),
potentially_animating(rhs.potentially_animating) {}
PropertyAnimationState::~PropertyAnimationState() {}
bool PropertyAnimationState::operator==(
const PropertyAnimationState& other) const {
return currently_running == other.currently_running &&
potentially_animating == other.potentially_animating;
}
bool PropertyAnimationState::operator!=(
const PropertyAnimationState& other) const {
return !operator==(other);
}
PropertyAnimationState& PropertyAnimationState::operator|=(
const PropertyAnimationState& other) {
currently_running |= other.currently_running;
potentially_animating |= other.potentially_animating;
return *this;
}
PropertyAnimationState& PropertyAnimationState::operator^=(
const PropertyAnimationState& other) {
currently_running ^= other.currently_running;
potentially_animating ^= other.potentially_animating;
return *this;
}
PropertyAnimationState& PropertyAnimationState::operator&=(
const PropertyAnimationState& other) {
currently_running &= other.currently_running;
potentially_animating &= other.potentially_animating;
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 i.e. potentially || !currently.
TargetProperties result = potentially_animating | ~currently_running;
return result.all();
}
void PropertyAnimationState::Clear() {
currently_running.reset();
potentially_animating.reset();
}
} // namespace cc