| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 SkColor GetFgColorFromStyleContext(GtkStyleContext* context); | 167 SkColor GetFgColorFromStyleContext(GtkStyleContext* context); |
| 168 | 168 |
| 169 // Overrides properties on |context| and all its parents with those | 169 // Overrides properties on |context| and all its parents with those |
| 170 // provided by |css|. | 170 // provided by |css|. |
| 171 void ApplyCssToContext(GtkStyleContext* context, const std::string& css); | 171 void ApplyCssToContext(GtkStyleContext* context, const std::string& css); |
| 172 | 172 |
| 173 // Get the 'color' property from the style context created by | 173 // Get the 'color' property from the style context created by |
| 174 // GetStyleContextFromCss(|css_selector|). | 174 // GetStyleContextFromCss(|css_selector|). |
| 175 SkColor GetFgColor(const std::string& css_selector); | 175 SkColor GetFgColor(const std::string& css_selector); |
| 176 | 176 |
| 177 ScopedCssProvider GetCssProvider(const std::string& css); |
| 178 |
| 177 // Renders the backgrounds of all ancestors of |context|, then renders | 179 // Renders the backgrounds of all ancestors of |context|, then renders |
| 178 // the background for |context| itself. | 180 // the background for |context| itself. |
| 179 void RenderBackground(const gfx::Size& size, | 181 void RenderBackground(const gfx::Size& size, |
| 180 cairo_t* cr, | 182 cairo_t* cr, |
| 181 GtkStyleContext* context); | 183 GtkStyleContext* context); |
| 182 | 184 |
| 183 // Renders a background from the style context created by | 185 // Renders a background from the style context created by |
| 184 // GetStyleContextFromCss(|css_selector|) into a 24x24 bitmap and | 186 // GetStyleContextFromCss(|css_selector|) into a 24x24 bitmap and |
| 185 // returns the average color. | 187 // returns the average color. |
| 186 SkColor GetBgColor(const std::string& css_selector); | 188 SkColor GetBgColor(const std::string& css_selector); |
| 187 | 189 |
| 188 // Renders the border from the style context created by | 190 // Renders the border from the style context created by |
| 189 // GetStyleContextFromCss(|css_selector|) into a 24x24 bitmap and | 191 // GetStyleContextFromCss(|css_selector|) into a 24x24 bitmap and |
| 190 // returns the average color. | 192 // returns the average color. |
| 191 SkColor GetBorderColor(const std::string& css_selector); | 193 SkColor GetBorderColor(const std::string& css_selector); |
| 192 | 194 |
| 193 // On Gtk3.20 or later, behaves like GetBgColor. Otherwise, returns | 195 // On Gtk3.20 or later, behaves like GetBgColor. Otherwise, returns |
| 194 // the background-color property. | 196 // the background-color property. |
| 195 SkColor GetSelectionBgColor(const std::string& css_selector); | 197 SkColor GetSelectionBgColor(const std::string& css_selector); |
| 196 | 198 |
| 197 // Get the color of the GtkSeparator specified by |css_selector|. | 199 // Get the color of the GtkSeparator specified by |css_selector|. |
| 198 SkColor GetSeparatorColor(const std::string& css_selector); | 200 SkColor GetSeparatorColor(const std::string& css_selector); |
| 199 #endif | 201 #endif |
| 200 | 202 |
| 201 } // namespace libgtkui | 203 } // namespace libgtkui |
| 202 | 204 |
| 203 #endif // CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ | 205 #endif // CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ |
| OLD | NEW |