Commit 9125a821 authored by estade's avatar estade Committed by Commit bot

[MD] fix bookmark bar/URL bar drag image color for OTR mode.

Do this by using textfield colors instead of label default colors. The change to
pre-MD and non-OTR should be extremely minimal (text that's \#222 becomes
\#000). The same colors are used regardless of the drag source (bookmark bar or
location bar), and this just matches the location bar instead of the bookmark
bar. Either way it's hard to notice a difference anywhere except MD OTR mode.

Also support systems without translucency better. We don't need a text shadow
but we do need a background (and border) on these systems.

BUG=581239

Review URL: https://codereview.chromium.org/1633793003

Cr-Commit-Position: refs/heads/master@{#371544}
parent 5897360a
......@@ -14,7 +14,10 @@
#include "ui/gfx/geometry/vector2d.h"
#include "ui/gfx/image/image.h"
#include "ui/resources/grit/ui_resources.h"
#include "ui/views/background.h"
#include "ui/views/border.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/button/label_button_border.h"
#include "ui/views/drag_utils.h"
#include "ui/views/resources/grit/views_resources.h"
#include "ui/views/widget/widget.h"
......@@ -49,13 +52,17 @@ void SetDragImage(const GURL& url,
button.SetTextSubpixelRenderingEnabled(false);
const ui::NativeTheme* theme = widget->GetNativeTheme();
button.SetTextColor(views::Button::STATE_NORMAL,
theme->GetSystemColor(ui::NativeTheme::kColorId_LabelEnabledColor));
gfx::ShadowValues shadows(
10,
gfx::ShadowValue(gfx::Vector2d(0, 0), 1.0f,
theme->GetSystemColor(
ui::NativeTheme::kColorId_LabelBackgroundColor)));
button.SetTextShadows(shadows);
theme->GetSystemColor(ui::NativeTheme::kColorId_TextfieldDefaultColor));
SkColor bg_color = theme->GetSystemColor(
ui::NativeTheme::kColorId_TextfieldDefaultBackground);
if (widget->IsTranslucentWindowOpacitySupported()) {
button.SetTextShadows(gfx::ShadowValues(
10, gfx::ShadowValue(gfx::Vector2d(0, 0), 1.0f, bg_color)));
} else {
button.set_background(views::Background::CreateSolidBackground(bg_color));
button.SetBorder(button.CreateDefaultBorder());
}
button.SetMaxSize(gfx::Size(kLinkDragImageMaxWidth, 0));
if (icon.isNull()) {
button.SetImage(views::Button::STATE_NORMAL,
......
......@@ -14,9 +14,6 @@ namespace {
float GetDeviceScaleForNativeView(views::Widget* widget) {
float device_scale = 1.0f;
// The following code should work on other platforms as well. But we do not
// yet care about device scale factor on other platforms. So to keep drag and
// drop behavior on other platforms un-touched, we wrap this in the #if guard.
if (widget && widget->GetNativeView()) {
gfx::NativeView view = widget->GetNativeView();
gfx::Display display = gfx::Screen::GetScreenFor(view)->
......
......@@ -209,13 +209,12 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
WidgetDelegate* delegate;
bool child;
// If TRANSLUCENT_WINDOW, the widget may be fully or partially transparent.
// Translucent windows may not always be supported. Use
// IsTranslucentWindowOpacitySupported to determine if translucent windows
// are supported.
// If OPAQUE_WINDOW, we can perform optimizations based on the widget being
// fully opaque. Defaults to TRANSLUCENT_WINDOW if
// ViewsDelegate::UseTransparentWindows(). Defaults to OPAQUE_WINDOW for
// non-window widgets.
// fully opaque.
// Default is based on ViewsDelegate::GetOpacityForInitParams(). Defaults
// to OPAQUE_WINDOW for non-window widgets.
// Translucent windows may not always be supported. Use
// IsTranslucentWindowOpacitySupported to determine whether they are.
WindowOpacity opacity;
bool accept_events;
Activatable activatable;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment