| Index: ash/common/system/tray/tray_details_view.cc
|
| diff --git a/ash/common/system/tray/tray_details_view.cc b/ash/common/system/tray/tray_details_view.cc
|
| index d48c0e3608800ba71fd7bb2ba4261fda9c035589..b273ff6ebd7ffc713e2c07075bd1109d794881aa 100644
|
| --- a/ash/common/system/tray/tray_details_view.cc
|
| +++ b/ash/common/system/tray/tray_details_view.cc
|
| @@ -100,6 +100,26 @@ class ScrollContentsView : public views::View,
|
| PositionHeaderRows();
|
| }
|
|
|
| + void ReorderChildLayers(ui::Layer* parent_layer) override {
|
| + views::View::ReorderChildLayers(parent_layer);
|
| + ui::Layer* topmost_layer = TopmostLayer(this, parent_layer);
|
| + if (!topmost_layer)
|
| + return;
|
| +
|
| + // Keep the sticky headers with layers above the rest of the children's
|
| + // layers. Make sure to avoid changing the stacking order of the layers that
|
| + // are children of |parent_layer| but do not belong to the same parent view.
|
| + // Note: this assumes that all views that have id=VIEW_ID_STICKY_HEADER have
|
| + // a layer.
|
| + for (int i = child_count() - 1; i >= 0; --i) {
|
| + View* child = child_at(i);
|
| + if (child->id() == VIEW_ID_STICKY_HEADER) {
|
| + if (child->layer() != topmost_layer)
|
| + parent_layer->StackAbove(child->layer(), topmost_layer);
|
| + }
|
| + }
|
| + }
|
| +
|
| void ViewHierarchyChanged(
|
| const ViewHierarchyChangedDetails& details) override {
|
| if (!details.is_add && details.parent == this) {
|
| @@ -234,6 +254,25 @@ class ScrollContentsView : public views::View,
|
| canvas->DrawRect(shadowed_area, paint);
|
| }
|
|
|
| + // Recursively iterates through children to return the child layer that is
|
| + // stacked at the top. Only considers layers that are direct |parent_layer|'s
|
| + // children.
|
| + ui::Layer* TopmostLayer(views::View* view, ui::Layer* parent_layer) {
|
| + DCHECK(parent_layer);
|
| + // Iterate backwards through the children to find the topmost layer.
|
| + for (int i = view->child_count() - 1; i >= 0; --i) {
|
| + views::View* child = view->child_at(i);
|
| + ui::Layer* layer = TopmostLayer(child, parent_layer);
|
| + if (layer)
|
| + return layer;
|
| + }
|
| + if (view->layer() && view->layer() != parent_layer &&
|
| + view->layer()->parent() == parent_layer) {
|
| + return view->layer();
|
| + }
|
| + return nullptr;
|
| + }
|
| +
|
| views::BoxLayout* box_layout_;
|
|
|
| // Header child views that stick to the top of visible viewport when scrolled.
|
|
|