Repaint media controls when network state changes.
Cause any change in network state in HTMLMediaElement to repaint the media
controls, since they rely on it silently during painting.
BUG=545704
Committed: https://crrev.com/cf0b46870c0ea22aa558903496685e4fe5b3840c
Cr-Commit-Position: refs/heads/master@{#357153}
5 years, 2 months ago
(2015-10-21 19:02:28 UTC)
#1
Patchset #1 (id:1) has been deleted
liberato (no reviews please)
Description was changed from ========== Media controls refer to less magic state. MediaControlsPainter looked at ...
5 years, 2 months ago
(2015-10-22 21:30:03 UTC)
#2
Description was changed from
==========
Media controls refer to less magic state.
MediaControlsPainter looked at magic bits of state to change how
they draw. The overlay play button, for example, might choose not
to paint anything if it believed that the media element couldn't
play currently.
The problem with this is that changes in state weren't being
reflected with new paints.
Now, MediaControls takes more responsility for managing this state,
and reflecting changes in ways that actually cause a repaint. For
example, the overlay play button is now marked as isWanted() only
when it's actually supposed to be on the screen.
Similar changes were made for closed caption, full screen, mute,
and regular play.
BUG=545704
==========
to
==========
Media controls refer to less magic state.
MediaControlsPainter looked at magic bits of state to change how they draw. The
overlay play button, for example, might choose not to paint anything if it
believed that the media element couldn't play currently.
The problem with this is that changes in state weren't being reflected with new
paints.
Now, MediaControls takes more responsility for managing this state, and
reflecting changes in ways that actually cause a repaint. For example, the
overlay play button is now marked as isWanted() only when it's actually supposed
to be on the screen.
Similar changes were made for closed caption, full screen, mute, and regular
play.
BUG=545704
==========
all of the test rebaselines were cases in which the test memorized non-disabled buttons incorrectly. ...
5 years, 2 months ago
(2015-10-22 21:33:49 UTC)
#4
all of the test rebaselines were cases in which the test memorized non-disabled
buttons incorrectly.
i'd like to add an additional test for the case of "player becomes ready but
doesn't paint", but it's pretty hard to trigger without a race. the best i
could come up with was an Internals method to lie about the network state on a
player that has no source.
does that seem useful? do you have a better idea.
philipj_slow
Description was changed from ========== Media controls refer to less magic state. MediaControlsPainter looked at ...
5 years, 2 months ago
(2015-10-23 07:54:43 UTC)
#5
Description was changed from
==========
Media controls refer to less magic state.
MediaControlsPainter looked at magic bits of state to change how they draw. The
overlay play button, for example, might choose not to paint anything if it
believed that the media element couldn't play currently.
The problem with this is that changes in state weren't being reflected with new
paints.
Now, MediaControls takes more responsility for managing this state, and
reflecting changes in ways that actually cause a repaint. For example, the
overlay play button is now marked as isWanted() only when it's actually supposed
to be on the screen.
Similar changes were made for closed caption, full screen, mute, and regular
play.
BUG=545704
==========
to
==========
Media controls refer to less magic state.
MediaControlsPainter looked at magic bits of state to change how they
draw. The overlay play button, for example, might choose not to paint
anything if it believed that the media element couldn't play currently.
The problem with this is that changes in state weren't being reflected
with new paints.
Now, MediaControls takes more responsility for managing this state, and
reflecting changes in ways that actually cause a repaint. For example,
the overlay play button is now marked as isWanted() only when it's
actually supposed to be on the screen.
Similar changes were made for closed caption, fullscreen, mute, and
regular play.
BUG=545704
==========
philipj_slow
This CL is doing a bunch of different things, I'd like to discuss the core ...
5 years, 2 months ago
(2015-10-23 08:31:25 UTC)
#6
This CL is doing a bunch of different things, I'd like to discuss the core of
issue 545704 and get that fixed first, and if possible save refactoring for a
separate CL.
So, if I understand correctly, the precise problem here is that
MediaControlsPainter paints different things depending on networkState, but a
change in networkState does not always result in a repaint.
There's a similar situation in MediaControlsPainter::paintMediaSliderInternal
where currentTime and duration are taken from the media element instead of via
some style or attribute set by MediaControls. Here the problem is solved by
calling setShouldDoFullPaintInvalidation() in
MediaControlTimelineElement::setDuration() and ::setPosition().
The overlay play button isn't the only thing that depends on networkState, so
it's possible that there are more subtle problems like this.
A solution, I think, would be to introduce a HTMLMediaElement::setNetworkState()
that is consistently used instead of assigning to m_networkState. Then, call a
new MediaControls::networkStateChanged() or possibly just MediaControls::reset()
to repaint what needs repainting.
That ought to be a very small CL, and I'd be interested to see if it fixes the
problem or not.
(More generally it would be great if MediaControlsPainter.cpp didn't know about
HTMLMediaElement at all so that all state had to be propagated in the same way,
but that's a significant refactoring.)
liberato (no reviews please)
On 2015/10/23 08:31:25, philipj wrote: > This CL is doing a bunch of different things, ...
5 years, 2 months ago
(2015-10-23 15:04:08 UTC)
#7
On 2015/10/23 08:31:25, philipj wrote:
> This CL is doing a bunch of different things, I'd like to discuss the core of
> issue 545704 and get that fixed first, and if possible save refactoring for a
> separate CL.
>
> So, if I understand correctly, the precise problem here is that
> MediaControlsPainter paints different things depending on networkState, but a
> change in networkState does not always result in a repaint.
>
> There's a similar situation in MediaControlsPainter::paintMediaSliderInternal
> where currentTime and duration are taken from the media element instead of via
> some style or attribute set by MediaControls. Here the problem is solved by
> calling setShouldDoFullPaintInvalidation() in
> MediaControlTimelineElement::setDuration() and ::setPosition().
>
> The overlay play button isn't the only thing that depends on networkState, so
> it's possible that there are more subtle problems like this.
>
> A solution, I think, would be to introduce a
HTMLMediaElement::setNetworkState()
> that is consistently used instead of assigning to m_networkState. Then, call a
> new MediaControls::networkStateChanged() or possibly just
MediaControls::reset()
> to repaint what needs repainting.
>
> That ought to be a very small CL, and I'd be interested to see if it fixes the
> problem or not.
>
> (More generally it would be great if MediaControlsPainter.cpp didn't know
about
> HTMLMediaElement at all so that all state had to be propagated in the same
way,
> but that's a significant refactoring.)
i did get a little overzealous trying to move state out of the painter, yes.
however, the same repro also breaks the control bar play button similarly
between opaque and partially transparent, where the next paint would make it
switch to the correct state. all of these need to be fixed, but i'll do
them in separate CLs.
HTMLMediaElement::setNetworkState: good idea!
core problem: not sure that we see the same core problem. i entirely agree
that, in the long run, having the painters start poking around for internal
state is bad, and is just asking for weird display bugs like this one.
however, for our overlay play button, i think it's especially extra broken and
needs to be fixed sooner. i don't see it as simply missing a repaint when the
internal state changes.
in particular, it's a very weird that the play button has two different 'not
shown' states. MediaController can decide to display:none it, and if not, then
the painter can choose simply to make it invisible if it doesn't agree.
further, these decisions are entirely federated between them; there's no sort of
central decision. i believe that's just broken.
for this CL, i'll try the repaint-only solution that you suggest -- it seems
safer if we want to merge back to M46. i'll also make a separate CL that merges
the logic into one place for the overlay play button.
philipj_slow
I do agree that it's extra strange when the very *same* kind of state (visibility) ...
5 years, 2 months ago
(2015-10-23 17:36:17 UTC)
#8
I do agree that it's extra strange when the very *same* kind of state
(visibility) is handled both via CSS and the painter. If that confusion is
really the cause of issue 545704 then of course it should be fixed, but from the
issue comments it sounds like it's really the lack of invalidation on
networkState changes.
philipj_slow
Note sure if you wanted review yet, but this looks great. A test, somehow, would ...
5 years, 2 months ago
(2015-10-23 17:41:21 UTC)
#9
Note sure if you wanted review yet, but this looks great. A test, somehow, would
be nice of course. If layout tests can't be made reliable (or fast) then a unit
test might be possible.
https://codereview.chromium.org/1417683004/diff/160001/third_party/WebKit/Sou...
File third_party/WebKit/Source/core/html/HTMLMediaElement.cpp (right):
https://codereview.chromium.org/1417683004/diff/160001/third_party/WebKit/Sou...
third_party/WebKit/Source/core/html/HTMLMediaElement.cpp:3589: if
(MediaControls* controls = mediaControls())
Yep, looks good. Later it may be possible to bake
changeNetworkStateFromLoadingToIdle() into this by checking old and new state,
but not this CL.
liberato (no reviews please)
Patchset #9 (id:180001) has been deleted
5 years, 2 months ago
(2015-10-23 21:56:33 UTC)
#10
Patchset #9 (id:180001) has been deleted
liberato (no reviews please)
5 years, 2 months ago
(2015-10-23 21:58:32 UTC)
#11
liberato (no reviews please)
Description was changed from ========== Media controls refer to less magic state. MediaControlsPainter looked at ...
5 years, 2 months ago
(2015-10-23 21:59:17 UTC)
#12
Description was changed from
==========
Media controls refer to less magic state.
MediaControlsPainter looked at magic bits of state to change how they
draw. The overlay play button, for example, might choose not to paint
anything if it believed that the media element couldn't play currently.
The problem with this is that changes in state weren't being reflected
with new paints.
Now, MediaControls takes more responsility for managing this state, and
reflecting changes in ways that actually cause a repaint. For example,
the overlay play button is now marked as isWanted() only when it's
actually supposed to be on the screen.
Similar changes were made for closed caption, fullscreen, mute, and
regular play.
BUG=545704
==========
to
==========
Repaint media controls when network state changes.
Cause any change in network state in HTMLMediaElement to repaint the media
controls, since they rely on it silently during painting.
BUG=545704
==========
philipj_slow
Did you forget to upload media/controls-repaint-for-network-change.html?
5 years, 1 month ago
(2015-10-26 10:33:00 UTC)
#13
Did you forget to upload media/controls-repaint-for-network-change.html?
liberato (no reviews please)
On 2015/10/26 10:33:00, philipj wrote: > Did you forget to upload media/controls-repaint-for-network-change.html? yes, sorry about ...
5 years, 1 month ago
(2015-10-26 14:07:25 UTC)
#14
On 2015/10/26 10:33:00, philipj wrote:
> Did you forget to upload media/controls-repaint-for-network-change.html?
yes, sorry about that. fixed.
-fl
philipj_slow
Actual solution looks good, just some thoughts about the things around it. https://codereview.chromium.org/1417683004/diff/260001/third_party/WebKit/LayoutTests/TestExpectations File third_party/WebKit/LayoutTests/TestExpectations ...
5 years, 1 month ago
(2015-10-28 15:14:02 UTC)
#15
thanks for the feedback. all addressed, sending to CQ. -fl https://chromiumcodereview.appspot.com/1417683004/diff/300001/third_party/WebKit/LayoutTests/media/controls-repaint-for-network-change-expected.html File third_party/WebKit/LayoutTests/media/controls-repaint-for-network-change-expected.html (right): https://chromiumcodereview.appspot.com/1417683004/diff/300001/third_party/WebKit/LayoutTests/media/controls-repaint-for-network-change-expected.html#newcode17 ...
5 years, 1 month ago
(2015-10-30 15:09:07 UTC)
#18
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1417683004/320001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1417683004/320001
5 years, 1 month ago
(2015-10-30 15:09:29 UTC)
#21
Some follow-ups, can you create a new CL? https://codereview.chromium.org/1417683004/diff/300001/third_party/WebKit/Source/core/testing/Internals.h File third_party/WebKit/Source/core/testing/Internals.h (right): https://codereview.chromium.org/1417683004/diff/300001/third_party/WebKit/Source/core/testing/Internals.h#newcode399 third_party/WebKit/Source/core/testing/Internals.h:399: void ...
5 years, 1 month ago
(2015-11-03 09:04:06 UTC)
#24
Issue 1417683004: Media controls refer to less magic state.
(Closed)
Created 5 years, 2 months ago by liberato (no reviews please)
Modified 5 years, 1 month ago
Reviewers: philipj_slow
Base URL: https://chromium.googlesource.com/chromium/src.git@master
Comments: 35