summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-14 20:46:52 +0000
committerjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-14 20:46:52 +0000
commit4245ae4e0766915f2e5ef8f1ba411089bc261ba2 (patch)
tree5b103ce72ad7a5bc03ff742e91a057efd8bd84e7
parentd49099c62c66e972dd4dee81aa0d7eb47096dc1c (diff)
downloadchromium_src-4245ae4e0766915f2e5ef8f1ba411089bc261ba2.zip
chromium_src-4245ae4e0766915f2e5ef8f1ba411089bc261ba2.tar.gz
chromium_src-4245ae4e0766915f2e5ef8f1ba411089bc261ba2.tar.bz2
Notification balloons don't want the WS_EX_LAYOUTRTL style flag, since the directionality of the content is specified already inside the HTML.
BUG=46170 TEST=create a notification while using an RTL language for Chrome UI. Review URL: http://codereview.chromium.org/2794001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49723 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/text_input/candidate_window.cc3
-rw-r--r--chrome/browser/views/extensions/extension_popup.cc3
-rw-r--r--chrome/browser/views/notifications/balloon_view.cc10
-rw-r--r--chrome/browser/views/status_bubble_views.cc3
-rw-r--r--chrome/browser/views/theme_install_bubble_view.cc3
-rw-r--r--views/examples/widget_example.h3
-rw-r--r--views/widget/widget.h12
-rw-r--r--views/widget/widget_gtk.cc3
-rw-r--r--views/widget/widget_win.cc7
9 files changed, 35 insertions, 12 deletions
diff --git a/chrome/browser/chromeos/text_input/candidate_window.cc b/chrome/browser/chromeos/text_input/candidate_window.cc
index 961ff23..17a2b7f 100644
--- a/chrome/browser/chromeos/text_input/candidate_window.cc
+++ b/chrome/browser/chromeos/text_input/candidate_window.cc
@@ -853,7 +853,8 @@ void CandidateWindowController::CreateView() {
frame_.reset(views::Widget::CreatePopupWidget(
views::Widget::NotTransparent,
views::Widget::AcceptEvents,
- views::Widget::DeleteOnDestroy));
+ views::Widget::DeleteOnDestroy,
+ views::Widget::MirrorOriginInRTL));
// The size is initially zero.
frame_->Init(NULL, gfx::Rect(0, 0));
diff --git a/chrome/browser/views/extensions/extension_popup.cc b/chrome/browser/views/extensions/extension_popup.cc
index f2a8f4d..95ac21e 100644
--- a/chrome/browser/views/extensions/extension_popup.cc
+++ b/chrome/browser/views/extensions/extension_popup.cc
@@ -109,7 +109,8 @@ ExtensionPopup::ExtensionPopup(ExtensionHost* host,
#else
border_widget_ = Widget::CreatePopupWidget(Widget::Transparent,
Widget::NotAcceptEvents,
- Widget::DeleteOnDestroy);
+ Widget::DeleteOnDestroy,
+ Widget::MirrorOriginInRTL);
#endif
border_widget_->Init(native_window, bounds());
#if defined(OS_CHROMEOS)
diff --git a/chrome/browser/views/notifications/balloon_view.cc b/chrome/browser/views/notifications/balloon_view.cc
index c1bea26..2c362d0 100644
--- a/chrome/browser/views/notifications/balloon_view.cc
+++ b/chrome/browser/views/notifications/balloon_view.cc
@@ -296,13 +296,16 @@ void BalloonViewImpl::Show(Balloon* balloon) {
//
// We carefully keep these two windows in sync to present the illusion of
// one window to the user.
+ //
+ // We don't let the OS manage the RTL layout of these widgets, because
+ // this code is already taking care of correctly reversing the layout.
gfx::Rect contents_rect = GetContentsRectangle();
html_contents_.reset(new BalloonViewHost(balloon));
html_contents_->SetPreferredSize(gfx::Size(10000, 10000));
-
html_container_ = Widget::CreatePopupWidget(Widget::NotTransparent,
Widget::AcceptEvents,
- Widget::DeleteOnDestroy);
+ Widget::DeleteOnDestroy,
+ Widget::DontMirrorOriginInRTL);
html_container_->SetAlwaysOnTop(true);
html_container_->Init(NULL, contents_rect);
html_container_->SetContentsView(html_contents_->view());
@@ -310,7 +313,8 @@ void BalloonViewImpl::Show(Balloon* balloon) {
gfx::Rect balloon_rect(x(), y(), GetTotalWidth(), GetTotalHeight());
frame_container_ = Widget::CreatePopupWidget(Widget::Transparent,
Widget::AcceptEvents,
- Widget::DeleteOnDestroy);
+ Widget::DeleteOnDestroy,
+ Widget::DontMirrorOriginInRTL);
frame_container_->SetWidgetDelegate(this);
frame_container_->SetAlwaysOnTop(true);
frame_container_->Init(NULL, balloon_rect);
diff --git a/chrome/browser/views/status_bubble_views.cc b/chrome/browser/views/status_bubble_views.cc
index 292d6ea..5026c49 100644
--- a/chrome/browser/views/status_bubble_views.cc
+++ b/chrome/browser/views/status_bubble_views.cc
@@ -557,7 +557,8 @@ void StatusBubbleViews::Init() {
if (!popup_.get()) {
popup_.reset(Widget::CreatePopupWidget(Widget::Transparent,
Widget::NotAcceptEvents,
- Widget::NotDeleteOnDestroy));
+ Widget::NotDeleteOnDestroy,
+ Widget::MirrorOriginInRTL));
if (!view_)
view_ = new StatusView(this, popup_.get(), frame_->GetThemeProvider());
if (!expand_view_.get())
diff --git a/chrome/browser/views/theme_install_bubble_view.cc b/chrome/browser/views/theme_install_bubble_view.cc
index a03b8b5..43871b1 100644
--- a/chrome/browser/views/theme_install_bubble_view.cc
+++ b/chrome/browser/views/theme_install_bubble_view.cc
@@ -70,7 +70,8 @@ ThemeInstallBubbleView::ThemeInstallBubbleView(TabContents* tab_contents)
gfx::Rect rc(0, 0, 0, 0);
popup_ = views::Widget::CreatePopupWidget(views::Widget::Transparent,
views::Widget::NotAcceptEvents,
- views::Widget::DeleteOnDestroy);
+ views::Widget::DeleteOnDestroy,
+ views::Widget::MirrorOriginInRTL);
popup_->SetOpacity(0xCC);
popup_->Init(tab_contents->GetNativeView(), rc);
popup_->SetContentsView(this);
diff --git a/views/examples/widget_example.h b/views/examples/widget_example.h
index 1897b53..4fff3e2 100644
--- a/views/examples/widget_example.h
+++ b/views/examples/widget_example.h
@@ -144,7 +144,8 @@ class WidgetExample : public ExampleBase, public views::ButtonListener {
const Widget::TransparencyParam transparency) {
Widget* widget = Widget::CreatePopupWidget(transparency,
Widget::AcceptEvents,
- Widget::DeleteOnDestroy);
+ Widget::DeleteOnDestroy,
+ Widget::MirrorOriginInRTL);
// Compute where to place the popup widget.
// We'll place it right below the create button.
gfx::Point point = parent->GetPosition();
diff --git a/views/widget/widget.h b/views/widget/widget.h
index cf893ee..7443bcb 100644
--- a/views/widget/widget.h
+++ b/views/widget/widget.h
@@ -64,10 +64,20 @@ class Widget {
NotDeleteOnDestroy
};
+ enum MirroringParam {
+ MirrorOriginInRTL,
+ DontMirrorOriginInRTL
+ };
+
// Creates a transient popup widget specific to the current platform.
+ // If |mirror_in_rtl| is set to MirrorOriginInRTL, the contents of the
+ // popup will be mirrored if the current locale is RTL. You should use
+ // DontMirrorOriginInRTL if you are aleady handling the RTL layout within
+ // the widget.
static Widget* CreatePopupWidget(TransparencyParam transparent,
EventsParam accept_events,
- DeleteParam delete_on_destroy);
+ DeleteParam delete_on_destroy,
+ MirroringParam mirror_in_rtl);
// Returns the root view for |native_window|. If |native_window| does not have
// a rootview, this recurses through all of |native_window|'s children until
diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc
index 7bc8d03..f38267b 100644
--- a/views/widget/widget_gtk.cc
+++ b/views/widget/widget_gtk.cc
@@ -1427,7 +1427,8 @@ void WidgetGtk::DrawTransparentBackground(GtkWidget* widget,
// static
Widget* Widget::CreatePopupWidget(TransparencyParam transparent,
EventsParam accept_events,
- DeleteParam delete_on_destroy) {
+ DeleteParam delete_on_destroy,
+ MirroringParam mirror_in_rtl) {
WidgetGtk* popup = new WidgetGtk(WidgetGtk::TYPE_POPUP);
popup->set_delete_on_destroy(delete_on_destroy == DeleteOnDestroy);
if (transparent == Transparent)
diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc
index 72431b0..ef6612a 100644
--- a/views/widget/widget_win.cc
+++ b/views/widget/widget_win.cc
@@ -1257,9 +1257,12 @@ void WidgetWin::PostProcessActivateMessage(WidgetWin* widget,
// static
Widget* Widget::CreatePopupWidget(TransparencyParam transparent,
EventsParam accept_events,
- DeleteParam delete_on_destroy) {
+ DeleteParam delete_on_destroy,
+ MirroringParam mirror_in_rtl) {
WidgetWin* popup = new WidgetWin;
- DWORD ex_style = WS_EX_TOOLWINDOW | l10n_util::GetExtendedTooltipStyles();
+ DWORD ex_style = WS_EX_TOOLWINDOW;
+ if (mirror_in_rtl == MirrorOriginInRTL)
+ ex_style |= l10n_util::GetExtendedTooltipStyles();
if (transparent == Transparent)
ex_style |= WS_EX_LAYERED;
if (accept_events != AcceptEvents)