Changeset 282256 in webkit


Ignore:
Timestamp:
Sep 9, 2021 8:04:42 PM (10 months ago)
Author:
Alan Bujtas
Message:

[Table layout] Incorrect vertical position when the inline level box has 0px used height.
https://bugs.webkit.org/show_bug.cgi?id=230118

Reviewed by Antti Koivisto.

Source/WebCore:

Intrinsic padding is used in table cells to offset the content with their alignments as the content box may not be as tall as the cell itself.
This patch ensures that zero height content (where the baseline is also 0) gets the alignment offset as well.
(This patch also fixes the bug where we may reset the intrinsic padding to 0 on subsequent layouts.)

Test: fast/table/vertical-position-with-0-height-box.html

  • rendering/RenderTableCell.cpp:

(WebCore::RenderTableCell::computeIntrinsicPadding):

LayoutTests:

  • fast/table/vertical-position-with-0-height-box-expected.txt: Added.
  • fast/table/vertical-position-with-0-height-box.html: Added.
Location:
trunk
Files:
2 added
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r282255 r282256  
     12021-09-09  Alan Bujtas  <zalan@apple.com>
     2
     3        [Table layout] Incorrect vertical position when the inline level box has 0px used height.
     4        https://bugs.webkit.org/show_bug.cgi?id=230118
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * fast/table/vertical-position-with-0-height-box-expected.txt: Added.
     9        * fast/table/vertical-position-with-0-height-box.html: Added.
     10
    1112021-09-09  Fujii Hironori  <Hironori.Fujii@sony.com>
    212
  • trunk/LayoutTests/fast/table/table-insert-before-non-anonymous-block-expected.txt

    r263855 r282256  
    5454              RenderBlock {DIV} at (0,0) size 50x50 [bgcolor=#0000FF]
    5555              RenderBlock {DIV} at (0,50) size 50x50 [bgcolor=#0000FF]
    56             RenderTableCell {DIV} at (50,0) size 50x0 [bgcolor=#0000FF] [r=0 c=1 rs=1 cs=1]
     56            RenderTableCell {DIV} at (50,50) size 50x0 [bgcolor=#0000FF] [r=0 c=1 rs=1 cs=1]
  • trunk/LayoutTests/platform/ios/fast/css/acid2-expected.txt

    r263855 r282256  
    3636      RenderTableSection (anonymous) at (0,0) size 48x12
    3737        RenderTableRow (anonymous) at (0,0) size 48x12
    38           RenderTableCell {LI} at (0,0) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
     38          RenderTableCell {LI} at (0,12) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
    3939          RenderTableCell (anonymous) at (12,0) size 12x12 [r=0 c=1 rs=1 cs=1]
    4040            RenderTable {LI} at (0,0) size 12x12 [bgcolor=#000000]
    41           RenderTableCell {LI} at (24,0) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
     41          RenderTableCell {LI} at (24,12) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
    4242          RenderTableCell (anonymous) at (36,0) size 12x12 [r=0 c=3 rs=1 cs=1]
    4343            RenderListItem {LI} at (0,0) size 12x12 [bgcolor=#000000]
  • trunk/LayoutTests/platform/ios/fast/css/acid2-pixel-expected.txt

    r263855 r282256  
    3636      RenderTableSection (anonymous) at (0,0) size 48x12
    3737        RenderTableRow (anonymous) at (0,0) size 48x12
    38           RenderTableCell {LI} at (0,0) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
     38          RenderTableCell {LI} at (0,12) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
    3939          RenderTableCell (anonymous) at (12,0) size 12x12 [r=0 c=1 rs=1 cs=1]
    4040            RenderTable {LI} at (0,0) size 12x12 [bgcolor=#000000]
    41           RenderTableCell {LI} at (24,0) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
     41          RenderTableCell {LI} at (24,12) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
    4242          RenderTableCell (anonymous) at (36,0) size 12x12 [r=0 c=3 rs=1 cs=1]
    4343            RenderListItem {LI} at (0,0) size 12x12 [bgcolor=#000000]
  • trunk/LayoutTests/platform/ios/fast/dynamic/insert-before-table-part-in-continuation-expected.txt

    r263855 r282256  
    4141            RenderTableSection (anonymous) at (0,0) size 105x20
    4242              RenderTableRow (anonymous) at (0,0) size 105x20
    43                 RenderTableCell {TD} at (0,0) size 0x0 [r=0 c=0 rs=1 cs=1]
     43                RenderTableCell {TD} at (0,15) size 0x0 [r=0 c=0 rs=1 cs=1]
    4444                RenderTableCell {DIV} at (0,0) size 105x20 [r=0 c=1 rs=1 cs=1]
    4545                  RenderText {#text} at (0,0) size 105x19
  • trunk/LayoutTests/platform/ios/http/tests/misc/acid2-expected.txt

    r263855 r282256  
    3636      RenderTableSection (anonymous) at (0,0) size 48x12
    3737        RenderTableRow (anonymous) at (0,0) size 48x12
    38           RenderTableCell {LI} at (0,0) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
     38          RenderTableCell {LI} at (0,12) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
    3939          RenderTableCell (anonymous) at (12,0) size 12x12 [r=0 c=1 rs=1 cs=1]
    4040            RenderTable {LI} at (0,0) size 12x12 [bgcolor=#000000]
    41           RenderTableCell {LI} at (24,0) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
     41          RenderTableCell {LI} at (24,12) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
    4242          RenderTableCell (anonymous) at (36,0) size 12x12 [r=0 c=3 rs=1 cs=1]
    4343            RenderListItem {LI} at (0,0) size 12x12 [bgcolor=#000000]
  • trunk/LayoutTests/platform/ios/http/tests/misc/acid2-pixel-expected.txt

    r263855 r282256  
    3636      RenderTableSection (anonymous) at (0,0) size 48x12
    3737        RenderTableRow (anonymous) at (0,0) size 48x12
    38           RenderTableCell {LI} at (0,0) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
     38          RenderTableCell {LI} at (0,12) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
    3939          RenderTableCell (anonymous) at (12,0) size 12x12 [r=0 c=1 rs=1 cs=1]
    4040            RenderTable {LI} at (0,0) size 12x12 [bgcolor=#000000]
    41           RenderTableCell {LI} at (24,0) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
     41          RenderTableCell {LI} at (24,12) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
    4242          RenderTableCell (anonymous) at (36,0) size 12x12 [r=0 c=3 rs=1 cs=1]
    4343            RenderListItem {LI} at (0,0) size 12x12 [bgcolor=#000000]
  • trunk/LayoutTests/platform/ios/tables/mozilla/bugs/bug3037-1-expected.txt

    r263855 r282256  
    2525                                text run at (0,0) width 33: "Back"
    2626                        RenderText {#text} at (0,0) size 0x0
    27                       RenderTableCell {HTML:SPAN} at (32,0) size 0x0 [r=0 c=1 rs=1 cs=1]
     27                      RenderTableCell {HTML:SPAN} at (32,15) size 0x0 [r=0 c=1 rs=1 cs=1]
    2828                        RenderInline {HTML:INPUT} at (0,0) size 0x0
    2929                        RenderText {#text} at (0,0) size 0x0
  • trunk/LayoutTests/platform/mac/fast/css/acid2-expected.txt

    r263855 r282256  
    3636      RenderTableSection (anonymous) at (0,0) size 48x12
    3737        RenderTableRow (anonymous) at (0,0) size 48x12
    38           RenderTableCell {LI} at (0,0) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
     38          RenderTableCell {LI} at (0,12) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
    3939          RenderTableCell (anonymous) at (12,0) size 12x12 [r=0 c=1 rs=1 cs=1]
    4040            RenderTable {LI} at (0,0) size 12x12 [bgcolor=#000000]
    41           RenderTableCell {LI} at (24,0) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
     41          RenderTableCell {LI} at (24,12) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
    4242          RenderTableCell (anonymous) at (36,0) size 12x12 [r=0 c=3 rs=1 cs=1]
    4343            RenderListItem {LI} at (0,0) size 12x12 [bgcolor=#000000]
  • trunk/LayoutTests/platform/mac/fast/css/acid2-pixel-expected.txt

    r263855 r282256  
    3636      RenderTableSection (anonymous) at (0,0) size 48x12
    3737        RenderTableRow (anonymous) at (0,0) size 48x12
    38           RenderTableCell {LI} at (0,0) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
     38          RenderTableCell {LI} at (0,12) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
    3939          RenderTableCell (anonymous) at (12,0) size 12x12 [r=0 c=1 rs=1 cs=1]
    4040            RenderTable {LI} at (0,0) size 12x12 [bgcolor=#000000]
    41           RenderTableCell {LI} at (24,0) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
     41          RenderTableCell {LI} at (24,12) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
    4242          RenderTableCell (anonymous) at (36,0) size 12x12 [r=0 c=3 rs=1 cs=1]
    4343            RenderListItem {LI} at (0,0) size 12x12 [bgcolor=#000000]
  • trunk/LayoutTests/platform/mac/fast/dynamic/insert-before-table-part-in-continuation-expected.txt

    r263855 r282256  
    4141            RenderTableSection (anonymous) at (0,0) size 105x18
    4242              RenderTableRow (anonymous) at (0,0) size 105x18
    43                 RenderTableCell {TD} at (0,0) size 0x0 [r=0 c=0 rs=1 cs=1]
     43                RenderTableCell {TD} at (0,14) size 0x0 [r=0 c=0 rs=1 cs=1]
    4444                RenderTableCell {DIV} at (0,0) size 105x18 [r=0 c=1 rs=1 cs=1]
    4545                  RenderText {#text} at (0,0) size 105x18
  • trunk/LayoutTests/platform/mac/http/tests/misc/acid2-expected.txt

    r263855 r282256  
    3636      RenderTableSection (anonymous) at (0,0) size 48x12
    3737        RenderTableRow (anonymous) at (0,0) size 48x12
    38           RenderTableCell {LI} at (0,0) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
     38          RenderTableCell {LI} at (0,12) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
    3939          RenderTableCell (anonymous) at (12,0) size 12x12 [r=0 c=1 rs=1 cs=1]
    4040            RenderTable {LI} at (0,0) size 12x12 [bgcolor=#000000]
    41           RenderTableCell {LI} at (24,0) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
     41          RenderTableCell {LI} at (24,12) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
    4242          RenderTableCell (anonymous) at (36,0) size 12x12 [r=0 c=3 rs=1 cs=1]
    4343            RenderListItem {LI} at (0,0) size 12x12 [bgcolor=#000000]
  • trunk/LayoutTests/platform/mac/http/tests/misc/acid2-pixel-expected.txt

    r263855 r282256  
    3636      RenderTableSection (anonymous) at (0,0) size 48x12
    3737        RenderTableRow (anonymous) at (0,0) size 48x12
    38           RenderTableCell {LI} at (0,0) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
     38          RenderTableCell {LI} at (0,12) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
    3939          RenderTableCell (anonymous) at (12,0) size 12x12 [r=0 c=1 rs=1 cs=1]
    4040            RenderTable {LI} at (0,0) size 12x12 [bgcolor=#000000]
    41           RenderTableCell {LI} at (24,0) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
     41          RenderTableCell {LI} at (24,12) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
    4242          RenderTableCell (anonymous) at (36,0) size 12x12 [r=0 c=3 rs=1 cs=1]
    4343            RenderListItem {LI} at (0,0) size 12x12 [bgcolor=#000000]
  • trunk/LayoutTests/platform/mac/tables/mozilla/bugs/bug3037-1-expected.txt

    r263855 r282256  
    2525                                text run at (0,0) width 33: "Back"
    2626                        RenderText {#text} at (0,0) size 0x0
    27                       RenderTableCell {HTML:SPAN} at (32,0) size 0x0 [r=0 c=1 rs=1 cs=1]
     27                      RenderTableCell {HTML:SPAN} at (32,14) size 0x0 [r=0 c=1 rs=1 cs=1]
    2828                        RenderInline {HTML:INPUT} at (0,0) size 0x0
    2929                        RenderText {#text} at (0,0) size 0x0
  • trunk/Source/WebCore/ChangeLog

    r282253 r282256  
     12021-09-09  Alan Bujtas  <zalan@apple.com>
     2
     3        [Table layout] Incorrect vertical position when the inline level box has 0px used height.
     4        https://bugs.webkit.org/show_bug.cgi?id=230118
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Intrinsic padding is used in table cells to offset the content with their alignments as the content box may not be as tall as the cell itself.
     9        This patch ensures that zero height content (where the baseline is also 0) gets the alignment offset as well.
     10        (This patch also fixes the bug where we may reset the intrinsic padding to 0 on subsequent layouts.)
     11
     12        Test: fast/table/vertical-position-with-0-height-box.html
     13
     14        * rendering/RenderTableCell.cpp:
     15        (WebCore::RenderTableCell::computeIntrinsicPadding):
     16
    1172021-09-09  Diego Pino Garcia  <dpino@igalia.com>
    218
  • trunk/Source/WebCore/rendering/RenderTableCell.cpp

    r278405 r282256  
    209209    LayoutUnit logicalHeightWithoutIntrinsicPadding = logicalHeight() - oldIntrinsicPaddingBefore - oldIntrinsicPaddingAfter;
    210210
    211     LayoutUnit intrinsicPaddingBefore;
     211    auto intrinsicPaddingBefore = oldIntrinsicPaddingBefore;
    212212    switch (style().verticalAlign()) {
    213213    case VerticalAlign::Sub:
     
    217217    case VerticalAlign::Length:
    218218    case VerticalAlign::Baseline: {
    219         LayoutUnit baseline = cellBaselinePosition();
    220         if (baseline > borderAndPaddingBefore())
     219        auto baseline = cellBaselinePosition();
     220        auto needsIntrinsicPadding = baseline > borderAndPaddingBefore() || !logicalHeight();
     221        if (needsIntrinsicPadding)
    221222            intrinsicPaddingBefore = section()->rowBaseline(rowIndex()) - (baseline - oldIntrinsicPaddingBefore);
    222223        break;
Note: See TracChangeset for help on using the changeset viewer.