[gtk/wip/otte/for-master: 46/46] sizerequestcache: Increase size




commit 45a051c0aa8042c147f7a3e6c251ba10c6490e70
Author: Benjamin Otte <otte redhat com>
Date:   Fri Nov 19 23:22:39 2021 +0100

    sizerequestcache: Increase size
    
    This is a quickfix to avoid infinite runtime in nested boxes with
    wrapped labels.
    
    Test included

 gtk/gtksizerequestcacheprivate.h                   |  6 +--
 testsuite/reftests/meson.build                     |  2 +
 .../reftests/wrapping-in-boxes-in-boxes.ref.ui     | 22 ++++++++
 testsuite/reftests/wrapping-in-boxes-in-boxes.ui   | 58 ++++++++++++++++++++++
 4 files changed, 85 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtksizerequestcacheprivate.h b/gtk/gtksizerequestcacheprivate.h
index 5d460ed013..8b3a3b7240 100644
--- a/gtk/gtksizerequestcacheprivate.h
+++ b/gtk/gtksizerequestcacheprivate.h
@@ -36,7 +36,7 @@ G_BEGIN_DECLS
  * only wrap to 3 lines, only 3 caches will
  * ever be allocated for it.
  */
-#define GTK_SIZE_REQUEST_CACHED_SIZES   (5)
+#define GTK_SIZE_REQUEST_CACHED_SIZES   (64)
 
 typedef struct {
   int minimum_size;
@@ -74,8 +74,8 @@ typedef struct {
   GtkSizeRequestMode request_mode   : 3;
   guint       request_mode_valid    : 1;
   struct {
-    guint       n_cached_requests   : 3;
-    guint       last_cached_request : 3;
+    guint       n_cached_requests   : 15;
+    guint       last_cached_request : 15;
     guint       cached_size_valid   : 1;
   }           flags[2];
 } SizeRequestCache;
diff --git a/testsuite/reftests/meson.build b/testsuite/reftests/meson.build
index 01f813bee5..1df038aa22 100644
--- a/testsuite/reftests/meson.build
+++ b/testsuite/reftests/meson.build
@@ -529,6 +529,8 @@ testdata = [
   #'window-show-contents-on-map.ui',
   'wrap-margin-align-critical.ref.ui',
   'wrap-margin-align-critical.ui',
+  'wrapping-in-boxes-in-boxes.ref.ui',
+  'wrapping-in-boxes-in-boxes.ui',
 ]
 
 # These need to be fixed but the issue hasn't been tracked down.
diff --git a/testsuite/reftests/wrapping-in-boxes-in-boxes.ref.ui 
b/testsuite/reftests/wrapping-in-boxes-in-boxes.ref.ui
new file mode 100644
index 0000000000..db2293bd30
--- /dev/null
+++ b/testsuite/reftests/wrapping-in-boxes-in-boxes.ref.ui
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkWindow" id="window1">
+    <property name="decorated">0</property>
+    <child>
+      <object class="GtkBox">
+        <child>
+          <object class="GtkBox">
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkLabel">
+                <property name="label" translatable="yes">Lorem ipsum dolor sit amet, consectetur adipisci 
elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud 
exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in 
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, 
sunt in culpa qui officia deserunt mollit anim id est laborum</property>
+                <property name="wrap">1</property>
+                <property name="max-width-chars">60</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/testsuite/reftests/wrapping-in-boxes-in-boxes.ui 
b/testsuite/reftests/wrapping-in-boxes-in-boxes.ui
new file mode 100644
index 0000000000..6de4a24ef4
--- /dev/null
+++ b/testsuite/reftests/wrapping-in-boxes-in-boxes.ui
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkWindow" id="window1">
+    <property name="decorated">0</property>
+    <child>
+      <object class="GtkBox">
+        <child>
+          <object class="GtkBox">
+            <property name="orientation">vertical</property>
+            <child>
+      <object class="GtkBox">
+        <child>
+          <object class="GtkBox">
+            <property name="orientation">vertical</property>
+            <child>
+      <object class="GtkBox">
+        <child>
+          <object class="GtkBox">
+            <property name="orientation">vertical</property>
+            <child>
+      <object class="GtkBox">
+        <child>
+          <object class="GtkBox">
+            <property name="orientation">vertical</property>
+            <child>
+      <object class="GtkBox">
+        <child>
+          <object class="GtkBox">
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkLabel">
+                <property name="label" translatable="yes">Lorem ipsum dolor sit amet, consectetur adipisci 
elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud 
exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in 
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, 
sunt in culpa qui officia deserunt mollit anim id est laborum</property>
+                <property name="wrap">1</property>
+                <property name="max-width-chars">60</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+        </child>
+      </object>
+    </child>
+  </object>
+        </child>
+      </object>
+    </child>
+  </object>
+        </child>
+      </object>
+    </child>
+  </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]