diff options
author | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-07 17:37:36 +0000 |
---|---|---|
committer | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-07 17:37:36 +0000 |
commit | cc563f0e83d20a0eb740fbb61361f5c615223756 (patch) | |
tree | 225b866b5bf3d641e37bf92af10a0fe532c63ff2 /ui/views/controls/label.cc | |
parent | a50563969a36701077cb226ff81c9a66230bfae9 (diff) | |
download | chromium_src-cc563f0e83d20a0eb740fbb61361f5c615223756.zip chromium_src-cc563f0e83d20a0eb740fbb61361f5c615223756.tar.gz chromium_src-cc563f0e83d20a0eb740fbb61361f5c615223756.tar.bz2 |
Replace Label::Alignment with gfx::HorizontalAlignment.
Also remove unnecessary center alignment specifications in:
ash/wm/maximize_bubble_controller.cc
chrome/browser/ui/views/find_bar_view.cc
chrome/browser/ui/views/panels/panel_frame_view.cc
chrome/browser/ui/views/speech_recognition_bubble_views.cc
ui/message_center/message_center_bubble.cc
BUG=90426,155526
TEST=No behavioral changes.
R=sky@chromium.org
Review URL: https://chromiumcodereview.appspot.com/11377005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166462 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/controls/label.cc')
-rw-r--r-- | ui/views/controls/label.cc | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/ui/views/controls/label.cc b/ui/views/controls/label.cc index 4de151b..08394ce 100644 --- a/ui/views/controls/label.cc +++ b/ui/views/controls/label.cc @@ -101,15 +101,17 @@ void Label::ClearEmbellishing() { has_shadow_ = false; } -void Label::SetHorizontalAlignment(Alignment alignment) { +void Label::SetHorizontalAlignment(gfx::HorizontalAlignment alignment) { // If the View's UI layout is right-to-left and directionality_mode_ is // USE_UI_DIRECTIONALITY, we need to flip the alignment so that the alignment // settings take into account the text directionality. if (base::i18n::IsRTL() && (directionality_mode_ == USE_UI_DIRECTIONALITY) && - (alignment != ALIGN_CENTER)) - alignment = (alignment == ALIGN_LEFT) ? ALIGN_RIGHT : ALIGN_LEFT; - if (horiz_alignment_ != alignment) { - horiz_alignment_ = alignment; + (alignment != gfx::ALIGN_CENTER)) { + alignment = (alignment == gfx::ALIGN_LEFT) ? + gfx::ALIGN_RIGHT : gfx::ALIGN_LEFT; + } + if (horizontal_alignment_ != alignment) { + horizontal_alignment_ = alignment; SchedulePaint(); } } @@ -321,7 +323,7 @@ void Label::Init(const string16& text, const gfx::Font& font) { ui::NativeTheme::kColorId_LabelBackgroundColor); auto_color_readability_ = true; RecalculateColors(); - horiz_alignment_ = ALIGN_CENTER; + horizontal_alignment_ = gfx::ALIGN_CENTER; is_multi_line_ = false; allow_character_break_ = false; elide_behavior_ = NO_ELIDE; @@ -354,10 +356,10 @@ gfx::Rect Label::GetTextBounds() const { gfx::Insets insets = GetInsets(); gfx::Point text_origin(insets.left(), insets.top()); - switch (horiz_alignment_) { - case ALIGN_LEFT: + switch (horizontal_alignment_) { + case gfx::ALIGN_LEFT: break; - case ALIGN_CENTER: + case gfx::ALIGN_CENTER: // We put any extra margin pixel on the left rather than the right. We // used to do this because measurement on Windows used // GetTextExtentPoint32(), which could report a value one too large on the @@ -365,7 +367,7 @@ gfx::Rect Label::GetTextBounds() const { text_origin.Offset((available_rect.width() + 1 - text_size.width()) / 2, 0); break; - case ALIGN_RIGHT: + case gfx::ALIGN_RIGHT: text_origin.set_x(available_rect.right() - text_size.width()); break; default: @@ -407,14 +409,14 @@ int Label::ComputeDrawStringFlags() const { #endif if (allow_character_break_) flags |= gfx::Canvas::CHARACTER_BREAK; - switch (horiz_alignment_) { - case ALIGN_LEFT: + switch (horizontal_alignment_) { + case gfx::ALIGN_LEFT: flags |= gfx::Canvas::TEXT_ALIGN_LEFT; break; - case ALIGN_CENTER: + case gfx::ALIGN_CENTER: flags |= gfx::Canvas::TEXT_ALIGN_CENTER; break; - case ALIGN_RIGHT: + case gfx::ALIGN_RIGHT: flags |= gfx::Canvas::TEXT_ALIGN_RIGHT; break; } |