Line data Source code
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/. */
6 :
7 : #include "mozilla/dom/TextTrackRegion.h"
8 : #include "mozilla/dom/VTTRegionBinding.h"
9 :
10 : namespace mozilla {
11 : namespace dom {
12 :
13 0 : NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(TextTrackRegion, mParent)
14 0 : NS_IMPL_CYCLE_COLLECTING_ADDREF(TextTrackRegion)
15 0 : NS_IMPL_CYCLE_COLLECTING_RELEASE(TextTrackRegion)
16 0 : NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TextTrackRegion)
17 0 : NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
18 0 : NS_INTERFACE_MAP_ENTRY(nsISupports)
19 0 : NS_INTERFACE_MAP_END
20 :
21 : JSObject*
22 0 : TextTrackRegion::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
23 : {
24 0 : return VTTRegionBinding::Wrap(aCx, this, aGivenProto);
25 : }
26 :
27 : already_AddRefed<TextTrackRegion>
28 0 : TextTrackRegion::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
29 : {
30 0 : nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports());
31 0 : if (!window) {
32 0 : aRv.Throw(NS_ERROR_FAILURE);
33 0 : return nullptr;
34 : }
35 :
36 0 : RefPtr<TextTrackRegion> region = new TextTrackRegion(aGlobal.GetAsSupports());
37 0 : return region.forget();
38 : }
39 :
40 0 : TextTrackRegion::TextTrackRegion(nsISupports* aGlobal)
41 : : mParent(aGlobal)
42 : , mWidth(100)
43 : , mLines(3)
44 : , mRegionAnchorX(0)
45 : , mRegionAnchorY(100)
46 : , mViewportAnchorX(0)
47 0 : , mViewportAnchorY(100)
48 : {
49 0 : }
50 :
51 : void
52 0 : TextTrackRegion::CopyValues(TextTrackRegion& aRegion)
53 : {
54 0 : mWidth = aRegion.Width();
55 0 : mLines = aRegion.Lines();
56 0 : mRegionAnchorX = aRegion.RegionAnchorX();
57 0 : mRegionAnchorY = aRegion.RegionAnchorY();
58 0 : mViewportAnchorX = aRegion.ViewportAnchorX();
59 0 : mViewportAnchorY = aRegion.ViewportAnchorY();
60 0 : mScroll = aRegion.Scroll();
61 0 : }
62 :
63 : } //namespace dom
64 : } //namespace mozilla
65 :
|