Use HTMLMediaElement::togglePlayState() where appropriate

togglePlayState() handles the MediaController case correctly, which the
updated code paths did not.

Introduce togglePlayStateWillPlay() to replace canPlay() and paused() in
certain contexts. The readyState < HAVE_METADATA in canPlay() condition
is not replicated because the hasSource() checks in paintMediaPlayButton
and paintMediaOverlayPlayButton disables the buttons so that they can't
be pressed at all. Some corner case seems likely to exist, but was not
found in ad-hoc testing.

Drop the ASSERT(controls()) in tooglePlayState() since it is now used in
contexts not directly tied to MediaControls. The ASSERT doesn't fail
yet, but the same ASSERT in togglePlayStateWillPlay() would, since
MediaControlPlayButtonElement::updateDisplayType() is called when the
controls are created for text track rendering but are not shown.

These changes made it possible to reduce the size of
MediaControllerInterface a little bit more.

BUG=341813
TEST=none, no observable changes intended

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

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