[Mac] respect in-band caption color
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Feb 2013 05:52:53 +0000 (05:52 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Feb 2013 05:52:53 +0000 (05:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=109203

Reviewed by Dean Jackson.

Source/WebCore:

Test: media/track/track-in-band-style.html

* WebCore.xcodeproj/project.pbxproj: Add HTMLDivElement.h to private headers because it is
    included by HTMLTextElement, which is included by HTMLMediaElement.h, which is included
    by files in WebKit/WebKit2.
* html/track/InbandTextTrack.cpp:
(WebCore::InbandTextTrack::addGenericCue): Set cue colors if necessary.

* html/track/TextTrackCue.h:
(WebCore::TextTrackCue::element): New, accessor for the cue element so it can be styled.

* html/track/TextTrackCueGeneric.cpp:
(WebCore::TextTrackCueGenericBoxElement::applyCSSProperties): Set container and cue background
    color if necessary.
(WebCore::TextTrackCueGeneric::operator==): Compare cue colors.
* html/track/TextTrackCueGeneric.h:
(WebCore::TextTrackCueGeneric::foregroundColor): Add color accessors.
(WebCore::TextTrackCueGeneric::setForegroundColor):
(WebCore::TextTrackCueGeneric::backgroundColor):
(WebCore::TextTrackCueGeneric::setBackgroundColor):

* page/CaptionUserPreferencesMac.mm:
(WebCore::CaptionUserPreferencesMac::registerForCaptionPreferencesChangedCallbacks): Always
    regenerate override CSS when an element registers for callbacks.
(WebCore::CaptionUserPreferencesMac::captionsWindowCSS): Drive by fix of "window color" padding.
(WebCore::CaptionUserPreferencesMac::captionsStyleSheetOverride): Log the stylesheet generated
    for easier debugging.

* platform/graphics/InbandTextTrackPrivateClient.h:
(WebCore::GenericCueData::foregroundColor): Add color getters/setters.
(WebCore::GenericCueData::setForegroundColor):
(WebCore::GenericCueData::backgroundColor):
(WebCore::GenericCueData::setBackgroundColor):

* platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
(WebCore::makeRGBA32FromARGBCFArray): Initialize a RGBA32 from a CFArray of color values.
(WebCore::InbandTextTrackPrivateAVF::processCueAttributes): Process cue colors.

LayoutTests:

* media/track/track-in-band-style-expected.txt: Added.
* media/track/track-in-band-style.html: Added.

* platform/chromium/TestExpectations: Skip new test.
* platform/efl/TestExpectations: Ditto.
* platform/gtk/TestExpectations: Ditto.
* platform/mac/TestExpectations: Ditto.
* platform/qt/TestExpectations: Ditto.
* platform/win/TestExpectations: Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@142349 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
LayoutTests/ChangeLog
LayoutTests/media/track/track-in-band-style-expected.txt [new file with mode: 0644]
LayoutTests/media/track/track-in-band-style.html [new file with mode: 0644]
LayoutTests/platform/chromium/TestExpectations
LayoutTests/platform/efl/TestExpectations
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/qt/TestExpectations
LayoutTests/platform/win/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/html/track/InbandTextTrack.cpp
Source/WebCore/html/track/TextTrackCue.h
Source/WebCore/html/track/TextTrackCueGeneric.cpp
Source/WebCore/html/track/TextTrackCueGeneric.h
Source/WebCore/page/CaptionUserPreferencesMac.mm
Source/WebCore/platform/graphics/InbandTextTrackPrivateClient.h
Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp

index 6b0d99ea92f2e9f721e7096ed6aaf9c50282af9b..28cc8bce29b9b32608c2f0e41ddb498adb3ee617 100644 (file)
@@ -1,27 +1,19 @@
-2013-02-08  Benjamin Poulain  <bpoulain@apple.com>
+2013-02-08  Eric Carlson  <eric.carlson@apple.com>
 
-        Move workerThreadCount from TestRunner to WebCore Internals
-        https://bugs.webkit.org/show_bug.cgi?id=109239
+        [Mac] respect in-band caption color
+        https://bugs.webkit.org/show_bug.cgi?id=109203
 
-        Reviewed by Darin Adler.
+        Reviewed by Dean Jackson.
 
-        Update the tests testRunner->internals.
+        * media/track/track-in-band-style-expected.txt: Added.
+        * media/track/track-in-band-style.html: Added.
 
-        * fast/workers/resources/dedicated-worker-lifecycle.js:
-        (runTests.worker.onmessage):
-        (runTests):
-        (orphanedWorkerExited.worker.onmessage):
-        (orphanedWorkerExited):
-        * fast/workers/resources/worker-lifecycle.js:
-        (runTests.worker.onmessage):
-        (runTests):
-        * fast/workers/resources/worker-util.js:
-        (.return):
-        (waitUntilThreadCountMatches):
-        * fast/workers/worker-close-more.html:
-        * http/tests/workers/resources/worker-util.js:
-        (.return):
-        (waitUntilThreadCountMatches):
+        * platform/chromium/TestExpectations: Skip new test.
+        * platform/efl/TestExpectations: Ditto.
+        * platform/gtk/TestExpectations: Ditto.
+        * platform/mac/TestExpectations: Ditto.
+        * platform/qt/TestExpectations: Ditto.
+        * platform/win/TestExpectations: Ditto.
 
 2013-02-08  Gregg Tavares  <gman@chromium.org>
 
diff --git a/LayoutTests/media/track/track-in-band-style-expected.txt b/LayoutTests/media/track/track-in-band-style-expected.txt
new file mode 100644 (file)
index 0000000..b1348b6
--- /dev/null
@@ -0,0 +1,16 @@
+Test that style to all cues is applied correctly.
+EVENT(canplaythrough)
+
+** Check initial in-band track states
+RUN(inbandTrack1 = video.textTracks[0])
+EXPECTED (video.textTracks.length == '1') OK
+EXPECTED (inbandTrack1.language == 'en') OK
+EXPECTED (inbandTrack1.kind == 'captions') OK
+RUN(video.play())
+EVENT(seeked)
+
+** Test current cue colors
+EXPECTED (getComputedStyle(cueDisplayElement).color == 'rgb(255, 255, 255)') OK
+EXPECTED (getComputedStyle(cueNode).backgroundColor == 'rgb(0, 0, 0)') OK
+END OF TEST
+
diff --git a/LayoutTests/media/track/track-in-band-style.html b/LayoutTests/media/track/track-in-band-style.html
new file mode 100644 (file)
index 0000000..9daab7c
--- /dev/null
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+        <script src=../media-file.js></script>
+        <script src=../video-test.js></script>
+        <script src=../media-controls.js></script>
+
+        <script>
+
+                function seeked()
+                {
+                    consoleWrite("<br><i>** Test current cue colors<" + "/i>");
+
+                    cueDisplayElement = textTrackDisplayElement(video, 'display', 0);
+                    testExpected("getComputedStyle(cueDisplayElement).color", "rgb(255, 255, 255)");
+
+                    cueNode = textTrackDisplayElement(video, 'all-nodes');
+                    testExpected("getComputedStyle(cueNode).backgroundColor", "rgb(0, 0, 0)");
+
+                    endTest();
+                }
+
+                function canplaythrough()
+                {
+                    consoleWrite("<br><i>** Check initial in-band track states<" + "/i>");
+                    run("inbandTrack1 = video.textTracks[0]");
+                    testExpected("video.textTracks.length", 1);
+                    testExpected("inbandTrack1.language", "en");
+                    testExpected("inbandTrack1.kind", "captions");
+                    inbandTrack1.mode = 'showing';
+                    run("video.play()");
+                    setTimeout(function() { video.pause(); video.currentTime = 0.3; }, 1500);
+                }
+
+            function loaded()
+            {
+                consoleWrite("Test that style to all cues is applied correctly.");
+                findMediaElement();
+                video.src = '../content/counting-captioned.mov';
+                waitForEvent('seeked', seeked);
+                waitForEvent('canplaythrough', canplaythrough);
+            }
+
+        </script>
+    </head>
+    <body onload="loaded()">
+        <video controls >
+        </video>
+    </body>
+</html>
index a17b94eef85738321ecc4e213e835fa45ea4de1a..e26a3dc4f82a29bb1b8aa259ab3d8ff916f35459 100644 (file)
@@ -4189,6 +4189,7 @@ webkit.org/b/94002 [ Mac Debug ] inspector/debugger/live-edit.html [ Crash Pass
 # No support for exposing in-band text tracks
 webkit.org/b/103767  [ Win Mac Linux ] media/track/track-in-band.html [ Skip ]
 webkit.org/b/103767  [ Win Mac Linux ] media/track/track-in-band-cues-added-once.html [ Skip ]
+webkit.org/b/103767  [ Win Mac Linux ] media/track/track-in-band-style.html [ Skip ]
 
 # Flaky on Win (perhaps due to lighttpd?)
 webkit.org/b/104489 [ Win ] http/tests/w3c/webperf/submission/resource-timing/html/test_resource_attribute_order.html [ Failure Pass ]
index 10c7798dece9dac86268c19ea15fb125cbf34daa..33e5a7bb16635348df137cad5aea818b6b28f0c9 100644 (file)
@@ -1733,6 +1733,7 @@ webkit.org/b/61138 http/tests/w3c/webperf/submission/resource-timing [ Skip ]
 # No support for exposing in-band text tracks
 Bug(EFL) media/track/track-in-band.html [ Skip ]
 Bug(EFL) media/track/track-in-band-cues-added-once.html [ Skip ]
+Bug(EFL) media/track/track-in-band-style.html [ Skip ]
 
 # All debug bots timeout (crash) on this one
 webkit.org/b/56496 [ Debug ] fast/js/array-sort-modifying-tostring.html [ Crash Pass ]
index b6287de5866e082235b8e8546db88e8c9c5a6cc5..8aad7f4a8abc248796603eab7c596458f5ea28d5 100644 (file)
@@ -478,6 +478,7 @@ webkit.org/b/103926 media/track/opera/track/webvtt/rendering/adhoc/voice_with_ev
 # No support for exposing in-band text tracks
 webkit.org/b/103771 media/track/track-in-band.html [ Failure ]
 webkit.org/b/103771 media/track/track-in-band-cues-added-once.html [ Timeout ]
+webkit.org/b/103771 media/track/track-in-band-style.html [ Failure ]
 
 #////////////////////////////////////////////////////////////////////////////////////////
 # End of Expected failures
index 3e557a8cefcec32c7c2630a0ef26a9135a7b9777..44f75472ca3ecf58024d1b600f08f78e3d0da085 100644 (file)
@@ -1238,6 +1238,7 @@ Bug(jernoble) [ MountainLion Lion SnowLeopard ] media/video-src-blob.html
 # Mountain Lion and prior do not allow access to in-band text tracks
 webkit.org/b/103663 [ MountainLion Lion SnowLeopard ] media/track/track-in-band.html
 webkit.org/b/103663 [ MountainLion Lion SnowLeopard ] media/track/track-in-band-cues-added-once.html
+webkit.org/b/103663 [ MountainLion Lion SnowLeopard ] media/track/track-in-band-style.html
 
 webkit.org/b/104104 fast/overflow/scrollbar-click-retains-focus.html [ Failure ]
 
index 363f444a5776b56a3b22846b2d18edba4239f864..f68f9f72ff483c2107a37e395c50c91562f5ba1f 100644 (file)
@@ -2557,6 +2557,7 @@ webkit.org/b/108257 compositing/overflow/automatically-opt-into-composited-scrol
 # No support for exposing in-band text tracks
 webkit.org/b/103769 media/track/track-in-band.html [ Skip ]
 webkit.org/b/103769 media/track/track-in-band-cues-added-once.html [ Skip ]
+webkit.org/b/103769 media/track/track-in-band-style.html [ Skip ]
 
 webkit.org/b/104150 fast/media/implicit-media-all.html [ ImageOnlyFailure ]
 
index f0632db88f9da23921451f99ba861cb0429b4dc9..91f23e7cc968a66b035a6aef8382d8022904e707 100644 (file)
@@ -2500,6 +2500,7 @@ fast/js/kde/Array.html
 # No support for exposing in-band text tracks
 webkit.org/b/103770 media/track/track-in-band.html [ Skip ]
 webkit.org/b/103770 media/track/track-in-band-cues-added-once.html [ Skip ]
+webkit.org/b/103770 media/track/track-in-band-style.html [ Skip ]
 
 # https://bugs.webkit.org/show_bug.cgi?id=97026
 fast/events/keydown-leftright-keys.html
index 0481f23b483eefd83401f57e0f081cc7d328cfb2..dcb364c3f63faae2947a873813c87f87920a6c74 100644 (file)
@@ -1,3 +1,48 @@
+2013-02-08  Eric Carlson  <eric.carlson@apple.com>
+
+        [Mac] respect in-band caption color
+        https://bugs.webkit.org/show_bug.cgi?id=109203
+
+        Reviewed by Dean Jackson.
+
+        Test: media/track/track-in-band-style.html
+
+        * WebCore.xcodeproj/project.pbxproj: Add HTMLDivElement.h to private headers because it is 
+            included by HTMLTextElement, which is included by HTMLMediaElement.h, which is included 
+            by files in WebKit/WebKit2.
+        * html/track/InbandTextTrack.cpp:
+        (WebCore::InbandTextTrack::addGenericCue): Set cue colors if necessary.
+
+        * html/track/TextTrackCue.h:
+        (WebCore::TextTrackCue::element): New, accessor for the cue element so it can be styled.
+
+        * html/track/TextTrackCueGeneric.cpp:
+        (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties): Set container and cue background 
+            color if necessary.
+        (WebCore::TextTrackCueGeneric::operator==): Compare cue colors.
+        * html/track/TextTrackCueGeneric.h:
+        (WebCore::TextTrackCueGeneric::foregroundColor): Add color accessors.
+        (WebCore::TextTrackCueGeneric::setForegroundColor):
+        (WebCore::TextTrackCueGeneric::backgroundColor):
+        (WebCore::TextTrackCueGeneric::setBackgroundColor):
+
+        * page/CaptionUserPreferencesMac.mm:
+        (WebCore::CaptionUserPreferencesMac::registerForCaptionPreferencesChangedCallbacks): Always
+            regenerate override CSS when an element registers for callbacks.
+        (WebCore::CaptionUserPreferencesMac::captionsWindowCSS): Drive by fix of "window color" padding.
+        (WebCore::CaptionUserPreferencesMac::captionsStyleSheetOverride): Log the stylesheet generated
+            for easier debugging.
+
+        * platform/graphics/InbandTextTrackPrivateClient.h:
+        (WebCore::GenericCueData::foregroundColor): Add color getters/setters.
+        (WebCore::GenericCueData::setForegroundColor):
+        (WebCore::GenericCueData::backgroundColor):
+        (WebCore::GenericCueData::setBackgroundColor):
+
+        * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
+        (WebCore::makeRGBA32FromARGBCFArray): Initialize a RGBA32 from a CFArray of color values.
+        (WebCore::InbandTextTrackPrivateAVF::processCueAttributes): Process cue colors.
+
 2013-02-08  Benjamin Poulain  <bpoulain@apple.com>
 
         Move workerThreadCount from TestRunner to WebCore Internals
index 48f6cae05962437acf5df34bcbdc71ab44638da4..f087b6e086f7b91a6f74ef66b8baa99b2962798a 100644 (file)
                97BC6A4E1505F081001B74AC /* SQLStatementSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 97BC6A0C1505F081001B74AC /* SQLStatementSync.h */; };
                97BC6A4F1505F081001B74AC /* SQLTransaction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97BC6A0D1505F081001B74AC /* SQLTransaction.cpp */; };
                97BC6A501505F081001B74AC /* SQLTransaction.h in Headers */ = {isa = PBXBuildFile; fileRef = 97BC6A0E1505F081001B74AC /* SQLTransaction.h */; };
-               FEE1811316C319E800084849 /* SQLTransactionBackend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEE1811116C319E800084849 /* SQLTransactionBackend.cpp */; };
-               FEE1811416C319E800084849 /* SQLTransactionBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = FEE1811216C319E800084849 /* SQLTransactionBackend.h */; };
-               FEAD7D8716C339EE00D4670B /* SQLTransactionBackendSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEAD7D8516C339EE00D4670B /* SQLTransactionBackendSync.cpp */; };
-               FEAD7D8816C339EE00D4670B /* SQLTransactionBackendSync.h in Headers */ = {isa = PBXBuildFile; fileRef = FEAD7D8616C339EE00D4670B /* SQLTransactionBackendSync.h */; };
                97BC6A521505F081001B74AC /* SQLTransactionCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 97BC6A101505F081001B74AC /* SQLTransactionCallback.h */; };
                97BC6A541505F081001B74AC /* SQLTransactionClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97BC6A121505F081001B74AC /* SQLTransactionClient.cpp */; };
                97BC6A551505F081001B74AC /* SQLTransactionClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 97BC6A131505F081001B74AC /* SQLTransactionClient.h */; };
                A8EA7CB20A192B9C00A8EF5F /* HTMLParagraphElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8EA7CA40A192B9C00A8EF5F /* HTMLParagraphElement.cpp */; };
                A8EA7CB30A192B9C00A8EF5F /* HTMLHRElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8EA7CA50A192B9C00A8EF5F /* HTMLHRElement.cpp */; };
                A8EA7CB50A192B9C00A8EF5F /* HTMLParagraphElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA7CA70A192B9C00A8EF5F /* HTMLParagraphElement.h */; };
-               A8EA7CB70A192B9C00A8EF5F /* HTMLDivElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA7CA90A192B9C00A8EF5F /* HTMLDivElement.h */; };
+               A8EA7CB70A192B9C00A8EF5F /* HTMLDivElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA7CA90A192B9C00A8EF5F /* HTMLDivElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A8EA7CB80A192B9C00A8EF5F /* HTMLHeadingElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA7CAA0A192B9C00A8EF5F /* HTMLHeadingElement.h */; };
                A8EA7D2B0A19385500A8EF5F /* HTMLImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA7D230A19385500A8EF5F /* HTMLImageLoader.h */; settings = {ATTRIBUTES = (); }; };
                A8EA7D2C0A19385500A8EF5F /* HTMLMapElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA7D240A19385500A8EF5F /* HTMLMapElement.h */; };
                FDF6BAF9134A4C9800822920 /* JSOfflineAudioCompletionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = FDF6BAF7134A4C9800822920 /* JSOfflineAudioCompletionEvent.h */; };
                FDF7E9C313AC21DB00A51EAC /* JSAudioBufferCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FDF7E9C113AC21DB00A51EAC /* JSAudioBufferCallback.cpp */; };
                FDF7E9C413AC21DB00A51EAC /* JSAudioBufferCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = FDF7E9C213AC21DB00A51EAC /* JSAudioBufferCallback.h */; };
