Changeset 289527 in webkit


Ignore:
Timestamp:
Feb 10, 2022 5:02:05 AM (5 months ago)
Author:
commit-queue@webkit.org
Message:

Incorrect abspos layout when toggling contain
https://bugs.webkit.org/show_bug.cgi?id=236261

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

LayoutTests/imported/w3c:

  • web-platform-tests/css/css-contain/contain-layout-020-expected.html: Added.
  • web-platform-tests/css/css-contain/contain-layout-020.html: Added.

Source/WebCore:

A change in layout containment for a container means either the container becomes
a absolute positioning containing block or ceases to be one. The method
removePositionedObjectsIfNeeded handles this, update it to take layout containment
changes into account.

Test: imported/w3c/web-platform-tests/css/css-contain/contain-layout-020.html

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::removePositionedObjectsIfNeeded):

Location:
trunk
Files:
2 added
3 edited

Legend:

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

    r289526 r289527  
     12022-02-10  Rob Buis  <rbuis@igalia.com>
     2
     3        Incorrect abspos layout when toggling contain
     4        https://bugs.webkit.org/show_bug.cgi?id=236261
     5
     6        Reviewed by Simon Fraser.
     7
     8        * web-platform-tests/css/css-contain/contain-layout-020-expected.html: Added.
     9        * web-platform-tests/css/css-contain/contain-layout-020.html: Added.
     10
    1112022-02-10  Antti Koivisto  <antti@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r289526 r289527  
     12022-02-10  Rob Buis  <rbuis@igalia.com>
     2
     3        Incorrect abspos layout when toggling contain
     4        https://bugs.webkit.org/show_bug.cgi?id=236261
     5
     6        Reviewed by Simon Fraser.
     7
     8        A change in layout containment for a container means either the container becomes
     9        a absolute positioning containing block or ceases to be one. The method
     10        removePositionedObjectsIfNeeded handles this, update it to take layout containment
     11        changes into account.
     12
     13        Test: imported/w3c/web-platform-tests/css/css-contain/contain-layout-020.html
     14
     15        * rendering/RenderBlock.cpp:
     16        (WebCore::RenderBlock::removePositionedObjectsIfNeeded):
     17
    1182022-02-10  Antti Koivisto  <antti@apple.com>
    219
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r289157 r289527  
    377377    bool hadTransform = oldStyle.hasTransformRelatedProperty();
    378378    bool willHaveTransform = newStyle.hasTransformRelatedProperty();
    379     if (oldStyle.position() == newStyle.position() && hadTransform == willHaveTransform)
     379    bool hadLayoutContainment = oldStyle.containsLayout();
     380    bool willHaveLayoutContainment = newStyle.containsLayout();
     381    if (oldStyle.position() == newStyle.position() && hadTransform == willHaveTransform && hadLayoutContainment == willHaveLayoutContainment)
    380382        return;
    381383
    382384    // We are no longer the containing block for out-of-flow descendants.
    383385    bool outOfFlowDescendantsHaveNewContainingBlock = (hadTransform && !willHaveTransform) || (newStyle.position() == PositionType::Static && !willHaveTransform);
     386    if (hadLayoutContainment != willHaveLayoutContainment)
     387        outOfFlowDescendantsHaveNewContainingBlock = hadLayoutContainment && !willHaveLayoutContainment;
    384388    if (outOfFlowDescendantsHaveNewContainingBlock) {
    385389        // Our out-of-flow descendants will be inserted into a new containing block's positioned objects list during the next layout.
Note: See TracChangeset for help on using the changeset viewer.