Changeset 142383 in webkit


Ignore:
Timestamp:
Feb 9, 2013 4:50:59 PM (11 years ago)
Author:
eric.carlson@apple.com
Message:

[Mac] Do not assume MediaAccessibility framework is installed
https://bugs.webkit.org/show_bug.cgi?id=109365

Reviewed by Sam Weinig.

  • page/CaptionUserPreferencesMac.h:
  • page/CaptionUserPreferencesMac.mm:

(WebCore::CaptionUserPreferencesMac::userPrefersCaptions): Call the base class if the framework

is not available.

(WebCore::CaptionUserPreferencesMac::setUserPrefersCaptions): Ditto.
(WebCore::CaptionUserPreferencesMac::userHasCaptionPreferences): Ditto.
(WebCore::CaptionUserPreferencesMac::registerForCaptionPreferencesChangedCallbacks): Ditto.
(WebCore::CaptionUserPreferencesMac::unregisterForCaptionPreferencesChangedCallbacks): Ditto.
(WebCore::CaptionUserPreferencesMac::captionsStyleSheetOverride): Ditto.
(WebCore::CaptionUserPreferencesMac::captionFontSizeScale): Ditto.
(WebCore::CaptionUserPreferencesMac::setPreferredLanguage): Ditto.
(WebCore::CaptionUserPreferencesMac::preferredLanguages): Ditto.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r142382 r142383  
     12013-02-09  Eric Carlson  <eric.carlson@apple.com>
     2
     3        [Mac] Do not assume MediaAccessibility framework is installed
     4        https://bugs.webkit.org/show_bug.cgi?id=109365
     5
     6        Reviewed by Sam Weinig.
     7
     8        * page/CaptionUserPreferencesMac.h:
     9        * page/CaptionUserPreferencesMac.mm:
     10        (WebCore::CaptionUserPreferencesMac::userPrefersCaptions): Call the base class if the framework
     11            is not available.
     12        (WebCore::CaptionUserPreferencesMac::setUserPrefersCaptions): Ditto.
     13        (WebCore::CaptionUserPreferencesMac::userHasCaptionPreferences): Ditto.
     14        (WebCore::CaptionUserPreferencesMac::registerForCaptionPreferencesChangedCallbacks): Ditto.
     15        (WebCore::CaptionUserPreferencesMac::unregisterForCaptionPreferencesChangedCallbacks): Ditto.
     16        (WebCore::CaptionUserPreferencesMac::captionsStyleSheetOverride): Ditto.
     17        (WebCore::CaptionUserPreferencesMac::captionFontSizeScale): Ditto.
     18        (WebCore::CaptionUserPreferencesMac::setPreferredLanguage): Ditto.
     19        (WebCore::CaptionUserPreferencesMac::preferredLanguages): Ditto.
     20
    1212013-02-09  Dominic Mazzoni  <dmazzoni@google.com>
    222
  • trunk/Source/WebCore/page/CaptionUserPreferencesMac.h

    r141864 r142383  
    4444    virtual bool userPrefersCaptions() const OVERRIDE;
    4545    virtual void setUserPrefersCaptions(bool) OVERRIDE;
    46     virtual bool userHasCaptionPreferences() const OVERRIDE { return true; }
     46    virtual bool userHasCaptionPreferences() const OVERRIDE;
    4747    virtual float captionFontSizeScale(bool&) const OVERRIDE;
    4848    virtual String captionsStyleSheetOverride() const OVERRIDE;
  • trunk/Source/WebCore/page/CaptionUserPreferencesMac.mm

    r142349 r142383  
    103103bool CaptionUserPreferencesMac::userPrefersCaptions() const
    104104{
     105    if (!MediaAccessibilityLibrary())
     106        return CaptionUserPreferences::userPrefersCaptions();
     107
    105108    return MACaptionAppearanceGetShowCaptions(kMACaptionAppearanceDomainUser);
    106109}
     
    108111void CaptionUserPreferencesMac::setUserPrefersCaptions(bool preference)
    109112{
     113    if (!MediaAccessibilityLibrary()) {
     114        CaptionUserPreferences::setUserPrefersCaptions(preference);
     115        return;
     116    }
     117
    110118    MACaptionAppearanceSetShowCaptions(kMACaptionAppearanceDomainUser, preference);
    111119}
    112120
     121bool CaptionUserPreferencesMac::userHasCaptionPreferences() const
     122{
     123    if (!MediaAccessibilityLibrary())
     124        return CaptionUserPreferences::userHasCaptionPreferences();
     125
     126    return !MediaAccessibilityLibrary();
     127}
     128
    113129void CaptionUserPreferencesMac::registerForCaptionPreferencesChangedCallbacks(CaptionPreferencesChangedListener* listener)
    114130{
     131    if (!MediaAccessibilityLibrary()) {
     132        CaptionUserPreferences::registerForCaptionPreferencesChangedCallbacks(listener);
     133        return;
     134    }
     135
    115136    ASSERT(!m_captionPreferenceChangeListeners.contains(listener));
    116137
     
    129150void CaptionUserPreferencesMac::unregisterForCaptionPreferencesChangedCallbacks(CaptionPreferencesChangedListener* listener)
    130151{
     152    if (!MediaAccessibilityLibrary()) {
     153        CaptionUserPreferences::unregisterForCaptionPreferencesChangedCallbacks(listener);
     154        return;
     155    }
     156
    131157    if (kMAXCaptionAppearanceSettingsChangedNotification)
    132158        m_captionPreferenceChangeListeners.remove(listener);
     
    333359String CaptionUserPreferencesMac::captionsStyleSheetOverride() const
    334360{
     361    if (!MediaAccessibilityLibrary())
     362        return CaptionUserPreferences::captionsStyleSheetOverride();
     363
    335364    StringBuilder captionsOverrideStyleSheet;
    336365
     
    375404float CaptionUserPreferencesMac::captionFontSizeScale(bool& important) const
    376405{
     406    if (!MediaAccessibilityLibrary())
     407        return CaptionUserPreferences::captionFontSizeScale(important);
     408
    377409    MACaptionAppearanceBehavior behavior;
    378410    CGFloat characterScale = CaptionUserPreferences::captionFontSizeScale(important);
     
    418450void CaptionUserPreferencesMac::setPreferredLanguage(String language) const
    419451{
     452    if (!MediaAccessibilityLibrary()) {
     453        CaptionUserPreferences::setPreferredLanguage(language);
     454        return;
     455    }
     456
    420457    MACaptionAppearanceAddSelectedLanguage(kMACaptionAppearanceDomainUser, language.createCFString().get());
    421458}
     
    426463    if (!override.isEmpty())
    427464        return override;
     465
     466    if (!MediaAccessibilityLibrary())
     467        return CaptionUserPreferences::preferredLanguages();
    428468
    429469    RetainPtr<CFArrayRef> languages(AdoptCF, MACaptionAppearanceCopySelectedLanguages(kMACaptionAppearanceDomainUser));
Note: See TracChangeset for help on using the changeset viewer.