Remove internals shouldDisplayTrackKind methods; these are also on internals.settings
authortony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 27 Oct 2012 15:13:49 +0000 (15:13 +0000)
committertony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 27 Oct 2012 15:13:49 +0000 (15:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=100564

Reviewed by Adam Barth.

Source/WebCore:

Remove duplicate methods from internals that was just forwarding on the call to internals.settings.
Also fix a bug where we didn't reset these settings properly.

No new tests, this is covered by existing media/track tests.

* testing/InternalSettings.cpp:
(WebCore::InternalSettings::Backup::Backup): Properly save display track settings.
(WebCore::InternalSettings::Backup::restoreTo): Restore display track settings.
* testing/InternalSettings.h:
* testing/InternalSettings.idl: Use [Conditional=VIDEO_TRACK].
* testing/Internals.cpp: Remove code.
* testing/Internals.h: Remove code.
* testing/Internals.idl: Remove code.

LayoutTests:

Update tests to use the internals.settings method.

* media/track/track-language-preference-expected.txt:
* media/track/track-language-preference.html:
* media/track/track-prefer-captions-expected.txt:
* media/track/track-prefer-captions.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@132726 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
LayoutTests/ChangeLog
LayoutTests/media/track/track-language-preference-expected.txt
LayoutTests/media/track/track-language-preference.html
LayoutTests/media/track/track-prefer-captions-expected.txt
LayoutTests/media/track/track-prefer-captions.html
Source/WebCore/ChangeLog
Source/WebCore/testing/InternalSettings.cpp
Source/WebCore/testing/InternalSettings.h
Source/WebCore/testing/InternalSettings.idl
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl

index 3eb03ab..6911e1b 100644 (file)
@@ -1,3 +1,17 @@
+2012-10-27  Tony Chang  <tony@chromium.org>
+
+        Remove internals shouldDisplayTrackKind methods; these are also on internals.settings
+        https://bugs.webkit.org/show_bug.cgi?id=100564
+
+        Reviewed by Adam Barth.
+
+        Update tests to use the internals.settings method.
+
+        * media/track/track-language-preference-expected.txt:
+        * media/track/track-language-preference.html:
+        * media/track/track-prefer-captions-expected.txt:
+        * media/track/track-prefer-captions.html:
+
 2012-10-26  Philip Rogers  <pdr@google.com>
 
         Prevent NaN offset values in ElementTimeControl.
index cac1335..d462c61 100644 (file)
@@ -1,7 +1,7 @@
 Tests that the user's preferred languages are honored.
 
 **Set track preferences and user preferred languages
-RUN(internals.setShouldDisplayTrackKind(document, 'Captions', true))
+RUN(internals.settings.setShouldDisplayTrackKind('Captions', true))
 RUN(internals.setUserPreferredLanguages(['jp', 'es-ES', 'en', 'fr']))
 
 Test: a track language matches one of the user's preferred languages exactly.
index 7ea7564..0fa8b05 100644 (file)
@@ -75,7 +75,7 @@
                 }
 
                 consoleWrite("<i>**Set track preferences and user preferred languages<" + "/i>");
-                run("internals.setShouldDisplayTrackKind(document, 'Captions', true)");
+                run("internals.settings.setShouldDisplayTrackKind('Captions', true)");
                 run("internals.setUserPreferredLanguages(['jp', 'es-ES', 'en', 'fr'])");
             }
             
index 9a8a9e6..3941443 100644 (file)
@@ -1,12 +1,12 @@
 Tests that the user preferences for track kind are honored.
 
 **Set preferences so subtitles and descriptions load, but captions do not
