[libhandy] clamp: Always measure with CSS
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy] clamp: Always measure with CSS
- Date: Tue, 9 Feb 2021 15:40:19 +0000 (UTC)
commit b7b06dd9397ef613d5c59fdaf973f1278d8c10f6
Author: Adrien Plazas <kekun plazas laposte net>
Date: Tue Feb 9 15:49:11 2021 +0100
clamp: Always measure with CSS
This ensures we use CSS sizing properties for the width of a horizontal
clamp and the height of a vertical one.
src/hdy-clamp.c | 34 +++++++++++++++-------------------
1 file changed, 15 insertions(+), 19 deletions(-)
---
diff --git a/src/hdy-clamp.c b/src/hdy-clamp.c
index d0e96400..f79177fb 100644
--- a/src/hdy-clamp.c
+++ b/src/hdy-clamp.c
@@ -221,32 +221,28 @@ hdy_clamp_measure (GtkWidget *widget,
if (self->orientation == orientation) {
if (child && gtk_widget_get_visible (child))
gtk_widget_get_preferred_width (child, minimum, natural);
+ } else {
+ child_size = get_child_size (HDY_CLAMP (widget), for_size, NULL, NULL, NULL, NULL);
- return;
+ gtk_widget_get_preferred_width_for_height (child,
+ child_size,
+ minimum,
+ natural);
}
-
- child_size = get_child_size (HDY_CLAMP (widget), for_size, NULL, NULL, NULL, NULL);
-
- gtk_widget_get_preferred_width_for_height (child,
- child_size,
- minimum,
- natural);
} else {
if (self->orientation == orientation) {
if (child && gtk_widget_get_visible (child))
gtk_widget_get_preferred_height (child, minimum, natural);
-
- return;
+ } else {
+ child_size = get_child_size (HDY_CLAMP (widget), for_size, NULL, NULL, NULL, NULL);
+
+ gtk_widget_get_preferred_height_and_baseline_for_width (child,
+ child_size,
+ minimum,
+ natural,
+ minimum_baseline,
+ natural_baseline);
}
-
- child_size = get_child_size (HDY_CLAMP (widget), for_size, NULL, NULL, NULL, NULL);
-
- gtk_widget_get_preferred_height_and_baseline_for_width (child,
- child_size,
- minimum,
- natural,
- minimum_baseline,
- natural_baseline);
}
hdy_css_measure (widget, orientation, minimum, natural);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]