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

Unified Diff: chrome/browser/ui/views/autofill/autofill_dialog_views.cc

Issue 107623002: Use the NativeTheme to create the text color for text during the generated card animation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed mac to use the GRAY constant that was previously set in the autofill_dialog_controller_impl. Created 6 years, 11 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
Index: chrome/browser/ui/views/autofill/autofill_dialog_views.cc
diff --git a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
index 459907ccbd3b9f30e0d4d88848dfcf56b1b6a22c..68fc6423d46e67ab4a12286a6c4514770bcfcf1b 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"
@@ -588,7 +589,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,
@@ -651,11 +654,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);
}

Powered by Google App Engine
This is Rietveld 408576698