Changeset 150516 in webkit


Ignore:
Timestamp:
May 22, 2013 9:11:55 AM (11 years ago)
Author:
Antoine Quint
Message:

[Mac] Captions menu isn't internationalized, doesn't use rtl layout for rtl languages
https://bugs.webkit.org/show_bug.cgi?id=116605

Reviewed by Eric Carlson.

Ensure that rtl languages are properly recognized by the captions menu such that text
layout and alignment is natural.

  • css/mediaControls.css:

(::-webkit-media-controls):
Remove the forced "direction: ltr" property which was forcing all layout to be
left-to-right.

  • css/mediaControlsQuickTime.css:

(video::-webkit-media-controls-closed-captions-track-list):
Remove the forced "text-align: left" property which was forcing all caption
titles to be left-aligned.

(video::-webkit-media-controls-closed-captions-track-list h3):
Use "-webkit-margin-start" instead of "padding-left" to position the heading
such that it adds the margin on the left for ltr languages and on the right
for rtl languages.

(video::-webkit-media-controls-closed-captions-track-list li):
Set "position: relative" such that the ::before pseudo-class can use "position: absolute"
to position itself relative to the caption title rather than the list element.

(video::-webkit-media-controls-closed-captions-track-list li.selected::before):
(video::-webkit-media-controls-closed-captions-track-list li.selected:hover::before):
Make the checkmarks a ::before pseudo-class rather than a background-image such that
we may control its positioning using the internationlization-friendly "-webkit-margin-start"
property.

  • html/shadow/MediaControlElements.cpp:

(WebCore::MediaControlClosedCaptionsContainerElement::create):
Set the "dir" attribute to "auto" such that rtl languages are correctly handled. This
means that the first string displayed within the captions container, currently the
"Subtitles" <h3> element, defines the direction for the whole container. It is therefore
crucial that this string is properly localized in rtl languages as falling back to
english would mean the entire caption container is using ltr.

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r150513 r150516  
     12013-05-22  Antoine Quint  <graouts@apple.com>
     2
     3        [Mac] Captions menu isn't internationalized, doesn't use rtl layout for rtl languages
     4        https://bugs.webkit.org/show_bug.cgi?id=116605
     5
     6        Reviewed by Eric Carlson.
     7
     8        Ensure that rtl languages are properly recognized by the captions menu such that text
     9        layout and alignment is natural.
     10
     11        * css/mediaControls.css:
     12        (::-webkit-media-controls):
     13        Remove the forced "direction: ltr" property which was forcing all layout to be
     14        left-to-right.
     15
     16        * css/mediaControlsQuickTime.css:
     17        (video::-webkit-media-controls-closed-captions-track-list):
     18        Remove the forced "text-align: left" property which was forcing all caption
     19        titles to be left-aligned.
     20
     21        (video::-webkit-media-controls-closed-captions-track-list h3):
     22        Use "-webkit-margin-start" instead of "padding-left" to position the heading
     23        such that it adds the margin on the left for ltr languages and on the right
     24        for rtl languages.
     25
     26        (video::-webkit-media-controls-closed-captions-track-list li):
     27        Set "position: relative" such that the ::before pseudo-class can use "position: absolute"
     28        to position itself relative to the caption title rather than the list element.
     29
     30        (video::-webkit-media-controls-closed-captions-track-list li.selected::before):
     31        (video::-webkit-media-controls-closed-captions-track-list li.selected:hover::before):
     32        Make the checkmarks a ::before pseudo-class rather than a background-image such that
     33        we may control its positioning using the internationlization-friendly "-webkit-margin-start"
     34        property.
     35
     36        * html/shadow/MediaControlElements.cpp:
     37        (WebCore::MediaControlClosedCaptionsContainerElement::create):
     38        Set the "dir" attribute to "auto" such that rtl languages are correctly handled. This
     39        means that the first string displayed within the captions container, currently the
     40        "Subtitles" <h3> element, defines the direction for the whole container. It is therefore
     41        crucial that this string is properly localized in rtl languages as falling back to
     42        english would mean the entire caption container is using ltr.
     43
    1442013-05-22  Hugo Parente Lima  <hugo.lima@openbossa.org>
    245
  • trunk/Source/WebCore/css/mediaControls.css

    r150260 r150516  
    3939    position: relative;
    4040    display: -webkit-flex;
    41     direction: ltr;
    4241    -webkit-align-items: flex-start;
    4342    -webkit-justify-content: flex-end;
  • trunk/Source/WebCore/css/mediaControlsQuickTime.css

    r149942 r150516  
    266266video::-webkit-media-controls-closed-captions-track-list {
    267267    display: block;
    268     text-align: left;
    269268    font-family: "Helvetica Bold", Helvetica;
    270269    font-size: 10pt;
     
    276275    color: #757575;
    277276    text-shadow: 0 1px 0 black;
    278     padding-left: 23px;
     277    -webkit-margin-start: 23px;
    279278    padding-top: 4px;
    280279    font-weight: bold;
     
    290289
    291290video::-webkit-media-controls-closed-captions-track-list li {
     291    position: relative;
    292292    color: white;
    293293    background-image: none;
     
    312312}
    313313
    314 video::-webkit-media-controls-closed-captions-track-list li.selected {
     314video::-webkit-media-controls-closed-captions-track-list li.selected::before {
     315    display: block;
     316    content: "";
     317    position: absolute;
     318    top: 0.25em;
     319    width: 1.1em;
     320    height: 1.1em;
     321    -webkit-margin-start: -20px;
    315322    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300"><polygon fill="#a3a3a3" points="252.301,4.477 126.667,194.104 43.358,108.3 6.868,161.408 132.515,290.814 297.732,49.926"/></svg>');
    316323    background-repeat: no-repeat;
    317     background-position: 17px 0.25em;
    318     background-size: 1.1em 1.1em;
    319 }
    320 
    321 video::-webkit-media-controls-closed-captions-track-list li.selected:hover {
    322     background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300"><polygon fill="white" points="252.301,4.477 126.667,194.104 43.358,108.3 6.868,161.408 132.515,290.814 297.732,49.926"/></svg>'), -webkit-gradient(linear, left top, left bottom, color-stop(0, #4f70f6), color-stop(1, #1a44f3));
    323     background-repeat: no-repeat, repeat;
    324     background-position: 17px 0.25em, top left;
    325     background-size: 1.1em 1.1em, 100% 100%;
    326 }
     324}
     325
     326video::-webkit-media-controls-closed-captions-track-list li.selected:hover::before {
     327    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300"><polygon fill="white" points="252.301,4.477 126.667,194.104 43.358,108.3 6.868,161.408 132.515,290.814 297.732,49.926"/></svg>');
     328}
  • trunk/Source/WebCore/html/shadow/MediaControlElements.cpp

    r149766 r150516  
    740740{
    741741    RefPtr<MediaControlClosedCaptionsContainerElement> element = adoptRef(new MediaControlClosedCaptionsContainerElement(document));
     742    element->setAttribute(dirAttr, "auto");
    742743    element->hide();
    743744    return element.release();
Note: See TracChangeset for help on using the changeset viewer.