Changeset 283546 in webkit


Ignore:
Timestamp:
Oct 5, 2021 5:10:00 AM (10 months ago)
Author:
Martin Robinson
Message:

[css-position-sticky] scrollIntoView should not take into account sticky positioning offsets
https://bugs.webkit.org/show_bug.cgi?id=230689

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

  • web-platform-tests/css/css-position/sticky/position-sticky-scrollIntoView-expected.txt: Update results to show newly

passing test.

Source/WebCore:

When calculating the location for absolute anchors rectangles,
do not take into account sticky offsets. This means that when
scrolling to elements that are stickily positioned, their static
positions will be targeted.

No new tests. This is covered by an existing WPT test.

  • rendering/RenderElement.cpp:

(WebCore::RenderElement::getLeadingCorner const): Do not take into account sticky position when calculating this point.
(WebCore::RenderElement::getTrailingCorner const): Ditto.

LayoutTests:

  • platform/ios-wk2/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-scrollIntoView-expected.txt: Removed.
Location:
trunk
Files:
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r283545 r283546  
     12021-10-05  Martin Robinson  <mrobinson@webkit.org>
     2
     3        [css-position-sticky] scrollIntoView should not take into account sticky positioning offsets
     4        https://bugs.webkit.org/show_bug.cgi?id=230689
     5
     6        Reviewed by Simon Fraser.
     7
     8        * platform/ios-wk2/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-scrollIntoView-expected.txt: Removed.
     9
    1102021-10-05  Youenn Fablet  <youenn@apple.com>
    211
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r283539 r283546  
     12021-10-05  Martin Robinson  <mrobinson@webkit.org>
     2
     3        [css-position-sticky] scrollIntoView should not take into account sticky positioning offsets
     4        https://bugs.webkit.org/show_bug.cgi?id=230689
     5
     6        Reviewed by Simon Fraser.
     7
     8        * web-platform-tests/css/css-position/sticky/position-sticky-scrollIntoView-expected.txt: Update results to show newly
     9        passing test.
     10
    1112021-10-05  Myles C. Maxfield  <mmaxfield@apple.com>
    212
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-scrollIntoView-expected.txt

    r280960 r283546  
    66
    77
    8 FAIL scrolling a sticky element into view should use its unshifted position assert_approx_equals: expected 1122 +/- 1 but got 561
     8PASS scrolling a sticky element into view should use its unshifted position
    99
  • trunk/Source/WebCore/ChangeLog

    r283544 r283546  
     12021-10-05  Martin Robinson  <mrobinson@webkit.org>
     2
     3        [css-position-sticky] scrollIntoView should not take into account sticky positioning offsets
     4        https://bugs.webkit.org/show_bug.cgi?id=230689
     5
     6        Reviewed by Simon Fraser.
     7
     8        When calculating the location for absolute anchors rectangles,
     9        do not take into account sticky offsets. This means that when
     10        scrolling to elements that are stickily positioned, their static
     11        positions will be targeted.
     12
     13        No new tests. This is covered by an existing WPT test.
     14
     15        * rendering/RenderElement.cpp:
     16        (WebCore::RenderElement::getLeadingCorner const): Do not take into account sticky position when calculating this point.
     17        (WebCore::RenderElement::getTrailingCorner const): Ditto.
     18
    1192021-10-05  Tim Nguyen  <ntim@apple.com>
    220
  • trunk/Source/WebCore/rendering/RenderElement.cpp

    r283464 r283546  
    16141614bool RenderElement::getLeadingCorner(FloatPoint& point, bool& insideFixed) const
    16151615{
     1616    // When scrolling elements into view, ignore sticky offsets and scroll to the static
     1617    // position of the element. See: https://drafts.csswg.org/css-position/#stickypos-scroll.
     1618    OptionSet<MapCoordinatesMode> localToAbsoluteMode { UseTransforms, IgnoreStickyOffsets };
     1619
    16161620    if (!isInline() || isReplaced()) {
    1617         point = localToAbsolute(FloatPoint(), UseTransforms, &insideFixed);
     1621        point = localToAbsolute(FloatPoint(), localToAbsoluteMode, &insideFixed);
    16181622        return true;
    16191623    }
     
    16411645
    16421646        if (!o->isInline() || o->isReplaced()) {
    1643             point = o->localToAbsolute(FloatPoint(), UseTransforms, &insideFixed);
     1647            point = o->localToAbsolute(FloatPoint(), localToAbsoluteMode, &insideFixed);
    16441648            return true;
    16451649        }
     
    16551659            } else if (is<RenderBox>(*o))
    16561660                point.moveBy(downcast<RenderBox>(*o).location());
    1657             point = o->container()->localToAbsolute(point, UseTransforms, &insideFixed);
     1661            point = o->container()->localToAbsolute(point, localToAbsoluteMode, &insideFixed);
    16581662            return true;
    16591663        }
     
    16711675bool RenderElement::getTrailingCorner(FloatPoint& point, bool& insideFixed) const
    16721676{
     1677    // When scrolling elements into view, ignore sticky offsets and scroll to the static
     1678    // position of the element. See: https://drafts.csswg.org/css-position/#stickypos-scroll.
     1679    OptionSet<MapCoordinatesMode> localToAbsoluteMode { UseTransforms, IgnoreStickyOffsets };
     1680
    16731681    if (!isInline() || isReplaced()) {
    1674         point = localToAbsolute(LayoutPoint(downcast<RenderBox>(*this).size()), UseTransforms, &insideFixed);
     1682        point = localToAbsolute(LayoutPoint(downcast<RenderBox>(*this).size()), localToAbsoluteMode, &insideFixed);
    16751683        return true;
    16761684    }
     
    17031711            } else
    17041712                point.moveBy(downcast<RenderBox>(*o).frameRect().maxXMaxYCorner());
    1705             point = o->container()->localToAbsolute(point, UseTransforms, &insideFixed);
     1713            point = o->container()->localToAbsolute(point, localToAbsoluteMode, &insideFixed);
    17061714            return true;
    17071715        }
Note: See TracChangeset for help on using the changeset viewer.