Make BGPT de-composite trivial transforms

With this CL, "trivial" transforms, which only produce at most a 2d
translation, will be de-composited if possible (see below). They will be
replaced by an offset that is set on the cc::Layer in
offset_to_transform_parent. With this change, the layer offset will be
stored in ForeignLayerDisplayItem, so that it can be used to update the
cc::Layer, and cc::Layer::SetOffsetToTransformParent() will be used in
many fewer cases directly.

The conditions required to de-composite a transform are:
 1. It is not the root transform node.
 2. It is a 2d translation only.
 3. The transform is not used for scrolling - its ScrollNode() is nullptr.
 4. It has no direct compositing reasons, other than k3DTransform. Note
    that if it has a k3DTransform reason, check #2 above ensures that it
    isn't really 3D.
 5. It has FlattensInheritedTransform matching that of its direct parent.
 6. It has backface visibility matching its direct parent.
 7. No clips have local_transform_space referring to this transform node.
 8. No effects have local_transform_space referring to this transform node.
 9. All child transform nodes are also able to be de-composited.

Bug: 952386,938563
Change-Id: I666e1609b48046372196c3864912a59e462bea77
Commit-Queue: Mason Freed <>
Reviewed-by: Xianzhu Wang <>
Auto-Submit: Mason Freed <>
Cr-Commit-Position: refs/heads/master@{#652620}
29 files changed