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"
9 namespace mozilla::dom
{
11 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(TextTrackRegion
, mParent
)
12 NS_IMPL_CYCLE_COLLECTING_ADDREF(TextTrackRegion
)
13 NS_IMPL_CYCLE_COLLECTING_RELEASE(TextTrackRegion
)
14 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TextTrackRegion
)
15 NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
16 NS_INTERFACE_MAP_ENTRY(nsISupports
)
19 JSObject
* TextTrackRegion::WrapObject(JSContext
* aCx
,
20 JS::Handle
<JSObject
*> aGivenProto
) {
21 return VTTRegion_Binding::Wrap(aCx
, this, aGivenProto
);
24 already_AddRefed
<TextTrackRegion
> TextTrackRegion::Constructor(
25 const GlobalObject
& aGlobal
, ErrorResult
& aRv
) {
26 nsCOMPtr
<nsPIDOMWindowInner
> window
=
27 do_QueryInterface(aGlobal
.GetAsSupports());
29 aRv
.Throw(NS_ERROR_FAILURE
);
33 RefPtr
<TextTrackRegion
> region
= new TextTrackRegion(aGlobal
.GetAsSupports());
34 return region
.forget();
37 TextTrackRegion::TextTrackRegion(nsISupports
* aGlobal
)
44 mViewportAnchorY(100),
45 mScroll(ScrollSetting::_empty
) {}
47 void TextTrackRegion::CopyValues(TextTrackRegion
& aRegion
) {
49 mWidth
= aRegion
.Width();
50 mLines
= aRegion
.Lines();
51 mRegionAnchorX
= aRegion
.RegionAnchorX();
52 mRegionAnchorY
= aRegion
.RegionAnchorY();
53 mViewportAnchorX
= aRegion
.ViewportAnchorX();
54 mViewportAnchorY
= aRegion
.ViewportAnchorY();
55 mScroll
= aRegion
.Scroll();
58 } // namespace mozilla::dom