Bug 1147673 - Relax the ancestor transform assertion a little. r?kats draft
authorMarkus Stange <mstange@themasta.com>
Tue, 22 Dec 2015 17:06:04 +0100
changeset 317022 bc7c6aa6d8cbae1337487fb2d772183fc827daad
parent 317021 027065697e7e0ef445d8bcf7a81cf0270dcf7b8b
child 512243 8c2724ee8d9c598abda28f3e969f09eccf9d7a96
push id8639
push usermstange@themasta.com
push dateTue, 22 Dec 2015 16:07:26 +0000
reviewerskats
bugs1147673
milestone46.0a1
Bug 1147673 - Relax the ancestor transform assertion a little. r?kats
gfx/layers/apz/src/APZCTreeManager.cpp
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -545,18 +545,24 @@ APZCTreeManager::PrepareNodeForLayer(con
     // to be updated to deal with the new layer's hit region.
 
     node = RecycleOrCreateNode(aState, apzc, aLayersId);
     AttachNodeToTree(node, aParent, aNextSibling);
 
     // Even though different layers associated with a given APZC may be at
     // different levels in the layer tree (e.g. one being an uncle of another),
     // we require from Layout that the CSS transforms up to their common
-    // ancestor be the same.
-    MOZ_ASSERT(aAncestorTransform == apzc->GetAncestorTransform());
+    // ancestor be roughly the same. There are cases in which the transforms
+    // are not exactly the same, for example if the parent is container layer
+    // for an opacity, and this container layer has a resolution-induced scale
+    // as its base transform and a prescale that is supposed to undo that scale.
+    // Due to floating point inaccuracies those transforms can end up not quite
+    // canceling each other. That's why we're using a fuzzy comparison here
+    // instead of an exact one.
+    MOZ_ASSERT(aAncestorTransform.FuzzyEqualsMultiplicative(apzc->GetAncestorTransform()));
 
     ParentLayerIntRegion clipRegion = ComputeClipRegion(state->mController, aLayer);
     node->SetHitTestData(GetEventRegions(aLayer), aLayer.GetTransform(), Some(clipRegion),
         GetEventRegionsOverride(aParent, aLayer));
   }
 
   node->SetScrollbarData(aLayer.GetScrollbarTargetContainerId(),
                          aLayer.GetScrollbarDirection(),