Changeset 263268 in webkit


Ignore:
Timestamp:
Jun 19, 2020, 8:39:55 AM (5 years ago)
Author:
Alan Bujtas
Message:

[LFC][TFC] Do not special-case empty tables
https://bugs.webkit.org/show_bug.cgi?id=213378

Reviewed by Antti Koivisto.

Source/WebCore:

Now that min/max-width support is added, empty tables can just go through the normal width computation path.

Test: fast/layoutformattingcontext/table-min-max-width-empty-content-simple.html

  • layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp:

(WebCore::Layout::TableWrapperBlockFormattingContext::computeWidthAndMarginForTableBox):

LayoutTests:

  • fast/layoutformattingcontext/table-min-max-width-empty-content-simple-expected.html: Added.
  • fast/layoutformattingcontext/table-min-max-width-empty-content-simple.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r263266 r263268  
     12020-06-19  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][TFC] Do not special-case empty tables
     4        https://bugs.webkit.org/show_bug.cgi?id=213378
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * fast/layoutformattingcontext/table-min-max-width-empty-content-simple-expected.html: Added.
     9        * fast/layoutformattingcontext/table-min-max-width-empty-content-simple.html: Added.
     10
    1112020-06-19  Jason Lawrence  <lawrence.j@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r263265 r263268  
     12020-06-19  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][TFC] Do not special-case empty tables
     4        https://bugs.webkit.org/show_bug.cgi?id=213378
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Now that min/max-width support is added, empty tables can just go through the normal width computation path.
     9
     10        Test: fast/layoutformattingcontext/table-min-max-width-empty-content-simple.html
     11
     12        * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp:
     13        (WebCore::Layout::TableWrapperBlockFormattingContext::computeWidthAndMarginForTableBox):
     14
    1152020-06-10  Sergio Villar Senin  <svillar@igalia.com>
    216
  • trunk/Source/WebCore/layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp

    r263260 r263268  
    145145{
    146146    ASSERT(tableBox.isTableBox());
    147     if (!tableBox.hasChild()) {
    148         auto computedWidthAndMargin = geometry().computedWidthAndMargin(tableBox, horizontalConstraints, { });
    149         auto& displayBox = formattingState().displayBox(tableBox);
    150         displayBox.setContentBoxWidth(computedWidthAndMargin.contentWidth);
    151         displayBox.setHorizontalMargin(computedWidthAndMargin.usedMargin);
    152         displayBox.setHorizontalComputedMargin(computedWidthAndMargin.computedMargin);
    153         return;
    154     }
    155 
    156147    // This is a special table "fit-content size" behavior handling. Not in the spec though.
    157148    // Table returns its final width as min/max. Use this final width value to computed horizontal margins etc.
     
    161152        intrinsicWidthConstraints = *precomputedIntrinsicWidthConstraints;
    162153    else {
    163         intrinsicWidthConstraints = LayoutContext::createFormattingContext(tableBox, layoutState())->computedIntrinsicWidthConstraints();
     154        if (tableBox.hasChild())
     155            intrinsicWidthConstraints = LayoutContext::createFormattingContext(tableBox, layoutState())->computedIntrinsicWidthConstraints();
    164156        formattingStateForTableBox.setIntrinsicWidthConstraints(intrinsicWidthConstraints);
    165157    }
    166158
     159    auto availableHorizontalSpace = horizontalConstraints.logicalWidth;
    167160    auto geometry = this->geometry();
    168     auto computedWidth = geometry.computedWidth(tableBox, horizontalConstraints.logicalWidth);
    169     auto computedMaxWidth = geometry.computedMaxWidth(tableBox, horizontalConstraints.logicalWidth);
    170     auto computedMinWidth = geometry.computedMinWidth(tableBox, horizontalConstraints.logicalWidth);
     161    auto computedWidth = geometry.computedWidth(tableBox, availableHorizontalSpace);
     162    auto computedMaxWidth = geometry.computedMaxWidth(tableBox, availableHorizontalSpace);
     163    auto computedMinWidth = geometry.computedMinWidth(tableBox, availableHorizontalSpace);
    171164    // Use the generic shrink-to-fit-width logic as the initial width for the table.
    172     auto usedWidth = std::min(std::max(intrinsicWidthConstraints.minimum, horizontalConstraints.logicalWidth), intrinsicWidthConstraints.maximum);
     165    auto usedWidth = std::min(std::max(intrinsicWidthConstraints.minimum, availableHorizontalSpace), intrinsicWidthConstraints.maximum);
    173166    if (computedWidth || computedMinWidth || computedMaxWidth) {
    174167        if (computedWidth) {
Note: See TracChangeset for help on using the changeset viewer.