Title: [145053] trunk
Revision
145053
Author
vcarb...@chromium.org
Date
2013-03-07 01:29:10 -0800 (Thu, 07 Mar 2013)

Log Message

TextTrackRegion Constructor
https://bugs.webkit.org/show_bug.cgi?id=110511

Reviewed by Adam Barth.

Source/WebCore:

This is an initial patch for implementing the TextTrackRegion
defined in the "WebVTT Extension: Regions for rendering cue groups":
https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/region.html

The feature components are hidden behind the WEBVTT_REGIONS flag
and is currently disabled by default in all ports and tests skipped.

Test: media/track/regions-webvtt/text-track-region-constructor.html

* WebCore.gypi: Added files to be included for building Chromium with
feature enabled (it is disabled by default).
* html/track/TextTrackRegion.cpp: Added.
(WebCore):
(WebCore::TextTrackRegion::TextTrackRegion):
(WebCore::TextTrackRegion::~TextTrackRegion):
(WebCore::TextTrackRegion::setId): Setter.
(WebCore::TextTrackRegion::setWidth): Setter.
(WebCore::TextTrackRegion::setHeight): Setter.
(WebCore::TextTrackRegion::setRegionAnchorX): Setter.
(WebCore::TextTrackRegion::setRegionAnchorY): Setter.
(WebCore::TextTrackRegion::setViewportAnchorX): Setter.
(WebCore::TextTrackRegion::setViewportAnchorY): Setter.
(WebCore::TextTrackRegion::scroll): Getter. Internally, the scroll
value is stored as a boolean, but when returned is converted to either
the empty string or "up".
(WebCore::TextTrackRegion::setScroll): Setter.
(WebCore::TextTrackRegion::setRegionSettings): Not used yet (see b/109818)
* html/track/TextTrackRegion.h: Added.
(WebCore):
(TextTrackRegion):
(WebCore::TextTrackRegion::create):
(WebCore::TextTrackRegion::track): Getter.
(WebCore::TextTrackRegion::id): Getter.
(WebCore::TextTrackRegion::width): Getter.
(WebCore::TextTrackRegion::height): Getter.
(WebCore::TextTrackRegion::regionAnchorX): Getter.
(WebCore::TextTrackRegion::regionAnchorY): Getter.
(WebCore::TextTrackRegion::viewportAnchorX): Getter.
(WebCore::TextTrackRegion::viewportAnchorY): Getter.
(WebCore::TextTrackRegion::regionSettings): Getter, used only internally (see b/109818).
* html/track/TextTrackRegion.idl: Added.
* page/DOMWindow.idl: Constructor support.

LayoutTests:

* TestExpectations:
* media/track/regions-webvtt/text-track-region-constructor-expected.txt: Added.
* media/track/regions-webvtt/text-track-region-constructor.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (145052 => 145053)


--- trunk/LayoutTests/ChangeLog	2013-03-07 09:04:57 UTC (rev 145052)
+++ trunk/LayoutTests/ChangeLog	2013-03-07 09:29:10 UTC (rev 145053)
@@ -1,3 +1,14 @@
+2013-03-07  Victor Carbune  <vcarb...@chromium.org>
+
+        TextTrackRegion Constructor
+        https://bugs.webkit.org/show_bug.cgi?id=110511
+
+        Reviewed by Adam Barth.
+
+        * TestExpectations:
+        * media/track/regions-webvtt/text-track-region-constructor-expected.txt: Added.
+        * media/track/regions-webvtt/text-track-region-constructor.html: Added.
+
 2013-03-06  Filip Pizlo  <fpi...@apple.com>
 
         ConvertThis should be turned into Identity based on predictions in Fixup, rather than based on proofs in ConstantFolding

Modified: trunk/LayoutTests/TestExpectations (145052 => 145053)


--- trunk/LayoutTests/TestExpectations	2013-03-07 09:04:57 UTC (rev 145052)
+++ trunk/LayoutTests/TestExpectations	2013-03-07 09:29:10 UTC (rev 145053)
@@ -5,3 +5,5 @@
 # pending functional patch and per-port verification
 webkit.org/b/109954 css3/line-break [ Skip ]
 
+# pending implementation completion and feature enabling
+webkit.org/b/109570 media/track/regions-webvtt [ Skip ]

Added: trunk/LayoutTests/media/track/regions-webvtt/text-track-region-constructor-expected.txt (0 => 145053)


--- trunk/LayoutTests/media/track/regions-webvtt/text-track-region-constructor-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/track/regions-webvtt/text-track-region-constructor-expected.txt	2013-03-07 09:29:10 UTC (rev 145053)
@@ -0,0 +1,120 @@
+Tests the constructor and mutation of TextTrackRegion.
+
+** Test the default indexs of a region. **
+EXPECTED (region.track == 'null') OK
+EXPECTED (region.scroll == '') OK
+EXPECTED (region.viewportAnchorX == '0') OK
+EXPECTED (region.viewportAnchorY == '100') OK
+EXPECTED (region.regionAnchorX == '0') OK
+EXPECTED (region.regionAnchorY == '100') OK
+EXPECTED (region.height == '3') OK
+EXPECTED (region.width == '100') OK
+
+** Test that incorrect mutation keeps previous valid values. **
+RUN(region.scroll = 'invalid-scroll-value')
+Error: SyntaxError: DOM Exception 12
+EXPECTED (region.scroll == '') OK
+
+Invalid percentage value: -1
+RUN(region.viewportAnchorX = invalidPercentageValues[index])
+Error: IndexSizeError: DOM Exception 1
+EXPECTED (region.viewportAnchorX == '0') OK
+RUN(region.viewportAnchorY = invalidPercentageValues[index])
+Error: IndexSizeError: DOM Exception 1
+EXPECTED (region.viewportAnchorY == '100') OK
+RUN(region.regionAnchorX = invalidPercentageValues[index])
+Error: IndexSizeError: DOM Exception 1
+EXPECTED (region.regionAnchorX == '0') OK
+RUN(region.regionAnchorY = invalidPercentageValues[index])
+Error: IndexSizeError: DOM Exception 1
+EXPECTED (region.regionAnchorY == '100') OK
+RUN(region.width = invalidPercentageValues[index])
+Error: IndexSizeError: DOM Exception 1
+EXPECTED (region.width == '100') OK
+
+Invalid percentage value: 101
+RUN(region.viewportAnchorX = invalidPercentageValues[index])
+Error: IndexSizeError: DOM Exception 1
+EXPECTED (region.viewportAnchorX == '0') OK
+RUN(region.viewportAnchorY = invalidPercentageValues[index])
+Error: IndexSizeError: DOM Exception 1
+EXPECTED (region.viewportAnchorY == '100') OK
+RUN(region.regionAnchorX = invalidPercentageValues[index])
+Error: IndexSizeError: DOM Exception 1
+EXPECTED (region.regionAnchorX == '0') OK
+RUN(region.regionAnchorY = invalidPercentageValues[index])
+Error: IndexSizeError: DOM Exception 1
+EXPECTED (region.regionAnchorY == '100') OK
+RUN(region.width = invalidPercentageValues[index])
+Error: IndexSizeError: DOM Exception 1
+EXPECTED (region.width == '100') OK
+
+Invalid percentage value: -Infinity
+RUN(region.viewportAnchorX = invalidPercentageValues[index])
+TypeError: Type error
+EXPECTED (region.viewportAnchorX == '0') OK
+RUN(region.viewportAnchorY = invalidPercentageValues[index])
+TypeError: Type error
+EXPECTED (region.viewportAnchorY == '100') OK
+RUN(region.regionAnchorX = invalidPercentageValues[index])
+TypeError: Type error
+EXPECTED (region.regionAnchorX == '0') OK
+RUN(region.regionAnchorY = invalidPercentageValues[index])
+TypeError: Type error
+EXPECTED (region.regionAnchorY == '100') OK
+RUN(region.width = invalidPercentageValues[index])
+TypeError: Type error
+EXPECTED (region.width == '100') OK
+
+Invalid percentage value: Infinity
+RUN(region.viewportAnchorX = invalidPercentageValues[index])
+TypeError: Type error
+EXPECTED (region.viewportAnchorX == '0') OK
+RUN(region.viewportAnchorY = invalidPercentageValues[index])
+TypeError: Type error
+EXPECTED (region.viewportAnchorY == '100') OK
+RUN(region.regionAnchorX = invalidPercentageValues[index])
+TypeError: Type error
+EXPECTED (region.regionAnchorX == '0') OK
+RUN(region.regionAnchorY = invalidPercentageValues[index])
+TypeError: Type error
+EXPECTED (region.regionAnchorY == '100') OK
+RUN(region.width = invalidPercentageValues[index])
+TypeError: Type error
+EXPECTED (region.width == '100') OK
+
+Invalid percentage value: NaN
+RUN(region.viewportAnchorX = invalidPercentageValues[index])
+TypeError: Type error
+EXPECTED (region.viewportAnchorX == '0') OK
+RUN(region.viewportAnchorY = invalidPercentageValues[index])
+TypeError: Type error
+EXPECTED (region.viewportAnchorY == '100') OK
+RUN(region.regionAnchorX = invalidPercentageValues[index])
+TypeError: Type error
+EXPECTED (region.regionAnchorX == '0') OK
+RUN(region.regionAnchorY = invalidPercentageValues[index])
+TypeError: Type error
+EXPECTED (region.regionAnchorY == '100') OK
+RUN(region.width = invalidPercentageValues[index])
+TypeError: Type error
+EXPECTED (region.width == '100') OK
+RUN(region.height = -1)
+Error: IndexSizeError: DOM Exception 1
+EXPECTED (region.height == '3') OK
+
+** Test that proper mutation keeps assigned value. **
+RUN(region.height = 130)
+EXPECTED (region.height == '130') OK
+RUN(region.viewportAnchorX = 64)
+EXPECTED (region.viewportAnchorX == '64') OK
+RUN(region.viewportAnchorY = 32)
+EXPECTED (region.viewportAnchorY == '32') OK
+RUN(region.regionAnchorX = 16)
+EXPECTED (region.regionAnchorX == '16') OK
+RUN(region.regionAnchorY = 8)
+EXPECTED (region.regionAnchorY == '8') OK
+RUN(region.width = 42)
+EXPECTED (region.width == '42') OK
+END OF TEST
+

Added: trunk/LayoutTests/media/track/regions-webvtt/text-track-region-constructor.html (0 => 145053)


--- trunk/LayoutTests/media/track/regions-webvtt/text-track-region-constructor.html	                        (rev 0)
+++ trunk/LayoutTests/media/track/regions-webvtt/text-track-region-constructor.html	2013-03-07 09:29:10 UTC (rev 145053)
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+        <script src=""
+        <script src=""
+        <script>
+            var region;
+            var invalidPercentageValues;
+
+            function startTest()
+            {
+                if (!window.TextTrackRegion) {
+                    failTest();
+                    return;
+                }
+
+                region = new TextTrackRegion();
+
+                consoleWrite("** Test the default indexs of a region. **");
+                testExpected("region.track", null);
+                testExpected("region.scroll", "");
+                testExpected("region.viewportAnchorX", 0);
+                testExpected("region.viewportAnchorY", 100);
+                testExpected("region.regionAnchorX", 0);
+                testExpected("region.regionAnchorY", 100);
+                testExpected("region.height", 3);
+                testExpected("region.width", 100);
+
+                consoleWrite("<br>** Test that incorrect mutation keeps previous valid values. **");
+                run("region.scroll = 'invalid-scroll-value'");
+                testExpected("region.scroll", "");
+
+                invalidPercentageValues = [-1, 101, -Infinity, Infinity, NaN];
+                for (index in invalidPercentageValues) {
+                  consoleWrite("<br>Invalid percentage value: " + invalidPercentageValues[index]);
+                  run("region.viewportAnchorX = invalidPercentageValues[index]");
+                  testExpected("region.viewportAnchorX", 0);
+                  run("region.viewportAnchorY = invalidPercentageValues[index]");
+                  testExpected("region.viewportAnchorY", 100);
+                  run("region.regionAnchorX = invalidPercentageValues[index]");
+                  testExpected("region.regionAnchorX", 0);
+                  run("region.regionAnchorY = invalidPercentageValues[index]");
+                  testExpected("region.regionAnchorY", 100);
+                  run("region.width = invalidPercentageValues[index]");
+                  testExpected("region.width", 100);
+                }
+
+                run("region.height = -1");
+                testExpected("region.height", 3);
+
+                consoleWrite("<br>** Test that proper mutation keeps assigned value. **");
+                run("region.height = 130");
+                testExpected("region.height", 130);
+
+                run("region.viewportAnchorX = 64");
+                testExpected("region.viewportAnchorX", 64);
+                run("region.viewportAnchorY = 32");
+                testExpected("region.viewportAnchorY", 32);
+                run("region.regionAnchorX = 16");
+                testExpected("region.regionAnchorX", 16);
+                run("region.regionAnchorY = 8");
+                testExpected("region.regionAnchorY", 8);
+
+                run("region.width = 42");
+                testExpected("region.width", 42);
+
+                endTest();
+            }
+
+        </script>
+    </head>
+    <body _onload_="startTest()">
+        <p>Tests the constructor and mutation of TextTrackRegion.</p>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (145052 => 145053)


--- trunk/Source/WebCore/ChangeLog	2013-03-07 09:04:57 UTC (rev 145052)
+++ trunk/Source/WebCore/ChangeLog	2013-03-07 09:29:10 UTC (rev 145053)
@@ -1,3 +1,53 @@
+2013-03-07  Victor Carbune  <vcarb...@chromium.org>
+
+        TextTrackRegion Constructor
+        https://bugs.webkit.org/show_bug.cgi?id=110511
+
+        Reviewed by Adam Barth.
+
+        This is an initial patch for implementing the TextTrackRegion
+        defined in the "WebVTT Extension: Regions for rendering cue groups":
+        https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/region.html
+
+        The feature components are hidden behind the WEBVTT_REGIONS flag
+        and is currently disabled by default in all ports and tests skipped.
+
+        Test: media/track/regions-webvtt/text-track-region-constructor.html
+
+        * WebCore.gypi: Added files to be included for building Chromium with
+        feature enabled (it is disabled by default).
+        * html/track/TextTrackRegion.cpp: Added.
+        (WebCore):
+        (WebCore::TextTrackRegion::TextTrackRegion):
+        (WebCore::TextTrackRegion::~TextTrackRegion):
+        (WebCore::TextTrackRegion::setId): Setter.
+        (WebCore::TextTrackRegion::setWidth): Setter.
+        (WebCore::TextTrackRegion::setHeight): Setter.
+        (WebCore::TextTrackRegion::setRegionAnchorX): Setter.
+        (WebCore::TextTrackRegion::setRegionAnchorY): Setter.
+        (WebCore::TextTrackRegion::setViewportAnchorX): Setter.
+        (WebCore::TextTrackRegion::setViewportAnchorY): Setter.
+        (WebCore::TextTrackRegion::scroll): Getter. Internally, the scroll
+        value is stored as a boolean, but when returned is converted to either
+        the empty string or "up".
+        (WebCore::TextTrackRegion::setScroll): Setter.
+        (WebCore::TextTrackRegion::setRegionSettings): Not used yet (see b/109818)
+        * html/track/TextTrackRegion.h: Added.
+        (WebCore):
+        (TextTrackRegion):
+        (WebCore::TextTrackRegion::create):
+        (WebCore::TextTrackRegion::track): Getter.
+        (WebCore::TextTrackRegion::id): Getter.
+        (WebCore::TextTrackRegion::width): Getter.
+        (WebCore::TextTrackRegion::height): Getter.
+        (WebCore::TextTrackRegion::regionAnchorX): Getter.
+        (WebCore::TextTrackRegion::regionAnchorY): Getter.
+        (WebCore::TextTrackRegion::viewportAnchorX): Getter.
+        (WebCore::TextTrackRegion::viewportAnchorY): Getter.
+        (WebCore::TextTrackRegion::regionSettings): Getter, used only internally (see b/109818).
+        * html/track/TextTrackRegion.idl: Added.
+        * page/DOMWindow.idl: Constructor support.
+
 2013-03-07  Dan Carney  <dcar...@google.com>
 
         [v8] remove latin-1 transition flag

