Title: [251136] trunk/Source/WebCore
Revision
251136
Author
za...@apple.com
Date
2019-10-15 08:03:03 -0700 (Tue, 15 Oct 2019)

Log Message

[LFC][TFC] Add <col> element's width attribute value to Layout::Box rare data
https://bugs.webkit.org/show_bug.cgi?id=202988
<rdar://problem/56291048>

Reviewed by Antti Koivisto.

Sadly RenderStyle does not have this value.

* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::setColumnWidth):
(WebCore::Layout::Box::columnWidth const):
* layout/layouttree/LayoutBox.h:
* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::TreeBuilder::createLayoutBox):
(WebCore::Layout::outputLayoutBox):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (251135 => 251136)


--- trunk/Source/WebCore/ChangeLog	2019-10-15 14:47:10 UTC (rev 251135)
+++ trunk/Source/WebCore/ChangeLog	2019-10-15 15:03:03 UTC (rev 251136)
@@ -1,5 +1,23 @@
 2019-10-15  Zalan Bujtas  <za...@apple.com>
 
+        [LFC][TFC] Add <col> element's width attribute value to Layout::Box rare data
+        https://bugs.webkit.org/show_bug.cgi?id=202988
+        <rdar://problem/56291048>
+
+        Reviewed by Antti Koivisto.
+
+        Sadly RenderStyle does not have this value.
+
+        * layout/layouttree/LayoutBox.cpp:
+        (WebCore::Layout::Box::setColumnWidth):
+        (WebCore::Layout::Box::columnWidth const):
+        * layout/layouttree/LayoutBox.h:
+        * layout/layouttree/LayoutTreeBuilder.cpp:
+        (WebCore::Layout::TreeBuilder::createLayoutBox):
+        (WebCore::Layout::outputLayoutBox):
+
+2019-10-15  Zalan Bujtas  <za...@apple.com>
+
         [LFC] Adjust computed height value when box sizing is border-box
         https://bugs.webkit.org/show_bug.cgi?id=202965
         <rdar://problem/56276771>

Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp (251135 => 251136)


--- trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp	2019-10-15 14:47:10 UTC (rev 251135)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp	2019-10-15 15:03:03 UTC (rev 251136)
@@ -439,6 +439,18 @@
     return rareData().columnSpan;
 }
 
+void Box::setColumnWidth(LayoutUnit columnWidth)
+{
+    ensureRareData().columnWidth = columnWidth;
+}
+
+Optional<LayoutUnit> Box::columnWidth() const
+{
+    if (!hasRareData())
+        return { };
+    return rareData().columnWidth;
+}
+
 Box::RareDataMap& Box::rareDataMap()
 {
     static NeverDestroyed<RareDataMap> map;

Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.h (251135 => 251136)


--- trunk/Source/WebCore/layout/layouttree/LayoutBox.h	2019-10-15 14:47:10 UTC (rev 251135)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.h	2019-10-15 15:03:03 UTC (rev 251136)
@@ -146,10 +146,14 @@
 
     // FIXME: Find a better place for random DOM things.
     void setRowSpan(unsigned);
+    unsigned rowSpan() const;
+
     void setColumnSpan(unsigned);
-    unsigned rowSpan() const;
     unsigned columnSpan() const;
 
+    void setColumnWidth(LayoutUnit);
+    Optional<LayoutUnit> columnWidth() const;
+
     void setParent(Container& parent) { m_parent = &parent; }
     void setNextSibling(Box& nextSibling) { m_nextSibling = &nextSibling; }
     void setPreviousSibling(Box& previousSibling) { m_previousSibling = &previousSibling; }
@@ -171,6 +175,7 @@
         std::unique_ptr<Replaced> replaced;
         unsigned rowSpan { 1 };
         unsigned columnSpan { 1 };
+        Optional<LayoutUnit> columnWidth;
     };
 
     bool hasRareData() const { return m_hasRareData; }

Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (251135 => 251136)


--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2019-10-15 14:47:10 UTC (rev 251135)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2019-10-15 15:03:03 UTC (rev 251136)
@@ -31,6 +31,7 @@
 #include "DisplayBox.h"
 #include "DisplayRun.h"
 #include "HTMLTableCellElement.h"
+#include "HTMLTableColElement.h"
 #include "InlineFormattingState.h"
 #include "LayoutBox.h"
 #include "LayoutChildIterator.h"
@@ -182,8 +183,13 @@
         else if (displayType == DisplayType::TableCaption || displayType == DisplayType::TableCell) {
             childLayoutBox = makeUnique<Container>(elementAttributes(renderer), RenderStyle::clone(renderer.style()));
         } else if (displayType == DisplayType::TableRowGroup || displayType == DisplayType::TableHeaderGroup || displayType == DisplayType::TableFooterGroup
-            || displayType == DisplayType::TableRow || displayType == DisplayType::TableColumnGroup || displayType == DisplayType::TableColumn) {
+            || displayType == DisplayType::TableRow || displayType == DisplayType::TableColumnGroup) {
             childLayoutBox = makeUnique<Container>(elementAttributes(renderer), RenderStyle::clone(renderer.style()));
+        } else if (displayType == DisplayType::TableColumn) {
+            childLayoutBox = makeUnique<Container>(elementAttributes(renderer), RenderStyle::clone(renderer.style()));
+            auto columnWidth = static_cast<HTMLTableColElement&>(*renderer.element()).width();
+            if (!columnWidth.isEmpty())
+                childLayoutBox->setColumnWidth(columnWidth.toInt());
         } else {
             ASSERT_NOT_IMPLEMENTED_YET();
             return { };
@@ -311,6 +317,10 @@
         stream << "TBODY";
     else if (layoutBox.isTableFooter())
         stream << "TFOOT";
+    else if (layoutBox.isTableColumnGroup())
+        stream << "COL GROUP";
+    else if (layoutBox.isTableColumn())
+        stream << "COL";
     else if (layoutBox.isTableCell())
         stream << "TD";
     else if (layoutBox.isTableRow())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to