Title: [101977] trunk/Source
Revision
101977
Author
eric.carl...@apple.com
Date
2011-12-05 00:42:27 -0800 (Mon, 05 Dec 2011)

Log Message

Source/WebCore: WebCore part of: Add WebKit preferences for text track settings
https://bugs.webkit.org/show_bug.cgi?id=73721

Reviewed by John Sullivan.

No new tests yet, still nothing to test.

* page/Settings.cpp:
(WebCore::Settings::setShouldDisplaySubtitles): Move the setters to the .cpp file so they
    aren't inlined.
(WebCore::Settings::setShouldDisplayCaptions): Ditto.
(WebCore::Settings::setShouldDisplayTextDescriptions): Ditto.
* page/Settings.h:

Source/WebKit/chromium: WebKit/chromium part of: Add WebKit preferences for text track settings
https://bugs.webkit.org/show_bug.cgi?id=73721

Reviewed by John Sullivan.

* src/WebSettingsImpl.cpp:
(WebKit::WebSettingsImpl::shouldDisplaySubtitles): Added.
(WebKit::WebSettingsImpl::shouldDisplayCaptions): Ditto.
(WebKit::WebSettingsImpl::shouldDisplayTextDescriptions): Ditto.
* src/WebSettingsImpl.h:

Source/WebKit/mac: Add WebKit preferences for text track settings
https://bugs.webkit.org/show_bug.cgi?id=73721

Reviewed by John Sullivan.

* WebView/WebPreferenceKeysPrivate.h: Added #define for shouldDisplaySubtitles, shouldDisplayCaptions,
and shouldDisplayTextDescriptions properties.

* WebView/WebPreferences.mm:
(+[WebPreferences initialize]): Initialize new preferences to NO.
(-[WebPreferences setShouldDisplaySubtitles:]): Added.
(-[WebPreferences shouldDisplaySubtitles]): Ditto.
(-[WebPreferences setShouldDisplayCaptions:]): Ditto.
(-[WebPreferences shouldDisplayCaptions]): Ditto.
(-[WebPreferences setShouldDisplayTextDescriptions:]): Ditto.
(-[WebPreferences shouldDisplayTextDescriptions]): Ditto.
* WebView/WebPreferencesPrivate.h:

* WebView/WebView.mm:
(-[WebView _preferencesChanged:]): Updates WebCore settings from WebKit prefs.

Source/WebKit/win: WebKit/mac part of: Add WebKit preferences for text track settings
https://bugs.webkit.org/show_bug.cgi?id=73721

Reviewed by John Sullivan.

* Interfaces/IWebPreferences.idl: Declare getters and setters for new properties.

* WebPreferenceKeysPrivate.h: Added #define for shouldDisplaySubtitles, shouldDisplayCaptions,
and shouldDisplayTextDescriptions properties.

* WebPreferences.cpp:
(WebPreferences::setShouldDisplaySubtitles): Added.
(WebPreferences::shouldDisplaySubtitles): Ditto.
(WebPreferences::setShouldDisplayCaptions): Ditto.
(WebPreferences::shouldDisplayCaptions): Ditto.
(WebPreferences::setShouldDisplayTextDescriptions): Ditto.
(WebPreferences::shouldDisplayTextDescriptions): Ditto.
* WebPreferences.h: Declare new methods.

* WebView.cpp:
(WebView::notifyPreferencesChanged): Updates WebCore settings from WebKit prefs.

Source/WebKit2: WebKit2 part of: Add WebKit preferences for text track settings
https://bugs.webkit.org/show_bug.cgi?id=73721

Reviewed by John Sullivan.

* Shared/WebPreferencesStore.h: Declared shouldDisplaySubtitles, shouldDisplayCaptions, and
shouldDisplayTextDescriptions properties with macros. All default to false.

* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetShouldDisplaySubtitles): Added.
(WKPreferencesGetShouldDisplaySubtitles): Ditto.
(WKPreferencesSetShouldDisplayCaptions): Ditto.
(WKPreferencesGetShouldDisplayCaptions): Ditto.
(WKPreferencesSetShouldDisplayTextDescriptions): Ditto.
(WKPreferencesGetShouldDisplayTextDescriptions): Ditto.
* UIProcess/API/C/WKPreferences.h:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences): Updates WebCore settings from WebKit2 prefs.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (101976 => 101977)


