cssnode: Avoid style context api

Duplicate the print flags in gtkcssnodeprivate.h,
so we don't rely on gtkstylecontext.h here.
This commit is contained in:
Matthias Clasen 2022-10-12 09:47:33 -04:00
parent ac3177ce95
commit f42fe500c9
3 changed files with 19 additions and 13 deletions

View File

@ -976,7 +976,7 @@ gtk_style_context_to_string (GtkStyleContext *context,
string = g_string_new (""); string = g_string_new ("");
gtk_css_node_print (priv->cssnode, flags, string, 0); gtk_css_node_print (priv->cssnode, (GtkCssNodePrintFlags)flags, string, 0);
return g_string_free (string, FALSE); return g_string_free (string, FALSE);
} }

View File

@ -1389,7 +1389,7 @@ gtk_css_node_get_style_provider (GtkCssNode *cssnode)
void void
gtk_css_node_print (GtkCssNode *cssnode, gtk_css_node_print (GtkCssNode *cssnode,
GtkStyleContextPrintFlags flags, GtkCssNodePrintFlags flags,
GString *string, GString *string,
guint indent) guint indent)
{ {
@ -1405,7 +1405,7 @@ gtk_css_node_print (GtkCssNode *cssnode,
if (!cssnode->visible) if (!cssnode->visible)
g_string_append_c (string, ']'); g_string_append_c (string, ']');
if (flags & GTK_STYLE_CONTEXT_PRINT_SHOW_CHANGE) if (flags & GTK_CSS_NODE_PRINT_SHOW_CHANGE)
{ {
GtkCssStyle *style = gtk_css_node_get_style (cssnode); GtkCssStyle *style = gtk_css_node_get_style (cssnode);
GtkCssChange change; GtkCssChange change;
@ -1417,10 +1417,10 @@ gtk_css_node_print (GtkCssNode *cssnode,
g_string_append_c (string, '\n'); g_string_append_c (string, '\n');
if (flags & GTK_STYLE_CONTEXT_PRINT_SHOW_STYLE) if (flags & GTK_CSS_NODE_PRINT_SHOW_STYLE)
need_newline = gtk_css_style_print (gtk_css_node_get_style (cssnode), string, indent + 2, TRUE); need_newline = gtk_css_style_print (gtk_css_node_get_style (cssnode), string, indent + 2, TRUE);
if (flags & GTK_STYLE_CONTEXT_PRINT_RECURSE) if (flags & GTK_CSS_NODE_PRINT_RECURSE)
{ {
GtkCssNode *node; GtkCssNode *node;

View File

@ -24,7 +24,6 @@
#include "gtkcssstylechangeprivate.h" #include "gtkcssstylechangeprivate.h"
#include "gtkbitmaskprivate.h" #include "gtkbitmaskprivate.h"
#include "gtkcsstypesprivate.h" #include "gtkcsstypesprivate.h"
#include "deprecated/gtkstylecontext.h"
#include "gtklistlistmodelprivate.h" #include "gtklistlistmodelprivate.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@ -155,8 +154,15 @@ void gtk_css_node_validate (GtkCssNode *
GtkStyleProvider * gtk_css_node_get_style_provider (GtkCssNode *cssnode) G_GNUC_PURE; GtkStyleProvider * gtk_css_node_get_style_provider (GtkCssNode *cssnode) G_GNUC_PURE;
typedef enum {
GTK_CSS_NODE_PRINT_NONE = 0,
GTK_CSS_NODE_PRINT_RECURSE = 1 << 0,
GTK_CSS_NODE_PRINT_SHOW_STYLE = 1 << 1,
GTK_CSS_NODE_PRINT_SHOW_CHANGE = 1 << 2
} GtkCssNodePrintFlags;
void gtk_css_node_print (GtkCssNode *cssnode, void gtk_css_node_print (GtkCssNode *cssnode,
GtkStyleContextPrintFlags flags, GtkCssNodePrintFlags flags,
GString *string, GString *string,
guint indent); guint indent);