| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/gfx/compositor/layer.h" | 5 #include "ui/gfx/compositor/layer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 child->parent_ = NULL; | 116 child->parent_ = NULL; |
| 117 #if defined(USE_WEBKIT_COMPOSITOR) | 117 #if defined(USE_WEBKIT_COMPOSITOR) |
| 118 child->web_layer_.removeFromParent(); | 118 child->web_layer_.removeFromParent(); |
| 119 #endif | 119 #endif |
| 120 | 120 |
| 121 SetNeedsToRecomputeHole(); | 121 SetNeedsToRecomputeHole(); |
| 122 | 122 |
| 123 child->DropTextures(); | 123 child->DropTextures(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void Layer::MoveToFront(Layer* child) { | 126 void Layer::StackAtTop(Layer* child) { |
| 127 if (children_.size() <= 1 || child == children_.back()) | 127 if (children_.size() <= 1 || child == children_.back()) |
| 128 return; // Already in front. | 128 return; // Already in front. |
| 129 MoveAbove(child, children_.back()); | 129 StackAbove(child, children_.back()); |
| 130 | 130 |
| 131 SetNeedsToRecomputeHole(); | 131 SetNeedsToRecomputeHole(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void Layer::MoveAbove(Layer* child, Layer* other) { | 134 void Layer::StackAbove(Layer* child, Layer* other) { |
| 135 DCHECK_NE(child, other); | 135 DCHECK_NE(child, other); |
| 136 DCHECK_EQ(this, child->parent()); | 136 DCHECK_EQ(this, child->parent()); |
| 137 DCHECK_EQ(this, other->parent()); | 137 DCHECK_EQ(this, other->parent()); |
| 138 size_t child_i = | 138 size_t child_i = |
| 139 std::find(children_.begin(), children_.end(), child) - children_.begin(); | 139 std::find(children_.begin(), children_.end(), child) - children_.begin(); |
| 140 size_t other_i = | 140 size_t other_i = |
| 141 std::find(children_.begin(), children_.end(), other) - children_.begin(); | 141 std::find(children_.begin(), children_.end(), other) - children_.begin(); |
| 142 if (child_i > other_i) | 142 if (child_i > other_i) |
| 143 return; // Already in front of |other|. | 143 return; // Already in front of |other|. |
| 144 | 144 |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 0, | 733 0, |
| 734 static_cast<float>(size.width())/texture_cc->size().width(), | 734 static_cast<float>(size.width())/texture_cc->size().width(), |
| 735 static_cast<float>(size.height())/texture_cc->size().height()); | 735 static_cast<float>(size.height())/texture_cc->size().height()); |
| 736 texture_layer.setUVRect(rect); | 736 texture_layer.setUVRect(rect); |
| 737 web_layer_.setBounds(size); | 737 web_layer_.setBounds(size); |
| 738 } | 738 } |
| 739 } | 739 } |
| 740 #endif | 740 #endif |
| 741 | 741 |
| 742 } // namespace ui | 742 } // namespace ui |
| OLD | NEW |