Title: [292996] branches/safari-613-branch/Source/WebCore
Revision
292996
Author
alanc...@apple.com
Date
2022-04-18 17:50:05 -0700 (Mon, 18 Apr 2022)

Log Message

Cherry-pick r292585. rdar://problem/90553831

    When using a TrackDisplayUpdateScope queue updateActiveTextTrackCues as a task
    https://bugs.webkit.org/show_bug.cgi?id=238963

    Reviewed by Eric Carlson.

    The HTMLMediaElement::didRemoveTextTrack call is done under ScriptDisallowedScope but this path
    currently can call updateActiveTextTrackCues which could result in updating the layout downstream.
    To resolve this we execute updateActiveTextTrackCues under a queueCancellableTaskKeepingObjectAlive call.

    We also add a needed check in RenderVTTCue::initializeLayoutParameters exposed by queueing the task.

    * html/HTMLMediaElement.cpp:
    (WebCore::HTMLMediaElement::endIgnoringTrackDisplayUpdateRequests):
    (WebCore::HTMLMediaElement::cancelPendingTasks):
    * html/HTMLMediaElement.h:
    * rendering/RenderVTTCue.cpp:
    (WebCore::RenderVTTCue::initializeLayoutParameters):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@292585 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (292995 => 292996)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-04-19 00:50:01 UTC (rev 292995)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-04-19 00:50:05 UTC (rev 292996)
@@ -1,5 +1,50 @@
 2022-04-18  Kocsen Chung  <kocsen_ch...@apple.com>
 
+        Cherry-pick r292585. rdar://problem/90553831
+
+    When using a TrackDisplayUpdateScope queue updateActiveTextTrackCues as a task
+    https://bugs.webkit.org/show_bug.cgi?id=238963
+    
+    Reviewed by Eric Carlson.
+    
+    The HTMLMediaElement::didRemoveTextTrack call is done under ScriptDisallowedScope but this path
+    currently can call updateActiveTextTrackCues which could result in updating the layout downstream.
+    To resolve this we execute updateActiveTextTrackCues under a queueCancellableTaskKeepingObjectAlive call.
+    
+    We also add a needed check in RenderVTTCue::initializeLayoutParameters exposed by queueing the task.
+    
+    * html/HTMLMediaElement.cpp:
+    (WebCore::HTMLMediaElement::endIgnoringTrackDisplayUpdateRequests):
+    (WebCore::HTMLMediaElement::cancelPendingTasks):
+    * html/HTMLMediaElement.h:
+    * rendering/RenderVTTCue.cpp:
+    (WebCore::RenderVTTCue::initializeLayoutParameters):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@292585 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-04-07  Gabriel Nava Marino  <gnavamar...@apple.com>
+
+            When using a TrackDisplayUpdateScope queue updateActiveTextTrackCues as a task
+            https://bugs.webkit.org/show_bug.cgi?id=238963
+
+            Reviewed by Eric Carlson.
+
+            The HTMLMediaElement::didRemoveTextTrack call is done under ScriptDisallowedScope but this path
+            currently can call updateActiveTextTrackCues which could result in updating the layout downstream.
+            To resolve this we execute updateActiveTextTrackCues under a queueCancellableTaskKeepingObjectAlive call.
+
+            We also add a needed check in RenderVTTCue::initializeLayoutParameters exposed by queueing the task.
+
+            * html/HTMLMediaElement.cpp:
+            (WebCore::HTMLMediaElement::endIgnoringTrackDisplayUpdateRequests):
+            (WebCore::HTMLMediaElement::cancelPendingTasks):
+            * html/HTMLMediaElement.h:
+            * rendering/RenderVTTCue.cpp:
+            (WebCore::RenderVTTCue::initializeLayoutParameters):
+
+2022-04-18  Kocsen Chung  <kocsen_ch...@apple.com>
+
         Cherry-pick r292563. rdar://problem/88969850
 
     (Safari 15 - iOS15):  Increased audio latency on streaming via webrtc

Modified: branches/safari-613-branch/Source/WebCore/html/HTMLMediaElement.cpp (292995 => 292996)


--- branches/safari-613-branch/Source/WebCore/html/HTMLMediaElement.cpp	2022-04-19 00:50:01 UTC (rev 292995)
+++ branches/safari-613-branch/Source/WebCore/html/HTMLMediaElement.cpp	2022-04-19 00:50:05 UTC (rev 292996)
@@ -1998,8 +1998,11 @@
 {
     ASSERT(m_ignoreTrackDisplayUpdate);
     --m_ignoreTrackDisplayUpdate;
-    if (!m_ignoreTrackDisplayUpdate && m_inActiveDocument)
-        updateActiveTextTrackCues(currentMediaTime());
+
+    queueCancellableTaskKeepingObjectAlive(*this, TaskSource::MediaElement, m_updateTextTracksTaskCancellationGroup, [this] {
+        if (!m_ignoreTrackDisplayUpdate && m_inActiveDocument)
+            updateActiveTextTrackCues(currentMediaTime());
+    });
 }
 
 void HTMLMediaElement::textTrackAddCues(TextTrack& track, const TextTrackCueList& cues)
@@ -5751,6 +5754,7 @@
 void HTMLMediaElement::cancelPendingTasks()
 {
     m_configureTextTracksTaskCancellationGroup.cancel();
+    m_updateTextTracksTaskCancellationGroup.cancel();
     m_checkPlaybackTargetCompatibilityTaskCancellationGroup.cancel();
     m_updateMediaStateTaskCancellationGroup.cancel();
     m_mediaEngineUpdatedTaskCancellationGroup.cancel();

Modified: branches/safari-613-branch/Source/WebCore/html/HTMLMediaElement.h (292995 => 292996)


--- branches/safari-613-branch/Source/WebCore/html/HTMLMediaElement.h	2022-04-19 00:50:01 UTC (rev 292995)
+++ branches/safari-613-branch/Source/WebCore/html/HTMLMediaElement.h	2022-04-19 00:50:05 UTC (rev 292996)
@@ -977,6 +977,7 @@
     Timer m_playbackControlsManagerBehaviorRestrictionsTimer;
     Timer m_seekToPlaybackPositionEndedTimer;
     TaskCancellationGroup m_configureTextTracksTaskCancellationGroup;
+    TaskCancellationGroup m_updateTextTracksTaskCancellationGroup;
     TaskCancellationGroup m_checkPlaybackTargetCompatibilityTaskCancellationGroup;
     TaskCancellationGroup m_updateMediaStateTaskCancellationGroup;
     TaskCancellationGroup m_mediaEngineUpdatedTaskCancellationGroup;

Modified: branches/safari-613-branch/Source/WebCore/rendering/RenderVTTCue.cpp (292995 => 292996)


--- branches/safari-613-branch/Source/WebCore/rendering/RenderVTTCue.cpp	2022-04-19 00:50:01 UTC (rev 292995)
+++ branches/safari-613-branch/Source/WebCore/rendering/RenderVTTCue.cpp	2022-04-19 00:50:05 UTC (rev 292996)
@@ -79,9 +79,9 @@
 
     RenderBlock* parentBlock = containingBlock();
 
-    firstLineBox = cueBox().firstLineBox();
+    firstLineBox = cueBox().firstLineBox() ? cueBox().firstLineBox() : this->firstRootBox();
     if (!firstLineBox)
-        firstLineBox = this->firstRootBox();
+        return false;
 
     // 1. Horizontal: Let step be the height of the first line box in boxes.
     //    Vertical: Let step be the width of the first line box in boxes.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to