Changeset 47110 in webkit


Ignore:
Timestamp:
Aug 12, 2009 9:20:34 AM (15 years ago)
Author:
eric.carlson@apple.com
Message:

2009-08-12 Eric Carlson <eric.carlson@apple.com>

Reviewed by Oliver Hunt.

<video> and <audio> controller should be accessible
https://bugs.webkit.org/show_bug.cgi?id=28081

Test: accessibility/media-element.html

  • GNUmakefile.am:
  • WebCore.gypi:
  • WebCore.pro:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • WebCoreSources.bkl:

Add AccessibilityMediaControls.cpp/.h

  • accessibility/AXObjectCache.cpp:
  • accessibility/AXObjectCache.h: (WebCore::AXObjectCache::getOrCreate):

Create AccessibilityMediaControl. Update Copyright

  • accessibility/AccessibilityMediaControls.cpp:
  • accessibility/AccessibilityMediaControls.h:

Added.

  • accessibility/AccessibilityObject.cpp:
  • accessibility/AccessibilityObject.h:

Add isMediaTimeline. Update Copyright.

  • accessibility/AccessibilitySlider.h:

Make constructor protected instead of private so AccessibilityMediaTimeline can
call it.

  • accessibility/mac/AccessibilityObjectWrapper.mm: (-[AccessibilityObjectWrapper accessibilityAttributeNames]):

Add NSAccessibilityValueDescriptionAttribute to range attributes.

(-[AccessibilityObjectWrapper subrole]):

Return NSAccessibilityTimelineSubrole for AccessibilityMediaTimeline.

  • dom/Node.h:

add isMediaControlElement.

  • page/mac/WebCoreViewFactory.h:
  • platform/LocalizedStrings.h:
  • platform/mac/LocalizedStringsMac.mm: (WebCore::localizedMediaControlElementString): (WebCore::localizedMediaControlElementHelpText): (WebCore::localizedMediaTimeDescription):

New, return localized media controller strings.

  • rendering/MediaControlElements.cpp: (WebCore::MediaControlElement::MediaControlElement):

Initialize m_displayType.

(WebCore::MediaControlElement::MediaControlElement):
(WebCore::MediaControlStatusDisplayElement::MediaControlStatusDisplayElement):

Fix style.

(WebCore::MediaControlInputElement::MediaControlInputElement):

Set m_displayType based on pseudo style ID.

(WebCore::MediaControlInputElement::MediaControlInputElement):

rename local "o" to "object".

(WebCore::MediaControlMuteButtonElement::MediaControlMuteButtonElement):
(WebCore::MediaControlPlayButtonElement::MediaControlPlayButtonElement):
(WebCore::MediaControlSeekButtonElement::MediaControlSeekButtonElement):
(WebCore::MediaControlRewindButtonElement::MediaControlRewindButtonElement):
(WebCore::MediaControlReturnToRealtimeButtonElement::MediaControlReturnToRealtimeButtonElement):
(WebCore::MediaControlTimelineElement::MediaControlTimelineElement):
(WebCore::MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement):
(WebCore::MediaControlTimelineElement::MediaControlTimelineElement):
(WebCore::MediaControlTimelineElement::MediaControlTimelineElement):
(WebCore::MediaControlTimelineElement::MediaControlTimelineElement):

Update for MediaControlInputElement constructor change.

(WebCore::MediaControlTimeDisplayElement::formatTime):

New, moved here from RenderMedia so AccessibilityMediaTimeDisplay can use it.

(WebCore::MediaControlTimeDisplayElement::setCurrentValue):

New, set text to current time.

  • rendering/MediaControlElements.h:
  • rendering/RenderMedia.cpp: (WebCore::RenderMedia::updateControls):

Create controls in tab order.

(WebCore::RenderMedia::formatTime):

Moved to MediaControlTimeDisplayElement::formatTime.

(WebCore::RenderMedia::updateTimeDisplay):

Call MediaControlTimeDisplayElement::setCurrentValue.

  • rendering/RenderMedia.h:

2009-08-12 Eric Carlson <eric.carlson@apple.com>

Reviewed by Oliver Hunt.

<video> and <audio> controller should be accessible
https://bugs.webkit.org/show_bug.cgi?id=28081

Add localized strings for media controller accessiblility.

  • English.lproj/Localizable.strings:

2009-08-12 Eric Carlson <eric.carlson@apple.com>

Reviewed by Oliver Hunt.

<video> and <audio> controller should be accessible
https://bugs.webkit.org/show_bug.cgi?id=28081

  • WebCoreSupport/WebViewFactory.mm: (-[WebViewFactory localizedMediaControlElementString:]): (-[WebViewFactory localizedMediaControlElementHelpText:]): (-[WebViewFactory localizedMediaTimeDescription:]):

New.

2009-08-12 Eric Carlson <eric.carlson@apple.com>

Reviewed by Oliver Hunt.

<video> and <audio> controller should be accessible
https://bugs.webkit.org/show_bug.cgi?id=28081

  • WebCoreLocalizedStrings.cpp: (WebCore::localizedMediaControlElementString): (WebCore::localizedMediaControlElementHelpText): (WebCore::localizedMediaTimeDescription):

New.

2009-08-12 Eric Carlson <eric.carlson@apple.com>

Reviewed by Oliver Hunt.

<video> and <audio> controller should be accessible
https://bugs.webkit.org/show_bug.cgi?id=28081

  • accessibility/media-element.html: Added.
  • platform/mac-leopard/accessibility/media-element-expected.txt:
  • platform/mac-leopard/media/controls-strict-expected.txt:
  • platform/mac/accessibility/media-element-expected.txt:

Added.

  • platform/mac-leopard/media/controls-after-reload-expected.txt:
  • platform/mac-leopard/media/controls-styling-expected.txt:
  • platform/mac-leopard/media/video-empty-source-expected.txt:
  • platform/mac-leopard/media/video-zoom-controls-expected.txt:
  • media/video-controls-visible-audio-only.html:
  • platform/mac-leopard/media/audio-controls-rendering-expected.txt:
  • platform/mac/media/audio-controls-rendering-expected.txt:
  • platform/mac/media/controls-after-reload-expected.txt:
  • platform/mac/media/controls-styling-expected.txt:
  • platform/mac/media/video-controls-rendering-expected.txt:
  • platform/mac/media/video-display-toggle-expected.txt:
  • platform/mac/media/video-empty-source-expected.txt:
  • platform/mac/media/video-zoom-controls-expected.txt:

Update for controller element tab order change.

