[Webkit-unassigned] [Bug 255853] Zero rowspan should span all rows

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jul 26 13:53:00 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=255853

--- Comment #3 from Ahmad Saleem <ahmad.saleem792 at gmail.com> ---
(In reply to Ahmad Saleem from comment #2)
> It is easy to do but I am stuck on one error:
> 
> >> Source/WebCore/rendering/RenderTableCell.h:
> 
> Line 46: unsigned parsedRowSpan() const;
> 
> and update 'old' rowSpan to 'rename' and introduce new 'rowSpan' below:
> 
> 
> inline unsigned RenderTableCell::parsedRowSpan() const
> {
>     if (!m_hasRowSpan)
>         return 1;
>     return parseRowSpanFromDOM();
> }
> inline unsigned RenderTableCell::rowSpan() const
> {
>     unsigned rowSpan = parsedRowSpan();
>     if (!rowSpan) {
>         ASSERT(!section()->needsCellRecalc());
>         rowSpan = section()->numRows() - rowIndex();
>     }
>     return std::min<unsigned>(rowSpan, maxRowIndex);
> }
> 
> ______
> 
> >> Source/WebCore/rendering/RenderTableSection.cpp:
> 
> In function: (recalcCells) Line 1351:
> 
>  bool resizedGrid = false;
>     for (RenderTableRow* row = firstRow(); row; row = row->nextRow()) {
>         unsigned insertionRow = m_cRow;
>         row->setRowIndex(insertionRow);
>         setRowLogicalHeightToRowStyleLogicalHeight(m_grid[insertionRow]);
>         for (RenderTableCell* cell = row->firstCell(); cell; cell =
> cell->nextCell()) {
>             // For rowspan, "the value zero means that the cell is to span
> all the
>             // remaining rows in the row group." Calculate the size of the
> full
>             // row grid now so that we can use it to count the remaining
> rows in
>             if (!cell->parsedRowSpan() && !resizedGrid) {
>                 unsigned m_cRow = row->rowIndex() + 1;
>                 for (auto* remainingRow = row; remainingRow; remainingRow =
> remainingRow->nextRow())
>                     m_cRow++;
>                     ensureRows(m_cRow);
>                     resizedGrid = true;
>             }
>         addCell(cell, row);
>         }
>     }
> 
> 
> _______
> 
> 
> >> Source/WebCore/rendering/RenderTableRow.cpp:
> 
> In function (didInsertTableCell) <<--- here I am stuck:
> 
> if (auto* section = this->section()) {
>         section->addCell(&child, this);
>         if (beforeChild || nextRow() || !cell.parsedRowSpan())
> 
> --> Here - I get uninitialised or undefined for 'cell'.
> 
> Looking into Blink patch, it is defined as:
> 
>  LayoutTableCell* cell = ToLayoutTableCell(child);
> 
> which usually means:
> 
> 
> RenderTableCell* (or auto*) cell = downcast<RenderTableCell>(child);
> 
> ^ but it is giving error that it is 'static_assert failed due to requirement
>       '!std::is_same_v<WebCore::RenderTableCell, WebCore::RenderTableCell>'
>       "Unnecessary cast to same type"' error. :-(

I fixed it by doing:

>> Source/WebCore/rendering/RenderTableRow.cpp:

void RenderTableRow::didInsertTableCell(RenderTableCell& child, RenderObject* beforeChild)
{
    // Generated content can result in us having a null section so make sure to null check our parent.
    if (auto* section = this->section()) {
        section->addCell(&child, this);
        if (beforeChild || nextRow() || !child.parsedRowSpan())
            section->setNeedsCellRecalc();
    }
    if (auto* table = this->table())
        table->invalidateCollapsedBorders();
}

Although, it compiles, we don't pass the WPT test case, could be due to this:

https://searchfox.org/wubkat/source/Source/WebCore/html/HTMLTableCellElement.cpp#72


unsigned HTMLTableCellElement::rowSpan() const
{
    // FIXME: a rowSpan equal to 0 should be allowed, and mean that the cell is to span all the remaining rows in the row group.
    return std::max(1u, rowSpanForBindings());
}

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230726/878fe168/attachment.htm>


More information about the webkit-unassigned mailing list