⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 287683 in webkit


Ignore:
Timestamp:
Jan 6, 2022, 6:33:25 AM (5 years ago)
Author:
Alan Bujtas
Message:

Ensure that the top layer is always anchored to the RenderView
https://bugs.webkit.org/show_bug.cgi?id=231292
<rdar://problem/83941854>

Reviewed by Simon Fraser.

Source/WebCore:

A fixed positioned block level box is not necessarily anchored to the RenderView (see canContainFixedPositionObjects).
This patch ensures that we skip those ancestors and return the RenderView as the containing block for the top layer content.

https://fullscreen.spec.whatwg.org/#new-stacking-layer
"If the top layer position property computes to fixed, its containing block is the viewport, and the initial containing block otherwise."

  • rendering/RenderObject.cpp:

(WebCore::RenderObject::containingBlock const):
(WebCore::containerForElement):

LayoutTests:

  • TestExpectations: offsetFromAncestorContainer expects no transformed renderer in-between the

dialog and the RenderView's layer. It will go away with the layer re-parenting work.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r287678 r287683  
     12022-01-06  Alan Bujtas  <zalan@apple.com>
     2
     3        Ensure that the top layer is always anchored to the RenderView
     4        https://bugs.webkit.org/show_bug.cgi?id=231292
     5        <rdar://problem/83941854>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * TestExpectations: offsetFromAncestorContainer expects no transformed renderer in-between the
     10        dialog and the RenderView's layer. It will go away with the layer re-parenting work.
     11
    1122022-01-05  Antoine Quint  <graouts@webkit.org>
    213
  • trunk/LayoutTests/TestExpectations

    r287663 r287683  
    23602360webkit.org/b/231292 imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-parent-overflow-clip.html [ ImageOnlyFailure ]
    23612361webkit.org/b/231292 imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-parent-overflow-scroll.html [ ImageOnlyFailure ]
    2362 webkit.org/b/231292 imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-parent-transform.html [ ImageOnlyFailure ]
     2362# Needs layer re-parenting
     2363webkit.org/b/231292 imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-parent-transform.html [ Skip ]
    23632364
    23642365# Assertion failure in MessagePort::contextDestroyed, usually attributed to later tests
  • trunk/Source/WebCore/ChangeLog

    r287681 r287683  
     12022-01-06  Alan Bujtas  <zalan@apple.com>
     2
     3        Ensure that the top layer is always anchored to the RenderView
     4        https://bugs.webkit.org/show_bug.cgi?id=231292
     5        <rdar://problem/83941854>
     6
     7        Reviewed by Simon Fraser.
     8
     9        A fixed positioned block level box is not necessarily anchored to the RenderView (see canContainFixedPositionObjects).
     10        This patch ensures that we skip those ancestors and return the RenderView as the containing block for the top layer content.
     11
     12        https://fullscreen.spec.whatwg.org/#new-stacking-layer
     13        "If the top layer position property computes to fixed, its containing block is the viewport, and the initial containing block otherwise."
     14
     15        * rendering/RenderObject.cpp:
     16        (WebCore::RenderObject::containingBlock const):
     17        (WebCore::containerForElement):
     18
    1192022-01-06  Jean-Yves Avenard  <jya@apple.com>
    220
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r287610 r287683  
    659659RenderBlock* RenderObject::containingBlock() const
    660660{
    661     auto containingBlockForRenderer = [](const RenderElement& renderer)
    662     {
     661    auto containingBlockForRenderer = [](const auto& renderer) -> RenderBlock* {
     662        if (isInTopLayerOrBackdrop(renderer.style(), renderer.element()))
     663            return &renderer.view();
    663664        if (renderer.isAbsolutelyPositioned())
    664665            return renderer.containingBlockForAbsolutePosition();
     
    14751476    if (!is<RenderElement>(renderer))
    14761477        return renderer.parent();
     1478    if (isInTopLayerOrBackdrop(renderer.style(), downcast<RenderElement>(renderer).element())) {
     1479        auto updateRepaintContainerSkippedFlagIfApplicable = [&] {
     1480            if (!repaintContainerSkipped)
     1481                return;
     1482            *repaintContainerSkipped = false;
     1483            if (repaintContainer == &renderer.view())
     1484                return;
     1485            for (auto& ancestor : ancestorsOfType<RenderElement>(renderer)) {
     1486                if (repaintContainer == &ancestor) {
     1487                    *repaintContainerSkipped = true;
     1488                    break;
     1489                }
     1490            }
     1491        };
     1492        updateRepaintContainerSkippedFlagIfApplicable();
     1493        return &renderer.view();
     1494    }
    14771495    auto position = renderer.style().position();
    14781496    if (position == PositionType::Static || position == PositionType::Relative || position == PositionType::Sticky)
Note: See TracChangeset for help on using the changeset viewer.