[web-animations] Rewrite algorithms for playing and pausing

Original change by Brian Birtles <birtles@gmail.com>
https://dvcs.w3.org/hg/FXTF/rev/1c93e839dbd8