+               FE09DB49169E2D6E00622557 /* DatabaseError.h in Headers */ = {isa = PBXBuildFile; fileRef = FE09DB46169E2D6E00622557 /* DatabaseError.h */; settings = {ATTRIBUTES = (Private, ); }; };
                FE115FAB167988CD00249134 /* AbstractDatabaseServer.h in Headers */ = {isa = PBXBuildFile; fileRef = FE115FA9167988CD00249134 /* AbstractDatabaseServer.h */; settings = {ATTRIBUTES = (Private, ); }; };
                FE16CFD3169D1DED00D3A0C7 /* DatabaseBackendAsync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE16CFCF169D1DEC00D3A0C7 /* DatabaseBackendAsync.cpp */; };
                FE16CFD4169D1DED00D3A0C7 /* DatabaseBackendAsync.h in Headers */ = {isa = PBXBuildFile; fileRef = FE16CFD0169D1DEC00D3A0C7 /* DatabaseBackendAsync.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               FE6F6AAF169E057500FC30A2 /* DatabaseBackendContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE6F6AAD169E057500FC30A2 /* DatabaseBackendContext.cpp */; };
-               FE6F6AB0169E057500FC30A2 /* DatabaseBackendContext.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6F6AAE169E057500FC30A2 /* DatabaseBackendContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
                FE16CFD5169D1DED00D3A0C7 /* DatabaseBackendSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE16CFD1169D1DEC00D3A0C7 /* DatabaseBackendSync.cpp */; };
                FE16CFD6169D1DED00D3A0C7 /* DatabaseBackendSync.h in Headers */ = {isa = PBXBuildFile; fileRef = FE16CFD2169D1DEC00D3A0C7 /* DatabaseBackendSync.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               FEBC5F3116BD0CC300659BD3 /* DatabaseBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEBC5F2F16BD0CC300659BD3 /* DatabaseBase.cpp */; };
-               FEBC5F3216BD0CC300659BD3 /* DatabaseBase.h in Headers */ = {isa = PBXBuildFile; fileRef = FEBC5F3016BD0CC300659BD3 /* DatabaseBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
                FE3371A2167C11D400EDB752 /* DatabaseBasicTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = FE3371A0167C11D400EDB752 /* DatabaseBasicTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               FE09DB49169E2D6E00622557 /* DatabaseError.h in Headers */ = {isa = PBXBuildFile; fileRef = FE09DB46169E2D6E00622557 /* DatabaseError.h */; settings = {ATTRIBUTES = (Private, ); }; };
                FE456F181677D74E005EDDF9 /* DatabaseManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE456F161677D74E005EDDF9 /* DatabaseManager.cpp */; };
                FE456F191677D74E005EDDF9 /* DatabaseManager.h in Headers */ = {isa = PBXBuildFile; fileRef = FE456F171677D74E005EDDF9 /* DatabaseManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               FEB26D28167A8F2A00FDD26B /* DatabaseServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEB26D27167A8F2A00FDD26B /* DatabaseServer.cpp */; };
-               FEAF6654167970320062D0C5 /* DatabaseServer.h in Headers */ = {isa = PBXBuildFile; fileRef = FEAF6653167970070062D0C5 /* DatabaseServer.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               FEDEF84116797108000E444A /* DatabaseStrategy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEDEF83F16797108000E444A /* DatabaseStrategy.cpp */; };
-               FEDEF84216797108000E444A /* DatabaseStrategy.h in Headers */ = {isa = PBXBuildFile; fileRef = FEDEF84016797108000E444A /* DatabaseStrategy.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               FE6F6AAF169E057500FC30A2 /* DatabaseBackendContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE6F6AAD169E057500FC30A2 /* DatabaseBackendContext.cpp */; };
+               FE6F6AB0169E057500FC30A2 /* DatabaseBackendContext.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6F6AAE169E057500FC30A2 /* DatabaseBackendContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
                FE6FD4880F676E5700092873 /* Coordinates.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6FD4850F676E5700092873 /* Coordinates.h */; settings = {ATTRIBUTES = (Private, ); }; };
                FE6FD48D0F676E9300092873 /* JSCoordinates.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE6FD48B0F676E9300092873 /* JSCoordinates.cpp */; };
                FE6FD48E0F676E9300092873 /* JSCoordinates.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6FD48C0F676E9300092873 /* JSCoordinates.h */; };
                FE80DA660E9C4703000D6F75 /* JSGeoposition.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80DA620E9C4703000D6F75 /* JSGeoposition.h */; };
                FE80DA710E9C472F000D6F75 /* JSPositionError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE80DA6D0E9C472F000D6F75 /* JSPositionError.cpp */; };
                FE80DA720E9C472F000D6F75 /* JSPositionError.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80DA6E0E9C472F000D6F75 /* JSPositionError.h */; };
