Rewind the DocumentLifecycle when dirtying state

Before this CL, we didn't actually rewind the DocumentLifecycle when we
scheduled layout or compositing updates. This CL adds the rewind and finds some
cases where we're doing something sketchy (e.g., scheduling a layout after
detaching a document from its frame).

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

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