[Webkit-unassigned] [Bug 276591] New: Refactor `shouldScaleColumns` in `AutoTableLayout`

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Jul 14 08:31:25 PDT 2024


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

            Bug ID: 276591
           Summary: Refactor `shouldScaleColumns` in `AutoTableLayout`
           Product: WebKit
           Version: Safari Technology Preview
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Tables
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: ahmad.saleem792 at gmail.com
                CC: zalan at apple.com

Hi Team,

While going through Blink's commit, I came across another potential merge, just wanted to raise to get input, if it is good or we should come up with new method?

Blink Commit: https://chromium.googlesource.com/chromium/src/+/89679f28e6d6e9ccd751f0314cb9ba6a0b455bc0

WebKit Source: https://searchfox.org/wubkat/rev/4a199452e4f0918a290880f0698d151dee0b3009/Source/WebCore/rendering/AutoTableLayout.cpp#192

*****

static bool shouldScaleColumnsForSelf(RenderTable* table)
{
    // Normally, scale all columns to satisfy this from CSS2.2:
    // "A percentage value for a column width is relative to the table width.
    // If the table has 'width: auto', a percentage represents a constraint on the column's width"

    // A special case.  If this table is not fixed width and contained inside
    // a cell, then don't bloat the maxwidth by examining percentage growth.
    while (true) {
        Length tableWidth = table->style().width();
        if ((!tableWidth.isAuto() && !tableWidth.isPercentOrCalculated()) || table->isOutOfFlowPositioned())
            return true;
        auto* containingBlock = table->containingBlock();
        while (!is<RenderView>(*containingBlock) && !is<RenderTableCell>(*containingBlock) 
            && containingBlock->style().width().isAuto() && !containingBlock->isOutOfFlowPositioned())
            containingBlock = containingBlock->containingBlock();
        // FIXME: Should below be check for 'isFixed()'?
        if (!is<RenderTableCell>(*containingBlock) || (!!containingBlock->style().width().isAuto() && !containingBlock->style().width().isPercentOrCalculated()))
            return true;

        CheckedPtr cell = dynamicDowncast<RenderTableCell>(containingBlock);
        if (cell->colSpan() > 1 || cell->table()->style().width().isAuto())
            return false;
    }
    ASSERT_NOT_REACHED();
    return true;
}

****

This compiles and don't regress anything in 'css-tables' (WPT).

Thanks!

-- 
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/20240714/c0b48092/attachment.htm>


More information about the webkit-unassigned mailing list