コード例 #1
0
ファイル: gtkcsslookup.c プロジェクト: alexlarsson/gtk
/**
 * _gtk_css_lookup_resolve:
 * @lookup: the lookup
 * @context: the context the values are resolved for
 * @values: a new #GtkCssStyle to be filled with the new properties
 *
 * Resolves the current lookup into a styleproperties object. This is done
 * by converting from the “winning declaration” to the “computed value”.
 *
 * XXX: This bypasses the notion of “specified value”. If this ever becomes
 * an issue, go fix it.
 **/
void
_gtk_css_lookup_resolve (GtkCssLookup            *lookup,
                         GtkStyleProviderPrivate *provider,
                         GtkCssStaticStyle       *style,
                         GtkCssStyle             *parent_style)
{
  guint i, n;

  gtk_internal_return_if_fail (lookup != NULL);
  gtk_internal_return_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider));
  gtk_internal_return_if_fail (GTK_IS_CSS_STATIC_STYLE (style));
  gtk_internal_return_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style));

  n = _gtk_css_style_property_get_n_properties ();

  for (i = 0; i < n; i++)
    {
      if (lookup->values[i].value ||
          _gtk_bitmask_get (lookup->missing, i))
        gtk_css_static_style_compute_value (GTK_CSS_STATIC_STYLE (style),
                                            provider,
                                            parent_style,
                                            i,
                                            lookup->values[i].value,
                                            lookup->values[i].section);
      /* else not a relevant property */
    }
}
コード例 #2
0
ファイル: gtkcssnode.c プロジェクト: GYGit/gtk
static gboolean
gtk_css_style_needs_recreation (GtkCssStyle  *style,
                                GtkCssChange  change)
{
  /* Try to avoid invalidating if we can */
  if (change & GTK_CSS_RADICAL_CHANGE)
    return TRUE;

  if (GTK_IS_CSS_ANIMATED_STYLE (style))
    style = GTK_CSS_ANIMATED_STYLE (style)->style;

  if (gtk_css_static_style_get_change (GTK_CSS_STATIC_STYLE (style)) & change)
    return TRUE;
  else
    return FALSE;
}
コード例 #3
0
ファイル: gtkcssnode.c プロジェクト: davidyang5405/gtk
static gboolean
may_be_stored_in_parent_cache (GtkCssStyle *style)
{
    GtkCssChange change;

    change = gtk_css_static_style_get_change (GTK_CSS_STATIC_STYLE (style));

    /* The cache is shared between all children of the parent, so if a
     * style depends on a sibling it is not independant of the child.
     */
    if (change & GTK_CSS_CHANGE_ANY_SIBLING)
        return FALSE;

    /* Again, the cache is shared between all children of the parent.
     * If the position is relevant, no child has the same style.
     */
    if (change & (GTK_CSS_CHANGE_NTH_CHILD | GTK_CSS_CHANGE_NTH_LAST_CHILD))
        return FALSE;

    return TRUE;
}