Ensure that painting phases are updated correctly in the CLM

Currently, we rely on ad hoc code to reset painting phases for our
graphics layers as the internal hierarchy changes. This is brittle and
leads to bugs, both when we set the wrong painting phases (or fail to
set them) as well as when we fail to invalidate layers when their paint
phases change.

This CL consolidates the painting phase updates for layers whose paint
phases vary depending on the hierarchy, and puts code in place to
trigger invalidations when these phases do indeed change.

R=enne@chromium.org
BUG=361940

Review URL: https://codereview.chromium.org/239053008

git-svn-id: svn://svn.chromium.org/blink/trunk@172414 bbb929c8-8fbe-4397-9dbb-9b2b20218538