summaryrefslogtreecommitdiffstats
path: root/views/controls
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-09 04:50:21 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-09 04:50:21 +0000
commit208386048305a96323581eaca4e4c378d2d8534e (patch)
tree809f266c0b42c1dba64f4233bee4ae615c813cf3 /views/controls
parent35a43f9fc8b757adfe1226acd95dab7541e8a9a6 (diff)
downloadchromium_src-208386048305a96323581eaca4e4c378d2d8534e.zip
chromium_src-208386048305a96323581eaca4e4c378d2d8534e.tar.gz
chromium_src-208386048305a96323581eaca4e4c378d2d8534e.tar.bz2
Rework tree APIs to reflect Google style and more const-correctness.Also, move PrintViewHierarchy/PrintFocusHierarchy out into a separate header.
BUG=72040 TEST=None Review URL: http://codereview.chromium.org/6452011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74244 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls')
-rw-r--r--views/controls/button/native_button_gtk.cc8
-rw-r--r--views/controls/button/radio_button.cc6
-rw-r--r--views/controls/menu/menu_controller.cc19
-rw-r--r--views/controls/menu/menu_item_view.cc21
-rw-r--r--views/controls/menu/menu_item_view_gtk.cc2
-rw-r--r--views/controls/menu/menu_item_view_win.cc2
-rw-r--r--views/controls/menu/submenu_view.cc19
-rw-r--r--views/controls/native_control.cc2
-rw-r--r--views/controls/native_control_gtk.cc4
-rw-r--r--views/controls/native_control_win.cc4
-rw-r--r--views/controls/scroll_view.cc15
-rw-r--r--views/controls/single_split_view.cc20
-rw-r--r--views/controls/single_split_view_unittest.cc6
-rw-r--r--views/controls/tabbed_pane/native_tabbed_pane_gtk.cc2
-rw-r--r--views/controls/tabbed_pane/native_tabbed_pane_win.cc12
-rw-r--r--views/controls/textfield/native_textfield_win.cc4
16 files changed, 70 insertions, 76 deletions
diff --git a/views/controls/button/native_button_gtk.cc b/views/controls/button/native_button_gtk.cc
index d49f38b..7659f48 100644
--- a/views/controls/button/native_button_gtk.cc
+++ b/views/controls/button/native_button_gtk.cc
@@ -233,14 +233,14 @@ void NativeRadioButtonGtk::SetGroupFrom(NativeButtonWrapper* wrapper) {
////////////////////////////////////////////////////////////////////////////////
// NativeRadioButtonGtk, NativeControlGtk overrides:
void NativeRadioButtonGtk::ViewHierarchyChanged(bool is_add,
- View *parent, View *child) {
+ View* parent, View* child) {
NativeControlGtk::ViewHierarchyChanged(is_add, parent, child);
// look for the same group and update
if (is_add && child == this) {
- View* container = GetParent();
- while (container && container->GetParent())
- container = container->GetParent();
+ View* container = parent;
+ while (container && container->parent())
+ container = container->parent();
if (container) {
std::vector<View*> other;
container->GetViewsWithGroup(native_button_->GetGroup(), &other);
diff --git a/views/controls/button/radio_button.cc b/views/controls/button/radio_button.cc
index b189aa6..4074da4 100644
--- a/views/controls/button/radio_button.cc
+++ b/views/controls/button/radio_button.cc
@@ -34,9 +34,9 @@ void RadioButton::SetChecked(bool checked) {
// We can't just get the root view here because sometimes the radio
// button isn't attached to a root view (e.g., if it's part of a tab page
// that is currently not active).
- View* container = GetParent();
- while (container && container->GetParent())
- container = container->GetParent();
+ View* container = parent();
+ while (container && container->parent())
+ container = container->parent();
if (container) {
std::vector<View*> other;
container->GetViewsWithGroup(GetGroup(), &other);
diff --git a/views/controls/menu/menu_controller.cc b/views/controls/menu/menu_controller.cc
index 72c6ca4..660f8ef 100644
--- a/views/controls/menu/menu_controller.cc
+++ b/views/controls/menu/menu_controller.cc
@@ -81,7 +81,7 @@ static View* GetFirstHotTrackedView(View* view) {
if (view->IsHotTracked())
return view;
- for (int i = 0; i < view->GetChildViewCount(); ++i) {
+ for (int i = 0; i < view->child_count(); ++i) {
View* hot_view = GetFirstHotTrackedView(view->GetChildViewAt(i));
if (hot_view)
return hot_view;
@@ -96,15 +96,14 @@ static View* GetFirstHotTrackedView(View* view) {
// to first.
static View* GetFirstFocusableView(View* view, int start, bool forward) {
if (forward) {
- for (int i = start == -1 ? 0 : start; i < view->GetChildViewCount(); ++i) {
+ for (int i = start == -1 ? 0 : start; i < view->child_count(); ++i) {
View* deepest = GetFirstFocusableView(view->GetChildViewAt(i), -1,
forward);
if (deepest)
return deepest;
}
} else {
- for (int i = start == -1 ? view->GetChildViewCount() - 1 : start;
- i >= 0; --i) {
+ for (int i = start == -1 ? view->child_count() - 1 : start; i >= 0; --i) {
View* deepest = GetFirstFocusableView(view->GetChildViewAt(i), -1,
forward);
if (deepest)
@@ -124,11 +123,11 @@ static View* GetInitialFocusableView(View* start, bool forward) {
static View* GetNextFocusableView(View* ancestor,
View* start_at,
bool forward) {
- DCHECK(ancestor->IsParentOf(start_at));
+ DCHECK(ancestor->Contains(start_at));
View* parent = start_at;
do {
- View* new_parent = parent->GetParent();
- int index = new_parent->GetChildIndex(parent);
+ View* new_parent = parent->parent();
+ int index = new_parent->GetIndexOf(parent);
index += forward ? 1 : -1;
if (forward || index != -1) {
View* next = GetFirstFocusableView(new_parent, index, forward);
@@ -1098,7 +1097,7 @@ MenuItemView* MenuController::GetMenuItemAt(View* source, int x, int y) {
View* child_under_mouse = source->GetViewForPoint(gfx::Point(x, y));
while (child_under_mouse &&
child_under_mouse->GetID() != MenuItemView::kMenuItemViewID) {
- child_under_mouse = child_under_mouse->GetParent();
+ child_under_mouse = child_under_mouse->parent();
}
if (child_under_mouse && child_under_mouse->IsEnabled() &&
child_under_mouse->GetID() == MenuItemView::kMenuItemViewID) {
@@ -1493,7 +1492,7 @@ void MenuController::IncrementSelection(int delta) {
}
}
- if (item->GetChildViewCount()) {
+ if (item->has_children()) {
View* hot_view = GetFirstHotTrackedView(item);
if (hot_view) {
hot_view->SetHotTracked(false);
@@ -1766,7 +1765,7 @@ void MenuController::UpdateActiveMouseView(SubmenuView* event_source,
View* target_menu) {
View* target = NULL;
gfx::Point target_menu_loc(event.location());
- if (target_menu && target_menu->GetChildViewCount()) {
+ if (target_menu && target_menu->has_children()) {
// Locate the deepest child view to send events to. This code assumes we
// don't have to walk up the tree to find a view interested in events. This
// is currently true for the cases we are embedding views, but if we embed
diff --git a/views/controls/menu/menu_item_view.cc b/views/controls/menu/menu_item_view.cc
index 04f59bc..f35d0db 100644
--- a/views/controls/menu/menu_item_view.cc
+++ b/views/controls/menu/menu_item_view.cc
@@ -400,7 +400,7 @@ MenuItemView* MenuItemView::GetMenuItemByID(int id) {
return this;
if (!HasSubmenu())
return NULL;
- for (int i = 0; i < GetSubmenu()->GetChildViewCount(); ++i) {
+ for (int i = 0; i < GetSubmenu()->child_count(); ++i) {
View* child = GetSubmenu()->GetChildViewAt(i);
if (child->GetID() == MenuItemView::kMenuItemViewID) {
MenuItemView* result = static_cast<MenuItemView*>(child)->
@@ -435,13 +435,13 @@ void MenuItemView::ChildrenChanged() {
}
void MenuItemView::Layout() {
- int child_count = GetChildViewCount();
- if (child_count == 0)
+ if (!has_children())
return;
- // Child views are layed out right aligned and given the full height. To right
+ // Child views are laid out right aligned and given the full height. To right
// align start with the last view and progress to the first.
- for (int i = child_count - 1, x = width() - item_right_margin_; i >= 0; --i) {
+ for (int i = child_count() - 1, x = width() - item_right_margin_; i >= 0;
+ --i) {
View* child = GetChildViewAt(i);
int width = child->GetPreferredSize().width();
child->SetBounds(x - width, 0, width, height());
@@ -581,8 +581,8 @@ int MenuItemView::GetDrawStringFlags() {
void MenuItemView::AddEmptyMenus() {
DCHECK(HasSubmenu());
- if (submenu_->GetChildViewCount() == 0) {
- submenu_->AddChildView(0, new EmptyMenuMenuItem(this));
+ if (!submenu_->has_children()) {
+ submenu_->AddChildViewAt(new EmptyMenuMenuItem(this), 0);
} else {
for (int i = 0, item_count = submenu_->GetMenuItemCount(); i < item_count;
++i) {
@@ -597,7 +597,7 @@ void MenuItemView::RemoveEmptyMenus() {
DCHECK(HasSubmenu());
// Iterate backwards as we may end up removing views, which alters the child
// view count.
- for (int i = submenu_->GetChildViewCount() - 1; i >= 0; --i) {
+ for (int i = submenu_->child_count() - 1; i >= 0; --i) {
View* child = submenu_->GetChildViewAt(i);
if (child->GetID() == MenuItemView::kMenuItemViewID) {
MenuItemView* menu_item = static_cast<MenuItemView*>(child);
@@ -664,12 +664,11 @@ int MenuItemView::GetBottomMargin() {
}
int MenuItemView::GetChildPreferredWidth() {
- int child_count = GetChildViewCount();
- if (child_count == 0)
+ if (!has_children())
return 0;
int width = 0;
- for (int i = 0; i < child_count; ++i) {
+ for (int i = 0; i < child_count(); ++i) {
if (i)
width += kChildXPadding;
width += GetChildViewAt(i)->GetPreferredSize().width();
diff --git a/views/controls/menu/menu_item_view_gtk.cc b/views/controls/menu/menu_item_view_gtk.cc
index e912964..c995c19 100644
--- a/views/controls/menu/menu_item_view_gtk.cc
+++ b/views/controls/menu/menu_item_view_gtk.cc
@@ -41,7 +41,7 @@ void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) {
bool render_selection =
(!for_drag && IsSelected() &&
parent_menu_item_->GetSubmenu()->GetShowSelection(this) &&
- GetChildViewCount() == 0);
+ !has_children());
int icon_x = config.item_left_margin;
int top_margin = GetTopMargin();
diff --git a/views/controls/menu/menu_item_view_win.cc b/views/controls/menu/menu_item_view_win.cc
index c0cd309..cf8ab974 100644
--- a/views/controls/menu/menu_item_view_win.cc
+++ b/views/controls/menu/menu_item_view_win.cc
@@ -30,7 +30,7 @@ void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) {
bool render_selection =
(!for_drag && IsSelected() &&
parent_menu_item_->GetSubmenu()->GetShowSelection(this) &&
- GetChildViewCount() == 0);
+ !has_children());
int state = render_selection ? MPI_HOT :
(IsEnabled() ? MPI_NORMAL : MPI_DISABLED);
HDC dc = canvas->BeginPlatformPaint();
diff --git a/views/controls/menu/submenu_view.cc b/views/controls/menu/submenu_view.cc
index a3428f7..56bd103 100644
--- a/views/controls/menu/submenu_view.cc
+++ b/views/controls/menu/submenu_view.cc
@@ -47,7 +47,7 @@ SubmenuView::~SubmenuView() {
int SubmenuView::GetMenuItemCount() {
int count = 0;
- for (int i = 0; i < GetChildViewCount(); ++i) {
+ for (int i = 0; i < child_count(); ++i) {
if (GetChildViewAt(i)->GetID() == MenuItemView::kMenuItemViewID)
count++;
}
@@ -55,7 +55,7 @@ int SubmenuView::GetMenuItemCount() {
}
MenuItemView* SubmenuView::GetMenuItemAt(int index) {
- for (int i = 0, count = 0; i < GetChildViewCount(); ++i) {
+ for (int i = 0, count = 0; i < child_count(); ++i) {
if (GetChildViewAt(i)->GetID() == MenuItemView::kMenuItemViewID &&
count++ == index) {
return static_cast<MenuItemView*>(GetChildViewAt(i));
@@ -67,24 +67,23 @@ MenuItemView* SubmenuView::GetMenuItemAt(int index) {
void SubmenuView::Layout() {
// We're in a ScrollView, and need to set our width/height ourselves.
- View* parent = GetParent();
- if (!parent)
+ if (!parent())
return;
// Use our current y, unless it means part of the menu isn't visible anymore.
int pref_height = GetPreferredSize().height();
int new_y;
- if (pref_height > parent->height())
- new_y = std::max(parent->height() - pref_height, y());
+ if (pref_height > parent()->height())
+ new_y = std::max(parent()->height() - pref_height, y());
else
new_y = 0;
- SetBounds(x(), new_y, parent->width(), pref_height);
+ SetBounds(x(), new_y, parent()->width(), pref_height);
gfx::Insets insets = GetInsets();
int x = insets.left();
int y = insets.top();
int menu_item_width = width() - insets.width();
- for (int i = 0; i < GetChildViewCount(); ++i) {
+ for (int i = 0; i < child_count(); ++i) {
View* child = GetChildViewAt(i);
if (child->IsVisible()) {
gfx::Size child_pref_size = child->GetPreferredSize();
@@ -95,13 +94,13 @@ void SubmenuView::Layout() {
}
gfx::Size SubmenuView::GetPreferredSize() {
- if (GetChildViewCount() == 0)
+ if (!has_children())
return gfx::Size();
max_accelerator_width_ = 0;
int max_width = 0;
int height = 0;
- for (int i = 0; i < GetChildViewCount(); ++i) {
+ for (int i = 0; i < child_count(); ++i) {
View* child = GetChildViewAt(i);
gfx::Size child_pref_size = child->IsVisible() ?
child->GetPreferredSize() : gfx::Size();
diff --git a/views/controls/native_control.cc b/views/controls/native_control.cc
index caea8c1..f00ab84 100644
--- a/views/controls/native_control.cc
+++ b/views/controls/native_control.cc
@@ -146,7 +146,7 @@ class NativeControlContainer : public CWindowImpl<NativeControlContainer,
if (brush)
return reinterpret_cast<LRESULT>(brush);
}
- ancestor = ancestor->GetParent();
+ ancestor = ancestor->parent();
}
// COLOR_BTNFACE is the default for dialog box backgrounds.
diff --git a/views/controls/native_control_gtk.cc b/views/controls/native_control_gtk.cc
index e0ce2f0..eb97394 100644
--- a/views/controls/native_control_gtk.cc
+++ b/views/controls/native_control_gtk.cc
@@ -67,13 +67,13 @@ void NativeControlGtk::Focus() {
DCHECK(native_view());
gtk_widget_grab_focus(native_view());
- GetParent()->NotifyAccessibilityEvent(AccessibilityTypes::EVENT_FOCUS);
+ parent()->NotifyAccessibilityEvent(AccessibilityTypes::EVENT_FOCUS);
}
void NativeControlGtk::NativeControlCreated(GtkWidget* native_control) {
Attach(native_control);
- // Update the newly created GtkWdigetwith any resident enabled state.
+ // Update the newly created GtkWidget with any resident enabled state.
gtk_widget_set_sensitive(native_view(), IsEnabled());
// Listen for focus change event to update the FocusManager focused view.
diff --git a/views/controls/native_control_win.cc b/views/controls/native_control_win.cc
index b81b2ea..9eaf25e 100644
--- a/views/controls/native_control_win.cc
+++ b/views/controls/native_control_win.cc
@@ -102,7 +102,7 @@ void NativeControlWin::Focus() {
// Since we are being wrapped by a view, accessibility should receive
// the super class as the focused view.
- View* parent_view = GetParent();
+ View* parent_view = parent();
// Due to some controls not behaving as expected without having
// a native win32 control, we don't always send a native (MSAA)
@@ -184,7 +184,7 @@ LRESULT NativeControlWin::GetControlColor(UINT message, HDC dc, HWND sender) {
if (brush)
return reinterpret_cast<LRESULT>(brush);
}
- ancestor = ancestor->GetParent();
+ ancestor = ancestor->parent();
}
// COLOR_BTNFACE is the default for dialog box backgrounds.
diff --git a/views/controls/scroll_view.cc b/views/controls/scroll_view.cc
index 79183da..05ab89f 100644
--- a/views/controls/scroll_view.cc
+++ b/views/controls/scroll_view.cc
@@ -19,13 +19,13 @@ class Viewport : public View {
virtual ~Viewport() {}
virtual void ScrollRectToVisible(const gfx::Rect& rect) {
- if (!GetChildViewCount() || !GetParent())
+ if (!has_children() || !parent())
return;
View* contents = GetChildViewAt(0);
gfx::Rect scroll_rect(rect);
scroll_rect.Offset(-contents->x(), -contents->y());
- static_cast<ScrollView*>(GetParent())->ScrollContentsRegionToBeVisible(
+ static_cast<ScrollView*>(parent())->ScrollContentsRegionToBeVisible(
scroll_rect);
}
@@ -46,17 +46,14 @@ ScrollView::ScrollView(ScrollBar* horizontal_scrollbar,
ScrollView::~ScrollView() {
// If scrollbars are currently not used, delete them
- if (!horiz_sb_->GetParent()) {
+ if (!horiz_sb_->parent())
delete horiz_sb_;
- }
- if (!vert_sb_->GetParent()) {
+ if (!vert_sb_->parent())
delete vert_sb_;
- }
- if (resize_corner_ && !resize_corner_->GetParent()) {
+ if (resize_corner_ && !resize_corner_->parent())
delete resize_corner_;
- }
}
void ScrollView::SetContents(View* a_view) {
@@ -449,7 +446,7 @@ int VariableRowHeightScrollHelper::GetPageScrollIncrement(
return 0;
// y coordinate is most likely negative.
int y = abs(scroll_view->GetContents()->y());
- int vis_height = scroll_view->GetContents()->GetParent()->height();
+ int vis_height = scroll_view->GetContents()->parent()->height();
if (is_positive) {
// Align the bottom most row to the top of the view.
int bottom = std::min(scroll_view->GetContents()->height() - 1,
diff --git a/views/controls/single_split_view.cc b/views/controls/single_split_view.cc
index 3936ad6..ad2a59a 100644
--- a/views/controls/single_split_view.cc
+++ b/views/controls/single_split_view.cc
@@ -39,7 +39,8 @@ SingleSplitView::SingleSplitView(View* leading,
}
void SingleSplitView::OnBoundsChanged() {
- divider_offset_ = CalculateDividerOffset(divider_offset_, previous_bounds_, bounds());
+ divider_offset_ = CalculateDividerOffset(divider_offset_, previous_bounds_,
+ bounds());
View::OnBoundsChanged();
previous_bounds_ = bounds();
}
@@ -49,10 +50,10 @@ void SingleSplitView::Layout() {
gfx::Rect trailing_bounds;
CalculateChildrenBounds(bounds(), &leading_bounds, &trailing_bounds);
- if (GetChildViewCount() > 0) {
+ if (has_children()) {
if (GetChildViewAt(0)->IsVisible())
GetChildViewAt(0)->SetBoundsRect(leading_bounds);
- if (GetChildViewCount() > 1) {
+ if (child_count() > 1) {
if (GetChildViewAt(1)->IsVisible())
GetChildViewAt(1)->SetBoundsRect(trailing_bounds);
}
@@ -71,7 +72,7 @@ AccessibilityTypes::Role SingleSplitView::GetAccessibleRole() {
gfx::Size SingleSplitView::GetPreferredSize() {
int width = 0;
int height = 0;
- for (int i = 0; i < 2 && i < GetChildViewCount(); ++i) {
+ for (int i = 0; i < 2 && i < child_count(); ++i) {
View* view = GetChildViewAt(i);
gfx::Size pref = view->GetPreferredSize();
if (is_horizontal_) {
@@ -110,10 +111,9 @@ void SingleSplitView::CalculateChildrenBounds(
const gfx::Rect& bounds,
gfx::Rect* leading_bounds,
gfx::Rect* trailing_bounds) const {
- bool is_leading_visible =
- GetChildViewCount() > 0 && GetChildViewAt(0)->IsVisible();
+ bool is_leading_visible = has_children() && GetChildViewAt(0)->IsVisible();
bool is_trailing_visible =
- GetChildViewCount() > 1 && GetChildViewAt(1)->IsVisible();
+ child_count() > 1 && GetChildViewAt(1)->IsVisible();
if (!is_leading_visible && !is_trailing_visible) {
*leading_bounds = gfx::Rect();
@@ -160,7 +160,7 @@ bool SingleSplitView::OnMousePressed(const MouseEvent& event) {
}
bool SingleSplitView::OnMouseDragged(const MouseEvent& event) {
- if (GetChildViewCount() < 2)
+ if (child_count() < 2)
return false;
int delta_offset = GetPrimaryAxisSize(event.x(), event.y()) -
@@ -184,7 +184,7 @@ bool SingleSplitView::OnMouseDragged(const MouseEvent& event) {
}
void SingleSplitView::OnMouseReleased(const MouseEvent& event, bool canceled) {
- if (GetChildViewCount() < 2)
+ if (child_count() < 2)
return;
if (canceled && drag_info_.initial_divider_offset != divider_offset_) {
@@ -195,7 +195,7 @@ void SingleSplitView::OnMouseReleased(const MouseEvent& event, bool canceled) {
}
bool SingleSplitView::IsPointInDivider(const gfx::Point& p) {
- if (GetChildViewCount() < 2)
+ if (child_count() < 2)
return false;
if (!GetChildViewAt(0)->IsVisible() || !GetChildViewAt(1)->IsVisible())
diff --git a/views/controls/single_split_view_unittest.cc b/views/controls/single_split_view_unittest.cc
index 3d84bd7..a42e3b8 100644
--- a/views/controls/single_split_view_unittest.cc
+++ b/views/controls/single_split_view_unittest.cc
@@ -13,10 +13,10 @@ using ::testing::Return;
namespace {
static void VerifySplitViewLayout(const views::SingleSplitView& split) {
- ASSERT_EQ(2, split.GetChildViewCount());
+ ASSERT_EQ(2, split.child_count());
- views::View* leading = split.GetChildViewAt(0);
- views::View* trailing = split.GetChildViewAt(1);
+ const views::View* leading = split.GetChildViewAt(0);
+ const views::View* trailing = split.GetChildViewAt(1);
if (split.bounds().IsEmpty()) {
EXPECT_TRUE(leading->bounds().IsEmpty());
diff --git a/views/controls/tabbed_pane/native_tabbed_pane_gtk.cc b/views/controls/tabbed_pane/native_tabbed_pane_gtk.cc
index 5172191..a82e893 100644
--- a/views/controls/tabbed_pane/native_tabbed_pane_gtk.cc
+++ b/views/controls/tabbed_pane/native_tabbed_pane_gtk.cc
@@ -201,7 +201,7 @@ WidgetGtk* NativeTabbedPaneGtk::GetWidgetAt(int index) {
View* NativeTabbedPaneGtk::GetTabViewAt(int index) {
WidgetGtk* widget = GetWidgetAt(index);
- DCHECK(widget && widget->GetRootView()->GetChildViewCount() == 1);
+ DCHECK(widget && widget->GetRootView()->child_count() == 1);
return widget->GetRootView()->GetChildViewAt(0);
}
diff --git a/views/controls/tabbed_pane/native_tabbed_pane_win.cc b/views/controls/tabbed_pane/native_tabbed_pane_win.cc
index c727437..aa651ac 100644
--- a/views/controls/tabbed_pane/native_tabbed_pane_win.cc
+++ b/views/controls/tabbed_pane/native_tabbed_pane_win.cc
@@ -53,7 +53,7 @@ class TabLayout : public LayoutManager {
// Switches to the tab page identified by the given index.
void SwitchToPage(View* host, View* page) {
- for (int i = 0; i < host->GetChildViewCount(); ++i) {
+ for (int i = 0; i < host->child_count(); ++i) {
View* child = host->GetChildViewAt(i);
// The child might not have been laid out yet.
if (child == page)
@@ -64,8 +64,8 @@ class TabLayout : public LayoutManager {
FocusManager* focus_manager = page->GetFocusManager();
DCHECK(focus_manager);
View* focused_view = focus_manager->GetFocusedView();
- if (focused_view && host->IsParentOf(focused_view) &&
- !page->IsParentOf(focused_view))
+ if (focused_view && host->Contains(focused_view) &&
+ !page->Contains(focused_view))
focus_manager->SetFocusedView(page);
}
@@ -73,7 +73,7 @@ class TabLayout : public LayoutManager {
// LayoutManager overrides:
virtual void Layout(View* host) {
gfx::Rect bounds(host->GetContentsBounds());
- for (int i = 0; i < host->GetChildViewCount(); ++i) {
+ for (int i = 0; i < host->child_count(); ++i) {
View* child = host->GetChildViewAt(i);
// We only layout visible children, since it may be expensive.
if (child->IsVisible() && child->bounds() != bounds)
@@ -84,7 +84,7 @@ class TabLayout : public LayoutManager {
virtual gfx::Size GetPreferredSize(View* host) {
// First, query the preferred sizes to determine a good width.
int width = 0;
- for (int i = 0; i < host->GetChildViewCount(); ++i) {
+ for (int i = 0; i < host->child_count(); ++i) {
View* page = host->GetChildViewAt(i);
width = std::max(width, page->GetPreferredSize().width());
}
@@ -94,7 +94,7 @@ class TabLayout : public LayoutManager {
virtual int GetPreferredHeightForWidth(View* host, int width) {
int height = 0;
- for (int i = 0; i < host->GetChildViewCount(); ++i) {
+ for (int i = 0; i < host->child_count(); ++i) {
View* page = host->GetChildViewAt(i);
height = std::max(height, page->GetHeightForWidth(width));
}
diff --git a/views/controls/textfield/native_textfield_win.cc b/views/controls/textfield/native_textfield_win.cc
index 222f722..681b15f 100644
--- a/views/controls/textfield/native_textfield_win.cc
+++ b/views/controls/textfield/native_textfield_win.cc
@@ -436,8 +436,8 @@ void NativeTextfieldWin::InitializeAccessibilityInfo() {
CHILDID_SELF, PROPID_ACC_ROLE, var);
// Set the accessible name by getting the label text.
- View* parent = textfield_->GetParent();
- int label_index = parent->GetChildIndex(textfield_) - 1;
+ View* parent = textfield_->parent();
+ int label_index = parent->GetIndexOf(textfield_) - 1;
if (label_index >= 0) {
// Try to find the name of this text field.
// We expect it to be a Label preceeding this view (if it exists).