Changeset 204361 in webkit


Ignore:
Timestamp:
Aug 10, 2016 4:30:24 PM (8 years ago)
Author:
n_wang@apple.com
Message:

AX: Media controls timeline should have percentage value description
https://bugs.webkit.org/show_bug.cgi?id=160619

Reviewed by Eric Carlson.

Source/WebCore:

Added aria-valuetext attribute to the timeline slider and set its value to
the percentage format. Also formatted the elapsed/remaining timer's description
so that it's more human readable.

Test: http/tests/media/hls/video-duration-accessibility.html

  • English.lproj/mediaControlsLocalizedStrings.js:
  • Modules/mediacontrols/mediaControlsApple.js:

(Controller.prototype.drawVolumeBackground):
(Controller.prototype.formatTimeDescription):
(Controller.prototype.formatTime):
(Controller.prototype.updateTime):
(Controller.prototype.updateControlsWhileScrubbing):

LayoutTests:

  • http/tests/media/hls/video-duration-accessibility-expected.txt: Added.
  • http/tests/media/hls/video-duration-accessibility.html: Added.
  • http/tests/media/resources/hls/generate-vod.php: Added.
  • media/media-controls-accessibility-expected.txt:
  • platform/efl/accessibility/media-element-expected.txt:
  • platform/gtk/accessibility/media-element-expected.txt:
  • platform/mac/accessibility/media-element-expected.txt:
