michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim:set ts=2 sw=2 et tw=78: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "mozilla/dom/TextTrackRegion.h" michael@0: #include "mozilla/dom/VTTRegionBinding.h" michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(TextTrackRegion, mParent) michael@0: NS_IMPL_CYCLE_COLLECTING_ADDREF(TextTrackRegion) michael@0: NS_IMPL_CYCLE_COLLECTING_RELEASE(TextTrackRegion) michael@0: NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TextTrackRegion) michael@0: NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY michael@0: NS_INTERFACE_MAP_ENTRY(nsISupports) michael@0: NS_INTERFACE_MAP_END michael@0: michael@0: JSObject* michael@0: TextTrackRegion::WrapObject(JSContext* aCx) michael@0: { michael@0: return VTTRegionBinding::Wrap(aCx, this); michael@0: } michael@0: michael@0: already_AddRefed michael@0: TextTrackRegion::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv) michael@0: { michael@0: nsCOMPtr window = do_QueryInterface(aGlobal.GetAsSupports()); michael@0: if (!window) { michael@0: aRv.Throw(NS_ERROR_FAILURE); michael@0: return nullptr; michael@0: } michael@0: michael@0: nsRefPtr region = new TextTrackRegion(aGlobal.GetAsSupports()); michael@0: return region.forget(); michael@0: } michael@0: michael@0: TextTrackRegion::TextTrackRegion(nsISupports* aGlobal) michael@0: : mParent(aGlobal) michael@0: , mWidth(100) michael@0: , mLines(3) michael@0: , mRegionAnchorX(0) michael@0: , mRegionAnchorY(100) michael@0: , mViewportAnchorX(0) michael@0: , mViewportAnchorY(100) michael@0: { michael@0: SetIsDOMBinding(); michael@0: } michael@0: michael@0: void michael@0: TextTrackRegion::CopyValues(TextTrackRegion& aRegion) michael@0: { michael@0: mWidth = aRegion.Width(); michael@0: mLines = aRegion.Lines(); michael@0: mRegionAnchorX = aRegion.RegionAnchorX(); michael@0: mRegionAnchorY = aRegion.RegionAnchorY(); michael@0: mViewportAnchorX = aRegion.ViewportAnchorX(); michael@0: mViewportAnchorY = aRegion.ViewportAnchorY(); michael@0: mScroll = aRegion.Scroll(); michael@0: } michael@0: michael@0: } //namespace dom michael@0: } //namespace mozilla michael@0: