Commit 1f70fd82 authored by scr@chromium.org's avatar scr@chromium.org

Use the NativeTheme to create the text color for text during the generated card animation.

Also adjust the background so that darker colors are lighter and by a larger amount if really dark.

BUG=320899

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244083 0039d316-1c4b-4281-b951-d872f2087c98
parent 6fed21b4
......@@ -800,7 +800,6 @@ DialogOverlayState AutofillDialogControllerImpl::GetDialogOverlay() {
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
DialogOverlayState state;
state.string.font = rb.GetFont(ui::ResourceBundle::BaseFont).DeriveFont(3);
state.string.text_color = SK_ColorDKGRAY;
const SkColor start_top_color = SkColorSetRGB(0xD6, 0xD6, 0xD6);
const SkColor start_bottom_color = SkColorSetRGB(0x98, 0x98, 0x98);
......
......@@ -173,9 +173,6 @@ struct DialogOverlayString {
// Text content of the message.
base::string16 text;
// Color of the message's text.
SkColor text_color;
// Font to render the message's text in.
gfx::Font font;
};
......
......@@ -95,7 +95,7 @@ SkColor kSubtleBorderColor = 0xffdfdfdf;
// We probably want to look at other multi-line messages somewhere.
[label_ setFont:message.font.GetNativeFont()];
[label_ setStringValue:base::SysUTF16ToNSString(message.text)];
[label_ setTextColor:gfx::SkColorToCalibratedNSColor(message.text_color)];
[label_ setTextColor:[NSColor darkGrayColor]];
// Resize only height, preserve width. This guarantees text stays centered in
// the dialog.
......
......@@ -35,6 +35,7 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/animation/animation_delegate.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/font_list.h"
#include "ui/gfx/path.h"
#include "ui/gfx/point.h"
......@@ -587,7 +588,9 @@ void AutofillDialogViews::OverlayView::UpdateState() {
message_view_->SetVisible(!state.string.text.empty());
message_view_->SetText(state.string.text);
message_view_->SetFontList(gfx::FontList(state.string.font));
message_view_->SetEnabledColor(state.string.text_color);
message_view_->SetEnabledColor(GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_TextfieldReadOnlyColor));
message_view_->set_border(
views::Border::CreateEmptyBorder(kOverlayMessageVerticalPadding,
kDialogEdgePadding,
......@@ -650,11 +653,25 @@ void AutofillDialogViews::OverlayView::OnPaint(gfx::Canvas* canvas) {
arrow.lineTo(rect.x() - 1, rect.bottom() + 1);
arrow.close();
// The mocked alpha blends were 7 for background & 10 for the border against
// a very bright background. The eye perceives luminance differences of
// darker colors much less than lighter colors, so increase the alpha blend
// amount the darker the color (lower the luminance).
SkPaint paint;
paint.setColor(kShadingColor);
SkColor background_color = background()->get_color();
int background_luminance =
color_utils::GetLuminanceForColor(background_color);
int background_alpha = static_cast<int>(
7 + 15 * (255 - background_luminance) / 255);
int subtle_border_alpha = static_cast<int>(
10 + 20 * (255 - background_luminance) / 255);
paint.setColor(color_utils::BlendTowardOppositeLuminance(
background_color, background_alpha));
paint.setStyle(SkPaint::kFill_Style);
canvas->DrawPath(arrow, paint);
paint.setColor(kSubtleBorderColor);
paint.setColor(color_utils::BlendTowardOppositeLuminance(
background_color, subtle_border_alpha));
paint.setStyle(SkPaint::kStroke_Style);
canvas->DrawPath(arrow, paint);
}
......
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