Bug 1420865 - Don't check for CONTENT_MAY_CHANGE_TRANSFORM across layer trees. r?mstange draft
authorRyan Hunt <rhunt@eqrion.net>
Mon, 07 May 2018 16:07:06 -0500
changeset 792209 32972cd7723ec673eecc4ec0f2c439862c3fb690
parent 790147 d2a4720d1c334b64d88a51678758c27ba8f03c89
push id109045
push userbmo:rhunt@eqrion.net
push dateMon, 07 May 2018 21:45:02 +0000
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;
   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.