| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/libgtkui/gtk_util.h" | 5 #include "chrome/browser/ui/libgtkui/gtk_util.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #include <gdk/gdk.h> | 8 #include <gdk/gdk.h> |
| 9 #include <gdk/gdkx.h> | 9 #include <gdk/gdkx.h> |
| 10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 const char* name; | 237 const char* name; |
| 238 GtkStateFlags state_flag; | 238 GtkStateFlags state_flag; |
| 239 } pseudo_classes[] = { | 239 } pseudo_classes[] = { |
| 240 {"active", GTK_STATE_FLAG_ACTIVE}, | 240 {"active", GTK_STATE_FLAG_ACTIVE}, |
| 241 {"hover", GTK_STATE_FLAG_PRELIGHT}, | 241 {"hover", GTK_STATE_FLAG_PRELIGHT}, |
| 242 {"selected", GTK_STATE_FLAG_SELECTED}, | 242 {"selected", GTK_STATE_FLAG_SELECTED}, |
| 243 {"disabled", GTK_STATE_FLAG_INSENSITIVE}, | 243 {"disabled", GTK_STATE_FLAG_INSENSITIVE}, |
| 244 {"indeterminate", GTK_STATE_FLAG_INCONSISTENT}, | 244 {"indeterminate", GTK_STATE_FLAG_INCONSISTENT}, |
| 245 {"focus", GTK_STATE_FLAG_FOCUSED}, | 245 {"focus", GTK_STATE_FLAG_FOCUSED}, |
| 246 {"backdrop", GTK_STATE_FLAG_BACKDROP}, | 246 {"backdrop", GTK_STATE_FLAG_BACKDROP}, |
| 247 // TODO(thomasanderson): These state flags are only available in | 247 {"link", GTK_STATE_FLAG_LINK}, |
| 248 // GTK 3.10 or later, which is unavailable in the wheezy | 248 {"visited", GTK_STATE_FLAG_VISITED}, |
| 249 // sysroot. Add them once the sysroot is updated to jessie. | 249 {"checked", GTK_STATE_FLAG_CHECKED}, |
| 250 // { "link", GTK_STATE_FLAG_LINK }, | |
| 251 // { "visited", GTK_STATE_FLAG_VISITED }, | |
| 252 // { "checked", GTK_STATE_FLAG_CHECKED }, | |
| 253 }; | 250 }; |
| 254 GtkStateFlags state = | 251 GtkStateFlags state = |
| 255 context ? gtk_style_context_get_state(context) : GTK_STATE_FLAG_NORMAL; | 252 context ? gtk_style_context_get_state(context) : GTK_STATE_FLAG_NORMAL; |
| 256 base::StringTokenizer t(css_node, ".:#"); | 253 base::StringTokenizer t(css_node, ".:#"); |
| 257 t.set_options(base::StringTokenizer::RETURN_DELIMS); | 254 t.set_options(base::StringTokenizer::RETURN_DELIMS); |
| 258 while (t.GetNext()) { | 255 while (t.GetNext()) { |
| 259 if (t.token_is_delim()) { | 256 if (t.token_is_delim()) { |
| 260 if (t.token_begin() == css_node.begin()) { | 257 if (t.token_begin() == css_node.begin()) { |
| 261 // Special case for the first token. | 258 // Special case for the first token. |
| 262 gtk_widget_path_append_type(path, G_TYPE_NONE); | 259 gtk_widget_path_append_type(path, G_TYPE_NONE); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 | 454 |
| 458 AddBorders(context); | 455 AddBorders(context); |
| 459 PixelSurface surface; | 456 PixelSurface surface; |
| 460 RenderBackground(surface.cairo(), context); | 457 RenderBackground(surface.cairo(), context); |
| 461 gtk_render_frame(context, surface.cairo(), 0, 0, 1, 1); | 458 gtk_render_frame(context, surface.cairo(), 0, 0, 1, 1); |
| 462 return surface.GetPixelValue(); | 459 return surface.GetPixelValue(); |
| 463 } | 460 } |
| 464 #endif | 461 #endif |
| 465 | 462 |
| 466 } // namespace libgtkui | 463 } // namespace libgtkui |
| OLD | NEW |