Bug 1466638 - Implement support for ContainerLayerParameters::mOffset in nsDisplayImageContainer. r=mstange

This gets set to a non-zero value when we have an inactive ContainerLayer ancestor (filter in this case).
The current code assumes we'd never call BuildLayer on an image when that happen, but we force the pseudo-active
state here because background-position is animated (all properties have a transition).

MozReview-Commit-ID: 6pL8EJTNgWy

--HG--
extra : rebase_source : 6370fc79d5f47f0b5c4bbe86c0b605b90256b653
This commit is contained in:
Matt Woodrow 2018-07-09 16:11:08 +12:00
parent aaf47c33a4
commit c1d6c26906
6 changed files with 57 additions and 7 deletions

View File

@ -0,0 +1,13 @@
<style>
#a {
-webkit-transition: all 44s linear;
filter: contrast(0.052452386);
}
</style>
<script>
function go() {
a.style.setProperty("background", "url(data:i;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAA) no-repeat scroll right")
}
</script>
<body onload=go()>
<label id="a">#y

View File

@ -545,6 +545,7 @@ load 1462412.html
load 1463940.html
pref(dom.webcomponents.shadowdom.enabled,true) HTTP load 1464641.html
load 1464737.html
load 1466638.html
load 1467688.html
load 1467964.html
load 1469354.html

View File

@ -4583,12 +4583,6 @@ nsDisplayImageContainer::ConfigureLayer(ImageLayer* aLayer,
UpdateDrawResult(ImgDrawResult::SUCCESS);
}
// XXX(seth): Right now we ignore aParameters.Scale() and
// aParameters.Offset(), because FrameLayerBuilder already applies
// aParameters.Scale() via the layer's post-transform, and
// aParameters.Offset() is always zero.
MOZ_ASSERT(aParameters.Offset() == LayerIntPoint(0,0));
// It's possible (for example, due to downscale-during-decode) that the
// ImageContainer this ImageLayer is holding has a different size from the
// intrinsic size of the image. For this reason we compute the transform using
@ -4606,7 +4600,8 @@ nsDisplayImageContainer::ConfigureLayer(ImageLayer* aLayer,
LayoutDeviceIntRect::FromAppUnitsToNearest(GetDestRect(), factor));
const LayoutDevicePoint p = destRect.TopLeft();
Matrix transform = Matrix::Translation(p.x, p.y);
Matrix transform = Matrix::Translation(p.x + aParameters.mOffset.x,
p.y + aParameters.mOffset.y);
transform.PreScale(destRect.width / containerSize.width,
destRect.height / containerSize.height);
aLayer->SetBaseTransform(gfx::Matrix4x4::From2D(transform));

View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<style>
@keyframes holdBackgroundPosition {
from,to { background-position-x: 50%; }
}
#test {
height: 100px;
width: 100px;
background-repeat: no-repeat;
background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAMAAADzN3VRAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRF/wAAAAAAQaMSAwAAABJJREFUeNpiYBgFo2AwAIAAAwACigABtnCV2AAAAABJRU5ErkJggg==); /* a 25x25 px red box */
animation: holdBackgroundPosition 100s infinite;
}
#wrapper {
opacity: 0.5;
}
</style>
<div id="wrapper">
<div id="test"></div>
</div>

View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<style>
@keyframes holdBackgroundPosition {
from,to { background-position-x: 50%; }
}
#test {
height: 100px;
width: 100px;
background-repeat: no-repeat;
background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAMAAADzN3VRAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRF/wAAAAAAQaMSAwAAABJJREFUeNpiYBgFo2AwAIAAAwACigABtnCV2AAAAABJRU5ErkJggg==); /* a 25x25 px red box */
animation: holdBackgroundPosition 100s infinite;
}
#wrapper {
filter: opacity(0.5);
}
</style>
<div id="wrapper">
<div id="test"></div>
</div>

View File

@ -2077,3 +2077,4 @@ pref(layout.css.moz-document.url-prefix-hack.enabled,false) == 1446470-2.html 10
test-pref(layout.css.prefixes.gradients,false) == 1451874.html 1451874-ref.html
fuzzy-if(!(webrender&&gtkWidget),1-2,17500-17500) == 1412375.html 1412375-ref.html
test-pref(layout.css.contain.enabled,false) == 1466008.html 1466008-ref.html
fuzzy(1,625) == 1466638-1.html 1466638-1-ref.html