--- trunk/Source/WebCore/ChangeLog	2011-12-05 08:19:46 UTC (rev 101976)
+++ trunk/Source/WebCore/ChangeLog	2011-12-05 08:42:27 UTC (rev 101977)
@@ -1,3 +1,19 @@
+2011-12-05  Eric Carlson  <eric.carl...@apple.com>
+
+        WebCore part of: Add WebKit preferences for text track settings
+        https://bugs.webkit.org/show_bug.cgi?id=73721
+
+        Reviewed by John Sullivan.
+
+        No new tests yet, still nothing to test.
+
+        * page/Settings.cpp:
+        (WebCore::Settings::setShouldDisplaySubtitles): Move the setters to the .cpp file so they
+            aren't inlined.
+        (WebCore::Settings::setShouldDisplayCaptions): Ditto.
+        (WebCore::Settings::setShouldDisplayTextDescriptions): Ditto.
+        * page/Settings.h:
+
 2011-12-05  Noel Gordon  <noel.gor...@gmail.com>
 
         ImageDecoder setSize() should check for backing store allocation failure

Modified: trunk/Source/WebCore/page/Settings.cpp (101976 => 101977)


--- trunk/Source/WebCore/page/Settings.cpp	2011-12-05 08:19:46 UTC (rev 101976)
+++ trunk/Source/WebCore/page/Settings.cpp	2011-12-05 08:42:27 UTC (rev 101977)
@@ -836,4 +836,21 @@
     return gMockScrollbarsEnabled;
 }
 
+#if ENABLE(VIDEO_TRACK)
+void Settings::setShouldDisplaySubtitles(bool flag)
+{
+    m_shouldDisplaySubtitles = flag;
+}
+
+void Settings::setShouldDisplayCaptions(bool flag)
+{
+    m_shouldDisplayCaptions = flag;
+}
+
+void Settings::setShouldDisplayTextDescriptions(bool flag)
+{
+    m_shouldDisplayTextDescriptions = flag;
+}
+#endif
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/page/Settings.h (101976 => 101977)


--- trunk/Source/WebCore/page/Settings.h	2011-12-05 08:19:46 UTC (rev 101976)
+++ trunk/Source/WebCore/page/Settings.h	2011-12-05 08:42:27 UTC (rev 101977)
@@ -487,13 +487,13 @@
         bool visualWordMovementEnabled() const { return m_visualWordMovementEnabled; }
 
 #if ENABLE(VIDEO_TRACK)
-        void setShouldDisplaySubtitles(bool flag) { m_shouldDisplaySubtitles = flag; }
+        void setShouldDisplaySubtitles(bool);
         bool shouldDisplaySubtitles() const { return m_shouldDisplaySubtitles; }
 
-        void setShouldDisplayCaptions(bool flag) { m_shouldDisplayCaptions = flag; }
+        void setShouldDisplayCaptions(bool);
         bool shouldDisplayCaptions() const { return m_shouldDisplayCaptions; }
 
-        void setShouldDisplayTextDescriptions(bool flag) { m_shouldDisplayTextDescriptions = flag; }
+        void setShouldDisplayTextDescriptions(bool);
         bool shouldDisplayTextDescriptions() const { return m_shouldDisplayTextDescriptions; }
 #endif
 

Modified: trunk/Source/WebKit/chromium/ChangeLog (101976 => 101977)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-12-05 08:19:46 UTC (rev 101976)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-12-05 08:42:27 UTC (rev 101977)
@@ -1,3 +1,16 @@
+2011-12-05  Eric Carlson  <eric.carl...@apple.com>
+
+        WebKit/chromium part of: Add WebKit preferences for text track settings
+        https://bugs.webkit.org/show_bug.cgi?id=73721
+
+        Reviewed by John Sullivan.
+
+        * src/WebSettingsImpl.cpp:
+        (WebKit::WebSettingsImpl::shouldDisplaySubtitles): Added.
+        (WebKit::WebSettingsImpl::shouldDisplayCaptions): Ditto.
+        (WebKit::WebSettingsImpl::shouldDisplayTextDescriptions): Ditto.
+        * src/WebSettingsImpl.h:
+
 2011-12-04  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed.  Rolled DEPS.

Modified: trunk/Source/WebKit/chromium/src/WebSettingsImpl.cpp (101976 => 101977)


--- trunk/Source/WebKit/chromium/src/WebSettingsImpl.cpp	2011-12-05 08:19:46 UTC (rev 101976)
+++ trunk/Source/WebKit/chromium/src/WebSettingsImpl.cpp	2011-12-05 08:42:27 UTC (rev 101977)
@@ -465,4 +465,32 @@
     m_settings->setVisualWordMovementEnabled(enabled);
 }
 
+void WebSettingsImpl::setShouldDisplaySubtitles(bool enabled)
+{
+#if ENABLE(VIDEO_TRACK)
+    m_settings->setShouldDisplaySubtitles(enabled);
+#else
+    UNUSED_PARAM(enabled);
+#endif
+}
+
+void WebSettingsImpl::setShouldDisplayCaptions(bool enabled)
+{
+#if ENABLE(VIDEO_TRACK)
+    m_settings->setShouldDisplayCaptions(enabled);
+#else
+    UNUSED_PARAM(enabled);
+#endif
+}
+
+void WebSettingsImpl::setShouldDisplayTextDescriptions(bool enabled)
+{
+#if ENABLE(VIDEO_TRACK)
+    m_settings->setShouldDisplayTextDescriptions(enabled);
+#else
+    UNUSED_PARAM(enabled);
+#endif
+}
+
+
 } // namespace WebKit

Modified: trunk/Source/WebKit/chromium/src/WebSettingsImpl.h (101976 => 101977)


--- trunk/Source/WebKit/chromium/src/WebSettingsImpl.h	2011-12-05 08:19:46 UTC (rev 101976)
+++ trunk/Source/WebKit/chromium/src/WebSettingsImpl.h	2011-12-05 08:42:27 UTC (rev 101977)
@@ -124,6 +124,9 @@
     virtual void setEnableScrollAnimator(bool);
     virtual void setHixie76WebSocketProtocolEnabled(bool);
     virtual void setVisualWordMovementEnabled(bool);
+    virtual void setShouldDisplaySubtitles(bool);
+    virtual void setShouldDisplayCaptions(bool);
+    virtual void setShouldDisplayTextDescriptions(bool);
 
 private:
     WebCore::Settings* m_settings;

Modified: trunk/Source/WebKit/mac/ChangeLog (101976 => 101977)


--- trunk/Source/WebKit/mac/ChangeLog	2011-12-05 08:19:46 UTC (rev 101976)
+++ trunk/Source/WebKit/mac/ChangeLog	2011-12-05 08:42:27 UTC (rev 101977)
@@ -1,3 +1,26 @@
+2011-12-05  Eric Carlson  <eric.carl...@apple.com>
+
+        Add WebKit preferences for text track settings
+        https://bugs.webkit.org/show_bug.cgi?id=73721
+
+        Reviewed by John Sullivan.
+
+        * WebView/WebPreferenceKeysPrivate.h: Added #define for shouldDisplaySubtitles, shouldDisplayCaptions, 
+        and shouldDisplayTextDescriptions properties.
+
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]): Initialize new preferences to NO.
+        (-[WebPreferences setShouldDisplaySubtitles:]): Added.
+        (-[WebPreferences shouldDisplaySubtitles]): Ditto.
+        (-[WebPreferences setShouldDisplayCaptions:]): Ditto.
+        (-[WebPreferences shouldDisplayCaptions]): Ditto.
+        (-[WebPreferences setShouldDisplayTextDescriptions:]): Ditto.
+        (-[WebPreferences shouldDisplayTextDescriptions]): Ditto.
+        * WebView/WebPreferencesPrivate.h:
+
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]): Updates WebCore settings from WebKit prefs.
+
 2011-12-03  Dan Bernstein  <m...@apple.com>
 
         <rdar://problem/10523721> Crash at WebCore::SubresourceLoader::releaseResources

Modified: trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h (101976 => 101977)


--- trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h	2011-12-05 08:19:46 UTC (rev 101976)
+++ trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h	2011-12-05 08:42:27 UTC (rev 101977)
@@ -111,6 +111,9 @@
 #define WebKitMediaPlaybackRequiresUserGesturePreferenceKey @"WebKitMediaPlaybackRequiresUserGesture"
 #define WebKitMediaPlaybackAllowsInlinePreferenceKey @"WebKitMediaPlaybackAllowsInline"
 #define WebKitMockScrollbarsEnabledPreferenceKey @"WebKitMockScrollbarsEnabled"
