TextTrackRegion Not Implemented
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Mar 2014 17:40:25 +0000 (17:40 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Mar 2014 17:40:25 +0000 (17:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=116546

Reviewed by Eric Carlson.

Merged from Blink (patch by vcarbune@chromium.org):
https://chromium.googlesource.com/chromium/blink/+/4940f89a087fea5b5ea628e98d0b355d398a9eea
http://crbug.com/25798003

Source/WebCore:

Tests: media/track/regions-webvtt/text-track-region-display.html
       media/track/regions-webvtt/text-track-region-dom-layout.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::parseAttribute):
* html/track/LoadableTextTrack.cpp:
(WebCore::LoadableTextTrack::newRegionsAvailable):
* html/track/TextTrack.cpp:
* html/track/TextTrack.h:
* html/track/TextTrackRegion.cpp:
(WebCore::TextTrackRegion::TextTrackRegion):
(WebCore::TextTrackRegion::appendTextTrackCueBox):
* html/track/TextTrackRegion.h:
* html/track/VTTCue.cpp:
(WebCore::VTTCue::VTTCue):
(WebCore::VTTCue::notifyRegionWhenRemovingDisplayTree):
(WebCore::VTTCue::removeDisplayTree):
* html/track/VTTCue.h:
* html/track/WebVTTParser.cpp:
(WebCore::WebVTTParser::parseBytes):
(WebCore::WebVTTParser::collectMetadataHeader):
* html/track/WebVTTParser.h:

LayoutTests:

* media/track/captions-webvtt/captions-regions.vtt: Added.
* media/track/regions-webvtt/text-track-cue-region-attribute-expected.txt: Rebaseline.
* media/track/regions-webvtt/text-track-region-display-expected.txt: Added.
* media/track/regions-webvtt/text-track-region-display.html: Added.
* media/track/regions-webvtt/text-track-region-dom-layout-expected.txt: Added.
* media/track/regions-webvtt/text-track-region-dom-layout.html: Added.
* media/track/regions-webvtt/text-track-region-list-expected.txt: Rebaseline.
* media/track/regions-webvtt/text-track-region-parser-expected.txt: Rebaseline.

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

20 files changed:
LayoutTests/ChangeLog
LayoutTests/media/track/captions-webvtt/captions-regions.vtt [new file with mode: 0644]
LayoutTests/media/track/regions-webvtt/text-track-cue-region-attribute-expected.txt
LayoutTests/media/track/regions-webvtt/text-track-region-display-expected.txt [new file with mode: 0644]
LayoutTests/media/track/regions-webvtt/text-track-region-display.html [new file with mode: 0644]
LayoutTests/media/track/regions-webvtt/text-track-region-dom-layout-expected.txt [new file with mode: 0644]
LayoutTests/media/track/regions-webvtt/text-track-region-dom-layout.html [new file with mode: 0644]
LayoutTests/media/track/regions-webvtt/text-track-region-list-expected.txt
LayoutTests/media/track/regions-webvtt/text-track-region-parser-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/track/LoadableTextTrack.cpp
Source/WebCore/html/track/TextTrack.cpp
Source/WebCore/html/track/TextTrack.h
Source/WebCore/html/track/TextTrackRegion.cpp
Source/WebCore/html/track/TextTrackRegion.h
Source/WebCore/html/track/VTTCue.cpp
Source/WebCore/html/track/VTTCue.h
Source/WebCore/html/track/WebVTTParser.cpp
Source/WebCore/html/track/WebVTTParser.h

index 7e4bb8d..d930e20 100644 (file)
@@ -1,3 +1,23 @@
+2014-03-18  Brent Fulgham  <bfulgham@apple.com>
+
+        TextTrackRegion Not Implemented
+        https://bugs.webkit.org/show_bug.cgi?id=116546
+
+        Reviewed by Eric Carlson.
+
+        Merged from Blink (patch by vcarbune@chromium.org):
+        https://chromium.googlesource.com/chromium/blink/+/4940f89a087fea5b5ea628e98d0b355d398a9eea
+        http://crbug.com/25798003
+
+        * media/track/captions-webvtt/captions-regions.vtt: Added.
+        * media/track/regions-webvtt/text-track-cue-region-attribute-expected.txt: Rebaseline.
+        * media/track/regions-webvtt/text-track-region-display-expected.txt: Added.
+        * media/track/regions-webvtt/text-track-region-display.html: Added.
+        * media/track/regions-webvtt/text-track-region-dom-layout-expected.txt: Added.
+        * media/track/regions-webvtt/text-track-region-dom-layout.html: Added.
+        * media/track/regions-webvtt/text-track-region-list-expected.txt: Rebaseline.
+        * media/track/regions-webvtt/text-track-region-parser-expected.txt: Rebaseline.
+
 2014-03-18  Krzysztof Wolanski  <k.wolanski@samsung.com>
 
         [EFL] Update baselines and test expectations
diff --git a/LayoutTests/media/track/captions-webvtt/captions-regions.vtt b/LayoutTests/media/track/captions-webvtt/captions-regions.vtt
new file mode 100644 (file)
index 0000000..50ba5b9
--- /dev/null
@@ -0,0 +1,19 @@
+WEBVTT FILE
+Region: id=fred width=50% height=2 regionanchor=50%,100% viewportanchor=10%,40%
+
+1
+00:00:00.000 --> 00:00:01.500 region:fred
+We are in New York City
+
+2
+00:00:00.500 --> 00:00:01.500 region:fred
+Second cue
+
+3
+00:00:01.000 --> 00:00:02.500 region:fred
+Multiline
+Cue
+
+4
+00:00:02.000 --> 00:00:03.000 region:fred
+Fourth cue!
\ No newline at end of file
index 5ce0efe..dd9e19b 100644 (file)
@@ -1,6 +1,7 @@
 Tests the regionId attribute of a cue.
 
 
+
 ** Test the setter and getter through the JS API **
 EXPECTED (cue.regionId == '') OK
 EXPECTED (cue.regionId == 'someId') OK
diff --git a/LayoutTests/media/track/regions-webvtt/text-track-region-display-expected.txt b/LayoutTests/media/track/regions-webvtt/text-track-region-display-expected.txt
new file mode 100644 (file)
index 0000000..914f9d7
--- /dev/null
@@ -0,0 +1,53 @@
+Tests default rendering for TextTrackCues that belong to a TextTrackRegion.
+
+
+EVENT(canplaythrough)
+** The text track has only one region **
+EXPECTED (testTrack.regions.length == '1') OK
+
+** Inspecting cues displayed within region**
+
+RUN(video.currentTime = 0.2)
+EVENT(seeked)
+Total cues in region: 1
+Cue content is: We are in New York City
+Cue lines visible from this cue: 1
+EXPECTED (totalVisibleLines <= testTrack.regions[0].height == 'true') OK
+
+RUN(video.currentTime = 0.5)
+EVENT(seeked)
+Total cues in region: 2
+Cue content is: We are in New York City
+Cue lines visible from this cue: 1
+Cue content is: Second cue
+Cue lines visible from this cue: 1
+EXPECTED (totalVisibleLines <= testTrack.regions[0].height == 'true') OK
+
+RUN(video.currentTime = 1)
+EVENT(seeked)
+Total cues in region: 3
+Cue content is: We are in New York City
+Cue lines visible from this cue: 1
+Cue content is: Second cue
+Cue lines visible from this cue: 1
+Cue content is: Multiline Cue
+Cue lines visible from this cue: 0
+EXPECTED (totalVisibleLines <= testTrack.regions[0].height == 'true') OK
+
+RUN(video.currentTime = 2.3)
+EVENT(seeked)
+Total cues in region: 2
+Cue content is: Multiline Cue
+Cue lines visible from this cue: 2
+Cue content is: Fourth cue!
+Cue lines visible from this cue: 0
+EXPECTED (totalVisibleLines <= testTrack.regions[0].height == 'true') OK
+
+RUN(video.currentTime = 3)
+EVENT(seeked)
+Total cues in region: 1
+Cue content is: Fourth cue!
+Cue lines visible from this cue: 1
+EXPECTED (totalVisibleLines <= testTrack.regions[0].height == 'true') OK
+END OF TEST
+
diff --git a/LayoutTests/media/track/regions-webvtt/text-track-region-display.html b/LayoutTests/media/track/regions-webvtt/text-track-region-display.html
new file mode 100644 (file)
index 0000000..7fd6d4c
--- /dev/null
@@ -0,0 +1,108 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+        <script src=../../media-controls.js></script>
+        <script src=../../media-file.js></script>
+        <script src=../../video-test.js></script>
+        <script>
+        var testTrack;
+        var region;
+        var container;
+        var totalVisibleLines;
+
+        var seekTimes = [0.2, 0.5, 1.0, 2.3, 3.0];
+        var crtSeekTime = 0;
+
+        function countVisibleLines(cueElement)
+        {
+            var cueRect = cueElement.getBoundingClientRect();
+            var regionRect = region.getBoundingClientRect();
+
+            var linesMatch = cueElement.textContent.match(/\n/g);
+            var linesCount = 1 + (linesMatch == null ? 0 : linesMatch.length);
+            var lineHeight = cueRect.height / linesCount;
+
+            var visibleLines = 0;
+            for (i = 0; i < linesCount; ++i) {
+              var lineTop = cueRect.top + i * lineHeight;
+              var lineBottom = cueRect.top + (i+1) * lineHeight;
+
+              if (lineTop >= regionRect.top && lineBottom <= regionRect.bottom)
+                visibleLines++;
+            }
+
+            return visibleLines;
+        }
+
+        function testRegionsDisplay()
+        {
+            testTrack = video.textTracks[0];
+
+            consoleWrite("** The text track has only one region **");
+            testExpected("testTrack.regions.length", 1);
+
+            try {
+              region = textTrackDisplayElement(video, 'region');
+              container = textTrackDisplayElement(video, 'region-container');
+            } catch(e) {
+              consoleWrite(e);
+            }
+
+            consoleWrite("<br>** Inspecting cues displayed within region**");
+
+            waitForEvent("seeked", inspectRegionTree);
+            seekVideo();
+        }
+
+        function seekVideo()
+        {
+            consoleWrite("");
+            run("video.currentTime = " + seekTimes[crtSeekTime++]);
+        }
+
+        function inspectRegionTree()
+        {
+            consoleWrite("Total cues in region: " + container.children.length);
+            totalVisibleLines = 0;
+
+            for (var i = 0; i < container.children.length; ++i) {
+                var cue = container.children[i];
+                var cueVisibleLines = countVisibleLines(cue);
+                consoleWrite("Cue content is: " + cue.textContent);
+                consoleWrite("Cue lines visible from this cue: " + cueVisibleLines);
+
+                totalVisibleLines += cueVisibleLines;
+            }
+
+            testExpected("totalVisibleLines <= testTrack.regions[0].height", true);
+
+            if (crtSeekTime == seekTimes.length)
+                endTest();
+            else
+                seekVideo();
+        }
+
+        function startTest()
+        {
+            if (!window.TextTrackRegion) {
+                failTest();
+                return;
+            }
+
+            findMediaElement();
+
+            video.src = findMediaFile('video', '../../content/test');
+            waitForEvent('canplaythrough', testRegionsDisplay);
+        }
+
+        </script>
+    </head>
+    <body>
+        <p>Tests default rendering for TextTrackCues that belong to a TextTrackRegion.</p>
+        <video controls>
+            <track src="../captions-webvtt/captions-regions.vtt" kind="captions" default onload="startTest()">
+        </video>
+    </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/media/track/regions-webvtt/text-track-region-dom-layout-expected.txt b/LayoutTests/media/track/regions-webvtt/text-track-region-dom-layout-expected.txt
new file mode 100644 (file)
index 0000000..f589627
--- /dev/null
@@ -0,0 +1,20 @@
+Tests default DOM layout structure for a TextTrackRegion.
+
+
+EVENT(canplaythrough)
+** The text track has only one region **
+EXPECTED (testTrack.regions.length == '1') OK
+
+** Inspecting the default DOM layout used for regions display **
+
+** Only one region should be displayed **
+EXPECTED (region.children.length == '1') OK
+
+** The child of the region should be the container **
+EXPECTED (region.children[0] == container == 'true') OK
+
+** Default pseudo IDs should be set properly
+EXPECTED (region.getAttribute('pseudo') == '-webkit-media-text-track-region') OK
+EXPECTED (container.getAttribute('pseudo') == '-webkit-media-text-track-region-container') OK
+END OF TEST
+
diff --git a/LayoutTests/media/track/regions-webvtt/text-track-region-dom-layout.html b/LayoutTests/media/track/regions-webvtt/text-track-region-dom-layout.html
new file mode 100644 (file)
index 0000000..62351ae
--- /dev/null
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+        <script src=../../media-controls.js></script>
+        <script src=../../media-file.js></script>
+        <script src=../../video-test.js></script>
+        <script>
+        var testTrack;
+        var region;
+        var container;
+
+        function testRegionsDisplay()
+        {
+            testTrack = video.textTracks[0];
+
+            consoleWrite("** The text track has only one region **");
+            testExpected("testTrack.regions.length", 1);
+
+            try {
+              region = textTrackDisplayElement(video, 'region');
+              container = textTrackDisplayElement(video, 'region-container');
+            } catch(e) {
+              consoleWrite(e);
+            }
+
+            consoleWrite("<br>** Inspecting the default DOM layout used for regions display **");
+
+            consoleWrite("<br>** Only one region should be displayed **");
+            testExpected("region.children.length", 1);
+
+            consoleWrite("<br>** The child of the region should be the container **");
+            testExpected("region.children[0] == container", true);
+
+            consoleWrite("<br>** Default pseudo IDs should be set properly");
+            testExpected("region.getAttribute('pseudo')", "-webkit-media-text-track-region");
+            testExpected("container.getAttribute('pseudo')", "-webkit-media-text-track-region-container");
+
+            endTest();
+        }
+
+        function startTest()
+        {
+            if (!window.TextTrackRegion) {
+                failTest();
+                return;
+            }
+
+            findMediaElement();
+
+            video.src = findMediaFile('video', '../../content/test');
+            waitForEvent('canplaythrough', testRegionsDisplay);
+        }
+
+        </script>
+    </head>
+    <body>
+        <p>Tests default DOM layout structure for a TextTrackRegion.</p>
+        <video controls>
+            <track src="../captions-webvtt/captions-regions.vtt" kind="captions" default onload="startTest()">
+        </video>
+    </body>
+</html>
\ No newline at end of file
index 013c744..8147cf3 100644 (file)
@@ -1,6 +1,7 @@
 Tests TextTrackRegionList functionality: length, operator[], and getRegionById()
 
 
+
 ** Implicit mode disabled and the regions attribute is null **
 EXPECTED (testTrack.track.mode == 'disabled') OK
 EXPECTED (testTrack.track.regions == 'null') OK
index 070f431..7a36de0 100644 (file)
@@ -1,5 +1,6 @@
 Tests proper parsing of various regions present in WebVTT header area.
 
+
 EXPECTED (video.textTracks[0].regions.length == '5') OK
 
 EXPECTED (region.id == 'region_without_settings') OK
index a8e41e7..f851725 100644 (file)
@@ -1,3 +1,37 @@
+2014-03-18  Brent Fulgham  <bfulgham@apple.com>
+
+        TextTrackRegion Not Implemented
+        https://bugs.webkit.org/show_bug.cgi?id=116546
+
+        Reviewed by Eric Carlson.
+
+        Merged from Blink (patch by vcarbune@chromium.org):
+        https://chromium.googlesource.com/chromium/blink/+/4940f89a087fea5b5ea628e98d0b355d398a9eea
+        http://crbug.com/25798003
+
+        Tests: media/track/regions-webvtt/text-track-region-display.html
+               media/track/regions-webvtt/text-track-region-dom-layout.html
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::parseAttribute):
+        * html/track/LoadableTextTrack.cpp:
+        (WebCore::LoadableTextTrack::newRegionsAvailable):
+        * html/track/TextTrack.cpp:
+        * html/track/TextTrack.h:
+        * html/track/TextTrackRegion.cpp:
+        (WebCore::TextTrackRegion::TextTrackRegion):
+        (WebCore::TextTrackRegion::appendTextTrackCueBox):
+        * html/track/TextTrackRegion.h:
+        * html/track/VTTCue.cpp:
+        (WebCore::VTTCue::VTTCue):
+        (WebCore::VTTCue::notifyRegionWhenRemovingDisplayTree):
+        (WebCore::VTTCue::removeDisplayTree):
+        * html/track/VTTCue.h:
+        * html/track/WebVTTParser.cpp:
+        (WebCore::WebVTTParser::parseBytes):
+        (WebCore::WebVTTParser::collectMetadataHeader):
+        * html/track/WebVTTParser.h:
+
 2014-03-18  Philippe Normand  <pnormand@igalia.com>
 
         [GTK] ResourceLoaderSoup.cpp was added by mistake
