Skip to content

Commit

Permalink
Source/WebCore: WebCore part of: Add WebKit preferences for text trac…
Browse files Browse the repository at this point in the history
…k 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.


Canonical link: https://commits.webkit.org/90440@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@101977 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
eric-carlson committed Dec 5, 2011
1 parent 766e446 commit c546180
Show file tree
Hide file tree
Showing 22 changed files with 370 additions and 3 deletions.
16 changes: 16 additions & 0 deletions Source/WebCore/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
2011-12-05 Eric Carlson <eric.carlson@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.gordon@gmail.com>

ImageDecoder setSize() should check for backing store allocation failure
Expand Down
17 changes: 17 additions & 0 deletions Source/WebCore/page/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -836,4 +836,21 @@ bool Settings::mockScrollbarsEnabled()
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
6 changes: 3 additions & 3 deletions Source/WebCore/page/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -487,13 +487,13 @@ namespace WebCore {
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

Expand Down
13 changes: 13 additions & 0 deletions Source/WebKit/chromium/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
2011-12-05 Eric Carlson <eric.carlson@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.bot@gmail.com>

Unreviewed. Rolled DEPS.
Expand Down
28 changes: 28 additions & 0 deletions Source/WebKit/chromium/src/WebSettingsImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,4 +465,32 @@ void WebSettingsImpl::setVisualWordMovementEnabled(bool enabled)
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
3 changes: 3 additions & 0 deletions Source/WebKit/chromium/src/WebSettingsImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ class WebSettingsImpl : public WebSettings {
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;
Expand Down
23 changes: 23 additions & 0 deletions Source/WebKit/mac/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
2011-12-05 Eric Carlson <eric.carlson@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 <mitz@apple.com>

<rdar://problem/10523721> Crash at WebCore::SubresourceLoader::releaseResources
Expand Down
3 changes: 3 additions & 0 deletions Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
33 changes: 33 additions & 0 deletions Source/WebKit/mac/WebView/WebPreferences.mm
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,9 @@ + (void)initialize
[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,
Expand Down Expand Up @@ -1574,6 +1577,36 @@ - (BOOL)backspaceKeyNavigationEnabled
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)
Expand Down
9 changes: 9 additions & 0 deletions Source/WebKit/mac/WebView/WebPreferencesPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,4 +271,13 @@ extern NSString *WebPreferencesChangedInternalNotification;
- (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
6 changes: 6 additions & 0 deletions Source/WebKit/mac/WebView/WebView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1496,6 +1496,12 @@ - (void)_preferencesChanged:(WebPreferences *)preferences
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]];

Expand Down
24 changes: 24 additions & 0 deletions Source/WebKit/win/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
2011-12-05 Eric Carlson <eric.carlson@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 <sfalken@apple.com>

Reviewed by Darin Adler.
Expand Down
9 changes: 9 additions & 0 deletions Source/WebKit/win/Interfaces/IWebPreferences.idl
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,13 @@ interface IWebPreferences : IUnknown

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);
}
3 changes: 3 additions & 0 deletions Source/WebKit/win/WebPreferenceKeysPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
72 changes: 72 additions & 0 deletions Source/WebKit/win/WebPreferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ void WebPreferences::initializeDefaultSettings()
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());
Expand Down Expand Up @@ -1649,3 +1652,72 @@ void WebPreferences::didRemoveFromWebView()
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
}
18 changes: 18 additions & 0 deletions Source/WebKit/win/WebPreferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,24 @@ class WebPreferences : public IWebPreferences, public IWebPreferencesPrivate {
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);
Expand Down
Loading

0 comments on commit c546180

Please sign in to comment.