2013-09-14 03:44:33 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim:set ts=2 sw=2 et tw=78: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "mozilla/dom/TextTrackRegion.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2014-04-29 12:57:00 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(TextTrackRegion, mParent)
|
2013-09-14 03:44:33 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(TextTrackRegion)
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(TextTrackRegion)
|
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TextTrackRegion)
|
|
|
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 17:13:33 +03:00
|
|
|
JSObject* TextTrackRegion::WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) {
|
2018-06-26 00:20:54 +03:00
|
|
|
return VTTRegion_Binding::Wrap(aCx, this, aGivenProto);
|
2013-09-14 03:44:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<TextTrackRegion> TextTrackRegion::Constructor(
|
|
|
|
const GlobalObject& aGlobal, ErrorResult& aRv) {
|
2016-01-30 20:05:36 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindowInner> window =
|
|
|
|
do_QueryInterface(aGlobal.GetAsSupports());
|
2013-09-14 03:44:33 +04:00
|
|
|
if (!window) {
|
|
|
|
aRv.Throw(NS_ERROR_FAILURE);
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<TextTrackRegion> region = new TextTrackRegion(aGlobal.GetAsSupports());
|
2013-09-14 03:44:33 +04:00
|
|
|
return region.forget();
|
|
|
|
}
|
|
|
|
|
|
|
|
TextTrackRegion::TextTrackRegion(nsISupports* aGlobal)
|
|
|
|
: mParent(aGlobal),
|
|
|
|
mWidth(100),
|
|
|
|
mLines(3),
|
|
|
|
mRegionAnchorX(0),
|
|
|
|
mRegionAnchorY(100),
|
|
|
|
mViewportAnchorX(0),
|
|
|
|
mViewportAnchorY(100),
|
2017-11-22 11:10:11 +03:00
|
|
|
mScroll(ScrollSetting::_empty) {}
|
2018-11-19 16:25:37 +03:00
|
|
|
|
2013-09-14 03:44:33 +04:00
|
|
|
void TextTrackRegion::CopyValues(TextTrackRegion& aRegion) {
|
2017-11-06 06:18:55 +03:00
|
|
|
mId = aRegion.Id();
|
2013-09-14 03:44:33 +04:00
|
|
|
mWidth = aRegion.Width();
|
|
|
|
mLines = aRegion.Lines();
|
|
|
|
mRegionAnchorX = aRegion.RegionAnchorX();
|
|
|
|
mRegionAnchorY = aRegion.RegionAnchorY();
|
|
|
|
mViewportAnchorX = aRegion.ViewportAnchorX();
|
|
|
|
mViewportAnchorY = aRegion.ViewportAnchorY();
|
|
|
|
mScroll = aRegion.Scroll();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|