Changeset 258434 in webkit
- Timestamp:
- Mar 13, 2020 2:49:31 PM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r258424 r258434 1 2020-03-13 Peng Liu <peng.liu6@apple.com> 2 3 Safari sometimes crashes when switch video into PiP mode 4 https://bugs.webkit.org/show_bug.cgi?id=208904 5 6 Reviewed by Simon Fraser. 7 8 With this patch, MediaControlTextTrackContainerElement won't paint its subtree 9 to an image buffer (for the captions in video fullscreen or picture-in-picture mode) 10 when the cues are updated. Instead, it only sets the flag m_needsGenerateTextTrackRepresentation 11 to true after running layout based on the new cues. After that, it paints its subtree 12 to an image buffer if needed at the end of Page::updateRendering() when the layout is clean. 13 TextTrackRepresentationCocoa will use the image buffer to set the content of the layer 14 for captions in video fullscreen or picture-in-picture mode. 15 16 MediaControlTextTrackContainerElement class is responsible for rendering the captions in both: 17 1) a video player in the inline mode. 18 2) a video player in "video fullscreen" or picture-in-picture mode. 19 This patch refactors some functions to make their responsibilities clear. 20 21 * Modules/mediacontrols/MediaControlsHost.cpp: 22 (WebCore::MediaControlsHost::updateTextTrackRepresentationImageIfNeeded): 23 * Modules/mediacontrols/MediaControlsHost.h: 24 * dom/Document.cpp: 25 (WebCore::Document::setMediaElementShowingTextTrack): 26 (WebCore::Document::clearMediaElementShowingTextTrack): 27 (WebCore::Document::updateTextTrackRepresentationImageIfNeeded): 28 * dom/Document.h: 29 30 Functions textTracksAreReady(), textTrackReadyStateChanged() and configureTextTrackDisplay() 31 should be wrapped with "#if ENABLE(VIDEO_TRACK)". 32 * html/HTMLMediaElement.cpp: 33 (WebCore::HTMLMediaElement::setTextTrackRepresentation): 34 (WebCore::HTMLMediaElement::textTracksAreReady const): 35 (WebCore::HTMLMediaElement::textTrackReadyStateChanged): 36 (WebCore::HTMLMediaElement::configureTextTrackDisplay): 37 (WebCore::HTMLMediaElement::updateTextTrackRepresentationImageIfNeeded): 38 * html/HTMLMediaElement.h: 39 40 * html/shadow/MediaControlElements.cpp: 41 (WebCore::MediaControlTextTrackContainerElement::createElementRenderer): 42 (WebCore::MediaControlTextTrackContainerElement::updateDisplay): 43 (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentationImageIfNeeded): 44 (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentationIfNeeded): 45 (WebCore::MediaControlTextTrackContainerElement::clearTextTrackRepresentation): 46 (WebCore::MediaControlTextTrackContainerElement::updateTextTrackStyle): 47 (WebCore::MediaControlTextTrackContainerElement::enteredFullscreen): 48 (WebCore::MediaControlTextTrackContainerElement::updateVideoDisplaySize): 49 (WebCore::MediaControlTextTrackContainerElement::updateSizes): 50 (WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage): 51 (WebCore::MediaControlTextTrackContainerElement::textTrackRepresentationBoundsChanged): 52 (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentation): Deleted. 53 (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentationStyle): Deleted. 54 (WebCore::MediaControlTextTrackContainerElement::layoutIfNecessary): Deleted. 55 (WebCore::MediaControlTextTrackContainerElement::updateCueStyles): Deleted. 56 * html/shadow/MediaControlElements.h: 57 * html/shadow/MediaControls.cpp: 58 (WebCore::MediaControls::updateTextTrackRepresentationImageIfNeeded): 59 * html/shadow/MediaControls.h: 60 * page/Page.cpp: 61 (WebCore::Page::updateRendering): 62 * rendering/RenderMediaControlElements.cpp: 63 (WebCore::RenderMediaControlTextTrackContainer::RenderMediaControlTextTrackContainer): 64 (WebCore::RenderMediaControlTextTrackContainer::layout): 65 (WebCore::RenderTextTrackContainerElement::RenderTextTrackContainerElement): Deleted. 66 (WebCore::RenderTextTrackContainerElement::layout): Deleted. 67 * rendering/RenderMediaControlElements.h: 68 1 69 2020-03-13 Ryan Haddad <ryanhaddad@apple.com> 2 70 -
trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp
r257997 r258434 173 173 } 174 174 175 void MediaControlsHost::updateTextTrackRepresentationImageIfNeeded() 176 { 177 if (m_textTrackContainer) 178 m_textTrackContainer->updateTextTrackRepresentationImageIfNeeded(); 179 } 180 175 181 void MediaControlsHost::enteredFullscreen() 176 182 { -
trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h
r258248 r258434 74 74 enum class ForceUpdate { Yes, No }; 75 75 void updateCaptionDisplaySizes(ForceUpdate = ForceUpdate::No); 76 void updateTextTrackRepresentationImageIfNeeded(); 76 77 void enteredFullscreen(); 77 78 void exitedFullscreen(); -
trunk/Source/WebCore/dom/Document.cpp
r258268 r258434 5452 5452 } 5453 5453 5454 void Document::setMediaElementShowingTextTrack(const HTMLMediaElement& element) 5455 { 5456 m_mediaElementShowingTextTrack = makeWeakPtr(element); 5457 } 5458 5459 void Document::clearMediaElementShowingTextTrack() 5460 { 5461 m_mediaElementShowingTextTrack = nullptr; 5462 } 5463 5464 void Document::updateTextTrackRepresentationImageIfNeeded() 5465 { 5466 if (m_mediaElementShowingTextTrack) 5467 m_mediaElementShowingTextTrack->updateTextTrackRepresentationImageIfNeeded(); 5468 } 5469 5454 5470 #endif 5455 5471 -
trunk/Source/WebCore/dom/Document.h
r258214 r258434 1116 1116 void unregisterForCaptionPreferencesChangedCallbacks(HTMLMediaElement&); 1117 1117 void captionPreferencesChanged(); 1118 void setMediaElementShowingTextTrack(const HTMLMediaElement&); 1119 void clearMediaElementShowingTextTrack(); 1120 void updateTextTrackRepresentationImageIfNeeded(); 1118 1121 #endif 1119 1122 … … 1802 1805 #if ENABLE(VIDEO_TRACK) 1803 1806 HashSet<HTMLMediaElement*> m_captionPreferencesChangedElements; 1807 WeakPtr<HTMLMediaElement> m_mediaElementShowingTextTrack; 1804 1808 #endif 1805 1809 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r258295 r258434 1877 1877 } 1878 1878 1879 bool HTMLMediaElement::textTracksAreReady() const1880 {1881 // 4.8.10.12.1 Text track model1882 // ...1883 // The text tracks of a media element are ready if all the text tracks whose mode was not1884 // in the disabled state when the element's resource selection algorithm last started now1885 // have a text track readiness state of loaded or failed to load.1886 for (unsigned i = 0; i < m_textTracksWhenResourceSelectionBegan.size(); ++i) {1887 if (m_textTracksWhenResourceSelectionBegan[i]->readinessState() == TextTrack::Loading1888 || m_textTracksWhenResourceSelectionBegan[i]->readinessState() == TextTrack::NotLoaded)1889 return false;1890 }1891 1892 return true;1893 }1894 1895 void HTMLMediaElement::textTrackReadyStateChanged(TextTrack* track)1896 {1897 if (track->readinessState() != TextTrack::Loading1898 && track->mode() != TextTrack::Mode::Disabled) {1899 // The display trees exist as long as the track is active, in this case,1900 // and if the same track is loaded again (for example if the src attribute was changed),1901 // cues can be accumulated with the old ones, that's why they needs to be flushed1902 if (hasMediaControls())1903 mediaControls()->clearTextDisplayContainer();1904 updateTextTrackDisplay();1905 }1906 if (m_player && m_textTracksWhenResourceSelectionBegan.contains(track)) {1907 if (track->readinessState() != TextTrack::Loading)1908 setReadyState(m_player->readyState());1909 } else {1910 // The track readiness state might have changed as a result of the user1911 // clicking the captions button. In this case, a check whether all the1912 // resources have failed loading should be done in order to hide the CC button.1913 if (hasMediaControls() && track->readinessState() == TextTrack::FailedToLoad)1914 mediaControls()->refreshClosedCaptionsButtonVisibility();1915 }1916 }1917 1918 1879 void HTMLMediaElement::audioTrackEnabledChanged(AudioTrack& track) 1919 1880 { … … 5852 5813 if (m_player) 5853 5814 m_player->setTextTrackRepresentation(representation); 5815 5816 if (representation) 5817 document().setMediaElementShowingTextTrack(*this); 5818 else 5819 document().clearMediaElementShowingTextTrack(); 5854 5820 } 5855 5821 … … 6346 6312 #if ENABLE(VIDEO_TRACK) 6347 6313 6314 bool HTMLMediaElement::textTracksAreReady() const 6315 { 6316 // 4.8.10.12.1 Text track model 6317 // ... 6318 // The text tracks of a media element are ready if all the text tracks whose mode was not 6319 // in the disabled state when the element's resource selection algorithm last started now 6320 // have a text track readiness state of loaded or failed to load. 6321 for (unsigned i = 0; i < m_textTracksWhenResourceSelectionBegan.size(); ++i) { 6322 if (m_textTracksWhenResourceSelectionBegan[i]->readinessState() == TextTrack::Loading 6323 || m_textTracksWhenResourceSelectionBegan[i]->readinessState() == TextTrack::NotLoaded) 6324 return false; 6325 } 6326 6327 return true; 6328 } 6329 6330 void HTMLMediaElement::textTrackReadyStateChanged(TextTrack* track) 6331 { 6332 if (track->readinessState() != TextTrack::Loading 6333 && track->mode() != TextTrack::Mode::Disabled) { 6334 // The display trees exist as long as the track is active, in this case, 6335 // and if the same track is loaded again (for example if the src attribute was changed), 6336 // cues can be accumulated with the old ones, that's why they needs to be flushed 6337 if (hasMediaControls()) 6338 mediaControls()->clearTextDisplayContainer(); 6339 updateTextTrackDisplay(); 6340 } 6341 if (m_player && m_textTracksWhenResourceSelectionBegan.contains(track)) { 6342 if (track->readinessState() != TextTrack::Loading) 6343 setReadyState(m_player->readyState()); 6344 } else { 6345 // The track readiness state might have changed as a result of the user 6346 // clicking the captions button. In this case, a check whether all the 6347 // resources have failed loading should be done in order to hide the CC button. 6348 if (hasMediaControls() && track->readinessState() == TextTrack::FailedToLoad) 6349 mediaControls()->refreshClosedCaptionsButtonVisibility(); 6350 } 6351 } 6352 6353 void HTMLMediaElement::configureTextTrackDisplay(TextTrackVisibilityCheckType checkType) 6354 { 6355 ALWAYS_LOG(LOGIDENTIFIER, checkType); 6356 ASSERT(m_textTracks); 6357 6358 if (m_processingPreferenceChange) 6359 return; 6360 6361 if (document().activeDOMObjectsAreStopped()) 6362 return; 6363 6364 bool haveVisibleTextTrack = false; 6365 for (unsigned i = 0; i < m_textTracks->length(); ++i) { 6366 if (m_textTracks->item(i)->mode() == TextTrack::Mode::Showing) { 6367 haveVisibleTextTrack = true; 6368 break; 6369 } 6370 } 6371 6372 if (checkType == CheckTextTrackVisibility && m_haveVisibleTextTrack == haveVisibleTextTrack) { 6373 updateActiveTextTrackCues(currentMediaTime()); 6374 return; 6375 } 6376 6377 m_haveVisibleTextTrack = haveVisibleTextTrack; 6378 m_closedCaptionsVisible = m_haveVisibleTextTrack; 6379 6380 #if ENABLE(MEDIA_CONTROLS_SCRIPT) 6381 if (!m_haveVisibleTextTrack) 6382 return; 6383 6384 ensureMediaControlsShadowRoot(); 6385 updateTextTrackDisplay(); 6386 #else 6387 if (!m_haveVisibleTextTrack && !hasMediaControls() && !createMediaControls()) 6388 return; 6389 6390 mediaControls()->changedClosedCaptionsVisibility(); 6391 6392 updateTextTrackDisplay(); 6393 updateActiveTextTrackCues(currentMediaTime()); 6394 #endif 6395 } 6396 6348 6397 void HTMLMediaElement::updateTextTrackDisplay() 6349 6398 { … … 6361 6410 } 6362 6411 6412 void HTMLMediaElement::updateTextTrackRepresentationImageIfNeeded() 6413 { 6414 #if ENABLE(MEDIA_CONTROLS_SCRIPT) 6415 ensureMediaControlsShadowRoot(); 6416 if (!m_mediaControlsHost) 6417 m_mediaControlsHost = MediaControlsHost::create(*this); 6418 m_mediaControlsHost->updateTextTrackRepresentationImageIfNeeded(); 6419 #else 6420 if (!hasMediaControls() && !createMediaControls()) 6421 return; 6422 6423 mediaControls()->updateTextTrackRepresentationImageIfNeeded(); 6424 #endif 6425 } 6426 6363 6427 #endif 6364 6428 … … 6601 6665 6602 6666 #if ENABLE(VIDEO_TRACK) 6603 void HTMLMediaElement::configureTextTrackDisplay(TextTrackVisibilityCheckType checkType)6604 {6605 ALWAYS_LOG(LOGIDENTIFIER, checkType);6606 ASSERT(m_textTracks);6607 6608 if (m_processingPreferenceChange)6609 return;6610 6611 if (document().activeDOMObjectsAreStopped())6612 return;6613 6614 bool haveVisibleTextTrack = false;6615 for (unsigned i = 0; i < m_textTracks->length(); ++i) {6616 if (m_textTracks->item(i)->mode() == TextTrack::Mode::Showing) {6617 haveVisibleTextTrack = true;6618 break;6619 }6620 }6621 6622 if (checkType == CheckTextTrackVisibility && m_haveVisibleTextTrack == haveVisibleTextTrack) {6623 updateActiveTextTrackCues(currentMediaTime());6624 return;6625 }6626 6627 m_haveVisibleTextTrack = haveVisibleTextTrack;6628 m_closedCaptionsVisible = m_haveVisibleTextTrack;6629 6630 #if ENABLE(MEDIA_CONTROLS_SCRIPT)6631 if (!m_haveVisibleTextTrack)6632 return;6633 6634 ensureMediaControlsShadowRoot();6635 updateTextTrackDisplay();6636 #else6637 if (!m_haveVisibleTextTrack && !hasMediaControls())6638 return;6639 if (!hasMediaControls() && !createMediaControls())6640 return;6641 6642 mediaControls()->changedClosedCaptionsVisibility();6643 6644 updateTextTrackDisplay();6645 updateActiveTextTrackCues(currentMediaTime());6646 #endif6647 }6648 6667 6649 6668 void HTMLMediaElement::captionPreferencesChanged() -
trunk/Source/WebCore/html/HTMLMediaElement.h
r258295 r258434 380 380 void setSelectedTextTrack(TextTrack*); 381 381 382 bool textTracksAreReady() const;383 using HTMLMediaElementEnums::TextTrackVisibilityCheckType;384 void configureTextTrackDisplay(TextTrackVisibilityCheckType checkType = CheckTextTrackVisibility);385 void updateTextTrackDisplay();386 387 382 // AudioTrackClient 388 383 void audioTrackEnabledChanged(AudioTrack&) final; 389 390 void textTrackReadyStateChanged(TextTrack*);391 384 392 385 // TextTrackClient … … 406 399 407 400 void captionPreferencesChanged(); 401 using HTMLMediaElementEnums::TextTrackVisibilityCheckType; 402 void textTrackReadyStateChanged(TextTrack*); 403 void updateTextTrackRepresentationImageIfNeeded(); 408 404 #endif 409 405 … … 812 808 void markCaptionAndSubtitleTracksAsUnconfigured(ReconfigureMode); 813 809 CaptionUserPreferences::CaptionDisplayMode captionDisplayMode(); 810 811 bool textTracksAreReady() const; 812 void configureTextTrackDisplay(TextTrackVisibilityCheckType = CheckTextTrackVisibility); 813 void updateTextTrackDisplay(); 814 814 #endif 815 815 -
trunk/Source/WebCore/html/shadow/MediaControlElements.cpp
r257997 r258434 1107 1107 RenderPtr<RenderElement> MediaControlTextTrackContainerElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) 1108 1108 { 1109 return createRenderer<Render TextTrackContainerElement>(*this, WTFMove(style));1109 return createRenderer<RenderMediaControlTextTrackContainer>(*this, WTFMove(style)); 1110 1110 } 1111 1111 … … 1185 1185 1186 1186 if (mediaController()->closedCaptionsVisible()) { 1187 // 10. For each text track cue cuein cues that has not yet had1187 // 10. For each text track cue in cues that has not yet had 1188 1188 // corresponding CSS boxes added to output, in text track cue order, run the 1189 1189 // following substeps: … … 1207 1207 hide(); 1208 1208 1209 if (m_textTrackRepresentation || video.requiresTextTrackRepresentation()) 1210 updateTextTrackRepresentation(); 1209 updateTextTrackRepresentationIfNeeded(); 1210 updateTextTrackStyle(); 1211 m_needsGenerateTextTrackRepresentation = true; 1212 } 1213 1214 void MediaControlTextTrackContainerElement::updateTextTrackRepresentationImageIfNeeded() 1215 { 1216 if (!m_needsGenerateTextTrackRepresentation) 1217 return; 1218 1219 m_needsGenerateTextTrackRepresentation = false; 1220 1221 // We should call m_textTrackRepresentation->update() to paint the subtree of 1222 // the RenderTextTrackContainerElement after the layout is clean. 1223 if (m_textTrackRepresentation) 1224 m_textTrackRepresentation->update(); 1211 1225 } 1212 1226 … … 1288 1302 } 1289 1303 1290 void MediaControlTextTrackContainerElement::updateTextTrackRepresentation ()1304 void MediaControlTextTrackContainerElement::updateTextTrackRepresentationIfNeeded() 1291 1305 { 1292 1306 auto mediaElement = parentMediaElement(this); … … 1297 1311 if (!hasChildNodes() || !requiresTextTrackRepresentation) { 1298 1312 if (m_textTrackRepresentation) { 1299 if (!requiresTextTrackRepresentation) {1313 if (!requiresTextTrackRepresentation) 1300 1314 clearTextTrackRepresentation(); 1301 updateSizes(ForceUpdate::Yes); 1302 } else 1315 else 1303 1316 m_textTrackRepresentation->setHidden(true); 1304 1317 } … … 1309 1322 ALWAYS_LOG(LOGIDENTIFIER); 1310 1323 1311 m_waitingForFirstLayout = true;1312 1324 m_textTrackRepresentation = TextTrackRepresentation::create(*this); 1313 1325 if (document().page()) 1314 1326 m_textTrackRepresentation->setContentScale(document().page()->deviceScaleFactor()); 1315 1327 mediaElement->setTextTrackRepresentation(m_textTrackRepresentation.get()); 1316 updateSizes();1317 updateTextTrackRepresentationStyle();1318 1328 } 1319 1329 1320 1330 m_textTrackRepresentation->setHidden(false); 1321 if (!m_waitingForFirstLayout)1322 m_textTrackRepresentation->update();1323 1331 } 1324 1332 … … 1330 1338 ALWAYS_LOG(LOGIDENTIFIER); 1331 1339 1332 m_waitingForFirstLayout = true;1333 1340 m_textTrackRepresentation = nullptr; 1334 1341 if (auto mediaElement = parentMediaElement(this)) 1335 1342 mediaElement->setTextTrackRepresentation(nullptr); 1336 updateTextTrackRepresentationStyle(); 1337 updateActiveCuesFontSize(); 1338 } 1339 1340 void MediaControlTextTrackContainerElement::updateTextTrackRepresentationStyle() 1343 } 1344 1345 void MediaControlTextTrackContainerElement::updateTextTrackStyle() 1341 1346 { 1342 1347 if (m_textTrackRepresentation) { 1348 setInlineStyleProperty(CSSPropertyPosition, CSSValueAbsolute); 1343 1349 setInlineStyleProperty(CSSPropertyWidth, m_videoDisplaySize.size().width(), CSSUnitType::CSS_PX); 1344 1350 setInlineStyleProperty(CSSPropertyHeight, m_videoDisplaySize.size().height(), CSSUnitType::CSS_PX); 1345 setInlineStyleProperty(CSSPropertyPosition, CSSValueAbsolute);1346 1351 setInlineStyleProperty(CSSPropertyLeft, 0, CSSUnitType::CSS_PX); 1347 1352 setInlineStyleProperty(CSSPropertyTop, 0, CSSUnitType::CSS_PX); … … 1358 1363 void MediaControlTextTrackContainerElement::enteredFullscreen() 1359 1364 { 1360 if (hasChildNodes()) 1361 updateTextTrackRepresentation(); 1365 updateTextTrackRepresentationIfNeeded(); 1362 1366 updateSizes(ForceUpdate::Yes); 1363 1367 } … … 1367 1371 clearTextTrackRepresentation(); 1368 1372 updateSizes(ForceUpdate::Yes); 1369 }1370 1371 void MediaControlTextTrackContainerElement::layoutIfNecessary()1372 {1373 m_waitingForFirstLayout = false;1374 1375 auto sizeChanged = updateVideoDisplaySize();1376 if (m_textTrackRepresentation)1377 m_textTrackRepresentation->update();1378 1379 if (!sizeChanged)1380 return;1381 1382 // FIXME (121170): This function is called during layout, and should lay out the text tracks immediately.1383 m_taskQueue.enqueueTask([this] () {1384 updateCueStyles();1385 });1386 1373 } 1387 1374 … … 1411 1398 1412 1399 m_videoDisplaySize = videoBox; 1413 updateTextTrackRepresentationStyle();1414 1415 1400 return true; 1416 1401 } … … 1418 1403 void MediaControlTextTrackContainerElement::updateSizes(ForceUpdate force) 1419 1404 { 1420 if (updateVideoDisplaySize() || force == ForceUpdate::Yes) 1421 updateCueStyles(); 1422 } 1423 1424 void MediaControlTextTrackContainerElement::updateCueStyles() 1425 { 1405 if (!updateVideoDisplaySize() && force != ForceUpdate::Yes) 1406 return; 1407 1426 1408 if (!document().page()) 1427 1409 return; … … 1433 1415 mediaElement->syncTextTrackBounds(); 1434 1416 1417 updateActiveCuesFontSize(); 1418 updateTextStrokeStyle(); 1435 1419 for (auto& activeCue : mediaElement->currentlyActiveCues()) 1436 1420 activeCue.data()->recalculateStyles(); 1437 1421 1438 updateActiveCuesFontSize();1439 updateDisplay();1440 updateTextStrokeStyle();1422 m_taskQueue.enqueueTask([this] () { 1423 updateDisplay(); 1424 }); 1441 1425 } 1442 1426 … … 1472 1456 return nullptr; 1473 1457 1474 layer->paint(buffer->context(), paintingRect, LayoutSize(), { PaintBehavior::FlattenCompositingLayers, PaintBehavior::Snapshotting }, nullptr, RenderLayer::paintLayerPaintingCompositingAllPhasesFlags()); 1458 auto paintFlags = RenderLayer::paintLayerPaintingCompositingAllPhasesFlags(); 1459 paintFlags.add(RenderLayer::PaintLayerTemporaryClipRects); 1460 layer->paint(buffer->context(), paintingRect, LayoutSize(), { PaintBehavior::FlattenCompositingLayers, PaintBehavior::Snapshotting }, nullptr, paintFlags); 1475 1461 1476 1462 return ImageBuffer::sinkIntoImage(WTFMove(buffer)); … … 1479 1465 void MediaControlTextTrackContainerElement::textTrackRepresentationBoundsChanged(const IntRect&) 1480 1466 { 1481 if (hasChildNodes()) 1482 updateTextTrackRepresentation(); 1467 updateTextTrackRepresentationIfNeeded(); 1483 1468 updateSizes(); 1484 1469 } -
trunk/Source/WebCore/html/shadow/MediaControlElements.h
r256060 r258434 484 484 enum class ForceUpdate { Yes, No }; 485 485 void updateSizes(ForceUpdate force = ForceUpdate::No); 486 void layoutIfNecessary();487 488 486 void updateDisplay(); 487 488 void updateTextTrackRepresentationImageIfNeeded(); 489 489 490 void enteredFullscreen(); 490 491 void exitedFullscreen(); … … 493 494 explicit MediaControlTextTrackContainerElement(Document&); 494 495 496 // Element 497 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; 498 499 // TextTrackRepresentationClient 500 RefPtr<Image> createTextTrackRepresentationImage() override; 501 void textTrackRepresentationBoundsChanged(const IntRect&) override; 502 503 void updateTextTrackRepresentationIfNeeded(); 504 void clearTextTrackRepresentation(); 505 495 506 bool updateVideoDisplaySize(); 496 void updateCueStyles();497 507 void updateActiveCuesFontSize(); 498 508 void updateTextStrokeStyle(); 499 509 void processActiveVTTCue(VTTCue&); 500 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; 501 502 RefPtr<Image> createTextTrackRepresentationImage() override; 503 void textTrackRepresentationBoundsChanged(const IntRect&) override; 504 void updateTextTrackRepresentation(); 505 void clearTextTrackRepresentation(); 506 void updateTextTrackRepresentationStyle(); 510 void updateTextTrackStyle(); 507 511 508 512 #if !RELEASE_LOG_DISABLED … … 521 525 int m_fontSize { 0 }; 522 526 bool m_fontSizeIsImportant { false }; 523 bool m_ waitingForFirstLayout { true };527 bool m_needsGenerateTextTrackRepresentation { false }; 524 528 }; 525 529 -
trunk/Source/WebCore/html/shadow/MediaControls.cpp
r251950 r258434 406 406 m_textDisplayContainer->updateDisplay(); 407 407 } 408 408 409 409 void MediaControls::textTrackPreferencesChanged() 410 410 { … … 420 420 } 421 421 422 void MediaControls::updateTextTrackRepresentationImageIfNeeded() 423 { 424 if (m_textDisplayContainer) 425 m_textDisplayContainer->updateTextTrackRepresentationImageIfNeeded(); 426 } 427 422 428 #endif 423 429 -
trunk/Source/WebCore/html/shadow/MediaControls.h
r257296 r258434 99 99 virtual void textTrackPreferencesChanged(); 100 100 virtual void clearTextDisplayContainer(); 101 virtual void updateTextTrackRepresentationImageIfNeeded(); 101 102 #endif 102 103 -
trunk/Source/WebCore/page/Page.cpp
r258339 r258434 1356 1356 1357 1357 layoutIfNeeded(); 1358 1358 1359 1359 forEachDocument([] (Document& document) { 1360 1360 document.updateHighlightPositions(); 1361 1361 }); 1362 1363 #if ENABLE(VIDEO_TRACK) 1364 forEachDocument([] (Document& document) { 1365 document.updateTextTrackRepresentationImageIfNeeded(); 1366 }); 1367 #endif 1362 1368 } 1363 1369 -
trunk/Source/WebCore/rendering/RenderMediaControlElements.cpp
r256060 r258434 42 42 WTF_MAKE_ISO_ALLOCATED_IMPL(RenderMediaControlTimelineContainer); 43 43 #if ENABLE(VIDEO_TRACK) 44 WTF_MAKE_ISO_ALLOCATED_IMPL(Render TextTrackContainerElement);44 WTF_MAKE_ISO_ALLOCATED_IMPL(RenderMediaControlTextTrackContainer); 45 45 #endif 46 46 … … 91 91 #if ENABLE(VIDEO_TRACK) 92 92 93 Render TextTrackContainerElement::RenderTextTrackContainerElement(Element& element, RenderStyle&& style)93 RenderMediaControlTextTrackContainer::RenderMediaControlTextTrackContainer(Element& element, RenderStyle&& style) 94 94 : RenderBlockFlow(element, WTFMove(style)) 95 95 { 96 96 } 97 97 98 void Render TextTrackContainerElement::layout()98 void RenderMediaControlTextTrackContainer::layout() 99 99 { 100 100 RenderBlockFlow::layout(); … … 105 105 106 106 LayoutStateDisabler layoutStateDisabler(view().frameView().layoutContext()); 107 static_cast<MediaControlTextTrackContainerElement*>(element())->layoutIfNecessary();108 107 } 109 108 -
trunk/Source/WebCore/rendering/RenderMediaControlElements.h
r224537 r258434 60 60 #if ENABLE(VIDEO_TRACK) 61 61 62 class Render TextTrackContainerElementfinal : public RenderBlockFlow {63 WTF_MAKE_ISO_ALLOCATED(Render TextTrackContainerElement);62 class RenderMediaControlTextTrackContainer final : public RenderBlockFlow { 63 WTF_MAKE_ISO_ALLOCATED(RenderMediaControlTextTrackContainer); 64 64 public: 65 Render TextTrackContainerElement(Element&, RenderStyle&&);65 RenderMediaControlTextTrackContainer(Element&, RenderStyle&&); 66 66 67 67 private:
Note: See TracChangeset
for help on using the changeset viewer.