Backed out changeset 9d34172f942f

This commit is contained in:
Taras Glek 2009-03-18 10:20:50 -07:00
parent 4228bce5c8
commit e5518c5104
4 changed files with 4 additions and 68 deletions

View File

@ -46,7 +46,7 @@ class nsIRegion;
[ptr] native nsIRegion(nsIRegion);
[scriptable, uuid(4d179656-a5bd-42a6-a937-c81f820dcf2f)]
[scriptable, uuid(82d8f400-5bde-11d3-b033-b27a62766bbc)]
interface nsIScriptableRegion : nsISupports
{
void init ( ) ;
@ -187,13 +187,6 @@ interface nsIScriptableRegion : nsISupports
**/
void offset ( in long aXOffset, in long aYOffset ) ;
/**
* @return null if there are no rects,
* @return flat array of rects,ie [x1,y1,width1,height1,x2...].
* The result will contain bogus data if values don't fit in 31 bit
**/
void getRects();
/**
* does the region intersect the rectangle?
*

View File

@ -55,8 +55,6 @@ REQUIRES = xpcom \
view \
unicharutil \
thebes \
js \
xpconnect \
$(NULL)
DIRS = shared thebes

View File

@ -22,7 +22,6 @@
*
* Contributor(s):
* Patrick Beard
* Taras Glek
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -39,12 +38,10 @@
* ***** END LICENSE BLOCK ***** */
#include "nsScriptableRegion.h"
#include "nsIRegion.h"
#include "nsCOMPtr.h"
#include "nsIXPConnect.h"
#include "nsServiceManagerUtils.h"
#include "jsapi.h"
nsScriptableRegion::nsScriptableRegion(nsIRegion* region) : mRegion(nsnull), mRectSet(nsnull)
nsScriptableRegion::nsScriptableRegion(nsIRegion* region) : mRegion(nsnull)
{
mRegion = region;
NS_IF_ADDREF(mRegion);
@ -52,10 +49,7 @@ nsScriptableRegion::nsScriptableRegion(nsIRegion* region) : mRegion(nsnull), mRe
nsScriptableRegion::~nsScriptableRegion()
{
if (mRegion) {
mRegion->FreeRects(mRectSet);
NS_RELEASE(mRegion);
}
NS_IF_RELEASE(mRegion);
}
NS_IMPL_ISUPPORTS1(nsScriptableRegion, nsIScriptableRegion)
@ -155,50 +149,3 @@ NS_IMETHODIMP nsScriptableRegion::GetRegion(nsIRegion** outRgn)
NS_IF_ADDREF(*outRgn);
return NS_OK;
}
NS_IMETHODIMP nsScriptableRegion::GetRects() {
nsAXPCNativeCallContext *ncc = nsnull;
nsIXPConnect *xpConnect;
nsresult rv = CallGetService(nsIXPConnect::GetCID(), &xpConnect);
NS_ENSURE_SUCCESS(rv, rv);
rv = xpConnect->GetCurrentNativeCallContext(&ncc);
NS_ENSURE_SUCCESS(rv, rv);
if (!ncc)
return NS_ERROR_FAILURE;
jsval *retvalPtr;
ncc->GetRetValPtr(&retvalPtr);
rv = mRegion->GetRects(&mRectSet);
NS_ENSURE_SUCCESS(rv, rv);
if (!mRectSet->mNumRects) {
*retvalPtr = JSVAL_NULL;
ncc->SetReturnValueWasSet(PR_TRUE);
return NS_OK;
}
JSContext *cx = nsnull;
rv = ncc->GetJSContext(&cx);
NS_ENSURE_SUCCESS(rv, rv);
JSObject *destArray = JS_NewArrayObject(cx, mRectSet->mNumRects*4, NULL);
*retvalPtr = OBJECT_TO_JSVAL(destArray);
ncc->SetReturnValueWasSet(PR_TRUE);
for(PRUint32 i = 0; i < mRectSet->mNumRects; i++) {
nsRegionRect &rect = mRectSet->mRects[i];
int n = i*4;
// This will contain bogus data if values don't fit in 31 bit
JS_DefineElement(cx, destArray, n, INT_TO_JSVAL(rect.x), NULL, NULL, JSPROP_ENUMERATE);
JS_DefineElement(cx, destArray, n+1, INT_TO_JSVAL(rect.y), NULL, NULL, JSPROP_ENUMERATE);
JS_DefineElement(cx, destArray, n+2, INT_TO_JSVAL(rect.width), NULL, NULL, JSPROP_ENUMERATE);
JS_DefineElement(cx, destArray, n+3, INT_TO_JSVAL(rect.height), NULL, NULL, JSPROP_ENUMERATE);
}
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}

View File

@ -39,7 +39,6 @@
#include "nsIScriptableRegion.h"
#include "gfxCore.h"
#include "nsIRegion.h"
class nsIRegion;
@ -57,5 +56,4 @@ public:
private:
nsIRegion* mRegion;
nsRegionRectSet *mRectSet;
};