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

Unified Diff: src/platform/theme/theme_draw.cc

Issue 2134013: Draw text field theme for GtkViewsTextView. (Closed) Base URL: ssh://git@chromiumos-git//chromeos
Patch Set: Created 10 years, 7 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 | « src/platform/theme/resources/gtkrc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/theme/theme_draw.cc
diff --git a/src/platform/theme/theme_draw.cc b/src/platform/theme/theme_draw.cc
index 34c36e9b92394175a7838e0ebad0720e1bd5388f..96e8a82370bdae7fac94e44ffadb1f25923f1451 100644
--- a/src/platform/theme/theme_draw.cc
+++ b/src/platform/theme/theme_draw.cc
@@ -218,7 +218,7 @@ static const double TEXT_GRADIENT_G2 = 1;
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 @@ static void DrawTextBorder(cairo_t* cr,
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 @@ static void DrawTextFieldBackground(GtkStyle* style,
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 @@ static void DrawTextFieldBorder(GtkStyle* style,
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 @@ void ThemeDrawFlatBox(GtkStyle* style,
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 @@ void ThemeDrawShadow(GtkStyle* style,
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 &&
« no previous file with comments | « src/platform/theme/resources/gtkrc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698