mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
9c5965b035
The bulk of this commit was generated with a script, executed at the top level of a typical source code checkout. The only non-machine-generated part was modifying MFBT's moz.build to reflect the new naming. CLOSED TREE makes big refactorings like this a piece of cake. # The main substitution. find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \ xargs perl -p -i -e ' s/nsRefPtr\.h/RefPtr\.h/g; # handle includes s/nsRefPtr ?</RefPtr</g; # handle declarations and variables ' # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h. perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h # Handle nsRefPtr.h itself, a couple places that define constructors # from nsRefPtr, and code generators specially. We do this here, rather # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename # things like nsRefPtrHashtable. perl -p -i -e 's/nsRefPtr/RefPtr/g' \ mfbt/nsRefPtr.h \ xpcom/glue/nsCOMPtr.h \ xpcom/base/OwningNonNull.h \ ipc/ipdl/ipdl/lower.py \ ipc/ipdl/ipdl/builtin.py \ dom/bindings/Codegen.py \ python/lldbutils/lldbutils/utils.py # In our indiscriminate substitution above, we renamed # nsRefPtrGetterAddRefs, the class behind getter_AddRefs. Fix that up. find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \ xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g' if [ -d .git ]; then git mv mfbt/nsRefPtr.h mfbt/RefPtr.h else hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h fi
90 lines
2.9 KiB
C++
90 lines
2.9 KiB
C++
/* 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 "DOMCameraDetectedFace.h"
|
|
#include "Navigator.h"
|
|
|
|
using namespace mozilla;
|
|
using namespace mozilla::dom;
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DOMCameraDetectedFace, mParent,
|
|
mBounds, mLeftEye, mRightEye, mMouth)
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMCameraDetectedFace)
|
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMCameraDetectedFace)
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMCameraDetectedFace)
|
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
|
NS_INTERFACE_MAP_END
|
|
|
|
/* static */
|
|
bool
|
|
DOMCameraDetectedFace::HasSupport(JSContext* aCx, JSObject* aGlobal)
|
|
{
|
|
return Navigator::HasCameraSupport(aCx, aGlobal);
|
|
}
|
|
|
|
JSObject*
|
|
DOMCameraDetectedFace::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
|
{
|
|
return CameraDetectedFaceBinding::Wrap(aCx, this, aGivenProto);
|
|
}
|
|
|
|
/* static */
|
|
already_AddRefed<DOMCameraDetectedFace>
|
|
DOMCameraDetectedFace::Constructor(const GlobalObject& aGlobal,
|
|
const dom::CameraDetectedFaceInit& aFace,
|
|
ErrorResult& aRv)
|
|
{
|
|
RefPtr<DOMCameraDetectedFace> face =
|
|
new DOMCameraDetectedFace(aGlobal.GetAsSupports(), aFace);
|
|
return face.forget();
|
|
}
|
|
|
|
DOMCameraDetectedFace::DOMCameraDetectedFace(nsISupports* aParent,
|
|
const dom::CameraDetectedFaceInit& aFace)
|
|
: mParent(aParent)
|
|
, mId(aFace.mId)
|
|
, mScore(aFace.mScore)
|
|
, mBounds(new DOMRect(this))
|
|
{
|
|
mBounds->SetRect(aFace.mBounds.mLeft,
|
|
aFace.mBounds.mTop,
|
|
aFace.mBounds.mRight - aFace.mBounds.mLeft,
|
|
aFace.mBounds.mBottom - aFace.mBounds.mTop);
|
|
|
|
if (aFace.mHasLeftEye) {
|
|
mLeftEye = new DOMPoint(this, aFace.mLeftEye.mX, aFace.mLeftEye.mY);
|
|
}
|
|
if (aFace.mHasRightEye) {
|
|
mRightEye = new DOMPoint(this, aFace.mRightEye.mX, aFace.mRightEye.mY);
|
|
}
|
|
if (aFace.mHasMouth) {
|
|
mMouth = new DOMPoint(this, aFace.mMouth.mX, aFace.mMouth.mY);
|
|
}
|
|
}
|
|
|
|
DOMCameraDetectedFace::DOMCameraDetectedFace(nsISupports* aParent,
|
|
const ICameraControl::Face& aFace)
|
|
: mParent(aParent)
|
|
, mId(aFace.id)
|
|
, mScore(aFace.score)
|
|
, mBounds(new DOMRect(this))
|
|
{
|
|
mBounds->SetRect(aFace.bound.left,
|
|
aFace.bound.top,
|
|
aFace.bound.right - aFace.bound.left,
|
|
aFace.bound.bottom - aFace.bound.top);
|
|
|
|
if (aFace.hasLeftEye) {
|
|
mLeftEye = new DOMPoint(this, aFace.leftEye.x, aFace.leftEye.y);
|
|
}
|
|
if (aFace.hasRightEye) {
|
|
mRightEye = new DOMPoint(this, aFace.rightEye.x, aFace.rightEye.y);
|
|
}
|
|
if (aFace.hasMouth) {
|
|
mMouth = new DOMPoint(this, aFace.mouth.x, aFace.mouth.y);
|
|
}
|
|
}
|