Make clearing the animated type at the end of an interval more robust

When an interval of a timed element ends, and said timed element will no
longer contribute to the target element, the animator of the timed element
needs to stopped, and it's state cleared (so that another timed element
may assume that role).
With "linked" syncbases involved, the end of one interval would trigger a
new interval, which in turn allowed resolving yet another interval - which
end up signaling a restart.

Fix by tightening the condition when maybeRestartInterval() returns by
checking if the newly resolved interval is active. Also attempt to make
the condition for when to clear the animator more robust by checking if
the timed element is no longer contributing to the target using
|animationIsContributing|, rather trying to re-deduce it from
the active-state transition + restart (which would observe
'active' -> 'in-active' + restart in this case.)
(Either one of these fix the issue.)

BUG=344408

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

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