Title: [169146] trunk/Source/WebCore
Revision
169146
Author
[email protected]
Date
2014-05-20 21:08:33 -0700 (Tue, 20 May 2014)

Log Message

[Mac] DataCues do not work properly when rewinding video
https://bugs.webkit.org/show_bug.cgi?id=133138
<rdar://problem/16979086>

Reviewed by Eric Carlson.

Make the TrackPrivateBase responsible for knowing if a type of track needs a non-zero
startTimeVariance value.

Also, correct a bug in the equality test for DataCue objects.

* html/track/DataCue.cpp:
(WebCore::DataCue::isEqual): Handle the JSValue data types consistently, so that we don't attempt
to compare a JSNull against a default JSValue object.
* html/track/InbandTextTrack.cpp:
(WebCore::InbandTextTrack::startTimeVariance): Added.
* html/track/InbandTextTrack.h:
* html/track/TextTrack.cpp:
(WebCore::TextTrack::hasCue): Use new startTimeVariance method location.
* html/track/TextTrack.h:
(WebCore::TextTrack::startTimeVariance): Added.
* html/track/TextTrackCue.cpp:
(WebCore::TextTrackCue::hasEquivalentStartTime): Use new startTimeVariance location.
* html/track/TextTrackCue.h:
(WebCore::TextTrackCue::startTimeVariance): Deleted.
* html/track/TextTrackCueGeneric.h:
* platform/graphics/TrackPrivateBase.h:
(WebCore::TrackPrivateBase::startTimeVariance): Added.
* platform/graphics/avfoundation/InbandTextTrackPrivateAVF.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (169145 => 169146)


--- trunk/Source/WebCore/ChangeLog	2014-05-21 03:49:16 UTC (rev 169145)
+++ trunk/Source/WebCore/ChangeLog	2014-05-21 04:08:33 UTC (rev 169146)
@@ -1,3 +1,35 @@
+2014-05-20  Brent Fulgham  <[email protected]>
+
+        [Mac] DataCues do not work properly when rewinding video
+        https://bugs.webkit.org/show_bug.cgi?id=133138
+        <rdar://problem/16979086>
+
+        Reviewed by Eric Carlson.
+
+        Make the TrackPrivateBase responsible for knowing if a type of track needs a non-zero
+        startTimeVariance value.
+
+        Also, correct a bug in the equality test for DataCue objects.
+
+        * html/track/DataCue.cpp:
+        (WebCore::DataCue::isEqual): Handle the JSValue data types consistently, so that we don't attempt
+        to compare a JSNull against a default JSValue object.
+        * html/track/InbandTextTrack.cpp:
+        (WebCore::InbandTextTrack::startTimeVariance): Added.
+        * html/track/InbandTextTrack.h:
+        * html/track/TextTrack.cpp:
+        (WebCore::TextTrack::hasCue): Use new startTimeVariance method location.
+        * html/track/TextTrack.h:
+        (WebCore::TextTrack::startTimeVariance): Added.
+        * html/track/TextTrackCue.cpp:
+        (WebCore::TextTrackCue::hasEquivalentStartTime): Use new startTimeVariance location.
+        * html/track/TextTrackCue.h:
+        (WebCore::TextTrackCue::startTimeVariance): Deleted.
+        * html/track/TextTrackCueGeneric.h:
+        * platform/graphics/TrackPrivateBase.h:
+        (WebCore::TrackPrivateBase::startTimeVariance): Added.
+        * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.h:
+
 2014-05-20  Mark Hahnenberg  <[email protected]>
 
         Watchdog timer should be lazily allocated

Modified: trunk/Source/WebCore/html/track/DataCue.cpp (169145 => 169146)


--- trunk/Source/WebCore/html/track/DataCue.cpp	2014-05-21 03:49:16 UTC (rev 169145)
+++ trunk/Source/WebCore/html/track/DataCue.cpp	2014-05-21 04:08:33 UTC (rev 169146)
@@ -145,10 +145,11 @@
     if (m_platformValue && !m_platformValue->isEqual(*otherPlatformValue.get()))
         return false;
 
+    JSC::JSValue thisValue = value(nullptr);
     JSC::JSValue otherValue = dataCue->value(nullptr);
-    if ((otherValue && !m_value) || (!otherValue && m_value))
+    if ((otherValue && !thisValue) || (!otherValue && thisValue))
         return false;
-    if (!JSC::JSValue::strictEqual(nullptr, m_value ? m_value : JSC::JSValue(), otherValue))
+    if (!JSC::JSValue::strictEqual(nullptr, thisValue, otherValue))
         return false;
 #endif
 

Modified: trunk/Source/WebCore/html/track/InbandTextTrack.cpp (169145 => 169146)


--- trunk/Source/WebCore/html/track/InbandTextTrack.cpp	2014-05-21 03:49:16 UTC (rev 169145)
+++ trunk/Source/WebCore/html/track/InbandTextTrack.cpp	2014-05-21 04:08:33 UTC (rev 169146)
@@ -213,6 +213,14 @@
     }
 }
 
+double InbandTextTrack::startTimeVariance() const
+{
+    if (!m_private)
+        return false;
+    
+    return m_private->startTimeVariance();
+}
+
 } // namespace WebCore
 
 #endif

Modified: trunk/Source/WebCore/html/track/InbandTextTrack.h (169145 => 169146)


--- trunk/Source/WebCore/html/track/InbandTextTrack.h	2014-05-21 03:49:16 UTC (rev 169145)
+++ trunk/Source/WebCore/html/track/InbandTextTrack.h	2014-05-21 04:08:33 UTC (rev 169146)
@@ -82,6 +82,7 @@
     virtual void removeGenericCue(InbandTextTrackPrivate*, GenericCueData*) override { ASSERT_NOT_REACHED(); }
 
     virtual void parseWebVTTCueData(InbandTextTrackPrivate*, const char*, unsigned) override { ASSERT_NOT_REACHED(); }
+    virtual double startTimeVariance() const;
 
 #if USE(PLATFORM_TEXT_TRACK_MENU)
     virtual InbandTextTrackPrivate* privateTrack() override { return m_private.get(); }

Modified: trunk/Source/WebCore/html/track/TextTrack.cpp (169145 => 169146)


--- trunk/Source/WebCore/html/track/TextTrack.cpp	2014-05-21 03:49:16 UTC (rev 169145)
+++ trunk/Source/WebCore/html/track/TextTrack.cpp	2014-05-21 04:08:33 UTC (rev 169146)
@@ -519,7 +519,7 @@
                     return false;
 
                 existingCue = m_cues->item(searchStart - 1);
-                if (!existingCue || cue->startTime() > (existingCue->startTime() + existingCue->startTimeVariance()))
+                if (!existingCue || cue->startTime() > (existingCue->startTime() + startTimeVariance()))
                     return false;
 
                 if (!existingCue->isEqual(*cue, match))
@@ -531,7 +531,7 @@
         
         size_t index = (searchStart + searchEnd) / 2;
         existingCue = m_cues->item(index);
-        if ((cue->startTime() + existingCue->startTimeVariance()) < existingCue->startTime() || (match != TextTrackCue::IgnoreDuration && cue->hasEquivalentStartTime(*existingCue) && cue->endTime() > existingCue->endTime()))
+        if ((cue->startTime() + startTimeVariance()) < existingCue->startTime() || (match != TextTrackCue::IgnoreDuration && cue->hasEquivalentStartTime(*existingCue) && cue->endTime() > existingCue->endTime()))
             searchEnd = index;
         else
             searchStart = index + 1;

Modified: trunk/Source/WebCore/html/track/TextTrack.h (169145 => 169146)


