Changeset 286417 in webkit


Ignore:
Timestamp:
Dec 2, 2021 12:18:21 AM (8 months ago)
Author:
Martin Robinson
Message:

sticky th or td in table does not stops at specified top
https://bugs.webkit.org/show_bug.cgi?id=232431
<rdar://problem/85011818>

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

Add new WPT tests that test the behavior of sticky <td> elements in the middle of
tables.

  • web-platform-tests/css/css-position/sticky/position-sticky-table-td-bottom-expected.html: Added.
  • web-platform-tests/css/css-position/sticky/position-sticky-table-td-bottom.html: Added.
  • web-platform-tests/css/css-position/sticky/position-sticky-table-td-left-expected.html: Added.
  • web-platform-tests/css/css-position/sticky/position-sticky-table-td-left.html: Added.
  • web-platform-tests/css/css-position/sticky/position-sticky-table-td-right-expected.html: Added.
  • web-platform-tests/css/css-position/sticky/position-sticky-table-td-right.html: Added.
  • web-platform-tests/css/css-position/sticky/position-sticky-table-td-top-expected.html: Added.
  • web-platform-tests/css/css-position/sticky/position-sticky-table-td-top.html: Added.

Source/WebCore:

Tests: imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-bottom.html

imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-left.html
imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-right.html
imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-top.html

  • rendering/RenderBox.h: Make frameRectForStickyPositioning not final.
  • rendering/RenderTableCell.cpp:

(WebCore::RenderTableCell::frameRectForStickyPositioning const): Added this implementation
that takes into account that RenderTableCell is positioned relatively to the RenderTableSection.

  • rendering/RenderTableCell.h: Added method declaration.
Location:
trunk
Files:
8 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r286415 r286417  
     12021-12-02  Martin Robinson  <mrobinson@webkit.org>
     2
     3        sticky th or td in table does not stops at specified top
     4        https://bugs.webkit.org/show_bug.cgi?id=232431
     5        <rdar://problem/85011818>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Add new WPT tests that test the behavior of sticky <td> elements in the middle of
     10        tables.
     11
     12        * web-platform-tests/css/css-position/sticky/position-sticky-table-td-bottom-expected.html: Added.
     13        * web-platform-tests/css/css-position/sticky/position-sticky-table-td-bottom.html: Added.
     14        * web-platform-tests/css/css-position/sticky/position-sticky-table-td-left-expected.html: Added.
     15        * web-platform-tests/css/css-position/sticky/position-sticky-table-td-left.html: Added.
     16        * web-platform-tests/css/css-position/sticky/position-sticky-table-td-right-expected.html: Added.
     17        * web-platform-tests/css/css-position/sticky/position-sticky-table-td-right.html: Added.
     18        * web-platform-tests/css/css-position/sticky/position-sticky-table-td-top-expected.html: Added.
     19        * web-platform-tests/css/css-position/sticky/position-sticky-table-td-top.html: Added.
     20
    1212021-12-02  Manuel Rego Casasnovas  <rego@igalia.com>
    222
  • trunk/Source/WebCore/ChangeLog

    r286416 r286417  
     12021-12-02  Martin Robinson  <mrobinson@webkit.org>
     2
     3        sticky th or td in table does not stops at specified top
     4        https://bugs.webkit.org/show_bug.cgi?id=232431
     5        <rdar://problem/85011818>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Tests: imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-bottom.html
     10               imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-left.html
     11               imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-right.html
     12               imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-top.html
     13
     14        * rendering/RenderBox.h: Make frameRectForStickyPositioning not final.
     15        * rendering/RenderTableCell.cpp:
     16        (WebCore::RenderTableCell::frameRectForStickyPositioning const): Added this implementation
     17        that takes into account that RenderTableCell is positioned relatively to the RenderTableSection.
     18        * rendering/RenderTableCell.h: Added method declaration.
     19
    1202021-12-01  Carlos Garcia Campos  <cgarcia@igalia.com>
    221
  • trunk/Source/WebCore/rendering/RenderBox.h

    r286115 r286417  
    784784    virtual void computePreferredLogicalWidths();
    785785
    786     LayoutRect frameRectForStickyPositioning() const final { return frameRect(); }
     786    LayoutRect frameRectForStickyPositioning() const override { return frameRect(); }
    787787
    788788    LayoutRect computeVisibleRectUsingPaintOffset(const LayoutRect&) const;
  • trunk/Source/WebCore/rendering/RenderTableCell.cpp

    r283893 r286417  
    204204}
    205205
     206LayoutRect RenderTableCell::frameRectForStickyPositioning() const
     207{
     208    // RenderTableCell has the RenderTableRow as the container, but is positioned relatively
     209    // to the RenderTableSection. The sticky positioning algorithm assumes that elements are
     210    // positioned relatively to their container, so we correct for that here.
     211    ASSERT(parentBox());
     212    auto returnValue = frameRect();
     213    returnValue.move(-parentBox()->locationOffset());
     214    return returnValue;
     215}
     216
    206217void RenderTableCell::computeIntrinsicPadding(LayoutUnit rowHeight)
    207218{
  • trunk/Source/WebCore/rendering/RenderTableCell.h

    r283893 r286417  
    139139    void computePreferredLogicalWidths() override;
    140140
     141    LayoutRect frameRectForStickyPositioning() const override;
     142
    141143    static RenderPtr<RenderTableCell> createTableCellWithStyle(Document&, const RenderStyle&);
    142144
Note: See TracChangeset for help on using the changeset viewer.