summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/views
diff options
context:
space:
mode:
authorscr@chromium.org <scr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-03 05:06:52 +0000
committerscr@chromium.org <scr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-03 05:06:52 +0000
commit6786cf43811e81e9dbc5842a475d59ffcb56c74f (patch)
treeb85d730502d49cbc0fcd155b5b1ec429fb1846a0 /chrome/browser/ui/views
parent910db6997cf15b2e50cf4afb788bd961fb8342f9 (diff)
downloadchromium_src-6786cf43811e81e9dbc5842a475d59ffcb56c74f.zip
chromium_src-6786cf43811e81e9dbc5842a475d59ffcb56c74f.tar.gz
chromium_src-6786cf43811e81e9dbc5842a475d59ffcb56c74f.tar.bz2
OffsetY shouldn't need parent parameter - moved kArrowSize to header.
All calls to OffsetY were passing |this| as the |parent|. The combination of using member variables (target_height_) and parent's info (parent->height()) were confusing and undocumented. Removing the need to deal with parent helps for adjusting the layout so that OffsetY can be from the perspective of the bar portion of the InfoBarView (shifted down by the tab portion), because all calculations are done on |this| (they are anyway since everyone passes |this|). BUG=74437 TEST=LANGUAGE=he_IL out/Release/chrome --user-data-dir=.dev-profile --enable-tabbed-options russia.ru for RTL and without the LANGUAGE= for LTR. Review URL: http://codereview.chromium.org/6604011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76721 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/views')
-rw-r--r--chrome/browser/ui/views/infobars/after_translate_infobar.cc20
-rw-r--r--chrome/browser/ui/views/infobars/before_translate_infobar.cc18
-rw-r--r--chrome/browser/ui/views/infobars/confirm_infobar.cc8
-rw-r--r--chrome/browser/ui/views/infobars/extension_infobar.cc2
-rw-r--r--chrome/browser/ui/views/infobars/infobar_view.cc8
-rw-r--r--chrome/browser/ui/views/infobars/infobar_view.h2
-rw-r--r--chrome/browser/ui/views/infobars/link_infobar.cc6
-rw-r--r--chrome/browser/ui/views/infobars/translate_message_infobar.cc4
8 files changed, 34 insertions, 34 deletions
diff --git a/chrome/browser/ui/views/infobars/after_translate_infobar.cc b/chrome/browser/ui/views/infobars/after_translate_infobar.cc
index af9b227..4bb557f 100644
--- a/chrome/browser/ui/views/infobars/after_translate_infobar.cc
+++ b/chrome/browser/ui/views/infobars/after_translate_infobar.cc
@@ -39,7 +39,7 @@ void AfterTranslateInfoBar::Layout() {
int available_width = std::max(0, EndX() - StartX() - ContentMinimumWidth());
gfx::Size label_1_size = label_1_->GetPreferredSize();
- label_1_->SetBounds(StartX(), OffsetY(this, label_1_size),
+ label_1_->SetBounds(StartX(), OffsetY(label_1_size),
std::min(label_1_size.width(), available_width), label_1_size.height());
available_width = std::max(0, available_width - label_1_size.width());
@@ -49,33 +49,33 @@ void AfterTranslateInfoBar::Layout() {
std::swap(first_button, second_button);
gfx::Size first_button_size = first_button->GetPreferredSize();
first_button->SetBounds(label_1_->bounds().right() + kButtonInLabelSpacing,
- OffsetY(this, first_button_size), first_button_size.width(),
+ OffsetY(first_button_size), first_button_size.width(),
first_button_size.height());
gfx::Size label_2_size = label_2_->GetPreferredSize();
label_2_->SetBounds(first_button->bounds().right() + kButtonInLabelSpacing,
- OffsetY(this, label_2_size),
- std::min(label_2_size.width(), available_width), label_2_size.height());
+ OffsetY(label_2_size), std::min(label_2_size.width(), available_width),
+ label_2_size.height());
available_width = std::max(0, available_width - label_2_size.width());
gfx::Size second_button_size = second_button->GetPreferredSize();
second_button->SetBounds(label_2_->bounds().right() + kButtonInLabelSpacing,
- OffsetY(this, second_button_size), second_button_size.width(),
+ OffsetY(second_button_size), second_button_size.width(),
second_button_size.height());
gfx::Size label_3_size = label_3_->GetPreferredSize();
label_3_->SetBounds(second_button->bounds().right() + kButtonInLabelSpacing,
- OffsetY(this, label_3_size),
- std::min(label_3_size.width(), available_width), label_3_size.height());
+ OffsetY(label_3_size), std::min(label_3_size.width(), available_width),
+ label_3_size.height());
gfx::Size revert_button_size = revert_button_->GetPreferredSize();
revert_button_->SetBounds(label_3_->bounds().right() + kButtonInLabelSpacing,
- OffsetY(this, revert_button_size),
- revert_button_size.width(), revert_button_size.height());
+ OffsetY(revert_button_size), revert_button_size.width(),
+ revert_button_size.height());
gfx::Size options_size = options_menu_button_->GetPreferredSize();
options_menu_button_->SetBounds(EndX() - options_size.width(),
- OffsetY(this, options_size), options_size.width(), options_size.height());
+ OffsetY(options_size), options_size.width(), options_size.height());
}
void AfterTranslateInfoBar::ViewHierarchyChanged(bool is_add,
diff --git a/chrome/browser/ui/views/infobars/before_translate_infobar.cc b/chrome/browser/ui/views/infobars/before_translate_infobar.cc
index 303b1fe..308f064 100644
--- a/chrome/browser/ui/views/infobars/before_translate_infobar.cc
+++ b/chrome/browser/ui/views/infobars/before_translate_infobar.cc
@@ -37,38 +37,38 @@ void BeforeTranslateInfoBar::Layout() {
int available_width = std::max(0, EndX() - StartX() - ContentMinimumWidth());
gfx::Size label_1_size = label_1_->GetPreferredSize();
- label_1_->SetBounds(StartX(), OffsetY(this, label_1_size),
+ label_1_->SetBounds(StartX(), OffsetY(label_1_size),
std::min(label_1_size.width(), available_width), label_1_size.height());
available_width = std::max(0, available_width - label_1_size.width());
gfx::Size language_button_size = language_menu_button_->GetPreferredSize();
language_menu_button_->SetBounds(
label_1_->bounds().right() + kButtonInLabelSpacing,
- OffsetY(this, language_button_size), language_button_size.width(),
+ OffsetY(language_button_size), language_button_size.width(),
language_button_size.height());
gfx::Size label_2_size = label_2_->GetPreferredSize();
label_2_->SetBounds(
language_menu_button_->bounds().right() + kButtonInLabelSpacing,
- OffsetY(this, label_2_size),
- std::min(label_2_size.width(), available_width), label_2_size.height());
+ OffsetY(label_2_size), std::min(label_2_size.width(), available_width),
+ label_2_size.height());
gfx::Size accept_button_size = accept_button_->GetPreferredSize();
accept_button_->SetBounds(label_2_->bounds().right() + kEndOfLabelSpacing,
- OffsetY(this, accept_button_size), accept_button_size.width(),
+ OffsetY(accept_button_size), accept_button_size.width(),
accept_button_size.height());
gfx::Size deny_button_size = deny_button_->GetPreferredSize();
deny_button_->SetBounds(
accept_button_->bounds().right() + kButtonButtonSpacing,
- OffsetY(this, deny_button_size), deny_button_size.width(),
+ OffsetY(deny_button_size), deny_button_size.width(),
deny_button_size.height());
if (never_translate_button_) {
gfx::Size never_button_size = never_translate_button_->GetPreferredSize();
never_translate_button_->SetBounds(
deny_button_->bounds().right() + kButtonButtonSpacing,
- OffsetY(this, never_button_size), never_button_size.width(),
+ OffsetY(never_button_size), never_button_size.width(),
never_button_size.height());
}
@@ -76,13 +76,13 @@ void BeforeTranslateInfoBar::Layout() {
gfx::Size always_button_size = always_translate_button_->GetPreferredSize();
always_translate_button_->SetBounds(
deny_button_->bounds().right() + kButtonButtonSpacing,
- OffsetY(this, always_button_size), always_button_size.width(),
+ OffsetY(always_button_size), always_button_size.width(),
always_button_size.height());
}
gfx::Size options_size = options_menu_button_->GetPreferredSize();
options_menu_button_->SetBounds(EndX() - options_size.width(),
- OffsetY(this, options_size), options_size.width(), options_size.height());
+ OffsetY(options_size), options_size.width(), options_size.height());
}
void BeforeTranslateInfoBar::ViewHierarchyChanged(bool is_add,
diff --git a/chrome/browser/ui/views/infobars/confirm_infobar.cc b/chrome/browser/ui/views/infobars/confirm_infobar.cc
index 5a40d68..661967a 100644
--- a/chrome/browser/ui/views/infobars/confirm_infobar.cc
+++ b/chrome/browser/ui/views/infobars/confirm_infobar.cc
@@ -33,28 +33,28 @@ void ConfirmInfoBar::Layout() {
int available_width = std::max(0, EndX() - StartX() - ContentMinimumWidth());
gfx::Size label_size = label_->GetPreferredSize();
- label_->SetBounds(StartX(), OffsetY(this, label_size),
+ label_->SetBounds(StartX(), OffsetY(label_size),
std::min(label_size.width(), available_width), label_size.height());
available_width = std::max(0, available_width - label_size.width());
int button_x = label_->bounds().right() + kEndOfLabelSpacing;
if (ok_button_ != NULL) {
gfx::Size ok_size = ok_button_->GetPreferredSize();
- ok_button_->SetBounds(button_x, OffsetY(this, ok_size), ok_size.width(),
+ ok_button_->SetBounds(button_x, OffsetY(ok_size), ok_size.width(),
ok_size.height());
button_x += ok_size.width() + kButtonButtonSpacing;
}
if (cancel_button_ != NULL) {
gfx::Size cancel_size = cancel_button_->GetPreferredSize();
- cancel_button_->SetBounds(button_x, OffsetY(this, cancel_size),
+ cancel_button_->SetBounds(button_x, OffsetY(cancel_size),
cancel_size.width(), cancel_size.height());
}
if (link_ != NULL) {
gfx::Size link_size = link_->GetPreferredSize();
int link_width = std::min(link_size.width(), available_width);
- link_->SetBounds(EndX() - link_width, OffsetY(this, link_size), link_width,
+ link_->SetBounds(EndX() - link_width, OffsetY(link_size), link_width,
link_size.height());
}
}
diff --git a/chrome/browser/ui/views/infobars/extension_infobar.cc b/chrome/browser/ui/views/infobars/extension_infobar.cc
index d959998..b39b477 100644
--- a/chrome/browser/ui/views/infobars/extension_infobar.cc
+++ b/chrome/browser/ui/views/infobars/extension_infobar.cc
@@ -61,7 +61,7 @@ void ExtensionInfoBar::Layout() {
InfoBarView::Layout();
gfx::Size menu_size = menu_->GetPreferredSize();
- menu_->SetBounds(StartX(), OffsetY(this, menu_size), menu_size.width(),
+ menu_->SetBounds(StartX(), OffsetY(menu_size), menu_size.width(),
menu_size.height());
GetDelegate()->extension_host()->view()->SetBounds(
diff --git a/chrome/browser/ui/views/infobars/infobar_view.cc b/chrome/browser/ui/views/infobars/infobar_view.cc
index f0e4bc9..f441905 100644
--- a/chrome/browser/ui/views/infobars/infobar_view.cc
+++ b/chrome/browser/ui/views/infobars/infobar_view.cc
@@ -241,7 +241,7 @@ void InfoBarView::Layout() {
int start_x = kHorizontalPadding;
if (icon_ != NULL) {
gfx::Size icon_size = icon_->GetPreferredSize();
- icon_->SetBounds(start_x, OffsetY(this, icon_size), icon_size.width(),
+ icon_->SetBounds(start_x, OffsetY(icon_size), icon_size.width(),
icon_size.height());
start_x += icon_->bounds().right();
}
@@ -249,7 +249,7 @@ void InfoBarView::Layout() {
gfx::Size button_size = close_button_->GetPreferredSize();
close_button_->SetBounds(std::max(start_x + ContentMinimumWidth(),
width() - kHorizontalPadding - button_size.width()),
- OffsetY(this, button_size), button_size.width(), button_size.height());
+ OffsetY(button_size), button_size.width(), button_size.height());
}
void InfoBarView::ViewHierarchyChanged(bool is_add, View* parent, View* child) {
@@ -358,8 +358,8 @@ int InfoBarView::CenterY(const gfx::Size prefsize) const {
return std::max((target_height_ - prefsize.height()) / 2, 0);
}
-int InfoBarView::OffsetY(View* parent, const gfx::Size prefsize) const {
- return CenterY(prefsize) - (target_height_ - parent->height());
+int InfoBarView::OffsetY(const gfx::Size prefsize) const {
+ return CenterY(prefsize) - (target_height_ - height());
}
AccessibilityTypes::Role InfoBarView::GetAccessibleRole() {
diff --git a/chrome/browser/ui/views/infobars/infobar_view.h b/chrome/browser/ui/views/infobars/infobar_view.h
index 31d3dee..03eeb36 100644
--- a/chrome/browser/ui/views/infobars/infobar_view.h
+++ b/chrome/browser/ui/views/infobars/infobar_view.h
@@ -142,7 +142,7 @@ class InfoBarView : public InfoBar,
// |prefsize| within the standard InfoBar height, adjusted according to the
// current amount of animation offset the |parent| InfoBar currently has.
// Changes during an animation.
- int OffsetY(View* parent, const gfx::Size prefsize) const;
+ int OffsetY(const gfx::Size prefsize) const;
private:
static const int kHorizontalPadding;
diff --git a/chrome/browser/ui/views/infobars/link_infobar.cc b/chrome/browser/ui/views/infobars/link_infobar.cc
index 2343e86..7e9c24f 100644
--- a/chrome/browser/ui/views/infobars/link_infobar.cc
+++ b/chrome/browser/ui/views/infobars/link_infobar.cc
@@ -32,17 +32,17 @@ void LinkInfoBar::Layout() {
// view because its subsequent view will be too small to show an ellipsis.
gfx::Size label_1_size = label_1_->GetPreferredSize();
int available_width = EndX() - StartX();
- label_1_->SetBounds(StartX(), OffsetY(this, label_1_size),
+ label_1_->SetBounds(StartX(), OffsetY(label_1_size),
std::min(label_1_size.width(), available_width), label_1_size.height());
available_width = std::max(0, available_width - label_1_size.width());
gfx::Size link_size = link_->GetPreferredSize();
- link_->SetBounds(label_1_->bounds().right(), OffsetY(this, link_size),
+ link_->SetBounds(label_1_->bounds().right(), OffsetY(link_size),
std::min(link_size.width(), available_width), link_size.height());
available_width = std::max(0, available_width - link_size.width());
gfx::Size label_2_size = label_2_->GetPreferredSize();
- label_2_->SetBounds(link_->bounds().right(), OffsetY(this, label_2_size),
+ label_2_->SetBounds(link_->bounds().right(), OffsetY(label_2_size),
std::min(label_2_size.width(), available_width), label_2_size.height());
}
diff --git a/chrome/browser/ui/views/infobars/translate_message_infobar.cc b/chrome/browser/ui/views/infobars/translate_message_infobar.cc
index a4fec2e..f31e3b6 100644
--- a/chrome/browser/ui/views/infobars/translate_message_infobar.cc
+++ b/chrome/browser/ui/views/infobars/translate_message_infobar.cc
@@ -22,7 +22,7 @@ void TranslateMessageInfoBar::Layout() {
TranslateInfoBarBase::Layout();
gfx::Size label_size = label_->GetPreferredSize();
- label_->SetBounds(StartX(), OffsetY(this, label_size),
+ label_->SetBounds(StartX(), OffsetY(label_size),
std::min(label_size.width(),
std::max(0, EndX() - StartX() - ContentMinimumWidth())),
label_size.height());
@@ -30,7 +30,7 @@ void TranslateMessageInfoBar::Layout() {
if (button_) {
gfx::Size button_size = button_->GetPreferredSize();
button_->SetBounds(label_->bounds().right() + kButtonInLabelSpacing,
- OffsetY(this, button_size), button_size.width(), button_size.height());
+ OffsetY(button_size), button_size.width(), button_size.height());
}
}