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

Unified Diff: ui/views/controls/textfield/textfield.cc

Issue 2228593002: Implement Harmony textfield border (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tapted to the resuce Created 4 years, 4 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 | « ui/views/controls/focusable_border.cc ('k') | ui/views/examples/textfield_example.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/textfield/textfield.cc
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc
index be796b27549a59f49444ee6261134903192ac70b..1f940c5e476d76a626c87e4a09caa5b0d229b7c8 100644
--- a/ui/views/controls/textfield/textfield.cc
+++ b/ui/views/controls/textfield/textfield.cc
@@ -17,6 +17,7 @@
#include "ui/base/dragdrop/drag_utils.h"
#include "ui/base/ime/input_method.h"
#include "ui/base/ime/text_edit_commands.h"
+#include "ui/base/material_design/material_design_controller.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_switches_util.h"
#include "ui/compositor/canvas_painter.h"
@@ -1732,12 +1733,18 @@ void Textfield::AccessibilitySetValue(const base::string16& new_value) {
void Textfield::UpdateBackgroundColor() {
const SkColor color = GetBackgroundColor();
- set_background(Background::CreateSolidBackground(color));
+ if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
+ set_background(Background::CreateBackgroundPainter(
+ true, Painter::CreateSolidRoundRectPainter(
+ color, FocusableBorder::kCornerRadiusDp)));
+ } else {
+ set_background(Background::CreateSolidBackground(color));
+ }
// Disable subpixel rendering when the background color is transparent
// because it draws incorrect colors around the glyphs in that case.
// See crbug.com/115198
GetRenderText()->set_subpixel_rendering_suppressed(
- SkColorGetA(color) != 0xFF);
+ SkColorGetA(color) != SK_AlphaOPAQUE);
SchedulePaint();
}
« no previous file with comments | « ui/views/controls/focusable_border.cc ('k') | ui/views/examples/textfield_example.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698