mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 07:48:38 +09:00
Issue #2241 - Part 7.2: Implement .fromRect and .fromQuad.
Backported from Mozilla bug 1558101.
This commit is contained in:
parent
0e2f687f4d
commit
4ec35fdcf2
6 changed files with 68 additions and 4 deletions
|
|
@ -43,6 +43,32 @@ DOMQuad::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
|||
return DOMQuadBinding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
already_AddRefed<DOMQuad>
|
||||
DOMQuad::FromRect(const GlobalObject& aGlobal, const DOMRectInit& aInit)
|
||||
{
|
||||
nsISupports* parent = aGlobal.GetAsSupports();
|
||||
RefPtr<DOMQuad> obj = new DOMQuad(parent);
|
||||
obj->mPoints[0] = new DOMPoint(parent, aInit.mX, aInit.mY, 0, 1);
|
||||
obj->mPoints[1] =
|
||||
new DOMPoint(parent, aInit.mX + aInit.mWidth, aInit.mY, 0, 1);
|
||||
obj->mPoints[2] = new DOMPoint(parent, aInit.mX + aInit.mWidth,
|
||||
aInit.mY + aInit.mHeight, 0, 1);
|
||||
obj->mPoints[3] =
|
||||
new DOMPoint(parent, aInit.mX, aInit.mY + aInit.mHeight, 0, 1);
|
||||
return obj.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<DOMQuad>
|
||||
DOMQuad::FromQuad(const GlobalObject& aGlobal, const DOMQuadInit& aInit)
|
||||
{
|
||||
RefPtr<DOMQuad> obj = new DOMQuad(aGlobal.GetAsSupports());
|
||||
obj->mPoints[0] = DOMPoint::FromPoint(aGlobal, aInit.mP1);
|
||||
obj->mPoints[1] = DOMPoint::FromPoint(aGlobal, aInit.mP2);
|
||||
obj->mPoints[2] = DOMPoint::FromPoint(aGlobal, aInit.mP3);
|
||||
obj->mPoints[3] = DOMPoint::FromPoint(aGlobal, aInit.mP4);
|
||||
return obj.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<DOMQuad>
|
||||
DOMQuad::Constructor(const GlobalObject& aGlobal,
|
||||
const DOMPointInit& aP1,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue