Changeset 126238 in webkit
- Timestamp:
- Aug 21, 2012 6:05:09 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 13 deleted
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r126233 r126238 1 2012-08-21 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r126233. 4 http://trac.webkit.org/changeset/126233 5 https://bugs.webkit.org/show_bug.cgi?id=94656 6 7 Broke Chromium Mac build (Requested by dominicc on #webkit). 8 9 * media/track/captions-webvtt/captions-snap-to-lines-set.vtt: Removed. 10 * media/track/track-cue-rendering-horizontal.html: Removed. 11 * media/track/track-cue-rendering-snap-to-lines-not-set-expected.txt: 12 * media/track/track-cue-rendering-vertical.html: Removed. 13 * media/video-test.js: 14 * platform/chromium-linux/media/track/track-cue-rendering-horizontal-expected.png: Removed. 15 * platform/chromium-linux/media/track/track-cue-rendering-horizontal-expected.txt: Removed. 16 * platform/chromium-linux/media/track/track-cue-rendering-vertical-expected.png: Removed. 17 * platform/chromium-linux/media/track/track-cue-rendering-vertical-expected.txt: Removed. 18 * platform/chromium/TestExpectations: 19 * platform/mac/media/track/track-cue-rendering-horizontal-expected.png: Removed. 20 * platform/mac/media/track/track-cue-rendering-horizontal-expected.txt: Removed. 21 * platform/mac/media/track/track-cue-rendering-vertical-expected.png: Removed. 22 * platform/mac/media/track/track-cue-rendering-vertical-expected.txt: Removed. 23 1 24 2012-08-21 Victor Carbune <victor@rosedu.org> 2 25 -
trunk/LayoutTests/media/track/track-cue-rendering-snap-to-lines-not-set-expected.txt
r126233 r126238 13 13 EXPECTED (cueDisplayElement.innerText == 'This is a demo track to illustrate positioning features of cues.') OK 14 14 Cue left position (percentage): 0 15 Cue top position (percentage): 8115 Cue top position (percentage): 100 16 16 17 17 ** Center ** -
trunk/LayoutTests/media/video-test.js
r126233 r126238 15 15 16 16 if (window.testRunner) { 17 // Some track element rendering tests require text pixel dump. 18 if (typeof requirePixelDump == "undefined") 19 testRunner.dumpAsText(); 20 17 testRunner.dumpAsText(); 21 18 testRunner.waitUntilDone(); 22 19 } -
trunk/LayoutTests/platform/chromium/TestExpectations
r126233 r126238 3453 3453 BUGWK93488 SKIP : fast/notifications/notifications-permission.html = TEXT 3454 3454 3455 BUGWK79751 : media/track/track-cue-rendering-horizontal.html = IMAGE3456 BUGWK79751 : media/track/track-cue-rendering-vertical.html = IMAGE3457 3458 3455 // Flaky 3459 3456 BUGWK93799 MAC : fast/dom/HTMLMeterElement/meter-element-repaint-on-update-value.html = PASS IMAGE -
trunk/Source/WebCore/CMakeLists.txt
r126233 r126238 2083 2083 rendering/RenderTextControlSingleLine.cpp 2084 2084 rendering/RenderTextFragment.cpp 2085 rendering/RenderTextTrackCue.cpp2086 2085 rendering/RenderTheme.cpp 2087 2086 rendering/RenderTreeAsText.cpp -
trunk/Source/WebCore/ChangeLog
r126237 r126238 1 2012-08-21 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r126233. 4 http://trac.webkit.org/changeset/126233 5 https://bugs.webkit.org/show_bug.cgi?id=94656 6 7 Broke Chromium Mac build (Requested by dominicc on #webkit). 8 9 * CMakeLists.txt: 10 * GNUmakefile.list.am: 11 * Target.pri: 12 * WebCore.gypi: 13 * WebCore.vcproj/WebCore.vcproj: 14 * WebCore.xcodeproj/project.pbxproj: 15 * css/mediaControls.css: 16 (video::-webkit-media-text-track-display): 17 * html/shadow/MediaControlElements.cpp: 18 (RenderTextTrackContainerElement): 19 (WebCore::MediaControlTextTrackContainerElement::updateDisplay): 20 * html/track/TextTrack.cpp: 21 * html/track/TextTrack.h: 22 (TextTrack): 23 * html/track/TextTrackCue.cpp: 24 (WebCore::TextTrackCue::TextTrackCue): 25 (WebCore::TextTrackCue::calculateComputedLinePosition): 26 (WebCore::TextTrackCue::calculateDisplayParameters): 27 (WebCore::TextTrackCue::getDisplayTree): 28 (WebCore::TextTrackCue::getPositionCoordinates): 29 * html/track/TextTrackCue.h: 30 (WebCore): 31 (TextTrackCue): 32 * rendering/RenderTextTrackCue.cpp: Removed. 33 * rendering/RenderTextTrackCue.h: Removed. 34 1 35 2012-08-20 Kentaro Hara <haraken@chromium.org> 2 36 -
trunk/Source/WebCore/GNUmakefile.list.am
r126233 r126238 4982 4982 Source/WebCore/rendering/RenderTextControlSingleLine.h \ 4983 4983 Source/WebCore/rendering/RenderText.cpp \ 4984 Source/WebCore/rendering/RenderTextTrackCue.cpp \4985 Source/WebCore/rendering/RenderTextTrackCue.h \4986 4984 Source/WebCore/rendering/RenderTextFragment.cpp \ 4987 4985 Source/WebCore/rendering/RenderTextFragment.h \ -
trunk/Source/WebCore/Target.pri
r126233 r126238 1174 1174 rendering/RenderTextControlSingleLine.cpp \ 1175 1175 rendering/RenderTextFragment.cpp \ 1176 rendering/RenderTextTrackCue.cpp \1177 1176 rendering/RenderTheme.cpp \ 1178 1177 rendering/RenderTreeAsText.cpp \ -
trunk/Source/WebCore/WebCore.gypi
r126233 r126238 4818 4818 'rendering/RenderTextFragment.cpp', 4819 4819 'rendering/RenderTextFragment.h', 4820 'rendering/RenderTextTrackCue.cpp',4821 'rendering/RenderTextTrackCue.h',4822 4820 'rendering/RenderTheme.cpp', 4823 4821 'rendering/RenderTheme.h', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r126233 r126238 43764 43764 </File> 43765 43765 <File 43766 RelativePath="..\rendering\RenderTextTrackCue.cpp"43767 >43768 <FileConfiguration43769 Name="Debug|Win32"43770 ExcludedFromBuild="true"43771 >43772 <Tool43773 Name="VCCLCompilerTool"43774 />43775 </FileConfiguration>43776 <FileConfiguration43777 Name="Release|Win32"43778 ExcludedFromBuild="true"43779 >43780 <Tool43781 Name="VCCLCompilerTool"43782 />43783 </FileConfiguration>43784 <FileConfiguration43785 Name="Debug_Cairo_CFLite|Win32"43786 ExcludedFromBuild="true"43787 >43788 <Tool43789 Name="VCCLCompilerTool"43790 />43791 </FileConfiguration>43792 <FileConfiguration43793 Name="Release_Cairo_CFLite|Win32"43794 ExcludedFromBuild="true"43795 >43796 <Tool43797 Name="VCCLCompilerTool"43798 />43799 </FileConfiguration>43800 <FileConfiguration43801 Name="Debug_All|Win32"43802 ExcludedFromBuild="true"43803 >43804 <Tool43805 Name="VCCLCompilerTool"43806 />43807 </FileConfiguration>43808 <FileConfiguration43809 Name="Production|Win32"43810 ExcludedFromBuild="true"43811 >43812 <Tool43813 Name="VCCLCompilerTool"43814 />43815 </FileConfiguration>43816 </File>43817 <File43818 RelativePath="..\rendering\RenderTextTrackCue.h"43819 >43820 </File>43821 <File43822 43766 RelativePath="..\rendering\RenderTheme.cpp" 43823 43767 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r126233 r126238 2943 2943 86BE340415058CB200CE0FD8 /* PerformanceEntryList.h in Headers */ = {isa = PBXBuildFile; fileRef = 86BE33FE15058CB200CE0FD8 /* PerformanceEntryList.h */; }; 2944 2944 86D982F7125C154000AD9E3D /* DocumentTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D982F6125C154000AD9E3D /* DocumentTiming.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2945 86FF886115DE3D0700BD6B28 /* RenderTextTrackCue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86FF885E15DE3B8200BD6B28 /* RenderTextTrackCue.cpp */; };2946 86FF886215DE3D0700BD6B28 /* RenderTextTrackCue.h in Headers */ = {isa = PBXBuildFile; fileRef = 86FF885F15DE3B8200BD6B28 /* RenderTextTrackCue.h */; };2947 2945 890AE0E11256A07900F5968C /* DirectoryReaderBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 890AE0E01256A07900F5968C /* DirectoryReaderBase.h */; }; 2948 2946 8931DE5B14C44C44000DC9D2 /* JSBlobCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8931DE5A14C44C44000DC9D2 /* JSBlobCustom.cpp */; }; … … 10079 10077 86BE33FF15058CB200CE0FD8 /* PerformanceEntryList.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PerformanceEntryList.idl; sourceTree = "<group>"; }; 10080 10078 86D982F6125C154000AD9E3D /* DocumentTiming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentTiming.h; sourceTree = "<group>"; }; 10081 86FF885E15DE3B8200BD6B28 /* RenderTextTrackCue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTextTrackCue.cpp; sourceTree = "<group>"; };10082 86FF885F15DE3B8200BD6B28 /* RenderTextTrackCue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderTextTrackCue.h; sourceTree = "<group>"; };10083 10079 890AE0E01256A07900F5968C /* DirectoryReaderBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DirectoryReaderBase.h; path = Modules/filesystem/DirectoryReaderBase.h; sourceTree = "<group>"; }; 10084 10080 8931DE5A14C44C44000DC9D2 /* JSBlobCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSBlobCustom.cpp; sourceTree = "<group>"; }; … … 21421 21417 BCEA484E097D93020094C9E4 /* RenderTextFragment.cpp */, 21422 21418 BCEA484F097D93020094C9E4 /* RenderTextFragment.h */, 21423 86FF885E15DE3B8200BD6B28 /* RenderTextTrackCue.cpp */,21424 86FF885F15DE3B8200BD6B28 /* RenderTextTrackCue.h */,21425 21419 BCEA484A097D93020094C9E4 /* RenderTheme.cpp */, 21426 21420 BCEA484B097D93020094C9E4 /* RenderTheme.h */, … … 24665 24659 083DAEA90F01A7FB00342754 /* RenderTextControlSingleLine.h in Headers */, 24666 24660 BCEA488E097D93020094C9E4 /* RenderTextFragment.h in Headers */, 24667 86FF886215DE3D0700BD6B28 /* RenderTextTrackCue.h in Headers */,24668 24661 BCEA488A097D93020094C9E4 /* RenderTheme.h in Headers */, 24669 24662 BCEA4887097D93020094C9E4 /* RenderThemeMac.h in Headers */, … … 27868 27861 083DAEA80F01A7FB00342754 /* RenderTextControlSingleLine.cpp in Sources */, 27869 27862 BCEA488D097D93020094C9E4 /* RenderTextFragment.cpp in Sources */, 27870 86FF886115DE3D0700BD6B28 /* RenderTextTrackCue.cpp in Sources */,27871 27863 BCEA4889097D93020094C9E4 /* RenderTheme.cpp in Sources */, 27872 27864 BCEA4888097D93020094C9E4 /* RenderThemeMac.mm in Sources */, -
trunk/Source/WebCore/css/mediaControls.css
r126233 r126238 254 254 position: absolute; 255 255 color: rgba(255, 255, 255, 1); 256 } 256 257 top: 100%; 258 -webkit-transform: translate(0%, -100%); 259 } -
trunk/Source/WebCore/html/shadow/MediaControlElements.cpp
r126233 r126238 33 33 #include "MediaControlElements.h" 34 34 35 #include "CSSStyleDeclaration.h"36 35 #include "CSSValueKeywords.h" 37 36 #include "DOMTokenList.h" 38 37 #include "EventNames.h" 39 38 #include "FloatConversion.h" 40 #include "FloatPoint.h"41 39 #include "Frame.h" 42 #include "HTMLDivElement.h"43 40 #include "HTMLMediaElement.h" 44 41 #include "HTMLNames.h" 45 42 #include "HTMLVideoElement.h" 46 #include "LayoutRepainter.h"47 43 #include "LocalizedStrings.h" 48 44 #include "MediaControls.h" … … 50 46 #include "Page.h" 51 47 #include "RenderDeprecatedFlexibleBox.h" 52 #include "RenderInline.h"53 48 #include "RenderMedia.h" 54 49 #include "RenderSlider.h" 55 #include "RenderText.h"56 50 #include "RenderTheme.h" 57 51 #include "RenderVideo.h" … … 1265 1259 public: 1266 1260 RenderTextTrackContainerElement(Node*); 1267 1261 1268 1262 private: 1269 1263 virtual void layout(); … … 1359 1353 // corresponding CSS boxes added to output, in text track cue order, run the 1360 1354 // following substeps: 1355 1356 // Simple renderer for now. 1361 1357 for (size_t i = 0; i < activeCues.size(); ++i) { 1362 1358 TextTrackCue* cue = activeCues[i].data(); 1363 1359 1364 1360 ASSERT(cue->isActive()); 1365 if ( !cue->track() || !cue->track()->isRendered())1361 if (cue->track()->kind() != TextTrack::captionsKeyword() && cue->track()->kind() != TextTrack::subtitlesKeyword()) 1366 1362 continue; 1367 1363 1368 RefPtr<TextTrackCueBox> displayBox = cue->getDisplayTree(); 1369 1370 if (displayBox->hasChildNodes() && !contains(static_cast<Node*>(displayBox.get()))) 1371 // Note: the display tree of a cue is removed when the active flag of the cue is unset. 1372 appendChild(displayBox, ASSERT_NO_EXCEPTION, false); 1364 if (!cue->track() || cue->track()->mode() != TextTrack::SHOWING) 1365 continue; 1366 1367 RefPtr<HTMLDivElement> displayTree = cue->getDisplayTree(); 1368 1369 // Append only new display trees. 1370 if (displayTree->hasChildNodes() && !contains(displayTree.get())) 1371 appendChild(displayTree, ASSERT_NO_EXCEPTION, true); 1372 1373 // Note: the display tree of a cue is removed when the active flag of the cue is unset. 1374 1375 // FIXME(BUG 79751): Render the TextTrackCue when snap-to-lines is set. 1376 1377 // FIXME(BUG 84296): Implement overlapping detection for cue boxes when snap-to-lines is not set. 1373 1378 } 1374 1379 -
trunk/Source/WebCore/html/track/TextTrack.cpp
r126233 r126238 295 295 } 296 296 297 bool TextTrack::isRendered()298 {299 if (m_kind != captionsKeyword() && m_kind != subtitlesKeyword())300 return false;301 302 if (m_mode != SHOWING && !m_showingByDefault)303 return false;304 305 return true;306 }307 308 297 TextTrackCueList* TextTrack::ensureTextTrackCueList() 309 298 { -
trunk/Source/WebCore/html/track/TextTrack.h
r126233 r126238 111 111 void invalidateTrackIndex(); 112 112 113 bool isRendered();114 115 113 protected: 116 114 TextTrack(ScriptExecutionContext*, TextTrackClient*, const String& kind, const String& label, const String& language, TextTrackType); -
trunk/Source/WebCore/html/track/TextTrackCue.cpp
r126233 r126238 42 42 #include "HTMLDivElement.h" 43 43 #include "HTMLMediaElement.h" 44 #include "RenderTextTrackCue.h"45 44 #include "Text.h" 46 45 #include "TextTrack.h" … … 89 88 return verticallr; 90 89 } 91 92 // ----------------------------93 94 TextTrackCueBox::TextTrackCueBox(Document* document, TextTrackCue* cue)95 : HTMLElement(divTag, document)96 , m_cue(cue)97 {98 }99 100 TextTrackCue* TextTrackCueBox::getCue() const101 {102 return m_cue;103 }104 105 void TextTrackCueBox::applyCSSProperties()106 {107 // FIXME: Apply all the initial CSS positioning properties. http://wkb.ug/79916108 109 // 3.5.1 On the (root) List of WebVTT Node Objects:110 111 // the 'position' property must be set to 'absolute'112 setInlineStyleProperty(CSSPropertyPosition, CSSValueAbsolute);113 114 // the 'unicode-bidi' property must be set to 'plaintext'115 setInlineStyleProperty(CSSPropertyUnicodeBidi, CSSValueWebkitPlaintext);116 117 // FIXME: Determine the text direction using the BIDI algorithm. http://wkb.ug/79749118 // the 'direction' property must be set to direction119 setInlineStyleProperty(CSSPropertyDirection, CSSValueLtr);120 121 // the 'writing-mode' property must be set to writing-mode122 setInlineStyleProperty(CSSPropertyWebkitWritingMode, m_cue->getCSSWritingMode(), false);123 124 std::pair<float, float> position = m_cue->getCSSPosition();125 126 // the 'top' property must be set to top,127 setInlineStyleProperty(CSSPropertyTop, static_cast<double>(position.second), CSSPrimitiveValue::CSS_PERCENTAGE);128 129 // the 'left' property must be set to left130 setInlineStyleProperty(CSSPropertyLeft, static_cast<double>(position.first), CSSPrimitiveValue::CSS_PERCENTAGE);131 132 // the 'width' property must be set to width, and the 'height' property must be set to height133 if (m_cue->vertical() == horizontalKeyword()) {134 setInlineStyleProperty(CSSPropertyWidth, static_cast<double>(m_cue->getCSSSize()), CSSPrimitiveValue::CSS_PERCENTAGE);135 setInlineStyleProperty(CSSPropertyHeight, CSSValueAuto);136 } else {137 setInlineStyleProperty(CSSPropertyWidth, CSSValueAuto);138 setInlineStyleProperty(CSSPropertyHeight, static_cast<double>(m_cue->getCSSSize()), CSSPrimitiveValue::CSS_PERCENTAGE);139 }140 141 // The 'text-align' property on the (root) List of WebVTT Node Objects must142 // be set to the value in the second cell of the row of the table below143 // whose first cell is the value of the corresponding cue's text track cue144 // alignment:145 if (m_cue->align() == startKeyword())146 setInlineStyleProperty(CSSPropertyTextAlign, CSSValueStart);147 else if (m_cue->align() == endKeyword())148 setInlineStyleProperty(CSSPropertyTextAlign, CSSValueEnd);149 else150 setInlineStyleProperty(CSSPropertyTextAlign, CSSValueCenter);151 152 if (!m_cue->snapToLines()) {153 // 10.13.1 Set up x and y:154 // Note: x and y are set through the CSS left and top above.155 156 // 10.13.2 Position the boxes in boxes such that the point x% along the157 // width of the bounding box of the boxes in boxes is x% of the way158 // across the width of the video's rendering area, and the point y%159 // along the height of the bounding box of the boxes in boxes is y%160 // of the way across the height of the video's rendering area, while161 // maintaining the relative positions of the boxes in boxes to each162 // other.163 setInlineStyleProperty(CSSPropertyWebkitTransform,164 String::format("translate(-%.2f%%, -%.2f%%)", position.first, position.second));165 166 setInlineStyleProperty(CSSPropertyWhiteSpace, CSSValuePre);167 }168 }169 170 const AtomicString& TextTrackCueBox::shadowPseudoId() const171 {172 DEFINE_STATIC_LOCAL(const AtomicString, trackDisplayBoxShadowPseudoId, ("-webkit-media-text-track-display"));173 return trackDisplayBoxShadowPseudoId;174 }175 176 RenderObject* TextTrackCueBox::createRenderer(RenderArena* arena, RenderStyle*)177 {178 return new (arena) RenderTextTrackCue(this);179 }180 181 // ----------------------------182 90 183 91 TextTrackCue::TextTrackCue(ScriptExecutionContext* context, const String& id, double start, double end, const String& content, const String& settings, bool pauseOnExit) … … 202 110 , m_futureDocumentNodes(HTMLDivElement::create(static_cast<Document*>(context))) 203 111 , m_displayTreeShouldChange(true) 204 , m_displayTree(TextTrackCueBox::create(static_cast<Document*>(m_scriptExecutionContext), this)) 112 , m_displayTree(HTMLDivElement::create(static_cast<Document*>(context))) 113 , m_displayXPosition(undefinedPosition) 114 , m_displayYPosition(undefinedPosition) 205 115 { 206 116 ASSERT(m_scriptExecutionContext->isDocument()); 207 117 208 // 4. If the text track cue writing direction is horizontal, then let 209 // writing-mode be 'horizontal-tb'. Otherwise, if the text track cue writing 210 // direction is vertical growing left, then let writing-mode be 211 // 'vertical-rl'. Otherwise, the text track cue writing direction is 212 // vertical growing right; let writing-mode be 'vertical-lr'. 118 // The text track cue writing directions are directly relatd to the 119 // block-flow element, which can be set through the CSS writing modes. 213 120 m_displayWritingModeMap[Horizontal] = CSSValueHorizontalTb; 214 m_displayWritingModeMap[VerticalGrowingLeft] = CSSValueVertical Rl;215 m_displayWritingModeMap[VerticalGrowingRight] = CSSValueVertical Lr;121 m_displayWritingModeMap[VerticalGrowingLeft] = CSSValueVerticalLr; 122 m_displayWritingModeMap[VerticalGrowingRight] = CSSValueVerticalRl; 216 123 217 124 parseSettings(settings); … … 537 444 // Otherwise, it is the value returned by the following algorithm: 538 445 539 // If cue is not associated with a text track, return -1 and abort these 540 // steps. 541 if (!track()) 542 return -1; 543 544 // Let n be the number of text tracks whose text track mode is showing or 545 // showing by default and that are in the media element's list of text 546 // tracks before track. 547 548 // FIXME: Add a method to cache the track index considering only 549 // rendered tracks (that have showing or showing by default mode set). 550 // http://wkb.ug/93779 551 int n = track()->trackIndex(); 552 553 // Increment n by one. 554 n++; 555 556 // Negate n. 557 n = -n; 558 559 return n; 446 // FIXME(BUG 79751): Complete determination algorithm when it is actually 447 // used - when displaying a TextTrackCue having snap-to-lines flag set. 448 449 return 100; 560 450 } 561 451 … … 571 461 // track cue writing direction is vertical growing right; let block-flow be 572 462 // 'rl'. 463 573 464 m_displayWritingMode = m_displayWritingModeMap[m_writingDirection]; 574 465 … … 579 470 || (m_writingDirection == Horizontal && m_cueAlignment == End && m_displayDirection == CSSValueRtl) 580 471 || (m_writingDirection == VerticalGrowingLeft && m_cueAlignment == Start) 581 || (m_writingDirection == VerticalGrowingRight && m_cueAlignment == Start)) {472 || (m_writingDirection == VerticalGrowingRight && m_cueAlignment == End)) { 582 473 maximumSize = 100 - m_textPosition; 583 474 } else if ((m_writingDirection == Horizontal && m_cueAlignment == End && m_displayDirection == CSSValueLtr) … … 595 486 m_displaySize = std::min(m_cueSize, maximumSize); 596 487 488 // 10.7 If the text track cue writing direction is horizontal, then let 489 // width be 'size vw' and height be 'auto'. Otherwise, let width be 'auto' 490 // and height be 'size vh'. (These are CSS values used by the next section 491 // to set CSS properties for the rendering; 'vw' and 'vh' are CSS units.) 492 m_displayWidth = m_writingDirection == Horizontal ? m_displaySize : autoSize; 493 m_displayHeight = m_writingDirection == Horizontal ? autoSize : m_displaySize; 494 597 495 // 10.8 Determine the value of x-position or y-position for cue as per the 598 496 // appropriate rules from the following list: 599 if (m_writingDirection == Horizontal) { 600 if (m_cueAlignment == Start) { 601 if (m_displayDirection == CSSValueLtr) 602 m_displayPosition.first = m_textPosition; 603 else 604 m_displayPosition.first = 100 - m_textPosition - m_displaySize; 605 } else if (m_cueAlignment == End) { 606 if (m_displayDirection == CSSValueRtl) 607 m_displayPosition.first = 100 - m_textPosition; 608 else 609 m_displayPosition.first = m_textPosition - m_displaySize; 610 } 497 if ((m_writingDirection == Horizontal && m_cueAlignment == Start && m_displayDirection == CSSValueLtr) 498 || (m_writingDirection == Horizontal && m_cueAlignment == End && m_displayDirection == CSSValueRtl)) { 499 m_displayXPosition = m_textPosition; 500 } else if ((m_writingDirection == Horizontal && m_cueAlignment == End && m_displayDirection == CSSValueLtr) 501 || (m_writingDirection == Horizontal && m_cueAlignment == Start && m_displayDirection == CSSValueRtl)) { 502 m_displayXPosition = 100 - m_textPosition; 611 503 } 612 504 613 505 if ((m_writingDirection == VerticalGrowingLeft && m_cueAlignment == Start) 614 506 || (m_writingDirection == VerticalGrowingRight && m_cueAlignment == Start)) { 615 m_display Position.second= m_textPosition;507 m_displayYPosition = m_textPosition; 616 508 } else if ((m_writingDirection == VerticalGrowingLeft && m_cueAlignment == End) 617 509 || (m_writingDirection == VerticalGrowingRight && m_cueAlignment == End)) { 618 m_display Position.second= 100 - m_textPosition;510 m_displayYPosition = 100 - m_textPosition; 619 511 } 620 512 621 513 if (m_writingDirection == Horizontal && m_cueAlignment == Middle) { 622 if (m_displayDirection == CSSValueLtr)623 m_displayPosition.first = m_textPosition - m_displaySize / 2; 624 else625 m_display Position.first = 100 - m_textPosition - m_displaySize / 2;514 m_displayXPosition = m_textPosition - m_displaySize / 2; 515 516 if (m_displayDirection == CSSValueRtl) 517 m_displayXPosition = 100 - m_displayXPosition; 626 518 } 627 519 628 520 if ((m_writingDirection == VerticalGrowingLeft && m_cueAlignment == Middle) 629 521 || (m_writingDirection == VerticalGrowingRight && m_cueAlignment == Middle)) 630 m_display Position.second= m_textPosition - m_displaySize / 2;522 m_displayYPosition = m_textPosition - m_displaySize / 2; 631 523 632 524 // 10.9 Determine the value of whichever of x-position or y-position is not 633 525 // yet calculated for cue as per the appropriate rules from the following 634 526 // list: 635 if (m_snapToLines && m_display Position.second== undefinedPosition && m_writingDirection == Horizontal)636 m_display Position.second= 0;637 638 if (!m_snapToLines && m_ displayPosition.second == undefinedPosition && m_writingDirection == Horizontal)639 m_display Position.second= m_computedLinePosition;640 641 if (m_snapToLines && m_display Position.first== undefinedPosition527 if (m_snapToLines && m_displayYPosition == undefinedPosition && m_writingDirection == Horizontal) 528 m_displayYPosition = 0; 529 530 if (!m_snapToLines && m_writingDirection == Horizontal) 531 m_displayYPosition = m_computedLinePosition; 532 533 if (m_snapToLines && m_displayXPosition == undefinedPosition 642 534 && (m_writingDirection == VerticalGrowingLeft || m_writingDirection == VerticalGrowingRight)) 643 m_display Position.first= 0;535 m_displayXPosition = 0; 644 536 645 537 if (!m_snapToLines && (m_writingDirection == VerticalGrowingLeft || m_writingDirection == VerticalGrowingRight)) 646 m_displayPosition.first = m_computedLinePosition; 538 m_displayXPosition = m_computedLinePosition; 539 540 // 10.10 Let left be 'x-position vw' and top be 'y-position vh'. 541 542 // FIXME(Bug 79916): CSS top and left properties need to be applied. 647 543 } 648 544 … … 692 588 } 693 589 694 PassRefPtr<TextTrackCueBox> TextTrackCue::getDisplayTree() 695 { 590 PassRefPtr<HTMLDivElement> TextTrackCue::getDisplayTree() 591 { 592 DEFINE_STATIC_LOCAL(const AtomicString, trackDisplayBoxShadowPseudoId, ("-webkit-media-text-track-display")); 593 696 594 if (!m_displayTreeShouldChange) 697 595 return m_displayTree; … … 703 601 // following constraints, thus obtaining a set of CSS boxes positioned 704 602 // relative to an initial containing block: 603 m_displayTree->setShadowPseudoId(trackDisplayBoxShadowPseudoId, ASSERT_NO_EXCEPTION); 705 604 m_displayTree->removeChildren(); 706 605 … … 726 625 // but if there is a particularly long word, it does not overflow as it 727 626 // normally would in CSS, it is instead forcibly wrapped at the box's edge.) 728 m_displayTree->applyCSSProperties(); 627 628 // FIXME(BUG 79916): CSS width property should be set to 'size vw', when the 629 // maximum cue size computation is corrected in the specification. 630 if (m_snapToLines) 631 m_displayTree->setInlineStyleProperty(CSSPropertyWidth, (double) m_cueSize, CSSPrimitiveValue::CSS_PERCENTAGE); 632 633 // FIXME(BUG 79750, 79751): Steps 10.12 - 10.14 634 635 if (!m_snapToLines) { 636 std::pair<double, double> position = getPositionCoordinates(); 637 638 // 10.13.1 Set up x and y: 639 m_displayTree->setInlineStyleProperty(CSSPropertyLeft, position.first, CSSPrimitiveValue::CSS_PERCENTAGE); 640 m_displayTree->setInlineStyleProperty(CSSPropertyTop, position.second, CSSPrimitiveValue::CSS_PERCENTAGE); 641 642 // 10.13.2 Position the boxes in boxes such that the point x% along the 643 // width of the bounding box of the boxes in boxes is x% of the way 644 // across the width of the video's rendering area, and the point y% 645 // along the height of the bounding box of the boxes in boxes is y% 646 // of the way across the height of the video's rendering area, while 647 // maintaining the relative positions of the boxes in boxes to each 648 // other. 649 String translateX = "-" + String::number(position.first) + "%"; 650 String translateY = "-" + String::number(position.second) + "%"; 651 String webkitTransformTranslateValue = "translate(" + translateX + "," + translateY + ")"; 652 653 m_displayTree->setInlineStyleProperty(CSSPropertyWebkitTransform, 654 webkitTransformTranslateValue); 655 656 m_displayTree->setInlineStyleProperty(CSSPropertyWhiteSpace, 657 CSSValuePre); 658 } 729 659 730 660 if (m_hasInnerTimestamps) … … 744 674 } 745 675 746 std::pair<double, double> TextTrackCue::getPositionCoordinates() const 747 { 748 // This method is used for setting x and y when snap to lines is not set. 676 std::pair<double, double> TextTrackCue::getPositionCoordinates() 677 { 749 678 std::pair<double, double> coordinates; 750 679 … … 1001 930 } 1002 931 1003 int TextTrackCue::getCSSWritingMode() const1004 {1005 return m_displayWritingMode;1006 }1007 1008 int TextTrackCue::getCSSSize() const1009 {1010 return m_displaySize;1011 }1012 1013 std::pair<double, double> TextTrackCue::getCSSPosition() const1014 {1015 if (!m_snapToLines)1016 return getPositionCoordinates();1017 1018 return m_displayPosition;1019 }1020 1021 932 const AtomicString& TextTrackCue::interfaceName() const 1022 933 { -
trunk/Source/WebCore/html/track/TextTrackCue.h
r126233 r126238 35 35 36 36 #include "EventTarget.h" 37 #include "HTMLElement.h"38 37 #include "TextTrack.h" 39 38 #include <wtf/PassOwnPtr.h> … … 43 42 44 43 class DocumentFragment; 45 class HTMLDivElement;46 44 class ScriptExecutionContext; 47 45 class TextTrack; 48 class TextTrackCue; 49 50 // ---------------------------- 51 52 class TextTrackCueBox : public HTMLElement { 53 public: 54 static PassRefPtr<TextTrackCueBox> create(Document* document, TextTrackCue* cue) 55 { 56 return adoptRef(new TextTrackCueBox(document, cue)); 57 } 58 59 TextTrackCue* getCue() const; 60 void applyCSSProperties(); 61 62 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 63 64 private: 65 TextTrackCueBox(Document*, TextTrackCue*); 66 67 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) OVERRIDE; 68 69 TextTrackCue* m_cue; 70 }; 71 72 // ---------------------------- 46 class HTMLDivElement; 73 47 74 48 class TextTrackCue : public RefCounted<TextTrackCue>, public EventTarget { … … 128 102 void setIsActive(bool); 129 103 130 PassRefPtr< TextTrackCueBox> getDisplayTree();104 PassRefPtr<HTMLDivElement> getDisplayTree(); 131 105 void updateDisplayTree(float); 132 106 void removeDisplayTree(); 133 107 134 int calculateComputedLinePosition();135 136 108 virtual const AtomicString& interfaceName() const; 137 109 virtual ScriptExecutionContext* scriptExecutionContext() const; 138 139 std::pair<double, double> getCSSPosition() const;140 int getCSSSize() const;141 int getCSSWritingMode() const;142 143 enum WritingDirection {144 Horizontal,145 VerticalGrowingLeft,146 VerticalGrowingRight,147 NumberOfWritingDirections148 };149 WritingDirection getWritingDirection() const { return m_writingDirection; }150 110 151 111 DEFINE_ATTRIBUTE_EVENT_LISTENER(enter); … … 162 122 TextTrackCue(ScriptExecutionContext*, const String& id, double start, double end, const String& content, const String& settings, bool pauseOnExit); 163 123 164 std::pair<double, double> getPositionCoordinates() const;165 124 void parseSettings(const String&); 166 125 126 int calculateComputedLinePosition(); 167 127 void calculateDisplayParameters(); 128 129 std::pair<double, double> getPositionCoordinates(); 168 130 169 131 void cueWillChange(); … … 186 148 int m_cueIndex; 187 149 150 enum WritingDirection { 151 Horizontal, 152 VerticalGrowingLeft, 153 VerticalGrowingRight, 154 NumberOfWritingDirections 155 }; 188 156 WritingDirection m_writingDirection; 189 157 … … 206 174 207 175 bool m_displayTreeShouldChange; 208 RefPtr< TextTrackCueBox> m_displayTree;176 RefPtr<HTMLDivElement> m_displayTree; 209 177 210 178 int m_displayDirection; … … 217 185 int m_displayWidth; 218 186 219 std::pair<float, float> m_displayPosition; 187 double m_displayXPosition; 188 double m_displayYPosition; 220 189 }; 221 190
Note: See TracChangeset
for help on using the changeset viewer.