Changeset 139714 in webkit


Ignore:
Timestamp:
Jan 14, 2013 9:22:43 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Implement ID selector matching for the WebVTT ::cue pseudo element
https://bugs.webkit.org/show_bug.cgi?id=105481

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

Source/WebCore:

Implemented matching cue WebVTT elements by an identifier. Identifiers of all WebVTT nodes in the rendering tree for
a given cue are set to match the cue identifier.

Existing tests were modified to cover this case.

  • html/track/TextTrackCue.cpp:

(WebCore::TextTrackCue::markFutureAndPastNodes):

LayoutTests:

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

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r139709 r139714  
     12013-01-14  Dima Gorbik  <dgorbik@apple.com>
     2
     3        Implement ID selector matching for the WebVTT ::cue pseudo element
     4        https://bugs.webkit.org/show_bug.cgi?id=105481
     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-14  Dominic Cooney   <dominicc@chromium.org>
    213
  • trunk/LayoutTests/media/track/captions-webvtt/styling.vtt

    r139692 r139714  
    161600:01.000 --> 00:01.200
    1717<c>Aliquam sollicitudin</c> <v>massa ac magna vulputate dignissim</v> <b>posuere et fermentum</b>
     18
     19testcue
     2000:01.200 --> 00:01.400
     21<c>Aliquam sollicitudin</c> <v>massa ac magna vulputate dignissim</v> <b>posuere et fermentum</b>
  • trunk/LayoutTests/media/track/track-css-matching-expected.txt

    r139692 r139714  
    1 1. Test that cues are being matched properly by the class name
    21EVENT(canplaythrough)
    32EVENT(seeked)
     3
     4
     51. Test that cues are being matched properly by the class name
    46EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
    57EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
     
    3537EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 255, 0)') OK
    3638EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 255, 0)') OK
     39
     40RUN(video.currentTime = 1.3)
     41EVENT(seeked)
     42
     43
     444. Test that cues are being matched properly by id.
     45EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
     46EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
     47EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
    3748END OF TEST
    3849
  • trunk/LayoutTests/media/track/track-css-matching.html

    r139692 r139714  
    1414        video::cue(.red, .red2) { color:red }
    1515        #testvideo::cue(.green) { color:green }
     16        video::cue(#testcue) {color: green}
    1617        video::cue(:future) {color: gray}
    1718        </style>
     
    2122        var cueNode;
    2223        var seekedCount = 0;
     24        var seekTimes = [0.3, 0.5, 0.7, 0.9, 1.1, 1.3];
     25
    2326        var info = [["rgb(255, 0, 0)", "rgb(0, 128, 0)", "rgb(255, 0, 0)"],
    2427                    ["rgb(128, 0, 128)", "rgb(128, 128, 128)", "rgb(128, 128, 128)"],
    2528                    ["rgb(128, 0, 128)", "rgb(128, 0, 128)", "rgb(128, 128, 128)"],
    2629                    ["rgb(128, 0, 128)", "rgb(128, 0, 128)", "rgb(128, 0, 128)"],
    27                     ["rgb(128, 0, 128)", "rgb(255, 255, 0)", "rgb(0, 255, 0)"]];
    28         var seekTimes = [0.3, 0.5, 0.7, 0.9, 1.1, 1.3];
     30                    ["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)"]];
     32
     33        var description = ["1. Test that cues are being matched properly by the class name",
     34                           "2. Test that cues are being matched properly by the ':future' pseudo class.", "", "",
     35                           "3. Test that cues are being matched properly by tag.",
     36                           "4. Test that cues are being matched properly by id."];
    2937
    3038        function skipNonElements(root)
     
    3644            return nextElementSibling;
    3745        }
    38        
     46
    3947        function seeked()
    4048        {
     
    4250                return;
    4351
    44             if (seekedCount == 1) {
    45                 consoleWrite("");
    46                 consoleWrite("");
    47                 consoleWrite("2. Test that cues are being matched properly by the ':future' pseudo class.");
    48             } else if (seekedCount == 4) {
    49                 consoleWrite("");
    50                 consoleWrite("");
    51                 consoleWrite("3. Test that cues are being matched properly by tag.");
     52            if (description[seekedCount] != "") {
     53                consoleWrite("<br>");
     54                consoleWrite(description[seekedCount]);
    5255            }
    5356
     
    7073        function loaded()
    7174        {
    72             consoleWrite("1. Test that cues are being matched properly by the class name");
    7375            findMediaElement();
    7476            video.src = findMediaFile('video', '../content/test');
  • trunk/Source/WebCore/ChangeLog

    r139711 r139714  
     12013-01-14  Dima Gorbik  <dgorbik@apple.com>
     2
     3        Implement ID selector matching for the WebVTT ::cue pseudo element
     4        https://bugs.webkit.org/show_bug.cgi?id=105481
     5
     6        Reviewed by Eric Carlson.
     7
     8        Implemented matching cue WebVTT elements by an identifier. Identifiers of all WebVTT nodes in the rendering tree for
     9        a given cue are set to match the cue identifier.
     10
     11        Existing tests were modified to cover this case.
     12
     13        * html/track/TextTrackCue.cpp:
     14        (WebCore::TextTrackCue::markFutureAndPastNodes):
     15
    1162013-01-14  Mark Pilgrim  <pilgrim@chromium.org>
    217
     
    126141        * rendering/RenderListItem.h:
    127142
    128 2013-01-14  Dima Gorbik  <dgorbik@apple.com>
     1432013-01-13  Dima Gorbik  <dgorbik@apple.com>
    129144
    130145        Implement element type selectors for the WebVTT ::cue pseudo class
  • trunk/Source/WebCore/html/track/TextTrackCue.cpp

    r139692 r139714  
    695695                isPastNode = false;
    696696        }
    697 
    698         if (child->isElementNode())
     697       
     698        if (child->isElementNode()) {
    699699            toElement(child)->setWebVTTNodeType(isPastNode ? WebVTTNodeTypePast : WebVTTNodeTypeFuture);
     700            // Make an elemenet id match a cue id for style matching purposes.
     701            if (!m_id.isEmpty())
     702                toElement(child)->setIdAttribute(AtomicString(m_id.characters(), m_id.length()));
     703        }
    700704    }
    701705}
Note: See TracChangeset for help on using the changeset viewer.