Title: [247927] trunk/Source/WebCore
Revision
247927
Author
[email protected]
Date
2019-07-29 16:04:43 -0700 (Mon, 29 Jul 2019)

Log Message

[LFC][TFC] Introduce Box::establishesTableFormattingContext
https://bugs.webkit.org/show_bug.cgi?id=200060

Reviewed by Antti Koivisto.

https://www.w3.org/TR/CSS22/tables.html

The table generates a principal block container box called the table wrapper box that contains the table box itself and any caption boxes.
The table box is a block-level box that contains the table's internal table boxes.
The table wrapper box is block-level for 'display: table', and inline-level; for 'display: inline-table'. The table wrapper box establishes a block
formatting context, and the table box establishes a table formatting context."

* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::establishesFormattingContext const):
(WebCore::Layout::Box::establishesTableFormattingContext const):
(WebCore::Layout::Box::isBlockLevelBox const):
(WebCore::Layout::Box::isInlineLevelBox const):
(WebCore::Layout::Box::isBlockContainerBox const):
* layout/layouttree/LayoutBox.h:
(WebCore::Layout::Box::isTableWrapperBox const):
(WebCore::Layout::Box::isTableBox const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (247926 => 247927)


--- trunk/Source/WebCore/ChangeLog	2019-07-29 22:48:30 UTC (rev 247926)
+++ trunk/Source/WebCore/ChangeLog	2019-07-29 23:04:43 UTC (rev 247927)
@@ -1,5 +1,29 @@
 2019-07-29  Zalan Bujtas  <[email protected]>
 
+        [LFC][TFC] Introduce Box::establishesTableFormattingContext
+        https://bugs.webkit.org/show_bug.cgi?id=200060
+
+        Reviewed by Antti Koivisto.
+
+        https://www.w3.org/TR/CSS22/tables.html
+
+        The table generates a principal block container box called the table wrapper box that contains the table box itself and any caption boxes.
+        The table box is a block-level box that contains the table's internal table boxes.
+        The table wrapper box is block-level for 'display: table', and inline-level; for 'display: inline-table'. The table wrapper box establishes a block
+        formatting context, and the table box establishes a table formatting context."
+
+        * layout/layouttree/LayoutBox.cpp:
+        (WebCore::Layout::Box::establishesFormattingContext const):
+        (WebCore::Layout::Box::establishesTableFormattingContext const):
+        (WebCore::Layout::Box::isBlockLevelBox const):
+        (WebCore::Layout::Box::isInlineLevelBox const):
+        (WebCore::Layout::Box::isBlockContainerBox const):
+        * layout/layouttree/LayoutBox.h:
+        (WebCore::Layout::Box::isTableWrapperBox const):
+        (WebCore::Layout::Box::isTableBox const):
+
+2019-07-29  Zalan Bujtas  <[email protected]>
+
         [ContentChangeObserver] didFinishContentChangeObserving should include the type of content change.
         https://bugs.webkit.org/show_bug.cgi?id=200247
         <rdar://problem/53681149>

Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp (247926 => 247927)


--- trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp	2019-07-29 22:48:30 UTC (rev 247926)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp	2019-07-29 23:04:43 UTC (rev 247927)
@@ -57,7 +57,7 @@
 
 bool Box::establishesFormattingContext() const
 {
-    return establishesBlockFormattingContext() || establishesInlineFormattingContext();
+    return establishesBlockFormattingContext() || establishesInlineFormattingContext() || establishesTableFormattingContext();
 }
 
 bool Box::establishesBlockFormattingContext() const
@@ -82,6 +82,11 @@
     return false;
 }
 
+bool Box::establishesTableFormattingContext() const
+{
+    return isTableBox();
+}
+
 bool Box::establishesBlockFormattingContextOnly() const
 {
     return establishesBlockFormattingContext() && !establishesInlineFormattingContext();
@@ -221,7 +226,7 @@
 {
     // Block level elements generate block level boxes.
     auto display = m_style.display();
-    return display == DisplayType::Block || display == DisplayType::ListItem || display == DisplayType::Table;
+    return display == DisplayType::Block || display == DisplayType::ListItem || (display == DisplayType::Table && !isTableWrapperBox());
 }
 
 bool Box::isInlineLevelBox() const
@@ -228,14 +233,13 @@
 {
     // Inline level elements generate inline level boxes.
     auto display = m_style.display();
-    return display == DisplayType::Inline || display == DisplayType::InlineBlock || display == DisplayType::InlineTable;
+    return display == DisplayType::Inline || isInlineBlockBox() || display == DisplayType::InlineTable;
 }
 
 bool Box::isBlockContainerBox() const
 {
-    // Inline level elements generate inline level boxes.
     auto display = m_style.display();
-    return display == DisplayType::Block || display == DisplayType::ListItem || display == DisplayType::InlineBlock || display == DisplayType::TableCell || display == DisplayType::TableCaption; // TODO && !replaced element
+    return display == DisplayType::Block || display == DisplayType::ListItem || isInlineBlockBox() || isTableWrapperBox() || isTableCell() || display == DisplayType::TableCaption; // TODO && !replaced element
 }
 
 bool Box::isInitialContainingBlock() const

Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.h (247926 => 247927)


--- trunk/Source/WebCore/layout/layouttree/LayoutBox.h	2019-07-29 22:48:30 UTC (rev 247926)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.h	2019-07-29 23:04:43 UTC (rev 247927)
@@ -45,6 +45,8 @@
     enum class ElementType {
         Document,
         Body,
+        TableWrapperBox, // The table generates a principal block container box called the table wrapper box that contains the table box and any caption boxes. 
+        TableBox, // The table box is a block-level box that contains the table's internal table boxes.
         TableCell,
         TableColumn,
         TableRow,
@@ -76,6 +78,7 @@
 
     bool establishesFormattingContext() const;
     bool establishesBlockFormattingContext() const;
+    bool establishesTableFormattingContext() const;
     bool establishesBlockFormattingContextOnly() const;
     virtual bool establishesInlineFormattingContext() const { return false; }
     virtual bool establishesInlineFormattingContextOnly() const { return false; }
@@ -113,6 +116,8 @@
 
     bool isDocumentBox() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::Document; }
     bool isBodyBox() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::Body; }
+    bool isTableWrapperBox() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::TableWrapperBox; }
+    bool isTableBox() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::TableBox; }
     bool isTableCell() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::TableCell; }
     bool isReplaced() const { return isImage() || isIFrame(); }
     bool isIFrame() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::IFrame; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to