Changeset 282138 in webkit


Ignore:
Timestamp:
Sep 8, 2021 4:48:25 AM (11 months ago)
Author:
Martin Robinson
Message:

[css-position-sticky] Sticky constraints are calculated incorrectly when scrolling container has padding and borders
https://bugs.webkit.org/show_bug.cgi?id=229997

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

  • web-platform-tests/css/css-position/sticky/position-sticky-large-top-2.tentative-expected.html: This test uses

an identity transform to make a div a containing block for absolutely positioned items. This exposes a bug in
WebKit, but position: relative also does this without exposing the bug. The bug for this issue is
https://bugs.webkit.org/show_bug.cgi?id=229999.

  • web-platform-tests/css/css-position/sticky/position-sticky-large-top.tentative-expected.html: Ditto.

Source/WebCore:

No new tests. This is covered by two existing WPT tests:

web-platform-tests/css/css-position/sticky/position-sticky-large-top-2.tentative-expected.html
web-platform-tests/css/css-position/sticky/position-sticky-large-top.tentative-expected.html

  • rendering/RenderBoxModelObject.cpp:

(WebCore::RenderBoxModelObject::computeStickyPositionConstraints const): When the containing block and the scroll container
are the same, fix the calculation of the container content rect. layoutOverflowRect() already does not include the border,
so stop adjusting for that. In addition, instead of simply adjusting the rect location by the padding, actually contract
it so that the bottom and right edges of the rectangle are correct.

