Bug 88818 - Add fullscreen button to Chrome video controls
Summary: Add fullscreen button to Chrome video controls
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Silvia Pfeiffer
URL:
Keywords:
Depends on: 87683 87835 88297 88623 88724 88743
Blocks: 84672 89050
  Show dependency treegraph
 
Reported: 2012-06-11 16:27 PDT by Silvia Pfeiffer
Modified: 2013-01-06 19:49 PST (History)
11 users (show)

See Also:


Attachments
Full patch for layout tests (89.30 KB, patch)
2012-06-11 20:41 PDT, Silvia Pfeiffer
no flags Details | Formatted Diff | Diff
Use this for review (16.11 KB, patch)
2012-06-11 20:46 PDT, Silvia Pfeiffer
no flags Details | Formatted Diff | Diff
adapted to work with recent fullscreen commits (64.83 KB, patch)
2012-06-12 09:20 PDT, Silvia Pfeiffer
no flags Details | Formatted Diff | Diff
Use this for review (23.61 KB, patch)
2012-06-12 09:24 PDT, Silvia Pfeiffer
no flags Details | Formatted Diff | Diff
added a fullscreen transparent background for audio (full patch) (27.32 KB, patch)
2012-06-14 06:15 PDT, Silvia Pfeiffer
no flags Details | Formatted Diff | Diff
Use this for review (10.84 KB, patch)
2012-06-14 06:21 PDT, Silvia Pfeiffer
no flags Details | Formatted Diff | Diff
patch for cq (15.76 KB, patch)
2012-06-14 17:26 PDT, Silvia Pfeiffer
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Silvia Pfeiffer 2012-06-11 16:27:10 PDT
This patch is part of the introduction of the new Chromium video controls, master bug at https://bugs.webkit.org/show_bug.cgi?id=84672 . It introduces a fullscreen button.
Comment 1 Silvia Pfeiffer 2012-06-11 20:41:38 PDT
Created attachment 147000 [details]
Full patch for layout tests
Comment 2 Silvia Pfeiffer 2012-06-11 20:46:51 PDT
Created attachment 147003 [details]
Use this for review

Fullscreen related changes only
Comment 3 Eric Carlson 2012-06-12 06:54:45 PDT
Comment on attachment 147003 [details]
Use this for review

it looks like this was created largely by copying and pasting chunks from MediaControlRootElement.cpp. This makes sense in as much as the patch adds functionality  that is already in the media controls root used by all of the other ports, but it also means that the two classes are more and more similar without actually sharing any code. We now have two classes that perform exactly the same function and that are called from cross platform code, but that share by copy and paste instead of by using a common base class. 