+               FEAD7D8716C339EE00D4670B /* SQLTransactionBackendSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEAD7D8516C339EE00D4670B /* SQLTransactionBackendSync.cpp */; };
+               FEAD7D8816C339EE00D4670B /* SQLTransactionBackendSync.h in Headers */ = {isa = PBXBuildFile; fileRef = FEAD7D8616C339EE00D4670B /* SQLTransactionBackendSync.h */; };
+               FEAF6654167970320062D0C5 /* DatabaseServer.h in Headers */ = {isa = PBXBuildFile; fileRef = FEAF6653167970070062D0C5 /* DatabaseServer.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               FEB26D28167A8F2A00FDD26B /* DatabaseServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEB26D27167A8F2A00FDD26B /* DatabaseServer.cpp */; };
+               FEBC5F3116BD0CC300659BD3 /* DatabaseBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEBC5F2F16BD0CC300659BD3 /* DatabaseBase.cpp */; };
+               FEBC5F3216BD0CC300659BD3 /* DatabaseBase.h in Headers */ = {isa = PBXBuildFile; fileRef = FEBC5F3016BD0CC300659BD3 /* DatabaseBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               FEDEF84116797108000E444A /* DatabaseStrategy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEDEF83F16797108000E444A /* DatabaseStrategy.cpp */; };
+               FEDEF84216797108000E444A /* DatabaseStrategy.h in Headers */ = {isa = PBXBuildFile; fileRef = FEDEF84016797108000E444A /* DatabaseStrategy.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               FEE1811316C319E800084849 /* SQLTransactionBackend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEE1811116C319E800084849 /* SQLTransactionBackend.cpp */; };
+               FEE1811416C319E800084849 /* SQLTransactionBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = FEE1811216C319E800084849 /* SQLTransactionBackend.h */; };
                FF945ECB161F7F3600971BC8 /* PseudoElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF945EC9161F7F3600971BC8 /* PseudoElement.cpp */; };
                FF945ECC161F7F3600971BC8 /* PseudoElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FF945ECA161F7F3600971BC8 /* PseudoElement.h */; };
                FFD5B97A135CC97800D5E92A /* PageVisibilityState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FFD5B977135CC97800D5E92A /* PageVisibilityState.cpp */; };
                97BC6A0D1505F081001B74AC /* SQLTransaction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SQLTransaction.cpp; path = Modules/webdatabase/SQLTransaction.cpp; sourceTree = "<group>"; };
                97BC6A0E1505F081001B74AC /* SQLTransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SQLTransaction.h; path = Modules/webdatabase/SQLTransaction.h; sourceTree = "<group>"; };
                97BC6A0F1505F081001B74AC /* SQLTransaction.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = SQLTransaction.idl; path = Modules/webdatabase/SQLTransaction.idl; sourceTree = "<group>"; };
-               FEE1811116C319E800084849 /* SQLTransactionBackend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SQLTransactionBackend.cpp; path = Modules/webdatabase/SQLTransactionBackend.cpp; sourceTree = "<group>"; };
-               FEE1811216C319E800084849 /* SQLTransactionBackend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SQLTransactionBackend.h; path = Modules/webdatabase/SQLTransactionBackend.h; sourceTree = "<group>"; };
-               FEAD7D8516C339EE00D4670B /* SQLTransactionBackendSync.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SQLTransactionBackendSync.cpp; path = Modules/webdatabase/SQLTransactionBackendSync.cpp; sourceTree = "<group>"; };
-               FEAD7D8616C339EE00D4670B /* SQLTransactionBackendSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SQLTransactionBackendSync.h; path = Modules/webdatabase/SQLTransactionBackendSync.h; sourceTree = "<group>"; };
                97BC6A101505F081001B74AC /* SQLTransactionCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SQLTransactionCallback.h; path = Modules/webdatabase/SQLTransactionCallback.h; sourceTree = "<group>"; };
                97BC6A111505F081001B74AC /* SQLTransactionCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = SQLTransactionCallback.idl; path = Modules/webdatabase/SQLTransactionCallback.idl; sourceTree = "<group>"; };
                97BC6A121505F081001B74AC /* SQLTransactionClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SQLTransactionClient.cpp; path = Modules/webdatabase/SQLTransactionClient.cpp; sourceTree = "<group>"; };
                FE115FA9167988CD00249134 /* AbstractDatabaseServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AbstractDatabaseServer.h; path = Modules/webdatabase/AbstractDatabaseServer.h; sourceTree = "<group>"; };
                FE16CFCF169D1DEC00D3A0C7 /* DatabaseBackendAsync.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DatabaseBackendAsync.cpp; path = Modules/webdatabase/DatabaseBackendAsync.cpp; sourceTree = "<group>"; };
                FE16CFD0169D1DEC00D3A0C7 /* DatabaseBackendAsync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DatabaseBackendAsync.h; path = Modules/webdatabase/DatabaseBackendAsync.h; sourceTree = "<group>"; };
-               FE6F6AAD169E057500FC30A2 /* DatabaseBackendContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DatabaseBackendContext.cpp; path = Modules/webdatabase/DatabaseBackendContext.cpp; sourceTree = "<group>"; };
-               FE6F6AAE169E057500FC30A2 /* DatabaseBackendContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DatabaseBackendContext.h; path = Modules/webdatabase/DatabaseBackendContext.h; sourceTree = "<group>"; };
                FE16CFD1169D1DEC00D3A0C7 /* DatabaseBackendSync.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DatabaseBackendSync.cpp; path = Modules/webdatabase/DatabaseBackendSync.cpp; sourceTree = "<group>"; };
                FE16CFD2169D1DEC00D3A0C7 /* DatabaseBackendSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DatabaseBackendSync.h; path = Modules/webdatabase/DatabaseBackendSync.h; sourceTree = "<group>"; };
-               FEBC5F2F16BD0CC300659BD3 /* DatabaseBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DatabaseBase.cpp; path = Modules/webdatabase/DatabaseBase.cpp; sourceTree = "<group>"; };
-               FEBC5F3016BD0CC300659BD3 /* DatabaseBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DatabaseBase.h; path = Modules/webdatabase/DatabaseBase.h; sourceTree = "<group>"; };
                FE3371A0167C11D400EDB752 /* DatabaseBasicTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DatabaseBasicTypes.h; path = Modules/webdatabase/DatabaseBasicTypes.h; sourceTree = "<group>"; };
                FE456F161677D74E005EDDF9 /* DatabaseManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DatabaseManager.cpp; path = Modules/webdatabase/DatabaseManager.cpp; sourceTree = "<group>"; };
                FE456F171677D74E005EDDF9 /* DatabaseManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DatabaseManager.h; path = Modules/webdatabase/DatabaseManager.h; sourceTree = "<group>"; };
-               FEB26D27167A8F2A00FDD26B /* DatabaseServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DatabaseServer.cpp; path = Modules/webdatabase/DatabaseServer.cpp; sourceTree = "<group>"; };
-               FEAF6653167970070062D0C5 /* DatabaseServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DatabaseServer.h; path = Modules/webdatabase/DatabaseServer.h; sourceTree = "<group>"; };
-               FEDEF83F16797108000E444A /* DatabaseStrategy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DatabaseStrategy.cpp; sourceTree = "<group>"; };
-               FEDEF84016797108000E444A /* DatabaseStrategy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatabaseStrategy.h; sourceTree = "<group>"; };
+               FE6F6AAD169E057500FC30A2 /* DatabaseBackendContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DatabaseBackendContext.cpp; path = Modules/webdatabase/DatabaseBackendContext.cpp; sourceTree = "<group>"; };
+               FE6F6AAE169E057500FC30A2 /* DatabaseBackendContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DatabaseBackendContext.h; path = Modules/webdatabase/DatabaseBackendContext.h; sourceTree = "<group>"; };
                FE6FD4850F676E5700092873 /* Coordinates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Coordinates.h; sourceTree = "<group>"; };
                FE6FD4860F676E5700092873 /* Coordinates.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Coordinates.idl; sourceTree = "<group>"; };
                FE6FD48B0F676E9300092873 /* JSCoordinates.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCoordinates.cpp; sourceTree = "<group>"; };
                FE80DA620E9C4703000D6F75 /* JSGeoposition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGeoposition.h; sourceTree = "<group>"; };
                FE80DA6D0E9C472F000D6F75 /* JSPositionError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPositionError.cpp; sourceTree = "<group>"; };
                FE80DA6E0E9C472F000D6F75 /* JSPositionError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPositionError.h; sourceTree = "<group>"; };
+               FEAD7D8516C339EE00D4670B /* SQLTransactionBackendSync.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SQLTransactionBackendSync.cpp; path = Modules/webdatabase/SQLTransactionBackendSync.cpp; sourceTree = "<group>"; };
+               FEAD7D8616C339EE00D4670B /* SQLTransactionBackendSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SQLTransactionBackendSync.h; path = Modules/webdatabase/SQLTransactionBackendSync.h; sourceTree = "<group>"; };
+               FEAF6653167970070062D0C5 /* DatabaseServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DatabaseServer.h; path = Modules/webdatabase/DatabaseServer.h; sourceTree = "<group>"; };
+               FEB26D27167A8F2A00FDD26B /* DatabaseServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DatabaseServer.cpp; path = Modules/webdatabase/DatabaseServer.cpp; sourceTree = "<group>"; };
+               FEBC5F2F16BD0CC300659BD3 /* DatabaseBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DatabaseBase.cpp; path = Modules/webdatabase/DatabaseBase.cpp; sourceTree = "<group>"; };
+               FEBC5F3016BD0CC300659BD3 /* DatabaseBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DatabaseBase.h; path = Modules/webdatabase/DatabaseBase.h; sourceTree = "<group>"; };
+               FEDEF83F16797108000E444A /* DatabaseStrategy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DatabaseStrategy.cpp; sourceTree = "<group>"; };
+               FEDEF84016797108000E444A /* DatabaseStrategy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatabaseStrategy.h; sourceTree = "<group>"; };
+               FEE1811116C319E800084849 /* SQLTransactionBackend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SQLTransactionBackend.cpp; path = Modules/webdatabase/SQLTransactionBackend.cpp; sourceTree = "<group>"; };
+               FEE1811216C319E800084849 /* SQLTransactionBackend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SQLTransactionBackend.h; path = Modules/webdatabase/SQLTransactionBackend.h; sourceTree = "<group>"; };
                FF945EC9161F7F3600971BC8 /* PseudoElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PseudoElement.cpp; sourceTree = "<group>"; };
                FF945ECA161F7F3600971BC8 /* PseudoElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PseudoElement.h; sourceTree = "<group>"; };
                FFD5B977135CC97800D5E92A /* PageVisibilityState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageVisibilityState.cpp; sourceTree = "<group>"; };
index 883c1ac132e2dd3c51edd81a999c7074210d495a..c5691119a91d07c1c6d6a0c6abf72a5213fbc327 100644 (file)
@@ -127,6 +127,11 @@ void InbandTextTrack::addGenericCue(InbandTextTrackPrivate* trackPrivate, Generi
         cue->setLine(lround(cueData->line()), IGNORE_EXCEPTION);
     if (cueData->size() > 0)
         cue->setSize(lround(cueData->size()), IGNORE_EXCEPTION);
+    if (cueData->backgroundColor().isValid())
+        cue->setBackgroundColor(cueData->backgroundColor().rgb());
+    if (cueData->foregroundColor().isValid())
+        cue->setForegroundColor(cueData->foregroundColor().rgb());
+
     if (cueData->align() == GenericCueData::Start)
         cue->setAlign(ASCIILiteral("start"), IGNORE_EXCEPTION);
     else if (cueData->align() == GenericCueData::Middle)
index 38517ab293c8b2feb8bceebf64f013cbeea5449a..5b487fd45796e4373a5285a1736844dafddd2d62 100644 (file)
@@ -35,6 +35,7 @@
 #if ENABLE(VIDEO_TRACK)
 
 #include "EventTarget.h"
+#include "HTMLDivElement.h"
 #include "HTMLElement.h"
 #include "TextTrack.h"
 #include <wtf/PassOwnPtr.h>
@@ -43,7 +44,6 @@
 namespace WebCore {
 
 class DocumentFragment;
-class HTMLDivElement;
 class ScriptExecutionContext;
 class TextTrack;
 class TextTrackCue;
@@ -141,6 +141,8 @@ public:
     void setIsActive(bool);
 
     PassRefPtr<TextTrackCueBox> getDisplayTree(const IntSize& videoSize);
+    PassRefPtr<HTMLDivElement> element() const { return m_allDocumentNodes; }
+
     void updateDisplayTree(float);
     void removeDisplayTree();
     void markFutureAndPastNodes(ContainerNode*, double, double);
index 9241673a9da6d5d5267632bae51dbf97d75f6741..26f4472d130c726544da50643dc3f05909ec4c21 100644 (file)
@@ -80,6 +80,12 @@ void TextTrackCueGenericBoxElement::applyCSSProperties(const IntSize& videoSize)
             setInlineStyleProperty(CSSPropertyHeight, size,  CSSPrimitiveValue::CSS_PERCENTAGE);
     }
 
+    if (cue->foregroundColor().isValid())
+        setInlineStyleProperty(CSSPropertyColor, cue->foregroundColor().serialized());
+    
+    if (cue->backgroundColor().isValid())
+        cue->element()->setInlineStyleProperty(CSSPropertyBackgroundColor, cue->backgroundColor().serialized());
+
     if (cue->getWritingDirection() == TextTrackCue::Horizontal)
         setInlineStyleProperty(CSSPropertyHeight, CSSValueAuto);
     else
@@ -142,6 +148,10 @@ bool TextTrackCueGeneric::operator==(const TextTrackCue& cue) const
         return false;
     if (m_fontName != other->fontName())
         return false;
+    if (m_foregroundColor != other->foregroundColor())
+        return false;
+    if (m_backgroundColor != other->backgroundColor())
+        return false;
 
     return TextTrackCue::operator==(cue);
 }
index 2f4e8026a9a7e5ee7f02b4113fd37d844243303e..5e97ec9a3739c132734973387921cdbc0d955c64 100644 (file)
@@ -28,7 +28,7 @@
 
 #if ENABLE(VIDEO_TRACK)
 
-#include "HTMLElement.h"
+#include "Color.h"
 #include "TextTrackCue.h"
 #include <wtf/RefCounted.h>
 
@@ -62,6 +62,12 @@ public:
     String fontName() const { return m_fontName; }
     void setFontName(String name) { m_fontName = name; }
 
+    Color foregroundColor() const { return m_foregroundColor; }
+    void setForegroundColor(RGBA32 color) { m_foregroundColor.setRGB(color); }
+    
+    Color backgroundColor() const { return m_backgroundColor; }
+    void setBackgroundColor(RGBA32 color) { m_backgroundColor.setRGB(color); }
+
     virtual bool operator==(const TextTrackCue&) const OVERRIDE;
     virtual bool operator!=(const TextTrackCue& cue) const OVERRIDE
     {
@@ -73,6 +79,8 @@ public:
 private:
     TextTrackCueGeneric(ScriptExecutionContext*, double start, double end, const String&);
     
+    Color m_foregroundColor;
+    Color m_backgroundColor;
     double m_baseFontSizeRelativeToVideoHeight;
     double m_fontSizeMultiplier;
     String m_fontName;
index d3467be7a3fd41dfa4a3ca3fce77aa284bc11bc8..3ca15b79aa59512af144d1dd85c98e0689ad7aa7 100644 (file)
@@ -36,9 +36,7 @@
 #import "KURL.h"
 #import "Language.h"
 #import "LocalizedStrings.h"
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
-#import "MediaAccessibility/MediaAccessibility.h"
-#endif
+#import "Logging.h"
 #import "PageGroup.h"
 #import "SoftLinking.h"
 #import "TextTrackCue.h"
 #import <wtf/RetainPtr.h>
 #import <wtf/text/StringBuilder.h>
 
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
+#import "MediaAccessibility/MediaAccessibility.h"
+#endif
+
 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
 
 SOFT_LINK_FRAMEWORK_OPTIONAL(MediaAccessibility)
@@ -114,13 +116,13 @@ void CaptionUserPreferencesMac::registerForCaptionPreferencesChangedCallbacks(Ca
 
     if (!kMAXCaptionAppearanceSettingsChangedNotification)
         return;
-    
+
     if (!m_listeningForPreferenceChanges) {
         m_listeningForPreferenceChanges = true;
         CFNotificationCenterAddObserver (CFNotificationCenterGetLocalCenter(), this, userCaptionPreferencesChangedNotificationCallback, kMAXCaptionAppearanceSettingsChangedNotification, NULL, CFNotificationSuspensionBehaviorCoalesce);
-        updateCaptionStyleSheetOveride();
     }
     
+    updateCaptionStyleSheetOveride();
     m_captionPreferenceChangeListeners.add(listener);
 }
 
@@ -148,10 +150,7 @@ String CaptionUserPreferencesMac::captionsWindowCSS() const
     StringBuilder builder;
     builder.append(windowStyle);
     builder.append(getPropertyNameString(CSSPropertyPadding));
-    builder.append(": .2em");
-    if (behavior == kMACaptionAppearanceBehaviorUseValue)
-        builder.append(" !important");
-    builder.append(';');
+    builder.append(": .4em !important;");
     
     return builder.toString();
 }
@@ -368,6 +367,8 @@ String CaptionUserPreferencesMac::captionsStyleSheetOverride() const
         captionsOverrideStyleSheet.append('}');
     }
 
+    LOG(Media, "CaptionUserPreferencesMac::captionsStyleSheetOverrideSetting sytle to:\n%s", captionsOverrideStyleSheet.toString().utf8().data());
+
     return captionsOverrideStyleSheet.toString();
 }
 
index 83e92d4785fc915b4e7fefb61464cdfc794a63cc..cf7ddfd2ec938d4cd717a887fde7dfe1c23ac9c4 100644 (file)
@@ -26,6 +26,7 @@
 #ifndef InbandTextTrackPrivateClient_h
 #define InbandTextTrackPrivateClient_h
 
+#include "Color.h"
 #include <wtf/Noncopyable.h>
 #include <wtf/text/WTFString.h>
 
@@ -89,7 +90,13 @@ public:
 
     double relativeFontSize() const { return m_relativeFontSize; }
     void setRelativeFontSize(double relativeFontSize) { m_relativeFontSize = relativeFontSize; }
-    
+
+    Color foregroundColor() const { return m_foregroundColor; }
+    void setForegroundColor(RGBA32 color) { m_foregroundColor.setRGB(color); }
+
+    Color backgroundColor() const { return m_backgroundColor; }
+    void setBackgroundColor(RGBA32 color) { m_backgroundColor.setRGB(color); }
+
 private:
     double m_startTime;
     double m_endTime;
@@ -102,6 +109,8 @@ private:
     String m_fontName;
     double m_baseFontSize;
     double m_relativeFontSize;
+    Color m_foregroundColor;
+    Color m_backgroundColor;
 };
 
 class InbandTextTrackPrivateClient {
index 7409e5a1c9260af7bb9def723642c6f184bc0c25..126874dac1cc50e2a4e746e80f165061e219222e 100644 (file)
@@ -57,6 +57,8 @@ SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextVerticalLayout_RightToLeft, CFStrin
 SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_BaseFontSizePercentageRelativeToVideoHeight, CFStringRef)
 SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_RelativeFontSize, CFStringRef)
 SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_FontFamilyName, CFStringRef)
+SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_ForegroundColorARGB, CFStringRef)
+SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_BackgroundColorARGB, CFStringRef)
 
 #define kCMTextMarkupAttribute_Alignment getkCMTextMarkupAttribute_Alignment()
 #define kCMTextMarkupAlignmentType_Start getkCMTextMarkupAlignmentType_Start()
@@ -74,6 +76,8 @@ SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_FontFamilyName, CFS
 #define kCMTextMarkupAttribute_BaseFontSizePercentageRelativeToVideoHeight getkCMTextMarkupAttribute_BaseFontSizePercentageRelativeToVideoHeight()
 #define kCMTextMarkupAttribute_RelativeFontSize getkCMTextMarkupAttribute_RelativeFontSize()
 #define kCMTextMarkupAttribute_FontFamilyName getkCMTextMarkupAttribute_FontFamilyName()
+#define kCMTextMarkupAttribute_ForegroundColorARGB getkCMTextMarkupAttribute_ForegroundColorARGB()
+#define kCMTextMarkupAttribute_BackgroundColorARGB getkCMTextMarkupAttribute_BackgroundColorARGB()
 
 using namespace std;
 
@@ -92,6 +96,26 @@ InbandTextTrackPrivateAVF::~InbandTextTrackPrivateAVF()
     disconnect();
 }
 
+static bool makeRGBA32FromARGBCFArray(CFArrayRef colorArray, RGBA32& color)
+{
+    if (CFArrayGetCount(colorArray) < 4)
+        return false;
+
+    float componentArray[4];
+    for (int i = 0; i < 4; i++) {
+        CFNumberRef value = static_cast<CFNumberRef>(CFArrayGetValueAtIndex(colorArray, i));
+        if (CFGetTypeID(value) != CFNumberGetTypeID())
+            return false;
+
+        float component;
+        CFNumberGetValue(value, kCFNumberFloatType, &component);
+        componentArray[i] = component;
+    }
+
+    color = makeRGBA32FromFloats(componentArray[1] * 255, componentArray[2] * 255, componentArray[3] * 255, componentArray[0] * 255);
+    return true;
+}
+
 void InbandTextTrackPrivateAVF::processCueAttributes(CFAttributedStringRef attributedString, GenericCueData* cueData)
 {
     // Some of the attributes we translate into per-cue WebVTT settings are are repeated on each part of an attributed string so only
@@ -267,6 +291,28 @@ void InbandTextTrackPrivateAVF::processCueAttributes(CFAttributedStringRef attri
                 cueData->setFontName(valueString);
                 continue;
             }
+            
+            if (CFStringCompare(key, kCMTextMarkupAttribute_ForegroundColorARGB, 0) == kCFCompareEqualTo) {
+                CFArrayRef arrayValue = static_cast<CFArrayRef>(value);
+                if (CFGetTypeID(arrayValue) != CFArrayGetTypeID())
+                    continue;
+                
+                RGBA32 color;
+                if (!makeRGBA32FromARGBCFArray(arrayValue, color))
+                    continue;
+                cueData->setForegroundColor(color);
+            }
+            
+            if (CFStringCompare(key, kCMTextMarkupAttribute_BackgroundColorARGB, 0) == kCFCompareEqualTo) {
+                CFArrayRef arrayValue = static_cast<CFArrayRef>(value);
+                if (CFGetTypeID(arrayValue) != CFArrayGetTypeID())
+                    continue;
+                
+                RGBA32 color;
+                if (!makeRGBA32FromARGBCFArray(arrayValue, color))
+                    continue;
+                cueData->setBackgroundColor(color);
+            }
         }
 
         content.append(tagStart);