Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Unified Diff: ui/views/corewm/tooltip_aura.cc

Issue 2174033002: [md] Fixes tooltips on Linux that should not have changed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [md] Fixes tooltips on Linux that should not have changed (comments) Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/corewm/tooltip_aura.cc
diff --git a/ui/views/corewm/tooltip_aura.cc b/ui/views/corewm/tooltip_aura.cc
index f33eaca7d4084325afd9d1a70ebb42f21d475687..7bf43adec87109e1ff051f64450d065e5b2e6c81 100644
--- a/ui/views/corewm/tooltip_aura.cc
+++ b/ui/views/corewm/tooltip_aura.cc
@@ -29,13 +29,19 @@ namespace {
// be wrapped.
const int kTooltipMaxWidthPixels = 400;
-// Corner radius of tooltip background used with Material Design.
-const float kTooltipCornerRadius = 2.f;
-
// FIXME: get cursor offset from actual cursor size.
const int kCursorOffsetX = 10;
const int kCursorOffsetY = 15;
+// TODO(varkha): Update if native widget can be transparent on Linux.
+bool CanUseTranslucentTooltipWidget() {
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+ return false;
+#else
+ return ui::MaterialDesignController::IsModeMaterial();
+#endif
+}
+
// Creates a widget of type TYPE_TOOLTIP
views::Widget* CreateTooltipWidget(aura::Window* tooltip_window) {
views::Widget* widget = new views::Widget;
@@ -47,10 +53,10 @@ views::Widget* CreateTooltipWidget(aura::Window* tooltip_window) {
DCHECK(params.context);
params.keep_on_top = true;
params.accept_events = false;
- if (ui::MaterialDesignController::IsModeMaterial()) {
+ if (CanUseTranslucentTooltipWidget())
params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
+ if (ui::MaterialDesignController::IsModeMaterial())
params.shadow_type = views::Widget::InitParams::SHADOW_TYPE_NONE;
- }
widget->Init(params);
return widget;
}
@@ -119,8 +125,10 @@ class TooltipAura::TooltipView : public views::View {
}
void SetBackgroundColor(SkColor background_color) {
+ // Corner radius of tooltip background used with Material Design.
+ const float kTooltipCornerRadius = 2.f;
views::Background* background =
- ui::MaterialDesignController::IsModeMaterial()
+ CanUseTranslucentTooltipWidget()
? views::Background::CreateBackgroundPainter(
true, views::Painter::CreateSolidRoundRectPainter(
background_color, kTooltipCornerRadius))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698