Location:
trunk
Files:
3 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r204358 r204361  
     12016-08-10  Nan Wang  <n_wang@apple.com>
     2
     3        AX: Media controls timeline should have percentage value description
     4        https://bugs.webkit.org/show_bug.cgi?id=160619
     5
     6        Reviewed by Eric Carlson.
     7
     8        * http/tests/media/hls/video-duration-accessibility-expected.txt: Added.
     9        * http/tests/media/hls/video-duration-accessibility.html: Added.
     10        * http/tests/media/resources/hls/generate-vod.php: Added.
     11        * media/media-controls-accessibility-expected.txt:
     12        * platform/efl/accessibility/media-element-expected.txt:
     13        * platform/gtk/accessibility/media-element-expected.txt:
     14        * platform/mac/accessibility/media-element-expected.txt:
     15
    1162016-08-09  Skachkov Oleksandr  <gskachkov@gmail.com>
    217
  • trunk/LayoutTests/media/media-controls-accessibility-expected.txt

    r203913 r204361  
    88
    99TEST COMPLETE
    10 elapsedTimer.description: AXDescription: Elapsed 00:00
    11 remainingTimer.description: AXDescription: Remaining -00:06
     10elapsedTimer.description: AXDescription: Elapsed 0 Seconds
     11remainingTimer.description: AXDescription: Remaining 6 Seconds
    1212
    1313muteButton.description: AXDescription: Mute
  • trunk/LayoutTests/platform/efl/accessibility/media-element-expected.txt

    r203913 r204361  
    2222
    2323
    24             title: AXTitle: Elapsed 00:00
     24            title: AXTitle: Elapsed 0 Seconds
    2525            role: AXRole: AXTimer
    2626
     
    3434
    3535
    36             title: AXTitle: Remaining -00:06
     36            title: AXTitle: Remaining 6 Seconds
    3737            role: AXRole: AXTimer
    3838
  • trunk/LayoutTests/platform/gtk/accessibility/media-element-expected.txt

    r203913 r204361  
    2222
    2323
    24             title: AXTitle: Remaining -00:06
     24            title: AXTitle: Remaining 6 Seconds
    2525            role: AXRole: AXTimer
    2626
  • trunk/LayoutTests/platform/mac/accessibility/media-element-expected.txt

    r203913 r204361  
    3535
    3636
    37             description: AXDescription: Elapsed 00:00
     37            description: AXDescription: Elapsed 0 Seconds
    3838            role: AXRole: AXGroup
    3939            subrole: AXSubrole: AXApplicationTimer
     
    5656
    5757
    58             description: AXDescription: Remaining -00:06
     58            description: AXDescription: Remaining 6 Seconds
    5959            role: AXRole: AXGroup
    6060            subrole: AXSubrole: AXApplicationTimer
  • trunk/Source/WebCore/ChangeLog

    r204359 r204361  
     12016-08-10  Nan Wang  <n_wang@apple.com>
     2
     3        AX: Media controls timeline should have percentage value description
     4        https://bugs.webkit.org/show_bug.cgi?id=160619
     5
     6        Reviewed by Eric Carlson.
     7
     8        Added aria-valuetext attribute to the timeline slider and set its value to
     9        the percentage format. Also formatted the elapsed/remaining timer's description
     10        so that it's more human readable.
     11
     12        Test: http/tests/media/hls/video-duration-accessibility.html
     13
     14        * English.lproj/mediaControlsLocalizedStrings.js:
     15        * Modules/mediacontrols/mediaControlsApple.js:
     16        (Controller.prototype.drawVolumeBackground):
     17        (Controller.prototype.formatTimeDescription):
     18        (Controller.prototype.formatTime):
     19        (Controller.prototype.updateTime):
     20        (Controller.prototype.updateControlsWhileScrubbing):
     21
    1222016-08-10  Anders Carlsson  <andersca@apple.com>
    223
  • trunk/Source/WebCore/English.lproj/mediaControlsLocalizedStrings.js

    r188182 r204361  
    1818    'Exit Full Screen': 'Exit Full Screen',
    1919    'Fast Forward': 'Fast Forward',
     20    'Hour' : 'Hour',
     21    'Hours': 'Hours',
    2022    'Live Broadcast': 'Live Broadcast',
    2123    'Loading': 'Loading',
    2224    'Maximum Volume': 'Maximum Volume',
    2325    'Minimum Volume': 'Minimum Volume',
     26    'Minute': 'Minute',
     27    'Minutes': 'Minutes',
    2428    'Mute': 'Mute',
    2529    'Pause': 'Pause',
     
    2832    'Rewind': 'Rewind',
    2933    'Rewind ##sec## Seconds': 'Rewind ##sec## Seconds',
     34    'Second': 'Second',
     35    'Seconds': 'Seconds',
    3036    'Show Controls': 'Show Controls',
    3137    'Stalled': 'Stalled',
  • trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js

    r204088 r204361  
    15691569        ctx.restore();
    15701570    },
     1571   
     1572    formatTimeDescription: function(time)
     1573    {
     1574        if (isNaN(time))
     1575            time = 0;
     1576        var absTime = Math.abs(time);
     1577        var intSeconds = Math.floor(absTime % 60).toFixed(0);
     1578        var intMinutes = Math.floor((absTime / 60) % 60).toFixed(0);
     1579        var intHours = Math.floor(absTime / (60 * 60)).toFixed(0);
     1580       
     1581        var secondString = intSeconds == 1 ? 'Second' : 'Seconds';
     1582        var minuteString = intMinutes == 1 ? 'Minute' : 'Minutes';
     1583        var hourString = intHours == 1 ? 'Hour' : 'Hours';
     1584        if (intHours > 0)
     1585            return `${intHours} ${this.UIString(hourString)}, ${intMinutes} ${this.UIString(minuteString)}, ${intSeconds} ${this.UIString(secondString)}`;
     1586        if (intMinutes > 0)
     1587            return `${intMinutes} ${this.UIString(minuteString)}, ${intSeconds} ${this.UIString(secondString)}`;
     1588        return `${intSeconds} ${this.UIString(secondString)}`;
     1589    },
    15711590
    15721591    formatTime: function(time)
     
    17701789        var timeRemaining = currentTime - this.video.duration;
    17711790        this.currentTimeClone.innerText = this.controls.currentTime.innerText = this.formatTime(currentTime);
    1772         this.controls.currentTime.setAttribute('aria-label', `${this.UIString('Elapsed')} ${this.formatTime(currentTime)}`);
     1791        this.controls.currentTime.setAttribute('aria-label', `${this.UIString('Elapsed')} ${this.formatTimeDescription(currentTime)}`);
    17731792        this.controls.timeline.value = this.video.currentTime;
    17741793        this.remainingTimeClone.innerText = this.controls.remainingTime.innerText = this.formatTime(timeRemaining);
    1775         this.controls.remainingTime.setAttribute('aria-label', `${this.UIString('Remaining')} ${this.formatTime(timeRemaining)}`);
     1794        this.controls.remainingTime.setAttribute('aria-label', `${this.UIString('Remaining')} ${this.formatTimeDescription(timeRemaining)}`);
     1795       
     1796        // Mark the timeline value in percentage format in accessibility.
     1797        var timeElapsedPercent = currentTime / this.video.duration;
     1798        timeElapsedPercent = Math.max(Math.min(1, timeElapsedPercent), 0);
     1799        this.controls.timeline.setAttribute('aria-valuetext', `${parseInt(timeElapsedPercent * 100)}%`);
    17761800    },
    17771801   
Note: See TracChangeset for help on using the changeset viewer.