index 4e0f689..4aca52c 100644 (file)
@@ -1683,6 +1683,14 @@ void HTMLMediaElement::textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue> c
     CueInterval interval = m_cueTree.createInterval(cue->startTime(), endTime, cue.get());
     m_cueTree.remove(interval);
 
+#if ENABLE(WEBVTT_REGIONS)
+    // Since the cue will be removed from the media element and likely the
+    // TextTrack might also be destructed, notifying the region of the cue
+    // removal shouldn't be done.
+    if (cue->isRenderable())
+        toVTTCue(cue.get())->notifyRegionWhenRemovingDisplayTree(false);
+#endif
+
     size_t index = m_currentlyActiveCues.find(interval);
     if (index != notFound) {
         cue->setIsActive(false);
@@ -1692,6 +1700,11 @@ void HTMLMediaElement::textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue> c
     if (cue->isRenderable())
         toVTTCue(cue.get())->removeDisplayTree();
     updateActiveTextTrackCues(currentTime());
+
+#if ENABLE(WEBVTT_REGIONS)
+    if (cue->isRenderable())
+        toVTTCue(cue.get())->notifyRegionWhenRemovingDisplayTree(true);
+#endif
 }
 
 #endif
index b882030..3e76765 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Google Inc.  All rights reserved.
+ * Copyright (C) 2011, 2013 Google Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -142,7 +142,7 @@ void LoadableTextTrack::newRegionsAvailable(TextTrackLoader* loader)
 
     for (size_t i = 0; i < newRegions.size(); ++i) {
         newRegions[i]->setTrack(this);
-        regionList()->add(newRegions[i]);
+        regions()->add(newRegions[i]);
     }
 }
 #endif