--- trunk/Source/WebCore/html/track/TextTrack.h	2014-05-21 03:49:16 UTC (rev 169145)
+++ trunk/Source/WebCore/html/track/TextTrack.h	2014-05-21 04:08:33 UTC (rev 169146)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2011 Google Inc. All rights reserved.
- * Copyright (C) 2011, 2012, 2013 Apple Inc.  All rights reserved.
+ * Copyright (C) 2011, 2012, 2013, 2014 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -158,6 +158,8 @@
 
     virtual bool isInband() const { return false; }
 
+    virtual double startTimeVariance() const { return 0; }
+
     using RefCounted<TrackBase>::ref;
     using RefCounted<TrackBase>::deref;
 

Modified: trunk/Source/WebCore/html/track/TextTrackCue.cpp (169145 => 169146)


--- trunk/Source/WebCore/html/track/TextTrackCue.cpp	2014-05-21 03:49:16 UTC (rev 169145)
+++ trunk/Source/WebCore/html/track/TextTrackCue.cpp	2014-05-21 04:08:33 UTC (rev 169146)
@@ -219,7 +219,13 @@
 
 bool TextTrackCue::hasEquivalentStartTime(const TextTrackCue& cue) const
 {
-    return std::abs(std::abs(startTime()) - std::abs(cue.startTime())) < startTimeVariance();
+    double startTimeVariance = 0;
+    if (track())
+        startTimeVariance = track()->startTimeVariance();
+    else if (cue.track())
+        startTimeVariance = cue.track()->startTimeVariance();
+
+    return std::abs(std::abs(startTime()) - std::abs(cue.startTime())) <= startTimeVariance;
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/html/track/TextTrackCue.h (169145 => 169146)


--- trunk/Source/WebCore/html/track/TextTrackCue.h	2014-05-21 03:49:16 UTC (rev 169145)
+++ trunk/Source/WebCore/html/track/TextTrackCue.h	2014-05-21 04:08:33 UTC (rev 169146)
@@ -84,7 +84,6 @@
     virtual bool isOrderedBefore(const TextTrackCue*) const;
 
     bool hasEquivalentStartTime(const TextTrackCue&) const;
-    virtual double startTimeVariance() const { return 0; }
 
     enum CueType {
         Data,

Modified: trunk/Source/WebCore/html/track/TextTrackCueGeneric.h (169145 => 169146)


--- trunk/Source/WebCore/html/track/TextTrackCueGeneric.h	2014-05-21 03:49:16 UTC (rev 169145)
+++ trunk/Source/WebCore/html/track/TextTrackCueGeneric.h	2014-05-21 04:08:33 UTC (rev 169146)
@@ -78,7 +78,6 @@
 
 private:
     virtual bool isOrderedBefore(const TextTrackCue*) const override;
-    virtual double startTimeVariance() const override { return 0.25; }
 
     TextTrackCueGeneric(ScriptExecutionContext&, double start, double end, const String&);
     

Modified: trunk/Source/WebCore/platform/graphics/TrackPrivateBase.h (169145 => 169146)


--- trunk/Source/WebCore/platform/graphics/TrackPrivateBase.h	2014-05-21 03:49:16 UTC (rev 169145)
+++ trunk/Source/WebCore/platform/graphics/TrackPrivateBase.h	2014-05-21 04:08:33 UTC (rev 169146)
@@ -61,6 +61,8 @@
 
     virtual int trackIndex() const { return 0; }
 
+    virtual double startTimeVariance() const { return 0; }
+    
     void willBeRemoved()
     {
         if (TrackPrivateBaseClient* client = this->client())

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.h (169145 => 169146)


--- trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.h	2014-05-21 03:49:16 UTC (rev 169145)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.h	2014-05-21 04:08:33 UTC (rev 169146)
@@ -69,6 +69,8 @@
     };
     virtual Category textTrackCategory() const = 0;
     
+    virtual double startTimeVariance() const override { return 0.25; }
+    
 protected:
     InbandTextTrackPrivateAVF(AVFInbandTrackParent*);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to