1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 et tw=78: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "mozilla/dom/TextTrackRegion.h"
12 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(TextTrackRegion
, mParent
)
13 NS_IMPL_CYCLE_COLLECTING_ADDREF(TextTrackRegion
)
14 NS_IMPL_CYCLE_COLLECTING_RELEASE(TextTrackRegion
)
15 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TextTrackRegion
)
16 NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
17 NS_INTERFACE_MAP_ENTRY(nsISupports
)
21 TextTrackRegion::WrapObject(JSContext
* aCx
, JS::Handle
<JSObject
*> aGivenProto
)
23 return VTTRegionBinding::Wrap(aCx
, this, aGivenProto
);
26 already_AddRefed
<TextTrackRegion
>
27 TextTrackRegion::Constructor(const GlobalObject
& aGlobal
, ErrorResult
& aRv
)
29 nsCOMPtr
<nsPIDOMWindowInner
> window
= do_QueryInterface(aGlobal
.GetAsSupports());
31 aRv
.Throw(NS_ERROR_FAILURE
);
35 RefPtr
<TextTrackRegion
> region
= new TextTrackRegion(aGlobal
.GetAsSupports());
36 return region
.forget();
39 TextTrackRegion::TextTrackRegion(nsISupports
* aGlobal
)
46 , mViewportAnchorY(100)
47 , mScroll(ScrollSetting::_empty
)
52 TextTrackRegion::CopyValues(TextTrackRegion
& aRegion
)
55 mWidth
= aRegion
.Width();
56 mLines
= aRegion
.Lines();
57 mRegionAnchorX
= aRegion
.RegionAnchorX();
58 mRegionAnchorY
= aRegion
.RegionAnchorY();
59 mViewportAnchorX
= aRegion
.ViewportAnchorX();
60 mViewportAnchorY
= aRegion
.ViewportAnchorY();
61 mScroll
= aRegion
.Scroll();