Title: [215175] trunk/Source/WebCore
- Revision
- 215175
- Author
- pvol...@apple.com
- Date
- 2017-04-10 03:01:46 -0700 (Mon, 10 Apr 2017)
Log Message
Add fallback fonts to video captions stylesheet.
https://bugs.webkit.org/show_bug.cgi?id=170495
Reviewed by Myles C. Maxfield.
The kCTFontCascadeListAttribute key is used to obtain the cascade list for a font reference.
I have not added a test, since CaptionUserPreferences::testingMode() returns true when running tests,
preventing this code path from being executed.
* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::CaptionUserPreferencesMediaAF::captionsDefaultFontCSS):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (215174 => 215175)
--- trunk/Source/WebCore/ChangeLog 2017-04-10 08:28:40 UTC (rev 215174)
+++ trunk/Source/WebCore/ChangeLog 2017-04-10 10:01:46 UTC (rev 215175)
@@ -1,3 +1,18 @@
+2017-04-10 Per Arne Vollan <pvol...@apple.com>
+
+ Add fallback fonts to video captions stylesheet.
+ https://bugs.webkit.org/show_bug.cgi?id=170495
+
+ Reviewed by Myles C. Maxfield.
+
+ The kCTFontCascadeListAttribute key is used to obtain the cascade list for a font reference.
+
+ I have not added a test, since CaptionUserPreferences::testingMode() returns true when running tests,
+ preventing this code path from being executed.
+
+ * page/CaptionUserPreferencesMediaAF.cpp:
+ (WebCore::CaptionUserPreferencesMediaAF::captionsDefaultFontCSS):
+
2017-04-10 Chris Dumez <cdu...@apple.com>
Drop Timer::startOneShot() overload taking a double
Modified: trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp (215174 => 215175)
--- trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp 2017-04-10 08:28:40 UTC (rev 215174)
+++ trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp 2017-04-10 10:01:46 UTC (rev 215175)
@@ -83,6 +83,8 @@
SOFT_LINK_AVF_FRAMEWORK_IMPORT(CoreText, CTFontDescriptorCopyAttribute, CFTypeRef, (CTFontDescriptorRef descriptor, CFStringRef attribute), (descriptor, attribute));
SOFT_LINK_AVF_POINTER(CoreText, kCTFontNameAttribute, CFStringRef)
#define kCTFontNameAttribute getkCTFontNameAttribute()
+SOFT_LINK_AVF_POINTER(CoreText, kCTFontCascadeListAttribute, CFStringRef)
+#define kCTFontCascadeListAttribute getkCTFontCascadeListAttribute()
#define CTFontDescriptorCopyAttribute softLink_CTFontDescriptorCopyAttribute
@@ -424,7 +426,7 @@
RetainPtr<CFTypeRef> name = adoptCF(CTFontDescriptorCopyAttribute(font.get(), kCTFontNameAttribute));
if (!name)
return emptyString();
-
+
StringBuilder builder;
builder.append(getPropertyNameString(CSSPropertyFontFamily));
@@ -431,6 +433,17 @@
builder.appendLiteral(": \"");
builder.append(static_cast<CFStringRef>(name.get()));
builder.append('"');
+
+ auto cascadeList = adoptCF(static_cast<CFArrayRef>(CTFontDescriptorCopyAttribute(font.get(), kCTFontCascadeListAttribute)));
+
+ for (CFIndex i = 0; i < CFArrayGetCount(cascadeList.get()); i++) {
+ auto fontCascade = static_cast<CTFontDescriptorRef>(CFArrayGetValueAtIndex(cascadeList.get(), i));
+ auto fontCascadeName = adoptCF(CTFontDescriptorCopyAttribute(fontCascade, kCTFontNameAttribute));
+ builder.append(", \"");
+ builder.append(static_cast<CFStringRef>(fontCascadeName.get()));
+ builder.append('"');
+ }
+
if (behavior == kMACaptionAppearanceBehaviorUseValue)
builder.appendLiteral(" !important");
builder.append(';');
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes