Bug 1961010 - Use ink overflow sizes more often in view transitions. r=view-transitions-reviewers,boris

This fixes the rendering of new-content-ancestor-clipped.html (with
D245770).

Differential Revision: https://phabricator.services.mozilla.com/D245802
This commit is contained in:
Emilio Cobos Álvarez
2025-04-21 12:09:38 +00:00
parent e94e1dd416
commit e930a03b8d
18 changed files with 12 additions and 38 deletions

View File

@@ -66,6 +66,11 @@ static CSSToCSSMatrix4x4Flagged EffectiveTransform(nsIFrame* aFrame) {
float sy = boundingRect.height / untransformedSize.height; float sy = boundingRect.height / untransformedSize.height;
matrix = CSSToCSSMatrix4x4Flagged::Scaling(sx, sy, 0.0f); matrix = CSSToCSSMatrix4x4Flagged::Scaling(sx, sy, 0.0f);
} }
auto inkOverflowOffset = aFrame->InkOverflowRectRelativeToSelf().TopLeft();
if (inkOverflowOffset != nsPoint()) {
auto cssOffset = CSSPoint::FromAppUnits(inkOverflowOffset);
matrix.PostTranslate(cssOffset.x, cssOffset.y, 0.0f);
}
if (boundingRect.TopLeft() != CSSPoint()) { if (boundingRect.TopLeft() != CSSPoint()) {
matrix.PostTranslate(boundingRect.x, boundingRect.y, 0.0f); matrix.PostTranslate(boundingRect.x, boundingRect.y, 0.0f);
} }
@@ -190,7 +195,7 @@ struct CapturedElementOldState {
mTriedImage(true), mTriedImage(true),
mSize(aFrame->Style()->IsRootElementStyle() mSize(aFrame->Style()->IsRootElementStyle()
? aSnapshotContainingBlockSize ? aSnapshotContainingBlockSize
: aFrame->GetRect().Size()), : aFrame->InkOverflowRect().Size()),
mTransform(EffectiveTransform(aFrame)), mTransform(EffectiveTransform(aFrame)),
mWritingMode(aFrame->StyleVisibility()->mWritingMode), mWritingMode(aFrame->StyleVisibility()->mWritingMode),
mDirection(aFrame->StyleVisibility()->mDirection), mDirection(aFrame->StyleVisibility()->mDirection),
@@ -825,9 +830,12 @@ bool ViewTransition::UpdatePseudoElementStyles(bool aNeedsInvalidation) {
auto* rule = EnsureRule(capturedElement.mGroupRule); auto* rule = EnsureRule(capturedElement.mGroupRule);
// Let newRect be snapshot containing block if capturedElement is the // Let newRect be snapshot containing block if capturedElement is the
// document element, otherwise, capturedElements border box. // document element, otherwise, capturedElements border box.
// NOTE: Needs ink overflow rect instead to get the correct rendering, see
// https://github.com/w3c/csswg-drafts/issues/12092.
// TODO(emilio, bug 1961139): Maybe revisit this.
auto newRect = frame->Style()->IsRootElementStyle() auto newRect = frame->Style()->IsRootElementStyle()
? SnapshotContainingBlockRect() ? SnapshotContainingBlockRect()
: frame->GetRect(); : frame->InkOverflowRectRelativeToSelf();
auto size = CSSPixel::FromAppUnits(newRect); auto size = CSSPixel::FromAppUnits(newRect);
// NOTE(emilio): Intentionally not short-circuiting. Int cast is needed to // NOTE(emilio): Intentionally not short-circuiting. Int cast is needed to
// silence warning. // silence warning.

View File

@@ -1,2 +0,0 @@
[block-with-overflowing-text.html]
expected: FAIL

View File

@@ -1,2 +0,0 @@
[capture-with-opacity-zero-child.html]
expected: FAIL

View File

@@ -1,2 +0,0 @@
[capture-with-visibility-hidden-child.html]
expected: FAIL

View File

@@ -1,2 +0,0 @@
[capture-with-visibility-mixed-descendants.html]
expected: FAIL

View File

@@ -1,2 +0,0 @@
[clip-path-larger-than-border-box-on-child-of-named-element.html]
expected: FAIL

View File

@@ -1,2 +0,0 @@
[content-with-child-with-transparent-background.html]
expected: FAIL

View File

@@ -1,2 +0,0 @@
[content-with-inline-child.html]
expected: FAIL

View File

@@ -1,2 +0,0 @@
[element-with-overflow.html]
expected: FAIL

View File

@@ -1,2 +0,0 @@
[fractional-box-with-overflow-children-new.html]
expected: FAIL

View File

@@ -1,2 +0,0 @@
[fractional-box-with-overflow-children-old.html]
expected: FAIL

View File

@@ -1,4 +0,0 @@
[inline-child-with-filter.html]
expected:
if (os == "android") and debug and not swgl: [FAIL, TIMEOUT]
FAIL

View File

@@ -0,0 +1,2 @@
[new-content-preserve-3d-ancestor.html]
expected: FAIL

View File

@@ -1,2 +0,0 @@
[new-content-with-overflow.html]
expected: FAIL

View File

@@ -1,2 +0,0 @@
[no-root-capture.html]
expected: FAIL

View File

@@ -1,4 +0,0 @@
[old-content-captures-different-size.html]
expected:
if debug: [FAIL, ERROR]
FAIL

View File

@@ -1,2 +0,0 @@
[old-content-with-overflow.html]
expected: FAIL

View File

@@ -1,2 +0,0 @@
[span-with-overflowing-text.html]
expected: FAIL