+#define WebKitShouldDisplaySubtitlesPreferenceKey @"WebKitShouldDisplaySubtitles"
+#define WebKitShouldDisplayCaptionsPreferenceKey @"WebKitShouldDisplayCaptions"
+#define WebKitShouldDisplayTextDescriptionsPreferenceKey @"WebKitShouldDisplayTextDescriptions"
 
 // These are private both because callers should be using the cover methods and because the
 // cover methods themselves are private.

Modified: trunk/Source/WebKit/mac/WebView/WebPreferences.mm (101976 => 101977)


--- trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2011-12-05 08:19:46 UTC (rev 101976)
+++ trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2011-12-05 08:42:27 UTC (rev 101977)
@@ -387,6 +387,9 @@
         [NSNumber numberWithBool:NO],   WebKitWebAudioEnabledPreferenceKey,
         [NSNumber numberWithBool:NO],   WebKitSuppressIncrementalRenderingKey,
         [NSNumber numberWithBool:YES],  WebKitBackspaceKeyNavigationEnabledKey,
+        [NSNumber numberWithBool:NO],   WebKitShouldDisplaySubtitlesPreferenceKey,
+        [NSNumber numberWithBool:NO],   WebKitShouldDisplayCaptionsPreferenceKey,
+        [NSNumber numberWithBool:NO],   WebKitShouldDisplayTextDescriptionsPreferenceKey,
 
         [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota,
         [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheDefaultOriginQuota,
@@ -1574,6 +1577,36 @@
     return [self _boolValueForKey:WebKitBackspaceKeyNavigationEnabledKey];
 }
 
+- (void)setShouldDisplaySubtitles:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitShouldDisplaySubtitlesPreferenceKey];
+}
+
+- (BOOL)shouldDisplaySubtitles
+{
+    return [self _boolValueForKey:WebKitShouldDisplaySubtitlesPreferenceKey];
+}
+
+- (void)setShouldDisplayCaptions:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitShouldDisplayCaptionsPreferenceKey];
+}
+
+- (BOOL)shouldDisplayCaptions
+{
+    return [self _boolValueForKey:WebKitShouldDisplayCaptionsPreferenceKey];
+}
+
+- (void)setShouldDisplayTextDescriptions:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitShouldDisplayTextDescriptionsPreferenceKey];
+}
+
+- (BOOL)shouldDisplayTextDescriptions
+{
+    return [self _boolValueForKey:WebKitShouldDisplayTextDescriptionsPreferenceKey];
+}
+
 @end
 
 @implementation WebPreferences (WebInternal)

Modified: trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h (101976 => 101977)


--- trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h	2011-12-05 08:19:46 UTC (rev 101976)
+++ trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h	2011-12-05 08:42:27 UTC (rev 101977)
@@ -271,4 +271,13 @@
 - (void)setBackspaceKeyNavigationEnabled:(BOOL)flag;
 - (BOOL)backspaceKeyNavigationEnabled;
 
+- (void)setShouldDisplaySubtitles:(BOOL)flag;
+- (BOOL)shouldDisplaySubtitles;
+
+- (void)setShouldDisplayCaptions:(BOOL)flag;
+- (BOOL)shouldDisplayCaptions;
+
+- (void)setShouldDisplayTextDescriptions:(BOOL)flag;
+- (BOOL)shouldDisplayTextDescriptions;
+
 @end

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (101976 => 101977)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2011-12-05 08:19:46 UTC (rev 101976)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2011-12-05 08:42:27 UTC (rev 101977)
@@ -1496,6 +1496,12 @@
     settings->setSuppressIncrementalRendering([preferences suppressIncrementalRendering]);
     settings->setBackspaceKeyNavigationEnabled([preferences backspaceKeyNavigationEnabled]);
 
+#if ENABLE(VIDEO_TRACK)
+    settings->setShouldDisplaySubtitles([preferences shouldDisplaySubtitles]);
+    settings->setShouldDisplayCaptions([preferences shouldDisplayCaptions]);
+    settings->setShouldDisplayTextDescriptions([preferences shouldDisplayTextDescriptions]);
+#endif
+
     // Application Cache Preferences are stored on the global cache storage manager, not in Settings.
     [WebApplicationCache setDefaultOriginQuota:[preferences applicationCacheDefaultOriginQuota]];
 

Modified: trunk/Source/WebKit/win/ChangeLog (101976 => 101977)


--- trunk/Source/WebKit/win/ChangeLog	2011-12-05 08:19:46 UTC (rev 101976)
+++ trunk/Source/WebKit/win/ChangeLog	2011-12-05 08:42:27 UTC (rev 101977)
@@ -1,3 +1,27 @@
+2011-12-05  Eric Carlson  <eric.carl...@apple.com>
+
+        WebKit/mac part of: Add WebKit preferences for text track settings
+        https://bugs.webkit.org/show_bug.cgi?id=73721
+
+        Reviewed by John Sullivan.
+
+        * Interfaces/IWebPreferences.idl: Declare getters and setters for new properties.
+
+        * WebPreferenceKeysPrivate.h: Added #define for shouldDisplaySubtitles, shouldDisplayCaptions, 
+        and shouldDisplayTextDescriptions properties.
+
+        * WebPreferences.cpp:
+        (WebPreferences::setShouldDisplaySubtitles): Added.
+        (WebPreferences::shouldDisplaySubtitles): Ditto.
+        (WebPreferences::setShouldDisplayCaptions): Ditto.
+        (WebPreferences::shouldDisplayCaptions): Ditto.
+        (WebPreferences::setShouldDisplayTextDescriptions): Ditto.
+        (WebPreferences::shouldDisplayTextDescriptions): Ditto.
+        * WebPreferences.h: Declare new methods.
+
+        * WebView.cpp:
+        (WebView::notifyPreferencesChanged): Updates WebCore settings from WebKit prefs.
+
 2011-12-02  Steve Falkenburg  <sfal...@apple.com>
 
         Reviewed by Darin Adler.

Modified: trunk/Source/WebKit/win/Interfaces/IWebPreferences.idl (101976 => 101977)


--- trunk/Source/WebKit/win/Interfaces/IWebPreferences.idl	2011-12-05 08:19:46 UTC (rev 101976)
+++ trunk/Source/WebKit/win/Interfaces/IWebPreferences.idl	2011-12-05 08:42:27 UTC (rev 101977)
@@ -205,4 +205,13 @@
 
     HRESULT pictographFontFamily([out, retval] BSTR* family);
     HRESULT setPictographFontFamily([in] BSTR family);
+
+    HRESULT setShouldDisplaySubtitles(BOOL shouldDisplaySubtitles);
+    HRESULT shouldDisplaySubtitles(BOOL *shouldDisplaySubtitles);
+
+    HRESULT setShouldDisplayCaptions(BOOL shouldDisplayCaptions);
+    HRESULT shouldDisplayCaptions(BOOL *shouldDisplayCaptions);
+
+    HRESULT setShouldDisplayTextDescriptions(BOOL shouldDisplayTextDescriptions);
+    HRESULT shouldDisplayTextDescriptions(BOOL *shouldDisplayTextDescriptions);
 }

Modified: trunk/Source/WebKit/win/WebPreferenceKeysPrivate.h (101976 => 101977)


--- trunk/Source/WebKit/win/WebPreferenceKeysPrivate.h	2011-12-05 08:19:46 UTC (rev 101976)
+++ trunk/Source/WebKit/win/WebPreferenceKeysPrivate.h	2011-12-05 08:42:27 UTC (rev 101977)
@@ -70,6 +70,9 @@
 #define WebKitLocalStorageDatabasePathPreferenceKey "WebKitLocalStorageDatabasePath"
 #define WebKitHyperlinkAuditingEnabledPreferenceKey "WebKitHyperlinkAuditingEnabled"
 #define WebKitWebAudioEnabledPreferenceKey "WebKitWebAudioEnabled"
+#define WebKitShouldDisplaySubtitlesPreferenceKey "WebKitShouldDisplaySubtitles"
+#define WebKitShouldDisplayCaptionsPreferenceKey "WebKitShouldDisplayCaptions"
+#define WebKitShouldDisplayTextDescriptionsPreferenceKey "WebKitShouldDisplayTextDescriptions"
 
 // These are private both because callers should be using the cover methods and because the
 // cover methods themselves are private.

Modified: trunk/Source/WebKit/win/WebPreferences.cpp (101976 => 101977)


--- trunk/Source/WebKit/win/WebPreferences.cpp	2011-12-05 08:19:46 UTC (rev 101976)
+++ trunk/Source/WebKit/win/WebPreferences.cpp	2011-12-05 08:42:27 UTC (rev 101977)
@@ -228,6 +228,9 @@
     CFDictionaryAddValue(defaults, CFSTR(WebKitShowsToolTipOverTruncatedTextPreferenceKey), kCFBooleanFalse);
     CFDictionaryAddValue(defaults, CFSTR(WebKitPDFDisplayModePreferenceKey), CFSTR("1"));
     CFDictionaryAddValue(defaults, CFSTR(WebKitPDFScaleFactorPreferenceKey), CFSTR("0"));
+    CFDictionaryAddValue(defaults, CFSTR(WebKitShouldDisplaySubtitlesPreferenceKey), kCFBooleanFalse);
+    CFDictionaryAddValue(defaults, CFSTR(WebKitShouldDisplayCaptionsPreferenceKey), kCFBooleanFalse);
+    CFDictionaryAddValue(defaults, CFSTR(WebKitShouldDisplayTextDescriptionsPreferenceKey), kCFBooleanFalse);
 
     RetainPtr<CFStringRef> linkBehaviorStringRef(AdoptCF, CFStringCreateWithFormat(0, 0, CFSTR("%d"), WebKitEditableLinkDefaultBehavior));
     CFDictionaryAddValue(defaults, CFSTR(WebKitEditableLinkBehaviorPreferenceKey), linkBehaviorStringRef.get());
@@ -1649,3 +1652,72 @@
         nc->postNotificationName(webPreferencesRemovedNotification(), static_cast<IWebPreferences*>(this), 0);
     }
 }
+
+HRESULT WebPreferences::shouldDisplaySubtitles(BOOL* enabled)
+{
+#if ENABLE(VIDEO_TRACK)
+    if (!enabled)
+        return E_POINTER;
+
+    *enabled = boolValueForKey(CFSTR(WebKitShouldDisplaySubtitlesPreferenceKey));
+    return S_OK;
+#else
+    return E_NOTIMPL;
+#endif
+}
+
+HRESULT WebPreferences::setShouldDisplaySubtitles(BOOL enabled)
+{
+#if ENABLE(VIDEO_TRACK)
+    setBoolValue(CFSTR(WebKitShouldDisplaySubtitlesPreferenceKey), enabled);
+    return S_OK;
+#else
+    return E_NOTIMPL;
+#endif
+}
+
+HRESULT WebPreferences::shouldDisplayCaptions(BOOL* enabled)
+{
+#if ENABLE(VIDEO_TRACK)
+    if (!enabled)
+        return E_POINTER;
+
+    *enabled = boolValueForKey(CFSTR(WebKitShouldDisplayCaptionsPreferenceKey));
+    return S_OK;
+#else
+    return E_NOTIMPL;
+#endif
+}
+
+HRESULT WebPreferences::setShouldDisplayCaptions(BOOL enabled)
+{
+#if ENABLE(VIDEO_TRACK)
+    setBoolValue(CFSTR(WebKitShouldDisplayCaptionsPreferenceKey), enabled);
+    return S_OK;
+#else
+    return E_NOTIMPL;
+#endif
+}
+
+HRESULT WebPreferences::shouldDisplayTextDescriptions(BOOL* enabled)
+{
+#if ENABLE(VIDEO_TRACK)
+    if (!enabled)
+        return E_POINTER;
+
+    *enabled = boolValueForKey(CFSTR(WebKitShouldDisplayTextDescriptionsPreferenceKey));
+    return S_OK;
+#else
+    return E_NOTIMPL;
+#endif
+}
+
+HRESULT WebPreferences::setShouldDisplayTextDescriptions(BOOL enabled)
+{
+#if ENABLE(VIDEO_TRACK)
+    setBoolValue(CFSTR(WebKitShouldDisplayTextDescriptionsPreferenceKey), enabled);
+    return S_OK;
+#else
+    return E_NOTIMPL;
+#endif
+}

Modified: trunk/Source/WebKit/win/WebPreferences.h (101976 => 101977)


--- trunk/Source/WebKit/win/WebPreferences.h	2011-12-05 08:19:46 UTC (rev 101976)
+++ trunk/Source/WebKit/win/WebPreferences.h	2011-12-05 08:42:27 UTC (rev 101977)
@@ -295,6 +295,24 @@
     virtual HRESULT STDMETHODCALLTYPE avFoundationEnabled(
     /* [retval][out] */ BOOL*);
 
