author | Wolfgang Rosenauer <wr@rosenauer.org> |
Sun, 24 Apr 2016 08:20:10 +0200 | |
branch | firefox45 |
changeset 908 | b29b47737173 |
parent 907 | 3ccb278a9ceb |
child 909 | c6717354928b |
permissions | -rw-r--r-- |
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1 |
diff -up firefox-45.0.2/widget/gtk/gtk3drawing.c.gtk3-20 firefox-45.0.2/widget/gtk/gtk3drawing.c |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
2 |
--- firefox-45.0.2/widget/gtk/gtk3drawing.c.gtk3-20 2016-04-08 01:55:04.000000000 +0200 |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
3 |
+++ firefox-45.0.2/widget/gtk/gtk3drawing.c 2016-04-20 18:49:52.897795872 +0200 |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
4 |
@@ -17,32 +17,79 @@ |
907 | 5 |
|
6 |
#include <math.h> |
|
7 |
||
8 |
+#define MOZ_WIDGET_STYLES 4 |
|
9 |
+ |
|
10 |
+typedef struct { |
|
11 |
+ GtkWidget* widget; |
|
12 |
+ |
|
13 |
+ union { |
|
14 |
+ struct { |
|
15 |
+ GtkStyleContext* style; |
|
16 |
+ GtkStyleContext* styleSelection; |
|
17 |
+ } entry; |
|
18 |
+ |
|
19 |
+ struct { |
|
20 |
+ GtkStyleContext* style; |
|
21 |
+ } button; |
|
22 |
+ |
|
23 |
+ struct { |
|
24 |
+ GtkStyleContext* style; |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
25 |
+ GtkStyleContext* styleContents; |
907 | 26 |
+ GtkStyleContext* styleTrough; |
27 |
+ GtkStyleContext* styleSlider; |
|
28 |
+ } scroll; |
|
29 |
+ |
|
30 |
+ struct { |
|
31 |
+ GtkStyleContext* style; |
|
32 |
+ GtkStyleContext* styleCheck; |
|
33 |
+ GtkStyleContext* styleLabel; |
|
34 |
+ } check; |
|
35 |
+ |
|
36 |
+ struct { |
|
37 |
+ GtkStyleContext* style; |
|
38 |
+ GtkStyleContext* styleTrough; |
|
39 |
+ GtkStyleContext* styleProgress; |
|
40 |
+ } progress; |
|
41 |
+ |
|
42 |
+ struct { |
|
43 |
+ GtkStyleContext* style; |
|
44 |
+ GtkStyleContext* styleEntry; |
|
45 |
+ GtkStyleContext* styleButtonUp; |
|
46 |
+ GtkStyleContext* styleButtonDown; |
|
47 |
+ } spin; |
|
48 |
+ |
|
49 |
+ struct { |
|
50 |
+ GtkStyleContext* style[MOZ_WIDGET_STYLES]; |
|
51 |
+ } all; |
|
52 |
+ }; |
|
53 |
+} MozGtkWidget; |
|
54 |
+ |
|
55 |
static GtkWidget* gProtoWindow; |
|
56 |
static GtkWidget* gProtoLayout; |
|
57 |
-static GtkWidget* gButtonWidget; |
|
58 |
+static MozGtkWidget gButton; |
|
59 |
static GtkWidget* gToggleButtonWidget; |
|
60 |
static GtkWidget* gButtonArrowWidget; |
|
61 |
-static GtkWidget* gCheckboxWidget; |
|
62 |
-static GtkWidget* gRadiobuttonWidget; |
|
63 |
-static GtkWidget* gHorizScrollbarWidget; |
|
64 |
-static GtkWidget* gVertScrollbarWidget; |
|
65 |
-static GtkWidget* gSpinWidget; |
|
66 |
+static MozGtkWidget gCheckbox; |
|
67 |
+static MozGtkWidget gRadiobutton; |
|
68 |
+static MozGtkWidget gVertScrollbar; |
|
69 |
+static MozGtkWidget gHorizScrollbar; |
|
70 |
+static MozGtkWidget gSpin; |
|
71 |
static GtkWidget* gHScaleWidget; |
|
72 |
static GtkWidget* gVScaleWidget; |
|
73 |
-static GtkWidget* gEntryWidget; |
|
74 |
+static MozGtkWidget gEntry; |
|
75 |
static GtkWidget* gComboBoxWidget; |
|
76 |
static GtkWidget* gComboBoxButtonWidget; |
|
77 |
static GtkWidget* gComboBoxArrowWidget; |
|
78 |
static GtkWidget* gComboBoxSeparatorWidget; |
|
79 |
static GtkWidget* gComboBoxEntryWidget; |
|
80 |
-static GtkWidget* gComboBoxEntryTextareaWidget; |
|
81 |
+static MozGtkWidget gComboBoxEntryTextarea; |
|
82 |
static GtkWidget* gComboBoxEntryButtonWidget; |
|
83 |
static GtkWidget* gComboBoxEntryArrowWidget; |
|
84 |
static GtkWidget* gHandleBoxWidget; |
|
85 |
static GtkWidget* gToolbarWidget; |
|
86 |
static GtkWidget* gFrameWidget; |
|
87 |
static GtkWidget* gStatusbarWidget; |
|
88 |
-static GtkWidget* gProgressWidget; |
|
89 |
+static MozGtkWidget gProgressBar; |
|
90 |
static GtkWidget* gTabWidget; |
|
91 |
static GtkWidget* gTooltipWidget; |
|
92 |
static GtkWidget* gMenuBarWidget; |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
93 |
@@ -78,6 +125,37 @@ static gboolean is_initialized; |
907 | 94 |
#define GTK_STATE_FLAG_CHECKED (1 << 11) |
95 |
#endif |
|
96 |
||
97 |
+void moz_gtk_widget_free(MozGtkWidget *aMozWidget) |
|
98 |
+{ |
|
99 |
+ // This was removed as a child of gProtoWindow |
|
100 |
+ if (aMozWidget->widget) { |
|
101 |
+ aMozWidget->widget = NULL; |
|
102 |
+ } |
|
103 |
+ |
|
104 |
+ for(int i = 0; i < MOZ_WIDGET_STYLES; i++) { |
|
105 |
+ if (aMozWidget->all.style[i]) { |
|
106 |
+ g_object_unref(aMozWidget->all.style[i]); |
|
107 |
+ aMozWidget->all.style[i] = NULL; |
|
108 |
+ } |
|
109 |
+ } |
|
110 |
+} |
|
111 |
+ |
|
112 |
+// TODO - weak dep!! (dlsym) |
|
113 |
+#if GTK_CHECK_VERSION(3, 19, 2) |
|
114 |
+#define moz_gtk_path_set_class_name gtk_widget_path_iter_set_object_name |
|
115 |
+#else |
|
116 |
+#define moz_gtk_path_set_class_name gtk_widget_path_iter_add_class |
|
117 |
+#endif |
|
118 |
+//gtk_widget_path_iter_get_state |
|
119 |
+ |
|
120 |
+static void |
|
121 |
+moz_gtk_get_style_border(GtkStyleContext* style, GtkStateFlags state_flags, |
|
122 |
+ GtkBorder *border); |
|
123 |
+ |
|
124 |
+static void |
|
125 |
+moz_gtk_get_style_padding(GtkStyleContext* style, GtkStateFlags state_flags, |
|
126 |
+ GtkBorder *padding); |
|
127 |
+ |
|
128 |
static GtkStateFlags |
|
129 |
GetStateFlagsFromGtkWidgetState(GtkWidgetState* state) |
|
130 |
{ |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
131 |
@@ -97,6 +175,41 @@ GetStateFlagsFromGtkWidgetState(GtkWidge |
907 | 132 |
return stateFlags; |
133 |
} |
|
134 |
||
135 |
+GtkStyleContext * |
|
136 |
+moz_gtk_style_create(GtkCssNode *node, GtkStyleContext *parent) |
|
137 |
+{ |
|
138 |
+ GtkWidgetPath *path; |
|
139 |
+ GtkStyleContext *context; |
|
140 |
+ |
|
141 |
+ if (parent) |
|
142 |
+ path = gtk_widget_path_copy (gtk_style_context_get_path (parent)); |
|
143 |
+ else |
|
144 |
+ path = gtk_widget_path_new (); |
|
145 |
+ |
|
146 |
+ gtk_widget_path_append_type (path, node->type); |
|
147 |
+ if (node->name) |
|
148 |
+ moz_gtk_path_set_class_name(path, -1, node->name); |
|
149 |
+ if (node->class1) |
|
150 |
+ gtk_widget_path_iter_add_class(path, -1, node->class1); |
|
151 |
+ if (node->class2) |
|
152 |
+ gtk_widget_path_iter_add_class(path, -1, node->class2); |
|
153 |
+ |
|
154 |
+ context = gtk_style_context_new (); |
|
155 |
+ gtk_style_context_set_path (context, path); |
|
156 |
+ gtk_style_context_set_parent (context, parent); |
|
157 |
+ |
|
158 |
+ if(!gtk_check_version(3, 14, 0)) { |
|
159 |
+ /* Unfortunately, we have to explicitly set the state again here |
|
160 |
+ * for it to take effect |
|
161 |
+ */ |
|
162 |
+ gtk_style_context_set_state (context, gtk_widget_path_iter_get_state (path, -1)); |
|
163 |
+ } |
|
164 |
+ |
|
165 |
+ gtk_widget_path_unref (path); |
|
166 |
+ |
|
167 |
+ return context; |
|
168 |
+} |
|
169 |
+ |
|
170 |
/* Because we have such an unconventional way of drawing widgets, signal to the GTK theme engine |
|
171 |
that they are drawing for Mozilla instead of a conventional GTK app so they can do any specific |
|
172 |
things they may want to do. */ |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
173 |
@@ -141,9 +254,16 @@ setup_widget_prototype(GtkWidget* widget |
907 | 174 |
static gint |
175 |
ensure_button_widget() |
|
176 |
{ |
|
177 |
- if (!gButtonWidget) { |
|
178 |
- gButtonWidget = gtk_button_new_with_label("M"); |
|
179 |
- setup_widget_prototype(gButtonWidget); |
|
180 |
+ if (!gButton.widget) { |
|
181 |
+ GtkCssNode path[] = { |
|
182 |
+ { GTK_TYPE_BUTTON, "button", NULL, NULL } |
|
183 |
+ }; |
|
184 |
+ |
|
185 |
+ gButton.widget = gtk_button_new_with_label("M"); |
|
186 |
+ setup_widget_prototype(gButton.widget); |
|
187 |
+ gtk_widget_show(gButton.widget); |
|
188 |
+ |
|
189 |
+ gButton.button.style = moz_gtk_style_create(&path[0], NULL); |
|
190 |
} |
|
191 |
return MOZ_GTK_SUCCESS; |
|
192 |
} |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
193 |
@@ -195,9 +315,21 @@ ensure_button_arrow_widget() |
907 | 194 |
static gint |
195 |
ensure_checkbox_widget() |
|
196 |
{ |
|
197 |
- if (!gCheckboxWidget) { |
|
198 |
- gCheckboxWidget = gtk_check_button_new_with_label("M"); |
|
199 |
- setup_widget_prototype(gCheckboxWidget); |
|
200 |
+ if (!gCheckbox.widget) { |
|
201 |
+ GtkCssNode path[] = { |
|
202 |
+ { GTK_TYPE_TOGGLE_BUTTON, "checkbutton", NULL, NULL }, |
|
203 |
+ { G_TYPE_NONE, "check", NULL, NULL }, |
|
204 |
+ { G_TYPE_NONE, "label", NULL, NULL } |
|
205 |
+ }; |
|
206 |
+ |
|
207 |
+ gCheckbox.widget = gtk_check_button_new_with_label("M"); |
|
208 |
+ setup_widget_prototype(gCheckbox.widget); |
|
209 |
+ |
|
210 |
+ gCheckbox.check.style = moz_gtk_style_create(&path[0], NULL); |
|
211 |
+ gCheckbox.check.styleCheck = moz_gtk_style_create(&path[1], |
|
212 |
+ gCheckbox.check.style); |
|
213 |
+ gCheckbox.check.styleLabel = moz_gtk_style_create(&path[2], |
|
214 |
+ gCheckbox.check.style); |
|
215 |
} |
|
216 |
return MOZ_GTK_SUCCESS; |
|
217 |
} |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
218 |
@@ -205,9 +337,21 @@ ensure_checkbox_widget() |
907 | 219 |
static gint |
220 |
ensure_radiobutton_widget() |
|
221 |
{ |
|
222 |
- if (!gRadiobuttonWidget) { |
|
223 |
- gRadiobuttonWidget = gtk_radio_button_new_with_label(NULL, "M"); |
|
224 |
- setup_widget_prototype(gRadiobuttonWidget); |
|
225 |
+ if (!gRadiobutton.widget) { |
|
226 |
+ GtkCssNode path[] = { |
|
227 |
+ { GTK_TYPE_TOGGLE_BUTTON, "radiobutton", NULL, NULL }, |
|
228 |
+ { G_TYPE_NONE, "radio", NULL, NULL }, |
|
229 |
+ { G_TYPE_NONE, "label", NULL, NULL } |
|
230 |
+ }; |
|
231 |
+ |
|
232 |
+ gRadiobutton.widget = gtk_radio_button_new_with_label(NULL, "M"); |
|
233 |
+ setup_widget_prototype(gRadiobutton.widget); |
|
234 |
+ |
|
235 |
+ gRadiobutton.check.style = moz_gtk_style_create(&path[0], NULL); |
|
236 |
+ gRadiobutton.check.styleCheck = moz_gtk_style_create(&path[1], |
|
237 |
+ gRadiobutton.check.style); |
|
238 |
+ gRadiobutton.check.styleLabel = moz_gtk_style_create(&path[2], |
|
239 |
+ gRadiobutton.check.style); |
|
240 |
} |
|
241 |
return MOZ_GTK_SUCCESS; |
|
242 |
} |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
243 |
@@ -215,25 +359,62 @@ ensure_radiobutton_widget() |
907 | 244 |
static gint |
245 |
ensure_scrollbar_widget() |
|
246 |
{ |
|
247 |
- if (!gVertScrollbarWidget) { |
|
248 |
- gVertScrollbarWidget = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, NULL); |
|
249 |
- setup_widget_prototype(gVertScrollbarWidget); |
|
250 |
- } |
|
251 |
- if (!gHorizScrollbarWidget) { |
|
252 |
- gHorizScrollbarWidget = gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL, NULL); |
|
253 |
- setup_widget_prototype(gHorizScrollbarWidget); |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
254 |
- } |
907 | 255 |
+ if (!gVertScrollbar.widget && !gHorizScrollbar.widget) { |
256 |
+ GtkCssNode path[] = { |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
257 |
+ { GTK_TYPE_SCROLLBAR, "scrollbar", "horizontal", "bottom"}, |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
258 |
+ { GTK_TYPE_SCROLLBAR, "scrollbar", "vertical", "right" }, |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
259 |
+ { G_TYPE_NONE, "contents", NULL, NULL }, |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
260 |
+ { G_TYPE_NONE, "trough", NULL, NULL }, |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
261 |
+ { G_TYPE_NONE, "slider", NULL, NULL } |
907 | 262 |
+ }; |
263 |
+ |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
264 |
+ gHorizScrollbar.widget = gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL, NULL); |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
265 |
+ setup_widget_prototype(gHorizScrollbar.widget); |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
266 |
+ |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
267 |
+ gHorizScrollbar.scroll.style = moz_gtk_style_create(path, NULL); |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
268 |
+ gHorizScrollbar.scroll.styleContents = moz_gtk_style_create(path+2, |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
269 |
+ gHorizScrollbar.scroll.style); |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
270 |
+ gHorizScrollbar.scroll.styleTrough = moz_gtk_style_create(path+3, |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
271 |
+ gHorizScrollbar.scroll.styleContents); |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
272 |
+ gHorizScrollbar.scroll.styleSlider = moz_gtk_style_create(path+4, |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
273 |
+ gHorizScrollbar.scroll.styleTrough); |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
274 |
+ |
907 | 275 |
+ gVertScrollbar.widget = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, NULL); |
276 |
+ setup_widget_prototype(gVertScrollbar.widget); |
|
277 |
+ |
|
278 |
+ gVertScrollbar.scroll.style = moz_gtk_style_create(path+1, NULL); |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
279 |
+ gVertScrollbar.scroll.styleContents = moz_gtk_style_create(path+2, |
907 | 280 |
+ gVertScrollbar.scroll.style); |
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
281 |
+ gVertScrollbar.scroll.styleTrough = moz_gtk_style_create(path+3, |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
282 |
+ gVertScrollbar.scroll.styleContents); |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
283 |
+ gVertScrollbar.scroll.styleSlider = moz_gtk_style_create(path+4, |
907 | 284 |
+ gVertScrollbar.scroll.styleTrough); |
285 |
+ |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
286 |
+ } |
907 | 287 |
return MOZ_GTK_SUCCESS; |
288 |
} |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
289 |
|
907 | 290 |
static gint |
291 |
ensure_spin_widget() |
|
292 |
{ |
|
293 |
- if (!gSpinWidget) { |
|
294 |
- gSpinWidget = gtk_spin_button_new(NULL, 1, 0); |
|
295 |
- setup_widget_prototype(gSpinWidget); |
|
296 |
- } |
|
297 |
- return MOZ_GTK_SUCCESS; |
|
298 |
+ if (!gSpin.widget) { |
|
299 |
+ GtkCssNode path[] = { |
|
300 |
+ { GTK_TYPE_SPIN_BUTTON, "spinbutton", "horizontal", NULL }, |
|
301 |
+ { GTK_TYPE_SPIN_BUTTON, "spinbutton", "vertical", NULL }, |
|
302 |
+ { GTK_TYPE_ENTRY, "entry", NULL, NULL }, |
|
303 |
+ { G_TYPE_NONE, "button", "up", NULL }, |
|
304 |
+ { G_TYPE_NONE, "button", "down", NULL } |
|
305 |
+ }; |
|
306 |
+ |
|
307 |
+ gSpin.widget = gtk_spin_button_new(NULL, 1, 0); |
|
308 |
+ setup_widget_prototype(gSpin.widget); |
|
309 |
+ |
|
310 |
+ gSpin.spin.style = moz_gtk_style_create(path, NULL); |
|
311 |
+ gSpin.spin.styleButtonUp = moz_gtk_style_create(path+3, gSpin.spin.style); |
|
312 |
+ gSpin.spin.styleButtonDown = moz_gtk_style_create(path+4, gSpin.spin.style); |
|
313 |
+ gSpin.spin.styleEntry = moz_gtk_style_create(path+2, gSpin.spin.style); |
|
314 |
+ } |
|
315 |
+ return MOZ_GTK_SUCCESS; |
|
316 |
} |
|
317 |
||
318 |
static gint |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
319 |
@@ -253,9 +434,19 @@ ensure_scale_widget() |
907 | 320 |
static gint |
321 |
ensure_entry_widget() |
|
322 |
{ |
|
323 |
- if (!gEntryWidget) { |
|
324 |
- gEntryWidget = gtk_entry_new(); |
|
325 |
- setup_widget_prototype(gEntryWidget); |
|
326 |
+ if (!gEntry.widget) { |
|
327 |
+ GtkCssNode path[] = { |
|
328 |
+ { GTK_TYPE_ENTRY, "entry", NULL, NULL }, |
|
329 |
+ { G_TYPE_NONE, "selection", NULL, NULL } |
|
330 |
+ }; |
|
331 |
+ |
|
332 |
+ gEntry.widget = gtk_entry_new(); |
|
333 |
+ setup_widget_prototype(gEntry.widget); |
|
334 |
+ gtk_widget_show(gEntry.widget); |
|
335 |
+ |
|
336 |
+ gEntry.entry.style = moz_gtk_style_create(&path[0], NULL); |
|
337 |
+ gEntry.entry.styleSelection = moz_gtk_style_create(&path[1], |
|
338 |
+ gEntry.entry.style); |
|
339 |
} |
|
340 |
return MOZ_GTK_SUCCESS; |
|
341 |
} |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
342 |
@@ -387,9 +578,9 @@ moz_gtk_get_combo_box_entry_inner_widget |
907 | 343 |
g_object_add_weak_pointer(G_OBJECT(widget), |
344 |
(gpointer) &gComboBoxEntryButtonWidget); |
|
345 |
} else if (GTK_IS_ENTRY(widget)) { |
|
346 |
- gComboBoxEntryTextareaWidget = widget; |
|
347 |
+ gComboBoxEntryTextarea.widget = widget; |
|
348 |
g_object_add_weak_pointer(G_OBJECT(widget), |
|
349 |
- (gpointer) &gComboBoxEntryTextareaWidget); |
|
350 |
+ (gpointer) &gComboBoxEntryTextarea.widget); |
|
351 |
} else |
|
352 |
return; |
|
353 |
gtk_widget_realize(widget); |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
354 |
@@ -411,7 +602,7 @@ ensure_combo_box_entry_widgets() |
907 | 355 |
{ |
356 |
GtkWidget* buttonChild; |
|
357 |
||
358 |
- if (gComboBoxEntryTextareaWidget && |
|
359 |
+ if (gComboBoxEntryTextarea.widget && |
|
360 |
gComboBoxEntryButtonWidget && |
|
361 |
gComboBoxEntryArrowWidget) |
|
362 |
return MOZ_GTK_SUCCESS; |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
363 |
@@ -427,9 +618,9 @@ ensure_combo_box_entry_widgets() |
907 | 364 |
moz_gtk_get_combo_box_entry_inner_widgets, |
365 |
NULL); |
|
366 |
||
367 |
- if (!gComboBoxEntryTextareaWidget) { |
|
368 |
+ if (!gComboBoxEntryTextarea.widget) { |
|
369 |
ensure_entry_widget(); |
|
370 |
- gComboBoxEntryTextareaWidget = gEntryWidget; |
|
371 |
+ gComboBoxEntryTextarea.widget = gEntry.widget; |
|
372 |
} |
|
373 |
||
374 |
if (gComboBoxEntryButtonWidget) { |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
375 |
@@ -528,9 +719,21 @@ ensure_tab_widget() |
907 | 376 |
static gint |
377 |
ensure_progress_widget() |
|
378 |
{ |
|
379 |
- if (!gProgressWidget) { |
|
380 |
- gProgressWidget = gtk_progress_bar_new(); |
|
381 |
- setup_widget_prototype(gProgressWidget); |
|
382 |
+ if (!gProgressBar.widget) { |
|
383 |
+ GtkCssNode path[] = { |
|
384 |
+ { GTK_TYPE_LABEL, "progressbar", NULL, NULL }, |
|
385 |
+ { G_TYPE_NONE, "trough", NULL, NULL }, |
|
386 |
+ { G_TYPE_NONE, "progress", NULL, NULL }, |
|
387 |
+ }; |
|
388 |
+ |
|
389 |
+ gProgressBar.widget = gtk_progress_bar_new(); |
|
390 |
+ setup_widget_prototype(gProgressBar.widget); |
|
391 |
+ |
|
392 |
+ gProgressBar.progress.style = moz_gtk_style_create(&path[0], NULL); |
|
393 |
+ gProgressBar.progress.styleTrough = moz_gtk_style_create(&path[1], |
|
394 |
+ gProgressBar.progress.style); |
|
395 |
+ gProgressBar.progress.styleProgress = moz_gtk_style_create(&path[2], |
|
396 |
+ gProgressBar.progress.styleTrough); |
|
397 |
} |
|
398 |
return MOZ_GTK_SUCCESS; |
|
399 |
} |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
400 |
@@ -636,6 +839,11 @@ static gint |
907 | 401 |
ensure_check_menu_item_widget() |
402 |
{ |
|
403 |
if (!gCheckMenuItemWidget) { |
|
404 |
+ GtkCssNode path[] = { |
|
405 |
+ { GTK_TYPE_CHECK_MENU_ITEM, "menuitem", NULL, NULL }, |
|
406 |
+ { G_TYPE_NONE, "check", NULL, NULL } |
|
407 |
+ }; |
|
408 |
+ |
|
409 |
ensure_menu_popup_widget(); |
|
410 |
gCheckMenuItemWidget = gtk_check_menu_item_new_with_label("M"); |
|
411 |
gtk_menu_shell_append(GTK_MENU_SHELL(gMenuPopupWidget), |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
412 |
@@ -757,7 +965,7 @@ moz_gtk_checkbox_get_metrics(gint* indic |
907 | 413 |
{ |
414 |
ensure_checkbox_widget(); |
|
415 |
||
416 |
- gtk_widget_style_get (gCheckboxWidget, |
|
417 |
+ gtk_widget_style_get (gCheckbox.widget, |
|
418 |
"indicator_size", indicator_size, |
|
419 |
"indicator_spacing", indicator_spacing, |
|
420 |
NULL); |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
421 |
@@ -770,7 +978,7 @@ moz_gtk_radio_get_metrics(gint* indicato |
907 | 422 |
{ |
423 |
ensure_radiobutton_widget(); |
|
424 |
||
425 |
- gtk_widget_style_get (gRadiobuttonWidget, |
|
426 |
+ gtk_widget_style_get (gRadiobutton.widget, |
|
427 |
"indicator_size", indicator_size, |
|
428 |
"indicator_spacing", indicator_spacing, |
|
429 |
NULL); |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
430 |
@@ -783,13 +991,12 @@ moz_gtk_get_focus_outline_size(gint* foc |
907 | 431 |
{ |
432 |
GtkBorder border; |
|
433 |
GtkBorder padding; |
|
434 |
- GtkStyleContext *style; |
|
435 |
+ GtkStyleContext* style = gEntry.entry.style; |
|
436 |
||
437 |
ensure_entry_widget(); |
|
438 |
- style = gtk_widget_get_style_context(gEntryWidget); |
|
439 |
||
440 |
- gtk_style_context_get_border(style, 0, &border); |
|
441 |
- gtk_style_context_get_padding(style, 0, &padding); |
|
442 |
+ gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border); |
|
443 |
+ gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding); |
|
444 |
*focus_h_width = border.left + padding.left; |
|
445 |
*focus_v_width = border.top + padding.top; |
|
446 |
return MOZ_GTK_SUCCESS; |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
447 |
@@ -826,7 +1033,7 @@ moz_gtk_button_get_default_overflow(gint |
907 | 448 |
GtkBorder* default_outside_border; |
449 |
||
450 |
ensure_button_widget(); |
|
451 |
- gtk_widget_style_get(gButtonWidget, |
|
452 |
+ gtk_widget_style_get(gButton.widget, |
|
453 |
"default-outside-border", &default_outside_border, |
|
454 |
NULL); |
|
455 |
||
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
456 |
@@ -849,7 +1056,7 @@ moz_gtk_button_get_default_border(gint* |
907 | 457 |
GtkBorder* default_border; |
458 |
||
459 |
ensure_button_widget(); |
|
460 |
- gtk_widget_style_get(gButtonWidget, |
|
461 |
+ gtk_widget_style_get(gButton.widget, |
|
462 |
"default-border", &default_border, |
|
463 |
NULL); |
|
464 |
||
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
465 |
@@ -940,7 +1147,7 @@ moz_gtk_button_paint(cairo_t *cr, GdkRec |
907 | 466 |
|
467 |
if (state->focused) { |
|
468 |
GtkBorder border; |
|
469 |
- gtk_style_context_get_border(style, state_flags, &border); |
|
470 |
+ moz_gtk_get_style_border(style, state_flags, &border); |
|
471 |
x += border.left; |
|
472 |
y += border.top; |
|
473 |
width -= (border.left + border.right); |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
474 |
@@ -961,15 +1168,14 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec |
907 | 475 |
gint indicator_size, indicator_spacing; |
476 |
gint x, y, width, height; |
|
477 |
gint focus_x, focus_y, focus_width, focus_height; |
|
478 |
- GtkWidget *w; |
|
479 |
- GtkStyleContext *style; |
|
480 |
+ MozGtkWidget *w; |
|
481 |
||
482 |
if (isradio) { |
|
483 |
moz_gtk_radio_get_metrics(&indicator_size, &indicator_spacing); |
|
484 |
- w = gRadiobuttonWidget; |
|
485 |
+ w = &gRadiobutton; |
|
486 |
} else { |
|
487 |
moz_gtk_checkbox_get_metrics(&indicator_size, &indicator_spacing); |
|
488 |
- w = gCheckboxWidget; |
|
489 |
+ w = &gCheckbox; |
|
490 |
} |
|
491 |
||
492 |
// XXX we should assert rect->height >= indicator_size too |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
493 |
@@ -988,11 +1194,9 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec |
907 | 494 |
focus_width = width + 2 * indicator_spacing; |
495 |
focus_height = height + 2 * indicator_spacing; |
|
496 |
||
497 |
- style = gtk_widget_get_style_context(w); |
|
498 |
- |
|
499 |
- gtk_widget_set_sensitive(w, !state->disabled); |
|
500 |
- gtk_widget_set_direction(w, direction); |
|
501 |
- gtk_style_context_save(style); |
|
502 |
+ gtk_widget_set_sensitive(w->widget, !state->disabled); |
|
503 |
+ gtk_widget_set_direction(w->widget, direction); |
|
504 |
+ gtk_style_context_save(w->check.styleCheck); |
|
505 |
||
506 |
if (selected) |
|
507 |
state_flags |= checkbox_check_state; |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
508 |
@@ -1000,13 +1204,15 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec |
907 | 509 |
if (inconsistent) |
510 |
state_flags |= GTK_STATE_FLAG_INCONSISTENT; |
|
511 |
||
512 |
- gtk_style_context_set_state(style, state_flags); |
|
513 |
+ gtk_style_context_set_state(w->check.styleCheck, state_flags); |
|
514 |
+ |
|
515 |
+ gtk_render_background(w->check.styleCheck, cr, x, y, width, height); |
|
516 |
+ gtk_render_frame(w->check.styleCheck, cr, x, y, width, height); |
|
517 |
||
518 |
if (isradio) { |
|
519 |
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_RADIO); |
|
520 |
- gtk_render_option(style, cr, x, y, width, height); |
|
521 |
+ gtk_render_option(w->check.styleCheck, cr, x, y, width, height); |
|
522 |
if (state->focused) { |
|
523 |
- gtk_render_focus(style, cr, focus_x, focus_y, |
|
524 |
+ gtk_render_focus(w->check.styleCheck, cr, focus_x, focus_y, |
|
525 |
focus_width, focus_height); |
|
526 |
} |
|
527 |
} |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
528 |
@@ -1015,15 +1221,14 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec |
907 | 529 |
* 'indeterminate' type on checkboxes. In GTK, the shadow type |
530 |
* must also be changed for the state to be drawn. |
|
531 |
*/ |
|
532 |
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_CHECK); |
|
533 |
- gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(gCheckboxWidget), inconsistent); |
|
534 |
- gtk_render_check(style, cr, x, y, width, height); |
|
535 |
+ gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(w->widget), inconsistent); |
|
536 |
+ gtk_render_check(w->check.styleCheck, cr, x, y, width, height); |
|
537 |
if (state->focused) { |
|
538 |
- gtk_render_focus(style, cr, |
|
539 |
+ gtk_render_focus(w->check.styleCheck, cr, |
|
540 |
focus_x, focus_y, focus_width, focus_height); |
|
541 |
} |
|
542 |
} |
|
543 |
- gtk_style_context_restore(style); |
|
544 |
+ gtk_style_context_restore(w->check.styleCheck); |
|
545 |
||
546 |
return MOZ_GTK_SUCCESS; |
|
547 |
} |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
548 |
@@ -1040,8 +1245,8 @@ calculate_button_inner_rect(GtkWidget* b |
907 | 549 |
style = gtk_widget_get_style_context(button); |
550 |
||
551 |
/* This mirrors gtkbutton's child positioning */ |
|
552 |
- gtk_style_context_get_border(style, 0, &border); |
|
553 |
- gtk_style_context_get_padding(style, 0, &padding); |
|
554 |
+ gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border); |
|
555 |
+ gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding); |
|
556 |
||
557 |
inner_rect->x = rect->x + border.left + padding.left; |
|
558 |
inner_rect->y = rect->y + padding.top + border.top; |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
559 |
@@ -1107,9 +1312,9 @@ moz_gtk_scrollbar_button_paint(cairo_t * |
907 | 560 |
ensure_scrollbar_widget(); |
561 |
||
562 |
if (flags & MOZ_GTK_STEPPER_VERTICAL) |
|
563 |
- scrollbar = gVertScrollbarWidget; |
|
564 |
+ scrollbar = gVertScrollbar.widget; |
|
565 |
else |
|
566 |
- scrollbar = gHorizScrollbarWidget; |
|
567 |
+ scrollbar = gHorizScrollbar.widget; |
|
568 |
||
569 |
gtk_widget_set_direction(scrollbar, direction); |
|
570 |
||
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
571 |
@@ -1175,26 +1380,23 @@ moz_gtk_scrollbar_trough_paint(GtkThemeW |
907 | 572 |
GtkTextDirection direction) |
573 |
{ |
|
574 |
GtkStyleContext* style; |
|
575 |
- GtkScrollbar *scrollbar; |
|
576 |
||
577 |
ensure_scrollbar_widget(); |
|
578 |
||
579 |
- if (widget == MOZ_GTK_SCROLLBAR_TRACK_HORIZONTAL) |
|
580 |
- scrollbar = GTK_SCROLLBAR(gHorizScrollbarWidget); |
|
581 |
- else |
|
582 |
- scrollbar = GTK_SCROLLBAR(gVertScrollbarWidget); |
|
583 |
- |
|
584 |
- gtk_widget_set_direction(GTK_WIDGET(scrollbar), direction); |
|
585 |
+ if (widget == MOZ_GTK_SCROLLBAR_TRACK_HORIZONTAL) { |
|
586 |
+ gtk_widget_set_direction(GTK_WIDGET(gHorizScrollbar.widget), direction); |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
587 |
+ style = gHorizScrollbar.scroll.style; |
907 | 588 |
+ } |
589 |
+ else { |
|
590 |
+ gtk_widget_set_direction(GTK_WIDGET(gVertScrollbar.widget), direction); |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
591 |
+ style = gVertScrollbar.scroll.style; |
907 | 592 |
+ } |
593 |
||
594 |
if (flags & MOZ_GTK_TRACK_OPAQUE) { |
|
595 |
style = gtk_widget_get_style_context(GTK_WIDGET(gProtoWindow)); |
|
596 |
gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height); |
|
597 |
} |
|
598 |
||
599 |
- style = gtk_widget_get_style_context(GTK_WIDGET(scrollbar)); |
|
600 |
- gtk_style_context_save(style); |
|
601 |
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_TROUGH); |
|
602 |
- |
|
603 |
gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height); |
|
604 |
gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height); |
|
605 |
||
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
606 |
@@ -1202,7 +1404,6 @@ moz_gtk_scrollbar_trough_paint(GtkThemeW |
907 | 607 |
gtk_render_focus(style, cr, |
608 |
rect->x, rect->y, rect->width, rect->height); |
|
609 |
} |
|
610 |
- gtk_style_context_restore(style); |
|
611 |
return MOZ_GTK_SUCCESS; |
|
612 |
} |
|
613 |
||
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
614 |
@@ -1214,25 +1415,21 @@ moz_gtk_scrollbar_thumb_paint(GtkThemeWi |
907 | 615 |
{ |
616 |
GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state); |
|
617 |
GtkStyleContext* style; |
|
618 |
- GtkScrollbar *scrollbar; |
|
619 |
GtkAdjustment *adj; |
|
620 |
GtkBorder margin; |
|
621 |
||
622 |
ensure_scrollbar_widget(); |
|
623 |
||
624 |
- if (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL) |
|
625 |
- scrollbar = GTK_SCROLLBAR(gHorizScrollbarWidget); |
|
626 |
- else |
|
627 |
- scrollbar = GTK_SCROLLBAR(gVertScrollbarWidget); |
|
628 |
- |
|
629 |
- gtk_widget_set_direction(GTK_WIDGET(scrollbar), direction); |
|
630 |
- |
|
631 |
- style = gtk_widget_get_style_context(GTK_WIDGET(scrollbar)); |
|
632 |
- gtk_style_context_save(style); |
|
633 |
+ if (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL) { |
|
634 |
+ style = gHorizScrollbar.scroll.styleSlider; |
|
635 |
+ gtk_widget_set_direction(GTK_WIDGET(gHorizScrollbar.widget), direction); |
|
636 |
+ } |
|
637 |
+ else { |
|
638 |
+ style = gVertScrollbar.scroll.styleSlider; |
|
639 |
+ gtk_widget_set_direction(GTK_WIDGET(gVertScrollbar.widget), direction); |
|
640 |
+ } |
|
641 |
||
642 |
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_SLIDER); |
|
643 |
gtk_style_context_set_state(style, state_flags); |
|
644 |
- |
|
645 |
gtk_style_context_get_margin (style, state_flags, &margin); |
|
646 |
||
647 |
gtk_render_slider(style, cr, |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
648 |
@@ -1243,8 +1440,6 @@ moz_gtk_scrollbar_thumb_paint(GtkThemeWi |
907 | 649 |
(widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL) ? |
650 |
GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL); |
|
651 |
||
652 |
- gtk_style_context_restore(style); |
|
653 |
- |
|
654 |
return MOZ_GTK_SUCCESS; |
|
655 |
} |
|
656 |
||
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
657 |
@@ -1255,8 +1450,8 @@ moz_gtk_spin_paint(cairo_t *cr, GdkRecta |
907 | 658 |
GtkStyleContext* style; |
659 |
||
660 |
ensure_spin_widget(); |
|
661 |
- gtk_widget_set_direction(gSpinWidget, direction); |
|
662 |
- style = gtk_widget_get_style_context(gSpinWidget); |
|
663 |
+ gtk_widget_set_direction(gSpin.widget, direction); |
|
664 |
+ style = gSpin.spin.style; |
|
665 |
gtk_style_context_save(style); |
|
666 |
gtk_style_context_add_class(style, GTK_STYLE_CLASS_SPINBUTTON); |
|
667 |
gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height); |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
668 |
@@ -1275,11 +1470,10 @@ moz_gtk_spin_updown_paint(cairo_t *cr, G |
907 | 669 |
GtkStyleContext* style; |
670 |
||
671 |
ensure_spin_widget(); |
|
672 |
- style = gtk_widget_get_style_context(gSpinWidget); |
|
673 |
+ style = gSpin.spin.style; |
|
674 |
gtk_style_context_save(style); |
|
675 |
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_SPINBUTTON); |
|
676 |
gtk_style_context_set_state(style, GetStateFlagsFromGtkWidgetState(state)); |
|
677 |
- gtk_widget_set_direction(gSpinWidget, direction); |
|
678 |
+ gtk_widget_set_direction(gSpin.widget, direction); |
|
679 |
||
680 |
gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height); |
|
681 |
gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height); |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
682 |
@@ -1445,15 +1639,13 @@ moz_gtk_vpaned_paint(cairo_t *cr, GdkRec |
907 | 683 |
static gint |
684 |
moz_gtk_entry_paint(cairo_t *cr, GdkRectangle* rect, |
|
685 |
GtkWidgetState* state, |
|
686 |
- GtkWidget* widget, GtkTextDirection direction) |
|
687 |
+ MozGtkWidget* w, GtkTextDirection direction) |
|
688 |
{ |
|
689 |
gint x = rect->x, y = rect->y, width = rect->width, height = rect->height; |
|
690 |
- GtkStyleContext* style; |
|
691 |
int draw_focus_outline_only = state->depressed; // NS_THEME_FOCUS_OUTLINE |
|
692 |
+ GtkStyleContext* style = w->entry.style; |
|
693 |
||
694 |
- gtk_widget_set_direction(widget, direction); |
|
695 |
- |
|
696 |
- style = gtk_widget_get_style_context(widget); |
|
697 |
+ gtk_widget_set_direction(w->widget, direction); |
|
698 |
||
699 |
if (draw_focus_outline_only) { |
|
700 |
// Inflate the given 'rect' with the focus outline size. |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
701 |
@@ -1473,10 +1665,9 @@ moz_gtk_entry_paint(cairo_t *cr, GdkRect |
907 | 702 |
* textarea window uses gtk_paint_flat_box when exposed */ |
703 |
||
704 |
/* This gets us a lovely greyish disabledish look */ |
|
705 |
- gtk_widget_set_sensitive(widget, !state->disabled); |
|
706 |
+ gtk_widget_set_sensitive(w->widget, !state->disabled); |
|
707 |
||
708 |
gtk_style_context_save(style); |
|
709 |
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_ENTRY); |
|
710 |
||
711 |
/* Now paint the shadow and focus border. |
|
712 |
* We do like in gtk_entry_draw_frame, we first draw the shadow, a tad |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
713 |
@@ -1526,7 +1717,7 @@ moz_gtk_treeview_paint(cairo_t *cr, GdkR |
907 | 714 |
style = gtk_widget_get_style_context(gScrolledWindowWidget); |
715 |
gtk_style_context_save(style); |
|
716 |
gtk_style_context_add_class(style, GTK_STYLE_CLASS_FRAME); |
|
717 |
- gtk_style_context_get_border(style, state_flags, &border); |
|
718 |
+ moz_gtk_get_style_border(style, state_flags, &border); |
|
719 |
xthickness = border.left; |
|
720 |
ythickness = border.top; |
|
721 |
||
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
722 |
@@ -1697,7 +1888,7 @@ moz_gtk_combo_box_paint(cairo_t *cr, Gdk |
907 | 723 |
if (direction == GTK_TEXT_DIR_LTR) { |
724 |
GtkBorder padding; |
|
725 |
GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state); |
|
726 |
- gtk_style_context_get_padding(style, state_flags, &padding); |
|
727 |
+ moz_gtk_get_style_padding(style, state_flags, &padding); |
|
728 |
arrow_rect.x -= padding.left; |
|
729 |
} |
|
730 |
else |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
731 |
@@ -1799,29 +1990,27 @@ moz_gtk_container_paint(cairo_t *cr, Gdk |
907 | 732 |
gboolean isradio, GtkTextDirection direction) |
733 |
{ |
|
734 |
GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state); |
|
735 |
- GtkStyleContext* style; |
|
736 |
- GtkWidget *widget; |
|
737 |
+ MozGtkWidget *widget; |
|
738 |
||
739 |
if (isradio) { |
|
740 |
ensure_radiobutton_widget(); |
|
741 |
- widget = gRadiobuttonWidget; |
|
742 |
+ widget = &gRadiobutton; |
|
743 |
} else { |
|
744 |
ensure_checkbox_widget(); |
|
745 |
- widget = gCheckboxWidget; |
|
746 |
+ widget = &gCheckbox; |
|
747 |
} |
|
748 |
- gtk_widget_set_direction(widget, direction); |
|
749 |
+ gtk_widget_set_direction(widget->widget, direction); |
|
750 |
||
751 |
- style = gtk_widget_get_style_context(widget); |
|
752 |
- gtk_style_context_save(style); |
|
753 |
- gtk_style_context_set_state(style, state_flags); |
|
754 |
+ gtk_style_context_save(widget->check.style); |
|
755 |
+ gtk_style_context_set_state(widget->check.style, state_flags); |
|
756 |
||
757 |
/* this is for drawing a prelight box */ |
|
758 |
if (state_flags & GTK_STATE_FLAG_PRELIGHT) { |
|
759 |
- gtk_render_background(style, cr, |
|
760 |
+ gtk_render_background(widget->check.style, cr, |
|
761 |
rect->x, rect->y, rect->width, rect->height); |
|
762 |
} |
|
763 |
||
764 |
- gtk_style_context_restore(style); |
|
765 |
+ gtk_style_context_restore(widget->check.style); |
|
766 |
||
767 |
return MOZ_GTK_SUCCESS; |
|
768 |
} |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
769 |
@@ -1831,32 +2020,26 @@ moz_gtk_toggle_label_paint(cairo_t *cr, |
907 | 770 |
GtkWidgetState* state, |
771 |
gboolean isradio, GtkTextDirection direction) |
|
772 |
{ |
|
773 |
- GtkStyleContext *style; |
|
774 |
- GtkWidget *widget; |
|
775 |
+ MozGtkWidget *widget; |
|
776 |
||
777 |
if (!state->focused) |
|
778 |
return MOZ_GTK_SUCCESS; |
|
779 |
||
780 |
if (isradio) { |
|
781 |
ensure_radiobutton_widget(); |
|
782 |
- widget = gRadiobuttonWidget; |
|
783 |
+ widget = &gRadiobutton; |
|
784 |
} else { |
|
785 |
ensure_checkbox_widget(); |
|
786 |
- widget = gCheckboxWidget; |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
787 |
+ widget = &gCheckbox; |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
788 |
} |
907 | 789 |
- style = gtk_widget_get_style_context(widget); |
790 |
- gtk_style_context_save(style); |
|
791 |
- if (isradio) { |
|
792 |
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_RADIO); |
|
793 |
- } else { |
|
794 |
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_CHECK); |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
795 |
- } |
907 | 796 |
- gtk_widget_set_direction(widget, direction); |
797 |
+ gtk_style_context_save(widget->check.styleLabel); |
|
798 |
+ gtk_widget_set_direction(widget->widget, direction); |
|
799 |
||
800 |
- gtk_style_context_set_state(style, GetStateFlagsFromGtkWidgetState(state)); |
|
801 |
- gtk_render_focus(style, cr, |
|
802 |
+ gtk_style_context_set_state(widget->check.styleLabel, |
|
803 |
+ GetStateFlagsFromGtkWidgetState(state)); |
|
804 |
+ gtk_render_focus(widget->check.styleLabel, cr, |
|
805 |
rect->x, rect->y, rect->width, rect->height); |
|
806 |
- gtk_style_context_restore(style); |
|
807 |
+ gtk_style_context_restore(widget->check.styleLabel); |
|
808 |
||
809 |
return MOZ_GTK_SUCCESS; |
|
810 |
} |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
811 |
@@ -1917,7 +2100,7 @@ moz_gtk_toolbar_separator_paint(cairo_t |
907 | 812 |
rect->height * (end_fraction - start_fraction)); |
813 |
} else { |
|
814 |
GtkBorder padding; |
|
815 |
- gtk_style_context_get_padding(style, 0, &padding); |
|
816 |
+ gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding); |
|
817 |
||
818 |
paint_width = padding.left; |
|
819 |
if (paint_width > rect->width) |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
820 |
@@ -2004,18 +2187,13 @@ static gint |
907 | 821 |
moz_gtk_progressbar_paint(cairo_t *cr, GdkRectangle* rect, |
822 |
GtkTextDirection direction) |
|
823 |
{ |
|
824 |
- GtkStyleContext* style; |
|
825 |
- |
|
826 |
ensure_progress_widget(); |
|
827 |
- gtk_widget_set_direction(gProgressWidget, direction); |
|
828 |
+ gtk_widget_set_direction(gProgressBar.widget, direction); |
|
829 |
||
830 |
- style = gtk_widget_get_style_context(gProgressWidget); |
|
831 |
- gtk_style_context_save(style); |
|
832 |
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_TROUGH); |
|
833 |
- |
|
834 |
- gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height); |
|
835 |
- gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height); |
|
836 |
- gtk_style_context_restore(style); |
|
837 |
+ gtk_render_background(gProgressBar.progress.styleTrough, cr, |
|
838 |
+ rect->x, rect->y, rect->width, rect->height); |
|
839 |
+ gtk_render_frame(gProgressBar.progress.styleTrough, cr, |
|
840 |
+ rect->x, rect->y, rect->width, rect->height); |
|
841 |
||
842 |
return MOZ_GTK_SUCCESS; |
|
843 |
} |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
844 |
@@ -2025,15 +2203,8 @@ moz_gtk_progress_chunk_paint(cairo_t *cr |
907 | 845 |
GtkTextDirection direction, |
846 |
GtkThemeWidgetType widget) |
|
847 |
{ |
|
848 |
- GtkStyleContext* style; |
|
849 |
- |
|
850 |
ensure_progress_widget(); |
|
851 |
- gtk_widget_set_direction(gProgressWidget, direction); |
|
852 |
- |
|
853 |
- style = gtk_widget_get_style_context(gProgressWidget); |
|
854 |
- gtk_style_context_save(style); |
|
855 |
- gtk_style_context_remove_class(style, GTK_STYLE_CLASS_TROUGH); |
|
856 |
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_PROGRESSBAR); |
|
857 |
+ gtk_widget_set_direction(gProgressBar.widget, direction); |
|
858 |
||
859 |
if (widget == MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE || |
|
860 |
widget == MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE) { |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
861 |
@@ -2072,12 +2243,14 @@ moz_gtk_progress_chunk_paint(cairo_t *cr |
907 | 862 |
// gtk_render_activity was used to render progress chunks on GTK versions |
863 |
// before 3.13.7, see bug 1173907. |
|
864 |
if (!gtk_check_version(3, 13, 7)) { |
|
865 |
- gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height); |
|
866 |
- gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height); |
|
867 |
+ gtk_render_background(gProgressBar.progress.styleProgress, cr, |
|
868 |
+ rect->x, rect->y, rect->width, rect->height); |
|
869 |
+ gtk_render_frame(gProgressBar.progress.styleProgress, cr, |
|
870 |
+ rect->x, rect->y, rect->width, rect->height); |
|
871 |
} else { |
|
872 |
- gtk_render_activity(style, cr, rect->x, rect->y, rect->width, rect->height); |
|
873 |
+ gtk_render_activity(gProgressBar.progress.styleProgress, cr, |
|
874 |
+ rect->x, rect->y, rect->width, rect->height); |
|
875 |
} |
|
876 |
- gtk_style_context_restore(style); |
|
877 |
||
878 |
return MOZ_GTK_SUCCESS; |
|
879 |
} |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
880 |
@@ -2094,7 +2267,7 @@ moz_gtk_get_tab_thickness(void) |
907 | 881 |
|
882 |
style = gtk_widget_get_style_context(gTabWidget); |
|
883 |
gtk_style_context_add_class(style, GTK_STYLE_CLASS_NOTEBOOK); |
|
884 |
- gtk_style_context_get_border(style, 0, &border); |
|
885 |
+ gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border); |
|
886 |
||
887 |
if (border.top < 2) |
|
888 |
return 2; /* some themes don't set ythickness correctly */ |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
889 |
@@ -2290,7 +2463,7 @@ moz_gtk_tab_paint(cairo_t *cr, GdkRectan |
907 | 890 |
gtk_style_context_save(style); |
891 |
moz_gtk_tab_prepare_style_context(style, flags); |
|
892 |
||
893 |
- gtk_style_context_get_padding(style, GetStateFlagsFromGtkWidgetState(state), &padding); |
|
894 |
+ moz_gtk_get_style_padding(style, GetStateFlagsFromGtkWidgetState(state), &padding); |
|
895 |
||
896 |
focusRect.x += padding.left; |
|
897 |
focusRect.width -= (padding.left + padding.right); |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
898 |
@@ -2406,7 +2579,7 @@ moz_gtk_tab_scroll_arrow_paint(cairo_t * |
907 | 899 |
} |
900 |
||
901 |
static gint |
|
902 |
-moz_gtk_menu_bar_paint(cairo_t *cr, GdkRectangle* rect, |
|
903 |
+moz_gtk_menu_bar_paint(cairo_t *cr, GdkRectangle* rect, GtkWidgetState* state, |
|
904 |
GtkTextDirection direction) |
|
905 |
{ |
|
906 |
GtkStyleContext* style; |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
907 |
@@ -2467,7 +2640,7 @@ moz_gtk_menu_separator_paint(cairo_t *cr |
907 | 908 |
border_width = gtk_container_get_border_width(GTK_CONTAINER(gMenuSeparatorWidget)); |
909 |
||
910 |
style = gtk_widget_get_style_context(gMenuSeparatorWidget); |
|
911 |
- gtk_style_context_get_padding(style, 0, &padding); |
|
912 |
+ gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding); |
|
913 |
||
914 |
x = rect->x + border_width; |
|
915 |
y = rect->y + border_width; |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
916 |
@@ -2521,7 +2694,8 @@ moz_gtk_menu_item_paint(cairo_t *cr, Gdk |
907 | 917 |
item_widget = gMenuItemWidget; |
918 |
} |
|
919 |
style = gtk_widget_get_style_context(item_widget); |
|
920 |
- gtk_style_context_save(style); |
|
921 |
+// TODO - FIX! |
|
922 |
+// gtk_style_context_save(style); |
|
923 |
||
924 |
if (flags & MOZ_TOPLEVEL_MENU_ITEM) { |
|
925 |
gtk_style_context_add_class(style, GTK_STYLE_CLASS_MENUBAR); |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
926 |
@@ -2540,7 +2714,7 @@ moz_gtk_menu_item_paint(cairo_t *cr, Gdk |
907 | 927 |
|
928 |
gtk_render_background(style, cr, x, y, w, h); |
|
929 |
gtk_render_frame(style, cr, x, y, w, h); |
|
930 |
- gtk_style_context_restore(style); |
|
931 |
+// gtk_style_context_restore(style); |
|
932 |
} |
|
933 |
||
934 |
return MOZ_GTK_SUCCESS; |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
935 |
@@ -2556,7 +2730,10 @@ moz_gtk_menu_arrow_paint(cairo_t *cr, Gd |
907 | 936 |
|
937 |
ensure_menu_item_widget(); |
|
938 |
gtk_widget_set_direction(gMenuItemWidget, direction); |
|
939 |
- |
|
940 |
+/* |
|
941 |
+ state_flags |= (direction == GTK_TEXT_DIR_LTR) ? GTK_STATE_FLAG_DIR_LTR : |
|
942 |
+ GTK_STATE_FLAG_DIR_RTL; |
|
943 |
+*/ |
|
944 |
style = gtk_widget_get_style_context(gMenuItemWidget); |
|
945 |
gtk_style_context_save(style); |
|
946 |
gtk_style_context_add_class(style, GTK_STYLE_CLASS_MENUITEM); |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
947 |
@@ -2606,7 +2783,7 @@ moz_gtk_check_menu_item_paint(cairo_t *c |
907 | 948 |
} |
949 |
||
950 |
gtk_style_context_set_state(style, state_flags); |
|
951 |
- gtk_style_context_get_padding(style, state_flags, &padding); |
|
952 |
+ moz_gtk_get_style_padding(style, state_flags, &padding); |
|
953 |
||
954 |
offset = gtk_container_get_border_width(GTK_CONTAINER(gCheckMenuItemWidget)) + |
|
955 |
padding.left + 2; |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
956 |
@@ -2658,7 +2835,7 @@ moz_gtk_add_style_border(GtkStyleContext |
907 | 957 |
{ |
958 |
GtkBorder border; |
|
959 |
||
960 |
- gtk_style_context_get_border(style, 0, &border); |
|
961 |
+ gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border); |
|
962 |
||
963 |
*left += border.left; |
|
964 |
*right += border.right; |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
965 |
@@ -2667,12 +2844,22 @@ moz_gtk_add_style_border(GtkStyleContext |
907 | 966 |
} |
967 |
||
968 |
static void |
|
969 |
+moz_gtk_get_style_border(GtkStyleContext* style, GtkStateFlags state_flags, |
|
970 |
+ GtkBorder *border) |
|
971 |
+{ |
|
972 |
+ gtk_style_context_save(style); |
|
973 |
+ gtk_style_context_set_state(style, state_flags); |
|
974 |
+ gtk_style_context_get_border(style, gtk_style_context_get_state(style), border); |
|
975 |
+ gtk_style_context_restore(style); |
|
976 |
+} |
|
977 |
+ |
|
978 |
+static void |
|
979 |
moz_gtk_add_style_padding(GtkStyleContext* style, |
|
980 |
gint* left, gint* top, gint* right, gint* bottom) |
|
981 |
{ |
|
982 |
GtkBorder padding; |
|
983 |
||
984 |
- gtk_style_context_get_padding(style, 0, &padding); |
|
985 |
+ gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding); |
|
986 |
||
987 |
*left += padding.left; |
|
988 |
*right += padding.right; |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
989 |
@@ -2680,6 +2867,16 @@ moz_gtk_add_style_padding(GtkStyleContex |
907 | 990 |
*bottom += padding.bottom; |
991 |
} |
|
992 |
||
993 |
+static void |
|
994 |
+moz_gtk_get_style_padding(GtkStyleContext* style, GtkStateFlags state_flags, |
|
995 |
+ GtkBorder *padding) |
|
996 |
+{ |
|
997 |
+ gtk_style_context_save(style); |
|
998 |
+ gtk_style_context_set_state(style, state_flags); |
|
999 |
+ gtk_style_context_get_padding(style, gtk_style_context_get_state(style), padding); |
|
1000 |
+ gtk_style_context_restore(style); |
|
1001 |
+} |
|
1002 |
+ |
|
1003 |
gint |
|
1004 |
moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top, |
|
1005 |
gint* right, gint* bottom, GtkTextDirection direction, |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1006 |
@@ -2694,36 +2891,27 @@ moz_gtk_get_widget_border(GtkThemeWidget |
907 | 1007 |
case MOZ_GTK_TOOLBAR_BUTTON: |
1008 |
{ |
|
1009 |
ensure_button_widget(); |
|
1010 |
- style = gtk_widget_get_style_context(gButtonWidget); |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1011 |
- |
907 | 1012 |
- *left = *top = *right = *bottom = gtk_container_get_border_width(GTK_CONTAINER(gButtonWidget)); |
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1013 |
|
907 | 1014 |
- if (widget == MOZ_GTK_TOOLBAR_BUTTON) { |
1015 |
- gtk_style_context_save(style); |
|
1016 |
- gtk_style_context_add_class(style, "image-button"); |
|
1017 |
- } |
|
1018 |
- |
|
1019 |
- moz_gtk_add_style_padding(style, left, top, right, bottom); |
|
1020 |
- |
|
1021 |
- if (widget == MOZ_GTK_TOOLBAR_BUTTON) |
|
1022 |
- gtk_style_context_restore(style); |
|
1023 |
+ *left = *top = *right = *bottom = gtk_container_get_border_width(GTK_CONTAINER(gButton.widget)); |
|
1024 |
+ moz_gtk_add_style_padding(gButton.button.style, left, top, right, bottom); |
|
1025 |
||
1026 |
// XXX: Subtract 1 pixel from the border to account for the added |
|
1027 |
// -moz-focus-inner border (Bug 1228281). |
|
1028 |
*left -= 1; *top -= 1; *right -= 1; *bottom -= 1; |
|
1029 |
- moz_gtk_add_style_border(style, left, top, right, bottom); |
|
1030 |
+ moz_gtk_add_style_border(gButton.button.style, left, top, right, bottom); |
|
1031 |
+ |
|
1032 |
return MOZ_GTK_SUCCESS; |
|
1033 |
} |
|
1034 |
case MOZ_GTK_ENTRY: |
|
1035 |
{ |
|
1036 |
ensure_entry_widget(); |
|
1037 |
- style = gtk_widget_get_style_context(gEntryWidget); |
|
1038 |
||
1039 |
// XXX: Subtract 1 pixel from the padding to account for the default |
|
1040 |
// padding in forms.css. See bug 1187385. |
|
1041 |
*left = *top = *right = *bottom = -1; |
|
1042 |
- moz_gtk_add_style_padding(style, left, top, right, bottom); |
|
1043 |
- moz_gtk_add_style_border(style, left, top, right, bottom); |
|
1044 |
+ |
|
1045 |
+ moz_gtk_add_style_padding(gEntry.entry.style, left, top, right, bottom); |
|
1046 |
+ moz_gtk_add_style_border(gEntry.entry.style, left, top, right, bottom); |
|
1047 |
||
1048 |
return MOZ_GTK_SUCCESS; |
|
1049 |
} |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1050 |
@@ -2759,7 +2947,7 @@ moz_gtk_get_widget_border(GtkThemeWidget |
907 | 1051 |
break; |
1052 |
case MOZ_GTK_DROPDOWN_ENTRY: |
|
1053 |
ensure_combo_box_entry_widgets(); |
|
1054 |
- w = gComboBoxEntryTextareaWidget; |
|
1055 |
+ w = gComboBoxEntryTextarea.widget; |
|
1056 |
break; |
|
1057 |
case MOZ_GTK_DROPDOWN_ARROW: |
|
1058 |
ensure_combo_box_entry_widgets(); |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1059 |
@@ -2795,7 +2983,7 @@ moz_gtk_get_widget_border(GtkThemeWidget |
907 | 1060 |
|
1061 |
if (!wide_separators) { |
|
1062 |
style = gtk_widget_get_style_context(gComboBoxSeparatorWidget); |
|
1063 |
- gtk_style_context_get_border(style, 0, &border); |
|
1064 |
+ gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border); |
|
1065 |
separator_width = border.left; |
|
1066 |
} |
|
1067 |
} |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1068 |
@@ -2814,14 +3002,17 @@ moz_gtk_get_widget_border(GtkThemeWidget |
907 | 1069 |
w = gTabWidget; |
1070 |
break; |
|
1071 |
case MOZ_GTK_PROGRESSBAR: |
|
1072 |
- ensure_progress_widget(); |
|
1073 |
- w = gProgressWidget; |
|
1074 |
- break; |
|
1075 |
+ { |
|
1076 |
+ ensure_progress_widget(); |
|
1077 |
+ moz_gtk_add_style_border(gProgressBar.progress.styleTrough, |
|
1078 |
+ left, top, right, bottom); |
|
1079 |
+ return MOZ_GTK_SUCCESS; |
|
1080 |
+ } |
|
1081 |
case MOZ_GTK_SPINBUTTON_ENTRY: |
|
1082 |
case MOZ_GTK_SPINBUTTON_UP: |
|
1083 |
case MOZ_GTK_SPINBUTTON_DOWN: |
|
1084 |
ensure_spin_widget(); |
|
1085 |
- w = gSpinWidget; |
|
1086 |
+ w = gSpin.widget; |
|
1087 |
break; |
|
1088 |
case MOZ_GTK_SCALE_HORIZONTAL: |
|
1089 |
ensure_scale_widget(); |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1090 |
@@ -2840,12 +3031,13 @@ moz_gtk_get_widget_border(GtkThemeWidget |
907 | 1091 |
{ |
1092 |
if (widget == MOZ_GTK_CHECKBUTTON_CONTAINER) { |
|
1093 |
ensure_checkbox_widget(); |
|
1094 |
- w = gCheckboxWidget; |
|
1095 |
+ w = gCheckbox.widget; |
|
1096 |
+ style = gCheckbox.check.styleCheck; |
|
1097 |
} else { |
|
1098 |
ensure_radiobutton_widget(); |
|
1099 |
- w = gRadiobuttonWidget; |
|
1100 |
+ w = gRadiobutton.widget; |
|
1101 |
+ style = gRadiobutton.check.styleCheck; |
|
1102 |
} |
|
1103 |
- style = gtk_widget_get_style_context(w); |
|
1104 |
||
1105 |
*left = *top = *right = *bottom = gtk_container_get_border_width(GTK_CONTAINER(w)); |
|
1106 |
moz_gtk_add_style_border(style, |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1107 |
@@ -2978,6 +3170,32 @@ moz_gtk_get_combo_box_entry_button_size( |
907 | 1108 |
} |
1109 |
||
1110 |
gint |
|
1111 |
+moz_gtk_get_entry_height(gint* height) |
|
1112 |
+{ |
|
1113 |
+ GtkRequisition requisition; |
|
1114 |
+ ensure_entry_widget(); |
|
1115 |
+ |
|
1116 |
+ gtk_widget_get_preferred_size(gEntry.widget, NULL, &requisition); |
|
1117 |
+ *height = requisition.height; |
|
1118 |
+ |
|
1119 |
+ return MOZ_GTK_SUCCESS; |
|
1120 |
+} |
|
1121 |
+ |
|
1122 |
+ |
|
1123 |
+gint |
|
1124 |
+moz_gtk_get_button_height(gint* height) |
|
1125 |
+{ |
|
1126 |
+ GtkRequisition requisition; |
|
1127 |
+ ensure_entry_widget(); |
|
1128 |
+ |
|
1129 |
+ gtk_widget_get_preferred_size(gButton.widget, NULL, &requisition); |
|
1130 |
+ *height = requisition.height; |
|
1131 |
+ |
|
1132 |
+ return MOZ_GTK_SUCCESS; |
|
1133 |
+} |
|
1134 |
+ |
|
1135 |
+ |
|
1136 |
+gint |
|
1137 |
moz_gtk_get_tab_scroll_arrow_size(gint* width, gint* height) |
|
1138 |
{ |
|
1139 |
gint arrow_size; |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1140 |
@@ -3022,7 +3240,7 @@ moz_gtk_get_toolbar_separator_width(gint |
907 | 1141 |
"separator-width", &separator_width, |
1142 |
NULL); |
|
1143 |
/* Just in case... */ |
|
1144 |
- gtk_style_context_get_border(style, 0, &border); |
|
1145 |
+ gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border); |
|
1146 |
*size = MAX(*size, (wide_separators ? separator_width : border.left)); |
|
1147 |
return MOZ_GTK_SUCCESS; |
|
1148 |
} |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1149 |
@@ -3064,7 +3282,7 @@ moz_gtk_get_menu_separator_height(gint * |
907 | 1150 |
border_width = gtk_container_get_border_width(GTK_CONTAINER(gMenuSeparatorWidget)); |
1151 |
||
1152 |
style = gtk_widget_get_style_context(gMenuSeparatorWidget); |
|
1153 |
- gtk_style_context_get_padding(style, 0, &padding); |
|
1154 |
+ gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding); |
|
1155 |
||
1156 |
gtk_style_context_save(style); |
|
1157 |
gtk_style_context_add_class(style, GTK_STYLE_CLASS_SEPARATOR); |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1158 |
@@ -3122,15 +3340,21 @@ moz_gtk_get_scrollbar_metrics(MozGtkScro |
907 | 1159 |
{ |
1160 |
ensure_scrollbar_widget(); |
|
1161 |
||
1162 |
- gtk_widget_style_get (gHorizScrollbarWidget, |
|
1163 |
+ gtk_widget_style_get (gHorizScrollbar.widget, |
|
1164 |
"slider_width", &metrics->slider_width, |
|
1165 |
"trough_border", &metrics->trough_border, |
|
1166 |
"stepper_size", &metrics->stepper_size, |
|
1167 |
"stepper_spacing", &metrics->stepper_spacing, |
|
1168 |
NULL); |
|
1169 |
||
1170 |
- metrics->min_slider_size = |
|
1171 |
- gtk_range_get_min_slider_size(GTK_RANGE(gHorizScrollbarWidget)); |
|
1172 |
+ if (!gtk_check_version(3,19,7)) { |
|
1173 |
+ gtk_style_context_get(gVertScrollbar.scroll.styleSlider, |
|
1174 |
+ gtk_style_context_get_state(gVertScrollbar.scroll.styleSlider), |
|
1175 |
+ "min-height", &metrics->min_slider_size, NULL); |
|
1176 |
+ } else { |
|
1177 |
+ metrics->min_slider_size = |
|
1178 |
+ gtk_range_get_min_slider_size(GTK_RANGE(gVertScrollbar.widget)); |
|
1179 |
+ } |
|
1180 |
||
1181 |
return MOZ_GTK_SUCCESS; |
|
1182 |
} |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1183 |
@@ -3155,7 +3379,7 @@ moz_gtk_images_in_buttons() |
907 | 1184 |
GtkSettings* settings; |
1185 |
||
1186 |
ensure_button_widget(); |
|
1187 |
- settings = gtk_widget_get_settings(gButtonWidget); |
|
1188 |
+ settings = gtk_widget_get_settings(gButton.widget); |
|
1189 |
||
1190 |
g_object_get(settings, "gtk-button-images", &result, NULL); |
|
1191 |
return result; |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1192 |
@@ -3183,7 +3407,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType |
907 | 1193 |
} |
1194 |
ensure_button_widget(); |
|
1195 |
return moz_gtk_button_paint(cr, rect, state, |
|
1196 |
- (GtkReliefStyle) flags, gButtonWidget, |
|
1197 |
+ (GtkReliefStyle) flags, gButton.widget, |
|
1198 |
direction); |
|
1199 |
break; |
|
1200 |
case MOZ_GTK_CHECKBUTTON: |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1201 |
@@ -3233,7 +3457,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType |
907 | 1202 |
case MOZ_GTK_SPINBUTTON_ENTRY: |
1203 |
ensure_spin_widget(); |
|
1204 |
return moz_gtk_entry_paint(cr, rect, state, |
|
1205 |
- gSpinWidget, direction); |
|
1206 |
+ &gSpin, direction); |
|
1207 |
break; |
|
1208 |
case MOZ_GTK_GRIPPER: |
|
1209 |
return moz_gtk_gripper_paint(cr, rect, state, |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1210 |
@@ -3260,7 +3484,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType |
907 | 1211 |
case MOZ_GTK_ENTRY: |
1212 |
ensure_entry_widget(); |
|
1213 |
return moz_gtk_entry_paint(cr, rect, state, |
|
1214 |
- gEntryWidget, direction); |
|
1215 |
+ &gEntry, direction); |
|
1216 |
break; |
|
1217 |
case MOZ_GTK_DROPDOWN: |
|
1218 |
return moz_gtk_combo_box_paint(cr, rect, state, direction); |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1219 |
@@ -3272,7 +3496,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType |
907 | 1220 |
case MOZ_GTK_DROPDOWN_ENTRY: |
1221 |
ensure_combo_box_entry_widgets(); |
|
1222 |
return moz_gtk_entry_paint(cr, rect, state, |
|
1223 |
- gComboBoxEntryTextareaWidget, direction); |
|
1224 |
+ &gComboBoxEntryTextarea, direction); |
|
1225 |
break; |
|
1226 |
case MOZ_GTK_CHECKBUTTON_CONTAINER: |
|
1227 |
case MOZ_GTK_RADIOBUTTON_CONTAINER: |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1228 |
@@ -3324,7 +3548,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType |
907 | 1229 |
(GtkArrowType) flags, direction); |
1230 |
break; |
|
1231 |
case MOZ_GTK_MENUBAR: |
|
1232 |
- return moz_gtk_menu_bar_paint(cr, rect, direction); |
|
1233 |
+ return moz_gtk_menu_bar_paint(cr, rect, state, direction); |
|
1234 |
break; |
|
1235 |
case MOZ_GTK_MENUPOPUP: |
|
1236 |
return moz_gtk_menu_popup_paint(cr, rect, direction); |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1237 |
@@ -3375,7 +3599,7 @@ GtkWidget* moz_gtk_get_scrollbar_widget( |
907 | 1238 |
{ |
1239 |
MOZ_ASSERT(is_initialized, "Forgot to call moz_gtk_init()"); |
|
1240 |
ensure_scrollbar_widget(); |
|
1241 |
- return gHorizScrollbarWidget; |
|
1242 |
+ return gVertScrollbar.widget; |
|
1243 |
} |
|
1244 |
||
1245 |
gboolean moz_gtk_has_scrollbar_buttons(void) |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1246 |
@@ -3383,7 +3607,7 @@ gboolean moz_gtk_has_scrollbar_buttons(v |
907 | 1247 |
gboolean backward, forward, secondary_backward, secondary_forward; |
1248 |
MOZ_ASSERT(is_initialized, "Forgot to call moz_gtk_init()"); |
|
1249 |
ensure_scrollbar_widget(); |
|
1250 |
- gtk_widget_style_get (gHorizScrollbarWidget, |
|
1251 |
+ gtk_widget_style_get (gHorizScrollbar.widget, |
|
1252 |
"has-backward-stepper", &backward, |
|
1253 |
"has-forward-stepper", &forward, |
|
1254 |
"has-secondary-backward-stepper", &secondary_backward, |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1255 |
@@ -3409,17 +3633,19 @@ moz_gtk_shutdown() |
907 | 1256 |
|
1257 |
gProtoWindow = NULL; |
|
1258 |
gProtoLayout = NULL; |
|
1259 |
- gButtonWidget = NULL; |
|
1260 |
+ |
|
1261 |
+ // MozWidgets |
|
1262 |
+ moz_gtk_widget_free(&gButton); |
|
1263 |
gToggleButtonWidget = NULL; |
|
1264 |
gButtonArrowWidget = NULL; |
|
1265 |
- gCheckboxWidget = NULL; |
|
1266 |
- gRadiobuttonWidget = NULL; |
|
1267 |
- gHorizScrollbarWidget = NULL; |
|
1268 |
- gVertScrollbarWidget = NULL; |
|
1269 |
- gSpinWidget = NULL; |
|
1270 |
+ moz_gtk_widget_free(&gCheckbox); |
|
1271 |
+ moz_gtk_widget_free(&gRadiobutton); |
|
1272 |
+ moz_gtk_widget_free(&gHorizScrollbar); |
|
1273 |
+ moz_gtk_widget_free(&gVertScrollbar); |
|
1274 |
+ moz_gtk_widget_free(&gSpin); |
|
1275 |
gHScaleWidget = NULL; |
|
1276 |
gVScaleWidget = NULL; |
|
1277 |
- gEntryWidget = NULL; |
|
1278 |
+ moz_gtk_widget_free(&gEntry); |
|
1279 |
gComboBoxWidget = NULL; |
|
1280 |
gComboBoxButtonWidget = NULL; |
|
1281 |
gComboBoxSeparatorWidget = NULL; |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1282 |
@@ -3427,12 +3653,12 @@ moz_gtk_shutdown() |
907 | 1283 |
gComboBoxEntryWidget = NULL; |
1284 |
gComboBoxEntryButtonWidget = NULL; |
|
1285 |
gComboBoxEntryArrowWidget = NULL; |
|
1286 |
- gComboBoxEntryTextareaWidget = NULL; |
|
1287 |
+ moz_gtk_widget_free(&gComboBoxEntryTextarea); |
|
1288 |
gHandleBoxWidget = NULL; |
|
1289 |
gToolbarWidget = NULL; |
|
1290 |
gStatusbarWidget = NULL; |
|
1291 |
gFrameWidget = NULL; |
|
1292 |
- gProgressWidget = NULL; |
|
1293 |
+ moz_gtk_widget_free(&gProgressBar); |
|
1294 |
gTabWidget = NULL; |
|
1295 |
gTooltipWidget = NULL; |
|
1296 |
gMenuBarWidget = NULL; |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1297 |
diff -up firefox-45.0.2/widget/gtk/gtkdrawing.h.gtk3-20 firefox-45.0.2/widget/gtk/gtkdrawing.h |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1298 |
--- firefox-45.0.2/widget/gtk/gtkdrawing.h.gtk3-20 2016-04-08 01:55:04.000000000 +0200 |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1299 |
+++ firefox-45.0.2/widget/gtk/gtkdrawing.h 2016-04-20 15:00:29.468048948 +0200 |
907 | 1300 |
@@ -67,6 +67,13 @@ typedef enum { |
1301 |
MOZ_GTK_TAB_SELECTED = 1 << 10 |
|
1302 |
} GtkTabFlags; |
|
1303 |
||
1304 |
+typedef struct { |
|
1305 |
+ GType type; |
|
1306 |
+ const gchar *name; |
|
1307 |
+ const gchar *class1; |
|
1308 |
+ const gchar *class2; |
|
1309 |
+} GtkCssNode; |
|
1310 |
+ |
|
1311 |
/** flags for menuitems **/ |
|
1312 |
typedef enum { |
|
1313 |
/* menuitem is part of the menubar */ |
|
1314 |
@@ -394,6 +401,10 @@ gint moz_gtk_get_tab_scroll_arrow_size(g |
|
1315 |
*/ |
|
1316 |
gint moz_gtk_get_arrow_size(gint* width, gint* height); |
|
1317 |
||
1318 |
+gint moz_gtk_get_entry_height(gint* height); |
|
1319 |
+ |
|
1320 |
+gint moz_gtk_get_button_height(gint* height); |
|
1321 |
+ |
|
1322 |
/** |
|
1323 |
* Get the desired size of a toolbar separator |
|
1324 |
* size: [OUT] the desired width |
|
1325 |
@@ -464,6 +475,12 @@ gboolean moz_gtk_images_in_buttons(void) |
|
1326 |
*/ |
|
1327 |
gboolean moz_gtk_has_scrollbar_buttons(void); |
|
1328 |
||
1329 |
+ |
|
1330 |
+GtkStyleContext * |
|
1331 |
+moz_gtk_style_create(GtkCssNode *node, GtkStyleContext *parent); |
|
1332 |
+ |
|
1333 |
+ |
|
1334 |
+ |
|
1335 |
#ifdef __cplusplus |
|
1336 |
} |
|
1337 |
#endif /* __cplusplus */ |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1338 |
diff -up firefox-45.0.2/widget/gtk/mozgtk/mozgtk.c.gtk3-20 firefox-45.0.2/widget/gtk/mozgtk/mozgtk.c |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1339 |
--- firefox-45.0.2/widget/gtk/mozgtk/mozgtk.c.gtk3-20 2016-04-20 15:00:29.443048846 +0200 |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1340 |
+++ firefox-45.0.2/widget/gtk/mozgtk/mozgtk.c 2016-04-20 15:00:29.469048952 +0200 |
907 | 1341 |
@@ -503,6 +503,11 @@ STUB(gtk_window_set_type_hint) |
1342 |
STUB(gtk_window_set_wmclass) |
|
1343 |
STUB(gtk_window_unfullscreen) |
|
1344 |
STUB(gtk_window_unmaximize) |
|
1345 |
+STUB(gtk_widget_get_preferred_height_and_baseline_for_width) |
|
1346 |
+STUB(gtk_entry_get_text_area) |
|
1347 |
+STUB(gtk_check_menu_item_get_type) |
|
1348 |
+STUB(gtk_spin_button_get_type) |
|
1349 |
+STUB(gtk_button_get_type) |
|
1350 |
#endif |
|
1351 |
||
1352 |
#ifdef GTK3_SYMBOLS |
|
1353 |
@@ -550,6 +555,7 @@ STUB(gtk_style_context_get_border_color) |
|
1354 |
STUB(gtk_style_context_get_color) |
|
1355 |
STUB(gtk_style_context_get_margin) |
|
1356 |
STUB(gtk_style_context_get_padding) |
|
1357 |
+STUB(gtk_style_context_get_state) |
|
1358 |
STUB(gtk_style_context_has_class) |
|
1359 |
STUB(gtk_style_context_new) |
|
1360 |
STUB(gtk_style_context_remove_class) |
|
1361 |
@@ -577,6 +583,13 @@ STUB(gtk_color_chooser_get_type) |
|
1362 |
STUB(gtk_color_chooser_set_rgba) |
|
1363 |
STUB(gtk_color_chooser_get_rgba) |
|
1364 |
STUB(gtk_color_chooser_set_use_alpha) |
|
1365 |
+STUB(gtk_style_context_get_path) |
|
1366 |
+STUB(gtk_widget_path_copy) |
|
1367 |
+STUB(gtk_widget_path_iter_set_object_name) |
|
1368 |
+STUB(gtk_widget_path_iter_add_class) |
|
1369 |
+STUB(gtk_widget_path_iter_get_state) |
|
1370 |
+STUB(gtk_style_context_set_parent) |
|
1371 |
+STUB(gtk_widget_path_unref) |
|
1372 |
#endif |
|
1373 |
||
1374 |
#ifdef GTK2_SYMBOLS |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1375 |
diff -up firefox-45.0.2/widget/gtk/nsLookAndFeel.cpp.gtk3-20 firefox-45.0.2/widget/gtk/nsLookAndFeel.cpp |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1376 |
--- firefox-45.0.2/widget/gtk/nsLookAndFeel.cpp.gtk3-20 2016-04-08 01:55:04.000000000 +0200 |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1377 |
+++ firefox-45.0.2/widget/gtk/nsLookAndFeel.cpp 2016-04-20 15:00:29.469048952 +0200 |
907 | 1378 |
@@ -232,14 +232,18 @@ nsLookAndFeel::NativeGetColor(ColorID aI |
1379 |
case eColorID_activeborder: |
|
1380 |
// active window border |
|
1381 |
gtk_style_context_get_border_color(mBackgroundStyle, |
|
1382 |
- GTK_STATE_FLAG_NORMAL, &gdk_color); |
|
1383 |
+ gtk_style_context_get_state(mBackgroundStyle), |
|
1384 |
+ &gdk_color); |
|
1385 |
aColor = GDK_RGBA_TO_NS_RGBA(gdk_color); |
|
1386 |
break; |
|
1387 |
case eColorID_inactiveborder: |
|
1388 |
// inactive window border |
|
1389 |
+ gtk_style_context_save(mBackgroundStyle); |
|
1390 |
+ gtk_style_context_set_state(mBackgroundStyle, GTK_STATE_FLAG_INSENSITIVE); |
|
1391 |
gtk_style_context_get_border_color(mBackgroundStyle, |
|
1392 |
- GTK_STATE_FLAG_INSENSITIVE, |
|
1393 |
+ gtk_style_context_get_state(mBackgroundStyle), |
|
1394 |
&gdk_color); |
|
1395 |
+ gtk_style_context_restore(mBackgroundStyle); |
|
1396 |
aColor = GDK_RGBA_TO_NS_RGBA(gdk_color); |
|
1397 |
break; |
|
1398 |
case eColorID_graytext: // disabled text in windows, menus, etc. |
|
1399 |
@@ -248,9 +252,12 @@ nsLookAndFeel::NativeGetColor(ColorID aI |
|
1400 |
break; |
|
1401 |
case eColorID_inactivecaption: |
|
1402 |
// inactive window caption |
|
1403 |
+ gtk_style_context_save(mBackgroundStyle); |
|
1404 |
+ gtk_style_context_set_state(mBackgroundStyle, GTK_STATE_FLAG_INSENSITIVE); |
|
1405 |
gtk_style_context_get_background_color(mBackgroundStyle, |
|
1406 |
- GTK_STATE_FLAG_INSENSITIVE, |
|
1407 |
+ gtk_style_context_get_state(mBackgroundStyle), |
|
1408 |
&gdk_color); |
|
1409 |
+ gtk_style_context_restore(mBackgroundStyle); |
|
1410 |
aColor = GDK_RGBA_TO_NS_RGBA(gdk_color); |
|
1411 |
break; |
|
1412 |
#endif |
|
1413 |
@@ -376,13 +383,17 @@ nsLookAndFeel::NativeGetColor(ColorID aI |
|
1414 |
case eColorID__moz_buttondefault: |
|
1415 |
// default button border color |
|
1416 |
gtk_style_context_get_border_color(mButtonStyle, |
|
1417 |
- GTK_STATE_FLAG_NORMAL, &gdk_color); |
|
1418 |
+ gtk_style_context_get_state(mButtonStyle), |
|
1419 |
+ &gdk_color); |
|
1420 |
aColor = GDK_RGBA_TO_NS_RGBA(gdk_color); |
|
1421 |
break; |
|
1422 |
case eColorID__moz_buttonhoverface: |
|
1423 |
+ gtk_style_context_save(mButtonStyle); |
|
1424 |
+ gtk_style_context_set_state(mButtonStyle, GTK_STATE_FLAG_PRELIGHT); |
|
1425 |
gtk_style_context_get_background_color(mButtonStyle, |
|
1426 |
- GTK_STATE_FLAG_PRELIGHT, |
|
1427 |
+ gtk_style_context_get_state(mButtonStyle), |
|
1428 |
&gdk_color); |
|
1429 |
+ gtk_style_context_restore(mButtonStyle); |
|
1430 |
aColor = GDK_RGBA_TO_NS_RGBA(gdk_color); |
|
1431 |
break; |
|
1432 |
case eColorID__moz_buttonhovertext: |
|
1433 |
@@ -989,7 +1000,7 @@ nsLookAndFeel::Init() |
|
1434 |
style = create_context(path); |
|
1435 |
gtk_style_context_add_class(style, GTK_STYLE_CLASS_SCROLLBAR); |
|
1436 |
gtk_style_context_add_class(style, GTK_STYLE_CLASS_TROUGH); |
|
1437 |
- gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color); |
|
1438 |
+ gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color); |
|
1439 |
sMozScrollbar = GDK_RGBA_TO_NS_RGBA(color); |
|
1440 |
g_object_unref(style); |
|
1441 |
||
1442 |
@@ -997,18 +1008,18 @@ nsLookAndFeel::Init() |
|
1443 |
style = create_context(path); |
|
1444 |
gtk_style_context_save(style); |
|
1445 |
gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND); |
|
1446 |
- gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color); |
|
1447 |
+ gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color); |
|
1448 |
sMozWindowBackground = GDK_RGBA_TO_NS_RGBA(color); |
|
1449 |
- gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color); |
|
1450 |
+ gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color); |
|
1451 |
sMozWindowText = GDK_RGBA_TO_NS_RGBA(color); |
|
1452 |
gtk_style_context_restore(style); |
|
1453 |
||
1454 |
// tooltip foreground and background |
|
1455 |
gtk_style_context_add_class(style, GTK_STYLE_CLASS_TOOLTIP); |
|
1456 |
gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND); |
|
1457 |
- gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color); |
|
1458 |
+ gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color); |
|
1459 |
sInfoBackground = GDK_RGBA_TO_NS_RGBA(color); |
|
1460 |
- gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color); |
|
1461 |
+ gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color); |
|
1462 |
sInfoText = GDK_RGBA_TO_NS_RGBA(color); |
|
1463 |
g_object_unref(style); |
|
1464 |
||
1465 |
@@ -1023,20 +1034,26 @@ nsLookAndFeel::Init() |
|
1466 |
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
|
1467 |
||
1468 |
style = gtk_widget_get_style_context(accel_label); |
|
1469 |
- gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color); |
|
1470 |
+ gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color); |
|
1471 |
sMenuText = GDK_RGBA_TO_NS_RGBA(color); |
|
1472 |
- gtk_style_context_get_color(style, GTK_STATE_FLAG_INSENSITIVE, &color); |
|
1473 |
+ gtk_style_context_save(style); |
|
1474 |
+ gtk_style_context_set_state(style, GTK_STATE_FLAG_INSENSITIVE); |
|
1475 |
+ gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color); |
|
1476 |
sMenuTextInactive = GDK_RGBA_TO_NS_RGBA(color); |
|
1477 |
+ gtk_style_context_restore(style); |
|
1478 |
||
1479 |
style = gtk_widget_get_style_context(menu); |
|
1480 |
- gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color); |
|
1481 |
+ gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color); |
|
1482 |
sMenuBackground = GDK_RGBA_TO_NS_RGBA(color); |
|
1483 |
||
1484 |
style = gtk_widget_get_style_context(menuitem); |
|
1485 |
- gtk_style_context_get_background_color(style, GTK_STATE_FLAG_PRELIGHT, &color); |
|
1486 |
+ gtk_style_context_save(style); |
|
1487 |
+ gtk_style_context_set_state(style, GTK_STATE_FLAG_PRELIGHT); |
|
1488 |
+ gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color); |
|
1489 |
sMenuHover = GDK_RGBA_TO_NS_RGBA(color); |
|
1490 |
- gtk_style_context_get_color(style, GTK_STATE_FLAG_PRELIGHT, &color); |
|
1491 |
+ gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color); |
|
1492 |
sMenuHoverText = GDK_RGBA_TO_NS_RGBA(color); |
|
1493 |
+ gtk_style_context_restore(style); |
|
1494 |
||
1495 |
g_object_unref(menu); |
|
1496 |
#endif |
|
1497 |
@@ -1145,44 +1162,54 @@ nsLookAndFeel::Init() |
|
1498 |
GDK_COLOR_TO_NS_RGB(style->dark[GTK_STATE_NORMAL]); |
|
1499 |
} |
|
1500 |
#else |
|
1501 |
+ GtkCssNode labelPath[] = { |
|
1502 |
+ { GTK_TYPE_LABEL, "label", "view", NULL }, |
|
1503 |
+ { G_TYPE_NONE, "selection", NULL, NULL } |
|
1504 |
+ }; |
|
1505 |
+ |
|
1506 |
+ GtkStyleContext *styleLabel; |
|
1507 |
+ GtkStyleContext *styleSelection; |
|
1508 |
+ GtkBorder padding; |
|
1509 |
+ |
|
1510 |
// Text colors |
|
1511 |
- style = gtk_widget_get_style_context(textView); |
|
1512 |
- gtk_style_context_save(style); |
|
1513 |
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_VIEW); |
|
1514 |
- gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color); |
|
1515 |
+ styleLabel = moz_gtk_style_create(labelPath, NULL); |
|
1516 |
+ styleSelection = moz_gtk_style_create(labelPath+1, styleLabel); |
|
1517 |
+ |
|
1518 |
+ gtk_style_context_get_background_color(styleLabel, gtk_style_context_get_state(styleLabel), &color); |
|
1519 |
sMozFieldBackground = GDK_RGBA_TO_NS_RGBA(color); |
|
1520 |
- gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color); |
|
1521 |
+ gtk_style_context_get_color(styleLabel, gtk_style_context_get_state(styleLabel), &color); |
|
1522 |
sMozFieldText = GDK_RGBA_TO_NS_RGBA(color); |
|
1523 |
||
1524 |
// Selected text and background |
|
1525 |
- gtk_style_context_get_background_color(style, |
|
1526 |
- static_cast<GtkStateFlags>(GTK_STATE_FLAG_FOCUSED|GTK_STATE_FLAG_SELECTED), |
|
1527 |
- &color); |
|
1528 |
+ gtk_style_context_get_background_color(styleSelection, gtk_style_context_get_state(styleSelection), &color); |
|
1529 |
sTextSelectedBackground = GDK_RGBA_TO_NS_RGBA(color); |
|
1530 |
- gtk_style_context_get_color(style, |
|
1531 |
- static_cast<GtkStateFlags>(GTK_STATE_FLAG_FOCUSED|GTK_STATE_FLAG_SELECTED), |
|
1532 |
- &color); |
|
1533 |
+ gtk_style_context_get_color(styleSelection, gtk_style_context_get_state(styleSelection), &color); |
|
1534 |
sTextSelectedText = GDK_RGBA_TO_NS_RGBA(color); |
|
1535 |
- gtk_style_context_restore(style); |
|
1536 |
||
1537 |
// Button text, background, border |
|
1538 |
style = gtk_widget_get_style_context(label); |
|
1539 |
- gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color); |
|
1540 |
+ gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color); |
|
1541 |
sButtonText = GDK_RGBA_TO_NS_RGBA(color); |
|
1542 |
- gtk_style_context_get_color(style, GTK_STATE_FLAG_PRELIGHT, &color); |
|
1543 |
+ gtk_style_context_save(style); |
|
1544 |
+ gtk_style_context_set_state(style, GTK_STATE_FLAG_PRELIGHT); |
|
1545 |
+ gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color); |
|
1546 |
sButtonHoverText = GDK_RGBA_TO_NS_RGBA(color); |
|
1547 |
+ gtk_style_context_restore(style); |
|
1548 |
||
1549 |
// Combobox text color |
|
1550 |
style = gtk_widget_get_style_context(comboboxLabel); |
|
1551 |
- gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color); |
|
1552 |
+ gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color); |
|
1553 |
sComboBoxText = GDK_RGBA_TO_NS_RGBA(color); |
|
1554 |
||
1555 |
// Menubar text and hover text colors |
|
1556 |
style = gtk_widget_get_style_context(menuBar); |
|
1557 |
- gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color); |
|
1558 |
+ gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color); |
|
1559 |
sMenuBarText = GDK_RGBA_TO_NS_RGBA(color); |
|
1560 |
- gtk_style_context_get_color(style, GTK_STATE_FLAG_PRELIGHT, &color); |
|
1561 |
+ gtk_style_context_save(style); |
|
1562 |
+ gtk_style_context_set_state(style, GTK_STATE_FLAG_PRELIGHT); |
|
1563 |
+ gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color); |
|
1564 |
sMenuBarHoverText = GDK_RGBA_TO_NS_RGBA(color); |
|
1565 |
+ gtk_style_context_restore(style); |
|
1566 |
||
1567 |
// GTK's guide to fancy odd row background colors: |
|
1568 |
// 1) Check if a theme explicitly defines an odd row color |
|
1569 |
@@ -1195,7 +1222,7 @@ nsLookAndFeel::Init() |
|
1570 |
// Get odd row background color |
|
1571 |
gtk_style_context_save(style); |
|
1572 |
gtk_style_context_add_region(style, GTK_STYLE_REGION_ROW, GTK_REGION_ODD); |
|
1573 |
- gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color); |
|
1574 |
+ gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color); |
|
1575 |
sOddCellBackground = GDK_RGBA_TO_NS_RGBA(color); |
|
1576 |
gtk_style_context_restore(style); |
|
1577 |
||
1578 |
@@ -1205,7 +1232,7 @@ nsLookAndFeel::Init() |
|
1579 |
// TODO GTK3 - update sFrameOuterLightBorder |
|
1580 |
// for GTK_BORDER_STYLE_INSET/OUTSET/GROVE/RIDGE border styles (Bug 978172). |
|
1581 |
style = gtk_widget_get_style_context(frame); |
|
1582 |
- gtk_style_context_get_border_color(style, GTK_STATE_FLAG_NORMAL, &color); |
|
1583 |
+ gtk_style_context_get_border_color(style, gtk_style_context_get_state(style), &color); |
|
1584 |
sFrameInnerDarkBorder = sFrameOuterLightBorder = GDK_RGBA_TO_NS_RGBA(color); |
|
1585 |
||
1586 |
gtk_widget_path_free(path); |
|
1587 |
@@ -1217,9 +1244,11 @@ nsLookAndFeel::Init() |
|
1588 |
gtk_container_add(GTK_CONTAINER(parent), infoBar); |
|
1589 |
gtk_container_add(GTK_CONTAINER(infoBarContent), infoBarLabel); |
|
1590 |
style = gtk_widget_get_style_context(infoBarLabel); |
|
1591 |
+ gtk_style_context_save(style); |
|
1592 |
gtk_style_context_add_class(style, GTK_STYLE_CLASS_INFO); |
|
1593 |
- gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color); |
|
1594 |
+ gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color); |
|
1595 |
sInfoBarText = GDK_RGBA_TO_NS_RGBA(color); |
|
1596 |
+ gtk_style_context_restore(style); |
|
1597 |
#endif |
|
1598 |
// Some themes have a unified menu bar, and support window dragging on it |
|
1599 |
gboolean supports_menubar_drag = FALSE; |
|
908
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1600 |
diff -up firefox-45.0.2/widget/gtk/nsNativeThemeGTK.cpp.gtk3-20 firefox-45.0.2/widget/gtk/nsNativeThemeGTK.cpp |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1601 |
--- firefox-45.0.2/widget/gtk/nsNativeThemeGTK.cpp.gtk3-20 2016-04-08 01:55:04.000000000 +0200 |
b29b47737173
sync from mozilla:Factory
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
907
diff
changeset
|
1602 |
+++ firefox-45.0.2/widget/gtk/nsNativeThemeGTK.cpp 2016-04-20 15:00:29.469048952 +0200 |
907 | 1603 |
@@ -1548,9 +1548,6 @@ nsNativeThemeGTK::GetMinimumWidgetSize(n |
1604 |
case NS_THEME_RADIO_CONTAINER: |
|
1605 |
case NS_THEME_CHECKBOX_LABEL: |
|
1606 |
case NS_THEME_RADIO_LABEL: |
|
1607 |
- case NS_THEME_BUTTON: |
|
1608 |
- case NS_THEME_DROPDOWN: |
|
1609 |
- case NS_THEME_TOOLBAR_BUTTON: |
|
1610 |
case NS_THEME_TREEVIEW_HEADER_CELL: |
|
1611 |
{ |
|
1612 |
// Just include our border, and let the box code augment the size. |
|
1613 |
@@ -1560,6 +1557,21 @@ nsNativeThemeGTK::GetMinimumWidgetSize(n |
|
1614 |
aResult->width = border.left + border.right; |
|
1615 |
aResult->height = border.top + border.bottom; |
|
1616 |
} |
|
1617 |
+ break; |
|
1618 |
+ case NS_THEME_BUTTON: |
|
1619 |
+ case NS_THEME_DROPDOWN: |
|
1620 |
+ case NS_THEME_TOOLBAR_BUTTON: |
|
1621 |
+ { |
|
1622 |
+ moz_gtk_get_button_height(&aResult->height); |
|
1623 |
+ } |
|
1624 |
+ break; |
|
1625 |
+ case NS_THEME_FOCUS_OUTLINE: |
|
1626 |
+ case NS_THEME_NUMBER_INPUT: |
|
1627 |
+ case NS_THEME_TEXTFIELD: |
|
1628 |
+ case NS_THEME_TEXTFIELD_MULTILINE: |
|
1629 |
+ { |
|
1630 |
+ moz_gtk_get_entry_height(&aResult->height); |
|
1631 |
+ } |
|
1632 |
break; |
|
1633 |
case NS_THEME_TOOLBAR_SEPARATOR: |
|
1634 |
{ |
|
1635 |