Title: [171758] branches/safari-600.1.4-branch/Source/WebCore

Diff

Modified: branches/safari-600.1.4-branch/Source/WebCore/ChangeLog (171757 => 171758)


--- branches/safari-600.1.4-branch/Source/WebCore/ChangeLog	2014-07-29 20:36:29 UTC (rev 171757)
+++ branches/safari-600.1.4-branch/Source/WebCore/ChangeLog	2014-07-29 20:54:02 UTC (rev 171758)
@@ -1,5 +1,33 @@
 2014-07-29  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r171700. <rdar://problem/17844901>
+
+    2014-07-27  Brent Fulgham  <bfulg...@apple.com>
+    
+            [Mac, iOS] Paint-on closed captions get out-of-order in Safari
+            https://bugs.webkit.org/show_bug.cgi?id=135332
+            <rdar://problem/15317278>
+    
+            Reviewed by Brent Fulgham.
+    
+            * html/shadow/MediaControlElements.cpp:
+            (WebCore::MediaControlTextTrackContainerElement::updateDisplay): If the
+            number of active cues is greater than the current set of CSS boxes representing
+            the cues, throw away the CSS boxes and re-layout all the cues.
+            * html/track/InbandGenericTextTrack.cpp:
+            (WebCore::InbandGenericTextTrack::addGenericCue): Add some logging.
+            (WebCore::InbandGenericTextTrack::removeGenericCue): Ditto.
+            * html/track/TextTrackCueGeneric.cpp:
+            (WebCore::TextTrackCueGeneric::isOrderedBefore): Revise ordering rules so that we put
+            newer cues earlier in the layout order so they are drawn towards the bottom
+            of the screen. Only do this for Generic captions.
+            * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
+            (WebCore::InbandTextTrackPrivateAVF::processAttributedStrings): Adjust logging
+            messages.
+            (WebCore::InbandTextTrackPrivateAVF::removeCompletedCues): Add logging.
+    
+2014-07-29  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r171675. <rdar://problem/17826572>
 
     2014-07-28  Yusuke Suzuki  <utatane....@gmail.com>

Modified: branches/safari-600.1.4-branch/Source/WebCore/html/shadow/MediaControlElements.cpp (171757 => 171758)


--- branches/safari-600.1.4-branch/Source/WebCore/html/shadow/MediaControlElements.cpp	2014-07-29 20:36:29 UTC (rev 171757)
+++ branches/safari-600.1.4-branch/Source/WebCore/html/shadow/MediaControlElements.cpp	2014-07-29 20:54:02 UTC (rev 171758)
@@ -42,6 +42,7 @@
 #include "ImageBuffer.h"
 #include "Language.h"
 #include "LocalizedStrings.h"
+#include "Logging.h"
 #include "MediaControls.h"
 #include "PageGroup.h"
 #include "RenderLayer.h"
@@ -1303,6 +1304,13 @@
     // within the TextTrackCue instance itself. If parameters of the cue change,
     // the display tree is cleared.
 
+    // If the number of CSS boxes in the output is less than the number of cues
+    // we wish to render (e.g., we are adding another cue in a set of roll-up
+    // cues), remove all the existing CSS boxes representing the cues and re-add
+    // them so that the new cue is at the bottom.
+    if (childNodeCount() < activeCues.size())
+        removeChildren();
+    
     // 10. For each text track cue cue in cues that has not yet had
     // corresponding CSS boxes added to output, in text track cue order, run the
     // following substeps:
@@ -1320,6 +1328,8 @@
         if (!cue->track() || !cue->track()->isRendered() || !cue->isActive() || cue->text().isEmpty())
             continue;
 
+        LOG(Media, "MediaControlTextTrackContainerElement::updateDisplay(%p) - adding and positioning cue #%zu: \"%s\", start=%.2f, end=%.2f, line=%.2f", this, i, cue->text().utf8().data(), cue->startTime(), cue->endTime(), cue->line());
+
         RefPtr<VTTCueBox> displayBox = cue->getDisplayTree(m_videoDisplaySize.size());
 #if ENABLE(WEBVTT_REGIONS)
         if (cue->track()->mode() == TextTrack::disabledKeyword())

Modified: branches/safari-600.1.4-branch/Source/WebCore/html/track/InbandGenericTextTrack.cpp (171757 => 171758)


--- branches/safari-600.1.4-branch/Source/WebCore/html/track/InbandGenericTextTrack.cpp	2014-07-29 20:36:29 UTC (rev 171757)
+++ branches/safari-600.1.4-branch/Source/WebCore/html/track/InbandGenericTextTrack.cpp	2014-07-29 20:54:02 UTC (rev 171758)
@@ -160,6 +160,8 @@
         return;
     }
 
+    LOG(Media, "InbandGenericTextTrack::addGenericCue added cue: start=%.2f, end=%.2f, content=\"%s\"\n", cueData->startTime(), cueData->endTime(), cueData->content().utf8().data());
+
     if (cueData->status() != GenericCueData::Complete)
         m_cueMap.add(cueData.get(), cue.get());
 
