Bug 1412180 - implement regionID on TextTrackRegion. r=smaug, rillian
MozReview-Commit-ID: 3uFAQuNfGjO
--- a/dom/media/TextTrackRegion.cpp
+++ b/dom/media/TextTrackRegion.cpp
@@ -46,16 +46,17 @@ TextTrackRegion::TextTrackRegion(nsISupp
, mViewportAnchorX(0)
, mViewportAnchorY(100)
{
}
void
TextTrackRegion::CopyValues(TextTrackRegion& aRegion)
{
+ mId = aRegion.Id();
mWidth = aRegion.Width();
mLines = aRegion.Lines();
mRegionAnchorX = aRegion.RegionAnchorX();
mRegionAnchorY = aRegion.RegionAnchorY();
mViewportAnchorX = aRegion.ViewportAnchorX();
mViewportAnchorY = aRegion.ViewportAnchorY();
mScroll = aRegion.Scroll();
}
--- a/dom/media/TextTrackRegion.h
+++ b/dom/media/TextTrackRegion.h
@@ -122,33 +122,48 @@ public:
if (!aScroll.EqualsLiteral("") && !aScroll.EqualsLiteral("up")) {
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
return;
}
mScroll = aScroll;
}
+ void GetId(nsAString& aId) const
+ {
+ aId = mId;
+ }
+
+ void SetId(const nsAString& aId)
+ {
+ mId = aId;
+ }
+
/** end WebIDL Methods. */
// Helper to aid copying of a given TextTrackRegion's width, lines,
// anchor, viewport and scroll values.
void CopyValues(TextTrackRegion& aRegion);
// -----helpers-------
const nsAString& Scroll() const
{
return mScroll;
}
+ const nsAString& Id() const
+ {
+ return mId;
+ }
private:
~TextTrackRegion() {}
nsCOMPtr<nsISupports> mParent;
+ nsString mId;
double mWidth;
long mLines;
double mRegionAnchorX;
double mRegionAnchorY;
double mViewportAnchorX;
double mViewportAnchorY;
nsString mScroll;
--- a/dom/media/webvtt/vtt.jsm
+++ b/dom/media/webvtt/vtt.jsm
@@ -1111,16 +1111,17 @@ const { XPCOMUtils } = require("resource
}
}, /=/, /\s/);
// Create the region, using default values for any values that were not
// specified.
if (settings.has("id")) {
try {
var region = new self.window.VTTRegion();
+ region.id = settings.get("id", "");
region.width = settings.get("width", 100);
region.lines = settings.get("lines", 3);
region.regionAnchorX = settings.get("regionanchorX", 0);
region.regionAnchorY = settings.get("regionanchorY", 100);
region.viewportAnchorX = settings.get("viewportanchorX", 0);
region.viewportAnchorY = settings.get("viewportanchorY", 100);
region.scroll = settings.get("scroll", "");
// Register the region.
--- a/dom/webidl/VTTRegion.webidl
+++ b/dom/webidl/VTTRegion.webidl
@@ -4,16 +4,17 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://dev.w3.org/html5/webvtt/#extension-of-the-texttrack-interface-for-region-support
*/
[Constructor, Pref="media.webvtt.regions.enabled"]
interface VTTRegion {
+ attribute DOMString id;
[SetterThrows]
attribute double width;
attribute long lines;
[SetterThrows]
attribute double regionAnchorX;
[SetterThrows]