Bug 1420865 - Don't check for CONTENT_MAY_CHANGE_TRANSFORM across layer trees. r?mstange
MayResample() is used on the content and compositor to determine whether the whole
visible region should be or should have been validated. This calculation is done
partially by traversing ancestor layers and looking for a flag. This can return
different values then in the content side versus the shadow side, which in this
case leads to artifacts.
This commit tries to solve the problem by ignoring layers that content is unaware
of. This works, but has the downside that resampling artifacts could show up if
the parent process is truly doing animations that require resampling.
MozReview-Commit-ID: 4TW6nzxS6E
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -458,16 +458,20 @@ Layer::SnapTransform(const Matrix4x4& aT
static bool
AncestorLayerMayChangeTransform(Layer* aLayer)
{
for (Layer* l = aLayer; l; l = l->GetParent()) {
if (l->GetContentFlags() & Layer::CONTENT_MAY_CHANGE_TRANSFORM) {
return true;
}
+
+ if (l->GetParent() && l->GetParent()->AsRefLayer()) {
+ return false;
+ }
}
return false;
}
bool
Layer::MayResample()
{
Matrix transform2d;
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -1792,16 +1792,19 @@ public:
virtual int32_t GetMaxLayerSize() { return Manager()->GetMaxTextureSize(); }
/**
* Returns true if this layer's effective transform is not just
* a translation by integers, or if this layer or some ancestor layer
* is marked as having a transform that may change without a full layer
* transaction.
+ *
+ * Note: This function ignores ancestor layers across layer tree boundaries
+ * so that it returns a consistent value when compositing and when painting.
*/
bool MayResample();
RenderTargetRect TransformRectToRenderTarget(const LayerIntRect& aRect);
/**
* Add debugging information to the layer dump.
*/