Title: [276302] trunk/Source/WebCore
Revision
276302
Author
[email protected]
Date
2021-04-20 07:07:14 -0700 (Tue, 20 Apr 2021)

Log Message

[LFC] Implement Box::isSizeContainmentBox()
https://bugs.webkit.org/show_bug.cgi?id=224799

Reviewed by Antti Koivisto.

This is part of https://www.w3.org/TR/css-contain-2/#containment-size

* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::isSizeContainmentBox const):
* layout/layouttree/LayoutBox.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (276301 => 276302)


--- trunk/Source/WebCore/ChangeLog	2021-04-20 11:38:39 UTC (rev 276301)
+++ trunk/Source/WebCore/ChangeLog	2021-04-20 14:07:14 UTC (rev 276302)
@@ -1,3 +1,16 @@
+2021-04-20  Zalan Bujtas  <[email protected]>
+
+        [LFC] Implement Box::isSizeContainmentBox()
+        https://bugs.webkit.org/show_bug.cgi?id=224799
+
+        Reviewed by Antti Koivisto.
+
+        This is part of https://www.w3.org/TR/css-contain-2/#containment-size
+
+        * layout/layouttree/LayoutBox.cpp:
+        (WebCore::Layout::Box::isSizeContainmentBox const):
+        * layout/layouttree/LayoutBox.h:
+
 2021-04-20  Kimmo Kinnunen  <[email protected]>
 
         AudioSourceProviderAVFObjC uses atomic variables but also locks with mutex

Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp (276301 => 276302)


--- trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp	2021-04-20 11:38:39 UTC (rev 276301)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp	2021-04-20 14:07:14 UTC (rev 276302)
@@ -369,6 +369,23 @@
     return m_style.contain().contains(Containment::Layout) && supportsLayoutContainment();
 }
 
+bool Box::isSizeContainmentBox() const
+{
+    auto supportsSizeContainment = [&] {
+        // If the element does not generate a principal box (as is the case with display: contents or display: none),
+        // or its inner display type is table, or its principal box is an internal table box, or an internal ruby box,
+        // or a non-atomic inline-level box, size containment has no effect.
+        if (isInternalTableBox() || isTableBox())
+            return false;
+        if (isInternalRubyBox())
+            return false;
+        if (isInlineLevelBox())
+            return isAtomicInlineLevelBox();
+        return true;
+    };
+    return m_style.contain().contains(Containment::Size) && supportsSizeContainment();
+}
+
 bool Box::isInternalTableBox() const
 {
     // table-row-group, table-header-group, table-footer-group, table-row, table-cell, table-column-group, table-column

Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.h (276301 => 276302)


--- trunk/Source/WebCore/layout/layouttree/LayoutBox.h	2021-04-20 11:38:39 UTC (rev 276301)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.h	2021-04-20 14:07:14 UTC (rev 276302)
@@ -118,6 +118,7 @@
     bool isInlineTableBox() const;
     bool isInitialContainingBlock() const { return baseTypeFlags().contains(InitialContainingBlockFlag); }
     bool isLayoutContainmentBox() const;
+    bool isSizeContainmentBox() const;
 
     bool isDocumentBox() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::Document; }
     bool isBodyBox() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::Body; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to