Merge branch 'matthiasc/for-main' into 'main'
popover: Stop making assumptions about corners See merge request GNOME/gtk!5961
This commit is contained in:
@@ -129,6 +129,7 @@
|
||||
#include "gtkroundedboxprivate.h"
|
||||
#include "gsk/gskroundedrectprivate.h"
|
||||
#include "gtkcssshadowvalueprivate.h"
|
||||
#include "gtkcsscornervalueprivate.h"
|
||||
|
||||
#include "gdk/gdksurfaceprivate.h"
|
||||
|
||||
@@ -1196,6 +1197,16 @@ gtk_popover_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (gtk_popover_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static double
|
||||
get_border_radius (GtkWidget *widget)
|
||||
{
|
||||
GtkCssStyle *style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
|
||||
|
||||
/* FIXME this is a very crude interpretation of border radius */
|
||||
return MAX (_gtk_css_corner_value_get_x (style->border->border_top_left_radius, 100),
|
||||
_gtk_css_corner_value_get_y (style->border->border_top_left_radius, 100));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_popover_get_gap_coords (GtkPopover *popover,
|
||||
int *initial_x_out,
|
||||
@@ -1230,7 +1241,7 @@ gtk_popover_get_gap_coords (GtkPopover *popover,
|
||||
pos = priv->final_position;
|
||||
|
||||
style = gtk_css_node_get_style (gtk_widget_get_css_node (priv->contents_widget));
|
||||
border_radius = _gtk_css_number_value_get (style->border->border_top_left_radius, 100);
|
||||
border_radius = round (get_border_radius (widget));
|
||||
border_top = _gtk_css_number_value_get (style->border->border_top_width, 100);
|
||||
border_right = _gtk_css_number_value_get (style->border->border_right_width, 100);
|
||||
border_bottom = _gtk_css_number_value_get (style->border->border_bottom_width, 100);
|
||||
@@ -1429,15 +1440,6 @@ gtk_popover_update_shape (GtkPopover *popover)
|
||||
gtk_native_update_opaque_region (GTK_NATIVE (popover), priv->contents_widget, TRUE, TRUE, 0);
|
||||
}
|
||||
|
||||
static int
|
||||
get_border_radius (GtkWidget *widget)
|
||||
{
|
||||
GtkCssStyle *style;
|
||||
|
||||
style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
|
||||
return round (_gtk_css_number_value_get (style->border->border_top_left_radius, 100));
|
||||
}
|
||||
|
||||
static int
|
||||
get_minimal_size (GtkPopover *popover,
|
||||
GtkOrientation orientation)
|
||||
@@ -1448,7 +1450,7 @@ get_minimal_size (GtkPopover *popover,
|
||||
int tail_gap_width = priv->has_arrow ? TAIL_GAP_WIDTH : 0;
|
||||
int min_width, min_height;
|
||||
|
||||
minimal_size = 2 * get_border_radius (GTK_WIDGET (priv->contents_widget));
|
||||
minimal_size = 2 * round (get_border_radius (GTK_WIDGET (priv->contents_widget)));
|
||||
pos = priv->position;
|
||||
|
||||
if ((orientation == GTK_ORIENTATION_HORIZONTAL && POS_IS_VERTICAL (pos)) ||
|
||||
|
||||
@@ -499,6 +499,8 @@ test_data = [
|
||||
'text-shadow-invalid-but-worked-in-3.12.errors',
|
||||
'text-shadow-invalid-but-worked-in-3.12.ref.css',
|
||||
'text-shadow.ref.css',
|
||||
'text-transform.css',
|
||||
'text-transform.ref.css',
|
||||
'transform.css',
|
||||
'transform.ref.css',
|
||||
'transform-invalid1.css',
|
||||
@@ -568,6 +570,15 @@ test_data = [
|
||||
'transition.ref.css',
|
||||
'transition-timing-function.css',
|
||||
'transition-timing-function.ref.css',
|
||||
'transition-timing-function-invalid.css',
|
||||
'transition-timing-function-invalid.errors',
|
||||
'transition-timing-function-invalid.ref.css',
|
||||
'transition-timing-function-invalid2.css',
|
||||
'transition-timing-function-invalid2.errors',
|
||||
'transition-timing-function-invalid2.ref.css',
|
||||
'transition-timing-function-invalid3.css',
|
||||
'transition-timing-function-invalid3.errors',
|
||||
'transition-timing-function-invalid3.ref.css',
|
||||
'url-invalid1.css',
|
||||
'url-invalid1.errors',
|
||||
'url-invalid1.ref.css',
|
||||
|
||||
15
testsuite/css/parser/text-transform.css
Normal file
15
testsuite/css/parser/text-transform.css
Normal file
@@ -0,0 +1,15 @@
|
||||
a {
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
b {
|
||||
text-transform: lowercase;
|
||||
}
|
||||
|
||||
c {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
d {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
15
testsuite/css/parser/text-transform.ref.css
Normal file
15
testsuite/css/parser/text-transform.ref.css
Normal file
@@ -0,0 +1,15 @@
|
||||
a {
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
b {
|
||||
text-transform: lowercase;
|
||||
}
|
||||
|
||||
c {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
d {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
a {
|
||||
transition-timing-function: cubic-bezier(-1,0,1,2);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
transition-timing-function-invalid.css:2:44-46: error: GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE
|
||||
@@ -0,0 +1,3 @@
|
||||
a {
|
||||
transition-timing-function: steps(-1);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
transition-timing-function-invalid2.css:2:37-39: error: GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE
|
||||
@@ -0,0 +1,3 @@
|
||||
a {
|
||||
transition-timing-function: steps(3,middle);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
transition-timing-function-invalid3.css:2:39-45: error: GTK_CSS_PARSER_ERROR_SYNTAX
|
||||
@@ -26,6 +26,7 @@ box {
|
||||
font-feature-settings: normal;
|
||||
font-kerning: normal;
|
||||
font-size: 10px;
|
||||
font-weight: bolder;
|
||||
line-height: 12px;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ window.background:dir(ltr)
|
||||
font-size: 10px; /* font.css:28:3-19 */
|
||||
font-family: "serif"; /* font.css:20:3-41 */
|
||||
font-style: oblique; /* font.css:20:3-41 */
|
||||
font-weight: 400; /* font.css:20:3-41 */
|
||||
font-weight: 700; /* font.css:29:3-23 */
|
||||
font-stretch: expanded; /* font.css:20:3-41 */
|
||||
font-kerning: normal; /* font.css:27:3-24 */
|
||||
font-variant-position: normal; /* font.css:24:3-33 */
|
||||
@@ -38,18 +38,18 @@ window.background:dir(ltr)
|
||||
font-variant-alternates: normal; /* font.css:23:3-35 */
|
||||
font-feature-settings: normal; /* font.css:26:3-33 */
|
||||
font-variation-settings: normal; /* font.css:25:3-35 */
|
||||
line-height: 12px; /* font.css:29:3-21 */
|
||||
line-height: 12px; /* font.css:30:3-21 */
|
||||
label#label5:dir(ltr)
|
||||
font-size: 12px; /* font.css:41:3-21 */
|
||||
font-family: "21st Century"; /* font.css:33:3-29 */
|
||||
font-style: normal; /* font.css:33:3-29 */
|
||||
font-weight: 400; /* font.css:33:3-29 */
|
||||
font-stretch: normal; /* font.css:33:3-29 */
|
||||
font-kerning: auto; /* font.css:40:3-22 */
|
||||
font-variant-position: super; /* font.css:37:3-32 */
|
||||
font-variant-caps: unicase; /* font.css:34:3-30 */
|
||||
font-variant-numeric: tabular-nums diagonal-fractions; /* font.css:35:3-57 */
|
||||
font-variant-alternates: historical-forms; /* font.css:36:3-45 */
|
||||
font-feature-settings: "dlig" 0, "tnum" 0, "liga" 1, "ss01" 1; /* font.css:39:3-68 */
|
||||
font-variation-settings: "slnt" 1, "wght" 300; /* font.css:38:3-49 */
|
||||
line-height: 14.399999999999999px; /* font.css:42:3-21 */
|
||||
font-size: 12px; /* font.css:42:3-21 */
|
||||
font-family: "21st Century"; /* font.css:34:3-29 */
|
||||
font-style: normal; /* font.css:34:3-29 */
|
||||
font-weight: 400; /* font.css:34:3-29 */
|
||||
font-stretch: normal; /* font.css:34:3-29 */
|
||||
font-kerning: auto; /* font.css:41:3-22 */
|
||||
font-variant-position: super; /* font.css:38:3-32 */
|
||||
font-variant-caps: unicase; /* font.css:35:3-30 */
|
||||
font-variant-numeric: tabular-nums diagonal-fractions; /* font.css:36:3-57 */
|
||||
font-variant-alternates: historical-forms; /* font.css:37:3-45 */
|
||||
font-feature-settings: "dlig" 0, "tnum" 0, "liga" 1, "ss01" 1; /* font.css:40:3-68 */
|
||||
font-variation-settings: "slnt" 1, "wght" 300; /* font.css:39:3-49 */
|
||||
line-height: 14.399999999999999px; /* font.css:43:3-21 */
|
||||
|
||||
@@ -107,6 +107,7 @@ typedef struct {
|
||||
|
||||
static ValueTransitionTest tests[] = {
|
||||
{ GTK_CSS_PROPERTY_COLOR, "transparent", "rgb(255,0,0)", 0.25, "rgba(255,0,0,0.25)" },
|
||||
{ GTK_CSS_PROPERTY_COLOR, "alpha(red, 0.2)", "alpha(rgb(255,0,0),0.8)", 0.5, "rgba(255,0,0,0.5)" },
|
||||
{ GTK_CSS_PROPERTY_BOX_SHADOW, "none", "2px 2px 10px 4px rgb(200,200,200)", 0.5, "1px 1px 5px 2px rgba(200,200,200,0.5)" },
|
||||
{ GTK_CSS_PROPERTY_BOX_SHADOW, "2px 2px 10px 4px rgb(200,200,200)", "none", 0.5, "1px 1px 5px 2px rgba(200,200,200,0.5)" },
|
||||
{ GTK_CSS_PROPERTY_BOX_SHADOW, "2px 2px 10px 4px rgb(200,200,200), 0px 10px 8px 6px rgb(200,100,0)", "none", 0.5, "1px 1px 5px 2px rgba(200,200,200,0.5), 0px 5px 4px 3px rgba(200,100,0,0.5)" },
|
||||
|
||||
Reference in New Issue
Block a user