Added nsIDOMNSRange method with InsertFragment method.
This commit is contained in:
Родитель
06c2bf3e7a
Коммит
348d5a1014
|
@ -41,3 +41,9 @@ interface Range {
|
|||
|
||||
DOMString toString();
|
||||
};
|
||||
|
||||
interface NSRange {
|
||||
/* IID: { 0xa6cf90f2, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } */
|
||||
void insertFragment(in DOMString fragment);
|
||||
};
|
||||
|
|
|
@ -17,5 +17,6 @@
|
|||
#
|
||||
|
||||
nsIDOMRange.h
|
||||
nsIDOMNSRange.h
|
||||
nsIDOMSelection.h
|
||||
nsIDOMSelectionListener.h
|
||||
|
|
|
@ -26,6 +26,7 @@ DEFINES += -D_IMPL_NS_DOM
|
|||
|
||||
EXPORTS = \
|
||||
nsIDOMRange.h \
|
||||
nsIDOMNSRange.h \
|
||||
nsIDOMSelection.h \
|
||||
nsIDOMSelectionListener.h \
|
||||
$(NULL)
|
||||
|
|
|
@ -20,8 +20,9 @@ IGNORE_MANIFEST=1
|
|||
|
||||
DEFINES=-D_IMPL_NS_DOM
|
||||
EXPORTS = \
|
||||
nsIDOMRange.h \
|
||||
nsIDOMSelection.h \
|
||||
nsIDOMRange.h \
|
||||
nsIDOMNSRange.h \
|
||||
nsIDOMSelection.h \
|
||||
nsIDOMSelectionListener.h \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMNSRange_h__
|
||||
#define nsIDOMNSRange_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
|
||||
#define NS_IDOMNSRANGE_IID \
|
||||
{ 0xa6cf90f2, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMNSRange : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMNSRANGE_IID; return iid; }
|
||||
|
||||
NS_IMETHOD InsertFragment(const nsString& aFragment)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMNSRANGE \
|
||||
NS_IMETHOD InsertFragment(const nsString& aFragment); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMNSRANGE(_to) \
|
||||
NS_IMETHOD InsertFragment(const nsString& aFragment) { return _to InsertFragment(aFragment); } \
|
||||
|
||||
|
||||
#endif // nsIDOMNSRange_h__
|
|
@ -27,6 +27,7 @@
|
|||
#include "nsIPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMNSRange.h"
|
||||
#include "nsIDOMDocumentFragment.h"
|
||||
#include "nsIDOMRange.h"
|
||||
|
||||
|
@ -35,10 +36,12 @@ static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
|
|||
static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID);
|
||||
static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID);
|
||||
static NS_DEFINE_IID(kINodeIID, NS_IDOMNODE_IID);
|
||||
static NS_DEFINE_IID(kINSRangeIID, NS_IDOMNSRANGE_IID);
|
||||
static NS_DEFINE_IID(kIDocumentFragmentIID, NS_IDOMDOCUMENTFRAGMENT_IID);
|
||||
static NS_DEFINE_IID(kIRangeIID, NS_IDOMRANGE_IID);
|
||||
|
||||
NS_DEF_PTR(nsIDOMNode);
|
||||
NS_DEF_PTR(nsIDOMNSRange);
|
||||
NS_DEF_PTR(nsIDOMDocumentFragment);
|
||||
NS_DEF_PTR(nsIDOMRange);
|
||||
|
||||
|
@ -897,6 +900,48 @@ RangeToString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval
|
|||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method InsertFragment
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
NSRangeInsertFragment(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMRange *privateThis = (nsIDOMRange*)JS_GetPrivate(cx, obj);
|
||||
nsIDOMNSRange *nativeThis = nsnull;
|
||||
if (NS_OK != privateThis->QueryInterface(kINSRangeIID, (void **)&nativeThis)) {
|
||||
JS_ReportError(cx, "Object must be of type NSRange");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsAutoString b0;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == nativeThis) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if (argc >= 1) {
|
||||
|
||||
nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]);
|
||||
|
||||
if (NS_OK != nativeThis->InsertFragment(b0)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
*rval = JSVAL_VOID;
|
||||
}
|
||||
else {
|
||||
JS_ReportError(cx, "Function insertFragment requires 1 parameters");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// class for Range
|
||||
|
@ -952,6 +997,7 @@ static JSFunctionSpec RangeMethods[] =
|
|||
{"surroundContents", RangeSurroundContents, 1},
|
||||
{"clone", RangeClone, 0},
|
||||
{"toString", RangeToString, 0},
|
||||
{"insertFragment", NSRangeInsertFragment, 1},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче