Changeset 148050 in webkit
- Timestamp:
- Apr 9, 2013, 1:56:27 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r148049 r148050 1 2013-04-09 Eric Carlson <eric.carlson@apple.com> 2 3 [Mac] user caption styles not applied to correct element 4 https://bugs.webkit.org/show_bug.cgi?id=114230 5 6 Reviewed by Jer Noble. 7 8 * media/track/track-css-user-override-expected.txt: Added. 9 * media/track/track-css-user-override.html: Added. 10 * media/track/track-cue-container-rendering-position-expected.txt: 11 * media/track/track-cue-container-rendering-position.html: 12 * media/track/track-cue-rendering-expected.txt: 13 * media/track/track-cue-rendering.html: Font size is not applied instantly when a video element is 14 resized, so check after a very short delay. 15 1 16 2013-04-09 Simon Fraser <simon.fraser@apple.com> 2 17 -
trunk/LayoutTests/media/track/track-cue-container-rendering-position-expected.txt
r134783 r148050 1 The top of the text track container should be in the bottom 25% of the video element.1 The top of the text track container should be in the bottom 30% of the video element. 2 2 EVENT(canplaythrough) 3 3 4 EXPECTED (cueDisplayElement.offsetTop > (video.videoHeight * .7 5) == 'true') OK4 EXPECTED (cueDisplayElement.offsetTop > (video.videoHeight * .70) == 'true') OK 5 5 END OF TEST 6 6 -
trunk/LayoutTests/media/track/track-cue-container-rendering-position.html
r147675 r148050 21 21 consoleWrite(""); 22 22 cueDisplayElement = textTrackDisplayElement(video, 'display', 0); 23 testExpected("cueDisplayElement.offsetTop > (video.videoHeight * .75)", true); 23 document.body.offsetTop; 24 testExpected("cueDisplayElement.offsetTop > (video.videoHeight * .70)", true); 24 25 endTest(); 25 26 } … … 27 28 function loaded() 28 29 { 29 consoleWrite("The top of the text track container should be in the bottom 25% of the video element.");30 consoleWrite("The top of the text track container should be in the bottom 30% of the video element."); 30 31 31 32 findMediaElement(); -
trunk/LayoutTests/media/track/track-cue-rendering-expected.txt
r132349 r148050 35 35 RUN(video.width = 320) 36 36 RUN(video.height = 240) 37 EXPECTED (getComputedStyle( textTrackDisplayElement(video)).fontSize == '12px') OK37 EXPECTED (getComputedStyle(currentCue).fontSize == '12px') OK 38 38 39 39 RUN(video.width = 640) 40 40 RUN(video.height = 480) 41 EXPECTED (getComputedStyle(textTrackDisplayElement(video)).fontSize == '24px') OK 41 EXPECTED (getComputedStyle(currentCue).fontSize == '24px') OK 42 43 RUN(video.width = 960) 44 RUN(video.height = 720) 45 EXPECTED (getComputedStyle(currentCue).fontSize == '36px') OK 42 46 43 47 RUN(video.width = 1280) 44 48 RUN(video.height = 960) 45 EXPECTED (getComputedStyle( textTrackDisplayElement(video)).fontSize == '48px') OK49 EXPECTED (getComputedStyle(currentCue).fontSize == '48px') OK 46 50 47 RUN(video.width = 2560) 48 RUN(video.height = 1440) 49 EXPECTED (getComputedStyle(textTrackDisplayElement(video )).fontSize == '72px') OK51 EXPECTED (getComputedStyle(currentCue).fontFamily == 'sans-serif') OK 52 EXPECTED (getComputedStyle(currentCue).color == 'rgb(255, 255, 255)') OK 53 EXPECTED (getComputedStyle(textTrackDisplayElement(video, 'display').firstChild).backgroundColor == 'rgba(0, 0, 0, 0.8)') OK 50 54 51 EXPECTED (getComputedStyle(textTrackDisplayElement(video)).fontFamily == 'sans-serif') OK52 EXPECTED (getComputedStyle(textTrackDisplayElement(video)).color == 'rgb(255, 255, 255)') OK53 EXPECTED (getComputedStyle(textTrackDisplayElement(video, 'display').firstChild).backgroundColor == 'rgba(0, 0, 0, 0.796875)'), OBSERVED 'rgba(0, 0, 0, 0.8)' FAIL54 55 END OF TEST 55 56 -
trunk/LayoutTests/media/track/track-cue-rendering.html
r132349 r148050 13 13 var testCueDisplayBox; 14 14 var seekedCount = 0; 15 var resizeCount = 1; 15 16 var info = [ "Lorem", "ipsum", "dolor", "sit" ]; 16 17 17 function testFontSize(width, height)18 function setVideoSize(width, height) 18 19 { 19 20 run("video.width = " + width); 20 21 run("video.height = " + height); 22 } 23 24 function resizeTest() 25 { 21 26 document.body.offsetTop; 22 testExpected("getComputedStyle(textTrackDisplayElement(video)).fontSize", parseInt(height * 0.05) + "px"); 27 currentCue = textTrackDisplayElement(video, 'cue'); 28 testExpected("getComputedStyle(currentCue).fontSize", parseInt(240 * resizeCount * 0.05) + "px"); 23 29 consoleWrite(""); 30 31 if (++resizeCount < 5) { 32 setVideoSize(320 * resizeCount, 240 * resizeCount); 33 setTimeout(resizeTest, 10); 34 return 35 } 36 37 testExpected("getComputedStyle(currentCue).fontFamily", "sans-serif"); 38 testExpected("getComputedStyle(currentCue).color", "rgb(255, 255, 255)"); 39 testExpected("getComputedStyle(textTrackDisplayElement(video, 'display').firstChild).backgroundColor", "rgba(0, 0, 0, 0.8)"); 40 41 consoleWrite(""); 42 endTest(); 43 44 // Resize the video so it is easier to interact with it manually, if necessary. 45 video.width = 320; 46 video.height = 240; 24 47 } 25 48 … … 27 50 { 28 51 consoleWrite("<br>Test the cue display colors and font."); 29 testFontSize(320, 240); 30 testFontSize(640, 480); 31 testFontSize(1280, 960); 32 testFontSize(2560, 1440); 33 34 testExpected("getComputedStyle(textTrackDisplayElement(video)).fontFamily", "sans-serif"); 35 testExpected("getComputedStyle(textTrackDisplayElement(video)).color", "rgb(255, 255, 255)"); 36 testExpected("getComputedStyle(textTrackDisplayElement(video, 'display').firstChild).backgroundColor", "rgba(0, 0, 0, 0.796875)"); 37 38 endTest(); 39 40 // Resize the video so it is easier to interact with it manually, if necessary. 41 video.width = 320; 42 video.height = 240; 52 setVideoSize(320, 240); 53 setTimeout(resizeTest, 10); 43 54 } 44 55 -
trunk/Source/WebCore/ChangeLog
r148049 r148050 1 2013-04-09 Eric Carlson <eric.carlson@apple.com> 2 3 [Mac] user caption styles not applied to correct element 4 https://bugs.webkit.org/show_bug.cgi?id=114230 5 6 Reviewed by Jer Noble. 7 8 Test: media/track/track-css-user-override.html 9 10 * html/HTMLMediaElement.cpp: 11 (WebCore::HTMLMediaElement::updateActiveTextTrackCues): Drive by clean-up so we don't log excessively. 12 13 * html/shadow/MediaControlElements.cpp: 14 (WebCore::MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement): Initialize 15 new member variables. 16 (WebCore::MediaControlTextTrackContainerElement::updateDisplay): Set cue font size when it is 17 inserted into the tree. 18 (WebCore::MediaControlTextTrackContainerElement::updateTimerFired): Update the font size of 19 all active cues. 20 (WebCore::MediaControlTextTrackContainerElement::updateSizes): Set size-relative CSS properties 21 after a time because this can be called during layout. 22 * html/shadow/MediaControlElements.h: 23 24 * html/shadow/MediaControls.cpp: 25 (WebCore::MediaControls::textTrackPreferencesChanged): Call closedCaptionTracksChanged before updateSizes. 26 27 * html/track/TextTrackCue.cpp: 28 (WebCore::TextTrackCue::setFontSize): New, set the cue's font size. 29 * html/track/TextTrackCue.h: 30 31 * html/track/TextTrackCueGeneric.cpp: 32 (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties): Set cue properties on the cue element 33 instead of on the cue box to match what we do for the "cue" pseudo element. 34 (WebCore::TextTrackCueGeneric::setFontSize): New, set the cue's font size. 35 * html/track/TextTrackCueGeneric.h: 36 37 * html/track/TextTrackList.cpp: 38 (TextTrackList::remove): Drive-by cleanup, don't ASSERT when the media element is NULL. 39 40 * page/CaptionUserPreferences.cpp: 41 (WebCore::CaptionUserPreferences::setCaptionsStyleSheetOverride): New, allow user CSS overrides 42 to be tested in DRT. 43 (WebCore::CaptionUserPreferences::updateCaptionStyleSheetOveride): New, generate a user style 44 sheet override. Moved here from CaptionUserPreferencesMac. 45 * page/CaptionUserPreferences.h: 46 47 * page/CaptionUserPreferencesMac.h: 48 * page/CaptionUserPreferencesMac.mm: 49 (WebCore::CaptionUserPreferencesMac::captionsBackgroundCSS): Don't ignore background color importance. 50 (WebCore::CaptionUserPreferencesMac::captionsStyleSheetOverride): Implement even when we don't 51 have the media accessibility framework so this can be tested in DRT. Apply all cue properties 52 to the element used for the "cue" pseudo element. 53 54 * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: 55 (WebCore::MediaPlayerPrivateAVFoundation::didLoadingProgress): Drive-by cleanup, remove logging 56 because this method is called so frequently and the logging is not especially useful. 57 (WebCore::MediaPlayerPrivateAVFoundation::updateStates): Only log when the ready/network 58 state changes because this method is called so frequently. 59 60 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: 61 (WebCore::MediaPlayerPrivateAVFoundationObjC::platformLayer): Drive-by cleanup, remove logging 62 because this method is called so frequently and the logging is not especially useful. 63 (WebCore::MediaPlayerPrivateAVFoundationObjC::setCurrentTrack): Make the logging more useful. 64 65 * testing/Internals.cpp: 66 (WebCore::Internals::resetToConsistentState): Reset captions style sheet override. 67 (WebCore::Internals::captionsStyleSheetOverride): New, return the captions style sheet override. 68 (WebCore::Internals::setCaptionsStyleSheetOverride): New, override the captions style sheet override. 69 * testing/Internals.h: 70 * testing/Internals.idl: 71 1 72 2013-04-08 Simon Fraser <simon.fraser@apple.com> 2 73 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r147888 r148050 1082 1082 void HTMLMediaElement::updateActiveTextTrackCues(float movieTime) 1083 1083 { 1084 LOG(Media, "HTMLMediaElement::updateActiveTextTracks");1085 1086 1084 // 4.8.10.8 Playing the media resource 1087 1085 … … 1091 1089 if (ignoreTrackDisplayUpdateRequests()) 1092 1090 return; 1091 1092 LOG(Media, "HTMLMediaElement::updateActiveTextTracks"); 1093 1093 1094 1094 // 1 - Let current cues be a list of cues, initialized to contain all the -
trunk/Source/WebCore/html/shadow/MediaControlElements.cpp
r147675 r148050 1189 1189 MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement(Document* document) 1190 1190 : MediaControlDivElement(document, MediaTextTrackDisplayContainer) 1191 , m_updateTimer(this, &MediaControlTextTrackContainerElement::updateTimerFired) 1191 1192 , m_fontSize(0) 1193 , m_fontSizeIsImportant(false) 1192 1194 { 1193 1195 } … … 1276 1278 1277 1279 RefPtr<TextTrackCueBox> displayBox = cue->getDisplayTree(m_videoDisplaySize.size()); 1278 if (displayBox->hasChildNodes() && !contains(static_cast<Node*>(displayBox.get()))) 1280 if (displayBox->hasChildNodes() && !contains(static_cast<Node*>(displayBox.get()))) { 1279 1281 // Note: the display tree of a cue is removed when the active flag of the cue is unset. 1280 1282 appendChild(displayBox, ASSERT_NO_EXCEPTION, AttachNow); 1283 cue->setFontSize(m_fontSize, m_videoDisplaySize.size(), m_fontSizeIsImportant); 1284 } 1281 1285 } 1282 1286 … … 1302 1306 removeInlineStyleProperty(CSSPropertyWidth); 1303 1307 removeInlineStyleProperty(CSSPropertyHeight); 1308 } 1309 } 1310 1311 void MediaControlTextTrackContainerElement::updateTimerFired(Timer<MediaControlTextTrackContainerElement>*) 1312 { 1313 if (!document()->page()) 1314 return; 1315 1316 if (m_textTrackRepresentation) { 1317 setInlineStyleProperty(CSSPropertyWidth, String::number(m_videoDisplaySize.size().width()) + "px"); 1318 setInlineStyleProperty(CSSPropertyHeight, String::number(m_videoDisplaySize.size().height()) + "px"); 1319 } 1320 1321 HTMLMediaElement* mediaElement = toParentMediaElement(this); 1322 if (!mediaElement) 1323 return; 1324 1325 float smallestDimension = std::min(m_videoDisplaySize.size().height(), m_videoDisplaySize.size().width()); 1326 float fontScale = document()->page()->group().captionPreferences()->captionFontSizeScaleAndImportance(m_fontSizeIsImportant); 1327 m_fontSize = lrintf(smallestDimension * fontScale); 1328 1329 CueList activeCues = mediaElement->currentlyActiveCues(); 1330 for (size_t i = 0; i < activeCues.size(); ++i) { 1331 TextTrackCue* cue = activeCues[i].data(); 1332 cue->setFontSize(m_fontSize, m_videoDisplaySize.size(), m_fontSizeIsImportant); 1333 1304 1334 } 1305 1335 } … … 1334 1364 m_videoDisplaySize = videoBox; 1335 1365 1336 if (m_textTrackRepresentation) { 1337 setInlineStyleProperty(CSSPropertyWidth, String::number(m_videoDisplaySize.size().width()) + "px"); 1338 setInlineStyleProperty(CSSPropertyHeight, String::number(m_videoDisplaySize.size().height()) + "px"); 1339 } 1340 1341 float smallestDimension = std::min(m_videoDisplaySize.size().height(), m_videoDisplaySize.size().width()); 1342 1343 bool important; 1344 float fontSize = smallestDimension * (document()->page()->group().captionPreferences()->captionFontSizeScale(important)); 1345 if (fontSize != m_fontSize) { 1346 m_fontSize = fontSize; 1347 setInlineStyleProperty(CSSPropertyFontSize, String::number(fontSize) + "px", important); 1348 } 1349 1350 CueList activeCues = mediaElement->currentlyActiveCues(); 1351 for (size_t i = 0; i < activeCues.size(); ++i) { 1352 TextTrackCue* cue = activeCues[i].data(); 1353 cue->videoSizeDidChange(m_videoDisplaySize.size()); 1354 } 1366 m_updateTimer.startOneShot(0); 1355 1367 } 1356 1368 -
trunk/Source/WebCore/html/shadow/MediaControlElements.h
r147675 r148050 449 449 450 450 private: 451 void updateTimerFired(Timer<MediaControlTextTrackContainerElement>*); 452 451 453 explicit MediaControlTextTrackContainerElement(Document*); 452 454 virtual const AtomicString& shadowPseudoId() const OVERRIDE; … … 458 460 OwnPtr<TextTrackRepresentation> m_textTrackRepresentation; 459 461 462 Timer<MediaControlTextTrackContainerElement> m_updateTimer; 460 463 IntRect m_videoDisplaySize; 461 float m_fontSize; 464 int m_fontSize; 465 bool m_fontSizeIsImportant; 462 466 }; 463 467 -
trunk/Source/WebCore/html/shadow/MediaControls.cpp
r146380 r148050 410 410 void MediaControls::textTrackPreferencesChanged() 411 411 { 412 closedCaptionTracksChanged(); 412 413 if (m_textDisplayContainer) 413 414 m_textDisplayContainer->updateSizes(true); 414 closedCaptionTracksChanged();415 415 } 416 416 #endif -
trunk/Source/WebCore/html/track/TextTrackCue.cpp
r147355 r148050 43 43 #include "HTMLMediaElement.h" 44 44 #include "HTMLSpanElement.h" 45 #include "Logging.h" 45 46 #include "NodeTraversal.h" 46 47 #include "RenderTextTrackCue.h" … … 1180 1181 } 1181 1182 1183 void TextTrackCue::setFontSize(int fontSize, const IntSize&, bool important) 1184 { 1185 if (!hasDisplayTree() || !fontSize) 1186 return; 1187 1188 LOG(Media, "TextTrackCue::setFontSize - setting cue font size to %i", fontSize); 1189 1190 element()->setInlineStyleProperty(CSSPropertyFontSize, String::number(fontSize) + "px", important); 1191 } 1192 1182 1193 } // namespace WebCore 1183 1194 -
trunk/Source/WebCore/html/track/TextTrackCue.h
r147355 r148050 178 178 CueAlignment getAlignment() const { return m_cueAlignment; } 179 179 180 virtual void videoSizeDidChange(const IntSize&) { }180 virtual void setFontSize(int, const IntSize&, bool important); 181 181 182 182 virtual bool operator==(const TextTrackCue&) const; -
trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp
r146140 r148050 35 35 #include "HTMLNames.h" 36 36 #include "InbandTextTrackPrivateClient.h" 37 #include "Logging.h" 37 38 #include "RenderObject.h" 38 39 #include "RenderTextTrackCue.h" … … 66 67 67 68 TextTrackCueGeneric* cue = static_cast<TextTrackCueGeneric*>(getCue()); 69 RefPtr<HTMLDivElement> cueElement = cue->element(); 68 70 69 71 float size = static_cast<float>(cue->getCSSSize()); … … 82 84 83 85 if (cue->foregroundColor().isValid()) 84 setInlineStyleProperty(CSSPropertyColor, cue->foregroundColor().serialized());86 cueElement->setInlineStyleProperty(CSSPropertyColor, cue->foregroundColor().serialized()); 85 87 86 88 if (cue->backgroundColor().isValid()) 87 cue ->element()->setInlineStyleProperty(CSSPropertyBackgroundColor, cue->backgroundColor().serialized());89 cueElement->setInlineStyleProperty(CSSPropertyBackgroundColor, cue->backgroundColor().serialized()); 88 90 89 91 if (cue->getWritingDirection() == TextTrackCue::Horizontal) … … 92 94 setInlineStyleProperty(CSSPropertyWidth, CSSValueAuto); 93 95 94 if (cue->baseFontSizeRelativeToVideoHeight()) { 95 double fontSize = videoSize.height() * cue->baseFontSizeRelativeToVideoHeight() / 100; 96 if (cue->fontSizeMultiplier()) 97 fontSize *= cue->fontSizeMultiplier() / 100; 98 setInlineStyleProperty(CSSPropertyFontSize, String::number(fontSize) + "px"); 99 } 96 if (cue->baseFontSizeRelativeToVideoHeight()) 97 cue->setFontSize(cue->baseFontSizeRelativeToVideoHeight(), videoSize, false); 100 98 101 99 if (cue->getAlignment() == TextTrackCue::Middle) … … 136 134 } 137 135 138 void TextTrackCueGeneric:: videoSizeDidChange(const IntSize& videoSize)136 void TextTrackCueGeneric::setFontSize(int fontSize, const IntSize& videoSize, bool important) 139 137 { 140 if (!hasDisplayTree() )138 if (!hasDisplayTree() || !fontSize) 141 139 return; 142 143 if (baseFontSizeRelativeToVideoHeight()) { 144 double fontSize = videoSize.height() * baseFontSizeRelativeToVideoHeight() / 100; 145 if (fontSizeMultiplier()) 146 fontSize *= fontSizeMultiplier() / 100; 147 displayTreeInternal()->setInlineStyleProperty(CSSPropertyFontSize, String::number(fontSize) + "px"); 140 141 if (important || !baseFontSizeRelativeToVideoHeight()) { 142 TextTrackCue::setFontSize(fontSize, videoSize, important); 143 return; 148 144 } 149 145 146 double size = videoSize.height() * baseFontSizeRelativeToVideoHeight() / 100; 147 if (fontSizeMultiplier()) 148 size *= fontSizeMultiplier() / 100; 149 element()->setInlineStyleProperty(CSSPropertyFontSize, String::number(lrintf(size)) + "px"); 150 151 LOG(Media, "TextTrackCueGeneric::setFontSize - setting cue font size to %li", lrintf(size)); 150 152 } 151 153 152 154 bool TextTrackCueGeneric::operator==(const TextTrackCue& cue) const 153 155 { -
trunk/Source/WebCore/html/track/TextTrackCueGeneric.h
r146140 r148050 69 69 void setBackgroundColor(RGBA32 color) { m_backgroundColor.setRGB(color); } 70 70 71 virtual void videoSizeDidChange(const IntSize&);71 virtual void setFontSize(int, const IntSize&, bool important) OVERRIDE; 72 72 73 73 virtual bool operator==(const TextTrackCue&) const OVERRIDE; -
trunk/Source/WebCore/html/track/TextTrackList.cpp
r146380 r148050 206 206 invalidateTrackIndexesAfterTrack(track); 207 207 208 ASSERT( track->mediaElement() == m_owner);208 ASSERT(!track->mediaElement() || track->mediaElement() == m_owner); 209 209 track->setMediaElement(0); 210 210 -
trunk/Source/WebCore/page/CaptionUserPreferences.cpp
r147675 r148050 29 29 30 30 #include "CaptionUserPreferences.h" 31 #include "DOMWrapperWorld.h" 31 32 #include "Page.h" 32 33 #include "PageGroup.h" 33 34 #include "Settings.h" 34 35 #include "TextTrackList.h" 36 #include "UserStyleSheetTypes.h" 35 37 #include <wtf/NonCopyingSort.h> 36 38 … … 222 224 } 223 225 226 void CaptionUserPreferences::setCaptionsStyleSheetOverride(const String& override) 227 { 228 m_captionsStyleSheetOverride = override; 229 updateCaptionStyleSheetOveride(); 230 } 231 232 void CaptionUserPreferences::updateCaptionStyleSheetOveride() 233 { 234 // Identify our override style sheet with a unique URL - a new scheme and a UUID. 235 DEFINE_STATIC_LOCAL(KURL, captionsStyleSheetURL, (ParsedURLString, "user-captions-override:01F6AF12-C3B0-4F70-AF5E-A3E00234DC23")); 236 237 pageGroup()->removeUserStyleSheetFromWorld(mainThreadNormalWorld(), captionsStyleSheetURL); 238 239 String captionsOverrideStyleSheet = captionsStyleSheetOverride(); 240 if (captionsOverrideStyleSheet.isEmpty()) 241 return; 242 243 pageGroup()->addUserStyleSheetToWorld(mainThreadNormalWorld(), captionsOverrideStyleSheet, captionsStyleSheetURL, Vector<String>(), 244 Vector<String>(), InjectInAllFrames, UserStyleAuthorLevel, InjectInExistingDocuments); 245 } 246 247 224 248 } 225 249 -
trunk/Source/WebCore/page/CaptionUserPreferences.h
r147675 r148050 67 67 virtual void setUserPrefersTextDescriptions(bool preference); 68 68 69 virtual float captionFontSizeScale(bool& important) const { important = false; return 0.05f; } 70 virtual String captionsStyleSheetOverride() const { return emptyString(); } 69 virtual float captionFontSizeScaleAndImportance(bool& important) const { important = false; return 0.05f; } 70 71 virtual String captionsStyleSheetOverride() const { return m_captionsStyleSheetOverride; } 72 virtual void setCaptionsStyleSheetOverride(const String&); 71 73 72 74 virtual void setInterestedInCaptionPreferenceChanges() { } … … 87 89 protected: 88 90 CaptionUserPreferences(PageGroup*); 91 void updateCaptionStyleSheetOveride(); 89 92 90 93 private: … … 96 99 Timer<CaptionUserPreferences> m_timer; 97 100 String m_userPreferredLanguage; 101 String m_captionsStyleSheetOverride; 98 102 bool m_testingMode; 99 103 bool m_havePreferences; -
trunk/Source/WebCore/page/CaptionUserPreferencesMac.h
r147675 r148050 48 48 virtual bool userPrefersSubtitles() const OVERRIDE; 49 49 50 virtual float captionFontSizeScale(bool&) const OVERRIDE; 51 virtual String captionsStyleSheetOverride() const OVERRIDE; 50 virtual float captionFontSizeScaleAndImportance(bool&) const OVERRIDE; 52 51 53 52 virtual void setInterestedInCaptionPreferenceChanges() OVERRIDE; … … 57 56 58 57 virtual void captionPreferencesChanged() OVERRIDE; 59 60 58 #endif 61 59 60 virtual String captionsStyleSheetOverride() const OVERRIDE; 62 61 virtual int textTrackSelectionScore(TextTrack*, HTMLMediaElement*) const OVERRIDE; 63 62 virtual Vector<RefPtr<TextTrack> > sortedTrackListForMenu(TextTrackList*) OVERRIDE; … … 79 78 String colorPropertyCSS(CSSPropertyID, const Color&, bool) const; 80 79 81 void updateCaptionStyleSheetOveride();82 83 80 bool m_listeningForPreferenceChanges; 84 81 #endif -
trunk/Source/WebCore/page/CaptionUserPreferencesMac.mm
r147675 r148050 251 251 252 252 bool important = behavior == kMACaptionAppearanceBehaviorUseValue; 253 CGFloat opacity = MACaptionAppearanceGetBackgroundOpacity(kMACaptionAppearanceDomainUser, 0);253 CGFloat opacity = MACaptionAppearanceGetBackgroundOpacity(kMACaptionAppearanceDomainUser, &behavior); 254 254 if (!important) 255 255 important = behavior == kMACaptionAppearanceBehaviorUseValue; … … 417 417 } 418 418 419 String CaptionUserPreferencesMac::captionsStyleSheetOverride() const419 float CaptionUserPreferencesMac::captionFontSizeScaleAndImportance(bool& important) const 420 420 { 421 421 if (testingMode() || !MediaAccessibilityLibrary()) 422 return CaptionUserPreferences::captionsStyleSheetOverride(); 423 424 StringBuilder captionsOverrideStyleSheet; 425 426 String background = captionsBackgroundCSS(); 427 if (!background.isEmpty()) { 428 captionsOverrideStyleSheet.append(" video::"); 429 captionsOverrideStyleSheet.append(TextTrackCue::cueShadowPseudoId()); 430 captionsOverrideStyleSheet.append('{'); 431 captionsOverrideStyleSheet.append(background); 432 captionsOverrideStyleSheet.append('}'); 433 } 434 435 String windowColor = captionsWindowCSS(); 436 String windowCornerRadius = windowRoundedCornerRadiusCSS(); 437 if (!windowColor.isEmpty() || !windowCornerRadius.isEmpty()) { 438 captionsOverrideStyleSheet.append(" video::"); 439 captionsOverrideStyleSheet.append(TextTrackCueBox::textTrackCueBoxShadowPseudoId()); 440 captionsOverrideStyleSheet.append('{'); 441 442 if (!windowColor.isEmpty()) 443 captionsOverrideStyleSheet.append(windowColor); 444 if (!windowCornerRadius.isEmpty()) 445 captionsOverrideStyleSheet.append(windowCornerRadius); 446 447 captionsOverrideStyleSheet.append('}'); 448 } 449 450 String captionsColor = captionsTextColorCSS(); 451 String edgeStyle = captionsTextEdgeCSS(); 452 String fontName = captionsDefaultFontCSS(); 453 if (!captionsColor.isEmpty() || !edgeStyle.isEmpty() || !fontName.isEmpty()) { 454 captionsOverrideStyleSheet.append(" video::"); 455 captionsOverrideStyleSheet.append(MediaControlTextTrackContainerElement::textTrackContainerElementShadowPseudoId()); 456 captionsOverrideStyleSheet.append('{'); 457 458 if (!captionsColor.isEmpty()) 459 captionsOverrideStyleSheet.append(captionsColor); 460 if (!edgeStyle.isEmpty()) 461 captionsOverrideStyleSheet.append(edgeStyle); 462 if (!fontName.isEmpty()) 463 captionsOverrideStyleSheet.append(fontName); 464 465 captionsOverrideStyleSheet.append('}'); 466 } 467 468 LOG(Media, "CaptionUserPreferencesMac::captionsStyleSheetOverrideSetting sytle to:\n%s", captionsOverrideStyleSheet.toString().utf8().data()); 469 470 return captionsOverrideStyleSheet.toString(); 471 } 472 473 float CaptionUserPreferencesMac::captionFontSizeScale(bool& important) const 474 { 475 if (testingMode() || !MediaAccessibilityLibrary()) 476 return CaptionUserPreferences::captionFontSizeScale(important); 422 return CaptionUserPreferences::captionFontSizeScaleAndImportance(important); 477 423 478 424 MACaptionAppearanceBehavior behavior; 479 CGFloat characterScale = CaptionUserPreferences::captionFontSizeScale (important);425 CGFloat characterScale = CaptionUserPreferences::captionFontSizeScaleAndImportance(important); 480 426 CGFloat scaleAdjustment = MACaptionAppearanceGetRelativeCharacterSize(kMACaptionAppearanceDomainUser, &behavior); 481 427 … … 489 435 return scaleAdjustment * characterScale; 490 436 #endif 491 }492 493 void CaptionUserPreferencesMac::updateCaptionStyleSheetOveride()494 {495 // Identify our override style sheet with a unique URL - a new scheme and a UUID.496 DEFINE_STATIC_LOCAL(KURL, captionsStyleSheetURL, (ParsedURLString, "user-captions-override:01F6AF12-C3B0-4F70-AF5E-A3E00234DC23"));497 498 pageGroup()->removeUserStyleSheetFromWorld(mainThreadNormalWorld(), captionsStyleSheetURL);499 500 String captionsOverrideStyleSheet = captionsStyleSheetOverride();501 if (captionsOverrideStyleSheet.isEmpty())502 return;503 504 pageGroup()->addUserStyleSheetToWorld(mainThreadNormalWorld(), captionsOverrideStyleSheet, captionsStyleSheetURL, Vector<String>(),505 Vector<String>(), InjectInAllFrames, UserStyleAuthorLevel, InjectInExistingDocuments);506 437 } 507 438 … … 550 481 } 551 482 #endif // HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK) 483 484 String CaptionUserPreferencesMac::captionsStyleSheetOverride() const 485 { 486 if (testingMode()) 487 return CaptionUserPreferences::captionsStyleSheetOverride(); 488 489 StringBuilder captionsOverrideStyleSheet; 490 491 #if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK) 492 if (!MediaAccessibilityLibrary()) 493 return CaptionUserPreferences::captionsStyleSheetOverride(); 494 495 String captionsColor = captionsTextColorCSS(); 496 String edgeStyle = captionsTextEdgeCSS(); 497 String fontName = captionsDefaultFontCSS(); 498 String background = captionsBackgroundCSS(); 499 if (!background.isEmpty() || !captionsColor.isEmpty() || !edgeStyle.isEmpty() || !fontName.isEmpty()) { 500 captionsOverrideStyleSheet.append(" video::"); 501 captionsOverrideStyleSheet.append(TextTrackCue::cueShadowPseudoId()); 502 captionsOverrideStyleSheet.append('{'); 503 504 if (!background.isEmpty()) 505 captionsOverrideStyleSheet.append(background); 506 if (!captionsColor.isEmpty()) 507 captionsOverrideStyleSheet.append(captionsColor); 508 if (!edgeStyle.isEmpty()) 509 captionsOverrideStyleSheet.append(edgeStyle); 510 if (!fontName.isEmpty()) 511 captionsOverrideStyleSheet.append(fontName); 512 513 captionsOverrideStyleSheet.append('}'); 514 } 515 516 String windowColor = captionsWindowCSS(); 517 String windowCornerRadius = windowRoundedCornerRadiusCSS(); 518 if (!windowColor.isEmpty() || !windowCornerRadius.isEmpty()) { 519 captionsOverrideStyleSheet.append(" video::"); 520 captionsOverrideStyleSheet.append(TextTrackCueBox::textTrackCueBoxShadowPseudoId()); 521 captionsOverrideStyleSheet.append('{'); 522 523 if (!windowColor.isEmpty()) 524 captionsOverrideStyleSheet.append(windowColor); 525 if (!windowCornerRadius.isEmpty()) 526 captionsOverrideStyleSheet.append(windowCornerRadius); 527 528 captionsOverrideStyleSheet.append('}'); 529 } 530 #endif // HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK) 531 532 LOG(Media, "CaptionUserPreferencesMac::captionsStyleSheetOverrideSetting sytle to:\n%s", captionsOverrideStyleSheet.toString().utf8().data()); 533 534 return captionsOverrideStyleSheet.toString(); 535 } 552 536 553 537 static String languageIdentifier(const String& languageCode) -
trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp
r144565 r148050 392 392 bool didLoadingProgress = currentMaxTimeLoaded != m_maxTimeLoadedAtLastDidLoadingProgress; 393 393 m_maxTimeLoadedAtLastDidLoadingProgress = currentMaxTimeLoaded; 394 LOG(Media, "MediaPlayerPrivateAVFoundation::didLoadingProgress(%p) - returning %d", this, didLoadingProgress); 394 395 395 return didLoadingProgress; 396 396 } … … 433 433 MediaPlayer::NetworkState oldNetworkState = m_networkState; 434 434 MediaPlayer::ReadyState oldReadyState = m_readyState; 435 436 LOG(Media, "MediaPlayerPrivateAVFoundation::updateStates(%p) - entering with networkState = %i, readyState = %i",437 this, static_cast<int>(m_networkState), static_cast<int>(m_readyState));438 435 439 436 if (m_loadingMetadata) … … 523 520 } 524 521 525 LOG(Media, "MediaPlayerPrivateAVFoundation::updateStates(%p) - exiting with networkState = %i, readyState = %i", 526 this, static_cast<int>(m_networkState), static_cast<int>(m_readyState)); 522 #if !LOG_DISABLED 523 if (m_networkState != oldNetworkState || oldReadyState != m_readyState) { 524 LOG(Media, "MediaPlayerPrivateAVFoundation::updateStates(%p) - entered with networkState = %i, readyState = %i, exiting with networkState = %i, readyState = %i", 525 this, static_cast<int>(oldNetworkState), static_cast<int>(oldReadyState), static_cast<int>(m_networkState), static_cast<int>(m_readyState)); 526 } 527 #endif 527 528 } 528 529 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
r147675 r148050 530 530 PlatformLayer* MediaPlayerPrivateAVFoundationObjC::platformLayer() const 531 531 { 532 LOG(Media, "MediaPlayerPrivateAVFoundationObjC::platformLayer(%p)", this);533 532 return m_videoLayer.get(); 534 533 } … … 1368 1367 AVMediaSelectionOptionType *mediaSelectionOption = trackPrivate ? trackPrivate->mediaSelectionOption() : 0; 1369 1368 1370 LOG(Media, "MediaPlayerPrivateAVFoundationObjC::setCurrentTrack(%p) - selecting media option %p ", this, mediaSelectionOption);1369 LOG(Media, "MediaPlayerPrivateAVFoundationObjC::setCurrentTrack(%p) - selecting media option %p, language = %s", this, mediaSelectionOption, [[[mediaSelectionOption locale] localeIdentifier] UTF8String]); 1371 1370 1372 1371 [m_avPlayerItem.get() selectMediaOption:mediaSelectionOption inMediaSelectionGroup:[m_avAsset.get() mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible]]; -
trunk/Source/WebCore/testing/Internals.cpp
r147888 r148050 274 274 #endif 275 275 #if ENABLE(VIDEO_TRACK) && !PLATFORM(WIN) 276 page->group().captionPreferences()->setCaptionsStyleSheetOverride(emptyString()); 276 277 page->group().captionPreferences()->setTestingMode(false); 277 278 #endif … … 2108 2109 } 2109 2110 2110 } 2111 String Internals::captionsStyleSheetOverride(ExceptionCode& ec) 2112 { 2113 Document* document = contextDocument(); 2114 if (!document || !document->page()) { 2115 ec = INVALID_ACCESS_ERR; 2116 return emptyString(); 2117 } 2118 2119 #if ENABLE(VIDEO_TRACK) && !PLATFORM(WIN) 2120 return document->page()->group().captionPreferences()->captionsStyleSheetOverride(); 2121 #else 2122 return emptyString(); 2123 #endif 2124 } 2125 2126 void Internals::setCaptionsStyleSheetOverride(const String& override, ExceptionCode& ec) 2127 { 2128 Document* document = contextDocument(); 2129 if (!document || !document->page()) { 2130 ec = INVALID_ACCESS_ERR; 2131 return; 2132 } 2133 2134 #if ENABLE(VIDEO_TRACK) && !PLATFORM(WIN) 2135 document->page()->group().captionPreferences()->setCaptionsStyleSheetOverride(override); 2136 #endif 2137 } 2138 2139 } -
trunk/Source/WebCore/testing/Internals.h
r147548 r148050 312 312 bool isSelectPopupVisible(Node*); 313 313 314 String captionsStyleSheetOverride(ExceptionCode&); 315 void setCaptionsStyleSheetOverride(const String&, ExceptionCode&); 316 314 317 private: 315 318 explicit Internals(Document*); -
trunk/Source/WebCore/testing/Internals.idl
r147548 r148050 273 273 DOMString getImageSourceURL(in Element element) raises(DOMException); 274 274 275 [Conditional=VIDEO_TRACK] DOMString captionsStyleSheetOverride() raises (DOMException); 276 [Conditional=VIDEO_TRACK] void setCaptionsStyleSheetOverride(in DOMString override) raises (DOMException); 277 275 278 boolean isSelectPopupVisible(in Node node); 276 279 };
Note:
See TracChangeset
for help on using the changeset viewer.