Use a separate backdrop element to allow cues to have highlight and background color
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Jul 2014 17:32:17 +0000 (17:32 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Jul 2014 17:32:17 +0000 (17:32 +0000)
commit0f58dd4993c235be68e55f1583dbf064a3b260f5
tree038b3ba352c202f5aacbf59bd67add2743c9bc00
parent7a1e59ece07611721a368ee37fb3b43a242edf7f
Use a separate backdrop element to allow cues to have highlight and background color
https://bugs.webkit.org/show_bug.cgi?id=134821
<rdar://problem/15999721>

Reviewed by Eric Carlson.

Source/WebCore:
Add a new <div> element wrapping the existing cue <span>. This allows
us to have a highlight on the cue (in the <span> background), as well
as an overall background color.

* Modules/mediacontrols/mediaControlsApple.css:
(video::-webkit-media-text-track-display-backdrop): New markup for
the backdrop element of the caption.
* html/track/VTTCue.cpp:
(WebCore::VTTCue::cueBackdropShadowPseudoId): Added to
allow user customization of the cue backdrop.
(WebCore::VTTCue::initialize): Rename the old "m_cueBackgroundBox" to
"m_cueHighlightBox" and add a new "m_cueBackdropBox" member.
(WebCore::VTTCue::updateDisplayTree): Update for m_cueHighlightBox.
(WebCore::VTTCue::getDisplayTree): Make m_cueHighlightBox a child
of the new m_cueBackdropBox element, and add m_cueBackdropBox to
the display tree.
* html/track/VTTCue.h:
(WebCore::VTTCue::element):
* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::CaptionUserPreferencesMediaAF::setInterestedInCaptionPreferenceChanges):
Fix for missing caption style updates. Even if we are already
listening for caption changes, we still want to update the new
instance's style sheet to match.
(WebCore::CaptionUserPreferencesMediaAF::captionsStyleSheetOverride):
* rendering/RenderVTTCue.cpp:
(WebCore::RenderVTTCue::initializeLayoutParameters): Take the new
<div> into consideration when looking for the Cue text element.

LayoutTests:
Updated tests for new formatting logic.

* platform/mac/media/track/track-cue-rendering-horizontal-expected.png:
* platform/mac/media/track/track-cue-rendering-horizontal-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@171004 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/platform/mac/media/track/track-cue-rendering-horizontal-expected.png
LayoutTests/platform/mac/media/track/track-cue-rendering-horizontal-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediacontrols/mediaControlsApple.css
Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css
Source/WebCore/html/track/VTTCue.cpp
Source/WebCore/html/track/VTTCue.h
Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp
Source/WebCore/rendering/RenderVTTCue.cpp
WebKit.xcworkspace/xcshareddata/xcschemes/All Source.xcscheme