| Index: ui/views/view.cc
|
| diff --git a/ui/views/view.cc b/ui/views/view.cc
|
| index 3023a1b57fb4aaa5452026bcd3cbd0e08b6bbe98..92223157d4c8671aaa2c55aab4c006d1ee25b265 100644
|
| --- a/ui/views/view.cc
|
| +++ b/ui/views/view.cc
|
| @@ -11,7 +11,6 @@
|
| #include <memory>
|
| #include <utility>
|
|
|
| -#include "base/containers/adapters.h"
|
| #include "base/logging.h"
|
| #include "base/macros.h"
|
| #include "base/memory/ptr_util.h"
|
| @@ -555,7 +554,8 @@
|
| // weren't changed by the layout manager. If there is no layout manager, we
|
| // just propagate the Layout() call down the hierarchy, so whoever receives
|
| // the call can take appropriate action.
|
| - for (auto* child : children_) {
|
| + for (int i = 0, count = child_count(); i < count; ++i) {
|
| + View* child = child_at(i);
|
| if (child->needs_layout_ || !layout_manager_.get()) {
|
| TRACE_EVENT1("views", "View::Layout", "class", child->GetClassName());
|
| child->needs_layout_ = false;
|
| @@ -621,8 +621,8 @@
|
| if (id == id_)
|
| return const_cast<View*>(this);
|
|
|
| - for (auto* child : children_) {
|
| - const View* view = child->GetViewByID(id);
|
| + for (int i = 0, count = child_count(); i < count; ++i) {
|
| + const View* view = child_at(i)->GetViewByID(id);
|
| if (view)
|
| return view;
|
| }
|
| @@ -651,8 +651,8 @@
|
| if (group_ == group)
|
| views->push_back(this);
|
|
|
| - for (auto* child : children_)
|
| - child->GetViewsInGroup(group, views);
|
| + for (int i = 0, count = child_count(); i < count; ++i)
|
| + child_at(i)->GetViewsInGroup(group, views);
|
| }
|
|
|
| View* View::GetSelectedViewForGroup(int group) {
|
| @@ -917,7 +917,8 @@
|
|
|
| // Walk the child Views recursively looking for the View that most
|
| // tightly encloses the specified point.
|
| - for (auto* child : base::Reversed(children_)) {
|
| + for (int i = child_count() - 1; i >= 0; --i) {
|
| + View* child = child_at(i);
|
| if (!child->visible())
|
| continue;
|
|
|
| @@ -1436,10 +1437,9 @@
|
|
|
| void View::PaintChildren(const ui::PaintContext& context) {
|
| TRACE_EVENT1("views", "View::PaintChildren", "class", GetClassName());
|
| - for (auto* child : children_) {
|
| - if (!child->layer())
|
| - child->Paint(context);
|
| - }
|
| + for (int i = 0, count = child_count(); i < count; ++i)
|
| + if (!child_at(i)->layer())
|
| + child_at(i)->Paint(context);
|
| }
|
|
|
| void View::OnPaint(gfx::Canvas* canvas) {
|
| @@ -1505,8 +1505,8 @@
|
| SetLayerBounds(gfx::Rect(local_point.x(), local_point.y(),
|
| width(), height()));
|
| } else {
|
| - for (auto* child : children_)
|
| - child->MoveLayerToParent(parent_layer, local_point);
|
| + for (int i = 0, count = child_count(); i < count; ++i)
|
| + child_at(i)->MoveLayerToParent(parent_layer, local_point);
|
| }
|
| }
|
|
|
| @@ -1522,8 +1522,8 @@
|
| if (layer()) {
|
| layer()->SetVisible(ancestor_visible && visible_);
|
| } else {
|
| - for (auto* child : children_)
|
| - child->UpdateChildLayerVisibility(ancestor_visible && visible_);
|
| + for (int i = 0, count = child_count(); i < count; ++i)
|
| + child_at(i)->UpdateChildLayerVisibility(ancestor_visible && visible_);
|
| }
|
| }
|
|
|
| @@ -1531,7 +1531,8 @@
|
| if (layer()) {
|
| SetLayerBounds(GetLocalBounds() + offset);
|
| } else {
|
| - for (auto* child : children_) {
|
| + for (int i = 0, count = child_count(); i < count; ++i) {
|
| + View* child = child_at(i);
|
| child->UpdateChildLayerBounds(
|
| offset + gfx::Vector2d(child->GetMirroredX(), child->y()));
|
| }
|
| @@ -1764,8 +1765,8 @@
|
| }
|
|
|
| // Children.
|
| - for (auto* child : view_with_children->children_)
|
| - result.append(child->PrintViewGraph(false));
|
| + for (int i = 0, count = view_with_children->child_count(); i < count; ++i)
|
| + result.append(view_with_children->child_at(i)->PrintViewGraph(false));
|
|
|
| if (first)
|
| result.append("}\n");
|
| @@ -1874,8 +1875,8 @@
|
| }
|
|
|
| void View::PropagateRemoveNotifications(View* old_parent, View* new_parent) {
|
| - for (auto* child : children_)
|
| - child->PropagateRemoveNotifications(old_parent, new_parent);
|
| + for (int i = 0, count = child_count(); i < count; ++i)
|
| + child_at(i)->PropagateRemoveNotifications(old_parent, new_parent);
|
|
|
| ViewHierarchyChangedDetails details(false, old_parent, this, new_parent);
|
| for (View* v = this; v; v = v->parent_)
|
| @@ -1884,14 +1885,14 @@
|
|
|
| void View::PropagateAddNotifications(
|
| const ViewHierarchyChangedDetails& details) {
|
| - for (auto* child : children_)
|
| - child->PropagateAddNotifications(details);
|
| + for (int i = 0, count = child_count(); i < count; ++i)
|
| + child_at(i)->PropagateAddNotifications(details);
|
| ViewHierarchyChangedImpl(true, details);
|
| }
|
|
|
| void View::PropagateNativeViewHierarchyChanged() {
|
| - for (auto* child : children_)
|
| - child->PropagateNativeViewHierarchyChanged();
|
| + for (int i = 0, count = child_count(); i < count; ++i)
|
| + child_at(i)->PropagateNativeViewHierarchyChanged();
|
| NativeViewHierarchyChanged();
|
| }
|
|
|
| @@ -1915,16 +1916,16 @@
|
| }
|
|
|
| void View::PropagateNativeThemeChanged(const ui::NativeTheme* theme) {
|
| - for (auto* child : children_)
|
| - child->PropagateNativeThemeChanged(theme);
|
| + for (int i = 0, count = child_count(); i < count; ++i)
|
| + child_at(i)->PropagateNativeThemeChanged(theme);
|
| OnNativeThemeChanged(theme);
|
| }
|
|
|
| // Size and disposition --------------------------------------------------------
|
|
|
| void View::PropagateVisibilityNotifications(View* start, bool is_visible) {
|
| - for (auto* child : children_)
|
| - child->PropagateVisibilityNotifications(start, is_visible);
|
| + for (int i = 0, count = child_count(); i < count; ++i)
|
| + child_at(i)->PropagateVisibilityNotifications(start, is_visible);
|
| VisibilityChangedImpl(start, is_visible);
|
| }
|
|
|
| @@ -2105,8 +2106,8 @@
|
| void View::CreateLayer() {
|
| // A new layer is being created for the view. So all the layers of the
|
| // sub-tree can inherit the visibility of the corresponding view.
|
| - for (auto* child : children_)
|
| - child->UpdateChildLayerVisibility(true);
|
| + for (int i = 0, count = child_count(); i < count; ++i)
|
| + child_at(i)->UpdateChildLayerVisibility(true);
|
|
|
| SetLayer(base::MakeUnique<ui::Layer>());
|
| layer()->set_delegate(this);
|
| @@ -2144,8 +2145,8 @@
|
| return false;
|
| }
|
| bool result = false;
|
| - for (auto* child : children_) {
|
| - if (child->UpdateParentLayers())
|
| + for (int i = 0, count = child_count(); i < count; ++i) {
|
| + if (child_at(i)->UpdateParentLayers())
|
| result = true;
|
| }
|
| return result;
|
| @@ -2160,8 +2161,8 @@
|
| // necessary to orphan the child layers.
|
| return;
|
| }
|
| - for (auto* child : children_)
|
| - child->OrphanLayers();
|
| + for (int i = 0, count = child_count(); i < count; ++i)
|
| + child_at(i)->OrphanLayers();
|
| }
|
|
|
| void View::ReparentLayer(const gfx::Vector2d& offset, ui::Layer* parent_layer) {
|
| @@ -2390,20 +2391,20 @@
|
| // System events ---------------------------------------------------------------
|
|
|
| void View::PropagateThemeChanged() {
|
| - for (auto* child : base::Reversed(children_))
|
| - child->PropagateThemeChanged();
|
| + for (int i = child_count() - 1; i >= 0; --i)
|
| + child_at(i)->PropagateThemeChanged();
|
| OnThemeChanged();
|
| }
|
|
|
| void View::PropagateLocaleChanged() {
|
| - for (auto* child : base::Reversed(children_))
|
| - child->PropagateLocaleChanged();
|
| + for (int i = child_count() - 1; i >= 0; --i)
|
| + child_at(i)->PropagateLocaleChanged();
|
| OnLocaleChanged();
|
| }
|
|
|
| void View::PropagateDeviceScaleFactorChanged(float device_scale_factor) {
|
| - for (auto* child : base::Reversed(children_))
|
| - child->PropagateDeviceScaleFactorChanged(device_scale_factor);
|
| + for (int i = child_count() - 1; i >= 0; --i)
|
| + child_at(i)->PropagateDeviceScaleFactorChanged(device_scale_factor);
|
|
|
| // If the view is drawing to the layer, OnDeviceScaleFactorChanged() is called
|
| // through LayerDelegate callback.
|
|
|