Title: [289561] branches/safari-613-branch
Revision
289561
Author
[email protected]
Date
2022-02-10 11:49:15 -0800 (Thu, 10 Feb 2022)

Log Message

Cherry-pick r289241. rdar://problem/85727334

    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.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289241 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Added: branches/safari-613-branch/LayoutTests/fast/dynamic/gap-style-change-should-initiate-layout-expected.html (0 => 289561)


--- branches/safari-613-branch/LayoutTests/fast/dynamic/gap-style-change-should-initiate-layout-expected.html	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/fast/dynamic/gap-style-change-should-initiate-layout-expected.html	2022-02-10 19:49:15 UTC (rev 289561)
@@ -0,0 +1,8 @@
+<style>
+div {
+  width: 100px;
+  height: 100px;
+  background-color: green;
+}
+</style>
+<div></div>

Added: branches/safari-613-branch/LayoutTests/fast/dynamic/gap-style-change-should-initiate-layout.html (0 => 289561)


--- branches/safari-613-branch/LayoutTests/fast/dynamic/gap-style-change-should-initiate-layout.html	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/fast/dynamic/gap-style-change-should-initiate-layout.html	2022-02-10 19:49:15 UTC (rev 289561)
@@ -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: branches/safari-613-branch/Source/WebCore/rendering/style/GapLength.h (289560 => 289561)


--- branches/safari-613-branch/Source/WebCore/rendering/style/GapLength.h	2022-02-10 19:49:12 UTC (rev 289560)
+++ branches/safari-613-branch/Source/WebCore/rendering/style/GapLength.h	2022-02-10 19:49:15 UTC (rev 289561)
@@ -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: branches/safari-613-branch/Source/WebCore/rendering/style/RenderStyle.cpp (289560 => 289561)


--- branches/safari-613-branch/Source/WebCore/rendering/style/RenderStyle.cpp	2022-02-10 19:49:12 UTC (rev 289560)
+++ branches/safari-613-branch/Source/WebCore/rendering/style/RenderStyle.cpp	2022-02-10 19:49:15 UTC (rev 289561)
@@ -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