-RUN(internals.setShouldDisplayTrackKind(document, 'Subtitles', true))
-EXPECTED (internals.shouldDisplayTrackKind(document, 'Subtitles') == 'true') OK
-RUN(internals.setShouldDisplayTrackKind(document, 'Captions', false))
-EXPECTED (internals.shouldDisplayTrackKind(document, 'Captions') == 'false') OK
-RUN(internals.setShouldDisplayTrackKind(document, 'TextDescriptions', true))
-EXPECTED (internals.shouldDisplayTrackKind(document, 'TextDescriptions') == 'true') OK
+RUN(internals.settings.setShouldDisplayTrackKind('Subtitles', true))
+EXPECTED (internals.settings.shouldDisplayTrackKind('Subtitles') == 'true') OK
+RUN(internals.settings.setShouldDisplayTrackKind('Captions', false))
+EXPECTED (internals.settings.shouldDisplayTrackKind('Captions') == 'false') OK
+RUN(internals.settings.setShouldDisplayTrackKind('TextDescriptions', true))
+EXPECTED (internals.settings.shouldDisplayTrackKind('TextDescriptions') == 'true') OK
 
 **Create track elements dynamically so they aren't processed by the media element until after preferences have been configured.
 - creating 'subtitles' track.
index ec012d4..e891c44 100644 (file)
@@ -36,8 +36,8 @@
                     return;
                 }
 
-                run("internals.setShouldDisplayTrackKind(document, '" + type + "', " + flag + ")");
-                testExpected("internals.shouldDisplayTrackKind(document, '" + type + "')", flag);
+                run("internals.settings.setShouldDisplayTrackKind('" + type + "', " + flag + ")");
+                testExpected("internals.settings.shouldDisplayTrackKind('" + type + "')", flag);
             }
             
             function createTrackElement(kind, src)
index 8f38b49..87d932b 100644 (file)
@@ -1,3 +1,24 @@
+2012-10-27  Tony Chang  <tony@chromium.org>
+
+        Remove internals shouldDisplayTrackKind methods; these are also on internals.settings
+        https://bugs.webkit.org/show_bug.cgi?id=100564
+
+        Reviewed by Adam Barth.
+
+        Remove duplicate methods from internals that was just forwarding on the call to internals.settings.
+        Also fix a bug where we didn't reset these settings properly.
+
+        No new tests, this is covered by existing media/track tests.
+
+        * testing/InternalSettings.cpp:
+        (WebCore::InternalSettings::Backup::Backup): Properly save display track settings.
+        (WebCore::InternalSettings::Backup::restoreTo): Restore display track settings.
+        * testing/InternalSettings.h:
+        * testing/InternalSettings.idl: Use [Conditional=VIDEO_TRACK].
+        * testing/Internals.cpp: Remove code.
+        * testing/Internals.h: Remove code.
+        * testing/Internals.idl: Remove code.
+
 2012-10-26  Ilya Tikhonovsky  <loislo@chromium.org>
 
         Web Inspector: instrument chromium GlyphCache. It keeps ~2mb.
index 87a14a7..15df798 100644 (file)
@@ -96,6 +96,11 @@ InternalSettings::Backup::Backup(Page* page, Settings* settings)
     , m_originalMockScrollbarsEnabled(settings->mockScrollbarsEnabled())
     , m_langAttributeAwareFormControlUIEnabled(RuntimeEnabledFeatures::langAttributeAwareFormControlUIEnabled())
     , m_imagesEnabled(settings->areImagesEnabled())
+#if ENABLE(VIDEO_TRACK)
+    , m_shouldDisplaySubtitles(settings->shouldDisplaySubtitles())
+    , m_shouldDisplayCaptions(settings->shouldDisplayCaptions())
+    , m_shouldDisplayTextDescriptions(settings->shouldDisplayTextDescriptions())
+#endif
 {
 }
 
@@ -133,6 +138,11 @@ void InternalSettings::Backup::restoreTo(Page* page, Settings* settings)
     settings->setMockScrollbarsEnabled(m_originalMockScrollbarsEnabled);
     RuntimeEnabledFeatures::setLangAttributeAwareFormControlUIEnabled(m_langAttributeAwareFormControlUIEnabled);
     settings->setImagesEnabled(m_imagesEnabled);
