| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/compositor/layer_animation_sequence.h" | 5 #include "ui/compositor/layer_animation_sequence.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 | 9 |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 waiting_for_group_start_ = false; | 168 waiting_for_group_start_ = false; |
| 169 NotifyAborted(); | 169 NotifyAborted(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void LayerAnimationSequence::AddElement(LayerAnimationElement* element) { | 172 void LayerAnimationSequence::AddElement(LayerAnimationElement* element) { |
| 173 properties_.insert(element->properties().begin(), | 173 properties_.insert(element->properties().begin(), |
| 174 element->properties().end()); | 174 element->properties().end()); |
| 175 elements_.push_back(make_linked_ptr(element)); | 175 elements_.push_back(make_linked_ptr(element)); |
| 176 } | 176 } |
| 177 | 177 |
| 178 bool LayerAnimationSequence::HasCommonProperty( | 178 bool LayerAnimationSequence::HasConflictingProperty( |
| 179 const LayerAnimationElement::AnimatableProperties& other) const { | 179 const LayerAnimationElement::AnimatableProperties& other) const { |
| 180 LayerAnimationElement::AnimatableProperties intersection; | 180 LayerAnimationElement::AnimatableProperties intersection; |
| 181 std::insert_iterator<LayerAnimationElement::AnimatableProperties> ii( | 181 std::insert_iterator<LayerAnimationElement::AnimatableProperties> ii( |
| 182 intersection, intersection.begin()); | 182 intersection, intersection.begin()); |
| 183 std::set_intersection(properties_.begin(), properties_.end(), | 183 std::set_intersection(properties_.begin(), properties_.end(), |
| 184 other.begin(), other.end(), | 184 other.begin(), other.end(), |
| 185 ii); | 185 ii); |
| 186 return intersection.size() > 0; | 186 if (intersection.size() > 0) |
| 187 return true; |
| 188 |
| 189 if (properties_.find(LayerAnimationElement::TRANSFORM) != properties_.end() && |
| 190 other.find(LayerAnimationElement::BOUNDS) != other.end()) |
| 191 return true; |
| 192 |
| 193 if (properties_.find(LayerAnimationElement::BOUNDS) != properties_.end() && |
| 194 other.find(LayerAnimationElement::TRANSFORM) != other.end()) |
| 195 return true; |
| 196 |
| 197 return false; |
| 187 } | 198 } |
| 188 | 199 |
| 189 bool LayerAnimationSequence::IsFirstElementThreaded() const { | 200 bool LayerAnimationSequence::IsFirstElementThreaded() const { |
| 190 if (!elements_.empty()) | 201 if (!elements_.empty()) |
| 191 return elements_[0]->IsThreaded(); | 202 return elements_[0]->IsThreaded(); |
| 192 | 203 |
| 193 return false; | 204 return false; |
| 194 } | 205 } |
| 195 | 206 |
| 196 void LayerAnimationSequence::AddObserver(LayerAnimationObserver* observer) { | 207 void LayerAnimationSequence::AddObserver(LayerAnimationObserver* observer) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 270 |
| 260 LayerAnimationElement* LayerAnimationSequence::CurrentElement() { | 271 LayerAnimationElement* LayerAnimationSequence::CurrentElement() { |
| 261 if (elements_.empty()) | 272 if (elements_.empty()) |
| 262 return NULL; | 273 return NULL; |
| 263 | 274 |
| 264 size_t current_index = last_element_ % elements_.size(); | 275 size_t current_index = last_element_ % elements_.size(); |
| 265 return elements_[current_index].get(); | 276 return elements_[current_index].get(); |
| 266 } | 277 } |
| 267 | 278 |
| 268 } // namespace ui | 279 } // namespace ui |
| OLD | NEW |