Bug 1472465 - Update flattened nsDisplayOpacity geometry despite empty invalidation region r=mattwoodrow

MozReview-Commit-ID: 7mrTuQ6gEoA

--HG--
extra : rebase_source : eba482b61fe298734a0a727dc29453054131f746
This commit is contained in:
Miko Mynttinen 2018-07-16 01:09:23 +02:00
Родитель 1f7733aebe
Коммит dc2028f5bb
5 изменённых файлов: 135 добавлений и 1 удалений

Просмотреть файл

@ -4988,7 +4988,8 @@ FrameLayerBuilder::ComputeGeometryChangeForItem(DisplayItemData* aData)
// one should be fine. We always reallocate for inactive layers, since these types don't
// implement ComputeInvalidateRegion (and rely on the ComputeDifferences call in
// AddPaintedDisplayItem instead).
if (!combined.IsEmpty() || aData->mLayerState == LAYER_INACTIVE) {
if (!combined.IsEmpty() || aData->mLayerState == LAYER_INACTIVE ||
item->NeedsGeometryUpdates()) {
geometry = item->AllocateGeometry(mDisplayListBuilder);
}
aData->mClip.AddOffsetAndComputeDifference(shift, aData->mGeometry->ComputeInvalidationRegion(),

Просмотреть файл

@ -2615,6 +2615,15 @@ public:
return false;
}
/**
* Returns true if this item needs to have its geometry updated, despite
* returning empty invalidation region.
*/
virtual bool NeedsGeometryUpdates() const
{
return false;
}
/**
* Some items such as those calling into the native themed widget machinery
* have to be painted on the content process. In this case it is best to avoid
@ -5225,6 +5234,16 @@ public:
virtual bool CanApplyOpacity() const override;
virtual bool ShouldFlattenAway(nsDisplayListBuilder* aBuilder) override;
bool NeedsGeometryUpdates() const override
{
// For flattened nsDisplayOpacity items, ComputeInvalidationRegion() only
// handles invalidation for changed |mOpacity|. In order to keep track of
// the current bounds of the item for invalidation, nsDisplayOpacityGeometry
// for the corresponding DisplayItemData needs to be updated, even if the
// reported invalidation region is empty.
return mChildOpacityState == ChildOpacityState::Deferred;
}
/**
* Returns true if ShouldFlattenAway() applied opacity to children.
*/

Просмотреть файл

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Bug 1472465</title>
<style type="text/css">
#container {
border: 1px solid;
width: 500px;
height: 500px;
overflow: hidden;
}
#box {
opacity: 1.0;
position: absolute;
top: 100px
left: 100px;
z-index:1;
background-color: green;
width: 100px;
height: 100px;
}
#bg {
position:relative;
width: 2500px;
height: 2500px;
left: 0px;
top: 0px;
}
</style>
</head>
<body>
<div id="container">
<div id="bg">
<div id="box">
Text to force layer state to inactive, that will get flattened.
</div>
</div>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,68 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<meta charset="UTF-8">
<title>Bug 1472465</title>
<style type="text/css">
#container {
border: 1px solid;
width: 500px;
height: 500px;
overflow: hidden;
}
#box {
opacity: 0.1;
position: absolute;
top: 100px
left: 100px;
z-index:1;
background-color: green;
width: 100px;
height: 100px;
}
#bg {
position:relative;
width: 2500px;
height: 2500px;
left: 300px;
top: 300px;
}
</style>
<script type="text/javascript">
function changeOpacity() {
var box = document.querySelector("#box");
box.style.opacity = "1.0";
document.documentElement.removeAttribute("class");
}
function moveBg() {
var bg = document.querySelector("#bg");
bg.style.top = "0px";
bg.style.left = "0px";
setTimeout(changeOpacity, 200);
}
function doTest() {
moveBg();
}
window.addEventListener("MozReftestInvalidate", doTest);
</script>
</head>
<body>
<div id="container">
<div id="bg">
<div id="box">
Text to force layer state to inactive, that will get flattened.
</div>
</div>
</div>
</body>
</html>

Просмотреть файл

@ -2079,3 +2079,4 @@ test-pref(layout.css.prefixes.gradients,false) == 1451874.html 1451874-ref.html
== 1456111-1.html about:blank
test-pref(layout.css.contain.enabled,false) == 1466008.html 1466008-ref.html
fuzzy(1,625) == 1466638-1.html 1466638-1-ref.html
== bug1472465-1.html bug1472465-1-ref.html