Changeset 293209 in webkit


Ignore:
Timestamp:
Apr 21, 2022 10:35:33 PM (3 months ago)
Author:
commit-queue@webkit.org
Message:

contain: layout on the html element should change position:fixed behavior
https://bugs.webkit.org/show_bug.cgi?id=238560

Patch by Rob Buis <rbuis@igalia.com> on 2022-04-21
Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

  • web-platform-tests/css/css-contain/contain-layout-021-expected.html: Added.
  • web-platform-tests/css/css-contain/contain-layout-021.html: Added.
  • web-platform-tests/css/css-contain/reference/contain-layout-021-ref.html: Added.

Source/WebCore:

The mapLocalToContainer/mapAbsoluteToLocalPoint methods need to not only consider boxes
having transforms but need to include all checks in canContainFixedPositionObjects to
determine if the box acts as a fixed position containing block.

Tests: imported/w3c/web-platform-tests/css/css-contain/contain-layout-021.html

imported/w3c/web-platform-tests/css/css-contain/reference/contain-layout-021-ref.html

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::mapLocalToContainer const):
(WebCore::RenderBox::mapAbsoluteToLocalPoint const):

  • rendering/svg/RenderSVGRoot.cpp:

(WebCore::RenderSVGRoot::mapLocalToContainer const):

Location:
trunk
Files:
4 added
4 edited

Legend:

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

    r293208 r293209  
     12022-04-21  Rob Buis  <rbuis@igalia.com>
     2
     3        `contain: layout` on the html element should change position:fixed behavior
     4        https://bugs.webkit.org/show_bug.cgi?id=238560
     5
     6        Reviewed by Simon Fraser.
     7
     8        * web-platform-tests/css/css-contain/contain-layout-021-expected.html: Added.
     9        * web-platform-tests/css/css-contain/contain-layout-021.html: Added.
     10        * web-platform-tests/css/css-contain/reference/contain-layout-021-ref.html: Added.
     11
    1122022-04-21  Chris Dumez  <cdumez@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r293208 r293209  
     12022-04-21  Rob Buis  <rbuis@igalia.com>
     2
     3        `contain: layout` on the html element should change position:fixed behavior
     4        https://bugs.webkit.org/show_bug.cgi?id=238560
     5
     6        Reviewed by Simon Fraser.
     7
     8        The mapLocalToContainer/mapAbsoluteToLocalPoint methods need to not only consider boxes
     9        having transforms but need to include all checks in canContainFixedPositionObjects to
     10        determine if the box acts as a fixed position containing block.
     11
     12        Tests: imported/w3c/web-platform-tests/css/css-contain/contain-layout-021.html
     13               imported/w3c/web-platform-tests/css/css-contain/reference/contain-layout-021-ref.html
     14
     15        * rendering/RenderBox.cpp:
     16        (WebCore::RenderBox::mapLocalToContainer const):
     17        (WebCore::RenderBox::mapAbsoluteToLocalPoint const):
     18        * rendering/svg/RenderSVGRoot.cpp:
     19        (WebCore::RenderSVGRoot::mapLocalToContainer const):
     20
    1212022-04-21  Chris Dumez  <cdumez@apple.com>
    222
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r292706 r293209  
    23212321    // If this box has a transform, it acts as a fixed position container for fixed descendants,
    23222322    // and may itself also be fixed position. So propagate 'fixed' up only if this box is fixed position.
    2323     if (hasTransform() && !isFixedPos)
     2323    if (isFixedPos)
     2324        mode.add(IsFixed);
     2325    else if (canContainFixedPositionObjects())
    23242326        mode.remove(IsFixed);
    2325     else if (isFixedPos)
    2326         mode.add(IsFixed);
    23272327
    23282328    if (wasFixed)
     
    23952395{
    23962396    bool isFixedPos = isFixedPositioned();
    2397     if (hasTransform() && !isFixedPos) {
     2397    if (isFixedPos)
     2398        mode.add(IsFixed);
     2399    else if (canContainFixedPositionObjects()) {
    23982400        // If this box has a transform, it acts as a fixed position container for fixed descendants,
    23992401        // and may itself also be fixed position. So propagate 'fixed' up only if this box is fixed position.
    24002402        mode.remove(IsFixed);
    2401     } else if (isFixedPos)
    2402         mode.add(IsFixed);
     2403    }
    24032404
    24042405    RenderBoxModelObject::mapAbsoluteToLocalPoint(mode, transformState);
  • trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp

    r292706 r293209  
    513513    // If this box has a transform, it acts as a fixed position container for fixed descendants,
    514514    // and may itself also be fixed position. So propagate 'fixed' up only if this box is fixed position.
    515     if (hasTransform() && !isFixedPos)
     515    if (isFixedPos)
     516        mode.add(IsFixed);
     517    else if (canContainFixedPositionObjects())
    516518        mode.remove(IsFixed);
    517     else if (isFixedPos)
    518         mode.add(IsFixed);
    519519
    520520    if (wasFixed)
Note: See TracChangeset for help on using the changeset viewer.