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:
Carlos Soriano
2014-11-11 15:04:46 +01:00
parent 5961f162fa
commit 2935fd4ffe
6 changed files with 234 additions and 0 deletions

View File

@ -40,6 +40,7 @@
#include "st-texture-cache.h"
#include "st-theme-context.h"
#include "st-theme-node-transition.h"
#include "st-theme-node-private.h"
#include "st-widget-accessible.h"
@ -1540,6 +1541,8 @@ st_widget_recompute_style (StWidget *widget,
return;
}
_st_theme_node_apply_margins (new_theme_node, CLUTTER_ACTOR (widget));
if (!old_theme_node ||
!st_theme_node_geometry_equal (old_theme_node, new_theme_node))
clutter_actor_queue_relayout ((ClutterActor *) widget);