Title: [150055] trunk/Source/WebCore
Revision
150055
Author
[email protected]
Date
2013-05-13 22:42:07 -0700 (Mon, 13 May 2013)

Log Message

[Mac] update in-band caption attributes
https://bugs.webkit.org/show_bug.cgi?id=116057

Reviewed by Dean Jackson.

* html/track/InbandTextTrack.cpp:
(WebCore::InbandTextTrack::updateCueFromCueData): Copy highlight color.

* html/track/TextTrackCueGeneric.cpp:
(WebCore::TextTrackCueGenericBoxElement::applyCSSProperties): "highlight" color sets the cue
    background, "background" color sets the cue container background.
* html/track/TextTrackCueGeneric.h:

* platform/graphics/InbandTextTrackPrivateClient.h:

* platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
(WebCore::InbandTextTrackPrivateAVF::processCueAttributes): Process "highlight" color.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (150054 => 150055)


--- trunk/Source/WebCore/ChangeLog	2013-05-14 04:09:27 UTC (rev 150054)
+++ trunk/Source/WebCore/ChangeLog	2013-05-14 05:42:07 UTC (rev 150055)
@@ -1,3 +1,23 @@
+2013-05-13  Eric Carlson  <[email protected]>
+
+        [Mac] update in-band caption attributes
+        https://bugs.webkit.org/show_bug.cgi?id=116057
+
+        Reviewed by Dean Jackson.
+
+        * html/track/InbandTextTrack.cpp:
+        (WebCore::InbandTextTrack::updateCueFromCueData): Copy highlight color.
+
+        * html/track/TextTrackCueGeneric.cpp:
+        (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties): "highlight" color sets the cue
+            background, "background" color sets the cue container background.
+        * html/track/TextTrackCueGeneric.h:
+
+        * platform/graphics/InbandTextTrackPrivateClient.h:
+
+        * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
+        (WebCore::InbandTextTrackPrivateAVF::processCueAttributes): Process "highlight" color.
+
 2013-05-13  David Kilzer  <[email protected]>
 
         BUILD FIX (r150049): Fix RetainPtr<> type in PasteboardIOS.mm

Modified: trunk/Source/WebCore/html/track/InbandTextTrack.cpp (150054 => 150055)


--- trunk/Source/WebCore/html/track/InbandTextTrack.cpp	2013-05-14 04:09:27 UTC (rev 150054)
+++ trunk/Source/WebCore/html/track/InbandTextTrack.cpp	2013-05-14 05:42:07 UTC (rev 150055)
@@ -203,6 +203,8 @@
         cue->setBackgroundColor(cueData->backgroundColor().rgb());
     if (cueData->foregroundColor().isValid())
         cue->setForegroundColor(cueData->foregroundColor().rgb());
+    if (cueData->highlightColor().isValid())
+        cue->setHighlightColor(cueData->highlightColor().rgb());
 
     if (cueData->align() == GenericCueData::Start)
         cue->setAlign(ASCIILiteral("start"), IGNORE_EXCEPTION);

Modified: trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp (150054 => 150055)


--- trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp	2013-05-14 04:09:27 UTC (rev 150054)
+++ trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp	2013-05-14 05:42:07 UTC (rev 150055)
@@ -84,9 +84,8 @@
 
     if (cue->foregroundColor().isValid())
         cueElement->setInlineStyleProperty(CSSPropertyColor, cue->foregroundColor().serialized());
-    
-    if (cue->backgroundColor().isValid())
-        cueElement->setInlineStyleProperty(CSSPropertyBackgroundColor, cue->backgroundColor().serialized());
+    if (cue->highlightColor().isValid())
+        cueElement->setInlineStyleProperty(CSSPropertyBackgroundColor, cue->highlightColor().serialized());
 
     if (cue->getWritingDirection() == TextTrackCue::Horizontal)
         setInlineStyleProperty(CSSPropertyHeight, CSSValueAuto);
@@ -103,6 +102,8 @@
     else
         setInlineStyleProperty(CSSPropertyTextAlign, CSSValueStart);
 
+    if (cue->backgroundColor().isValid())
+        setInlineStyleProperty(CSSPropertyBackgroundColor, cue->backgroundColor().serialized());
     setInlineStyleProperty(CSSPropertyWebkitWritingMode, cue->getCSSWritingMode(), false);
     setInlineStyleProperty(CSSPropertyWhiteSpace, CSSValuePreWrap);
     setInlineStyleProperty(CSSPropertyWordBreak, CSSValueNormal);

Modified: trunk/Source/WebCore/html/track/TextTrackCueGeneric.h (150054 => 150055)


--- trunk/Source/WebCore/html/track/TextTrackCueGeneric.h	2013-05-14 04:09:27 UTC (rev 150054)
+++ trunk/Source/WebCore/html/track/TextTrackCueGeneric.h	2013-05-14 05:42:07 UTC (rev 150055)
@@ -67,7 +67,10 @@
     
     Color backgroundColor() const { return m_backgroundColor; }
     void setBackgroundColor(RGBA32 color) { m_backgroundColor.setRGB(color); }
