Skip to content
  • vcarbune@chromium.org's avatar
    Determine text direction for rendering a TextTrackCue · 770dc028
    vcarbune@chromium.org authored
    https://bugs.webkit.org/show_bug.cgi?id=79749
    
    Reviewed by Levi Weintraub.
    
    Source/WebCore:
    
    The rendering rules for WebVTT cues are slightly different
    depending on the directionality determined from the characters
    of the cue text. This patch implements the preliminary step
    to be able to take directionality into account.
    
    It iterates through the cue characters and setting the CSS
    directionality to the one of the first strong directional character.
    
    Test: media/track/track-cue-rendering-rtl.html
    
    * html/track/TextTrackCue.cpp:
    (WebCore::TextTrackCueBox::applyCSSProperties): Applies the determined
    direction.
    (WebCore::TextTrackCue::TextTrackCue): Sets the default value for the
    display direction.
    (WebCore::isCueParagraphSeparator): Tests for explicit unicode characters
    that are paragraph separators.
    (WebCore):
    (WebCore::TextTrackCue::determineTextDirection): Determined the direction
    by the first strong directional character found.
    (WebCore::TextTrackCue::calculateDisplayParameters): Updated.
    (WebCore::TextTrackCue::getCSSWritingDirection): Return the determined CSS
    writing direction.
    * html/track/TextTrackCue.h:
    (TextTrackCue):
    
    LayoutTests:
    
    * media/track/captions-webvtt/captions-rtl.vtt: Added.
    * media/track/track-cue-rendering-rtl-expected.txt: Added.
    * media/track/track-cue-rendering-rtl.html: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146128 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    770dc028