St: support css margin property
It's implemented similar to the padding property, but instead of taking into account the margin values at drawing time in node-drawing, we set the clutter actor margins in StWidget when the style is computed. In the case that a CSS margin is not specified, we don't to set a value of 0 to the clutter actor margin. In this manner it allows to use Clutter margin values set in the code. However, the margins that are set both in the code and in the CSS on the same side, the result is unpredictable. We avoid to set the clutter actor margin values to 0 if there's no CSS margin values defined, so we still allow clutter actors to use margin set in the code. https://bugzilla.gnome.org/show_bug.cgi?id=728437
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
#include "st-theme-node.h"
|
||||
#include <libcroco/libcroco.h>
|
||||
#include "st-types.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@@ -58,6 +59,7 @@ struct _StThemeNode {
|
||||
int border_radius[4];
|
||||
int outline_width;
|
||||
guint padding[4];
|
||||
guint margin[4];
|
||||
|
||||
int width;
|
||||
int height;
|
||||
@@ -90,6 +92,8 @@ struct _StThemeNode {
|
||||
guint background_position_set : 1;
|
||||
guint background_repeat : 1;
|
||||
|
||||
gboolean margin_set : 4;
|
||||
|
||||
guint properties_computed : 1;
|
||||
guint geometry_computed : 1;
|
||||
guint background_computed : 1;
|
||||
@@ -121,6 +125,8 @@ struct _StThemeNodeClass {
|
||||
|
||||
void _st_theme_node_ensure_background (StThemeNode *node);
|
||||
void _st_theme_node_ensure_geometry (StThemeNode *node);
|
||||
void _st_theme_node_apply_margins (StThemeNode *node,
|
||||
ClutterActor *actor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Reference in New Issue
Block a user