Merge branch 'wip/otte/center-center-center' into 'master'

Add a bunch of reftests and fix their failures

Closes #4285

See merge request GNOME/gtk!4085
This commit is contained in:
Benjamin Otte 2021-10-22 16:35:41 +00:00
commit 2b2fd23815
39 changed files with 541 additions and 6 deletions

View File

@ -211,11 +211,12 @@ gsk_gl_renderer_render (GskRenderer *renderer,
viewport.size.width = gdk_surface_get_width (surface) * scale_factor;
viewport.size.height = gdk_surface_get_height (surface) * scale_factor;
gdk_gl_context_make_current (self->context);
gdk_draw_context_begin_frame_full (GDK_DRAW_CONTEXT (self->context),
gsk_render_node_prefers_high_depth (root),
update_area);
gdk_gl_context_make_current (self->context);
/* Must be called *AFTER* gdk_draw_context_begin_frame() */
render_region = get_render_region (surface, self->context);
@ -229,7 +230,6 @@ gsk_gl_renderer_render (GskRenderer *renderer,
gsk_gl_driver_end_frame (self->driver);
gsk_gl_render_job_free (job);
gdk_gl_context_make_current (self->context);
gdk_draw_context_end_frame (GDK_DRAW_CONTEXT (self->context));
gsk_gl_driver_after_frame (self->driver);
@ -259,6 +259,8 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
format = gsk_render_node_prefers_high_depth (root) ? GL_RGBA32F : GL_RGBA8;
gdk_gl_context_make_current (self->context);
if (gsk_gl_driver_create_render_target (self->driver,
width, height,
format,

View File

@ -3848,7 +3848,11 @@ gtk_widget_adjust_size_allocation (GtkWidget *widget,
{
gtk_widget_measure (widget, GTK_ORIENTATION_HORIZONTAL,
allocation->height + priv->margin.top + priv->margin.bottom,
&min_width, &natural_width, NULL, NULL);
&min_width, NULL, NULL, NULL);
gtk_widget_measure (widget, GTK_ORIENTATION_HORIZONTAL,
-1,
NULL, &natural_width, NULL, NULL);
natural_width = MAX (min_width, natural_width);
adjust_for_align (effective_align (priv->halign, _gtk_widget_get_direction (widget)),
natural_width - priv->margin.left - priv->margin.right,
&allocation->x,
@ -3865,7 +3869,11 @@ gtk_widget_adjust_size_allocation (GtkWidget *widget,
{
gtk_widget_measure (widget, GTK_ORIENTATION_VERTICAL,
allocation->width + priv->margin.left + priv->margin.right,
&min_height, &natural_height, NULL, NULL);
&min_height, NULL, NULL, NULL);
gtk_widget_measure (widget, GTK_ORIENTATION_VERTICAL,
-1,
NULL, &natural_height, NULL, NULL);
natural_height = MAX (min_height, natural_height);
adjust_for_align (priv->valign,
natural_height - priv->margin.top - priv->margin.bottom,
&allocation->y,

View File

@ -712,12 +712,24 @@ if get_option('f16c').enabled()
# if !defined(__amd64__) && !defined(__x86_64__)
# error "F16C intrinsics are only available on x86_64"
# endif
#if !defined __has_attribute
# error "No __has_attribute() support"
#endif
#if !__has_attribute(ifunc)
# error "ifunc not supported"
#endif
static int resolved_ifunc (void) { return 0; }
static void *resolve_ifunc (void) { return resolved_ifunc; }
int ifunc_test (void) __attribute__((ifunc ("resolve_ifunc")));
#else
int ifunc_test (void) { return 0; }
#endif
#if defined(__SSE__) || defined(_MSC_VER)
# include <immintrin.h>
#else
# error "No F16C intrinsics available"
#endif
int main () {
float f[4] = { 0, };
unsigned short h[4] = { 0, };
@ -730,7 +742,7 @@ int main () {
__builtin_cpu_supports ("f16c");
#endif
return 0;
return ifunc_test ();
}'''
if cc.get_id() != 'msvc'
test_f16c_cflags = [ '-mf16c' ]

View File

@ -0,0 +1,15 @@
* {
all: unset;
background-color: mintcream;
}
picture {
background-color: firebrick;
}
#reference {
background-image: image(lime);
background-repeat: no-repeat;
background-position: center;
background-size: 100px 100px;
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow">
<property name="width_request">100</property>
<property name="height_request">200</property>
<property name="name">reference</property>
<property name="decorated">0</property>
</object>
</interface>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow">
<property name="width_request">100</property>
<property name="height_request">200</property>
<property name="decorated">0</property>
<child>
<object class="GtkOverlay">
<child type="overlay">
<object class="GtkPicture">
<property name="paintable">green-100x100.png</property>
<property name="keep-aspect-ratio">0</property>
<property name="can-shrink">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
<layout>
<property name="measure">0</property>
</layout>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@ -0,0 +1,15 @@
* {
all: unset;
background-color: mintcream;
}
picture {
background-color: firebrick;
}
#reference {
background-image: image(lime);
background-repeat: no-repeat;
background-position: center;
background-size: 100px 100px;
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow">
<property name="width_request">200</property>
<property name="height_request">100</property>
<property name="name">reference</property>
<property name="decorated">0</property>
</object>
</interface>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow">
<property name="width_request">200</property>
<property name="height_request">100</property>
<property name="decorated">0</property>
<child>
<object class="GtkOverlay">
<child type="overlay">
<object class="GtkPicture">
<property name="paintable">green-100x100.png</property>
<property name="keep-aspect-ratio">0</property>
<property name="can-shrink">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
<layout>
<property name="measure">0</property>
</layout>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@ -0,0 +1,15 @@
* {
all: unset;
background-color: mintcream;
}
picture {
background-color: firebrick;
}
#reference {
background-image: image(lime);
background-repeat: no-repeat;
background-position: center;
background-size: 150px 150px;
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow">
<property name="width_request">100</property>
<property name="height_request">200</property>
<property name="name">reference</property>
<property name="decorated">0</property>
</object>
</interface>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow">
<property name="width_request">100</property>
<property name="height_request">200</property>
<property name="decorated">0</property>
<child>
<object class="GtkOverlay">
<child type="overlay">
<object class="GtkPicture">
<property name="paintable">green-150x150.png</property>
<property name="keep-aspect-ratio">0</property>
<property name="can-shrink">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
<layout>
<property name="measure">0</property>
</layout>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@ -0,0 +1,15 @@
* {
all: unset;
background-color: mintcream;
}
picture {
background-color: firebrick;
}
#reference {
background-image: image(lime);
background-repeat: no-repeat;
background-position: center;
background-size: 150px 150px;
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow">
<property name="width_request">200</property>
<property name="height_request">100</property>
<property name="name">reference</property>
<property name="decorated">0</property>
</object>
</interface>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow">
<property name="width_request">200</property>
<property name="height_request">100</property>
<property name="decorated">0</property>
<child>
<object class="GtkOverlay">
<child type="overlay">
<object class="GtkPicture">
<property name="paintable">green-150x150.png</property>
<property name="keep-aspect-ratio">0</property>
<property name="can-shrink">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
<layout>
<property name="measure">0</property>
</layout>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@ -0,0 +1,15 @@
* {
all: unset;
background-color: mintcream;
}
picture {
background-color: firebrick;
}
#reference {
background-image: image(lime);
background-repeat: no-repeat;
background-position: center;
background-size: 200px 200px;
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow">
<property name="width_request">100</property>
<property name="height_request">200</property>
<property name="name">reference</property>
<property name="decorated">0</property>
</object>
</interface>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow">
<property name="width_request">100</property>
<property name="height_request">200</property>
<property name="decorated">0</property>
<child>
<object class="GtkOverlay">
<child type="overlay">
<object class="GtkPicture">
<property name="paintable">green-200x200.png</property>
<property name="keep-aspect-ratio">0</property>
<property name="can-shrink">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
<layout>
<property name="measure">0</property>
</layout>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@ -0,0 +1,15 @@
* {
all: unset;
background-color: mintcream;
}
picture {
background-color: firebrick;
}
#reference {
background-image: image(lime);
background-repeat: no-repeat;
background-position: center;
background-size: 200px 200px;
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow">
<property name="width_request">200</property>
<property name="height_request">100</property>
<property name="name">reference</property>
<property name="decorated">0</property>
</object>
</interface>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow">
<property name="width_request">200</property>
<property name="height_request">100</property>
<property name="decorated">0</property>
<child>
<object class="GtkOverlay">
<child type="overlay">
<object class="GtkPicture">
<property name="paintable">green-200x200.png</property>
<property name="keep-aspect-ratio">0</property>
<property name="can-shrink">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
<layout>
<property name="measure">0</property>
</layout>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@ -0,0 +1,15 @@
* {
all: unset;
background-color: mintcream;
}
picture {
background-color: firebrick;
}
#reference {
background-image: image(lime);
background-repeat: no-repeat;
background-position: center;
background-size: 20px 20px;
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow">
<property name="width_request">100</property>
<property name="height_request">200</property>
<property name="name">reference</property>
<property name="decorated">0</property>
</object>
</interface>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow">
<property name="width_request">100</property>
<property name="height_request">200</property>
<property name="decorated">0</property>
<child>
<object class="GtkOverlay">
<child type="overlay">
<object class="GtkPicture">
<property name="paintable">green-20x20.png</property>
<property name="keep-aspect-ratio">0</property>
<property name="can-shrink">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
<layout>
<property name="measure">0</property>
</layout>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@ -0,0 +1,15 @@
* {
all: unset;
background-color: mintcream;
}
picture {
background-color: firebrick;
}
#reference {
background-image: image(lime);
background-repeat: no-repeat;
background-position: center;
background-size: 20px 20px;
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow">
<property name="width_request">200</property>
<property name="height_request">100</property>
<property name="name">reference</property>
<property name="decorated">0</property>
</object>
</interface>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow">
<property name="width_request">200</property>
<property name="height_request">100</property>
<property name="decorated">0</property>
<child>
<object class="GtkOverlay">
<child type="overlay">
<object class="GtkPicture">
<property name="paintable">green-20x20.png</property>
<property name="keep-aspect-ratio">0</property>
<property name="can-shrink">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
<layout>
<property name="measure">0</property>
</layout>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@ -0,0 +1,15 @@
* {
all: unset;
background-color: mintcream;
}
picture {
background-color: firebrick;
}
#reference {
background-image: image(lime);
background-repeat: no-repeat;
background-position: center;
background-size: 300px 300px;
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow">
<property name="width_request">100</property>
<property name="height_request">200</property>
<property name="name">reference</property>
<property name="decorated">0</property>
</object>
</interface>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow">
<property name="width_request">100</property>
<property name="height_request">200</property>
<property name="decorated">0</property>
<child>
<object class="GtkOverlay">
<child type="overlay">
<object class="GtkPicture">
<property name="paintable">green-300x300.png</property>
<property name="keep-aspect-ratio">0</property>
<property name="can-shrink">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
<layout>
<property name="measure">0</property>
</layout>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@ -0,0 +1,15 @@
* {
all: unset;
background-color: mintcream;
}
picture {
background-color: firebrick;
}
#reference {
background-image: image(lime);
background-repeat: no-repeat;
background-position: center;
background-size: 300px 300px;
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow">
<property name="width_request">200</property>
<property name="height_request">100</property>
<property name="name">reference</property>
<property name="decorated">0</property>
</object>
</interface>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow">
<property name="width_request">200</property>
<property name="height_request">100</property>
<property name="decorated">0</property>
<child>
<object class="GtkOverlay">
<child type="overlay">
<object class="GtkPicture">
<property name="paintable">green-300x300.png</property>
<property name="keep-aspect-ratio">0</property>
<property name="can-shrink">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
<layout>
<property name="measure">0</property>
</layout>
</object>
</child>
</object>
</child>
</object>
</interface>

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 687 B

View File

@ -311,7 +311,10 @@ save_node (GskRenderNode *node,
}
g_test_message ("Storing test result node at %s", filename);
if (node)
bytes = gsk_render_node_serialize (node);
else
bytes = g_bytes_new ("", 0);
ret = g_file_set_contents (filename,
g_bytes_get_data (bytes, NULL),
g_bytes_get_size (bytes),

View File

@ -170,6 +170,36 @@ testdata = [
'box-shadow-with-blend-mode.ui',
'button-wrapping.ui',
'button-wrapping.ref.ui',
'center-center-100x100-picture-in-100x200.css',
'center-center-100x100-picture-in-100x200.ref.ui',
'center-center-100x100-picture-in-100x200.ui',
'center-center-100x100-picture-in-200x100.css',
'center-center-100x100-picture-in-200x100.ref.ui',
'center-center-100x100-picture-in-200x100.ui',
'center-center-150x150-picture-in-100x200.css',
'center-center-150x150-picture-in-100x200.ref.ui',
'center-center-150x150-picture-in-100x200.ui',
'center-center-150x150-picture-in-200x100.css',
'center-center-150x150-picture-in-200x100.ref.ui',
'center-center-150x150-picture-in-200x100.ui',
'center-center-200x200-picture-in-100x200.css',
'center-center-200x200-picture-in-100x200.ref.ui',
'center-center-200x200-picture-in-100x200.ui',
'center-center-200x200-picture-in-200x100.css',
'center-center-200x200-picture-in-200x100.ref.ui',
'center-center-200x200-picture-in-200x100.ui',
'center-center-20x20-picture-in-100x200.css',
'center-center-20x20-picture-in-100x200.ref.ui',
'center-center-20x20-picture-in-100x200.ui',
'center-center-20x20-picture-in-200x100.css',
'center-center-20x20-picture-in-200x100.ref.ui',
'center-center-20x20-picture-in-200x100.ui',
'center-center-300x300-picture-in-100x200.css',
'center-center-300x300-picture-in-100x200.ref.ui',
'center-center-300x300-picture-in-100x200.ui',
'center-center-300x300-picture-in-200x100.css',
'center-center-300x300-picture-in-200x100.ref.ui',
'center-center-300x300-picture-in-200x100.ui',
'centerlayout-invisible-child.css',
'centerlayout-invisible-child.ref.ui',
'centerlayout-invisible-child.ui',