Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(939)

Unified Diff: ui/views/view.cc

Issue 15922004: Rename Widget::CalculateOffsetToAncestorWithLayer() to Widget::GetLayer() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/view.h ('k') | ui/views/view_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/view.cc
diff --git a/ui/views/view.cc b/ui/views/view.cc
index 0e12e14f494eed0172f426d2ca2986b44a24d97f..4bd82c84994af9c27ef343a7fadd29d3a4bef176 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -1374,6 +1374,19 @@ gfx::Vector2d View::CalculateOffsetToAncestorWithLayer(
parent_->CalculateOffsetToAncestorWithLayer(layer_parent);
}
+void View::UpdateParentLayer() {
+ if (!layer())
+ return;
+
+ ui::Layer* parent_layer = NULL;
+ gfx::Vector2d offset(GetMirroredX(), y());
+
+ if (parent_)
+ offset += parent_->CalculateOffsetToAncestorWithLayer(&parent_layer);
+
+ ReparentLayer(offset, parent_layer);
+}
+
void View::MoveLayerToParent(ui::Layer* parent_layer,
const gfx::Point& point) {
gfx::Point local_point(point);
@@ -1439,20 +1452,20 @@ void View::ReorderLayers() {
while (v && !v->layer())
v = v->parent();
- // Forward to widget in case we're in a NativeWidgetAura.
if (!v) {
- if (GetWidget())
- GetWidget()->ReorderLayers();
+ Widget* widget = GetWidget();
+ if (widget) {
+ ui::Layer* layer = widget->GetLayer();
+ if (layer)
+ widget->GetRootView()->ReorderChildLayers(layer);
+ }
} else {
- for (Views::const_iterator i(v->children_.begin());
- i != v->children_.end();
- ++i)
- (*i)->ReorderChildLayers(v->layer());
+ v->ReorderChildLayers(v->layer());
}
}
void View::ReorderChildLayers(ui::Layer* parent_layer) {
- if (layer()) {
+ if (layer() && layer() != parent_layer) {
DCHECK_EQ(parent_layer, layer()->parent());
parent_layer->StackAtTop(layer());
} else {
@@ -2020,24 +2033,6 @@ void View::UpdateParentLayers() {
}
}
-void View::UpdateParentLayer() {
- if (!layer())
- return;
-
- ui::Layer* parent_layer = NULL;
- gfx::Vector2d offset(GetMirroredX(), y());
-
- // TODO(sad): The NULL check here for parent_ essentially is to check if this
- // is the RootView. Instead of doing this, this function should be made
- // virtual and overridden from the RootView.
- if (parent_)
- offset += parent_->CalculateOffsetToAncestorWithLayer(&parent_layer);
- else if (!parent_ && GetWidget())
- offset += GetWidget()->CalculateOffsetToAncestorWithLayer(&parent_layer);
-
- ReparentLayer(offset, parent_layer);
-}
-
void View::OrphanLayers() {
if (layer()) {
if (layer()->parent())
« no previous file with comments | « ui/views/view.h ('k') | ui/views/view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698