+#if ENABLE(VIDEO_TRACK)
+    settings->setShouldDisplaySubtitles(m_shouldDisplaySubtitles);
+    settings->setShouldDisplayCaptions(m_shouldDisplayCaptions);
+    settings->setShouldDisplayTextDescriptions(m_shouldDisplayTextDescriptions);
+#endif
 }
 
 InternalSettings* InternalSettings::from(Page* page)
index 3814fd0..102e4a4 100644 (file)
@@ -82,6 +82,11 @@ public:
         bool m_originalMockScrollbarsEnabled;
         bool m_langAttributeAwareFormControlUIEnabled;
         bool m_imagesEnabled;
+#if ENABLE(VIDEO_TRACK)
+        bool m_shouldDisplaySubtitles;
+        bool m_shouldDisplayCaptions;
+        bool m_shouldDisplayTextDescriptions;
+#endif
     };
 
     typedef RefCountedSupplement<Page, InternalSettings> SuperType;
index 1aa14e2..3149411 100644 (file)
     void setUserPreferredLanguages(in sequence<String> languages);
     void allowRoundingHacks();
     void setEnableMockPagePopup(in boolean enabled) raises(DOMException);
-#if defined(ENABLE_VIDEO_TRACK) && ENABLE_VIDEO_TRACK
-    void setShouldDisplayTrackKind(in DOMString kind, in boolean enabled) raises (DOMException);
-    boolean shouldDisplayTrackKind(in DOMString trackKind) raises (DOMException);
-#endif
+    [Conditional=VIDEO_TRACK] void setShouldDisplayTrackKind(in DOMString kind, in boolean enabled) raises (DOMException);
+    [Conditional=VIDEO_TRACK] boolean shouldDisplayTrackKind(in DOMString trackKind) raises (DOMException);
     void setMemoryInfoEnabled(in boolean enabled) raises(DOMException);
     void setStorageBlockingPolicy(in DOMString policy) raises(DOMException);
     void setImagesEnabled(in boolean enabled) raises(DOMException);
index b674a31..d6ed2ca 100644 (file)
@@ -1003,16 +1003,6 @@ void Internals::setUserPreferredLanguages(const Vector<String>& languages)
     settings()->setUserPreferredLanguages(languages);
 }
 
-void Internals::setShouldDisplayTrackKind(Document*, const String& kind, bool enabled, ExceptionCode& ec)
-{
-    settings()->setShouldDisplayTrackKind(kind, enabled, ec);
-}
-
-bool Internals::shouldDisplayTrackKind(Document*, const String& kind, ExceptionCode& ec)
-{
-    return settings()->shouldDisplayTrackKind(kind, ec);
-}
-
 unsigned Internals::wheelEventHandlerCount(Document* document, ExceptionCode& ec)
 {
     if (!document) {
index 85293ef..a6fb4dd 100644 (file)
@@ -159,9 +159,6 @@ public:
     Vector<String> userPreferredLanguages() const;
     void setUserPreferredLanguages(const Vector<String>&);
 
-    void setShouldDisplayTrackKind(Document*, const String& kind, bool, ExceptionCode&);
-    bool shouldDisplayTrackKind(Document*, const String& kind, ExceptionCode&);
-
     unsigned wheelEventHandlerCount(Document*, ExceptionCode&);
     unsigned touchEventHandlerCount(Document*, ExceptionCode&);
 
index 3012d69..bb4fb7a 100644 (file)
     long lastSpellCheckRequestSequence(in Document document) raises (DOMException);
     long lastSpellCheckProcessedSequence(in Document document) raises (DOMException);
 
-#if defined(ENABLE_VIDEO_TRACK) && ENABLE_VIDEO_TRACK
-    void setShouldDisplayTrackKind(in Document document, in DOMString kind, in boolean enabled) raises (DOMException);
-    boolean shouldDisplayTrackKind(in Document document, in DOMString trackKind) raises (DOMException);
-#endif
-
     sequence<String> userPreferredLanguages();
     void setUserPreferredLanguages(in sequence<String> languages);