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

Unified Diff: ui/views/view.cc

Issue 2883273007: Revert of Ensure that the focus ring in the bookmarks bar does not paint outside the parent view. (Closed)
Patch Set: Created 3 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 27eada4660d6798ae106657b69e53a3358dd1d72..6b231e9b15dc3498c65ef3322b7443069520cd7d 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -537,16 +537,39 @@
if (paint_to_layer_ && (layer()->type() == layer_type))
return;
- DestroyLayerImpl(LayerChangeNotifyBehavior::DONT_NOTIFY);
+ DestroyLayer();
CreateLayer(layer_type);
paint_to_layer_ = true;
-
- // Notify the parent chain about the layer change.
- NotifyParentsOfLayerChange();
}
void View::DestroyLayer() {
- DestroyLayerImpl(LayerChangeNotifyBehavior::NOTIFY);
+ if (!paint_to_layer_)
+ return;
+
+ paint_to_layer_ = false;
+ if (!layer())
+ return;
+
+ ui::Layer* new_parent = layer()->parent();
+ std::vector<ui::Layer*> children = layer()->children();
+ for (size_t i = 0; i < children.size(); ++i) {
+ layer()->Remove(children[i]);
+ if (new_parent)
+ new_parent->Add(children[i]);
+ }
+
+ LayerOwner::DestroyLayer();
+
+ if (new_parent)
+ ReorderLayers();
+
+ UpdateChildLayerBounds(CalculateOffsetToAncestorWithLayer(NULL));
+
+ SchedulePaint();
+
+ Widget* widget = GetWidget();
+ if (widget)
+ widget->LayerTreeChanged();
}
std::unique_ptr<ui::Layer> View::RecreateLayer() {
@@ -1605,49 +1628,6 @@
}
}
-void View::DestroyLayerImpl(LayerChangeNotifyBehavior notify_parents) {
- if (!paint_to_layer_)
- return;
-
- paint_to_layer_ = false;
- if (!layer())
- return;
-
- ui::Layer* new_parent = layer()->parent();
- std::vector<ui::Layer*> children = layer()->children();
- for (size_t i = 0; i < children.size(); ++i) {
- layer()->Remove(children[i]);
- if (new_parent)
- new_parent->Add(children[i]);
- }
-
- LayerOwner::DestroyLayer();
-
- if (new_parent)
- ReorderLayers();
-
- UpdateChildLayerBounds(CalculateOffsetToAncestorWithLayer(NULL));
-
- SchedulePaint();
-
- // Notify the parent chain about the layer change.
- if (notify_parents == LayerChangeNotifyBehavior::NOTIFY)
- NotifyParentsOfLayerChange();
-
- Widget* widget = GetWidget();
- if (widget)
- widget->LayerTreeChanged();
-}
-
-void View::NotifyParentsOfLayerChange() {
- // Notify the parent chain about the layer change.
- View* view_parent = parent();
- while (view_parent) {
- view_parent->OnChildLayerChanged(this);
- view_parent = view_parent->parent();
- }
-}
-
void View::UpdateChildLayerBounds(const gfx::Vector2d& offset) {
if (layer()) {
SetLayerBounds(GetLocalBounds() + offset);
@@ -1715,8 +1695,6 @@
child->ReorderChildLayers(parent_layer);
}
}
-
-void View::OnChildLayerChanged(View* child) {}
// Input -----------------------------------------------------------------------
« 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