roundedbox: Only grow border-radius if there is one

This is relevant for shadow spread and goes in line with the web.

Testcase included.
This commit is contained in:
Benjamin Otte 2014-08-21 00:10:43 +02:00
parent 1126a34353
commit 67456304d4
5 changed files with 64 additions and 2 deletions

View File

@ -149,8 +149,10 @@ gtk_css_border_radius_grow (GtkRoundedBoxCorner *corner,
double horizontal,
double vertical)
{
corner->horizontal += horizontal;
corner->vertical += vertical;
if (corner->horizontal)
corner->horizontal += horizontal;
if (corner->vertical)
corner->vertical += vertical;
if (corner->horizontal <= 0 || corner->vertical <= 0)
{

View File

@ -143,6 +143,9 @@ testdata = \
box-shadow-spec-inset.css \
box-shadow-spec-inset.ref.ui \
box-shadow-spec-inset.ui \
box-shadow-spread.css \
box-shadow-spread.ref.ui \
box-shadow-spread.ui \
button-wrapping.ui \
button-wrapping.ref.ui \
cellrenderer-pixbuf-stock-rtl.css \

View File

@ -0,0 +1,9 @@
@import "reset-to-defaults.css";
.test {
box-shadow: 0 0 0 10px red;
}
.reference {
border: solid 10px red;
}

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.1 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkWindow" id="window1">
<property name="width_request">100</property>
<property name="height_request">100</property>
<property name="can_focus">False</property>
<property name="type">popup</property>
<child>
<object class="GtkButton" id="button1">
<property name="label" translatable="yes">Hi</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<style>
<class name="reference"/>
</style>
</object>
</child>
</object>
</interface>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.1 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkWindow" id="window1">
<property name="width_request">100</property>
<property name="height_request">100</property>
<property name="can_focus">False</property>
<property name="type">popup</property>
<child>
<object class="GtkButton" id="button1">
<property name="label" translatable="yes">Hi</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<style>
<class name="test"/>
</style>
</object>
</child>
</object>
</interface>