Changeset 146992 in webkit


Ignore:
Timestamp:
Mar 27, 2013 9:43:02 AM (11 years ago)
Author:
jer.noble@apple.com
Message:

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:
Location:
trunk
Files:
1 added
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r146986 r146992  
     12013-03-27  Jer Noble  <jer.noble@apple.com>
     2
     3        Mac: Media Controls always hide time display elements
     4        https://bugs.webkit.org/show_bug.cgi?id=113355
     5
     6        Reviewed by Eric Carlson.
     7
     8        Rebaseline mac results.
     9
     10        * platform/mac/media/audio-controls-rendering-expected.png:
     11        * platform/mac/media/audio-controls-rendering-expected.txt:
     12        * platform/mac/media/controls-after-reload-expected.png:
     13        * platform/mac/media/controls-after-reload-expected.txt:
     14        * platform/mac/media/controls-strict-expected.png:
     15        * platform/mac/media/controls-strict-expected.txt:
     16        * platform/mac/media/controls-styling-strict-expected.png: Added.
     17        * platform/mac/media/controls-styling-strict-expected.txt:
     18        * platform/mac/media/controls-without-preload-expected.png:
     19        * platform/mac/media/controls-without-preload-expected.txt:
     20        * platform/mac/media/video-controls-rendering-expected.png:
     21        * platform/mac/media/video-controls-rendering-expected.txt:
     22        * platform/mac/media/video-display-toggle-expected.png:
     23        * platform/mac/media/video-display-toggle-expected.txt:
     24        * platform/mac/media/video-no-audio-expected.png:
     25        * platform/mac/media/video-no-audio-expected.txt:
     26        * platform/mac/media/video-playing-and-pause-expected.png:
     27        * platform/mac/media/video-playing-and-pause-expected.txt:
     28
    1292013-03-27  Chris Fleizach  <cfleizach@apple.com>
    230
  • trunk/LayoutTests/platform/mac/media/audio-controls-rendering-expected.txt

    r145588 r146992  
    3636    RenderButton {INPUT} at (32,4) size 16x17
    3737    RenderFlexibleBox {DIV} at (49,5) size 246x15
    38       RenderSlider {INPUT} at (0,2) size 246x13
    39         RenderFlexibleBox {DIV} at (0,0) size 246x13
    40           RenderBlock {DIV} at (0,2) size 246x9
     38      RenderSlider {INPUT} at (45,2) size 156x13
     39        RenderFlexibleBox {DIV} at (0,0) size 156x13
     40          RenderBlock {DIV} at (0,2) size 156x9
    4141            RenderBlock {DIV} at (0,0) size 10x8
    4242    RenderBlock {DIV} at (295,6) size 25x13
     43layer at (57,92) size 45x11
     44  RenderFlexibleBox {DIV} at (0,2) size 45x11 [color=#FFFFFF]
     45    RenderBlock (anonymous) at (9,0) size 27x11
     46      RenderText {#text} at (0,0) size 26x11
     47        text run at (0,0) width 26: "00:00"
     48layer at (258,92) size 45x11
     49  RenderFlexibleBox {DIV} at (201,2) size 45x11 [color=#FFFFFF]
     50    RenderBlock (anonymous) at (7,0) size 31x11
     51      RenderText {#text} at (0,0) size 31x11
     52        text run at (0,0) width 31: "-00:07"
    4353layer at (305,92) size 14x12
    4454  RenderButton zI: 1 {INPUT} at (2,0) size 14x12
     
    5262    RenderButton {INPUT} at (32,4) size 16x17
    5363    RenderFlexibleBox {DIV} at (49,5) size 246x15
    54       RenderSlider {INPUT} at (0,2) size 246x13
    55         RenderFlexibleBox {DIV} at (0,0) size 246x13
    56           RenderBlock {DIV} at (0,2) size 246x9
     64      RenderSlider {INPUT} at (45,2) size 156x13
     65        RenderFlexibleBox {DIV} at (0,0) size 156x13
     66          RenderBlock {DIV} at (0,2) size 156x9
    5767            RenderBlock {DIV} at (0,0) size 10x8
    5868    RenderBlock {DIV} at (295,6) size 25x13
     69layer at (57,210) size 45x11
     70  RenderFlexibleBox {DIV} at (0,2) size 45x11 [color=#FFFFFF]
     71    RenderBlock (anonymous) at (9,0) size 27x11
     72      RenderText {#text} at (0,0) size 26x11
     73        text run at (0,0) width 26: "00:00"
     74layer at (258,210) size 45x11
     75  RenderFlexibleBox {DIV} at (201,2) size 45x11 [color=#FFFFFF]
     76    RenderBlock (anonymous) at (7,0) size 31x11
     77      RenderText {#text} at (0,0) size 31x11
     78        text run at (0,0) width 31: "-00:07"
    5979layer at (305,210) size 14x12
    6080  RenderButton zI: 1 {INPUT} at (2,0) size 14x12
  • trunk/LayoutTests/platform/mac/media/controls-after-reload-expected.txt

    r145588 r146992  
    1818    RenderButton {INPUT} at (32,4) size 16x17
    1919    RenderFlexibleBox {DIV} at (49,5) size 216x15
    20       RenderSlider {INPUT} at (0,2) size 216x13
    21         RenderFlexibleBox {DIV} at (0,0) size 216x13
    22           RenderBlock {DIV} at (0,2) size 216x9
     20      RenderSlider {INPUT} at (45,2) size 126x13
     21        RenderFlexibleBox {DIV} at (0,0) size 126x13
     22          RenderBlock {DIV} at (0,2) size 126x9
    2323            RenderBlock {DIV} at (0,0) size 10x8
    2424    RenderButton {INPUT} at (297,4) size 16x17
    2525    RenderBlock {DIV} at (265,6) size 25x13
     26layer at (57,264) size 45x11
     27  RenderFlexibleBox {DIV} at (0,2) size 45x11 [color=#FFFFFF]
     28    RenderBlock (anonymous) at (9,0) size 27x11
     29      RenderText {#text} at (0,0) size 26x11
     30        text run at (0,0) width 26: "00:00"
     31layer at (228,264) size 45x11
     32  RenderFlexibleBox {DIV} at (171,2) size 45x11 [color=#FFFFFF]
     33    RenderBlock (anonymous) at (7,0) size 31x11
     34      RenderText {#text} at (0,0) size 31x11
     35        text run at (0,0) width 31: "-00:06"
    2636layer at (275,264) size 14x12
    2737  RenderButton zI: 1 {INPUT} at (2,0) size 14x12
  • trunk/LayoutTests/platform/mac/media/controls-strict-expected.txt

    r145588 r146992  
    1818    RenderButton {INPUT} at (32,4) size 16x17
    1919    RenderFlexibleBox {DIV} at (49,5) size 216x15
    20       RenderSlider {INPUT} at (0,2) size 216x13
    21         RenderFlexibleBox {DIV} at (0,0) size 216x13
    22           RenderBlock {DIV} at (0,2) size 216x9
     20      RenderSlider {INPUT} at (45,2) size 126x13
     21        RenderFlexibleBox {DIV} at (0,0) size 126x13
     22          RenderBlock {DIV} at (0,2) size 126x9
    2323            RenderBlock {DIV} at (0,0) size 10x8
    2424    RenderButton {INPUT} at (297,4) size 16x17
    2525    RenderBlock {DIV} at (265,6) size 25x13
     26layer at (57,272) size 45x11
     27  RenderFlexibleBox {DIV} at (0,2) size 45x11 [color=#FFFFFF]
     28    RenderBlock (anonymous) at (9,0) size 27x11
     29      RenderText {#text} at (0,0) size 26x11
     30        text run at (0,0) width 26: "00:00"
     31layer at (228,272) size 45x11
     32  RenderFlexibleBox {DIV} at (171,2) size 45x11 [color=#FFFFFF]
     33    RenderBlock (anonymous) at (7,0) size 31x11
     34      RenderText {#text} at (0,0) size 31x11
     35        text run at (0,0) width 31: "-00:06"
    2636layer at (275,272) size 14x12
    2737  RenderButton zI: 1 {INPUT} at (2,0) size 14x12
  • trunk/LayoutTests/platform/mac/media/controls-styling-strict-expected.txt

    r145588 r146992  
    2222    RenderButton {INPUT} at (32,4) size 16x17
    2323    RenderFlexibleBox {DIV} at (49,5) size 216x15
    24       RenderSlider {INPUT} at (0,2) size 216x13
    25         RenderFlexibleBox {DIV} at (0,0) size 216x13
    26           RenderBlock {DIV} at (0,2) size 216x9
     24      RenderSlider {INPUT} at (45,2) size 126x13
     25        RenderFlexibleBox {DIV} at (0,0) size 126x13
     26          RenderBlock {DIV} at (0,2) size 126x9
    2727            RenderBlock {DIV} at (0,0) size 10x8
    2828    RenderButton {INPUT} at (297,4) size 16x17
    2929    RenderBlock {DIV} at (265,6) size 25x13
     30layer at (57,272) size 45x11
     31  RenderFlexibleBox {DIV} at (0,2) size 45x11 [color=#FFFFFF]
     32    RenderBlock (anonymous) at (9,0) size 27x11
     33      RenderText {#text} at (0,0) size 26x11
     34        text run at (0,0) width 26: "00:00"
     35layer at (228,272) size 45x11
     36  RenderFlexibleBox {DIV} at (171,2) size 45x11 [color=#FFFFFF]
     37    RenderBlock (anonymous) at (7,0) size 31x11
     38      RenderText {#text} at (0,0) size 31x11
     39        text run at (0,0) width 31: "-00:06"
    3040layer at (275,272) size 14x12
    3141  RenderButton zI: 1 {INPUT} at (2,0) size 14x12
     
    3747    RenderButton {INPUT} at (32,4) size 16x17
    3848    RenderFlexibleBox {DIV} at (49,5) size 216x15
    39       RenderSlider {INPUT} at (0,2) size 216x13
    40         RenderFlexibleBox {DIV} at (0,0) size 216x13
    41           RenderBlock {DIV} at (0,2) size 216x9
     49      RenderSlider {INPUT} at (45,2) size 126x13
     50        RenderFlexibleBox {DIV} at (0,0) size 126x13
     51          RenderBlock {DIV} at (0,2) size 126x9
    4252            RenderBlock {DIV} at (0,0) size 10x8
    4353    RenderButton {INPUT} at (297,4) size 16x17
    4454    RenderBlock {DIV} at (265,6) size 25x13
     55layer at (381,272) size 45x11
     56  RenderFlexibleBox {DIV} at (0,2) size 45x11 [color=#FFFFFF]
     57    RenderBlock (anonymous) at (9,0) size 27x11
     58      RenderText {#text} at (0,0) size 26x11
     59        text run at (0,0) width 26: "00:00"
     60layer at (552,272) size 45x11
     61  RenderFlexibleBox {DIV} at (171,2) size 45x11 [color=#FFFFFF]
     62    RenderBlock (anonymous) at (7,0) size 31x11
     63      RenderText {#text} at (0,0) size 31x11
     64        text run at (0,0) width 31: "-00:06"
    4565layer at (599,272) size 14x12
    4666  RenderButton zI: 1 {INPUT} at (2,0) size 14x12
  • trunk/LayoutTests/platform/mac/media/controls-without-preload-expected.txt

    r145588 r146992  
    1818    RenderButton {INPUT} at (32,4) size 16x17
    1919    RenderFlexibleBox {DIV} at (49,5) size 216x15
    20       RenderSlider {INPUT} at (0,2) size 216x13
    21         RenderFlexibleBox {DIV} at (0,0) size 216x13
    22           RenderBlock {DIV} at (0,2) size 216x9
     20      RenderSlider {INPUT} at (45,2) size 126x13
     21        RenderFlexibleBox {DIV} at (0,0) size 126x13
     22          RenderBlock {DIV} at (0,2) size 126x9
    2323            RenderBlock {DIV} at (0,0) size 10x8
    2424    RenderButton {INPUT} at (297,4) size 16x17
    2525    RenderBlock {DIV} at (265,6) size 25x13
     26layer at (57,264) size 45x11
     27  RenderFlexibleBox {DIV} at (0,2) size 45x11 [color=#FFFFFF]
     28    RenderBlock (anonymous) at (9,0) size 27x11
     29      RenderText {#text} at (0,0) size 26x11
     30        text run at (0,0) width 26: "00:00"
     31layer at (228,264) size 45x11
     32  RenderFlexibleBox {DIV} at (171,2) size 45x11 [color=#FFFFFF]
     33    RenderBlock (anonymous) at (7,0) size 31x11
     34      RenderText {#text} at (0,0) size 31x11
     35        text run at (0,0) width 31: "-00:06"
    2636layer at (275,264) size 14x12
    2737  RenderButton zI: 1 {INPUT} at (2,0) size 14x12
  • trunk/LayoutTests/platform/mac/media/video-controls-rendering-expected.txt

    r145588 r146992  
    2323    RenderButton {INPUT} at (32,4) size 16x17
    2424    RenderFlexibleBox {DIV} at (49,5) size 216x15
    25       RenderSlider {INPUT} at (0,2) size 216x13
    26         RenderFlexibleBox {DIV} at (0,0) size 216x13
    27           RenderBlock {DIV} at (0,2) size 216x9
     25      RenderSlider {INPUT} at (45,2) size 126x13
     26        RenderFlexibleBox {DIV} at (0,0) size 126x13
     27          RenderBlock {DIV} at (0,2) size 126x9
    2828            RenderBlock {DIV} at (0,0) size 10x8
    2929    RenderButton {INPUT} at (297,4) size 16x17
    3030    RenderBlock {DIV} at (265,6) size 25x13
     31layer at (57,264) size 45x11
     32  RenderFlexibleBox {DIV} at (0,2) size 45x11 [color=#FFFFFF]
     33    RenderBlock (anonymous) at (9,0) size 27x11
     34      RenderText {#text} at (0,0) size 26x11
     35        text run at (0,0) width 26: "00:00"
     36layer at (228,264) size 45x11
     37  RenderFlexibleBox {DIV} at (171,2) size 45x11 [color=#FFFFFF]
     38    RenderBlock (anonymous) at (7,0) size 31x11
     39      RenderText {#text} at (0,0) size 31x11
     40        text run at (0,0) width 31: "-00:06"
    3141layer at (275,264) size 14x12
    3242  RenderButton zI: 1 {INPUT} at (2,0) size 14x12
     
    3848    RenderButton {INPUT} at (32,4) size 16x17
    3949    RenderFlexibleBox {DIV} at (49,5) size 216x15
    40       RenderSlider {INPUT} at (0,2) size 216x13
    41         RenderFlexibleBox {DIV} at (0,0) size 216x13
    42           RenderBlock {DIV} at (0,2) size 216x9
     50      RenderSlider {INPUT} at (45,2) size 126x13
     51        RenderFlexibleBox {DIV} at (0,0) size 126x13
     52          RenderBlock {DIV} at (0,2) size 126x9
    4353            RenderBlock {DIV} at (0,0) size 10x8
    4454    RenderButton {INPUT} at (297,4) size 16x17
    4555    RenderBlock {DIV} at (265,6) size 25x13
     56layer at (57,504) size 45x11
     57  RenderFlexibleBox {DIV} at (0,2) size 45x11 [color=#FFFFFF]
     58    RenderBlock (anonymous) at (9,0) size 27x11
     59      RenderText {#text} at (0,0) size 26x11
     60        text run at (0,0) width 26: "00:00"
     61layer at (228,504) size 45x11
     62  RenderFlexibleBox {DIV} at (171,2) size 45x11 [color=#FFFFFF]
     63    RenderBlock (anonymous) at (7,0) size 31x11
     64      RenderText {#text} at (0,0) size 31x11
     65        text run at (0,0) width 31: "-00:06"
    4666layer at (275,504) size 14x12
    4767  RenderButton zI: 1 {INPUT} at (2,0) size 14x12
     
    5575    RenderButton {INPUT} at (32,4) size 16x17
    5676    RenderFlexibleBox {DIV} at (49,5) size 216x15
    57       RenderSlider {INPUT} at (0,2) size 216x13
    58         RenderFlexibleBox {DIV} at (0,0) size 216x13
    59           RenderBlock {DIV} at (0,2) size 216x9
     77      RenderSlider {INPUT} at (45,2) size 126x13
     78        RenderFlexibleBox {DIV} at (0,0) size 126x13
     79          RenderBlock {DIV} at (0,2) size 126x9
    6080            RenderBlock {DIV} at (0,0) size 10x8
    6181    RenderButton {INPUT} at (297,4) size 16x17
    6282    RenderBlock {DIV} at (265,6) size 25x13
     83layer at (57,744) size 45x11
     84  RenderFlexibleBox {DIV} at (0,2) size 45x11 [color=#FFFFFF]
     85    RenderBlock (anonymous) at (9,0) size 27x11
     86      RenderText {#text} at (0,0) size 26x11
     87        text run at (0,0) width 26: "00:00"
     88layer at (228,744) size 45x11
     89  RenderFlexibleBox {DIV} at (171,2) size 45x11 [color=#FFFFFF]
     90    RenderBlock (anonymous) at (7,0) size 31x11
     91      RenderText {#text} at (0,0) size 31x11
     92        text run at (0,0) width 31: "-00:06"
    6393layer at (275,744) size 14x12
    6494  RenderButton zI: 1 {INPUT} at (2,0) size 14x12
  • trunk/LayoutTests/platform/mac/media/video-display-toggle-expected.txt

    r145588 r146992  
    1717    RenderButton {INPUT} at (32,4) size 16x17
    1818    RenderFlexibleBox {DIV} at (49,5) size 216x15
    19       RenderSlider {INPUT} at (0,2) size 216x13
    20         RenderFlexibleBox {DIV} at (0,0) size 216x13
    21           RenderBlock {DIV} at (0,2) size 216x9
     19      RenderSlider {INPUT} at (45,2) size 126x13
     20        RenderFlexibleBox {DIV} at (0,0) size 126x13
     21          RenderBlock {DIV} at (0,2) size 126x9
    2222            RenderBlock {DIV} at (0,0) size 10x8
    2323    RenderButton {INPUT} at (297,4) size 16x17
    2424    RenderBlock {DIV} at (265,6) size 25x13
     25layer at (57,248) size 45x11
     26  RenderFlexibleBox {DIV} at (0,2) size 45x11 [color=#FFFFFF]
     27    RenderBlock (anonymous) at (9,0) size 27x11
     28      RenderText {#text} at (0,0) size 26x11
     29        text run at (0,0) width 26: "00:00"
     30layer at (228,248) size 45x11
     31  RenderFlexibleBox {DIV} at (171,2) size 45x11 [color=#FFFFFF]
     32    RenderBlock (anonymous) at (7,0) size 31x11
     33      RenderText {#text} at (0,0) size 31x11
     34        text run at (0,0) width 31: "-00:06"
    2535layer at (275,248) size 14x12
    2636  RenderButton zI: 1 {INPUT} at (2,0) size 14x12
  • trunk/LayoutTests/platform/mac/media/video-no-audio-expected.txt

    r145588 r146992  
    1818    RenderButton {INPUT} at (32,4) size 16x17
    1919    RenderFlexibleBox {DIV} at (49,5) size 273x15
    20       RenderSlider {INPUT} at (0,2) size 273x13
    21         RenderFlexibleBox {DIV} at (0,0) size 273x13
    22           RenderBlock {DIV} at (0,2) size 273x9
     20      RenderSlider {INPUT} at (45,2) size 183x13
     21        RenderFlexibleBox {DIV} at (0,0) size 183x13
     22          RenderBlock {DIV} at (0,2) size 183x9
    2323            RenderBlock {DIV} at (0,0) size 10x8
    2424    RenderButton {INPUT} at (329,4) size 16x17
    2525    RenderBlock {DIV} at (322,12) size 0x1
     26layer at (57,312) size 45x11
     27  RenderFlexibleBox {DIV} at (0,2) size 45x11 [color=#FFFFFF]
     28    RenderBlock (anonymous) at (9,0) size 27x11
     29      RenderText {#text} at (0,0) size 26x11
     30        text run at (0,0) width 26: "00:00"
     31layer at (285,312) size 45x11
     32  RenderFlexibleBox {DIV} at (228,2) size 45x11 [color=#FFFFFF]
     33    RenderBlock (anonymous) at (7,0) size 31x11
     34      RenderText {#text} at (0,0) size 31x11
     35        text run at (0,0) width 31: "-00:09"
  • trunk/LayoutTests/platform/mac/media/video-playing-and-pause-expected.txt

    r145588 r146992  
    1919    RenderButton {INPUT} at (32,4) size 16x17
    2020    RenderFlexibleBox {DIV} at (49,5) size 216x15
    21       RenderSlider {INPUT} at (0,2) size 216x13
    22         RenderFlexibleBox {DIV} at (0,0) size 216x13
    23           RenderBlock {DIV} at (0,2) size 216x9
     21      RenderSlider {INPUT} at (45,2) size 126x13
     22        RenderFlexibleBox {DIV} at (0,0) size 126x13
     23          RenderBlock {DIV} at (0,2) size 126x9
    2424            RenderBlock {DIV} at (0,0) size 10x8
    2525    RenderButton {INPUT} at (297,4) size 16x17
    2626    RenderBlock {DIV} at (265,6) size 25x13
     27layer at (57,290) size 45x11
     28  RenderFlexibleBox {DIV} at (0,2) size 45x11 [color=#FFFFFF]
     29    RenderBlock (anonymous) at (9,0) size 27x11
     30      RenderText {#text} at (0,0) size 26x11
     31        text run at (0,0) width 26: "00:00"
     32layer at (228,290) size 45x11
     33  RenderFlexibleBox {DIV} at (171,2) size 45x11 [color=#FFFFFF]
     34    RenderBlock (anonymous) at (7,0) size 31x11
     35      RenderText {#text} at (0,0) size 31x11
     36        text run at (0,0) width 31: "-00:06"
    2737layer at (275,290) size 14x12
    2838  RenderButton zI: 1 {INPUT} at (2,0) size 14x12
  • trunk/Source/WebCore/ChangeLog

    r146987 r146992  
     12013-03-26  Jer Noble  <jer.noble@apple.com>
     2
     3        Mac: Media Controls always hide time display elements
     4        https://bugs.webkit.org/show_bug.cgi?id=113355
     5
     6        Reviewed by Eric Carlson.
     7
     8        No new tests; rebaselined existing tests against correct behavior.
     9
     10        A prior commit set the "min-width:0" property on the time display elements, which, combined
     11        with the "-webkit-flex-box:0 0" setting, caused the flex-box container to collapse the width
     12        of the elements to zero. To achieve the desired effect of hiding the time display elements,
     13        first set the elements' min-width to the desired width, as the new flex-box spec treats the
     14        default value of "min-width:auto" as the intrinsic width, and will collapse the text display
     15        elements to the intrinsic width of its contained text node.
     16
     17        The above allows the timeline container to collapse beyond the sum of its childrens'
     18        intrinsic width. Create a custom renderer that detects when this happens, and hide the time
     19        display controls.
     20
     21        * css/mediaControls.css:
     22        * css/mediaControlsQuickTime.css:
     23        (audio::-webkit-media-controls-current-time-display, video::-webkit-media-controls-current-time-display):
     24            Set the "min-width:" property to equal the "width:" property.
     25        (audio::-webkit-media-controls-time-remaining-display, video::-webkit-media-controls-time-remaining-display):
     26            Ditto.
     27        * css/mediaControlsChromium.css:
     28        (audio::-webkit-media-controls-time-remaining-display, video::-webkit-media-controls-time-remaining-display):
     29            Chromium assumes the time display controls are flex-boxes, so make that explicit.
     30        * html/shadow/MediaControlElementTypes.cpp: Removed MediaControlTimeDisplayElement::createRenderer().
     31        * html/shadow/MediaControlElementTypes.h:
     32        (MediaControlTimeDisplayElement): Ditto.
     33        * html/shadow/MediaControlElements.cpp:
     34        (WebCore::MediaControlTimelineContainerElement::setTimeDisplaysHidden): Added, walks through the
     35            container's children and shows or hides time display elements.
     36        (WebCore::MediaControlTimelineContainerElement::createRenderer): Added, creates a RenderMediaControlTimelineContainer.
     37        (WebCore::getMediaControlTimeRemainingDisplayElementShadowPseudoId): Added, allow setTimeDisplaysHidden to
     38            query against children's shadowPseudoId().
     39        (WebCore::MediaControlTimeRemainingDisplayElement::shadowPseudoId): Moved contents to getMediaControlTimeRemainingDisplayElementShadowPseudoId.
     40        (WebCore::getMediaControlCurrentTimeDisplayElementShadowPseudoId): Added, allow setTimeDisplaysHidden to
     41            query against children's shadowPseudoId().
     42        (WebCore::MediaControlCurrentTimeDisplayElement::shadowPseudoId): Moved contents to getMediaControlCurrentTimeDisplayElementShadowPseudoId.
     43        * html/shadow/MediaControlElements.h:
     44        (MediaControlTimelineContainerElement):
     45        * rendering/RenderMediaControlElements.cpp:
     46        (WebCore::RenderMediaControlTimelineContainer::RenderMediaControlTimelineContainer): Added, simple constructor.
     47        (WebCore::RenderMediaControlTimelineContainer::layout): Detect when the controller's width is greater than
     48            a certain value, and show or hide the time display elements in response.
     49        * rendering/RenderMediaControlElements.h:
     50        (RenderMediaControlTimelineContainer):
     51
    1522013-03-27  Ilya Tikhonovsky  <loislo@chromium.org>
    253
  • trunk/Source/WebCore/css/mediaControlsChromium.css

    r142947 r146992  
    113113    -webkit-user-select: none;
    114114    -webkit-flex: none;
    115     display: block;
     115    display: -webkit-flex;
    116116    border: none;
    117117    cursor: default;
  • trunk/Source/WebCore/css/mediaControlsQuickTime.css

    r145588 r146992  
    8383    overflow: hidden;
    8484    width: 45px;
    85     min-width: 0; /* needed due to flexbox */
     85    min-width: 45px;
    8686    color: white;
    8787    text-shadow: black 0px 1px 1px;
     
    106106    overflow: hidden;
    107107    width: 45px;
    108     min-width: 0; /* needed due to flexbox */
     108    min-width: 45px;
    109109    color: white;
    110110    text-shadow: black 0px 1px 1px;
  • trunk/Source/WebCore/html/shadow/MediaControlElementTypes.cpp

    r145818 r146992  
    160160}
    161161
    162 RenderObject* MediaControlTimeDisplayElement::createRenderer(RenderArena* arena, RenderStyle*)
    163 {
    164     return new (arena) RenderMediaControlTimeDisplay(this);
    165 }
    166 
    167162// ----------------------------
    168163
  • trunk/Source/WebCore/html/shadow/MediaControlElementTypes.h

    r136613 r146992  
    142142
    143143private:
    144     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) OVERRIDE;
    145 
    146144    float m_currentValue;
    147145};
  • trunk/Source/WebCore/html/shadow/MediaControlElements.cpp

    r146647 r146992  
    6868using namespace HTMLNames;
    6969
     70static const AtomicString& getMediaControlCurrentTimeDisplayElementShadowPseudoId();
     71static const AtomicString& getMediaControlTimeRemainingDisplayElementShadowPseudoId();
     72
    7073#if ENABLE(VIDEO_TRACK)
    7174static const char* textTracksOffAttrValue = "-1"; // This must match HTMLMediaElement::textTracksOffIndex()
     
    317320    DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-timeline-container", AtomicString::ConstructFromLiteral));
    318321    return id;
     322}
     323
     324void MediaControlTimelineContainerElement::setTimeDisplaysHidden(bool hidden)
     325{
     326    for (unsigned i = 0; i < childNodeCount(); ++i) {
     327        Node* child = childNode(i);
     328        if (!child || !child->isElementNode())
     329            continue;
     330        Element* element = static_cast<Element*>(child);
     331        if (element->shadowPseudoId() != getMediaControlTimeRemainingDisplayElementShadowPseudoId()
     332            && element->shadowPseudoId() != getMediaControlCurrentTimeDisplayElementShadowPseudoId())
     333            continue;
     334
     335        MediaControlTimeDisplayElement* timeDisplay = static_cast<MediaControlTimeDisplayElement*>(element);
     336        if (hidden)
     337            timeDisplay->hide();
     338        else
     339            timeDisplay->show();
     340    }
     341}
     342
     343RenderObject* MediaControlTimelineContainerElement::createRenderer(RenderArena* arena, RenderStyle*)
     344{
     345    return new (arena) RenderMediaControlTimelineContainer(this);
    319346}
    320347
     
    11421169}
    11431170
     1171static const AtomicString& getMediaControlTimeRemainingDisplayElementShadowPseudoId()
     1172{
     1173    DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-time-remaining-display", AtomicString::ConstructFromLiteral));
     1174    return id;
     1175}
     1176
    11441177const AtomicString& MediaControlTimeRemainingDisplayElement::shadowPseudoId() const
    11451178{
    1146     DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-time-remaining-display", AtomicString::ConstructFromLiteral));
    1147     return id;
     1179    return getMediaControlTimeRemainingDisplayElementShadowPseudoId();
    11481180}
    11491181
     
    11601192}
    11611193
     1194static const AtomicString& getMediaControlCurrentTimeDisplayElementShadowPseudoId()
     1195{
     1196    DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-current-time-display", AtomicString::ConstructFromLiteral));
     1197    return id;
     1198}
     1199
    11621200const AtomicString& MediaControlCurrentTimeDisplayElement::shadowPseudoId() const
    11631201{
    1164     DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-current-time-display", AtomicString::ConstructFromLiteral));
    1165     return id;
     1202    return getMediaControlCurrentTimeDisplayElementShadowPseudoId();
    11661203}
    11671204
  • trunk/Source/WebCore/html/shadow/MediaControlElements.h

    r146380 r146992  
    107107    static PassRefPtr<MediaControlTimelineContainerElement> create(Document*);
    108108
     109    void setTimeDisplaysHidden(bool);
     110
    109111private:
    110112    explicit MediaControlTimelineContainerElement(Document*);
    111113    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
     114
     115    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) OVERRIDE;
    112116};
    113117
  • trunk/Source/WebCore/rendering/RenderMediaControlElements.cpp

    r142947 r146992  
    6060// ----------------------------
    6161
    62 RenderMediaControlTimeDisplay::RenderMediaControlTimeDisplay(Element* element)
     62RenderMediaControlTimelineContainer::RenderMediaControlTimelineContainer(Element* element)
    6363    : RenderFlexibleBox(element)
    6464{
     
    6969static const int minWidthToDisplayTimeDisplays = 45 + 100 + 45;
    7070
    71 void RenderMediaControlTimeDisplay::layout()
     71void RenderMediaControlTimelineContainer::layout()
    7272{
    7373    RenderFlexibleBox::layout();
    74     RenderBox* timelineContainerBox = parentBox();
    75     while (timelineContainerBox && timelineContainerBox->isAnonymous())
    76         timelineContainerBox = timelineContainerBox->parentBox();
    7774
    78     if (timelineContainerBox && timelineContainerBox->width() < minWidthToDisplayTimeDisplays)
    79         setWidth(0);
     75    LayoutStateDisabler layoutStateDisabler(view());
     76    MediaControlTimelineContainerElement* container = static_cast<MediaControlTimelineContainerElement*>(node());
     77    container->setTimeDisplaysHidden(width().toInt() < minWidthToDisplayTimeDisplays);
    8078}
    8179
  • trunk/Source/WebCore/rendering/RenderMediaControlElements.h

    r142947 r146992  
    4747// ----------------------------
    4848
    49 class RenderMediaControlTimeDisplay : public RenderFlexibleBox {
     49class RenderMediaControlTimelineContainer : public RenderFlexibleBox {
    5050public:
    51     RenderMediaControlTimeDisplay(Element*);
     51    RenderMediaControlTimelineContainer(Element*);
    5252
    5353private:
Note: See TracChangeset for help on using the changeset viewer.