Modified: trunk/Source/WebCore/WebCore.gypi (145052 => 145053)


--- trunk/Source/WebCore/WebCore.gypi	2013-03-07 09:04:57 UTC (rev 145052)
+++ trunk/Source/WebCore/WebCore.gypi	2013-03-07 09:29:10 UTC (rev 145053)
@@ -498,6 +498,7 @@
             'html/track/TextTrackCueList.idl',
             'html/track/TextTrackList.idl',
             'html/track/TrackEvent.idl',
+            'html/track/TextTrackRegion.idl',
             'inspector/InjectedScriptHost.idl',
             'inspector/InspectorFrontendHost.idl',
             'inspector/_javascript_CallFrame.idl',
@@ -3605,6 +3606,8 @@
             'html/track/TextTrackCueList.cpp',
             'html/track/TextTrackCueList.h',
             'html/track/TextTrackList.cpp',
+            'html/track/TextTrackRegion.cpp',
+            'html/track/TextTrackRegion.h',
             'html/track/TrackBase.cpp',
             'html/track/TrackEvent.cpp',
             'html/track/WebVTTElement.cpp',

Added: trunk/Source/WebCore/html/track/TextTrackRegion.cpp (0 => 145053)


--- trunk/Source/WebCore/html/track/TextTrackRegion.cpp	                        (rev 0)
+++ trunk/Source/WebCore/html/track/TextTrackRegion.cpp	2013-03-07 09:29:10 UTC (rev 145053)
@@ -0,0 +1,185 @@
+/*
+ * Copyright (C) 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 are
+ * met:
+ *
+ *     * Redistributions of source ec must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(VIDEO_TRACK) && ENABLE(WEBVTT_REGIONS)
+
+#include "TextTrackRegion.h"
+
+namespace WebCore {
+
+// The region occupies by default 100% of the width of the video viewport.
+static const float defaultWidth = 100;
+
+// The region has, by default, 3 lines of text.
+static const long defaultHeightInLines = 3;
+
+// The region and viewport are anchored in the bottom left corner.
+static const float defaultAnchorPointX = 0;
+static const float defaultAnchorPointY = 100;
+
+// The region doesn't have scrolling text, by default.
+static const bool defaultScroll = false;
+
+TextTrackRegion::TextTrackRegion()
+    : m_id(emptyString())
+    , m_width(defaultWidth)
+    , m_heightInLines(defaultHeightInLines)
+    , m_regionAnchor(FloatPoint(defaultAnchorPointX, defaultAnchorPointY))
+    , m_viewportAnchor(FloatPoint(defaultAnchorPointX, defaultAnchorPointY))
+    , m_scroll(defaultScroll)
+{
+}
+
+TextTrackRegion::~TextTrackRegion()
+{
+}
+
+void TextTrackRegion::setId(const String& id)
+{
+    m_id = id;
+}
+
+void TextTrackRegion::setWidth(double value, ExceptionCode& ec)
+{
+    if (std::isinf(value) || std::isnan(value)) {
+        ec = TypeError;
+        return;
+    }
+
+    if (value < 0 || value > 100) {
+        ec = INDEX_SIZE_ERR;
+        return;
+    }
+
+    m_width = value;
+}
+
+void TextTrackRegion::setHeight(long value, ExceptionCode& ec)
+{
+    if (value < 0) {
+        ec = INDEX_SIZE_ERR;
+        return;
+    }
+
+    m_heightInLines = value;
+}
+
+void TextTrackRegion::setRegionAnchorX(double value, ExceptionCode& ec)
+{
+    if (std::isinf(value) || std::isnan(value)) {
+        ec = TypeError;
+        return;
+    }
+
+    if (value < 0 || value > 100) {
+        ec = INDEX_SIZE_ERR;
+        return;
+    }
+
+    m_regionAnchor.setX(value);
+}
+
+void TextTrackRegion::setRegionAnchorY(double value, ExceptionCode& ec)
+{
+    if (std::isinf(value) || std::isnan(value)) {
+        ec = TypeError;
+        return;
+    }
+
+    if (value < 0 || value > 100) {
+        ec = INDEX_SIZE_ERR;
+        return;
+    }
+
+    m_regionAnchor.setY(value);
+}
+
+void TextTrackRegion::setViewportAnchorX(double value, ExceptionCode& ec)
+{
+    if (std::isinf(value) || std::isnan(value)) {
+        ec = TypeError;
+        return;
+    }
+
+    if (value < 0 || value > 100) {
+        ec = INDEX_SIZE_ERR;
+        return;
+    }
+
+    m_viewportAnchor.setX(value);
+}
+
+void TextTrackRegion::setViewportAnchorY(double value, ExceptionCode& ec)
+{
+    if (std::isinf(value) || std::isnan(value)) {
+        ec = TypeError;
+        return;
+    }
+
+    if (value < 0 || value > 100) {
+        ec = INDEX_SIZE_ERR;
+        return;
+    }
+
+    m_viewportAnchor.setY(value);
+}
+
+const AtomicString TextTrackRegion::scroll() const
+{
+    DEFINE_STATIC_LOCAL(const AtomicString, upScrollValueKeyword, ("up", AtomicString::ConstructFromLiteral));
+
+    if (m_scroll)
+        return upScrollValueKeyword;
+
+    return "";
+}
+
+void TextTrackRegion::setScroll(const AtomicString& value, ExceptionCode& ec)
+{
+    DEFINE_STATIC_LOCAL(const AtomicString, upScrollValueKeyword, ("up", AtomicString::ConstructFromLiteral));
+
+    if (value != emptyString() && value != upScrollValueKeyword) {
+        ec = SYNTAX_ERR;
+        return;
+    }
+
+    m_scroll = value == upScrollValueKeyword;
+}
+
+void TextTrackRegion::setRegionSettings(const String& input)
+{
+    // FIXME(109818): Parse region header metadata.
+}
+
+} // namespace WebCore
+
+#endif

Added: trunk/Source/WebCore/html/track/TextTrackRegion.h (0 => 145053)


--- trunk/Source/WebCore/html/track/TextTrackRegion.h	                        (rev 0)
+++ trunk/Source/WebCore/html/track/TextTrackRegion.h	2013-03-07 09:29:10 UTC (rev 145053)
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 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 are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TextTrackRegion_h
+#define TextTrackRegion_h
+
+#if ENABLE(VIDEO_TRACK) && ENABLE(WEBVTT_REGIONS)
+
+#include "FloatPoint.h"
+#include "TextTrack.h"
+#include <wtf/PassOwnPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class TextTrackRegion : public RefCounted<TextTrackRegion> {
+public:
+    static PassRefPtr<TextTrackRegion> create()
+    {
+        return adoptRef(new TextTrackRegion());
+    }
+
+    virtual ~TextTrackRegion();
+
+    TextTrack* track() const { return 0; }
+
+    const String& id() const { return m_id; }
+    void setId(const String&);
+
+    double width() const { return m_width; }
+    void setWidth(double, ExceptionCode&);
+
+    long height() const { return m_heightInLines; }
+    void setHeight(long, ExceptionCode&);
+
+    double regionAnchorX() const { return m_regionAnchor.x(); }
+    void setRegionAnchorX(double, ExceptionCode&);
+
+    double regionAnchorY() const { return m_regionAnchor.y(); }
+    void setRegionAnchorY(double, ExceptionCode&);
+
+    double viewportAnchorX() const { return m_viewportAnchor.x(); }
+    void setViewportAnchorX(double, ExceptionCode&);
+
+    double viewportAnchorY() const { return m_viewportAnchor.y(); }
+    void setViewportAnchorY(double, ExceptionCode&);
+
+    const AtomicString scroll() const;
+    void setScroll(const AtomicString&, ExceptionCode&);
+
+    const String& regionSettings() const { return m_settings; }
+    void setRegionSettings(const String&);
+
+private:
+    TextTrackRegion();
+
+    enum RegionSetting {
+        None,
+        Id,
+        Width,
+        Height,
+        RegionAnchor,
+        ViewportAnchor,
+        Scroll
+    };
+
+    String m_id;
+    String m_settings;
+
+    double m_width;
+    unsigned m_heightInLines;
+
+    FloatPoint m_regionAnchor;
+    FloatPoint m_viewportAnchor;
+
+    bool m_scroll;
+};
+
+} // namespace WebCore
+
+#endif
+#endif

Added: trunk/Source/WebCore/html/track/TextTrackRegion.idl (0 => 145053)


--- trunk/Source/WebCore/html/track/TextTrackRegion.idl	                        (rev 0)
+++ trunk/Source/WebCore/html/track/TextTrackRegion.idl	2013-03-07 09:29:10 UTC (rev 145053)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 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
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+[
+    Conditional=VIDEO_TRACK & WEBVTT_REGIONS,
+    V8EnabledAtRuntime=webkitVideoTrack,
+    JSGenerateToNativeObject,
+    Constructor()
+] interface TextTrackRegion {
+    readonly attribute TextTrack track;
+
+    attribute DOMString id;
+    attribute double width
+        setter raises (DOMException);
+    attribute long height
+        setter raises (DOMException);
+    attribute double regionAnchorX
+        setter raises (DOMException);
+    attribute double regionAnchorY
+        setter raises (DOMException);
+    attribute double viewportAnchorX
+        setter raises (DOMException);
+    attribute double viewportAnchorY
+        setter raises (DOMException);
+    attribute DOMString scroll
+        setter raises (DOMException);
+};
+

Modified: trunk/Source/WebCore/page/DOMWindow.idl (145052 => 145053)


--- trunk/Source/WebCore/page/DOMWindow.idl	2013-03-07 09:04:57 UTC (rev 145052)
+++ trunk/Source/WebCore/page/DOMWindow.idl	2013-03-07 09:29:10 UTC (rev 145053)
@@ -492,6 +492,7 @@
     [Conditional=VIDEO_TRACK, V8EnabledAtRuntime=webkitVideoTrack] attribute TextTrackCueConstructor TextTrackCue; // Usable with the new operator
     [Conditional=VIDEO_TRACK, V8EnabledAtRuntime=webkitVideoTrack] attribute TextTrackCueListConstructor TextTrackCueList;
     [Conditional=VIDEO_TRACK, V8EnabledAtRuntime=webkitVideoTrack] attribute TextTrackListConstructor TextTrackList;
+    [Conditional=VIDEO_TRACK & WEBVTT_REGIONS, V8EnabledAtRuntime=webkitVideoTrack] attribute TextTrackRegionConstructor TextTrackRegion; // Usable with the new operator
     [Conditional=VIDEO_TRACK, V8EnabledAtRuntime=webkitVideoTrack] attribute TrackEventConstructor TrackEvent;
 
     [JSCustomGetter, Conditional=VIDEO, V8EnabledAtRuntime] attribute HTMLAudioElementConstructorConstructor Audio; // Usable with the new operator
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to