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 #ifndef CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ | 5 #ifndef CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ |
6 #define CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ | 6 #define CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 typedef ScopedGObject<GtkStyleContext> ScopedStyleContext; | 132 typedef ScopedGObject<GtkStyleContext> ScopedStyleContext; |
133 | 133 |
134 // Parses |css_selector| into a GtkStyleContext. The format is a | 134 // Parses |css_selector| into a GtkStyleContext. The format is a |
135 // sequence of whitespace-separated objects. Each object may have at | 135 // sequence of whitespace-separated objects. Each object may have at |
136 // most one object name at the beginning of the string, and any number | 136 // most one object name at the beginning of the string, and any number |
137 // of '.'-prefixed classes and ':'-prefixed pseudoclasses. An example | 137 // of '.'-prefixed classes and ':'-prefixed pseudoclasses. An example |
138 // is "GtkButton.button.suggested-action:hover:active". The caller | 138 // is "GtkButton.button.suggested-action:hover:active". The caller |
139 // must g_object_unref() the returned context. | 139 // must g_object_unref() the returned context. |
140 ScopedStyleContext GetStyleContextFromCss(const char* css_selector); | 140 ScopedStyleContext GetStyleContextFromCss(const char* css_selector); |
141 | 141 |
| 142 SkColor SkColorFromStyleContext(GtkStyleContext* context); |
| 143 |
142 // Removes all border-type properties on |context| and all of its parents. | 144 // Removes all border-type properties on |context| and all of its parents. |
143 void RemoveBorders(GtkStyleContext* context); | 145 void RemoveBorders(GtkStyleContext* context); |
144 | 146 |
145 // Get the 'color' property from the style context created by | 147 // Get the 'color' property from the style context created by |
146 // GetStyleContextFromCss(|css_selector|). | 148 // GetStyleContextFromCss(|css_selector|). |
147 SkColor GetFgColor(const char* css_selector); | 149 SkColor GetFgColor(const char* css_selector); |
148 | 150 |
149 // Renders the backgrounds of all ancestors of |context|, then renders | 151 // Renders the backgrounds of all ancestors of |context|, then renders |
150 // the background for |context| itself. | 152 // the background for |context| itself. |
151 void RenderBackground(const gfx::Size& size, | 153 void RenderBackground(const gfx::Size& size, |
(...skipping 10 matching lines...) Expand all Loading... |
162 // pixel and returns the color. Otherwise returns kInvalidColor. | 164 // pixel and returns the color. Otherwise returns kInvalidColor. |
163 SkColor GetBorderColor(const char* css_selector); | 165 SkColor GetBorderColor(const char* css_selector); |
164 | 166 |
165 // Get the color of the GtkSeparator specified by |css_selector|. | 167 // Get the color of the GtkSeparator specified by |css_selector|. |
166 SkColor GetSeparatorColor(const char* css_selector); | 168 SkColor GetSeparatorColor(const char* css_selector); |
167 #endif | 169 #endif |
168 | 170 |
169 } // namespace libgtkui | 171 } // namespace libgtkui |
170 | 172 |
171 #endif // CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ | 173 #endif // CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ |
OLD | NEW |