Title: [136843] trunk
Revision
136843
Author
commit-qu...@webkit.org
Date
2012-12-06 07:23:10 -0800 (Thu, 06 Dec 2012)

Log Message

TextTrack's .cues not ordered correctly when two cues have the same .startTime
https://bugs.webkit.org/show_bug.cgi?id=103266

Patch by Antoine Quint <grao...@apple.com> on 2012-12-06
Reviewed by Eric Carlson.

Source/WebCore:

Adding a new method TextTrackCueList::updateCueIndex() to update the list of
cues after changing the .startTime or .endTime of a TextTrackCue. I elected to
add a new method to TextTrackCueList rather than calling remove() and then add()
on the list from TextTrack::cueDidChange() so that the nature of the operation
is abstracted and we can easily change the way we keep the cue list sorted at
a later time should we choose to.

* html/track/TextTrack.cpp:
(WebCore::TextTrack::cueDidChange):
* html/track/TextTrackCueList.cpp:
(WebCore::TextTrackCueList::updateCueIndex):
(WebCore):
* html/track/TextTrackCueList.h:
(TextTrackCueList):

LayoutTests:

Unskip an Opera test that we now pass. Note that the original test has two issues that prompted
changes in this patch. The first issue is https://www.w3.org/Bugs/Public/show_bug.cgi?id=20066
and I've elected to comment the sub-test that fails and tracking turning it back on when the test
is corrected with https://bugs.webkit.org/show_bug.cgi?id=104255. The second issue was in the sub-test
that revealed the failure covered by this bug and had an issue acknowledged by the author
(see https://www.w3.org/Bugs/Public/show_bug.cgi?id=20066) so I fixed it in our repository.

* media/track/opera/interfaces/TextTrack/cues-expected.txt: Added.
* media/track/opera/interfaces/TextTrack/cues.html:
* platform/chromium/TestExpectations:
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/mac/TestExpectations:
* platform/qt/TestExpectations:
* platform/win/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (136842 => 136843)


--- trunk/LayoutTests/ChangeLog	2012-12-06 15:01:28 UTC (rev 136842)
+++ trunk/LayoutTests/ChangeLog	2012-12-06 15:23:10 UTC (rev 136843)
@@ -1,3 +1,26 @@
+2012-12-06  Antoine Quint  <grao...@apple.com>
+
+        TextTrack's .cues not ordered correctly when two cues have the same .startTime
+        https://bugs.webkit.org/show_bug.cgi?id=103266
+
+        Reviewed by Eric Carlson.
+
+        Unskip an Opera test that we now pass. Note that the original test has two issues that prompted
+        changes in this patch. The first issue is https://www.w3.org/Bugs/Public/show_bug.cgi?id=20066
+        and I've elected to comment the sub-test that fails and tracking turning it back on when the test
+        is corrected with https://bugs.webkit.org/show_bug.cgi?id=104255. The second issue was in the sub-test
+        that revealed the failure covered by this bug and had an issue acknowledged by the author
+        (see https://www.w3.org/Bugs/Public/show_bug.cgi?id=20066) so I fixed it in our repository.
+
+        * media/track/opera/interfaces/TextTrack/cues-expected.txt: Added.
+        * media/track/opera/interfaces/TextTrack/cues.html:
+        * platform/chromium/TestExpectations:
+        * platform/efl/TestExpectations:
+        * platform/gtk/TestExpectations:
+        * platform/mac/TestExpectations:
+        * platform/qt/TestExpectations:
+        * platform/win/TestExpectations:
+
 2012-12-06  Zan Dobersek  <zandober...@gmail.com>
 
         Unreviewed GTK gardening.

Added: trunk/LayoutTests/media/track/opera/interfaces/TextTrack/cues-expected.txt (0 => 136843)


--- trunk/LayoutTests/media/track/opera/interfaces/TextTrack/cues-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/track/opera/interfaces/TextTrack/cues-expected.txt	2012-12-06 15:23:10 UTC (rev 136843)
@@ -0,0 +1,5 @@
+
+PASS TextTrack.cues, after addCue() 
+PASS TextTrack.cues, different modes 
+PASS TextTrack.cues, changing order 
+

Modified: trunk/LayoutTests/media/track/opera/interfaces/TextTrack/cues.html (136842 => 136843)


--- trunk/LayoutTests/media/track/opera/interfaces/TextTrack/cues.html	2012-12-06 15:01:28 UTC (rev 136842)
+++ trunk/LayoutTests/media/track/opera/interfaces/TextTrack/cues.html	2012-12-06 15:23:10 UTC (rev 136843)
@@ -14,16 +14,18 @@
     window.t1_cues = t1.cues
     window.t2_cues = t2.cues
 });
