Draw text field theme for GtkViewsTextView.
BUG=chromium-os:3426
TEST=Verify the multiline text edit (feedback dialog description) has similar look as other single line edits.
Review URL: http://codereview.chromium.org/2134013
diff --git a/resources/gtkrc b/resources/gtkrc
index 96013ea..4d6c501 100644
--- a/resources/gtkrc
+++ b/resources/gtkrc
@@ -133,6 +133,8 @@
class "GtkTextView" style "TextStyle"
+class "GtkViewsTextView" style "TextStyle"
+
widget "gtk-tooltip*" style "TooltipStyle"
widget "*.chromeos-options-tab" style "WhiteBackgroundStyle"
diff --git a/theme_draw.cc b/theme_draw.cc
index 34c36e9..96e8a82 100644
--- a/theme_draw.cc
+++ b/theme_draw.cc
@@ -218,7 +218,7 @@
static const double TEXT_GRADIENT_B2 = 1;
static const double TEXT_GRADIENT_STOP_0 = 0;
-static const double TEXT_GRADIENT_STOP_1 = .2;
+static const double TEXT_GRADIENT_STOP_1_PIXEL = 4;
static const double TEXT_GRADIENT_STOP_2 = 1;
static const double TREE_ITEM_BG_R = 1;
@@ -441,11 +441,13 @@
AddRoundedRectPath(cr, w, h, stroke_width, BORDER_CORNER_RADIUS);
+ double text_gradient_stop_1 = h ? TEXT_GRADIENT_STOP_1_PIXEL / h : 0;
+
ScopedPattern pattern(cairo_pattern_create_linear(0, 0, 0, h));
cairo_pattern_add_color_stop_rgb(pattern.get(), TEXT_GRADIENT_STOP_0,
TEXT_GRADIENT_R0, TEXT_GRADIENT_G0,
TEXT_GRADIENT_B0);
- cairo_pattern_add_color_stop_rgb(pattern.get(), TEXT_GRADIENT_STOP_1,
+ cairo_pattern_add_color_stop_rgb(pattern.get(), text_gradient_stop_1,
TEXT_GRADIENT_R1, TEXT_GRADIENT_G1,
TEXT_GRADIENT_B1);
cairo_pattern_add_color_stop_rgb(pattern.get(), TEXT_GRADIENT_STOP_2,
@@ -1154,7 +1156,7 @@
gint y,
gint w,
gint h) {
- if (!gtk_entry_get_has_frame(GTK_ENTRY(widget)))
+ if (GTK_IS_ENTRY(widget) && !gtk_entry_get_has_frame(GTK_ENTRY(widget)))
return;
ScopedSurface cr(window, area);
@@ -1174,7 +1176,7 @@
gint y,
gint w,
gint h) {
- if (!gtk_entry_get_has_frame(GTK_ENTRY(widget)))
+ if (GTK_IS_ENTRY(widget) && !gtk_entry_get_has_frame(GTK_ENTRY(widget)))
return;
ScopedSurface cr(window, area);
@@ -1411,7 +1413,8 @@
gint y,
gint w,
gint h) {
- if (GTK_IS_ENTRY(widget) && detail && !strcmp(detail, "entry_bg")) {
+ if ((GTK_IS_ENTRY(widget) && detail && !strcmp(detail, "entry_bg")) ||
+ (GTK_IS_TEXT_VIEW(widget) && detail && !strcmp(detail, "textview"))) {
DrawTextFieldBackground(style, window, state_type, shadow_type, area,
widget, x, y, w, h);
} else if (GTK_IS_WINDOW(widget) && detail && !strcmp(detail, "tooltip")) {
@@ -1486,7 +1489,8 @@
gint y,
gint w,
gint h) {
- if (GTK_IS_ENTRY(widget) && detail && !strcmp(detail, "entry")) {
+ if ((GTK_IS_ENTRY(widget) && detail && !strcmp(detail, "entry")) ||
+ (GTK_IS_TEXT_VIEW(widget) && detail && !strcmp(detail, "textview"))) {
DrawTextFieldBorder(style, window, state_type, shadow_type, area, widget, x,
y, w, h);
} else if (GTK_IS_SCROLLED_WINDOW(widget) && detail &&