-
+    
+    Color highlightColor() const { return m_highlightColor; }
+    void setHighlightColor(RGBA32 color) { m_highlightColor.setRGB(color); }
+    
     virtual void setFontSize(int, const IntSize&, bool important) OVERRIDE;
 
     virtual bool isEqual(const TextTrackCue&, CueMatchRules) const OVERRIDE;
@@ -79,6 +82,7 @@
     
     Color m_foregroundColor;
     Color m_backgroundColor;
+    Color m_highlightColor;
     double m_baseFontSizeRelativeToVideoHeight;
     double m_fontSizeMultiplier;
     String m_fontName;

Modified: trunk/Source/WebCore/platform/graphics/InbandTextTrackPrivateClient.h (150054 => 150055)


--- trunk/Source/WebCore/platform/graphics/InbandTextTrackPrivateClient.h	2013-05-14 04:09:27 UTC (rev 150054)
+++ trunk/Source/WebCore/platform/graphics/InbandTextTrackPrivateClient.h	2013-05-14 05:42:07 UTC (rev 150055)
@@ -86,7 +86,10 @@
 
     Color backgroundColor() const { return m_backgroundColor; }
     void setBackgroundColor(RGBA32 color) { m_backgroundColor.setRGB(color); }
-
+    
+    Color highlightColor() const { return m_highlightColor; }
+    void setHighlightColor(RGBA32 color) { m_highlightColor.setRGB(color); }
+    
     enum Status {
         Uninitialized,
         Partial,
@@ -122,6 +125,7 @@
     double m_relativeFontSize;
     Color m_foregroundColor;
     Color m_backgroundColor;
+    Color m_highlightColor;
     Status m_status;
 };
 

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp (150054 => 150055)


--- trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp	2013-05-14 04:09:27 UTC (rev 150054)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp	2013-05-14 05:42:07 UTC (rev 150055)
@@ -58,6 +58,7 @@
 SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_FontFamilyName, CFStringRef)
 SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_ForegroundColorARGB, CFStringRef)
 SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_BackgroundColorARGB, CFStringRef)
+SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_CharacterBackgroundColorARGB, CFStringRef)
 
 #define kCMTextMarkupAttribute_Alignment getkCMTextMarkupAttribute_Alignment()
 #define kCMTextMarkupAlignmentType_Start getkCMTextMarkupAlignmentType_Start()
@@ -77,6 +78,7 @@
 #define kCMTextMarkupAttribute_FontFamilyName getkCMTextMarkupAttribute_FontFamilyName()
 #define kCMTextMarkupAttribute_ForegroundColorARGB getkCMTextMarkupAttribute_ForegroundColorARGB()
 #define kCMTextMarkupAttribute_BackgroundColorARGB getkCMTextMarkupAttribute_BackgroundColorARGB()
+#define kCMTextMarkupAttribute_CharacterBackgroundColorARGB getkCMTextMarkupAttribute_CharacterBackgroundColorARGB()
 
 using namespace std;
 
@@ -261,7 +263,7 @@
                     tagStart.append(rightToLeftMark);
                 continue;
             }
-            
+
             if (CFStringCompare(key, kCMTextMarkupAttribute_BaseFontSizePercentageRelativeToVideoHeight, 0) == kCFCompareEqualTo) {
                 if (CFGetTypeID(value) != CFNumberGetTypeID())
                     continue;
@@ -272,7 +274,7 @@
                 cueData->setBaseFontSize(baseFontSize);
                 continue;
             }
-            
+
             if (CFStringCompare(key, kCMTextMarkupAttribute_RelativeFontSize, 0) == kCFCompareEqualTo) {
                 if (CFGetTypeID(value) != CFNumberGetTypeID())
                     continue;
@@ -295,7 +297,7 @@
                 cueData->setFontName(valueString);
                 continue;
             }
-            
+
             if (CFStringCompare(key, kCMTextMarkupAttribute_ForegroundColorARGB, 0) == kCFCompareEqualTo) {
                 CFArrayRef arrayValue = static_cast<CFArrayRef>(value);
                 if (CFGetTypeID(arrayValue) != CFArrayGetTypeID())
@@ -317,6 +319,17 @@
                     continue;
                 cueData->setBackgroundColor(color);
             }
+
+            if (CFStringCompare(key, kCMTextMarkupAttribute_CharacterBackgroundColorARGB, 0) == kCFCompareEqualTo) {
+                CFArrayRef arrayValue = static_cast<CFArrayRef>(value);
+                if (CFGetTypeID(arrayValue) != CFArrayGetTypeID())
+                    continue;
+                
+                RGBA32 color;
+                if (!makeRGBA32FromARGBCFArray(arrayValue, color))
+                    continue;
+                cueData->setHighlightColor(color);
+            }
         }
 
         content.append(tagStart);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to