Skip to content

Commit

Permalink
[view-transitions] Offscreen elements that are visible onscreen via t…
Browse files Browse the repository at this point in the history
…heir pseudo are not rendered

https://bugs.webkit.org/show_bug.cgi?id=273751
<rdar://127583691>

Reviewed by Tim Nguyen.

Ensure that the snapshot code doesn't skip over offscreen position:fixed layers, since
we frequently want to capture layer regardless of whether they'd be visible for normal
painting.

Don't restrict the compositing bounds to the viewport for layers that are captured
in a view transition.

* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/massive-element-below-viewport-offscreen-old.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/massive-element-on-top-of-viewport-offscreen-old.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/massive-element-right-of-viewport-offscreen-old.html:
* LayoutTests/platform/glib/TestExpectations:
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::debugDescription const):
* Source/WebCore/rendering/RenderBlock.h:
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintLayer):
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::shouldClipCompositedBounds const):

Canonical link: https://commits.webkit.org/278439@main
  • Loading branch information
mattwoodrow committed May 7, 2024
1 parent f0697eb commit b3f0213
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 12 deletions.
8 changes: 0 additions & 8 deletions LayoutTests/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -6950,23 +6950,15 @@ imported/w3c/web-platform-tests/css/css-view-transitions/fractional-box-with-ove
imported/w3c/web-platform-tests/css/css-view-transitions/fractional-box-with-shadow-new.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/fractional-box-with-shadow-old.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/inline-with-offset-from-containing-block.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/massive-element-left-of-viewport-offscreen-new.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/massive-element-left-of-viewport-partially-onscreen-new.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/massive-element-on-top-of-viewport-offscreen-old.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/massive-element-right-of-viewport-offscreen-old.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/massive-element-right-of-viewport-partially-onscreen-new.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/old-content-with-overflow-zoomed.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/root-style-change-during-animation.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/snapshot-containing-block-absolute.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/span-with-overflowing-text.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/content-with-transform-new-image.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/fractional-box-with-overflow-children-new.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/massive-element-below-viewport-offscreen-new.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/massive-element-below-viewport-offscreen-old.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/massive-element-left-of-viewport-offscreen-old.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/massive-element-left-of-viewport-partially-onscreen-old.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/massive-element-on-top-of-viewport-offscreen-new.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/massive-element-right-of-viewport-offscreen-new.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/massive-element-right-of-viewport-partially-onscreen-old.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/new-content-captures-different-size.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/new-content-with-overflow-zoomed.html [ ImageOnlyFailure ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-1/">
<link rel="author" href="mailto:khushalsagar@chromium.org">
<link rel="match" href="massive-element-below-viewport-offscreen-ref.html">
<meta name="fuzzy" content="maxDifference=0-2;totalPixels=0-445">
<meta name="fuzzy" content="maxDifference=0-2;totalPixels=0-1497">

<script src="/common/reftest-wait.js"></script>
<style>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-1/">
<link rel="author" href="mailto:khushalsagar@chromium.org">
<link rel="match" href="massive-element-on-top-of-viewport-offscreen-ref.html">
<meta name="fuzzy" content="maxDifference=0-3;totalPixels=0-330">
<meta name="fuzzy" content="maxDifference=0-16;totalPixels=0-330">

<script src="/common/reftest-wait.js"></script>
<style>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-1/">
<link rel="author" href="mailto:khushalsagar@chromium.org">
<link rel="match" href="massive-element-right-of-viewport-offscreen-ref.html">
<meta name="fuzzy" content="maxDifference=0-3;totalPixels=0-445">
<meta name="fuzzy" content="maxDifference=0-3;totalPixels=0-1497777777">

<script src="/common/reftest-wait.js"></script>
<style>
Expand Down
4 changes: 4 additions & 0 deletions LayoutTests/platform/glib/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -3912,6 +3912,10 @@ imported/w3c/web-platform-tests/css/css-view-transitions/element-is-grouping-dur
imported/w3c/web-platform-tests/css/css-view-transitions/view-transition-name-removed-mid-transition.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/modify-style-via-cssom.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/root-to-shared-animation-incoming.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/massive-element-on-top-of-viewport-offscreen-old.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/massive-element-right-of-viewport-offscreen-old.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/massive-element-below-viewport-offscreen-old.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-view-transitions/massive-element-left-of-viewport-offscreen-old.html [ ImageOnlyFailure ]

imported/w3c/web-platform-tests/svg/text/reftests/transform-dynamic-change.html [ ImageOnlyFailure ]

Expand Down
18 changes: 18 additions & 0 deletions Source/WebCore/rendering/RenderBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3108,6 +3108,24 @@ ASCIILiteral RenderBlock::renderName() const
return "RenderBlock"_s;
}

String RenderBlock::debugDescription() const
{
if (isViewTransitionPseudo()) {
StringBuilder builder;

builder.append(renderName(), " 0x"_s, hex(reinterpret_cast<uintptr_t>(this), Lowercase));

builder.append(" ::view-transition"_s);
if (style().pseudoElementType() != PseudoId::ViewTransition) {
builder.append("-"_s, style().pseudoElementType() == PseudoId::ViewTransitionGroup ? "group("_s : "image-pair("_s);
builder.append(style().pseudoElementNameArgument(), ')');
}
return builder.toString();
}

return RenderObject::debugDescription();
}

TextRun RenderBlock::constructTextRun(StringView stringView, const RenderStyle& style, ExpansionBehavior expansion, TextRunFlags flags)
{
auto textDirection = TextDirection::LTR;
Expand Down
2 changes: 2 additions & 0 deletions Source/WebCore/rendering/RenderBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@ class RenderBlock : public RenderBox {

static LayoutUnit layoutOverflowLogicalBottom(const RenderBlock&);

String debugDescription() const override;

public:
virtual void computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeFloats = false);
void clearLayoutOverflow();
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/RenderLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2902,7 +2902,7 @@ void RenderLayer::paintLayer(GraphicsContext& context, const LayerPaintingInfo&
paintFlags.add(PaintLayerFlag::TemporaryClipRects);
}

if (viewportConstrainedNotCompositedReason() == NotCompositedForBoundsOutOfView) {
if (viewportConstrainedNotCompositedReason() == NotCompositedForBoundsOutOfView && !(paintingInfo.paintBehavior & PaintBehavior::Snapshotting)) {
// Don't paint out-of-view viewport constrained layers (when doing prepainting) because they will never be visible
// unless their position or viewport size is changed.
ASSERT(renderer().isFixedPositioned());
Expand Down
5 changes: 5 additions & 0 deletions Source/WebCore/rendering/RenderLayerBacking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,11 @@ bool RenderLayerBacking::shouldClipCompositedBounds() const
return false;
#endif

if (renderer().capturedInViewTransition())
return false;
if (renderer().style().pseudoElementType() == PseudoId::ViewTransitionNew)
return false;

if (m_isFrameLayerWithTiledBacking)
return false;

Expand Down

0 comments on commit b3f0213

Please sign in to comment.