I don't know why Steve decided to create this file by cloning MediaControlRootElement instead of factoring the common code into a base class, and clearly I should not have r+d the original change, but I think it is time to reevaluate. Instead of making this mess worse, how hard would it be to add these fullscreen changes by factoring the code from MediaControlRootElement into a base class?
Comment 4 Silvia Pfeiffer 2012-06-12 07:02:42 PDT
(In reply to comment #3)
> (From update of attachment 147003 [details])
> I don't know why Steve decided to create this file by cloning MediaControlRootElement instead of 
> factoring the common code into a base class, and clearly I should not have r+d the original change, but 
>I think it is time to reevaluate. Instead of making this mess worse, how hard would it be to add these
> fullscreen changes by factoring the code from MediaControlRootElement into a base class?

Actually, today, a patch landed that added fullscreen support for Android, so half this patch has already landed.

Also, if you look at the individual functions, some of them are actually quite different between the two files.

I understand where you're coming from and I am sympathetic, but I'd prefer doing it after this patch. I am supposed to land this this week so it can make it into Chrome 21. So, I'd prefer to do the analysis and clean-up afterwards.
Comment 5 Silvia Pfeiffer 2012-06-12 07:29:35 PDT
Created a new bug for the code restructing issue, see bug 88871 .
Comment 6 Silvia Pfeiffer 2012-06-12 09:20:56 PDT
Created attachment 147096 [details]
adapted to work with recent fullscreen commits
Comment 7 Silvia Pfeiffer 2012-06-12 09:24:00 PDT
Created attachment 147098 [details]
Use this for review

Substantial change with recent comment, see bug 88266.
Comment 8 Eric Carlson 2012-06-12 09:41:20 PDT
Comment on attachment 147098 [details]
Use this for review

View in context: https://bugs.webkit.org/attachment.cgi?id=147098&action=review

This generally looks OK, but I would like to see a version with corrected ChangeLogs.

> Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp:365
> +            // When we get a mouse move in fullscreen mode, show the media controls, and start a timer
> +            // that will hide the media controls after a 3 seconds without a mouse move.

Copy-pasta: you redefined timeWithoutMouseMovementBeforeHidingControls above to 2 seconds.

> Source/WebCore/rendering/RenderMediaControlsChromium.cpp:277
> -    DEFINE_STATIC_LOCAL(Image*, mediaFullscreen, (platformResource("mediaFullscreen")));
> -    return paintMediaButton(paintInfo.context, rect, mediaFullscreen);
> +    static Image* mediaFullscreenButton = platformResource("mediaplayerFullscreen");

Why the change from "DEFINE_STATIC_LOCAL" to just "static"?

> Source/WebCore/rendering/RenderThemeChromiumSkia.cpp:462
> -String formatMediaControlsTime(float time) const
> +String formatMediaControlsTime(float time)

Is it not possible for RenderMediaControlsChromium::formatMediaControlsTime to be const?
Comment 9 Silvia Pfeiffer 2012-06-12 09:49:09 PDT
(In reply to comment #8)
> (From update of attachment 147098 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=147098&action=review
> 
> This generally looks OK, but I would like to see a version with corrected ChangeLogs.

Actually, I was hasty with this diff, since it includes more than it should, in particular the weird changes to the ChangeLogs and the Skia changes (the latter of which need to go into bug 88724 where the skia builds failed.
 
> > Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp:365
> > +            // When we get a mouse move in fullscreen mode, show the media controls, and start a timer
> > +            // that will hide the media controls after a 3 seconds without a mouse move.
> 
> Copy-pasta: you redefined timeWithoutMouseMovementBeforeHidingControls above to 2 seconds.

Thanks for noticing!
 
> > Source/WebCore/rendering/RenderMediaControlsChromium.cpp:277
> > -    DEFINE_STATIC_LOCAL(Image*, mediaFullscreen, (platformResource("mediaFullscreen")));
> > -    return paintMediaButton(paintInfo.context, rect, mediaFullscreen);
> > +    static Image* mediaFullscreenButton = platformResource("mediaplayerFullscreen");
> 
> Why the change from "DEFINE_STATIC_LOCAL" to just "static"?

All images are now pulled in in this way - the previous way doesn't work any more.


> > Source/WebCore/rendering/RenderThemeChromiumSkia.cpp:462
> > -String formatMediaControlsTime(float time) const
> > +String formatMediaControlsTime(float time)
> 
> Is it not possible for RenderMediaControlsChromium::formatMediaControlsTime to be const?

It's not a class member function, just a static helper so can't declare it in this way. Hmm... I missed the "static". Will fix.
Comment 10 WebKit Review Bot 2012-06-12 11:14:08 PDT
Comment on attachment 147096 [details]
adapted to work with recent fullscreen commits

Attachment 147096 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/12938788
Comment 11 Silvia Pfeiffer 2012-06-14 06:15:22 PDT
Created attachment 147568 [details]
added a fullscreen transparent background for audio (full patch)
Comment 12 Silvia Pfeiffer 2012-06-14 06:21:36 PDT
Created attachment 147569 [details]
Use this for review

This patch plus the changelog will be what I'm planning to land.
Comment 13 Eric Carlson 2012-06-14 09:42:00 PDT
Comment on attachment 147569 [details]
Use this for review

View in context: https://bugs.webkit.org/attachment.cgi?id=147569&action=review

> Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp:365
> +            // When we get a mouse move in fullscreen mode, show the media controls, and start a timer
> +            // that will hide the media controls after a 3 seconds without a mouse move.

Nit: you hide the controls after 2 seconds, not 3.

> Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp:369
> +        if (m_isFullscreen) {
> +            // When we get a mouse move in fullscreen mode, show the media controls, and start a timer
> +            // that will hide the media controls after a 3 seconds without a mouse move.
> +            makeOpaque();
> +            if (shouldHideControls())
> +                startHideFullscreenControlsTimer();
> +        }

Does it matter that you may call startHideFullscreenControlsTimer() multiple times?
Comment 14 Silvia Pfeiffer 2012-06-14 15:00:25 PDT
(In reply to comment #13)
> (From update of attachment 147569 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=147569&action=review
> 
> > Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp:365
> > +            // When we get a mouse move in fullscreen mode, show the media controls, and start a timer
> > +            // that will hide the media controls after a 3 seconds without a mouse move.
> 
> Nit: you hide the controls after 2 seconds, not 3.

DONE.

 
> > Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp:369
> > +        if (m_isFullscreen) {
> > +            // When we get a mouse move in fullscreen mode, show the media controls, and start a timer
> > +            // that will hide the media controls after a 3 seconds without a mouse move.
> > +            makeOpaque();
> > +            if (shouldHideControls())
> > +                startHideFullscreenControlsTimer();
> > +        }
> 
> Does it matter that you may call startHideFullscreenControlsTimer() multiple times?

Every time that the mouse is moved, the timer has to be reset. So, no, it's intended. (Also note that MediaControlRootElement.cpp does the same thing.)
Comment 15 Silvia Pfeiffer 2012-06-14 17:26:24 PDT
Created attachment 147687 [details]
patch for cq
Comment 16 WebKit Review Bot 2012-06-15 00:20:09 PDT
Comment on attachment 147687 [details]
patch for cq

Clearing flags on attachment: 147687

Committed r120414: <http://trac.webkit.org/changeset/120414>
Comment 17 WebKit Review Bot 2012-06-15 00:20:26 PDT
All reviewed patches have been landed.  Closing bug.