Bug 1449132 [wpt PR 10194] - [css-grid] Fix resolution of percentage paddings and...
[gecko.git] / dom / media / TextTrackRegion.cpp
blob0ddfb20d15423d14be5e9580525321c5a7cd93a5
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 {
10 namespace dom {
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)
18 NS_INTERFACE_MAP_END
20 JSObject*
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());
30 if (!window) {
31 aRv.Throw(NS_ERROR_FAILURE);
32 return nullptr;
35 RefPtr<TextTrackRegion> region = new TextTrackRegion(aGlobal.GetAsSupports());
36 return region.forget();
39 TextTrackRegion::TextTrackRegion(nsISupports* aGlobal)
40 : mParent(aGlobal)
41 , mWidth(100)
42 , mLines(3)
43 , mRegionAnchorX(0)
44 , mRegionAnchorY(100)
45 , mViewportAnchorX(0)
46 , mViewportAnchorY(100)
47 , mScroll(ScrollSetting::_empty)
51 void
52 TextTrackRegion::CopyValues(TextTrackRegion& aRegion)
54 mId = aRegion.Id();
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();
64 } //namespace dom
65 } //namespace mozilla