LayoutTests:

  • TestExpectations: Unskip two newly passing tests.
  • platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-expected.txt: Rebaseline.
  • platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-gain-scrolling-ancestor-expected.txt: Ditto.
  • platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-in-fixed-expected.txt: Ditto.
  • platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-lose-scrolling-ancestor-expected.txt: Ditto.
Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r282136 r282138  
     12021-09-08  Martin Robinson  <mrobinson@webkit.org>
     2
     3        [css-position-sticky] Sticky constraints are calculated incorrectly when scrolling container has padding and borders
     4        https://bugs.webkit.org/show_bug.cgi?id=229997
     5
     6        Reviewed by Simon Fraser.
     7
     8        * TestExpectations: Unskip two newly passing tests.
     9        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-expected.txt: Rebaseline.
     10        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-gain-scrolling-ancestor-expected.txt: Ditto.
     11        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-in-fixed-expected.txt: Ditto.
     12        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-lose-scrolling-ancestor-expected.txt: Ditto.
     13
    1142021-09-08  Kimmo Kinnunen  <kkinnunen@apple.com>
    215
  • trunk/LayoutTests/TestExpectations

    r282133 r282138  
    34873487webkit.org/b/228993 imported/w3c/web-platform-tests/css/css-position/multicol/static-position/vrl-rtl-rtl-in-multicol.html [ ImageOnlyFailure ]
    34883488webkit.org/b/203450 imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-writing-modes.html [ ImageOnlyFailure ]
    3489 webkit.org/b/203450 imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-large-top-2.tentative.html [ ImageOnlyFailure ]
    3490 webkit.org/b/203450 imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-large-top.tentative.html [ ImageOnlyFailure ]
    34913489webkit.org/b/203450 imported/w3c/web-platform-tests/css/css-position/sticky/sticky-after-input.html [ Failure ]
    34923490webkit.org/b/203451 imported/w3c/web-platform-tests/css/css-position/static-position/htb-ltr-ltr.html [ ImageOnlyFailure ]
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r282133 r282138  
     12021-09-08  Martin Robinson  <mrobinson@webkit.org>
     2
     3        [css-position-sticky] Sticky constraints are calculated incorrectly when scrolling container has padding and borders
     4        https://bugs.webkit.org/show_bug.cgi?id=229997
     5
     6        Reviewed by Simon Fraser.
     7
     8        * web-platform-tests/css/css-position/sticky/position-sticky-large-top-2.tentative-expected.html: This test uses
     9        an identity transform to make a div a containing block for absolutely positioned items. This exposes a bug in
     10        WebKit, but position: relative also does this without exposing the bug. The bug for this issue is
     11        https://bugs.webkit.org/show_bug.cgi?id=229999.
     12        * web-platform-tests/css/css-position/sticky/position-sticky-large-top.tentative-expected.html: Ditto.
     13
    1142021-09-08  Tim Nguyen  <ntim@apple.com>
    215
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-large-top-2.tentative-expected.html

    r280960 r282138  
    1313    height: 200px;
    1414    width: 200px;
    15     transform: scale(1);
     15    position: relative;
    1616  }
    1717
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-large-top.tentative-expected.html

    r280960 r282138  
    1212    height: 200px;
    1313    width: 200px;
    14     transform: scale(1);
     14    position: relative;
    1515  }
    1616
  • trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-expected.txt

    r271070 r282138  
    4242                  (top offset 10.00)
    4343                  (bottom offset 10.00)
    44                   (containing block rect at (2,2) size 400x1760)
     44                  (containing block rect at (0,0) size 400x1760)
    4545                  (sticky box rect at (0,830) size 100x100)
    4646                  (constraining rect at (0,0) size 400x300)
  • trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-gain-scrolling-ancestor-expected.txt

    r271070 r282138  
    4747                      (top offset 10.00)
    4848                      (bottom offset 10.00)
    49                       (containing block rect at (2,2) size 400x1760)
     49                      (containing block rect at (0,0) size 400x1760)
    5050                      (sticky box rect at (0,830) size 100x100)
    5151                      (constraining rect at (0,0) size 400x300)
  • trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-in-fixed-expected.txt

    r271070 r282138  
    4747                      (top offset 10.00)
    4848                      (bottom offset 10.00)
    49                       (containing block rect at (2,2) size 400x1760)
     49                      (containing block rect at (0,0) size 400x1760)
    5050                      (sticky box rect at (0,830) size 100x100)
    5151                      (constraining rect at (0,0) size 400x300)
  • trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-lose-scrolling-ancestor-expected.txt

    r271070 r282138  
    4242                  (top offset 10.00)
    4343                  (bottom offset 10.00)
    44                   (containing block rect at (2,2) size 400x1760)
     44                  (containing block rect at (0,0) size 400x1760)
    4545                  (sticky box rect at (0,830) size 100x100)
    4646                  (constraining rect at (0,0) size 400x300)
  • trunk/Source/WebCore/ChangeLog

    r282137 r282138  
     12021-09-08  Martin Robinson  <mrobinson@webkit.org>
     2
     3        [css-position-sticky] Sticky constraints are calculated incorrectly when scrolling container has padding and borders
     4        https://bugs.webkit.org/show_bug.cgi?id=229997
     5
     6        Reviewed by Simon Fraser.
     7
     8        No new tests. This is covered by two existing WPT tests:
     9            web-platform-tests/css/css-position/sticky/position-sticky-large-top-2.tentative-expected.html
     10            web-platform-tests/css/css-position/sticky/position-sticky-large-top.tentative-expected.html
     11
     12        * rendering/RenderBoxModelObject.cpp:
     13        (WebCore::RenderBoxModelObject::computeStickyPositionConstraints const): When the containing block and the scroll container
     14        are the same, fix the calculation of the container content rect. layoutOverflowRect() already does not include the border,
     15        so stop adjusting for that. In addition, instead of simply adjusting the rect location by the padding, actually contract
     16        it so that the bottom and right edges of the rectangle are correct.
     17
    1182021-09-08  Jean-Yves Avenard  <jya@apple.com>
    219
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r282069 r282138  
    470470    } else {
    471471        containerContentRect = containingBlock->layoutOverflowRect();
    472         LayoutPoint containerLocation = containerContentRect.location() + LayoutPoint(containingBlock->borderLeft() + containingBlock->paddingLeft(),
    473             containingBlock->borderTop() + containingBlock->paddingTop());
    474         containerContentRect.setLocation(containerLocation);
     472        containerContentRect.contract(LayoutBoxExtent {
     473            containingBlock->computedCSSPaddingTop(), containingBlock->computedCSSPaddingRight(),
     474            containingBlock->computedCSSPaddingBottom(), containingBlock->computedCSSPaddingLeft() });
    475475    }
    476476
Note: See TracChangeset for help on using the changeset viewer.