Implement preservesAxisAlignment on gfx::Transform

In many cases we would like to check if a rect remains axis-aligned after
having a transform applied to it. This is often done by actually applying the
transform to the rect and then verifying that it is still rectilinear. This
entire map operation can be avoided, instead performing a quicker check over 6
elements of the matrix.

Additionally, this patch fixes a bug where we were unnecessarily creating
renderSurfaces.  This bug was diagnosed and solved by [email protected],
but it was appropriate to do the fix in this patch while it lands.

BUG=258760

Review URL: https://chromiumcodereview.appspot.com/11576036

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211017 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ui/gfx/transform.h b/ui/gfx/transform.h
index 10885bd..66e76ea0 100644
--- a/ui/gfx/transform.h
+++ b/ui/gfx/transform.h
@@ -122,6 +122,10 @@
     return (matrix_.getType() & ~mask) == 0;
   }
 
+  // Returns true if axis-aligned 2d rects will remain axis-aligned after being
+  // transformed by this matrix.
+  bool Preserves2dAxisAlignment() const;
+
   // Returns true if the matrix has any perspective component that would
   // change the w-component of a homogeneous point.
   bool HasPerspective() const {