Merge Minor WebVTT Cleanups from Blink
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Mar 2014 17:38:28 +0000 (17:38 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Mar 2014 17:38:28 +0000 (17:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=130681

Reviewed by Eric Carlson.

Merged from Blink (patch by philipj@opera.com):
https://chromium.googlesource.com/chromium/blink/+/693eb5e2933dca0eab5bbd604e9f3406fe9fd1ab
http://crbug.com/52593009
https://chromium.googlesource.com/chromium/blink/+/40b3602feab34e9be829fd742b6ad6ded322a09f
http://crbug.com/104243003

* html/track/TextTrack.cpp:
(WebCore::TextTrack::setMode):
* html/track/TextTrack.idl:
* html/track/TextTrackCue.h:
* html/track/VTTCue.cpp:
(WebCore::VTTCue::VTTCue):
* html/track/VTTCue.h:

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

Source/WebCore/ChangeLog
Source/WebCore/html/track/TextTrack.cpp
Source/WebCore/html/track/TextTrack.idl
Source/WebCore/html/track/TextTrackCue.h
Source/WebCore/html/track/VTTCue.cpp
Source/WebCore/html/track/VTTCue.h

index 41fb9db..8151091 100644 (file)
@@ -1,3 +1,24 @@
+2014-03-24  Brent Fulgham  <bfulgham@apple.com>
+
+        Merge Minor WebVTT Cleanups from Blink
+        https://bugs.webkit.org/show_bug.cgi?id=130681
+
+        Reviewed by Eric Carlson.
+
+        Merged from Blink (patch by philipj@opera.com):
+        https://chromium.googlesource.com/chromium/blink/+/693eb5e2933dca0eab5bbd604e9f3406fe9fd1ab
+        http://crbug.com/52593009
+        https://chromium.googlesource.com/chromium/blink/+/40b3602feab34e9be829fd742b6ad6ded322a09f
+        http://crbug.com/104243003
+
+        * html/track/TextTrack.cpp:
+        (WebCore::TextTrack::setMode):
+        * html/track/TextTrack.idl:
+        * html/track/TextTrackCue.h:
+        * html/track/VTTCue.cpp:
+        (WebCore::VTTCue::VTTCue):
+        * html/track/VTTCue.h:
+
 2014-03-24  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r166169.
index bc2ed2c..b2971d4 100644 (file)
@@ -210,11 +210,10 @@ void TextTrack::setKind(const AtomicString& newKind)
 
 void TextTrack::setMode(const AtomicString& mode)
 {
+    ASSERT(mode == disabledKeyword() || mode == hiddenKeyword() || mode == showingKeyword());
+
     // On setting, if the new value isn't equal to what the attribute would currently
     // return, the new value must be processed as follows ...
-    if (mode != disabledKeyword() && mode != hiddenKeyword() && mode != showingKeyword())
-        return;
-
     if (m_mode == mode)
         return;
 
index b69c06f..8fe3024 100644 (file)
@@ -23,6 +23,9 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
+enum TextTrackMode { "disabled",  "hidden",  "showing" };
+enum TextTrackKind { "subtitles",  "captions",  "descriptions",  "chapters", "metadata" };
+
 [
     Conditional=VIDEO_TRACK,
     EventTarget,
     SkipVTableValidation,
 ] interface TextTrack {
     readonly attribute DOMString id;
-    [CustomSetter] attribute DOMString kind;
+    [CustomSetter] attribute TextTrackKind kind;
     readonly attribute DOMString label;
     [CustomSetter] attribute DOMString language;
 
-    attribute DOMString mode;
+    attribute TextTrackMode mode;
 
     readonly attribute TextTrackCueList cues;
     readonly attribute TextTrackCueList activeCues;
-             attribute EventListener oncuechange;
 
     [RaisesException] void addCue(TextTrackCue cue);
     [RaisesException] void removeCue(TextTrackCue cue);
 
+             attribute EventListener oncuechange;
+
 #if defined(ENABLE_WEBVTT_REGIONS) && ENABLE_WEBVTT_REGIONS
     readonly attribute VTTRegionList regions;
     void addRegion(VTTRegion region);
index 033970f..59409d7 100644 (file)
@@ -120,8 +120,8 @@ private:
 
     ScriptExecutionContext& m_scriptExecutionContext;
 
-    bool m_isActive;
-    bool m_pauseOnExit;
+    bool m_isActive : 1;
+    bool m_pauseOnExit : 1;
 };
 
 } // namespace WebCore
index 4249b39..36dc291 100644 (file)
@@ -218,12 +218,12 @@ VTTCue::VTTCue(ScriptExecutionContext& context, double start, double end, const
     , m_cueSize(100)
     , m_writingDirection(Horizontal)
     , m_cueAlignment(Middle)
-    , m_webVTTNodeTree(0)
-    , m_snapToLines(true)
+    , m_webVTTNodeTree(nullptr)
     , m_cueBackgroundBox(HTMLSpanElement::create(spanTag, toDocument(context)))
-    , m_displayTreeShouldChange(true)
     , m_displayDirection(CSSValueLtr)
     , m_displaySize(0)
+    , m_snapToLines(true)
+    , m_displayTreeShouldChange(true)
     , m_notifyRegion(true)
 {
 }
index 008b7f3..c1e3445 100644 (file)
@@ -201,25 +201,21 @@ private:
 
     WritingDirection m_writingDirection;
     CueAlignment m_cueAlignment;
+#if ENABLE(WEBVTT_REGIONS)
+    String m_regionId;
+#endif
 
     RefPtr<DocumentFragment> m_webVTTNodeTree;
-
-    bool m_snapToLines;
-
     RefPtr<HTMLSpanElement> m_cueBackgroundBox;
-
-    bool m_displayTreeShouldChange;
     RefPtr<VTTCueBox> m_displayTree;
 
     CSSValueID m_displayDirection;
-
     int m_displaySize;
-
     std::pair<float, float> m_displayPosition;
-#if ENABLE(WEBVTT_REGIONS)
-    String m_regionId;
-#endif
-    bool m_notifyRegion;
+
+    bool m_snapToLines : 1;
+    bool m_displayTreeShouldChange : 1;
+    bool m_notifyRegion : 1;
 };
 
 VTTCue* toVTTCue(TextTrackCue*);