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

Unified Diff: ui/views/view.cc

Issue 2813353002: Ensure that the focus ring in the bookmarks bar does not paint outside the parent view. (Closed)
Patch Set: Fix test Created 3 years, 8 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
Index: ui/views/view.cc
diff --git a/ui/views/view.cc b/ui/views/view.cc
index 83192d8c93df41d122c633fa68f89130182ba0cb..a7e65a8390840e6e443a7e0e19561989dca82abf 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -296,6 +296,8 @@ void View::ReorderChildView(View* view, int index) {
ReorderLayers();
}
+void View::OnChildLayerChanged(View* child) {}
+
void View::RemoveChildView(View* view) {
DoRemoveChildView(view, true, true, false, NULL);
}
@@ -537,12 +539,19 @@ void View::SetPaintToLayer(ui::LayerType layer_type) {
if (paint_to_layer_ && (layer()->type() == layer_type))
return;
- DestroyLayer();
+ DestroyLayerImpl(DONT_NOTIFY);
CreateLayer(layer_type);
paint_to_layer_ = true;
+
+ // Notify the parent chain about the layer change.
+ NotifyParentsOfLayerChange();
}
void View::DestroyLayer() {
+ DestroyLayerImpl(NOTIFY);
+}
+
+void View::DestroyLayerImpl(LayerChangeNotifyBehavior notify_parents) {
if (!paint_to_layer_)
return;
@@ -567,6 +576,10 @@ void View::DestroyLayer() {
SchedulePaint();
+ // Notify the parent chain about the layer change.
+ if (notify_parents == NOTIFY)
+ NotifyParentsOfLayerChange();
+
Widget* widget = GetWidget();
if (widget)
widget->LayerTreeChanged();
@@ -2650,4 +2663,13 @@ bool View::DoDrag(const ui::LocatedEvent& event,
return true;
}
+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();
+ }
+}
+
} // namespace views

Powered by Google App Engine
This is Rietveld 408576698