diff options
author | scr@chromium.org <scr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-10 04:52:55 +0000 |
---|---|---|
committer | scr@chromium.org <scr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-10 04:52:55 +0000 |
commit | 1f70fd82514e1eadb93aebafd62268e3b1a4b212 (patch) | |
tree | 00df43b13eac85e4f139cc4235d647d84e063806 | |
parent | 6fed21b45cfde8d5c15e542a6c78170b69e2e536 (diff) | |
download | chromium_src-1f70fd82514e1eadb93aebafd62268e3b1a4b212.zip chromium_src-1f70fd82514e1eadb93aebafd62268e3b1a4b212.tar.gz chromium_src-1f70fd82514e1eadb93aebafd62268e3b1a4b212.tar.bz2 |
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
4 files changed, 21 insertions, 8 deletions
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc index 5e368da..05b1c24 100644 --- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc +++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc @@ -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); diff --git a/chrome/browser/ui/autofill/autofill_dialog_types.h b/chrome/browser/ui/autofill/autofill_dialog_types.h index 52f2e86..6da4270 100644 --- a/chrome/browser/ui/autofill/autofill_dialog_types.h +++ b/chrome/browser/ui/autofill/autofill_dialog_types.h @@ -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; }; diff --git a/chrome/browser/ui/cocoa/autofill/autofill_overlay_controller.mm b/chrome/browser/ui/cocoa/autofill/autofill_overlay_controller.mm index 8cff218..53d6901 100644 --- a/chrome/browser/ui/cocoa/autofill/autofill_overlay_controller.mm +++ b/chrome/browser/ui/cocoa/autofill/autofill_overlay_controller.mm @@ -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. diff --git a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc index 7f857a7..0cef3d8 100644 --- a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc +++ b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc @@ -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); } |