css: An opaque background does not allow omitting push_group

When the background-clip of the background is smaller than the
background-clip of blended images, not pushing a group is wrong.

Test testing exactly that included.
This commit is contained in:
Benjamin Otte 2016-12-13 23:00:26 +01:00
parent 23e35706b4
commit dd1cf1ac0f
5 changed files with 60 additions and 9 deletions

View File

@ -77,18 +77,9 @@ _gtk_theming_background_paint_color (GtkThemingBackground *bg,
static gboolean
_gtk_theming_background_needs_push_group (GtkCssStyle *style)
{
const GdkRGBA *bg_color;
GtkCssValue *background_color;
GtkCssValue *blend_modes;
gint i;
background_color = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BACKGROUND_COLOR);
bg_color = _gtk_css_rgba_value_get_rgba (background_color);
/* An opaque background-color means we don't need to push the group */
if (bg_color->alpha == 1)
return FALSE;
blend_modes = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BACKGROUND_BLEND_MODE);
/*

View File

@ -84,6 +84,9 @@ testdata = \
background-area.css \
background-area.ref.ui \
background-area.ui \
background-blend-mode-clip-interaction.css \
background-blend-mode-clip-interaction.ref.ui \
background-blend-mode-clip-interaction.ui \
background-color-transparent.css \
background-color-transparent.ref.ui \
background-color-transparent.ui \

View File

@ -0,0 +1,24 @@
* {all: unset; }
window {
background: lime;
}
box {
background-color: red;
background-image: linear-gradient(yellow, yellow), linear-gradient(white, white);
background-clip: border-box, content-box;
background-size: 50% 100%, 100% 50%;
background-repeat: no-repeat;
background-blend-mode: multiply;
padding: 10px;
border: 1px solid blue;
}
window#reference box {
background-image: linear-gradient(red,red), linear-gradient(yellow, yellow);
background-clip: content-box, border-box;
background-size: 100% 100%, 50% 100%;
background-color: transparent;
background-blend-mode: normal;
}

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="window1">
<property name="width_request">50</property>
<property name="height_request">50</property>
<property name="can_focus">False</property>
<property name="type">popup</property>
<property name="name">reference</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
</object>
</interface>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="window1">
<property name="width_request">50</property>
<property name="height_request">50</property>
<property name="can_focus">False</property>
<property name="type">popup</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
</object>
</interface>