+// Skipping this test due to https://www.w3.org/Bugs/Public/show_bug.cgi?id=20066,
+// tracking uncommenting this when test is fixed with webkit.org/b/104255
+// test(function(){
+//     assert_equals(t1.cues, t1_cues, 't1.cues should return same object');
+//     assert_equals(t2.cues, t2_cues, 't2.cues should return same object');
+//     assert_not_equals(t1.cues, t2.cues, 't1.cues and t2.cues should be different objects');
+//     assert_not_equals(t1.cues, null, 't1.cues should not be null');
+//     assert_not_equals(t2.cues, null, 't2.cues should not be null');
+//     assert_equals(t1.cues.length, 0, 't1.cues should have length 0');
+//     assert_equals(t2.cues.length, 0, 't2.cues should have length 0');
+// }, document.title+', empty list');
 test(function(){
-    assert_equals(t1.cues, t1_cues, 't1.cues should return same object');
-    assert_equals(t2.cues, t2_cues, 't2.cues should return same object');
-    assert_not_equals(t1.cues, t2.cues, 't1.cues and t2.cues should be different objects');
-    assert_not_equals(t1.cues, null, 't1.cues should not be null');
-    assert_not_equals(t2.cues, null, 't2.cues should not be null');
-    assert_equals(t1.cues.length, 0, 't1.cues should have length 0');
-    assert_equals(t2.cues.length, 0, 't2.cues should have length 0');
-}, document.title+', empty list');
-test(function(){
     var c = new TextTrackCue(0, 1, "text");
     c.id = "id";
     t1.addCue(c);
@@ -62,7 +64,7 @@
     t1.cues[1].startTime = 0; // this should change the text track cue order
     assert_equals(t1.cues[0].id, 'id2');
     assert_equals(t1.cues[1].id, 'id');
-    t1.cues[1].startTime = 0.5; // this should change it back
+    t1.cues[0].startTime = 0.5; // this should change it back
     assert_equals(t1.cues[0].id, 'id');
     assert_equals(t1.cues[1].id, 'id2');
 }, document.title+', changing order');

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (136842 => 136843)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2012-12-06 15:01:28 UTC (rev 136842)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2012-12-06 15:23:10 UTC (rev 136843)
@@ -3000,7 +3000,6 @@
 webkit.org/b/103926 media/track/opera/interfaces/HTMLElement/HTMLTrackElement/kind.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/HTMLElement/HTMLTrackElement/src.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/TextTrack/activeCues.html [ Skip ]
-webkit.org/b/103926 media/track/opera/interfaces/TextTrack/cues.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/TextTrack/removeCue.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/TrackEvent/constructor.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/TrackEvent/createEvent.html [ Skip ]

Modified: trunk/LayoutTests/platform/efl/TestExpectations (136842 => 136843)


--- trunk/LayoutTests/platform/efl/TestExpectations	2012-12-06 15:01:28 UTC (rev 136842)
+++ trunk/LayoutTests/platform/efl/TestExpectations	2012-12-06 15:23:10 UTC (rev 136843)
@@ -723,7 +723,6 @@
 webkit.org/b/103926 media/track/opera/interfaces/HTMLElement/HTMLTrackElement/kind.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/HTMLElement/HTMLTrackElement/src.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/TextTrack/activeCues.html [ Skip ]
-webkit.org/b/103926 media/track/opera/interfaces/TextTrack/cues.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/TextTrack/removeCue.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/TrackEvent/constructor.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/TrackEvent/createEvent.html [ Skip ]

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (136842 => 136843)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2012-12-06 15:01:28 UTC (rev 136842)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2012-12-06 15:23:10 UTC (rev 136843)
@@ -424,7 +424,6 @@
 webkit.org/b/103926 media/track/opera/interfaces/HTMLElement/HTMLTrackElement/kind.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/HTMLElement/HTMLTrackElement/src.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/TextTrack/activeCues.html [ Skip ]
-webkit.org/b/103926 media/track/opera/interfaces/TextTrack/cues.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/TextTrack/removeCue.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/TrackEvent/constructor.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/TrackEvent/createEvent.html [ Skip ]

Modified: trunk/LayoutTests/platform/mac/TestExpectations (136842 => 136843)


--- trunk/LayoutTests/platform/mac/TestExpectations	2012-12-06 15:01:28 UTC (rev 136842)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2012-12-06 15:23:10 UTC (rev 136843)
@@ -479,7 +479,6 @@
 webkit.org/b/103926 media/track/opera/interfaces/HTMLElement/HTMLTrackElement/kind.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/HTMLElement/HTMLTrackElement/src.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/TextTrack/activeCues.html [ Skip ]
-webkit.org/b/103926 media/track/opera/interfaces/TextTrack/cues.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/TextTrack/removeCue.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/TrackEvent/constructor.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/TrackEvent/createEvent.html [ Skip ]

Modified: trunk/LayoutTests/platform/qt/TestExpectations (136842 => 136843)


