Title: [289241] trunk
Revision
289241
Author
[email protected]
Date
2022-02-07 14:27:35 -0800 (Mon, 07 Feb 2022)

Log Message

Updating grid gap value does not recalculate styles
https://bugs.webkit.org/show_bug.cgi?id=233252
<rdar://problem/85727334>

Reviewed by Simon Fraser.

Source/WebCore:

Both column and row gap style value change need to initiate layout in order to update their geometries.

Test: fast/dynamic/gap-style-change-should-initiate-layout.html

* rendering/style/RenderStyle.cpp:
(WebCore::rareNonInheritedDataChangeRequiresLayout):

LayoutTests:

* fast/dynamic/gap-style-change-should-initiate-layout-expected.html: Added.
* fast/dynamic/gap-style-change-should-initiate-layout.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (289240 => 289241)


--- trunk/LayoutTests/ChangeLog	2022-02-07 22:26:47 UTC (rev 289240)
+++ trunk/LayoutTests/ChangeLog	2022-02-07 22:27:35 UTC (rev 289241)
@@ -1,3 +1,14 @@
+2022-02-07  Alan Bujtas  <[email protected]>
+
+        Updating grid gap value does not recalculate styles
+        https://bugs.webkit.org/show_bug.cgi?id=233252
+        <rdar://problem/85727334>
+
+        Reviewed by Simon Fraser.
+
+        * fast/dynamic/gap-style-change-should-initiate-layout-expected.html: Added.
+        * fast/dynamic/gap-style-change-should-initiate-layout.html: Added.
+
 2022-02-07  Tyler Wilcock  <[email protected]>
 
         AX: The isolated tree needs to fix-up table cell parent relationships

Added: trunk/LayoutTests/fast/dynamic/gap-style-change-should-initiate-layout-expected.html (0 => 289241)


--- trunk/LayoutTests/fast/dynamic/gap-style-change-should-initiate-layout-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dynamic/gap-style-change-should-initiate-layout-expected.html	2022-02-07 22:27:35 UTC (rev 289241)
@@ -0,0 +1,8 @@
+<style>
+div {
+  width: 100px;
+  height: 100px;
+  background-color: green;
+}
+</style>
+<div></div>

Added: trunk/LayoutTests/fast/dynamic/gap-style-change-should-initiate-layout.html (0 => 289241)


--- trunk/LayoutTests/fast/dynamic/gap-style-change-should-initiate-layout.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dynamic/gap-style-change-should-initiate-layout.html	2022-02-07 22:27:35 UTC (rev 289241)
@@ -0,0 +1,28 @@
+<style>
+#grid {
+  width: 200px;
+  display: grid;
+  grid-template-columns: repeat(3, 1fr);
+  grid-gap: 0px;
+  overflow: hidden;
+}
+
+#flex {
+  width: 200px;
+  display: flex;
+  flex-direction: row;
+}
+
+.item {
+  width: 100px;
+  height: 100px;
+  background-color: green;
+}
+</style>
+<div id=grid><div class=item></div><div class=item></div></div>
+<div id=flex><div class=item></div><div class=item></div></div>
+<script>
+  document.body.offsetHeight;
+  grid.style.gridGap = "200px";
+  flex.style.gap = "200px";
+</script>

Modified: trunk/Source/WebCore/ChangeLog (289240 => 289241)


--- trunk/Source/WebCore/ChangeLog	2022-02-07 22:26:47 UTC (rev 289240)
+++ trunk/Source/WebCore/ChangeLog	2022-02-07 22:27:35 UTC (rev 289241)
@@ -1,3 +1,18 @@
+2022-02-07  Alan Bujtas  <[email protected]>
+
+        Updating grid gap value does not recalculate styles
+        https://bugs.webkit.org/show_bug.cgi?id=233252
+        <rdar://problem/85727334>
+
+        Reviewed by Simon Fraser.
+
+        Both column and row gap style value change need to initiate layout in order to update their geometries.
+
+        Test: fast/dynamic/gap-style-change-should-initiate-layout.html
+
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::rareNonInheritedDataChangeRequiresLayout):
+
 2022-02-07  Simon Fraser  <[email protected]>
 
         Tidy up some ImageBuffer-related classes

Modified: trunk/Source/WebCore/rendering/style/GapLength.h (289240 => 289241)


--- trunk/Source/WebCore/rendering/style/GapLength.h	2022-02-07 22:26:47 UTC (rev 289240)
+++ trunk/Source/WebCore/rendering/style/GapLength.h	2022-02-07 22:27:35 UTC (rev 289241)
@@ -56,11 +56,16 @@
     bool isNormal() const { return m_isNormal; }
     const Length& length() const { ASSERT(!m_isNormal); return m_length; }
 
-    bool operator==(const GapLength& o) const
+    bool operator==(const GapLength& other) const
     {
-        return m_isNormal == o.m_isNormal && m_length == o.m_length;
+        return m_isNormal == other.m_isNormal && m_length == other.m_length;
     }
 
+    bool operator!=(const GapLength& other) const
+    {
+        return !(*this == other);
+    }
+
 private:
     bool m_isNormal;
     Length m_length;

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (289240 => 289241)


--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2022-02-07 22:26:47 UTC (rev 289240)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2022-02-07 22:27:35 UTC (rev 289241)
@@ -664,6 +664,9 @@
     if (first.flexibleBox != second.flexibleBox)
         return true;
 
+    if (first.columnGap != second.columnGap || first.rowGap != second.rowGap)
+        return true;
+
     if (first.order != second.order
         || first.alignContent != second.alignContent
         || first.alignItems != second.alignItems
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to