Changeset 215175 in webkit


Ignore:
Timestamp:
Apr 10, 2017 3:01:46 AM (7 years ago)
Author:
pvollan@apple.com
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r215173 r215175  
     12017-04-10  Per Arne Vollan  <pvollan@apple.com>
     2
     3        Add fallback fonts to video captions stylesheet.
     4        https://bugs.webkit.org/show_bug.cgi?id=170495
     5
     6        Reviewed by Myles C. Maxfield.
     7
     8        The kCTFontCascadeListAttribute key is used to obtain the cascade list for a font reference.
     9
     10        I have not added a test, since CaptionUserPreferences::testingMode() returns true when running tests,
     11        preventing this code path from being executed.
     12
     13        * page/CaptionUserPreferencesMediaAF.cpp:
     14        (WebCore::CaptionUserPreferencesMediaAF::captionsDefaultFontCSS):
     15
    1162017-04-10  Chris Dumez  <cdumez@apple.com>
    217
  • trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp

    r215160 r215175  
    8484SOFT_LINK_AVF_POINTER(CoreText, kCTFontNameAttribute, CFStringRef)
    8585#define kCTFontNameAttribute getkCTFontNameAttribute()
     86SOFT_LINK_AVF_POINTER(CoreText, kCTFontCascadeListAttribute, CFStringRef)
     87#define kCTFontCascadeListAttribute getkCTFontCascadeListAttribute()
    8688
    8789#define CTFontDescriptorCopyAttribute softLink_CTFontDescriptorCopyAttribute
     
    425427    if (!name)
    426428        return emptyString();
    427    
     429
    428430    StringBuilder builder;
    429431   
     
    432434    builder.append(static_cast<CFStringRef>(name.get()));
    433435    builder.append('"');
     436
     437    auto cascadeList = adoptCF(static_cast<CFArrayRef>(CTFontDescriptorCopyAttribute(font.get(), kCTFontCascadeListAttribute)));
     438
     439    for (CFIndex i = 0; i < CFArrayGetCount(cascadeList.get()); i++) {
     440        auto fontCascade = static_cast<CTFontDescriptorRef>(CFArrayGetValueAtIndex(cascadeList.get(), i));
     441        auto fontCascadeName = adoptCF(CTFontDescriptorCopyAttribute(fontCascade, kCTFontNameAttribute));
     442        builder.append(", \"");
     443        builder.append(static_cast<CFStringRef>(fontCascadeName.get()));
     444        builder.append('"');
     445    }
     446   
    434447    if (behavior == kMACaptionAppearanceBehaviorUseValue)
    435448        builder.appendLiteral(" !important");
Note: See TracChangeset for help on using the changeset viewer.