index e5950d6..e69d14e 100644 (file)
@@ -343,11 +343,6 @@ void TextTrack::removeCue(TextTrackCue* cue, ExceptionCode& ec)
 }
 
 #if ENABLE(VIDEO_TRACK) && ENABLE(WEBVTT_REGIONS)
-TextTrackRegionList* TextTrack::regionList()
-{
-    return ensureTextTrackRegionList();
-}
-
 TextTrackRegionList* TextTrack::ensureTextTrackRegionList()
 {
     if (!m_regions)
index 4f5195e..9abfe1e 100644 (file)
@@ -159,9 +159,6 @@ public:
 
 protected:
     TextTrack(ScriptExecutionContext*, TextTrackClient*, const AtomicString& kind, const AtomicString& id, const AtomicString& label, const AtomicString& language, TextTrackType);
-#if ENABLE(VIDEO_TRACK) && ENABLE(WEBVTT_REGIONS)
-    TextTrackRegionList* regionList();
-#endif
 
     RefPtr<TextTrackCueList> m_cues;
 
index 11d3849..4825376 100644 (file)
@@ -76,8 +76,8 @@ TextTrackRegion::TextTrackRegion(ScriptExecutionContext& context)
     , m_regionAnchor(FloatPoint(defaultAnchorPointX, defaultAnchorPointY))
     , m_viewportAnchor(FloatPoint(defaultAnchorPointX, defaultAnchorPointY))
     , m_scroll(defaultScroll)
-    , m_regionDisplayTree(nullptr)
     , m_cueContainer(nullptr)
+    , m_regionDisplayTree(nullptr)
     , m_track(nullptr)
     , m_currentTop(0)
     , m_scrollTimer(this, &TextTrackRegion::scrollTimerFired)
@@ -354,6 +354,8 @@ const AtomicString& TextTrackRegion::textTrackRegionShadowPseudoId()
 
 void TextTrackRegion::appendTextTrackCueBox(PassRefPtr<VTTCueBox> displayBox)
 {
+    ASSERT(m_cueContainer);
+
     if (m_cueContainer->contains(displayBox.get()))
         return;
 
index 6555ebe..f54848a 100644 (file)
@@ -136,11 +136,10 @@ private:
 
     bool m_scroll;
 
-    RefPtr<HTMLDivElement> m_regionDisplayTree;
-
     // The cue container is the container that is scrolled up to obtain the
     // effect of scrolling cues when this is enabled for the regions.
     RefPtr<HTMLDivElement> m_cueContainer;
+    RefPtr<HTMLDivElement> m_regionDisplayTree;
 
     // The member variable track can be a raw pointer as it will never
     // reference a destroyed TextTrack, as this member variable
index 40b8f8d..e01d1c2 100644 (file)
@@ -207,6 +207,7 @@ VTTCue::VTTCue(ScriptExecutionContext& context, double start, double end, const
     , m_displayDirection(CSSValueLtr)
     , m_displayWritingMode(CSSValueInherit)
     , m_displaySize(0)
+    , m_notifyRegion(true)
 {
     // 4. If the text track cue writing direction is horizontal, then let
     // writing-mode be 'horizontal-tb'. Otherwise, if the text track cue writing
@@ -460,6 +461,11 @@ void VTTCue::setRegionId(const String& regionId)
     m_regionId = regionId;
     didChange();
 }
+
+void VTTCue::notifyRegionWhenRemovingDisplayTree(bool notifyRegion)
+{
+    m_notifyRegion = notifyRegion;
+}
 #endif
 
 void VTTCue::setIsActive(bool active)
@@ -747,7 +753,7 @@ void VTTCue::removeDisplayTree()
 {
 #if ENABLE(WEBVTT_REGIONS)
     // The region needs to be informed about the cue removal.
-    if (track()) {
+    if (m_notifyRegion && track()) {
         if (TextTrackRegionList* regions = track()->regions()) {
             if (TextTrackRegion* region = regions->getRegionById(m_regionId))
                 region->willRemoveTextTrackCueBox(m_displayTree.get());
index ac19bb4..22fbe43 100644 (file)
@@ -109,6 +109,7 @@ public:
 #if ENABLE(WEBVTT_REGIONS)
     const String& regionId() const { return m_regionId; }
     void setRegionId(const String&);
+    void notifyRegionWhenRemovingDisplayTree(bool);
 #endif
 
     virtual void setIsActive(bool);
@@ -216,6 +217,7 @@ private:
 #if ENABLE(WEBVTT_REGIONS)
     String m_regionId;
 #endif
+    bool m_notifyRegion;
 };
 
 VTTCue* toVTTCue(TextTrackCue*);
index daee81a..e4c3989 100644 (file)
@@ -167,8 +167,10 @@ void WebVTTParser::parseBytes(const char* data, unsigned length)
             break;
 
         case Header:
-            // 13-18 - Allow a header (comment area) under the WEBVTT line.
 #if ENABLE(WEBVTT_REGIONS)
+            collectMetadataHeader(line);
+
+            // 13-18 - Allow a header (comment area) under the WEBVTT line.
             if (line.isEmpty()) {
                 if (m_client && m_regionList.size())
                     m_client->newRegionsParsed();
@@ -176,14 +178,7 @@ void WebVTTParser::parseBytes(const char* data, unsigned length)
                 m_state = Id;
                 break;
             }
-            collectHeader(line);
-
-            break;
-
-        case Metadata:
 #endif
-            if (line.isEmpty())
-                m_state = Id;
             break;
 
         case Id:
@@ -252,7 +247,7 @@ bool WebVTTParser::hasRequiredFileIdentifier(const String& line)
 }
 
 #if ENABLE(WEBVTT_REGIONS)
-void WebVTTParser::collectHeader(const String& line)
+void WebVTTParser::collectMetadataHeader(const String& line)
 {
     // 4.1 Extension of WebVTT header parsing (11 - 15)
     DEPRECATED_DEFINE_STATIC_LOCAL(const AtomicString, regionHeaderName, ("Region", AtomicString::ConstructFromLiteral));
index 52bb10d..23d692c 100644 (file)
@@ -100,9 +100,6 @@ public:
     enum ParseState {
         Initial,
         Header,
-#if ENABLE(WEBVTT_REGIONS)
-        Metadata,
-#endif
         Id,
         TimingsAndSettings,
         CueText,
@@ -169,7 +166,7 @@ private:
     void resetCueValues();
 
 #if ENABLE(WEBVTT_REGIONS)
-    void collectHeader(const String&);
+    void collectMetadataHeader(const String&);
     void createNewRegion();
 #endif