[webkit-changes] [WebKit/WebKit] 2e0c7a: [view-transitions] Support view transitions on top...

mattwoodrow noreply at github.com
Thu May 2 07:37:55 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2e0c7a1325e77dfe9a67c60778af5ce27efa4c78
      https://github.com/WebKit/WebKit/commit/2e0c7a1325e77dfe9a67c60778af5ce27efa4c78
  Author: Matt Woodrow <mattwoodrow at apple.com>
  Date:   2024-05-02 (Thu, 02 May 2024)

  Changed paths:
    M LayoutTests/TestExpectations
    A LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/dialog-in-rtl-iframe-old-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/dialog-in-rtl-iframe-old-ref.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/dialog-in-rtl-iframe-old.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/support/dialog-in-rtl-iframe-child-old.html
    M LayoutTests/platform/glib/TestExpectations
    M LayoutTests/platform/gtk/TestExpectations
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Document.h
    M Source/WebCore/dom/ViewTransition.cpp
    M Source/WebCore/dom/ViewTransition.h
    M Source/WebCore/rendering/RenderElement.cpp
    M Source/WebCore/rendering/RenderElement.h
    M Source/WebCore/rendering/RenderLayer.cpp
    M Source/WebCore/rendering/RenderLayerBacking.cpp
    M Source/WebCore/rendering/RenderLayerBacking.h
    M Source/WebCore/rendering/RenderLayerCompositor.cpp

  Log Message:
  -----------
  [view-transitions] Support view transitions on top layer elements
https://bugs.webkit.org/show_bug.cgi?id=265169
<rdar://118667007>

Reviewed by Tim Nguyen.

If the captured element is the document element, then the captured images should be
of the RenderView instead.

We already adjust the sizing to that of the view, this changes the actual snapshots to
happen from the view so that the top layer is included.

Changes the layer parenting for the new snapshot so that the RenderView's layer gets added
to the ::view-transition-new(pseudo), and the ::view-transition root pseudo get directly
parented in place of the RenderView.

The render tree for this situation is this:

Content-root
     |
 RenderView
   /     \
<html>   ::view-transition
            \
           ::view-transition-group(root)
             |
           ::view-transition-image-pair(root)
             |
           ::view-transition-new(root)

We want to build a GraphicsLayer tree where the RenderView and all its contents (except the view-transition
tree) are attached to the ::view-transition-new.

Content-root
     |
::view-transition
     |
::view-transition-group(root)
     |
::view-transition-image-pair(root)
     |
::view-transition-new(root)
     |
 RenderView
     |
   <html>

This happens by:

RenderLayerCompositor::collectViewTransitionNewContentLayers detects when the captured element is the <html>,
and adjusts to reparent the RenderView instead. This ensures the 'top layer' is included, as required.

RenderLayerCompositor::updateBackingAndHierarchy skips attaching the ::view-transition's GraphicsLayer
to the parent obtained via the RenderLayer hierarchy (the RenderView's layer).

RenderLayerBacking::childForSuperlayers detects when it's a RenderView and will already be attached to
the ::view-transition-new, and forwards the request through to the ::view-transition's RenderLayer,
so that ::view-transition gets attached to the parent of the RenderView instead.

Adds a new test for the ::view-transition-old(root) case.

* LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/dialog-in-rtl-iframe-old-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/dialog-in-rtl-iframe-old-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/dialog-in-rtl-iframe-old.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/support/dialog-in-rtl-iframe-child-old.html: Added.
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::activeViewTransitionCapturedDocumentElement const):
* Source/WebCore/dom/Document.h:
* Source/WebCore/dom/ViewTransition.cpp:
(WebCore::snapshotElementVisualOverflowClippedToViewport):
(WebCore::ViewTransition::documentElementIsCaptured const):
* Source/WebCore/dom/ViewTransition.h:
* Source/WebCore/rendering/RenderElement.cpp:
(WebCore::RenderElement::isViewTransitionRoot const):
* Source/WebCore/rendering/RenderElement.h:
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintList):
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::childForSuperlayers const):
(WebCore::RenderLayerBacking::childForSuperlayersExcludingViewTransitions const):
* Source/WebCore/rendering/RenderLayerBacking.h:
* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::collectViewTransitionNewContentLayers):
(WebCore::RenderLayerCompositor::updateBackingAndHierarchy):

Canonical link: https://commits.webkit.org/278256@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list