--- trunk/LayoutTests/platform/qt/TestExpectations	2012-12-06 15:01:28 UTC (rev 136842)
+++ trunk/LayoutTests/platform/qt/TestExpectations	2012-12-06 15:23:10 UTC (rev 136843)
@@ -905,7 +905,6 @@
 webkit.org/b/103926 media/track/opera/interfaces/HTMLElement/HTMLTrackElement/kind.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/HTMLElement/HTMLTrackElement/src.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/TextTrack/activeCues.html [ Skip ]
-webkit.org/b/103926 media/track/opera/interfaces/TextTrack/cues.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/TextTrack/removeCue.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/TrackEvent/constructor.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/TrackEvent/createEvent.html [ Skip ]

Modified: trunk/LayoutTests/platform/win/TestExpectations (136842 => 136843)


--- trunk/LayoutTests/platform/win/TestExpectations	2012-12-06 15:01:28 UTC (rev 136842)
+++ trunk/LayoutTests/platform/win/TestExpectations	2012-12-06 15:23:10 UTC (rev 136843)
@@ -1566,7 +1566,6 @@
 webkit.org/b/103926 media/track/opera/interfaces/HTMLElement/HTMLTrackElement/kind.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/HTMLElement/HTMLTrackElement/src.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/TextTrack/activeCues.html [ Skip ]
-webkit.org/b/103926 media/track/opera/interfaces/TextTrack/cues.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/TextTrack/removeCue.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/TrackEvent/constructor.html [ Skip ]
 webkit.org/b/103926 media/track/opera/interfaces/TrackEvent/createEvent.html [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (136842 => 136843)


--- trunk/Source/WebCore/ChangeLog	2012-12-06 15:01:28 UTC (rev 136842)
+++ trunk/Source/WebCore/ChangeLog	2012-12-06 15:23:10 UTC (rev 136843)
@@ -1,3 +1,25 @@
+2012-12-06  Antoine Quint  <grao...@apple.com>
+
+        TextTrack's .cues not ordered correctly when two cues have the same .startTime
+        https://bugs.webkit.org/show_bug.cgi?id=103266
+
+        Reviewed by Eric Carlson.
+
+        Adding a new method TextTrackCueList::updateCueIndex() to update the list of
+        cues after changing the .startTime or .endTime of a TextTrackCue. I elected to
+        add a new method to TextTrackCueList rather than calling remove() and then add()
+        on the list from TextTrack::cueDidChange() so that the nature of the operation
+        is abstracted and we can easily change the way we keep the cue list sorted at
+        a later time should we choose to.
+
+        * html/track/TextTrack.cpp:
+        (WebCore::TextTrack::cueDidChange):
+        * html/track/TextTrackCueList.cpp:
+        (WebCore::TextTrackCueList::updateCueIndex):
+        (WebCore):
+        * html/track/TextTrackCueList.h:
+        (TextTrackCueList):
+
 2012-12-06  Andras Becsi  <andras.be...@digia.com>
 
         [Qt][Mac] Fix libxslt and libxml2 config tests

Modified: trunk/Source/WebCore/html/track/TextTrack.cpp (136842 => 136843)


--- trunk/Source/WebCore/html/track/TextTrack.cpp	2012-12-06 15:01:28 UTC (rev 136842)
+++ trunk/Source/WebCore/html/track/TextTrack.cpp	2012-12-06 15:23:10 UTC (rev 136843)
@@ -285,6 +285,9 @@
     if (!m_client)
         return;
 
+    // Make sure the TextTrackCueList order is up-to-date.
+    ensureTextTrackCueList()->updateCueIndex(cue);
+
     // ... and add it back again.
     m_client->textTrackAddCue(this, cue);
 }

Modified: trunk/Source/WebCore/html/track/TextTrackCueList.cpp (136842 => 136843)


--- trunk/Source/WebCore/html/track/TextTrackCueList.cpp	2012-12-06 15:01:28 UTC (rev 136842)
+++ trunk/Source/WebCore/html/track/TextTrackCueList.cpp	2012-12-06 15:23:10 UTC (rev 136843)
@@ -123,6 +123,15 @@
     return m_list.contains(cue);
 }
 
+bool TextTrackCueList::updateCueIndex(TextTrackCue* cue)
+{
+    if (!contains(cue))
+        return false;
+    
+    remove(cue);
+    return add(cue);
+}
+
 void TextTrackCueList::clear()
 {
     m_list.clear();

Modified: trunk/Source/WebCore/html/track/TextTrackCueList.h (136842 => 136843)


--- trunk/Source/WebCore/html/track/TextTrackCueList.h	2012-12-06 15:01:28 UTC (rev 136842)
+++ trunk/Source/WebCore/html/track/TextTrackCueList.h	2012-12-06 15:23:10 UTC (rev 136843)
@@ -54,6 +54,8 @@
     bool add(PassRefPtr<TextTrackCue>);
     bool remove(TextTrackCue*);
     bool contains(TextTrackCue*) const;
+    
+    bool updateCueIndex(TextTrackCue*);
 
 private:
     TextTrackCueList();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to