+    virtual HRESULT STDMETHODCALLTYPE setShouldDisplaySubtitles(
+    /* [in] */ BOOL);
+
+    virtual HRESULT STDMETHODCALLTYPE shouldDisplaySubtitles(
+    /* [retval][out] */ BOOL*);
+
+    virtual HRESULT STDMETHODCALLTYPE setShouldDisplayCaptions(
+    /* [in] */ BOOL);
+
+    virtual HRESULT STDMETHODCALLTYPE shouldDisplayCaptions(
+    /* [retval][out] */ BOOL*);
+
+    virtual HRESULT STDMETHODCALLTYPE setShouldDisplayTextDescriptions(
+    /* [in] */ BOOL);
+
+    virtual HRESULT STDMETHODCALLTYPE shouldDisplayTextDescriptions(
+    /* [retval][out] */ BOOL*);
+
     // IWebPreferencesPrivate
     virtual HRESULT STDMETHODCALLTYPE setDeveloperExtrasEnabled(
         /* [in] */ BOOL);

Modified: trunk/Source/WebKit/win/WebView.cpp (101976 => 101977)


--- trunk/Source/WebKit/win/WebView.cpp	2011-12-05 08:19:46 UTC (rev 101976)
+++ trunk/Source/WebKit/win/WebView.cpp	2011-12-05 08:42:27 UTC (rev 101977)
@@ -4584,6 +4584,23 @@
     settings->setFixedFontFamily(AtomicString(str, SysStringLen(str)));
     SysFreeString(str);
 
+#if ENABLE(VIDEO_TRACK)
+    hr = preferences->shouldDisplaySubtitles(&enabled);
+    if (FAILED(hr))
+        return hr;
+    settings->setShouldDisplaySubtitles(enabled);
+
+    hr = preferences->shouldDisplayCaptions(&enabled);
+    if (FAILED(hr))
+        return hr;
+    settings->setShouldDisplayCaptions(enabled);
+
+    hr = preferences->shouldDisplayTextDescriptions(&enabled);
+    if (FAILED(hr))
+        return hr;
+    settings->setShouldDisplayTextDescriptions(enabled);
+#endif
+
     COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences);
     if (prefsPrivate) {
         hr = prefsPrivate->localStorageDatabasePath(&str);

Modified: trunk/Source/WebKit2/ChangeLog (101976 => 101977)


--- trunk/Source/WebKit2/ChangeLog	2011-12-05 08:19:46 UTC (rev 101976)
+++ trunk/Source/WebKit2/ChangeLog	2011-12-05 08:42:27 UTC (rev 101977)
@@ -1,3 +1,25 @@
+2011-12-05  Eric Carlson  <eric.carl...@apple.com>
+
+        WebKit2 part of: Add WebKit preferences for text track settings
+        https://bugs.webkit.org/show_bug.cgi?id=73721
+
+        Reviewed by John Sullivan.
+
+        * Shared/WebPreferencesStore.h: Declared shouldDisplaySubtitles, shouldDisplayCaptions, and
+        shouldDisplayTextDescriptions properties with macros. All default to false.
+
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetShouldDisplaySubtitles): Added.
+        (WKPreferencesGetShouldDisplaySubtitles): Ditto.
+        (WKPreferencesSetShouldDisplayCaptions): Ditto.
+        (WKPreferencesGetShouldDisplayCaptions): Ditto.
+        (WKPreferencesSetShouldDisplayTextDescriptions): Ditto.
+        (WKPreferencesGetShouldDisplayTextDescriptions): Ditto.
+        * UIProcess/API/C/WKPreferences.h:
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences): Updates WebCore settings from WebKit2 prefs.
+
 2011-12-04  Gopal Raghavan  <gopal.1.ragha...@nokia.com>
 
         [Qt] cleanup qmltests.pro

Modified: trunk/Source/WebKit2/Shared/WebPreferencesStore.h (101976 => 101977)


--- trunk/Source/WebKit2/Shared/WebPreferencesStore.h	2011-12-05 08:19:46 UTC (rev 101976)
+++ trunk/Source/WebKit2/Shared/WebPreferencesStore.h	2011-12-05 08:42:27 UTC (rev 101977)
@@ -98,6 +98,9 @@
     macro(SuppressIncrementalRendering, suppressIncrementalRendering, Bool, bool, false) \
     macro(BackspaceKeyNavigationEnabled, backspaceKeyNavigationEnabled, Bool, bool, true) \
     macro(CaretBrowsingEnabled, caretBrowsingEnabled, Bool, bool, false) \
