Changeset 110409 in webkit
- Timestamp:
- Mar 11, 2012 9:47:28 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r110408 r110409 1 2012-03-11 Victor Carbune <vcarbune@adobe.com> 2 3 Updated layout tests for basic rendering of cues. 4 Some Chromium tests require rebaselining and have been marked accordingly. 5 6 https://bugs.webkit.org/show_bug.cgi?id=79746 7 8 Reviewed by Eric Carlson. 9 10 * media/media-controls.js: Adjusted helper function. 11 (mediaControlsElement): 12 (textTrackDisplayElement): If the method is called with only 13 one parameter, it returns the text track container instead of 14 a specific cue. 15 * media/track/track-cue-mutable-text-expected.txt: Adjusted. 16 * media/track/track-cue-nothing-to-render-expected.txt: Adjusted. 17 * media/track/track-cue-rendering-expected.txt: Adjusted. 18 * media/track/track-cue-rendering.html: Adjusted. 19 * platform/chromium/test_expectations.txt: Marked tests that need to 20 be rebaselined accordingly. 21 1 22 2012-03-11 Noel Gordon <noel.gordon@gmail.com> 2 23 -
trunk/LayoutTests/media/media-controls.js
r103852 r110409 3 3 { 4 4 for (var element = first; element; element = element.nextSibling) { 5 6 5 // Not every element in the media controls has a shadow pseudo ID, eg. the 7 6 // text nodes for the time values, so guard against exceptions. … … 36 35 function textTrackDisplayElement(parentElement, id) 37 36 { 38 var controlID = "-webkit-media-text-track-" + id; 39 var displayElement = mediaControlsElement(internals.shadowRoot(parentElement).firstChild, controlID); 37 var textTrackContainerID = "-webkit-media-text-track-container"; 38 var containerElement = mediaControlsElement(internals.shadowRoot(parentElement).firstChild, "-webkit-media-text-track-container"); 39 40 if (!containerElement) 41 throw "Failed to find text track container element"; 42 43 if (!id) 44 return containerElement; 45 46 var controlID = "-webkit-media-text-track-" + arguments[1]; 47 48 var displayElement = mediaControlsElement(containerElement.firstChild, controlID); 40 49 if (!displayElement) 41 throw "Failed to find media control element ID '" + controlID + "'"; 50 throw "No text track cue with display id '" + controlID + "' is currently visible"; 51 42 52 return displayElement; 43 53 } -
trunk/LayoutTests/media/track/track-cue-mutable-text-expected.txt
r104624 r110409 4 4 ** Test initial cue info 5 5 EXPECTED (testTrack.track.activeCues.length == '0') OK 6 EXPECTED (textTrackDisplayElement(video, 'display').innerText == '') OK 6 No text track cue with display id '-webkit-media-text-track-display' is currently visible 7 7 EXPECTED (testTrack.track.cues[0].startTime == '1') OK 8 8 EXPECTED (testTrack.track.cues[1].startTime == '3') OK -
trunk/LayoutTests/media/track/track-cue-nothing-to-render-expected.txt
r104624 r110409 4 4 EVENT(seeked) 5 5 EXPECTED (video.currentTime.toFixed(1) == '0.5') OK 6 EXPECTED (textTrackDisplayElement(video, 'display').innerText == '') OK 6 No text track cue with display id '-webkit-media-text-track-display' is currently visible 7 7 8 8 RUN(video.currentTime = 1.5) … … 15 15 EVENT(seeked) 16 16 EXPECTED (video.currentTime.toFixed(1) == '2.5') OK 17 EXPECTED (textTrackDisplayElement(video, 'display').innerText == '') OK 17 No text track cue with display id '-webkit-media-text-track-display' is currently visible 18 18 19 19 RUN(video.currentTime = 3.3) … … 26 26 EVENT(seeked) 27 27 EXPECTED (video.currentTime.toFixed(1) == '0.6') OK 28 EXPECTED (textTrackDisplayElement(video, 'display').innerText == '') OK 28 No text track cue with display id '-webkit-media-text-track-display' is currently visible 29 29 30 30 RUN(video.currentTime = 5.9) … … 37 37 EVENT(seeked) 38 38 EXPECTED (video.currentTime.toFixed(1) == '4.4') OK 39 EXPECTED (textTrackDisplayElement(video, 'display').innerText == '') OK 39 No text track cue with display id '-webkit-media-text-track-display' is currently visible 40 40 41 41 RUN(video.currentTime = 7.9) -
trunk/LayoutTests/media/track/track-cue-rendering-expected.txt
r104624 r110409 31 31 RUN(video.width = 320) 32 32 RUN(video.height = 240) 33 EXPECTED (getComputedStyle(textTrackDisplayElement(video , 'container')).fontSize == '12px') OK33 EXPECTED (getComputedStyle(textTrackDisplayElement(video)).fontSize == '12px') OK 34 34 35 35 RUN(video.width = 640) 36 36 RUN(video.height = 480) 37 EXPECTED (getComputedStyle(textTrackDisplayElement(video , 'container')).fontSize == '24px') OK37 EXPECTED (getComputedStyle(textTrackDisplayElement(video)).fontSize == '24px') OK 38 38 39 39 RUN(video.width = 1280) 40 40 RUN(video.height = 960) 41 EXPECTED (getComputedStyle(textTrackDisplayElement(video , 'container')).fontSize == '48px') OK41 EXPECTED (getComputedStyle(textTrackDisplayElement(video)).fontSize == '48px') OK 42 42 43 43 RUN(video.width = 2560) 44 44 RUN(video.height = 1440) 45 EXPECTED (getComputedStyle(textTrackDisplayElement(video , 'container')).fontSize == '72px') OK45 EXPECTED (getComputedStyle(textTrackDisplayElement(video)).fontSize == '72px') OK 46 46 47 EXPECTED (getComputedStyle(textTrackDisplayElement(video , 'container')).fontFamily == 'sans-serif') OK48 EXPECTED (getComputedStyle(textTrackDisplayElement(video , 'container')).color == 'rgba(255, 255, 255, 0)') OK47 EXPECTED (getComputedStyle(textTrackDisplayElement(video)).fontFamily == 'sans-serif') OK 48 EXPECTED (getComputedStyle(textTrackDisplayElement(video)).color == 'rgba(255, 255, 255, 0)') OK 49 49 EXPECTED (getComputedStyle(textTrackDisplayElement(video, 'display')).backgroundColor == 'rgba(0, 0, 0, 0.796875)') OK 50 50 END OF TEST -
trunk/LayoutTests/media/track/track-cue-rendering.html
r104624 r110409 19 19 run("video.height = " + height); 20 20 document.body.offsetTop; 21 testExpected("getComputedStyle(textTrackDisplayElement(video , 'container')).fontSize", parseInt(height * 0.05) + "px");21 testExpected("getComputedStyle(textTrackDisplayElement(video)).fontSize", parseInt(height * 0.05) + "px"); 22 22 consoleWrite(""); 23 23 } … … 31 31 testFontSize(2560, 1440); 32 32 33 testExpected("getComputedStyle(textTrackDisplayElement(video , 'container')).fontFamily", "sans-serif");34 testExpected("getComputedStyle(textTrackDisplayElement(video , 'container')).color", "rgba(255, 255, 255, 0)");33 testExpected("getComputedStyle(textTrackDisplayElement(video)).fontFamily", "sans-serif"); 34 testExpected("getComputedStyle(textTrackDisplayElement(video)).color", "rgba(255, 255, 255, 0)"); 35 35 testExpected("getComputedStyle(textTrackDisplayElement(video, 'display')).backgroundColor", "rgba(0, 0, 0, 0.796875)"); 36 36 -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r110408 r110409 3413 3413 BUGWK73865 : media/track/text-track-is-reachable.html = TEXT CRASH 3414 3414 3415 // Need rebaselining 3416 BUGWK79746 : media/media-document-audio-repaint.html = IMAGE+TEXT 3417 BUGWK79746 : media/video-no-audio.html = IMAGE+TEXT 3418 BUGWK79746 : media/controls-strict.html = IMAGE+TEXT 3419 BUGWK79746 : media/video-volume-slider.html = IMAGE+TEXT 3420 BUGWK79746 : media/controls-styling.html = IMAGE+TEXT 3421 BUGWK79746 : media/video-display-toggle.html = IMAGE+TEXT 3422 BUGWK79746 : media/audio-controls-rendering.html = IMAGE+TEXT 3423 BUGWK79746 : media/video-zoom-controls.html = IMAGE+TEXT 3424 BUGWK79746 : media/video-controls-rendering.html = IMAGE+TEXT 3425 BUGWK79746 : media/controls-without-preload.html = IMAGE+TEXT 3426 BUGWK79746 : media/media-controls-clone.html = IMAGE+TEXT 3427 BUGWK79746 : fast/layers/video-layer.html = IMAGE+TEXT 3428 BUGWK79746 : media/video-empty-source.html = IMAGE+TEXT 3429 BUGWK79746 : media/video-playing-and-pause.html = IMAGE+TEXT 3430 BUGWK79746 : media/controls-after-reload.html = IMAGE+TEXT 3431 BUGWK79746 : media/audio-repaint.html = IMAGE+TEXT 3432 BUGWK79746 : media/controls-layout-direction.html = IMAGE 3433 BUGWK79746 : media/video-aspect-ratio.html = IMAGE 3434 BUGWK79746 : media/video-colorspace-yuv420.html = IMAGE 3435 BUGWK79746 : media/video-colorspace-yuv422.html = IMAGE 3436 BUGWK79746 : media/video-frame-accurate-seek.html = IMAGE 3437 BUGWK79746 : media/video-layer-crash.html = IMAGE 3438 BUGWK79746 : media/video-transformed.html = IMAGE 3439 BUGWK79746 : media/video-zoom.html = IMAGE 3440 3415 3441 BUGWK72271 MAC DEBUG : fast/loader/javascript-url-in-embed.html = PASS CRASH 3416 3442 BUGWK72271 SNOWLEOPARD DEBUG : fast/dom/node-iterator-reference-node-moved-crash.html = PASS CRASH … … 3691 3717 BUGCR114777 : compositing/culling/filter-occlusion-blur-large.html = PASS IMAGE 3692 3718 BUGCR114777 : compositing/culling/filter-occlusion-blur.html = PASS IMAGE 3693 3694 // Needs rebaseline3695 BUGWK78878 : media/audio-repaint.html = IMAGE3696 3719 3697 3720 // Needs new baselines. -
trunk/Source/WebCore/ChangeLog
r110405 r110409 1 2012-03-11 Victor Carbune <vcarbune@adobe.com> 2 3 The main code structure for placing future text track cue rendering 4 code and main outer rendering steps. 5 https://bugs.webkit.org/show_bug.cgi?id=79746 6 7 Reviewed by Eric Carlson. 8 9 No new tests. Only refactoring, but some chromium tests require rebaselining 10 and have been marked accordingly. 11 12 * css/mediaControls.css: 13 (::-webkit-media-controls): Changed the default display to -webkit-box, as 14 captions need to always be rendered on top of the controls, if they are visible. 15 (audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel): 16 Default position attribute is now relative, handled by the parent -webkit-box 17 (video::-webkit-media-text-track-container): The position of the container is 18 now relative, handled by -webkit-box. 19 (video::-webkit-media-text-track-display): Adjusted text color to match 20 the color required in the WebVTT spec (section 3.5.1 'color' property) 21 * css/mediaControlsChromium.css: 22 (audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel): 23 Default position attribute is now relative, handled by the parent -webkit-box 24 25 * html/shadow/MediaControlElements.cpp: 26 (WebCore::MediaControlPanelElement::MediaControlPanelElement): Added a timer 27 for the webkit fade out transition event. This timer is required for setting 28 the display property to 'none', when the fade out transition is over. Otherwise, 29 captions would not be displayed at the bottom of the video. 30 (WebCore::MediaControlPanelElement::startTimer): Added. 31 (WebCore): 32 (WebCore::MediaControlPanelElement::stopTimer): Added. 33 (WebCore::MediaControlPanelElement::transitionTimerFired): Added. If the current 34 state of the controls is transparent, the display property is set to 'none'. 35 (WebCore::MediaControlPanelElement::makeOpaque): The inline display:'none' property 36 is removed before the fade in transition. 37 (WebCore::MediaControlPanelElement::makeTransparent): Added the timer start. 38 (WebCore::MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement): 39 Removed m_bottom as it is not needed anymore. 40 (WebCore::MediaControlTextTrackContainerElement::updateDisplay): Added. Main 41 function for the rendering rules. 42 (WebCore::MediaControlTextTrackContainerElement::updateSizes): The bottom position 43 needs not to be set anymore. 44 * html/shadow/MediaControlElements.h: 45 (MediaControlPanelElement): Added timer internals. 46 (MediaControlTextTrackContainerElement): Added updateDisplay() and removed unused 47 variables. 48 49 (WebCore): 50 * html/shadow/MediaControlRootElement.cpp: Removed m_textTrackDisplay 51 and duplicated code with MediaControlRootElementChromium (only minimum 52 function calls to the main text track container) 53 (WebCore::MediaControlRootElement::MediaControlRootElement): 54 (WebCore::MediaControlRootElement::setMediaController): 55 (WebCore::MediaControlRootElement::createTextTrackDisplay): 56 (WebCore::MediaControlRootElement::updateTextTrackDisplay): 57 58 * html/shadow/MediaControlRootElementChromium.cpp: Removed m_textTrackDisplay 59 and duplicate code with MediaControlRootElement (only minimum function calls 60 to the main text track container remained) 61 (WebCore::MediaControlRootElementChromium::MediaControlRootElementChromium): 62 (WebCore::MediaControlRootElementChromium::setMediaController): 63 (WebCore::MediaControlRootElementChromium::createTextTrackDisplay): 64 (WebCore::MediaControlRootElementChromium::updateTextTrackDisplay): 65 66 (WebCore): 67 * html/track/TextTrackCue.cpp: Enhanced structure for supporting more complex 68 rendering required by the WebVTT spec. 69 (WebCore::TextTrackCue::TextTrackCue): 70 (WebCore::TextTrackCue::cueDidChange): Mark the display tree as obsolete, so that 71 it needs to be re-computed. 72 (WebCore::TextTrackCue::setIsActive): The display tree needs to be removed as 73 soon as the cue becomes inactive. Adjusted this method to support the functionality. 74 (WebCore): 75 (WebCore::TextTrackCue::determineDisplayParameters): Added. This method will hold 76 main positioning parameter computations for a TextTrackCue 77 (WebCore): 78 (WebCore::TextTrackCue::getDisplayTree): Added. This method returns the root node 79 of the CSS boxes that need to be displayed on top of the video, for the current 80 instance. 81 * html/track/TextTrackCue.h: 82 (WebCore): 83 (TextTrackCue): 84 1 85 2012-03-11 Sheriff Bot <webkit.review.bot@gmail.com> 2 86 -
trunk/Source/WebCore/css/mediaControls.css
r104278 r110409 38 38 height: inherit; 39 39 position: relative; 40 display: block;40 display: -webkit-box; 41 41 direction: ltr; 42 -webkit-box-align: start; 43 -webkit-box-pack: end; 44 -webkit-box-orient: vertical; 42 45 } 43 46 … … 47 50 -webkit-box-align: center; 48 51 -webkit-user-select: none; 49 position: absolute;52 position: relative; 50 53 bottom: 0; 51 54 width: 100%; … … 202 205 203 206 video::-webkit-media-text-track-container { 204 position: absolute;207 position: relative; 205 208 width: 100%; 206 209 overflow: hidden; 210 padding-bottom: 5px; 207 211 208 212 font-size: 22px; … … 210 214 text-align: center; 211 215 color: rgba(255, 255, 255, 0); 212 216 213 217 letter-spacing: normal; 214 218 word-spacing: normal; … … 223 227 display: inline; 224 228 background-color: rgba(0, 0, 0, 0.8); 225 color: yellow;229 color: rgba(255, 255, 255, 1); 226 230 padding: 0px 2px; 227 231 } -
trunk/Source/WebCore/css/mediaControlsChromium.css
r104278 r110409 42 42 audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel { 43 43 -webkit-user-select: none; 44 position: absolute;44 position: relative; 45 45 overflow: visible; 46 46 bottom: 0; -
trunk/Source/WebCore/html/shadow/MediaControlElements.cpp
r109378 r110409 41 41 #include "HTMLMediaElement.h" 42 42 #include "HTMLNames.h" 43 #include "HTMLVideoElement.h" 43 44 #include "LocalizedStrings.h" 44 45 #include "MediaControls.h" … … 53 54 #include "ScriptController.h" 54 55 #include "Settings.h" 56 #include "Text.h" 55 57 56 58 namespace WebCore { … … 108 110 , m_isBeingDragged(false) 109 111 , m_opaque(true) 112 , m_transitionTimer(this, &MediaControlPanelElement::transitionTimerFired) 110 113 { 111 114 } … … 172 175 173 176 frame->eventHandler()->setCapturingMouseEventsNode(0); 177 } 178 179 void MediaControlPanelElement::startTimer() 180 { 181 stopTimer(); 182 183 // The timer is required to set the property display:'none' on the panel, 184 // such that captions are correctly displayed at the bottom of the video 185 // at the end of the fadeout transition. 186 double duration = document()->page() ? document()->page()->theme()->mediaControlsFadeOutDuration() : 0; 187 m_transitionTimer.startOneShot(duration); 188 } 189 190 void MediaControlPanelElement::stopTimer() 191 { 192 if (m_transitionTimer.isActive()) 193 m_transitionTimer.stop(); 194 } 195 196 197 void MediaControlPanelElement::transitionTimerFired(Timer<MediaControlPanelElement>*) 198 { 199 if (!m_opaque) 200 hide(); 201 202 stopTimer(); 174 203 } 175 204 … … 213 242 214 243 m_opaque = true; 244 245 show(); 215 246 } 216 247 … … 225 256 226 257 m_opaque = false; 258 259 startTimer(); 227 260 } 228 261 … … 1166 1199 : MediaControlElement(document) 1167 1200 , m_fontSize(0) 1168 , m_bottom(0)1169 1201 { 1170 1202 } … … 1188 1220 } 1189 1221 1222 void MediaControlTextTrackContainerElement::updateDisplay() 1223 { 1224 HTMLMediaElement* mediaElement = toParentMediaElement(this); 1225 1226 // 1. If the media element is an audio element, or is another playback 1227 // mechanism with no rendering area, abort these steps. There is nothing to 1228 // render. 1229 if (!mediaElement->isVideo()) 1230 return; 1231 1232 // 2. Let video be the media element or other playback mechanism. 1233 HTMLVideoElement* video = static_cast<HTMLVideoElement*>(mediaElement); 1234 1235 // 3. Let output be an empty list of absolutely positioned CSS block boxes. 1236 Vector<RefPtr<HTMLDivElement> > output; 1237 1238 // 4. If the user agent is exposing a user interface for video, add to 1239 // output one or more completely transparent positioned CSS block boxes that 1240 // cover the same region as the user interface. 1241 1242 // 5. If the last time these rules were run, the user agent was not exposing 1243 // a user interface for video, but now it is, let reset be true. Otherwise, 1244 // let reset be false. 1245 1246 // There is nothing to be done explicitly for 4th and 5th steps, as 1247 // everything is handled through CSS. The caption box is on top of the 1248 // controls box, in a container set with the -webkit-box display property. 1249 1250 // 6. Let tracks be the subset of video's list of text tracks that have as 1251 // their rules for updating the text track rendering these rules for 1252 // updating the display of WebVTT text tracks, and whose text track mode is 1253 // showing or showing by default. 1254 // 7. Let cues be an empty list of text track cues. 1255 // 8. For each track track in tracks, append to cues all the cues from 1256 // track's list of cues that have their text track cue active flag set. 1257 CueList activeCues = video->currentlyActiveCues(); 1258 1259 // 9. If reset is false, then, for each text track cue cue in cues: if cue's 1260 // text track cue display state has a set of CSS boxes, then add those boxes 1261 // to output, and remove cue from cues. 1262 1263 // There is nothing explicitly to be done here, as all the caching occurs 1264 // within the TextTrackCue instance itself. If parameters of the cue change, 1265 // the display tree is cleared. 1266 1267 // 10. For each text track cue cue in cues that has not yet had 1268 // corresponding CSS boxes added to output, in text track cue order, run the 1269 // following substeps: 1270 1271 // Simple renderer for now. 1272 for (size_t i = 0; i < activeCues.size(); ++i) { 1273 TextTrackCue* cue = activeCues[i].data(); 1274 1275 ASSERT(cue->isActive()); 1276 if (!cue->track() || cue->track()->mode() != TextTrack::SHOWING) 1277 continue; 1278 1279 RefPtr<HTMLDivElement> displayTree = cue->getDisplayTree(); 1280 1281 // Append only new display trees. 1282 if (displayTree->hasChildNodes() && !contains(displayTree.get())) 1283 appendChild(displayTree, ASSERT_NO_EXCEPTION, true); 1284 1285 // The display tree of a cue is removed when the active flag of the cue is unset. 1286 1287 // FIXME(BUG 79750): Render the TextTrackCue when snap-to-lines is set. 1288 // FIXME(BUG 79751): Render the TextTrackCue when snap-to-lines is not set. 1289 } 1290 1291 // 11. Return output. 1292 hasChildNodes() ? show() : hide(); 1293 } 1294 1190 1295 static const float mimimumFontSize = 16; 1191 1296 static const float videoHeightFontSizePercentage = .05; 1192 1297 static const float trackBottomMultiplier = .9; 1193 1298 1194 1299 void MediaControlTextTrackContainerElement::updateSizes() 1195 1300 { … … 1197 1302 if (!mediaElement || !mediaElement->renderer() || !mediaElement->renderer()->isVideo()) 1198 1303 return; 1199 1304 1200 1305 IntRect videoBox = toRenderVideo(mediaElement->renderer())->videoBox(); 1201 1306 if (m_videoDisplaySize == videoBox) … … 1208 1313 setInlineStyleProperty(CSSPropertyFontSize, String::number(fontSize) + "px"); 1209 1314 } 1210 1211 LayoutUnit bottom = static_cast<LayoutUnit>(m_videoDisplaySize.y() + m_videoDisplaySize.height() - (m_videoDisplaySize.height() * trackBottomMultiplier)); 1212 if (bottom != m_bottom) { 1213 m_bottom = bottom; 1214 setInlineStyleProperty(CSSPropertyBottom, String::number(roundToInt(bottom)) + "px"); 1215 } 1216 } 1217 1218 // ---------------------------- 1219 1220 MediaControlTextTrackDisplayElement::MediaControlTextTrackDisplayElement(Document* document) 1221 : MediaControlElement(document) 1222 { 1223 } 1224 1225 PassRefPtr<MediaControlTextTrackDisplayElement> MediaControlTextTrackDisplayElement::create(Document* document) 1226 { 1227 return adoptRef(new MediaControlTextTrackDisplayElement(document)); 1228 } 1229 1230 const AtomicString& MediaControlTextTrackDisplayElement::shadowPseudoId() const 1231 { 1232 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-text-track-display")); 1233 return id; 1234 } 1235 1236 #endif 1315 } 1316 1317 #endif // ENABLE(VIDEO_TRACK) 1237 1318 1238 1319 // ---------------------------- -
trunk/Source/WebCore/html/shadow/MediaControlElements.h
r109231 r110409 123 123 void endDrag(); 124 124 125 void startTimer(); 126 void stopTimer(); 127 void transitionTimerFired(Timer<MediaControlPanelElement>*); 128 125 129 void setPosition(const LayoutPoint&); 126 130 … … 130 134 LayoutPoint m_dragStartPosition; 131 135 LayoutPoint m_dragStartEventLocation; 136 137 Timer<MediaControlPanelElement> m_transitionTimer; 132 138 }; 133 139 … … 492 498 class MediaControlTextTrackContainerElement : public MediaControlElement { 493 499 public: 494 495 500 static PassRefPtr<MediaControlTextTrackContainerElement> create(Document*); 496 501 502 void updateDisplay(); 497 503 void updateSizes(); 498 504 … … 506 512 IntRect m_videoDisplaySize; 507 513 float m_fontSize; 508 LayoutUnit m_bottom; 509 }; 510 511 // ---------------------------- 512 513 class MediaControlTextTrackDisplayElement : public MediaControlElement { 514 public: 515 static PassRefPtr<MediaControlTextTrackDisplayElement> create(Document*); 516 517 private: 518 MediaControlTextTrackDisplayElement(Document*); 519 520 virtual MediaControlElementType displayType() const { return MediaTextTrackDisplay; } 521 virtual const AtomicString& shadowPseudoId() const; 522 }; 514 }; 515 523 516 #endif 524 525 517 // ---------------------------- 526 518 -
trunk/Source/WebCore/html/shadow/MediaControlRootElement.cpp
r109231 r110409 74 74 #if ENABLE(VIDEO_TRACK) 75 75 , m_textDisplayContainer(0) 76 , m_textTrackDisplay(0)77 76 #endif 78 77 , m_hideFullscreenControlsTimer(this, &MediaControlRootElement::hideFullscreenControlsTimerFired) … … 278 277 if (m_textDisplayContainer) 279 278 m_textDisplayContainer->setMediaController(controller); 280 if (m_textTrackDisplay)281 m_textTrackDisplay->setMediaController(controller);282 279 #endif 283 280 reset(); … … 605 602 m_textDisplayContainer = textDisplayContainer.get(); 606 603 607 RefPtr<MediaControlTextTrackDisplayElement> textDisplay = MediaControlTextTrackDisplayElement::create(document()); 608 m_textDisplayContainer->hide(); 609 m_textTrackDisplay = textDisplay.get(); 610 604 // Insert it before the first controller element so it always displays behind the controls. 611 605 ExceptionCode ec; 612 textDisplayContainer->appendChild(textDisplay.release(), ec, true);613 if (ec)614 return;615 616 // Insert it before the first controller element so it always displays behind the controls.617 606 insertBefore(textDisplayContainer.release(), m_panel, ec, true); 618 607 } … … 637 626 createTextTrackDisplay(); 638 627 639 CueList activeCues = toParentMediaElement(m_textDisplayContainer)->currentlyActiveCues(); 640 m_textTrackDisplay->removeChildren(); 641 bool nothingToDisplay = true; 642 for (size_t i = 0; i < activeCues.size(); ++i) { 643 TextTrackCue* cue = activeCues[i].data(); 644 ASSERT(cue->isActive()); 645 if (!cue->track() || cue->track()->mode() != TextTrack::SHOWING) 646 continue; 647 648 String cueText = cue->text(); 649 if (!cueText.isEmpty()) { 650 if (!nothingToDisplay) 651 m_textTrackDisplay->appendChild(document()->createElement(HTMLNames::brTag, false), ASSERT_NO_EXCEPTION); 652 m_textTrackDisplay->appendChild(document()->createTextNode(cueText), ASSERT_NO_EXCEPTION); 653 nothingToDisplay = false; 654 } 655 } 656 657 if (!nothingToDisplay) 658 m_textDisplayContainer->show(); 659 else 660 m_textDisplayContainer->hide(); 628 m_textDisplayContainer->updateDisplay(); 629 661 630 } 662 631 #endif -
trunk/Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp
r104658 r110409 59 59 #if ENABLE(VIDEO_TRACK) 60 60 , m_textDisplayContainer(0) 61 , m_textTrackDisplay(0)62 61 #endif 63 62 , m_opaque(true) … … 159 158 if (m_textDisplayContainer) 160 159 m_textDisplayContainer->setMediaController(controller); 161 if (m_textTrackDisplay)162 m_textTrackDisplay->setMediaController(controller);163 160 #endif 164 161 reset(); … … 336 333 m_textDisplayContainer = textDisplayContainer.get(); 337 334 338 RefPtr<MediaControlTextTrackDisplayElement> textDisplay = MediaControlTextTrackDisplayElement::create(document()); 339 m_textDisplayContainer->hide(); 340 m_textTrackDisplay = textDisplay.get(); 341 335 // Insert it before the first controller element so it always displays behind the controls. 342 336 ExceptionCode ec; 343 textDisplayContainer->appendChild(textDisplay.release(), ec, true);344 if (ec)345 return;346 347 // Insert it before the first controller element so it always displays behind the controls.348 337 insertBefore(textDisplayContainer.release(), m_panel, ec, true); 349 338 } … … 368 357 createTextTrackDisplay(); 369 358 370 CueList activeCues = toParentMediaElement(m_textDisplayContainer)->currentlyActiveCues(); 371 m_textTrackDisplay->removeChildren(); 372 bool nothingToDisplay = true; 373 for (size_t i = 0; i < activeCues.size(); ++i) { 374 TextTrackCue* cue = activeCues[i].data(); 375 ASSERT(cue->isActive()); 376 if (!cue->track() || cue->track()->mode() != TextTrack::SHOWING) 377 continue; 378 379 String cueText = cue->text(); 380 if (!cueText.isEmpty()) { 381 if (!nothingToDisplay) 382 m_textTrackDisplay->appendChild(document()->createElement(HTMLNames::brTag, false), ASSERT_NO_EXCEPTION); 383 m_textTrackDisplay->appendChild(document()->createTextNode(cueText), ASSERT_NO_EXCEPTION); 384 nothingToDisplay = false; 385 } 386 } 387 388 if (!nothingToDisplay) 389 m_textDisplayContainer->show(); 390 else 391 m_textDisplayContainer->hide(); 392 } 393 #endif 394 359 m_textDisplayContainer->updateDisplay(); 360 } 361 #endif 362 395 363 const AtomicString& MediaControlRootElementChromium::shadowPseudoId() const 396 364 { -
trunk/Source/WebCore/html/track/TextTrackCue.cpp
r110308 r110409 36 36 #include "TextTrackCue.h" 37 37 38 #include "CSSPropertyNames.h" 39 #include "CSSValueKeywords.h" 40 #include "DocumentFragment.h" 38 41 #include "Event.h" 39 #include "DocumentFragment.h" 42 #include "HTMLDivElement.h" 43 #include "Text.h" 40 44 #include "TextTrack.h" 41 45 #include "TextTrackCueList.h" … … 112 116 , m_pauseOnExit(pauseOnExit) 113 117 , m_snapToLines(true) 114 { 118 , m_displayTreeShouldChange(true) 119 , m_displayTree(HTMLDivElement::create(static_cast<Document*>(context))) 120 { 121 ASSERT(m_scriptExecutionContext->isDocument()); 115 122 parseSettings(settings); 116 123 } … … 130 137 if (m_track) 131 138 m_track->cueDidChange(this); 139 140 m_displayTreeShouldChange = true; 132 141 } 133 142 … … 395 404 { 396 405 m_isActive = active; 406 407 if (!active) { 408 // Remove the display tree as soon as the cue becomes inactive. 409 ExceptionCode ec; 410 m_displayTree->remove(ec); 411 } 412 } 413 414 void TextTrackCue::determineDisplayParameters() 415 { 416 // FIXME(BUG 79749): Determine the text direction using the BIDI algorithm. 417 // Steps 10.2, 10.3 418 419 // FIXME(BUG 79747): Determine the display parameters from the rules. 420 // Steps 10.1, 10.4 - 10.10 421 } 422 423 PassRefPtr<HTMLDivElement> TextTrackCue::getDisplayTree() 424 { 425 if (!m_displayTreeShouldChange) 426 return m_displayTree; 427 428 // 10.1 - 10.10 429 determineDisplayParameters(); 430 431 // 10.11. Apply the terms of the CSS specifications to nodes within the 432 // following constraints, thus obtaining a set of CSS boxes positioned 433 // relative to an initial containing block: 434 m_displayTree->removeChildren(); 435 436 // The document tree is the tree of WebVTT Node Objects rooted at nodes. 437 438 // The children of the nodes must be wrapped in an anonymous box whose 439 // 'display' property has the value 'inline'. This is the WebVTT cue 440 // background box. 441 m_displayTree->setShadowPseudoId(AtomicString("-webkit-media-text-track-display"), ASSERT_NO_EXCEPTION); 442 m_displayTree->appendChild(getCueAsHTML(), ASSERT_NO_EXCEPTION, true); 443 444 // FIXME(BUG 79916): Runs of children of WebVTT Ruby Objects that are not 445 // WebVTT Ruby Text Objects must be wrapped in anonymous boxes whose 446 // 'display' property has the value 'ruby-base'. 447 448 // FIXME(BUG 79916): Text runs must be wrapped according to the CSS 449 // line-wrapping rules, except that additionally, regardless of the value of 450 // the 'white-space' property, lines must be wrapped at the edge of their 451 // containing blocks, even if doing so requires splitting a word where there 452 // is no line breaking opportunity. (Thus, normally text wraps as needed, 453 // but if there is a particularly long word, it does not overflow as it 454 // normally would in CSS, it is instead forcibly wrapped at the box's edge.) 455 456 // FIXME(BUG 79750, 79751): Steps 10.12 - 10.14 457 458 m_displayTreeShouldChange = false; 459 460 // 10.15. Let cue's text track cue display state have the CSS boxes in 461 // boxes. 462 return m_displayTree; 397 463 } 398 464 -
trunk/Source/WebCore/html/track/TextTrackCue.h
r110308 r110409 44 44 class ScriptExecutionContext; 45 45 class TextTrack; 46 class HTMLDivElement; 46 47 47 48 class TextTrackCue : public RefCounted<TextTrackCue>, public EventTarget { … … 101 102 void setIsActive(bool); 102 103 104 PassRefPtr<HTMLDivElement> getDisplayTree(); 105 103 106 virtual const AtomicString& interfaceName() const; 104 107 virtual ScriptExecutionContext* scriptExecutionContext() const; … … 111 114 112 115 protected: 113 114 116 virtual EventTargetData* eventTargetData(); 115 117 virtual EventTargetData* ensureEventTargetData(); … … 119 121 120 122 void parseSettings(const String&); 123 void determineDisplayParameters(); 124 121 125 void cueWillChange(); 122 126 void cueDidChange(); … … 149 153 bool m_pauseOnExit; 150 154 bool m_snapToLines; 155 156 bool m_displayTreeShouldChange; 157 RefPtr<HTMLDivElement> m_displayTree; 151 158 }; 152 159
Note: See TracChangeset
for help on using the changeset viewer.