Bug 1501195 - Fix snapping issues caused by translation only transforms. r=jrmuizel

In nsDisplayTransform::CreateWebRenderCommands we should be rounding the
translation from the reference frame if there is no other transformation
to better match non-WebRender which performs similar rounding in
ChooseScaleAndSetTransform.

Differential Revision: https://phabricator.services.mozilla.com/D14265
This commit is contained in:
Andrew Osmond 2019-01-23 09:30:07 -05:00
parent 577b673167
commit b04c5a5091
4 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,30 @@
<html reftest-zoom="1.1">
<head>
<style type="text/css">
.parent {
display: flex;
overflow: hidden;
}
.bg {
background-color: lime;
width: 200px;
height: 200px;
transform: scale(1.05);
}
.bg_overlay {
background-color: red;
width: 100px;
height: 100px;
position: absolute;
}
</style>
</head>
<body>
<div class="parent">
<div class="bg"></div>
<div class="bg_overlay"></div>
</div>
</body>
</html>

View File

@ -0,0 +1,31 @@
<html reftest-zoom="1.1">
<head>
<style type="text/css">
.parent {
display: flex;
transform: translate3d(0px, 0px, 0px);
overflow: hidden;
}
.bg {
background-color: lime;
width: 200px;
height: 200px;
transform: scale(1.05);
}
.bg_overlay {
background-color: red;
width: 100px;
height: 100px;
position: absolute;
}
</style>
</head>
<body>
<div class="parent">
<div class="bg"></div>
<div class="bg_overlay"></div>
</div>
</body>
</html>

View File

@ -16,4 +16,5 @@ fuzzy(0-100,0-30) == 1149923.html 1149923-ref.html # use fuzzy due to few distor
== 1461313.html 1461313-ref.html
fuzzy(5-32,21908-26621) fuzzy-if(webrender,0-1,0-3) == 1463802.html 1463802-ref.html
fuzzy(0-11,0-4) == 1474722.html 1474722-ref.html
== 1501195.html 1501195-ref.html
== 1519754.html 1519754-ref.html

View File

@ -7864,6 +7864,11 @@ bool nsDisplayTransform::CreateWebRenderCommands(
// doesn't turn this stacking context into a reference frame, as it
// affects positioning. Bug 1345577 tracks a better fix.
transformForSC = nullptr;
// In ChooseScaleAndSetTransform, we round the offset from the reference
// frame used to adjust the transform, if there is no transform, or it
// is just a translation. We need to do the same here.
position.Round();
}
uint64_t animationsId = AddAnimationsForWebRender(