@@ -184,8 +186,10 @@
     if (cue) {
         LOG(Media, "InbandGenericTextTrack::removeGenericCue removing cue: start=%.2f, end=%.2f, content=\"%s\"\n", cueData->startTime(), cueData->endTime(), cueData->content().utf8().data());
         removeCue(cue.get(), IGNORE_EXCEPTION);
-    } else
+    } else {
+        LOG(Media, "InbandGenericTextTrack::removeGenericCue UNABLE to find cue: start=%.2f, end=%.2f, content=\"%s\"\n", cueData->startTime(), cueData->endTime(), cueData->content().utf8().data());
         m_cueMap.remove(cueData);
+    }
 }
 
 void InbandGenericTextTrack::removeCue(TextTrackCue* cue, ExceptionCode& ec)

Modified: branches/safari-600.1.4-branch/Source/WebCore/html/track/TextTrackCueGeneric.cpp (171757 => 171758)


--- branches/safari-600.1.4-branch/Source/WebCore/html/track/TextTrackCueGeneric.cpp	2014-07-29 20:36:29 UTC (rev 171757)
+++ branches/safari-600.1.4-branch/Source/WebCore/html/track/TextTrackCueGeneric.cpp	2014-07-29 20:54:02 UTC (rev 171758)
@@ -202,9 +202,6 @@
 
 bool TextTrackCueGeneric::isOrderedBefore(const TextTrackCue* that) const
 {
-    if (VTTCue::isOrderedBefore(that))
-        return true;
-
     if (that->cueType() == Generic && startTime() == that->startTime() && endTime() == that->endTime()) {
         // Further order generic cues by their calculated line value.
         std::pair<double, double> thisPosition = getPositionCoordinates();
@@ -212,7 +209,10 @@
         return thisPosition.second > thatPosition.second || (thisPosition.second == thatPosition.second && thisPosition.first < thatPosition.first);
     }
 
-    return false;
+    if (that->cueType() == Generic)
+        return startTime() > that->startTime();
+    
+    return VTTCue::isOrderedBefore(that);
 }
     
 } // namespace WebCore

Modified: branches/safari-600.1.4-branch/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp (171757 => 171758)


--- branches/safari-600.1.4-branch/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp	2014-07-29 20:36:29 UTC (rev 171757)
+++ branches/safari-600.1.4-branch/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp	2014-07-29 20:54:02 UTC (rev 171758)
@@ -435,7 +435,7 @@
                     if (!arrivingCue->doesExtendCueData(*cueData))
                         nonExtensionCues.append(arrivingCue);
                     else
-                        LOG(Media, "InbandTextTrackPrivateAVF::processCue(%p) - found an extension cue (\"%s\") for time = %.2f, position =  %.2f, line =  %.2f", this, arrivingCue->content().utf8().data(), arrivingCue->startTime(), arrivingCue->position(), arrivingCue->line());
+                        LOG(Media, "InbandTextTrackPrivateAVF::processCue(%p) - found an extension cue (\"%s\") for time = %.2f, end = %.2f, position =  %.2f, line =  %.2f", this, arrivingCue->content().utf8().data(), arrivingCue->startTime(), arrivingCue->endTime(), arrivingCue->position(), arrivingCue->line());
                 }
 
                 bool currentCueIsExtended = (arrivingCues.size() != nonExtensionCues.size());
@@ -449,7 +449,7 @@
                     cueData->setEndTime(m_currentCueEndTime);
                     cueData->setStatus(GenericCueData::Complete);
 
-                    LOG(Media, "InbandTextTrackPrivateAVF::processCue(%p) - updating cue: start=%.2f, end=%.2f, content=\"%s\"", this, cueData->startTime(), m_currentCueEndTime, cueData->content().utf8().data());
+                    LOG(Media, "InbandTextTrackPrivateAVF::processCue(%p) - updating cue \"%s\": start=%.2f, end=%.2f", this, cueData->content().utf8().data(), cueData->startTime(), m_currentCueEndTime);
                     client()->updateGenericCue(this, cueData.get());
                 } else {
                     // We have to assume that the implicit duration is invalid for cues delivered during a seek because the AVF decode pipeline may not
@@ -472,7 +472,7 @@
 
         m_cues.append(cueData);
         
-        LOG(Media, "InbandTextTrackPrivateAVF::processCue(%p) - adding cue for time = %.2f, position =  %.2f, line =  %.2f", this, cueData->startTime(), cueData->position(), cueData->line());
+        LOG(Media, "InbandTextTrackPrivateAVF::processCue(%p) - adding cue \"%s\" for time = %.2f, end = %.2f, position =  %.2f, line =  %.2f", this, cueData->content().utf8().data(), cueData->startTime(), cueData->endTime(), cueData->position(), cueData->line());
 
         client()->addGenericCue(this, cueData.release());
     }
@@ -503,6 +503,8 @@
             if (m_cues[currentCue]->status() != GenericCueData::Complete)
                 continue;
 
+            LOG(Media, "InbandTextTrackPrivateAVF::removeCompletedCues(%p) - removing cue \"%s\": start=%.2f, end=%.2f", this, m_cues[currentCue]->content().utf8().data(), m_cues[currentCue]->startTime(), m_cues[currentCue]->endTime());
+
             m_cues.remove(currentCue);
         }
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to