Title: [248594] trunk/Source/WebCore
Revision
248594
Author
za...@apple.com
Date
2019-08-13 08:11:53 -0700 (Tue, 13 Aug 2019)

Log Message

[LFC][TFC] Add rowSpan and colSpan to Box
https://bugs.webkit.org/show_bug.cgi?id=200654
<rdar://problem/54239281>

Reviewed by Antti Koivisto.

colSpan and rowSpan are not part of the RenderStyle. We eventually need to find a more appropriate place for the "random DOM things".

* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::setRowSpan):
(WebCore::Layout::Box::setColumnSpan):
(WebCore::Layout::Box::rowSpan const):
(WebCore::Layout::Box::columnSpan const):
* layout/layouttree/LayoutBox.h:
* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::TreeBuilder::createLayoutBox):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (248593 => 248594)


--- trunk/Source/WebCore/ChangeLog	2019-08-13 10:06:16 UTC (rev 248593)
+++ trunk/Source/WebCore/ChangeLog	2019-08-13 15:11:53 UTC (rev 248594)
@@ -1,3 +1,22 @@
+2019-08-13  Zalan Bujtas  <za...@apple.com>
+
+        [LFC][TFC] Add rowSpan and colSpan to Box
+        https://bugs.webkit.org/show_bug.cgi?id=200654
+        <rdar://problem/54239281>
+
+        Reviewed by Antti Koivisto.
+
+        colSpan and rowSpan are not part of the RenderStyle. We eventually need to find a more appropriate place for the "random DOM things".
+
+        * layout/layouttree/LayoutBox.cpp:
+        (WebCore::Layout::Box::setRowSpan):
+        (WebCore::Layout::Box::setColumnSpan):
+        (WebCore::Layout::Box::rowSpan const):
+        (WebCore::Layout::Box::columnSpan const):
+        * layout/layouttree/LayoutBox.h:
+        * layout/layouttree/LayoutTreeBuilder.cpp:
+        (WebCore::Layout::TreeBuilder::createLayoutBox):
+
 2019-08-13  Youenn Fablet  <you...@apple.com>
 
         Blob registries should be keyed by session IDs

Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp (248593 => 248594)


--- trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp	2019-08-13 10:06:16 UTC (rev 248593)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp	2019-08-13 15:11:53 UTC (rev 248594)
@@ -408,6 +408,30 @@
     return rareData().replaced.get();
 }
 
+void Box::setRowSpan(unsigned rowSpan)
+{
+    ensureRareData().rowSpan = rowSpan;
+}
+
+void Box::setColumnSpan(unsigned columnSpan)
+{
+    ensureRareData().columnSpan = columnSpan;
+}
+
+unsigned Box::rowSpan() const
+{
+    if (!hasRareData())
+        return 1;
+    return rareData().rowSpan;
+}
+
+unsigned Box::columnSpan() const
+{
+    if (!hasRareData())
+        return 1;
+    return rareData().columnSpan;
+}
+
 Box::RareDataMap& Box::rareDataMap()
 {
     static NeverDestroyed<RareDataMap> map;

Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.h (248593 => 248594)


--- trunk/Source/WebCore/layout/layouttree/LayoutBox.h	2019-08-13 10:06:16 UTC (rev 248593)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.h	2019-08-13 15:11:53 UTC (rev 248594)
@@ -146,6 +146,12 @@
     bool hasTextContent() const;
     String textContent() const;
 
+    // FIXME: Find a better place for random DOM things.
+    void setRowSpan(unsigned);
+    void setColumnSpan(unsigned);
+    unsigned rowSpan() const;
+    unsigned columnSpan() const;
+
     void setParent(Container& parent) { m_parent = &parent; }
     void setNextSibling(Box& nextSibling) { m_nextSibling = &nextSibling; }
     void setPreviousSibling(Box& previousSibling) { m_previousSibling = &previousSibling; }
@@ -163,6 +169,8 @@
 
         String textContent;
         std::unique_ptr<Replaced> replaced;
+        unsigned rowSpan { 1 };
+        unsigned columnSpan { 1 };
     };
 
     bool hasRareData() const { return m_hasRareData; }

Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (248593 => 248594)


--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2019-08-13 10:06:16 UTC (rev 248593)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2019-08-13 15:11:53 UTC (rev 248594)
@@ -30,6 +30,7 @@
 
 #include "DisplayBox.h"
 #include "DisplayRun.h"
+#include "HTMLTableCellElement.h"
 #include "InlineFormattingState.h"
 #include "LayoutBox.h"
 #include "LayoutChildIterator.h"
@@ -46,6 +47,7 @@
 #include "RenderStyle.h"
 #include "RenderTable.h"
 #include "RenderTableCaption.h"
+#include "RenderTableCell.h"
 #include "RenderView.h"
 #include <wtf/text/TextStream.h>
 
@@ -178,6 +180,18 @@
             return { };
         }
     }
+
+    if (is<RenderTableCell>(renderer)) {
+        auto& cellElement = downcast<HTMLTableCellElement>(*renderer.element());
+        auto rowSpan = cellElement.rowSpan();
+        if (rowSpan > 1)
+            childLayoutBox->setRowSpan(rowSpan);
+
+        auto columnSpan = cellElement.colSpan();
+        if (columnSpan > 1)
+            childLayoutBox->setColumnSpan(columnSpan);
+    }
+
     return childLayoutBox;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to