Explicitly track reason for View layer painting

Previously, the reason for a View painting to a layer was implicit
based on the presence of a layer and the flag paint_to_layer_ (which
was used with different semantics in different places). This
explicitly keeps track of the reason for painting to a layer with
flags, and centralizes the code for creating and destroying layers
based on these flags.

This is in preparation for InstallableInkDrops which will add yet
another reason for a View to implicitly paint to a layer.

This also fixes an apparent bug where setting an identity transform on
a View after calling SetPaintToLayer() would cause the layer to be
improperly destroyed.

Bug: 931964
Change-Id: I5fa56d04bfa79b44a92429fb0307dc470ab8dff2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1525011
Commit-Queue: Collin Baker <collinbaker@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#642003}
3 files changed