Changeset 139803 in webkit


Ignore:
Timestamp:
Jan 15, 2013 3:49:31 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Implement matching by the voice attribute for WebVTT ::cue pseudo element
https://bugs.webkit.org/show_bug.cgi?id=106762

Patch by Dima Gorbik <dgorbik@apple.com> on 2013-01-15
Reviewed by Eric Carlson.

Source/WebCore:

Implemented matching cue WebVTT elements by a voice attribute by adding a WebVTT specific voice attribute.
For DOM trees title attribute is used instead as this is required by specs.

  • html/track/TextTrackCue.cpp:

(WebCore::TextTrackCue::copyWebVTTNodeToDOMTree): set a title argument instead of a voice attribute for the DOM tree.

  • html/track/TextTrackCue.h:

(WebCore::TextTrackCue::voiceAttributeName):

  • html/track/WebVTTParser.cpp:

(WebCore::WebVTTParser::constructTreeFromToken):

LayoutTests:

  • media/track/captions-webvtt/styling.vtt:
  • media/track/track-css-matching-expected.txt:
  • media/track/track-css-matching.html:
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r139799 r139803  
     12013-01-15  Dima Gorbik  <dgorbik@apple.com>
     2
     3        Implement matching by the voice attribute for WebVTT ::cue pseudo element
     4        https://bugs.webkit.org/show_bug.cgi?id=106762
     5
     6        Reviewed by Eric Carlson.
     7
     8        * media/track/captions-webvtt/styling.vtt:
     9        * media/track/track-css-matching-expected.txt:
     10        * media/track/track-css-matching.html:
     11
    1122013-01-15  Levi Weintraub  <leviw@chromium.org>
    213
  • trunk/LayoutTests/media/track/captions-webvtt/styling.vtt

    r139714 r139803  
    202000:01.200 --> 00:01.400
    2121<c>Aliquam sollicitudin</c> <v>massa ac magna vulputate dignissim</v> <b>posuere et fermentum</b>
     22
     235
     2400:01.400 --> 00:01.600
     25<v>Aliquam sollicitudin</v> <v Mark>massa ac magna vulputate dignissim</v> <v Nancy>posuere et fermentum</v>
     26
  • trunk/LayoutTests/media/track/track-css-matching-expected.txt

    r139714 r139803  
    4646EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
    4747EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
     48
     49RUN(video.currentTime = 1.5)
     50EVENT(seeked)
     51
     52
     535. Test that cues are being matched properly by the voice attribute.
     54EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 255, 0)') OK
     55EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
     56EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
    4857END OF TEST
    4958
  • trunk/LayoutTests/media/track/track-css-matching.html

    r139714 r139803  
    1111        video::cue(c) {color: purple}
    1212        video::cue(v) {color: yellow}
     13        video::cue(v[voice="Mark"]) {color: red}
     14        video::cue(v[voice="Nancy"]) {color: green}
    1315        video::cue(b) {color: lime}
    1416        video::cue(.red, .red2) { color:red }
     
    2224        var cueNode;
    2325        var seekedCount = 0;
    24         var seekTimes = [0.3, 0.5, 0.7, 0.9, 1.1, 1.3];
     26        var seekTimes = [0.3, 0.5, 0.7, 0.9, 1.1, 1.3, 1.5];
    2527
    2628        var info = [["rgb(255, 0, 0)", "rgb(0, 128, 0)", "rgb(255, 0, 0)"],
     
    2931                    ["rgb(128, 0, 128)", "rgb(128, 0, 128)", "rgb(128, 0, 128)"],
    3032                    ["rgb(128, 0, 128)", "rgb(255, 255, 0)", "rgb(0, 255, 0)"],
    31                     ["rgb(0, 128, 0)", "rgb(0, 128, 0)", "rgb(0, 128, 0)"]];
     33                    ["rgb(0, 128, 0)", "rgb(0, 128, 0)", "rgb(0, 128, 0)"],
     34                    ["rgb(255, 255, 0)", "rgb(255, 0, 0)", "rgb(0, 128, 0)"]];
    3235
    3336        var description = ["1. Test that cues are being matched properly by the class name",
    3437                           "2. Test that cues are being matched properly by the ':future' pseudo class.", "", "",
    3538                           "3. Test that cues are being matched properly by tag.",
    36                            "4. Test that cues are being matched properly by id."];
     39                           "4. Test that cues are being matched properly by id.",
     40                           "5. Test that cues are being matched properly by the voice attribute."];
    3741
    3842        function skipNonElements(root)
  • trunk/Source/WebCore/ChangeLog

    r139802 r139803  
     12013-01-15  Dima Gorbik  <dgorbik@apple.com>
     2        Implement matching by the voice attribute for WebVTT ::cue pseudo element
     3        https://bugs.webkit.org/show_bug.cgi?id=106762
     4
     5        Reviewed by Eric Carlson.
     6
     7        Implemented matching cue WebVTT elements by a voice attribute by adding a WebVTT specific voice attribute.
     8        For DOM trees title attribute is used instead as this is required by specs.
     9
     10        * html/track/TextTrackCue.cpp:
     11        (WebCore::TextTrackCue::copyWebVTTNodeToDOMTree): set a title argument instead of a voice attribute for the DOM tree.
     12        * html/track/TextTrackCue.h:
     13        (WebCore::TextTrackCue::voiceAttributeName):
     14        * html/track/WebVTTParser.cpp:
     15        (WebCore::WebVTTParser::constructTreeFromToken):
     16
    1172013-01-15  Simon Fraser  <simon.fraser@apple.com>
    218
  • trunk/Source/WebCore/html/track/TextTrackCue.cpp

    r139714 r139803  
    496496            clonedNode = HTMLSpanElement::create(spanTag, static_cast<Document*>(m_scriptExecutionContext));
    497497            toElement(clonedNode.get())->setAttribute(classAttr, toElement(node)->getAttribute(classAttr));
    498             toElement(clonedNode.get())->setAttribute(titleAttr, toElement(node)->getAttribute(titleAttr));
     498            toElement(clonedNode.get())->setAttribute(titleAttr, toElement(node)->getAttribute(voiceAttributeName()));
    499499        } else
    500500            clonedNode = node->cloneNode(false);
  • trunk/Source/WebCore/html/track/TextTrackCue.h

    r139692 r139803  
    9090        return cTag;
    9191    }
     92   
     93    static const QualifiedName& voiceAttributeName()
     94    {
     95        DEFINE_STATIC_LOCAL(QualifiedName, voiceAttr, (nullAtom, "voice", nullAtom));
     96        return voiceAttr;
     97    }
    9298
    9399    virtual ~TextTrackCue();
  • trunk/Source/WebCore/html/track/WebVTTParser.cpp

    r139692 r139803  
    368368                child->setAttribute(classAttr, AtomicString(m_token.classes().data(), m_token.classes().size()));
    369369            if (child->hasTagName(TextTrackCue::voiceElementTagName()))
    370                 child->setAttribute(titleAttr, AtomicString(m_token.annotation().data(), m_token.annotation().size()));
     370                child->setAttribute(TextTrackCue::voiceAttributeName(), AtomicString(m_token.annotation().data(), m_token.annotation().size()));
    371371            m_currentNode->parserAppendChild(child);
    372372            m_currentNode = child;
Note: See TracChangeset for help on using the changeset viewer.