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
This commit is contained in:
chrome/browser
views
@ -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));
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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())
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user