+    macro(ShouldDisplaySubtitles, shouldDisplaySubtitles, Bool, bool, false) \
+    macro(ShouldDisplayCaptions, shouldDisplayCaptions, Bool, bool, false) \
+    macro(ShouldDisplayTextDescriptions, shouldDisplayTextDescriptions, Bool, bool, false) \
     \
 
 #define FOR_EACH_WEBKIT_DOUBLE_PREFERENCE(macro) \

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp (101976 => 101977)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp	2011-12-05 08:19:46 UTC (rev 101976)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp	2011-12-05 08:42:27 UTC (rev 101977)
@@ -671,3 +671,33 @@
 {
     return toImpl(preferencesRef)->caretBrowsingEnabled();
 }
+
+void WKPreferencesSetShouldDisplaySubtitles(WKPreferencesRef preferencesRef, bool enabled)
+{
+    toImpl(preferencesRef)->setShouldDisplaySubtitles(enabled);
+}
+
+bool WKPreferencesGetShouldDisplaySubtitles(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->shouldDisplaySubtitles();
+}
+
+void WKPreferencesSetShouldDisplayCaptions(WKPreferencesRef preferencesRef, bool enabled)
+{
+    toImpl(preferencesRef)->setShouldDisplayCaptions(enabled);
+}
+
+bool WKPreferencesGetShouldDisplayCaptions(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->shouldDisplayCaptions();
+}
+
+void WKPreferencesSetShouldDisplayTextDescriptions(WKPreferencesRef preferencesRef, bool enabled)
+{
+    toImpl(preferencesRef)->setShouldDisplayTextDescriptions(enabled);
+}
+
+bool WKPreferencesGetShouldDisplayTextDescriptions(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->shouldDisplayTextDescriptions();
+}

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.h (101976 => 101977)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.h	2011-12-05 08:19:46 UTC (rev 101976)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.h	2011-12-05 08:42:27 UTC (rev 101977)
@@ -181,6 +181,18 @@
 WK_EXPORT void WKPreferencesSetCaretBrowsingEnabled(WKPreferencesRef preferencesRef, bool enabled);
 WK_EXPORT bool WKPreferencesGetCaretBrowsingEnabled(WKPreferencesRef preferencesRef);
 
+// Defaults to false
+WK_EXPORT void WKPreferencesSetShouldDisplaySubtitles(WKPreferencesRef preferencesRef, bool enabled);
+WK_EXPORT bool WKPreferencesGetShouldDisplaySubtitles(WKPreferencesRef preferencesRef);
+
+// Defaults to false
+WK_EXPORT void WKPreferencesSetShouldDisplayCaptions(WKPreferencesRef preferencesRef, bool enabled);
+WK_EXPORT bool WKPreferencesGetShouldDisplayCaptions(WKPreferencesRef preferencesRef);
+
+// Defaults to false
+WK_EXPORT void WKPreferencesSetShouldDisplayTextDescriptions(WKPreferencesRef preferencesRef, bool enabled);
+WK_EXPORT bool WKPreferencesGetShouldDisplayTextDescriptions(WKPreferencesRef preferencesRef);
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (101976 => 101977)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-12-05 08:19:46 UTC (rev 101976)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-12-05 08:42:27 UTC (rev 101977)
@@ -1813,6 +1813,12 @@
     settings->setBackspaceKeyNavigationEnabled(store.getBoolValueForKey(WebPreferencesKey::backspaceKeyNavigationEnabledKey()));
     settings->setCaretBrowsingEnabled(store.getBoolValueForKey(WebPreferencesKey::caretBrowsingEnabledKey()));
 
+#if ENABLE(VIDEO_TRACK)
+    settings->setShouldDisplaySubtitles(store.getBoolValueForKey(WebPreferencesKey::shouldDisplaySubtitlesKey()));
+    settings->setShouldDisplayCaptions(store.getBoolValueForKey(WebPreferencesKey::shouldDisplayCaptionsKey()));
+    settings->setShouldDisplayTextDescriptions(store.getBoolValueForKey(WebPreferencesKey::shouldDisplayTextDescriptionsKey()));
+#endif
+
     platformPreferencesDidChange(store);
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to