Changeset 248594 in webkit


Ignore:
Timestamp:
Aug 13, 2019 8:11:53 AM (5 years ago)
Author:
Alan Bujtas
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):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r248593 r248594  
     12019-08-13  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][TFC] Add rowSpan and colSpan to Box
     4        https://bugs.webkit.org/show_bug.cgi?id=200654
     5        <rdar://problem/54239281>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        colSpan and rowSpan are not part of the RenderStyle. We eventually need to find a more appropriate place for the "random DOM things".
     10
     11        * layout/layouttree/LayoutBox.cpp:
     12        (WebCore::Layout::Box::setRowSpan):
     13        (WebCore::Layout::Box::setColumnSpan):
     14        (WebCore::Layout::Box::rowSpan const):
     15        (WebCore::Layout::Box::columnSpan const):
     16        * layout/layouttree/LayoutBox.h:
     17        * layout/layouttree/LayoutTreeBuilder.cpp:
     18        (WebCore::Layout::TreeBuilder::createLayoutBox):
     19
    1202019-08-13  Youenn Fablet  <youenn@apple.com>
    221
  • trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp

    r248364 r248594  
    409409}
    410410
     411void Box::setRowSpan(unsigned rowSpan)
     412{
     413    ensureRareData().rowSpan = rowSpan;
     414}
     415
     416void Box::setColumnSpan(unsigned columnSpan)
     417{
     418    ensureRareData().columnSpan = columnSpan;
     419}
     420
     421unsigned Box::rowSpan() const
     422{
     423    if (!hasRareData())
     424        return 1;
     425    return rareData().rowSpan;
     426}
     427
     428unsigned Box::columnSpan() const
     429{
     430    if (!hasRareData())
     431        return 1;
     432    return rareData().columnSpan;
     433}
     434
    411435Box::RareDataMap& Box::rareDataMap()
    412436{
  • trunk/Source/WebCore/layout/layouttree/LayoutBox.h

    r248290 r248594  
    147147    String textContent() const;
    148148
     149    // FIXME: Find a better place for random DOM things.
     150    void setRowSpan(unsigned);
     151    void setColumnSpan(unsigned);
     152    unsigned rowSpan() const;
     153    unsigned columnSpan() const;
     154
    149155    void setParent(Container& parent) { m_parent = &parent; }
    150156    void setNextSibling(Box& nextSibling) { m_nextSibling = &nextSibling; }
     
    164170        String textContent;
    165171        std::unique_ptr<Replaced> replaced;
     172        unsigned rowSpan { 1 };
     173        unsigned columnSpan { 1 };
    166174    };
    167175
  • trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp

    r248364 r248594  
    3131#include "DisplayBox.h"
    3232#include "DisplayRun.h"
     33#include "HTMLTableCellElement.h"
    3334#include "InlineFormattingState.h"
    3435#include "LayoutBox.h"
     
    4748#include "RenderTable.h"
    4849#include "RenderTableCaption.h"
     50#include "RenderTableCell.h"
    4951#include "RenderView.h"
    5052#include <wtf/text/TextStream.h>
     
    179181        }
    180182    }
     183
     184    if (is<RenderTableCell>(renderer)) {
     185        auto& cellElement = downcast<HTMLTableCellElement>(*renderer.element());
     186        auto rowSpan = cellElement.rowSpan();
     187        if (rowSpan > 1)
     188            childLayoutBox->setRowSpan(rowSpan);
     189
     190        auto columnSpan = cellElement.colSpan();
     191        if (columnSpan > 1)
     192            childLayoutBox->setColumnSpan(columnSpan);
     193    }
     194
    181195    return childLayoutBox;
    182196}
Note: See TracChangeset for help on using the changeset viewer.