Location:
trunk
Files:
6 added
41 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r47107 r47110  
     12009-08-12  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        <video> and <audio> controller should be accessible
     6        https://bugs.webkit.org/show_bug.cgi?id=28081
     7
     8        * accessibility/media-element.html: Added.
     9        * platform/mac-leopard/accessibility/media-element-expected.txt:
     10        * platform/mac-leopard/media/controls-strict-expected.txt:
     11        * platform/mac/accessibility/media-element-expected.txt:
     12            Added.
     13
     14        * platform/mac-leopard/media/controls-after-reload-expected.txt:
     15        * platform/mac-leopard/media/controls-styling-expected.txt:
     16        * platform/mac-leopard/media/video-empty-source-expected.txt:
     17        * platform/mac-leopard/media/video-zoom-controls-expected.txt:
     18        * media/video-controls-visible-audio-only.html:
     19        * platform/mac-leopard/media/audio-controls-rendering-expected.txt:
     20        * platform/mac/media/audio-controls-rendering-expected.txt:
     21        * platform/mac/media/controls-after-reload-expected.txt:
     22        * platform/mac/media/controls-styling-expected.txt:
     23        * platform/mac/media/video-controls-rendering-expected.txt:
     24        * platform/mac/media/video-display-toggle-expected.txt:
     25        * platform/mac/media/video-empty-source-expected.txt:
     26        * platform/mac/media/video-zoom-controls-expected.txt:
     27            Update for controller element tab order change.
     28
    1292009-08-12  Brady Eidson  <beidson@apple.com>
    230
  • trunk/LayoutTests/media/video-controls-visible-audio-only.html

    r40219 r47110  
    3434
    3535                // start playback
    36                 eventSender.mouseMoveTo(left + 16 + 8, bottom - 8);
     36                eventSender.mouseMoveTo(left + 8, bottom - 8);
    3737                eventSender.mouseDown();
    3838                eventSender.mouseUp();
  • trunk/LayoutTests/platform/mac-leopard/media/audio-controls-rendering-expected.txt

    r46288 r47110  
    2020  RenderFlexibleBox (positioned) {DIV} at (0,0) size 200x16
    2121    RenderButton {INPUT} at (0,0) size 16x16
    22     RenderButton {INPUT} at (16,0) size 16x16
    23     RenderFlexibleBox {DIV} at (32,0) size 136x16
     22    RenderFlexibleBox {DIV} at (16,0) size 136x16
    2423      RenderSlider {INPUT} at (0,0) size 136x16
    2524        RenderBlock {DIV} at (2,1) size 13x14
     25    RenderButton {INPUT} at (152,0) size 16x16
    2626    RenderButton {INPUT} at (168,0) size 16x16
    2727    RenderButton {INPUT} at (184,0) size 16x16
     
    3131  RenderFlexibleBox (positioned) {DIV} at (0,0) size 320x16
    3232    RenderButton {INPUT} at (0,0) size 16x16
    33     RenderButton {INPUT} at (16,0) size 16x16
    34     RenderFlexibleBox {DIV} at (32,0) size 256x16
     33    RenderFlexibleBox {DIV} at (16,0) size 256x16
    3534      RenderSlider {INPUT} at (0,0) size 256x16
    3635        RenderBlock {DIV} at (2,1) size 13x14
     36    RenderButton {INPUT} at (272,0) size 16x16
    3737    RenderButton {INPUT} at (288,0) size 16x16
    3838    RenderButton {INPUT} at (304,0) size 16x16
     
    4444  RenderFlexibleBox (positioned) {DIV} at (0,84) size 320x16
    4545    RenderButton {INPUT} at (0,0) size 16x16
    46     RenderButton {INPUT} at (16,0) size 16x16
    47     RenderFlexibleBox {DIV} at (32,0) size 256x16
     46    RenderFlexibleBox {DIV} at (16,0) size 256x16
    4847      RenderSlider {INPUT} at (0,0) size 256x16
    4948        RenderBlock {DIV} at (2,1) size 13x14
     49    RenderButton {INPUT} at (272,0) size 16x16
    5050    RenderButton {INPUT} at (288,0) size 16x16
    5151    RenderButton {INPUT} at (304,0) size 16x16
  • trunk/LayoutTests/platform/mac-leopard/media/controls-after-reload-expected.txt

    r45628 r47110  
    1818  RenderFlexibleBox (positioned) {DIV} at (0,224) size 320x16
    1919    RenderButton {INPUT} at (0,0) size 16x16
    20     RenderButton {INPUT} at (16,0) size 16x16
    21     RenderFlexibleBox {DIV} at (32,0) size 256x16
     20    RenderFlexibleBox {DIV} at (16,0) size 256x16
    2221      RenderSlider {INPUT} at (0,0) size 256x16
    2322        RenderBlock {DIV} at (2,1) size 13x14
     23    RenderButton {INPUT} at (272,0) size 16x16
    2424    RenderButton {INPUT} at (288,0) size 16x16
    2525    RenderButton {INPUT} at (304,0) size 16x16
  • trunk/LayoutTests/platform/mac-leopard/media/controls-styling-expected.txt

    r45610 r47110  
    2222  RenderFlexibleBox (positioned) {DIV} at (0,224) size 320x16
    2323    RenderButton {INPUT} at (0,0) size 16x16
    24     RenderButton {INPUT} at (16,0) size 16x16
    25     RenderFlexibleBox {DIV} at (32,0) size 256x16
     24    RenderFlexibleBox {DIV} at (16,0) size 256x16
    2625      RenderSlider {INPUT} at (0,0) size 256x16
    2726        RenderBlock {DIV} at (2,1) size 13x14
     27    RenderButton {INPUT} at (272,0) size 16x16
    2828    RenderButton {INPUT} at (288,0) size 16x16
    2929    RenderButton {INPUT} at (304,0) size 16x16
     
    3333  RenderFlexibleBox (positioned) {DIV} at (0,224) size 320x16
    3434    RenderButton {INPUT} at (0,0) size 16x16
    35     RenderButton {INPUT} at (16,0) size 16x16
    36     RenderFlexibleBox {DIV} at (32,0) size 256x16
     35    RenderFlexibleBox {DIV} at (16,0) size 256x16
    3736      RenderSlider {INPUT} at (0,0) size 256x16
    3837        RenderBlock {DIV} at (2,1) size 13x14
     38    RenderButton {INPUT} at (272,0) size 16x16
    3939    RenderButton {INPUT} at (288,0) size 16x16
    4040    RenderButton {INPUT} at (304,0) size 16x16
  • trunk/LayoutTests/platform/mac-leopard/media/video-empty-source-expected.txt

    r45655 r47110  
    1818  RenderFlexibleBox (positioned) {DIV} at (0,134) size 300x16
    1919    RenderButton {INPUT} at (0,0) size 16x16
    20     RenderButton {INPUT} at (16,0) size 16x16
    21     RenderFlexibleBox {DIV} at (32,0) size 236x16
     20    RenderFlexibleBox {DIV} at (16,0) size 236x16
    2221      RenderSlider {INPUT} at (0,0) size 236x16
    2322        RenderBlock {DIV} at (2,1) size 13x14
     23    RenderButton {INPUT} at (252,0) size 16x16
    2424    RenderButton {INPUT} at (268,0) size 16x16
    2525    RenderButton {INPUT} at (284,0) size 16x16
  • trunk/LayoutTests/platform/mac-leopard/media/video-zoom-controls-expected.txt

    r45687 r47110  
    1414  RenderFlexibleBox (positioned) {DIV} at (0,156) size 240x24
    1515    RenderButton {INPUT} at (0,0) size 24x24
    16     RenderButton {INPUT} at (24,0) size 24x24
    17     RenderFlexibleBox {DIV} at (48,0) size 144x24
     16    RenderFlexibleBox {DIV} at (24,0) size 144x24
    1817      RenderSlider {INPUT} at (0,0) size 144x24
    1918        RenderBlock {DIV} at (3,1) size 19x21
     19    RenderButton {INPUT} at (168,0) size 24x24
    2020    RenderButton {INPUT} at (192,0) size 24x24
    2121    RenderButton {INPUT} at (216,0) size 24x24
     
    2727  RenderFlexibleBox (positioned) {DIV} at (0,156) size 240x24
    2828    RenderButton {INPUT} at (0,0) size 24x24
    29     RenderButton {INPUT} at (24,0) size 24x24
    30     RenderFlexibleBox {DIV} at (48,0) size 144x24
     29    RenderFlexibleBox {DIV} at (24,0) size 144x24
    3130      RenderSlider {INPUT} at (0,0) size 144x24
    3231        RenderBlock {DIV} at (3,1) size 19x21
     32    RenderButton {INPUT} at (168,0) size 24x24
    3333    RenderButton {INPUT} at (192,0) size 24x24
    3434    RenderButton {INPUT} at (216,0) size 24x24
  • trunk/LayoutTests/platform/mac/media/audio-controls-rendering-expected.txt

    r46279 r47110  
    2020  RenderFlexibleBox (positioned) {DIV} at (0,0) size 200x25
    2121    RenderButton {INPUT} at (6,3) size 18x18
    22     RenderButton {INPUT} at (177,5) size 15x14
    2322    RenderButton {INPUT} at (32,4) size 16x16
    2423    RenderFlexibleBox {DIV} at (49,1) size 126x22
    2524      RenderSlider {INPUT} at (0,5) size 126x13
    2625        RenderBlock {DIV} at (0,1) size 12x10
     26    RenderButton {INPUT} at (177,5) size 15x14
    2727layer at (8,85) size 320x25
    2828  RenderBlock (relative positioned) {DIV} at (0,0) size 320x25
     
    3030  RenderFlexibleBox (positioned) {DIV} at (0,0) size 320x25
    3131    RenderButton {INPUT} at (6,3) size 18x18
    32     RenderButton {INPUT} at (297,5) size 15x14
    3332    RenderButton {INPUT} at (32,4) size 16x16
    3433    RenderFlexibleBox {DIV} at (49,5) size 246x15
    3534      RenderSlider {INPUT} at (45,2) size 156x13
    3635        RenderBlock {DIV} at (0,1) size 12x10
     36    RenderButton {INPUT} at (297,5) size 15x14
    3737layer at (57,92) size 45x11 scrollHeight 13
    3838  RenderFlexibleBox {DIV} at (0,2) size 45x11 [color=#FFFFFF]
     
    5252  RenderFlexibleBox (positioned) {DIV} at (0,75) size 320x25
    5353    RenderButton {INPUT} at (6,3) size 18x18
    54     RenderButton {INPUT} at (297,5) size 15x14
    5554    RenderButton {INPUT} at (32,4) size 16x16
    5655    RenderFlexibleBox {DIV} at (49,5) size 246x15
    5756      RenderSlider {INPUT} at (45,2) size 156x13
    5857        RenderBlock {DIV} at (0,1) size 12x10
     58    RenderButton {INPUT} at (297,5) size 15x14
    5959layer at (57,210) size 45x11 scrollHeight 13
    6060  RenderFlexibleBox {DIV} at (0,2) size 45x11 [color=#FFFFFF]
  • trunk/LayoutTests/platform/mac/media/controls-after-reload-expected.txt

    r46140 r47110  
    1818  RenderFlexibleBox (positioned) {DIV} at (0,215) size 320x25
    1919    RenderButton {INPUT} at (6,3) size 18x18
    20     RenderButton {INPUT} at (297,5) size 15x14
    2120    RenderButton {INPUT} at (32,4) size 16x16
    2221    RenderFlexibleBox {DIV} at (49,5) size 246x15
    2322      RenderSlider {INPUT} at (45,2) size 156x13
    2423        RenderBlock {DIV} at (0,1) size 12x10
     24    RenderButton {INPUT} at (297,5) size 15x14
    2525layer at (57,264) size 45x11 scrollHeight 13
    2626  RenderFlexibleBox {DIV} at (0,2) size 45x11 [color=#FFFFFF]
  • trunk/LayoutTests/platform/mac/media/controls-styling-expected.txt

    r46140 r47110  
    2222  RenderFlexibleBox (positioned) {DIV} at (0,215) size 320x25
    2323    RenderButton {INPUT} at (6,3) size 18x18
    24     RenderButton {INPUT} at (297,5) size 15x14
    2524    RenderButton {INPUT} at (32,4) size 16x16
    2625    RenderFlexibleBox {DIV} at (49,5) size 246x15
    2726      RenderSlider {INPUT} at (45,2) size 156x13
    2827        RenderBlock {DIV} at (0,1) size 12x10
     28    RenderButton {INPUT} at (297,5) size 15x14
    2929layer at (67,264) size 45x11 scrollHeight 13
    3030  RenderFlexibleBox {DIV} at (0,2) size 45x11 [color=#FFFFFF]
     
    4242  RenderFlexibleBox (positioned) {DIV} at (0,215) size 320x25
    4343    RenderButton {INPUT} at (6,3) size 18x18
    44     RenderButton {INPUT} at (297,5) size 15x14
    4544    RenderButton {INPUT} at (32,4) size 16x16
    4645    RenderFlexibleBox {DIV} at (49,5) size 246x15
    4746      RenderSlider {INPUT} at (45,2) size 156x13
    4847        RenderBlock {DIV} at (0,1) size 12x10
     48    RenderButton {INPUT} at (297,5) size 15x14
    4949layer at (57,504) size 45x11 scrollHeight 13
    5050  RenderFlexibleBox {DIV} at (0,2) size 45x11 [color=#FFFFFF]
  • trunk/LayoutTests/platform/mac/media/video-controls-rendering-expected.txt

    r45271 r47110  
    2121  RenderFlexibleBox (positioned) {DIV} at (0,224) size 320x16
    2222    RenderButton {INPUT} at (0,0) size 16x16
    23     RenderButton {INPUT} at (16,0) size 16x16
    24     RenderFlexibleBox {DIV} at (32,0) size 256x16
     23    RenderFlexibleBox {DIV} at (16,0) size 256x16
    2524      RenderSlider {INPUT} at (0,0) size 256x16
    2625        RenderBlock {DIV} at (2,1) size 13x14
     26    RenderButton {INPUT} at (272,0) size 16x16
    2727    RenderButton {INPUT} at (288,0) size 16x16
    2828    RenderButton {INPUT} at (304,0) size 16x16
     
    3232  RenderFlexibleBox (positioned) {DIV} at (0,224) size 320x16
    3333    RenderButton {INPUT} at (0,0) size 16x16
    34     RenderButton {INPUT} at (16,0) size 16x16
    35     RenderFlexibleBox {DIV} at (32,0) size 256x16
     34    RenderFlexibleBox {DIV} at (16,0) size 256x16
    3635      RenderSlider {INPUT} at (0,0) size 256x16
    3736        RenderBlock {DIV} at (2,1) size 13x14
     37    RenderButton {INPUT} at (272,0) size 16x16
    3838    RenderButton {INPUT} at (288,0) size 16x16
    3939    RenderButton {INPUT} at (304,0) size 16x16
     
    4545  RenderFlexibleBox (positioned) {DIV} at (0,224) size 320x16
    4646    RenderButton {INPUT} at (0,0) size 16x16
    47     RenderButton {INPUT} at (16,0) size 16x16
    48     RenderFlexibleBox {DIV} at (32,0) size 256x16
     47    RenderFlexibleBox {DIV} at (16,0) size 256x16
    4948      RenderSlider {INPUT} at (0,0) size 256x16
    5049        RenderBlock {DIV} at (2,1) size 13x14
     50    RenderButton {INPUT} at (272,0) size 16x16
    5151    RenderButton {INPUT} at (288,0) size 16x16
    5252    RenderButton {INPUT} at (304,0) size 16x16
  • trunk/LayoutTests/platform/mac/media/video-display-toggle-expected.txt

    r45271 r47110  
    1717  RenderFlexibleBox (positioned) {DIV} at (0,224) size 320x16
    1818    RenderButton {INPUT} at (0,0) size 16x16
    19     RenderButton {INPUT} at (16,0) size 16x16
    20     RenderFlexibleBox {DIV} at (32,0) size 256x16
     19    RenderFlexibleBox {DIV} at (16,0) size 256x16
    2120      RenderSlider {INPUT} at (0,0) size 256x16
    2221        RenderBlock {DIV} at (2,1) size 13x14
     22    RenderButton {INPUT} at (272,0) size 16x16
    2323    RenderButton {INPUT} at (288,0) size 16x16
    2424    RenderButton {INPUT} at (304,0) size 16x16
  • trunk/LayoutTests/platform/mac/media/video-empty-source-expected.txt

    r45744 r47110  
    1818  RenderFlexibleBox (positioned) {DIV} at (0,125) size 300x25
    1919    RenderButton {INPUT} at (6,3) size 18x18
     20    RenderButton {INPUT} at (32,4) size 16x16
    2021    RenderButton {INPUT} at (277,5) size 15x14
    21     RenderButton {INPUT} at (32,4) size 16x16
  • trunk/LayoutTests/platform/mac/media/video-zoom-controls-expected.txt

    r46140 r47110  
    1414  RenderFlexibleBox (positioned) {DIV} at (0,143) size 240x37
    1515    RenderButton {INPUT} at (9,4) size 27x27
    16     RenderButton {INPUT} at (206,8) size 22x21
    1716    RenderButton {INPUT} at (48,6) size 24x24
    1817    RenderFlexibleBox {DIV} at (73,1) size 130x34
    1918      RenderSlider {INPUT} at (0,9) size 130x19
    2019        RenderBlock {DIV} at (0,2) size 18x15
     20    RenderButton {INPUT} at (206,8) size 22x21
    2121layer at (57,310) size 240x180
    2222  RenderVideo {VIDEO} at (45,298) size 240x180
     
    2626  RenderFlexibleBox (positioned) {DIV} at (0,143) size 240x37
    2727    RenderButton {INPUT} at (9,4) size 27x27
    28     RenderButton {INPUT} at (206,8) size 22x21
    2928    RenderButton {INPUT} at (48,6) size 24x24
    3029    RenderFlexibleBox {DIV} at (73,1) size 130x34
    3130      RenderSlider {INPUT} at (0,9) size 130x19
    3231        RenderBlock {DIV} at (0,2) size 18x15
     32    RenderButton {INPUT} at (206,8) size 22x21
  • trunk/WebCore/ChangeLog

    r47108 r47110  
     12009-08-12  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        <video> and <audio> controller should be accessible
     6        https://bugs.webkit.org/show_bug.cgi?id=28081
     7
     8        Test: accessibility/media-element.html
     9
     10        * GNUmakefile.am:
     11        * WebCore.gypi:
     12        * WebCore.pro:
     13        * WebCore.vcproj/WebCore.vcproj:
     14        * WebCore.xcodeproj/project.pbxproj:
     15        * WebCoreSources.bkl:
     16            Add AccessibilityMediaControls.cpp/.h
     17
     18        * accessibility/AXObjectCache.cpp:
     19        * accessibility/AXObjectCache.h:
     20        (WebCore::AXObjectCache::getOrCreate):
     21            Create AccessibilityMediaControl. Update Copyright
     22
     23        * accessibility/AccessibilityMediaControls.cpp:
     24        * accessibility/AccessibilityMediaControls.h:
     25            Added.
     26
     27        * accessibility/AccessibilityObject.cpp:
     28        * accessibility/AccessibilityObject.h:
     29            Add isMediaTimeline. Update Copyright.
     30
     31        * accessibility/AccessibilitySlider.h:
     32            Make constructor protected instead of private so AccessibilityMediaTimeline can
     33            call it.
     34
     35        * accessibility/mac/AccessibilityObjectWrapper.mm:
     36        (-[AccessibilityObjectWrapper accessibilityAttributeNames]):
     37            Add NSAccessibilityValueDescriptionAttribute to range attributes.
     38        (-[AccessibilityObjectWrapper subrole]):
     39            Return NSAccessibilityTimelineSubrole for AccessibilityMediaTimeline.
     40
     41        * dom/Node.h:
     42            add isMediaControlElement.
     43
     44        * page/mac/WebCoreViewFactory.h:
     45        * platform/LocalizedStrings.h:
     46        * platform/mac/LocalizedStringsMac.mm:
     47        (WebCore::localizedMediaControlElementString):
     48        (WebCore::localizedMediaControlElementHelpText):
     49        (WebCore::localizedMediaTimeDescription):
     50            New, return localized media controller strings.
     51
     52        * rendering/MediaControlElements.cpp:
     53        (WebCore::MediaControlElement::MediaControlElement):
     54            Initialize m_displayType.
     55        (WebCore::MediaControlElement::MediaControlElement):
     56        (WebCore::MediaControlStatusDisplayElement::MediaControlStatusDisplayElement):
     57            Fix style.
     58        (WebCore::MediaControlInputElement::MediaControlInputElement):
     59            Set m_displayType based on pseudo style ID.
     60        (WebCore::MediaControlInputElement::MediaControlInputElement):
     61            rename local "o" to "object".
     62        (WebCore::MediaControlMuteButtonElement::MediaControlMuteButtonElement):
     63        (WebCore::MediaControlPlayButtonElement::MediaControlPlayButtonElement):
     64        (WebCore::MediaControlSeekButtonElement::MediaControlSeekButtonElement):
     65        (WebCore::MediaControlRewindButtonElement::MediaControlRewindButtonElement):
     66        (WebCore::MediaControlReturnToRealtimeButtonElement::MediaControlReturnToRealtimeButtonElement):
     67        (WebCore::MediaControlTimelineElement::MediaControlTimelineElement):
     68        (WebCore::MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement):
     69        (WebCore::MediaControlTimelineElement::MediaControlTimelineElement):
     70        (WebCore::MediaControlTimelineElement::MediaControlTimelineElement):
     71        (WebCore::MediaControlTimelineElement::MediaControlTimelineElement):
     72            Update for MediaControlInputElement constructor change.
     73        (WebCore::MediaControlTimeDisplayElement::formatTime):
     74            New, moved here from RenderMedia so AccessibilityMediaTimeDisplay can use it.
     75        (WebCore::MediaControlTimeDisplayElement::setCurrentValue):
     76            New, set text to current time.
     77        * rendering/MediaControlElements.h:
     78
     79        * rendering/RenderMedia.cpp:
     80        (WebCore::RenderMedia::updateControls):
     81            Create controls in tab order.
     82        (WebCore::RenderMedia::formatTime):
     83            Moved to MediaControlTimeDisplayElement::formatTime.
     84        (WebCore::RenderMedia::updateTimeDisplay):
     85            Call MediaControlTimeDisplayElement::setCurrentValue.
     86        * rendering/RenderMedia.h:
     87
    1882009-08-12  Viet-Trung Luu  <viettrungluu@gmail.com>
    289
  • trunk/WebCore/GNUmakefile.am

    r47100 r47110  
    289289        WebCore/accessibility/AccessibilityListBoxOption.cpp \
    290290        WebCore/accessibility/AccessibilityListBoxOption.h \
     291        WebCore/accessibility/AccessibilityMediaControls.cpp \
     292        WebCore/accessibility/AccessibilityMediaControls.h \
    291293        WebCore/accessibility/AccessibilityObject.cpp \
    292294        WebCore/accessibility/AccessibilityObject.h \
  • trunk/WebCore/WebCore.gypi

    r47081 r47110  
    370370            'accessibility/AccessibilityListBoxOption.cpp',
    371371            'accessibility/AccessibilityListBoxOption.h',
     372            'accessibility/AccessibilityMediaControls.cpp',
     373            'accessibility/AccessibilityMediaControls.h',
    372374            'accessibility/AccessibilityObject.cpp',
    373375            'accessibility/AccessibilityObject.h',
  • trunk/WebCore/WebCore.pro

    r47094 r47110  
    608608SOURCES += \
    609609    accessibility/AccessibilityImageMapLink.cpp \
     610    accessibility/AccessibilityMediaControls.cpp \   
    610611    accessibility/AccessibilityObject.cpp \   
    611612    accessibility/AccessibilityList.cpp \   
     
    12951296    accessibility/AccessibilityListBoxOption.h \
    12961297    accessibility/AccessibilityList.h \
     1298    accessibility/AccessibilityMediaControls.h \
    12971299    accessibility/AccessibilityObject.h \
    12981300    accessibility/AccessibilityRenderObject.h \
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r47073 r47110  
    1658316583                        <File
    1658416584                                RelativePath="..\accessibility\AccessibilityListBoxOption.h"
     16585                                >
     16586                        </File>
     16587                        <File
     16588                                RelativePath="..\accessibility\AccessibilityMediaControls.cpp"
     16589                                >
     16590                        </File>
     16591                        <File
     16592                                RelativePath="..\accessibility\AccessibilityMediaControls.h"
    1658516593                                >
    1658616594                        </File>
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r47056 r47110  
    3939                0709FC4E1025DEE30059CDBA /* AccessibilitySlider.h in Headers */ = {isa = PBXBuildFile; fileRef = 0709FC4D1025DEE30059CDBA /* AccessibilitySlider.h */; };
    4040                0735EE6A0F40C5E4004A2604 /* MediaPlayerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 0735EE690F40C5E4004A2604 /* MediaPlayerProxy.h */; settings = {ATTRIBUTES = (Private, ); }; };
     41                07B0113D1032241900FBDC33 /* AccessibilityMediaControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07B0113C1032241900FBDC33 /* AccessibilityMediaControls.cpp */; };
     42                07B0113F1032242200FBDC33 /* AccessibilityMediaControls.h in Headers */ = {isa = PBXBuildFile; fileRef = 07B0113E1032242200FBDC33 /* AccessibilityMediaControls.h */; };
    4143                080081960ED3B2DD00C53BC0 /* WMLAnchorElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 080081940ED3B2DD00C53BC0 /* WMLAnchorElement.cpp */; };
    4244                080081970ED3B2DD00C53BC0 /* WMLAnchorElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 080081950ED3B2DD00C53BC0 /* WMLAnchorElement.h */; };
     
    645647                3390CA550FFC157B00921962 /* NotificationCenter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3390CA510FFC157B00921962 /* NotificationCenter.cpp */; };
    646648                3390CA560FFC157B00921962 /* NotificationCenter.h in Headers */ = {isa = PBXBuildFile; fileRef = 3390CA520FFC157B00921962 /* NotificationCenter.h */; };
    647                 3390CA570FFC157B00921962 /* NotificationCenter.idl in Resources */ = {isa = PBXBuildFile; fileRef = 3390CA530FFC157B00921962 /* NotificationCenter.idl */; };
    648649                3390CA580FFC157B00921962 /* NotificationContents.h in Headers */ = {isa = PBXBuildFile; fileRef = 3390CA540FFC157B00921962 /* NotificationContents.h */; };
    649650                371F4F400D25B9AF00ECE0D5 /* FontData.h in Headers */ = {isa = PBXBuildFile; fileRef = 371F4F3E0D25B9AF00ECE0D5 /* FontData.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    50095010                079F5E4B0F3BEBEA005E0782 /* MediaPlayerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaPlayerPrivate.h; sourceTree = "<group>"; };
    50105011                07AFE5900F1446BD00841617 /* mediaControlsQT.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mediaControlsQT.css; sourceTree = "<group>"; };
     5012                07B0113C1032241900FBDC33 /* AccessibilityMediaControls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityMediaControls.cpp; sourceTree = "<group>"; };
     5013                07B0113E1032242200FBDC33 /* AccessibilityMediaControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityMediaControls.h; sourceTree = "<group>"; };
    50115014                080081940ED3B2DD00C53BC0 /* WMLAnchorElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLAnchorElement.cpp; sourceTree = "<group>"; };
    50125015                080081950ED3B2DD00C53BC0 /* WMLAnchorElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLAnchorElement.h; sourceTree = "<group>"; };
     
    99859988                                29A8121F0FBB9C1D00510293 /* AccessibilityListBoxOption.cpp */,
    99869989                                29A812240FBB9C1D00510293 /* AccessibilityListBoxOption.h */,
     9990                                07B0113C1032241900FBDC33 /* AccessibilityMediaControls.cpp */,
     9991                                07B0113E1032242200FBDC33 /* AccessibilityMediaControls.h */,
    99879992                                29A8121E0FBB9C1D00510293 /* AccessibilityObject.cpp */,
    99889993                                29A812180FBB9C1D00510293 /* AccessibilityObject.h */,
     
    1724817253                                49484FCE102CF23C00187DD3 /* CanvasStyle.h in Headers */,
    1724917254                                416E29A6102FA962007FC14E /* WorkerReportingProxy.h in Headers */,
     17255                                07B0113F1032242200FBDC33 /* AccessibilityMediaControls.h in Headers */,
    1725017256                        );
    1725117257                        runOnlyForDeploymentPostprocessing = 0;
     
    1930419310                                49484FCA102CF23C00187DD3 /* CanvasRenderingContext2D.cpp in Sources */,
    1930519311                                49484FCD102CF23C00187DD3 /* CanvasStyle.cpp in Sources */,
     19312                                07B0113D1032241900FBDC33 /* AccessibilityMediaControls.cpp in Sources */,
    1930619313                        );
    1930719314                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/WebCoreSources.bkl

    r46937 r47110  
    3838        accessibility/AccessibilityARIAGridRow.cpp
    3939        accessibility/AccessibilityImageMapLink.cpp
     40        accessibility/AccessibilityMediaControls.cpp
    4041        accessibility/AccessibilityObject.cpp
    4142        accessibility/AccessibilityList.cpp
  • trunk/WebCore/accessibility/AXObjectCache.cpp

    r46878 r47110  
    11/*
    2  * Copyright (C) 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3737#include "AccessibilityListBoxOption.h"
    3838#include "AccessibilityImageMapLink.h"
     39#include "AccessibilityMediaControls.h"
    3940#include "AccessibilityRenderObject.h"
    4041#include "AccessibilitySlider.h"
     
    4647#include "InputElement.h"
    4748#include "HTMLNames.h"
     49#if ENABLE(VIDEO)
     50#include "MediaControlElements.h"
     51#endif
    4852#include "RenderObject.h"
    4953#include "RenderView.h"
     
    127131        else if (renderer->isTableCell())
    128132            newObj = AccessibilityTableCell::create(renderer);
     133
     134#if ENABLE(VIDEO)
     135        // media controls
     136        else if (renderer->node() && renderer->node()->isMediaControlElement())
     137            newObj = AccessibilityMediaControl::create(renderer);
     138#endif
    129139
    130140        // input type=range
  • trunk/WebCore/accessibility/AXObjectCache.h

    r46604 r47110  
    11/*
    2  * Copyright (C) 2003, 2006, 2007, 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
  • trunk/WebCore/accessibility/AccessibilityObject.cpp

    r47076 r47110  
    11/*
    2  * Copyright (C) 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
  • trunk/WebCore/accessibility/AccessibilityObject.h

    r47076 r47110  
    11/*
    2  * Copyright (C) 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
    33 * Copyright (C) 2008 Nuanti Ltd.
    44 *
     
    222222    virtual bool isCheckboxOrRadio() const { return false; };
    223223    virtual bool isListBox() const { return roleValue() == ListBoxRole; };
     224    virtual bool isMediaTimeline() const { return false; }
    224225    virtual bool isMenuRelated() const { return false; }
    225226    virtual bool isMenu() const { return false; }
  • trunk/WebCore/accessibility/AccessibilitySlider.h

    r46783 r47110  
    6262        virtual void decrement();
    6363
     64    protected:
     65        AccessibilitySlider(RenderObject*);
     66
    6467    private:
    65         AccessibilitySlider(RenderObject*);
    6668        void changeValue(float /*percentChange*/);
    6769        HTMLInputElement* element() const;
  • trunk/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm

    r47076 r47110  
    11/*
    2  * Copyright (C) 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    679679        [tempArray addObject:NSAccessibilityMaxValueAttribute];
    680680        [tempArray addObject:NSAccessibilityOrientationAttribute];
     681        [tempArray addObject:NSAccessibilityValueDescriptionAttribute];
    681682        rangeAttrs = [[NSArray alloc] initWithArray:tempArray];
    682683        [tempArray release];
     
    980981        { DefinitionListTermRole, NSAccessibilityGroupRole },
    981982       
    982         { SliderThumbRole, NSAccessibilityValueIndicatorRole },
    983        
    984 
     983        { SliderThumbRole, NSAccessibilityValueIndicatorRole }
    985984    };
    986985    AccessibilityRoleMap& roleMap = *new AccessibilityRoleMap;
     
    10291028    }
    10301029   
     1030    if (m_object->isMediaTimeline())
     1031        return NSAccessibilityTimelineSubrole;
     1032
    10311033    return nil;
    10321034}
     
    11201122    if ([axRole isEqualToString:NSAccessibilityToolbarRole])
    11211123        return NSAccessibilityRoleDescription(NSAccessibilityToolbarRole, [self subrole]);
    1122 
     1124   
    11231125    return NSAccessibilityRoleDescription(NSAccessibilityUnknownRole, nil);
    11241126}
     
    12541256        return m_object->accessibilityDescription();
    12551257    }
    1256    
     1258
    12571259    if ([attributeName isEqualToString: NSAccessibilityValueAttribute]) {
    12581260        if (m_object->isAttachment()) {
  • trunk/WebCore/dom/Node.h

    r45251 r47110  
    183183#endif
    184184
     185    virtual bool isMediaControlElement() const { return false; }
    185186    virtual bool isStyledElement() const { return false; }
    186187    virtual bool isFrameOwnerElement() const { return false; }
  • trunk/WebCore/page/mac/WebCoreViewFactory.h

    r45474 r47110  
    11/*
    2  * Copyright (C) 2003, 2005 Apple Computer, Inc.  All rights reserved.
     2 * Copyright (C) 2003, 2005, 2009 Apple Computer, Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    144144- (NSString *)mediaElementLoadingStateText;
    145145- (NSString *)mediaElementLiveBroadcastStateText;
     146- (NSString*)localizedMediaControlElementString:(NSString*)name;
     147- (NSString*)localizedMediaControlElementHelpText:(NSString*)name;
     148- (NSString*)localizedMediaTimeDescription:(float)time;
     149
    146150
    147151@end
  • trunk/WebCore/platform/LocalizedStrings.h

    r45474 r47110  
    11/*
    2  * Copyright (C) 2003, 2006 Apple Computer, Inc.  All rights reserved.
     2 * Copyright (C) 2003, 2006, 2009 Apple Computer, Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    136136    String mediaElementLoadingStateText();
    137137    String mediaElementLiveBroadcastStateText();
     138    String localizedMediaControlElementString(const String&);
     139    String localizedMediaControlElementHelpText(const String&);
     140    String localizedMediaTimeDescription(float);
    138141}
    139142
  • trunk/WebCore/platform/mac/LocalizedStringsMac.mm

    r45474 r47110  
    11/*
    2  * Copyright (C) 2003, 2006 Apple Computer, Inc.  All rights reserved.
     2 * Copyright (C) 2003, 2006, 2009 Apple Computer, Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    714714}
    715715
    716 }
     716String localizedMediaControlElementString(const String& controlName)
     717{
     718    BEGIN_BLOCK_OBJC_EXCEPTIONS;
     719    return [[WebCoreViewFactory sharedFactory] localizedMediaControlElementString:controlName];
     720    END_BLOCK_OBJC_EXCEPTIONS;
     721    return String();
     722}
     723
     724String localizedMediaControlElementHelpText(const String& controlName)
     725{
     726    BEGIN_BLOCK_OBJC_EXCEPTIONS;
     727    return [[WebCoreViewFactory sharedFactory] localizedMediaControlElementHelpText:controlName];
     728    END_BLOCK_OBJC_EXCEPTIONS;
     729    return String();
     730}
     731
     732String localizedMediaTimeDescription(float time)
     733{
     734    BEGIN_BLOCK_OBJC_EXCEPTIONS;
     735    return [[WebCoreViewFactory sharedFactory] localizedMediaTimeDescription:time];
     736    END_BLOCK_OBJC_EXCEPTIONS;
     737    return String();
     738}
     739
     740
     741}
  • trunk/WebCore/rendering/MediaControlElements.cpp

    r46915 r47110  
    3333#include "MediaControlElements.h"
    3434
    35 #include "LocalizedStrings.h"
    3635#include "EventNames.h"
    3736#include "FloatConversion.h"
    3837#include "Frame.h"
    3938#include "HTMLNames.h"
     39#include "LocalizedStrings.h"
    4040#include "MouseEvent.h"
    4141#include "RenderMedia.h"
     
    7979   
    8080
    81 MediaControlElement::MediaControlElement(Document* doc, PseudoId pseudo, HTMLMediaElement* mediaElement) 
     81MediaControlElement::MediaControlElement(Document* doc, PseudoId pseudo, HTMLMediaElement* mediaElement)
    8282    : HTMLDivElement(divTag, doc)
    8383    , m_mediaElement(mediaElement)
     
    8585{
    8686    setInDocument(true);
     87    switch (pseudo) {
     88    case MEDIA_CONTROLS_CURRENT_TIME_DISPLAY:
     89        m_displayType = MediaCurrentTimeDisplay;
     90        break;
     91    case MEDIA_CONTROLS_TIME_REMAINING_DISPLAY:
     92        m_displayType = MediaTimeRemainingDisplay;
     93        break;
     94    case MEDIA_CONTROLS_TIMELINE_CONTAINER:
     95        m_displayType = MediaTimelineContainer;
     96        break;
     97    case MEDIA_CONTROLS_STATUS_DISPLAY:
     98        m_displayType = MediaStatusDisplay;
     99        break;
     100    case MEDIA_CONTROLS_PANEL:
     101        m_displayType = MediaControlsPanel;
     102        break;
     103    default:
     104        ASSERT_NOT_REACHED();
     105        break;
     106    }
    87107}
    88108
     
    167187
    168188MediaControlTimelineContainerElement::MediaControlTimelineContainerElement(Document* doc, HTMLMediaElement* element)
    169 : MediaControlElement(doc, MEDIA_CONTROLS_TIMELINE_CONTAINER, element)
     189    : MediaControlElement(doc, MEDIA_CONTROLS_TIMELINE_CONTAINER, element)
    170190{
    171191}
     
    190210
    191211MediaControlStatusDisplayElement::MediaControlStatusDisplayElement(Document* doc, HTMLMediaElement* element)
    192 : MediaControlElement(doc, MEDIA_CONTROLS_STATUS_DISPLAY, element)
    193 , m_stateBeingDisplayed(Nothing)
     212    : MediaControlElement(doc, MEDIA_CONTROLS_STATUS_DISPLAY, element)
     213    , m_stateBeingDisplayed(Nothing)
    194214{
    195215}
     
    236256// ----------------------------
    237257   
    238 MediaControlInputElement::MediaControlInputElement(Document* doc, PseudoId pseudo, const String& type, HTMLMediaElement* mediaElement, MediaControlElementType displayType)
     258MediaControlInputElement::MediaControlInputElement(Document* doc, PseudoId pseudo, const String& type, HTMLMediaElement* mediaElement)
    239259    : HTMLInputElement(inputTag, doc)
    240260    , m_mediaElement(mediaElement)
    241261    , m_pseudoStyleId(pseudo)
    242     , m_displayType(displayType)
    243262{
    244263    setInputType(type);
    245264    setInDocument(true);
     265
     266    switch (pseudo) {
     267    case MEDIA_CONTROLS_MUTE_BUTTON:
     268        m_displayType = MediaMuteButton;
     269        break;
     270    case MEDIA_CONTROLS_PLAY_BUTTON:
     271        m_displayType = MediaPlayButton;
     272        break;
     273    case MEDIA_CONTROLS_SEEK_FORWARD_BUTTON:
     274        m_displayType = MediaSeekForwardButton;
     275        break;
     276    case MEDIA_CONTROLS_SEEK_BACK_BUTTON:
     277        m_displayType = MediaSeekBackButton;
     278        break;
     279    case MEDIA_CONTROLS_FULLSCREEN_BUTTON:
     280        m_displayType = MediaFullscreenButton;
     281        break;
     282    case MEDIA_CONTROLS_TIMELINE:
     283        m_displayType = MediaSlider;
     284        break;
     285    case MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON:
     286        m_displayType = MediaReturnToRealtimeButton;
     287        break;
     288    case MEDIA_CONTROLS_REWIND_BUTTON:
     289        m_displayType = MediaRewindButton;
     290        break;
     291    default:
     292        ASSERT_NOT_REACHED();
     293        break;
     294    }
    246295}
    247296
     
    325374
    326375    m_displayType = displayType;
    327     if (RenderObject* o = renderer())
    328         o->repaint();
     376    if (RenderObject* object = renderer())
     377        object->repaint();
    329378}
    330379
     
    332381
    333382MediaControlMuteButtonElement::MediaControlMuteButtonElement(Document* doc, HTMLMediaElement* element)
    334     : MediaControlInputElement(doc, MEDIA_CONTROLS_MUTE_BUTTON, "button", element, element->muted() ? MediaUnMuteButton : MediaMuteButton)
     383    : MediaControlInputElement(doc, MEDIA_CONTROLS_MUTE_BUTTON, "button", element)
    335384{
    336385}
     
    353402
    354403MediaControlPlayButtonElement::MediaControlPlayButtonElement(Document* doc, HTMLMediaElement* element)
    355     : MediaControlInputElement(doc, MEDIA_CONTROLS_PLAY_BUTTON, "button", element, element->canPlay() ? MediaPlayButton : MediaPauseButton)
     404    : MediaControlInputElement(doc, MEDIA_CONTROLS_PLAY_BUTTON, "button", element)
    356405{
    357406}
     
    375424MediaControlSeekButtonElement::MediaControlSeekButtonElement(Document* doc, HTMLMediaElement* element, bool forward)
    376425    : MediaControlInputElement(doc, forward ? MEDIA_CONTROLS_SEEK_FORWARD_BUTTON : MEDIA_CONTROLS_SEEK_BACK_BUTTON,
    377                                "button", element, forward ? MediaSeekForwardButton : MediaSeekBackButton)
     426                               "button", element)
    378427    , m_forward(forward)
    379428    , m_seeking(false)
     
    434483
    435484MediaControlRewindButtonElement::MediaControlRewindButtonElement(Document* doc, HTMLMediaElement* element)
    436 : MediaControlInputElement(doc, MEDIA_CONTROLS_REWIND_BUTTON, "button", element, MediaRewindButton)
     485    : MediaControlInputElement(doc, MEDIA_CONTROLS_REWIND_BUTTON, "button", element)
    437486{
    438487}
     
    456505
    457506MediaControlReturnToRealtimeButtonElement::MediaControlReturnToRealtimeButtonElement(Document* doc, HTMLMediaElement* element)
    458 : MediaControlInputElement(doc, MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON, "button", element, MediaReturnToRealtimeButton)
     507: MediaControlInputElement(doc, MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON, "button", element)
    459508{
    460509}
     
    477526
    478527MediaControlTimelineElement::MediaControlTimelineElement(Document* document, HTMLMediaElement* element)
    479     : MediaControlInputElement(document, MEDIA_CONTROLS_TIMELINE, "range", element, MediaTimelineContainer)
    480 { 
     528    : MediaControlInputElement(document, MEDIA_CONTROLS_TIMELINE, "range", element)
     529{
    481530}
    482531
     
    518567    MediaControlInputElement::update();
    519568}
    520 
    521569// ----------------------------
    522570
    523571MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(Document* doc, HTMLMediaElement* element)
    524     : MediaControlInputElement(doc, MEDIA_CONTROLS_FULLSCREEN_BUTTON, "button", element, MediaFullscreenButton)
     572    : MediaControlInputElement(doc, MEDIA_CONTROLS_FULLSCREEN_BUTTON, "button", element)
    525573{
    526574}
     
    544592MediaControlTimeDisplayElement::MediaControlTimeDisplayElement(Document* doc, PseudoId pseudo, HTMLMediaElement* element)
    545593    : MediaControlElement(doc, pseudo, element)
     594    , m_currentValue(0)
    546595    , m_isVisible(true)
    547596{
     
    573622}
    574623
     624String MediaControlTimeDisplayElement::formatTime(float time)
     625{
     626    if (!isfinite(time))
     627        time = 0;
     628    int seconds = (int)fabsf(time);
     629    int hours = seconds / (60 * 60);
     630    int minutes = (seconds / 60) % 60;
     631    seconds %= 60;
     632    if (hours) {
     633        if (hours > 9)
     634            return String::format("%s%02d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds);
     635
     636        return String::format("%s%01d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds);
     637    }
     638
     639    return String::format("%s%02d:%02d", (time < 0 ? "-" : ""), minutes, seconds);
     640}
     641
     642void MediaControlTimeDisplayElement::setCurrentValue(float time)
     643{
     644    m_currentValue = time;
     645
     646    ExceptionCode ec;
     647    setInnerText(formatTime(m_currentValue), ec);
     648}
     649
    575650
    576651} //namespace WebCore
  • trunk/WebCore/rendering/MediaControlElements.h

    r45744 r47110  
    9090    virtual void updateStyle();
    9191
     92    MediaControlElementType displayType() const { return m_displayType; }
     93
     94    HTMLMediaElement* mediaElement() const { return m_mediaElement; }
     95    virtual bool isMediaControlElement() const { return true; }
     96
    9297protected:
    9398    HTMLMediaElement* m_mediaElement;   
    9499    PseudoId m_pseudoStyleId;
     100    MediaControlElementType m_displayType;  // some elements can show multiple types (e.g. play/pause)
    95101};
    96102
     
    119125class MediaControlInputElement : public HTMLInputElement {
    120126public:
    121     MediaControlInputElement(Document*, PseudoId, const String& type, HTMLMediaElement*, MediaControlElementType);
     127    MediaControlInputElement(Document*, PseudoId, const String& type, HTMLMediaElement*);
    122128    virtual void attach();
    123129    virtual bool rendererIsNeeded(RenderStyle*);
     
    131137    MediaControlElementType displayType() const { return m_displayType; }
    132138
     139    HTMLMediaElement* mediaElement() const { return m_mediaElement; }
     140    virtual bool isMediaControlElement() const { return true; }
     141
    133142protected:
    134143    virtual void updateDisplayType() { }
     
    137146    HTMLMediaElement* m_mediaElement;   
    138147    PseudoId m_pseudoStyleId;
    139     MediaControlElementType m_displayType;  // some elements can show multiple types (e.g. play/pause)
     148    MediaControlElementType m_displayType;
    140149};
    141150
     
    218227    virtual PassRefPtr<RenderStyle> styleForElement();
    219228
    220 private:
     229    void setCurrentValue(float);
     230    float currentValue() const { return m_currentValue; }
     231
     232private:
     233    String formatTime(float time);
     234
     235    float m_currentValue;
    221236    bool m_isVisible;
    222237};
  • trunk/WebCore/rendering/RenderMedia.cpp

    r45687 r47110  
    299299        if (m_panel) {
    300300            createRewindButton();
    301             createMuteButton();
    302301            createPlayButton();
    303302            createReturnToRealtimeButton();
    304303            createStatusDisplay();
    305304            createTimelineContainer();
    306             createSeekBackButton();
    307             createSeekForwardButton();
    308305            createFullscreenButton();
    309306            if (m_timelineContainer) {
     
    312309                createTimeRemainingDisplay();
    313310            }
     311            createSeekBackButton();
     312            createSeekForwardButton();
     313            createMuteButton();
    314314            m_panel->attach();
    315315        }
     
    367367}
    368368   
    369 String RenderMedia::formatTime(float time)
    370 {
    371     if (!isfinite(time))
    372         time = 0;
    373     int seconds = (int)fabsf(time);
    374     int hours = seconds / (60 * 60);
    375     int minutes = (seconds / 60) % 60;
    376     seconds %= 60;
    377     if (hours) {
    378         if (hours > 9)
    379             return String::format("%s%02d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds);
    380         else
    381             return String::format("%s%01d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds);
    382     }
    383     else
    384         return String::format("%s%02d:%02d", (time < 0 ? "-" : ""), minutes, seconds);
    385 }
    386 
    387369void RenderMedia::updateTimeDisplay()
    388370{
     
    392374    float duration = mediaElement()->duration();
    393375
    394     String timeString = formatTime(now);
    395     ExceptionCode ec;
    396     m_currentTimeDisplay->setInnerText(timeString, ec);
    397    
    398     timeString = formatTime(now - duration);
    399     m_timeRemainingDisplay->setInnerText(timeString, ec);
     376    m_currentTimeDisplay->setCurrentValue(now);
     377    m_timeRemainingDisplay->setCurrentValue(now - duration);
    400378}
    401379
  • trunk/WebCore/rendering/RenderMedia.h

    r46815 r47110  
    6060    HTMLMediaElement* mediaElement() const;
    6161    MediaPlayer* player() const;
    62 
    63     static String formatTime(float time);
    6462
    6563    bool shouldShowTimeDisplayControls() const;
  • trunk/WebKit/ChangeLog

    r46876 r47110  
     12009-08-12  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        <video> and <audio> controller should be accessible
     6        https://bugs.webkit.org/show_bug.cgi?id=28081
     7
     8        Add localized strings for media controller accessiblility.
     9
     10        * English.lproj/Localizable.strings:
     11
    1122009-08-06  Mark Rowe  <mrowe@apple.com>
    213
  • trunk/WebKit/English.lproj/Localizable.strings

    r45484 r47110  
    227227"Paste Ruler (Undo action name)" = "Paste Ruler";
    228228
     229/* accessibility help text for enter fullscreen button */
     230"Play movie in fullscreen mode" = "Play movie in fullscreen mode";
     231
    229232/* WebKitErrorPlugInCancelledConnection description */
    230233"Plug-in cancelled" = "Plug-in cancelled";
     
    443446"activate" = "activate";
    444447
     448/* accessibility role description for audio element controller */
     449"audio element controller" = "audio element controller";
     450
     451/* accessibility role description for audio element controller */
     452"audio element playback controls and status display" = "audio element playback controls and status display";
     453
     454/* accessibility role description for seek back 30 seconds button */
     455"back 30 seconds" = "back 30 seconds";
     456
    445457/* HTTP result code string */
    446458"bad gateway" = "bad gateway";
     
    448460/* HTTP result code string */
    449461"bad request" = "bad request";
     462
     463/* accessibility help text for play button */
     464"begin playback" = "begin playback";
    450465
    451466/* Verb stating the action that will occur when an unchecked checkbox is clicked, as used by accessibility */
     
    464479"created" = "created";
    465480
     481/* accessibility help text for movie status display */
     482"current movie status" = "current movie status";
     483
     484/* accessibility help text for elapsed time display */
     485"current movie time in seconds" = "current movie time in seconds";
     486
     487/* string for days, hours, minutes & seconds */
     488"date.format.for.days" = "date.format.for.days";
     489
     490/* string for hours, minutes & seconds */
     491"date.format.for.hours" = "date.format.for.hours";
     492
     493/* string for minutes & seconds */
     494"date.format.for.minutes" = "date.format.for.minutes";
     495
     496/* string for seconds */
     497"date.format.for.seconds" = "date.format.for.seconds";
     498
    466499/* definition phrase */
    467500"definition" = "definition";
    468501
     502/* accessibility role description for elapsed time display */
     503"elapsed time" = "elapsed time";
     504
    469505/* HTTP result code string */
    470506"expectation failed" = "expectation failed";
    471507
     508/* accessibility role description for fast forward button */
     509"fast forward" = "fast forward";
     510
     511/* accessibility role description for fast reverse button */
     512"fast reverse" = "fast reverse";
     513
    472514/* HTTP result code string */
    473515"forbidden" = "forbidden";
     
    475517/* HTTP result code string */
    476518"found" = "found";
     519
     520/* accessibility role description for enter fullscreen button */
     521"fullscreen" = "fullscreen";
    477522
    478523/* HTTP result code string */
     
    485530"image map" = "image map";
    486531
     532/* string for an indefinite movie time */
     533"indefinite time" = "indefinite time";
     534
    487535/* HTTP result code string */
    488536"informational" = "informational";
     
    509557"moved permanently" = "moved permanently";
    510558
     559/* accessibility role description for timeline slider */
     560"movie time" = "movie time";
     561
     562/* accessibility help text for timeline slider */
     563"movie time scrubber" = "movie time scrubber";
     564
     565/* accessibility help text for timeline slider thumb */
     566"movie time scrubber thumb" = "movie time scrubber thumb";
     567
    511568/* HTTP result code string */
    512569"multiple choices" = "multiple choices";
     570
     571/* accessibility role description for mute button */
     572"mute" = "mute";
     573
     574/* accessibility help text for mute button */
     575"mute audio tracks" = "mute audio tracks";
    513576
    514577/* HTTP result code string */
     
    536599"not modified" = "not modified";
    537600
     601/* accessibility help text for remaining time display */
     602"number of seconds of movie remaining" = "number of seconds of movie remaining";
     603
    538604/* HTTP result code string */
    539605"partial content" = "partial content";
    540606
     607/* accessibility role description for pause button */
     608"pause" = "pause";
     609
     610/* accessibility help text for pause button */
     611"pause playback" = "pause playback";
     612
    541613/* HTTP result code string */
    542614"payment required" = "payment required";
     615
     616/* accessibility role description for play button */
     617"play" = "play";
    543618
    544619/* HTTP result code string */
     
    554629"redirected" = "redirected";
    555630
     631/* accessibility role description for time remaining display */
     632"remaining time" = "remaining time";
     633
    556634/* HTTP result code string */
    557635"request timed out" = "request timed out";
     
    569647"reset content" = "reset content";
    570648
     649/* accessibility help text for return streaming movie to real time button */
     650"return streaming movie to real time" = "return streaming movie to real time";
     651
     652/* accessibility role description for return to real time button */
     653"return to realtime" = "return to realtime";
     654
    571655/* HTTP result code string */
    572656"see other" = "see other";
     657
     658/* accessibility help text for jump back 30 seconds button */
     659"seek movie back 30 seconds" = "seek movie back 30 seconds";
     660
     661/* accessibility help text for fast rewind button */
     662"seek quickly back" = "seek quickly back";
     663
     664/* accessibility help text for fast forward button */
     665"seek quickly forward" = "seek quickly forward";
    573666
    574667/* Verb stating the action that will occur when a radio button is clicked, as used by accessibility */
     
    581674"service unavailable" = "service unavailable";
    582675
     676/* accessibility role description for movie status */
     677"status" = "status";
     678
    583679/* HTTP result code string */
    584680"success" = "success";
     
    593689"term" = "term";
    594690
     691/* accessibility role description for timeline thumb */
     692"timeline slider thumb" = "timeline slider thumb";
     693
    595694/* HTTP result code string */
    596695"unacceptable" = "unacceptable";
     
    608707"unknown" = "unknown";
    609708
     709/* accessibility role description for turn mute off button */
     710"unmute" = "unmute";
     711
     712/* accessibility help text for un mute button */
     713"unmute audio tracks" = "unmute audio tracks";
     714
    610715/* HTTP result code string */
    611716"unsupported media type" = "unsupported media type";
     
    613718/* HTTP result code string */
    614719"unsupported version" = "unsupported version";
     720
     721/* accessibility role description for video element controller */
     722"video element controller" = "video element controller";
     723
     724/* accessibility role description for video element controller */
     725"video element playback controls and status display" = "video element playback controls and status display";
    615726
    616727/* accessibility role description for web area */
  • trunk/WebKit/mac/ChangeLog

    r47056 r47110  
     12009-08-12  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        <video> and <audio> controller should be accessible
     6        https://bugs.webkit.org/show_bug.cgi?id=28081
     7
     8        * WebCoreSupport/WebViewFactory.mm:
     9        (-[WebViewFactory localizedMediaControlElementString:]):
     10        (-[WebViewFactory localizedMediaControlElementHelpText:]):
     11        (-[WebViewFactory localizedMediaTimeDescription:]):
     12            New.
     13
    1142009-08-11  John Gregg  <johnnyg@google.com>
    215
  • trunk/WebKit/mac/WebCoreSupport/WebViewFactory.mm

    r45484 r47110  
    11/*
    2  * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
     2 * Copyright (C) 2005, 2009 Apple Computer, Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    609609}
    610610
     611- (NSString*)localizedMediaControlElementString:(NSString*)name
     612{
     613    if ([name isEqualToString:@"AudioElement"])
     614        return UI_STRING("audio element controller", "accessibility role description for audio element controller");
     615    if ([name isEqualToString:@"VideoElement"])
     616        return UI_STRING("video element controller", "accessibility role description for video element controller");
     617
     618    if ([name isEqualToString:@"MuteButton"])
     619        return UI_STRING("mute", "accessibility role description for mute button");
     620    if ([name isEqualToString:@"UnMuteButton"])
     621        return UI_STRING("unmute", "accessibility role description for turn mute off button");
     622    if ([name isEqualToString:@"PlayButton"])
     623        return UI_STRING("play", "accessibility role description for play button");
     624    if ([name isEqualToString:@"PauseButton"])
     625        return UI_STRING("pause", "accessibility role description for pause button");
     626    if ([name isEqualToString:@"Slider"])
     627        return UI_STRING("movie time", "accessibility role description for timeline slider");
     628    if ([name isEqualToString:@"SliderThumb"])
     629        return UI_STRING("timeline slider thumb", "accessibility role description for timeline thumb");
     630    if ([name isEqualToString:@"RewindButton"])
     631        return UI_STRING("back 30 seconds", "accessibility role description for seek back 30 seconds button");
     632    if ([name isEqualToString:@"ReturnToRealtimeButton"])
     633        return UI_STRING("return to realtime", "accessibility role description for return to real time button");
     634    if ([name isEqualToString:@"CurrentTimeDisplay"])
     635        return UI_STRING("elapsed time", "accessibility role description for elapsed time display");
     636    if ([name isEqualToString:@"TimeRemainingDisplay"])
     637        return UI_STRING("remaining time", "accessibility role description for time remaining display");
     638    if ([name isEqualToString:@"StatusDisplay"])
     639        return UI_STRING("status", "accessibility role description for movie status");
     640    if ([name isEqualToString:@"FullscreenButton"])
     641        return UI_STRING("fullscreen", "accessibility role description for enter fullscreen button");
     642    if ([name isEqualToString:@"SeekForwardButton"])
     643        return UI_STRING("fast forward", "accessibility role description for fast forward button");
     644    if ([name isEqualToString:@"SeekBackButton"])
     645        return UI_STRING("fast reverse", "accessibility role description for fast reverse button");
     646    ASSERT_NOT_REACHED();
     647    return @"";
     648}
     649
     650- (NSString*)localizedMediaControlElementHelpText:(NSString*)name
     651{
     652    if ([name isEqualToString:@"AudioElement"])
     653        return UI_STRING("audio element playback controls and status display", "accessibility role description for audio element controller");
     654    if ([name isEqualToString:@"VideoElement"])
     655        return UI_STRING("video element playback controls and status display", "accessibility role description for video element controller");
     656
     657    if ([name isEqualToString:@"MuteButton"])
     658        return UI_STRING("mute audio tracks", "accessibility help text for mute button");
     659    if ([name isEqualToString:@"UnMuteButton"])
     660        return UI_STRING("unmute audio tracks", "accessibility help text for un mute button");
     661    if ([name isEqualToString:@"PlayButton"])
     662        return UI_STRING("begin playback", "accessibility help text for play button");
     663    if ([name isEqualToString:@"PauseButton"])
     664        return UI_STRING("pause playback", "accessibility help text for pause button");
     665    if ([name isEqualToString:@"Slider"])
     666        return UI_STRING("movie time scrubber", "accessibility help text for timeline slider");
     667    if ([name isEqualToString:@"SliderThumb"])
     668        return UI_STRING("movie time scrubber thumb", "accessibility help text for timeline slider thumb");
     669    if ([name isEqualToString:@"RewindButton"])
     670        return UI_STRING("seek movie back 30 seconds", "accessibility help text for jump back 30 seconds button");
     671    if ([name isEqualToString:@"ReturnToRealtimeButton"])
     672        return UI_STRING("return streaming movie to real time", "accessibility help text for return streaming movie to real time button");
     673    if ([name isEqualToString:@"CurrentTimeDisplay"])
     674        return UI_STRING("current movie time in seconds", "accessibility help text for elapsed time display");
     675    if ([name isEqualToString:@"TimeRemainingDisplay"])
     676        return UI_STRING("number of seconds of movie remaining", "accessibility help text for remaining time display");
     677    if ([name isEqualToString:@"StatusDisplay"])
     678        return UI_STRING("current movie status", "accessibility help text for movie status display");
     679    if ([name isEqualToString:@"SeekBackButton"])
     680        return UI_STRING("seek quickly back", "accessibility help text for fast rewind button");
     681    if ([name isEqualToString:@"SeekForwardButton"])
     682        return UI_STRING("seek quickly forward", "accessibility help text for fast forward button");
     683    if ([name isEqualToString:@"FullscreenButton"])
     684        return UI_STRING("Play movie in fullscreen mode", "accessibility help text for enter fullscreen button");
     685    ASSERT_NOT_REACHED();
     686    return @"";
     687}
     688
     689- (NSString*)localizedMediaTimeDescription:(float)time
     690{
     691    if (!isfinite(time))
     692        return UI_STRING("indefinite time", "string for an indefinite movie time");
     693
     694    int seconds = (int)fabsf(time);
     695    int days = seconds / (60 * 60 * 24);
     696    int hours = seconds / (60 * 60);
     697    int minutes = (seconds / 60) % 60;
     698    seconds %= 60;
     699
     700    if (days)
     701        return [NSString stringWithFormat:UI_STRING("date.format.for.days", "string for days, hours, minutes & seconds"), days, hours, minutes, seconds];
     702    else if (hours)
     703        return [NSString stringWithFormat:UI_STRING("date.format.for.hours", "string for hours, minutes & seconds"), hours, minutes, seconds];
     704    else if (minutes)
     705        return [NSString stringWithFormat:UI_STRING("date.format.for.minutes", "string for minutes & seconds"), minutes, seconds];
     706
     707    return [NSString stringWithFormat:UI_STRING("date.format.for.seconds", "string for seconds"), seconds];
     708}
     709
    611710@end
  • trunk/WebKit/win/ChangeLog

    r47084 r47110  
     12009-08-12  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        <video> and <audio> controller should be accessible
     6        https://bugs.webkit.org/show_bug.cgi?id=28081
     7
     8        * WebCoreLocalizedStrings.cpp:
     9        (WebCore::localizedMediaControlElementString):
     10        (WebCore::localizedMediaControlElementHelpText):
     11        (WebCore::localizedMediaTimeDescription):
     12            New.
     13
    1142009-08-11  John Gregg  <johnnyg@google.com>
    215
  • trunk/WebKit/win/WebCoreLocalizedStrings.cpp

    r46245 r47110  
    115115    return result.get();
    116116}
     117
     118String WebCore::localizedMediaControlElementString(const String& name)
     119{
     120    if (name == "AudioElement")
     121        return String(LPCTSTR_UI_STRING("audio element controller", "accessibility role description for audio element controller"));
     122    if (name == "VideoElement")
     123        return String(LPCTSTR_UI_STRING("video element controller", "accessibility role description for video element controller"));
     124    if (name == "MuteButton")
     125        return String(LPCTSTR_UI_STRING("mute", "accessibility role description for mute button"));
     126    if (name == "UnMuteButton")
     127        return String(LPCTSTR_UI_STRING("unmute", "accessibility role description for turn mute off button"));
     128    if (name == "PlayButton")
     129        return String(LPCTSTR_UI_STRING("play", "accessibility role description for play button"));
     130    if (name == "PauseButton")
     131        return String(LPCTSTR_UI_STRING("pause", "accessibility role description for pause button"));
     132    if (name == "Slider")
     133        return String(LPCTSTR_UI_STRING("movie time", "accessibility role description for timeline slider"));
     134    if (name == "SliderThumb")
     135        return String(LPCTSTR_UI_STRING("timeline slider thumb", "accessibility role description for timeline thumb"));
     136    if (name == "RewindButton")
     137        return String(LPCTSTR_UI_STRING("back 30 seconds", "accessibility role description for seek back 30 seconds button"));
     138    if (name == "ReturnToRealtimeButton")
     139        return String(LPCTSTR_UI_STRING("return to realtime", "accessibility role description for return to real time button"));
     140    if (name == "CurrentTimeDisplay")
     141        return String(LPCTSTR_UI_STRING("elapsed time", "accessibility role description for elapsed time display"));
     142    if (name == "TimeRemainingDisplay")
     143        return String(LPCTSTR_UI_STRING("remaining time", "accessibility role description for time remaining display"));
     144    if (name == "StatusDisplay")
     145        return String(LPCTSTR_UI_STRING("status", "accessibility role description for movie status"));
     146    if (name == "FullscreenButton")
     147        return String(LPCTSTR_UI_STRING("fullscreen", "accessibility role description for enter fullscreen button"));
     148    if (name == "SeekForwardButton")
     149        return String(LPCTSTR_UI_STRING("fast forward", "accessibility role description for fast forward button"));
     150    if (name == "SeekBackButton")
     151        return String(LPCTSTR_UI_STRING("fast reverse", "accessibility role description for fast reverse button"));
     152
     153    ASSERT_NOT_REACHED();
     154    return String();
     155}
     156
     157String WebCore::localizedMediaControlElementHelpText(const String& name)
     158{
     159    if (name == "AudioElement")
     160        return String(LPCTSTR_UI_STRING("audio element playback controls and status display", "accessibility role description for audio element controller"));
     161    if (name == "VideoElement")
     162        return String(LPCTSTR_UI_STRING("video element playback controls and status display", "accessibility role description for video element controller"));
     163    if (name == "MuteButton")
     164        return String(LPCTSTR_UI_STRING("mute audio tracks", "accessibility help text for mute button"));
     165    if (name == "UnMuteButton")
     166        return String(LPCTSTR_UI_STRING("unmute audio tracks", "accessibility help text for un mute button"));
     167    if (name == "PlayButton")
     168        return String(LPCTSTR_UI_STRING("begin playback", "accessibility help text for play button"));
     169    if (name == "PauseButton")
     170        return String(LPCTSTR_UI_STRING("pause playback", "accessibility help text for pause button"));
     171    if (name == "Slider")
     172        return String(LPCTSTR_UI_STRING("movie time scrubber", "accessibility help text for timeline slider"));
     173    if (name == "SliderThumb")
     174        return String(LPCTSTR_UI_STRING("movie time scrubber thumb", "accessibility help text for timeline slider thumb"));
     175    if (name == "RewindButton")
     176        return String(LPCTSTR_UI_STRING("seek movie back 30 seconds", "accessibility help text for jump back 30 seconds button"));
     177    if (name == "ReturnToRealtimeButton")
     178        return String(LPCTSTR_UI_STRING("return streaming movie to real time", "accessibility help text for return streaming movie to real time button"));
     179    if (name == "CurrentTimeDisplay")
     180        return String(LPCTSTR_UI_STRING("current movie time in seconds", "accessibility help text for elapsed time display"));
     181    if (name == "TimeRemainingDisplay")
     182        return String(LPCTSTR_UI_STRING("number of seconds of movie remaining", "accessibility help text for remaining time display"));
     183    if (name == "StatusDisplay")
     184        return String(LPCTSTR_UI_STRING("current movie status", "accessibility help text for movie status display"));
     185    if (name == "SeekBackButton")
     186        return String(LPCTSTR_UI_STRING("seek quickly back", "accessibility help text for fast rewind button"));
     187    if (name == "SeekForwardButton")
     188        return String(LPCTSTR_UI_STRING("seek quickly forward", "accessibility help text for fast forward button"));
     189    if (name == "FullscreenButton")
     190        return String(LPCTSTR_UI_STRING("Play movie in fullscreen mode", "accessibility help text for enter fullscreen button"));
     191
     192    ASSERT_NOT_REACHED();
     193    return String();
     194}
     195
     196String WebCore::localizedMediaTimeDescription(float time)
     197{
     198    if (!isfinite(time))
     199        return return String(LPCTSTR_UI_STRING("indefinite time", "string for an indefinite movie time"));
     200
     201    int seconds = (int)fabsf(time);
     202    int days = seconds / (60 * 60 * 24);
     203    int hours = seconds / (60 * 60);
     204    int minutes = (seconds / 60) % 60;
     205    seconds %= 60;
     206
     207    if (days) {
     208        static RetainPtr<CFStringRef> format(AdoptCF, UI_STRING("date.format.for.days", "string for days, hours, minutes & seconds"));
     209        RetainPtr<CFStringRef> result(AdoptCF, CFStringCreateWithFormat(0, 0, format.get(), days, hours, minutes, seconds));
     210        return result.get();
     211    }
     212    else if (hours) {
     213        static RetainPtr<CFStringRef> format(AdoptCF, UI_STRING("date.format.for.hours", "string for hours, minutes & seconds"));
     214        RetainPtr<CFStringRef> result(AdoptCF, CFStringCreateWithFormat(0, 0, format.get(), hours, minutes, seconds));
     215        return result.get();
     216    }
     217    else if (minutes) {
     218        static RetainPtr<CFStringRef> format(AdoptCF, UI_STRING("date.format.for.minutes", "string for minutes & seconds"));
     219        RetainPtr<CFStringRef> result(AdoptCF, CFStringCreateWithFormat(0, 0, format.get(), minutes, seconds));
     220        return result.get();
     221    }
     222
     223    static RetainPtr<CFStringRef> format(AdoptCF, UI_STRING("date.format.for.seconds", "string for seconds"));
     224    RetainPtr<CFStringRef> result(AdoptCF, CFStringCreateWithFormat(0, 0, format.get(), seconds));
     225    return result.get();
     226}
     227
Note: See TracChangeset for help on using the changeset viewer.