Source/WebCore: Source/WebCore: Mac: Media Controls always hide time display elements
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Mar 2013 16:43:02 +0000 (16:43 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Mar 2013 16:43:02 +0000 (16:43 +0000)
commitb23f036b80fce4eb2df15b2ee09890238a532b7f
tree713b2eb309dd9520b7dd4c65d9a30813b889b35b
parenta723a3a741e7f66d1f8ab8084118dabe4f1d0fba
Source/WebCore: Source/WebCore: Mac: Media Controls always hide time display elements
https://bugs.webkit.org/show_bug.cgi?id=113355

Reviewed by Eric Carlson.

No new tests; rebaselined existing tests against correct behavior.

A prior commit set the "min-width:0" property on the time display elements, which, combined
with the "-webkit-flex-box:0 0" setting, caused the flex-box container to collapse the width
of the elements to zero. To achieve the desired effect of hiding the time display elements,
first set the elements' min-width to the desired width, as the new flex-box spec treats the
default value of "min-width:auto" as the intrinsic width, and will collapse the text display
elements to the intrinsic width of its contained text node.

The above allows the timeline container to collapse beyond the sum of its childrens'
intrinsic width. Create a custom renderer that detects when this happens, and hide the time
display controls.

* css/mediaControls.css:
* css/mediaControlsQuickTime.css:
(audio::-webkit-media-controls-current-time-display, video::-webkit-media-controls-current-time-display):
    Set the "min-width:" property to equal the "width:" property.
(audio::-webkit-media-controls-time-remaining-display, video::-webkit-media-controls-time-remaining-display):
    Ditto.
* css/mediaControlsChromium.css:
(audio::-webkit-media-controls-time-remaining-display, video::-webkit-media-controls-time-remaining-display):
    Chromium assumes the time display controls are flex-boxes, so make that explicit.
* html/shadow/MediaControlElementTypes.cpp: Removed MediaControlTimeDisplayElement::createRenderer().
* html/shadow/MediaControlElementTypes.h:
(MediaControlTimeDisplayElement): Ditto.
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTimelineContainerElement::setTimeDisplaysHidden): Added, walks through the
    container's children and shows or hides time display elements.
(WebCore::MediaControlTimelineContainerElement::createRenderer): Added, creates a RenderMediaControlTimelineContainer.
(WebCore::getMediaControlTimeRemainingDisplayElementShadowPseudoId): Added, allow setTimeDisplaysHidden to
    query against children's shadowPseudoId().
(WebCore::MediaControlTimeRemainingDisplayElement::shadowPseudoId): Moved contents to getMediaControlTimeRemainingDisplayElementShadowPseudoId.
(WebCore::getMediaControlCurrentTimeDisplayElementShadowPseudoId): Added, allow setTimeDisplaysHidden to
    query against children's shadowPseudoId().
(WebCore::MediaControlCurrentTimeDisplayElement::shadowPseudoId): Moved contents to getMediaControlCurrentTimeDisplayElementShadowPseudoId.
* html/shadow/MediaControlElements.h:
(MediaControlTimelineContainerElement):
* rendering/RenderMediaControlElements.cpp:
(WebCore::RenderMediaControlTimelineContainer::RenderMediaControlTimelineContainer): Added, simple constructor.
(WebCore::RenderMediaControlTimelineContainer::layout): Detect when the controller's width is greater than
    a certain value, and show or hide the time display elements in response.
* rendering/RenderMediaControlElements.h:
(RenderMediaControlTimelineContainer):

LayoutTests: Mac: Media Controls always hide time display elements
https://bugs.webkit.org/show_bug.cgi?id=113355

Reviewed by Eric Carlson.

Rebaseline mac results.

* platform/mac/media/audio-controls-rendering-expected.png:
* platform/mac/media/audio-controls-rendering-expected.txt:
* platform/mac/media/controls-after-reload-expected.png:
* platform/mac/media/controls-after-reload-expected.txt:
* platform/mac/media/controls-strict-expected.png:
* platform/mac/media/controls-strict-expected.txt:
* platform/mac/media/controls-styling-strict-expected.png: Added.
* platform/mac/media/controls-styling-strict-expected.txt:
* platform/mac/media/controls-without-preload-expected.png:
* platform/mac/media/controls-without-preload-expected.txt:
* platform/mac/media/video-controls-rendering-expected.png:
* platform/mac/media/video-controls-rendering-expected.txt:
* platform/mac/media/video-display-toggle-expected.png:
* platform/mac/media/video-display-toggle-expected.txt:
* platform/mac/media/video-no-audio-expected.png:
* platform/mac/media/video-no-audio-expected.txt:
* platform/mac/media/video-playing-and-pause-expected.png:
* platform/mac/media/video-playing-and-pause-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@146992 268f45cc-cd09-0410-ab3c-d52691b4dbfc
28 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac/media/audio-controls-rendering-expected.png
LayoutTests/platform/mac/media/audio-controls-rendering-expected.txt
LayoutTests/platform/mac/media/controls-after-reload-expected.png
LayoutTests/platform/mac/media/controls-after-reload-expected.txt
LayoutTests/platform/mac/media/controls-strict-expected.png
LayoutTests/platform/mac/media/controls-strict-expected.txt
LayoutTests/platform/mac/media/controls-styling-strict-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/media/controls-styling-strict-expected.txt
LayoutTests/platform/mac/media/controls-without-preload-expected.png
LayoutTests/platform/mac/media/controls-without-preload-expected.txt
LayoutTests/platform/mac/media/video-controls-rendering-expected.png
LayoutTests/platform/mac/media/video-controls-rendering-expected.txt
LayoutTests/platform/mac/media/video-display-toggle-expected.png
LayoutTests/platform/mac/media/video-display-toggle-expected.txt
LayoutTests/platform/mac/media/video-no-audio-expected.png
LayoutTests/platform/mac/media/video-no-audio-expected.txt
LayoutTests/platform/mac/media/video-playing-and-pause-expected.png
LayoutTests/platform/mac/media/video-playing-and-pause-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/css/mediaControlsChromium.css
Source/WebCore/css/mediaControlsQuickTime.css
Source/WebCore/html/shadow/MediaControlElementTypes.cpp
Source/WebCore/html/shadow/MediaControlElementTypes.h
Source/WebCore/html/shadow/MediaControlElements.cpp
Source/WebCore/html/shadow/MediaControlElements.h
Source/WebCore/rendering/RenderMediaControlElements.cpp
Source/WebCore/rendering/RenderMediaControlElements.h