summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-10 21:56:57 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-10 21:56:57 +0000
commit633299837b77365f07bf15a87925e9eeda1e3987 (patch)
tree2a388af27bef7bb01455f2d6f49185531f5e3658 /chrome
parent6877d9cd6b5a9a522b4f6c1d968cbd7277245e37 (diff)
downloadchromium_src-633299837b77365f07bf15a87925e9eeda1e3987.zip
chromium_src-633299837b77365f07bf15a87925e9eeda1e3987.tar.gz
chromium_src-633299837b77365f07bf15a87925e9eeda1e3987.tar.bz2
Fix RTL issues with opaque frame.
http://crbug.com/3247 Review URL: http://codereview.chromium.org/7240 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3256 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/views/constrained_window_impl.cc6
-rw-r--r--chrome/browser/views/frame/opaque_non_client_view.cc24
-rw-r--r--chrome/views/view.cc1
-rw-r--r--chrome/views/view.h2
4 files changed, 14 insertions, 19 deletions
diff --git a/chrome/browser/views/constrained_window_impl.cc b/chrome/browser/views/constrained_window_impl.cc
index 316bb6f..8cb16f8 100644
--- a/chrome/browser/views/constrained_window_impl.cc
+++ b/chrome/browser/views/constrained_window_impl.cc
@@ -753,10 +753,10 @@ void ConstrainedWindowNonClientView::PaintThrobber(ChromeCanvas* canvas) {
}
void ConstrainedWindowNonClientView::PaintWindowTitle(ChromeCanvas* canvas) {
+ int title_x = MirroredLeftPointForRect(title_bounds_);
canvas->DrawStringInt(container_->GetWindowTitle(), title_font_,
- GetTitleColor(), title_bounds_.x(),
- title_bounds_.y(), title_bounds_.width(),
- title_bounds_.height());
+ GetTitleColor(), title_x, title_bounds_.y(),
+ title_bounds_.width(), title_bounds_.height());
}
// static
diff --git a/chrome/browser/views/frame/opaque_non_client_view.cc b/chrome/browser/views/frame/opaque_non_client_view.cc
index 4669d12..b957549 100644
--- a/chrome/browser/views/frame/opaque_non_client_view.cc
+++ b/chrome/browser/views/frame/opaque_non_client_view.cc
@@ -766,8 +766,9 @@ void OpaqueNonClientView::PaintMaximizedFrameBorder(ChromeCanvas* canvas) {
void OpaqueNonClientView::PaintOTRAvatar(ChromeCanvas* canvas) {
if (browser_view_->ShouldShowOffTheRecordAvatar()) {
- canvas->DrawBitmapInt(browser_view_->GetOTRAvatarIcon(),
- otr_avatar_bounds_.x(), otr_avatar_bounds_.y());
+ int icon_x = MirroredLeftPointForRect(otr_avatar_bounds_);
+ canvas->DrawBitmapInt(browser_view_->GetOTRAvatarIcon(), icon_x,
+ otr_avatar_bounds_.y());
}
}
@@ -776,8 +777,8 @@ void OpaqueNonClientView::PaintDistributorLogo(ChromeCanvas* canvas) {
// when we actually have a logo.
if (!frame_->IsMaximized() && !frame_->IsMinimized() &&
!distributor_logo_.empty()) {
- canvas->DrawBitmapInt(distributor_logo_, logo_bounds_.x(),
- logo_bounds_.y());
+ int logo_x = MirroredLeftPointForRect(logo_bounds_);
+ canvas->DrawBitmapInt(distributor_logo_, logo_x, logo_bounds_.y());
}
}
@@ -785,8 +786,9 @@ void OpaqueNonClientView::PaintTitleBar(ChromeCanvas* canvas) {
// The window icon is painted by the TabIconView.
ChromeViews::WindowDelegate* d = frame_->window_delegate();
if (d->ShouldShowWindowTitle()) {
+ int title_x = MirroredLeftPointForRect(title_bounds_);
canvas->DrawStringInt(d->GetWindowTitle(), title_font_, SK_ColorWHITE,
- title_bounds_.x(), title_bounds_.y(),
+ title_x, title_bounds_.y(),
title_bounds_.width(), title_bounds_.height());
}
}
@@ -968,16 +970,8 @@ void OpaqueNonClientView::LayoutDistributorLogo() {
int logo_w = distributor_logo_.empty() ? 0 : distributor_logo_.width();
int logo_h = distributor_logo_.empty() ? 0 : distributor_logo_.height();
- int logo_x = 0;
- if (UILayoutIsRightToLeft()) {
- CRect minimize_bounds;
- minimize_button_->GetBounds(&minimize_bounds,
- APPLY_MIRRORING_TRANSFORMATION);
- logo_x = minimize_bounds.right + kDistributorLogoHorizontalOffset;
- } else {
- logo_x = minimize_button_->x() - logo_w -
- kDistributorLogoHorizontalOffset;
- }
+ int logo_x =
+ minimize_button_->x() - logo_w - kDistributorLogoHorizontalOffset;
logo_bounds_.SetRect(logo_x, kDistributorLogoVerticalOffset, logo_w, logo_h);
}
diff --git a/chrome/views/view.cc b/chrome/views/view.cc
index 4df9cc2..9f107be 100644
--- a/chrome/views/view.cc
+++ b/chrome/views/view.cc
@@ -282,6 +282,7 @@ bool View::UILayoutIsRightToLeft() const {
////////////////////////////////////////////////////////////////////////////////
inline int View::MirroredX() const {
+ // TODO(beng): reimplement in terms of MirroredLeftPointForRect.
View* parent = GetParent();
if (parent && parent->UILayoutIsRightToLeft()) {
return parent->width() - bounds_.left - width();
diff --git a/chrome/views/view.h b/chrome/views/view.h
index cd9a89f..072e84d 100644
--- a/chrome/views/view.h
+++ b/chrome/views/view.h
@@ -331,7 +331,7 @@ class View : public AcceleratorTarget {
// UI mirroring is transparent to most View subclasses and therefore there is
// no need to call this routine from anywhere within your subclass
// implementation.
- int View::MirroredX() const;
+ int MirroredX() const;
// Given a rectangle specified in this View's coordinate system, the function
// computes the 'left' value for the mirrored rectangle within this View. If