[Mac] user caption styles not applied to correct element
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Apr 2013 20:56:27 +0000 (20:56 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Apr 2013 20:56:27 +0000 (20:56 +0000)
commit54d97789e4c67a2779f3361da62f4156802b4302
tree3dbb4365224325a82bf1db5de052f1f7ebb1612d
parent3249e0d64e2de4f38d5c401efedcef6be02c72c8
[Mac] user caption styles not applied to correct element
https://bugs.webkit.org/show_bug.cgi?id=114230

Reviewed by Jer Noble.

Source/WebCore:

Test: media/track/track-css-user-override.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::updateActiveTextTrackCues): Drive by clean-up so we don't log excessively.

* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement): Initialize
    new member variables.
(WebCore::MediaControlTextTrackContainerElement::updateDisplay): Set cue font size when it is
    inserted into the tree.
(WebCore::MediaControlTextTrackContainerElement::updateTimerFired): Update the font size of
    all active cues.
(WebCore::MediaControlTextTrackContainerElement::updateSizes): Set size-relative CSS properties
    after a time because this can be called during layout.
* html/shadow/MediaControlElements.h:

* html/shadow/MediaControls.cpp:
(WebCore::MediaControls::textTrackPreferencesChanged): Call closedCaptionTracksChanged before updateSizes.

* html/track/TextTrackCue.cpp:
(WebCore::TextTrackCue::setFontSize): New, set the cue's font size.
* html/track/TextTrackCue.h:

* html/track/TextTrackCueGeneric.cpp:
(WebCore::TextTrackCueGenericBoxElement::applyCSSProperties): Set cue properties on the cue element
    instead of on the cue box to match what we do for the "cue" pseudo element.
(WebCore::TextTrackCueGeneric::setFontSize): New, set the cue's font size.
* html/track/TextTrackCueGeneric.h:

* html/track/TextTrackList.cpp:
(TextTrackList::remove): Drive-by cleanup, don't ASSERT when the media element is NULL.

* page/CaptionUserPreferences.cpp:
(WebCore::CaptionUserPreferences::setCaptionsStyleSheetOverride): New, allow user CSS overrides
    to be tested in DRT.
(WebCore::CaptionUserPreferences::updateCaptionStyleSheetOveride): New, generate a user style
    sheet override. Moved here from CaptionUserPreferencesMac.
* page/CaptionUserPreferences.h:

* page/CaptionUserPreferencesMac.h:
* page/CaptionUserPreferencesMac.mm:
(WebCore::CaptionUserPreferencesMac::captionsBackgroundCSS): Don't ignore background color importance.
(WebCore::CaptionUserPreferencesMac::captionsStyleSheetOverride): Implement even when we don't
    have the media accessibility framework so this can be tested in DRT. Apply all cue properties
    to the element used for the "cue" pseudo element.

* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::didLoadingProgress): Drive-by cleanup, remove logging
    because this method is called so frequently and the logging is not especially useful.
(WebCore::MediaPlayerPrivateAVFoundation::updateStates): Only log when the ready/network
    state changes because this method is called so frequently.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformLayer): Drive-by cleanup, remove logging
    because this method is called so frequently and the logging is not especially useful.
(WebCore::MediaPlayerPrivateAVFoundationObjC::setCurrentTrack): Make the logging more useful.

* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState): Reset captions style sheet override.
(WebCore::Internals::captionsStyleSheetOverride): New, return the captions style sheet override.
(WebCore::Internals::setCaptionsStyleSheetOverride): New, override the captions style sheet override.
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

* media/track/track-css-user-override-expected.txt: Added.
* media/track/track-css-user-override.html: Added.
* media/track/track-cue-container-rendering-position-expected.txt:
* media/track/track-cue-container-rendering-position.html:
* media/track/track-cue-rendering-expected.txt:
* media/track/track-cue-rendering.html: Font size is not applied instantly when a video element is
    resized, so check after a very short delay.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@148050 268f45cc-cd09-0410-ab3c-d52691b4dbfc
26 files changed:
LayoutTests/ChangeLog
LayoutTests/media/track/track-css-user-override-expected.txt [new file with mode: 0644]
LayoutTests/media/track/track-css-user-override.html [new file with mode: 0644]
LayoutTests/media/track/track-cue-container-rendering-position-expected.txt
LayoutTests/media/track/track-cue-container-rendering-position.html
LayoutTests/media/track/track-cue-rendering-expected.txt
LayoutTests/media/track/track-cue-rendering.html
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/shadow/MediaControlElements.cpp
Source/WebCore/html/shadow/MediaControlElements.h
Source/WebCore/html/shadow/MediaControls.cpp
Source/WebCore/html/track/TextTrackCue.cpp
Source/WebCore/html/track/TextTrackCue.h
Source/WebCore/html/track/TextTrackCueGeneric.cpp
Source/WebCore/html/track/TextTrackCueGeneric.h
Source/WebCore/html/track/TextTrackList.cpp
Source/WebCore/page/CaptionUserPreferences.cpp
Source/WebCore/page/CaptionUserPreferences.h
Source/WebCore/page/CaptionUserPreferencesMac.h
Source/WebCore/page/CaptionUserPreferencesMac.mm
Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl