| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 typedef ScopedGObject<GtkStyleContext> ScopedStyleContext; | 113 typedef ScopedGObject<GtkStyleContext> ScopedStyleContext; |
| 114 | 114 |
| 115 // Parses |css_selector| into a GtkStyleContext. The format is a | 115 // Parses |css_selector| into a GtkStyleContext. The format is a |
| 116 // sequence of whitespace-separated objects. Each object may have at | 116 // sequence of whitespace-separated objects. Each object may have at |
| 117 // most one object name at the beginning of the string, and any number | 117 // most one object name at the beginning of the string, and any number |
| 118 // of '.'-prefixed classes and ':'-prefixed pseudoclasses. An example | 118 // of '.'-prefixed classes and ':'-prefixed pseudoclasses. An example |
| 119 // is "GtkButton.button.suggested-action:hover:active". The caller | 119 // is "GtkButton.button.suggested-action:hover:active". The caller |
| 120 // must g_object_unref() the returned context. | 120 // must g_object_unref() the returned context. |
| 121 ScopedStyleContext GetStyleContextFromCss(const char* css_selector); | 121 ScopedStyleContext GetStyleContextFromCss(const char* css_selector); |
| 122 | 122 |
| 123 // Removes all border-type properties on |context| and all of its parents. |
| 124 void RemoveBorders(GtkStyleContext* context); |
| 125 |
| 123 // Get the 'color' property from the style context created by | 126 // Get the 'color' property from the style context created by |
| 124 // GetStyleContextFromCss(|css_selector|). | 127 // GetStyleContextFromCss(|css_selector|). |
| 125 SkColor GetFgColor(const char* css_selector); | 128 SkColor GetFgColor(const char* css_selector); |
| 126 | 129 |
| 127 // Renders a background from the style context created by | 130 // Renders a background from the style context created by |
| 128 // GetStyleContextFromCss(|css_selector|) into a single pixel and | 131 // GetStyleContextFromCss(|css_selector|) into a single pixel and |
| 129 // returns the color. | 132 // returns the color. |
| 130 SkColor GetBgColor(const char* css_selector); | 133 SkColor GetBgColor(const char* css_selector); |
| 131 | 134 |
| 132 // If there is a border, renders the border from the style context | 135 // If there is a border, renders the border from the style context |
| 133 // created by GetStyleContextFromCss(|css_selector|) into a single | 136 // created by GetStyleContextFromCss(|css_selector|) into a single |
| 134 // pixel and returns the color. Otherwise returns kInvalidColor. | 137 // pixel and returns the color. Otherwise returns kInvalidColor. |
| 135 SkColor GetBorderColor(const char* css_selector); | 138 SkColor GetBorderColor(const char* css_selector); |
| 136 #endif | 139 #endif |
| 137 | 140 |
| 138 } // namespace libgtkui | 141 } // namespace libgtkui |
| 139 | 142 |
| 140 #endif // CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ | 143 #endif // CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ |
| OLD | NEW |