Bug 1553828 - Compute intermediate bounds for transform items that do not extend 3D context r=mattwoodrow

Differential Revision: https://phabricator.services.mozilla.com/D33724

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Miko Mynttinen 2019-06-05 20:04:08 +00:00
parent 8fc077841c
commit 6f5e91c151
4 changed files with 84 additions and 9 deletions

View File

@ -1286,7 +1286,7 @@ void nsDisplayListBuilder::SetGlassDisplayItem(nsDisplayItem* aItem) {
NS_WARNING("Multiple glass backgrounds found?");
} else
#endif
if (!mHasGlassItemDuringPartial) {
if (!mHasGlassItemDuringPartial) {
mHasGlassItemDuringPartial = true;
aItem->SetIsGlassItem();
}
@ -1300,7 +1300,7 @@ void nsDisplayListBuilder::SetGlassDisplayItem(nsDisplayItem* aItem) {
NS_WARNING("Multiple glass backgrounds found?");
} else
#endif
if (!mGlassDisplayItem) {
if (!mGlassDisplayItem) {
mGlassDisplayItem = aItem;
mGlassDisplayItem->SetIsGlassItem();
}
@ -8639,22 +8639,26 @@ void nsDisplayTransform::UpdateBounds(nsDisplayListBuilder* aBuilder) {
return;
}
if (!Combines3DTransformWithAncestors()) {
if (mFrame->Extend3DContext()) {
if (mFrame->Extend3DContext()) {
if (!Combines3DTransformWithAncestors()) {
// The transform establishes a 3D context. |UpdateBoundsFor3D()| will
// collect the bounds from the child transforms.
UpdateBoundsFor3D(aBuilder);
} else {
// A stand-alone transform.
mBounds = TransformUntransformedBounds(aBuilder, GetTransform());
// With nested 3D transforms, the 2D bounds might not be useful.
mBounds = nsRect();
}
return;
}
// With nested 3D transforms, the 2D bounds might not be useful.
MOZ_ASSERT(mFrame->Combines3DTransformWithAncestors());
mBounds = nsRect();
MOZ_ASSERT(!mFrame->Extend3DContext());
// We would like to avoid calculating 2D bounds here for nested 3D transforms,
// but mix-blend-mode relies on having bounds set. See bug 1556956.
// A stand-alone transform.
mBounds = TransformUntransformedBounds(aBuilder, GetTransform());
}
void nsDisplayTransform::UpdateBoundsFor3D(nsDisplayListBuilder* aBuilder) {

View File

@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Bug 1553828</title>
<style type="text/css">
.container {
transform-style: preserve-3d;
perspective: 1000px;
width: 500px;
background-color: white;
}
.child {
width: 500px;
height: 500px;
background-color: red;
transform: translateY(0px);
mix-blend-mode: difference;
}
</style>
</head>
<body>
<div class="container">
<div class="child"></div>
</div>
</body>
</html>

View File

@ -0,0 +1,39 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Bug 1553828</title>
<style type="text/css">
.container {
transform-style: preserve-3d;
perspective: 1000px;
width: 500px;
background-color: white;
}
.child {
width: 500px;
height: 500px;
background-color: blue;
transform: translateY(0px);
mix-blend-mode: difference;
}
</style>
</head>
<body>
<div class="container">
<div class="child"></div>
</div>
<script type="text/javascript">
function doTest() {
document.querySelector(".child").style["background-color"] = "red";
document.documentElement.className = "";
}
window.addEventListener("MozReftestInvalidate", doTest);
// setTimeout(doTest, 5000);
</script>
</body>
</html>

View File

@ -42,3 +42,4 @@ fuzzy(0-2,0-40000) skip-if(!asyncPan) == 1464288-1.html 1464288-ref.html
== 1533317-1.html 1533317-1-ref.html
== 1544948-1.html 1544948-1-ref.html
== 1551053-1.html 1551053-1-ref.html
== 1553828-1.html 1553828-1-ref.html