Update Range spec
This commit is contained in:
Родитель
fc4a53c3e3
Коммит
cbf9d5a5e9
|
@ -38,47 +38,42 @@ public:
|
|||
nsRange();
|
||||
virtual ~nsRange();
|
||||
|
||||
// IsPositioned attribute disappeared from the dom spec
|
||||
NS_IMETHOD GetIsPositioned(PRBool* aIsPositioned);
|
||||
NS_IMETHOD SetIsPositioned(PRBool aIsPositioned);
|
||||
|
||||
NS_IMETHOD GetStartParent(nsIDOMNode** aStartParent);
|
||||
NS_IMETHOD SetStartParent(nsIDOMNode* aStartParent);
|
||||
|
||||
NS_IMETHOD GetStartOffset(PRInt32* aStartOffset);
|
||||
NS_IMETHOD SetStartOffset(PRInt32 aStartOffset);
|
||||
|
||||
NS_IMETHOD GetEndParent(nsIDOMNode** aEndParent);
|
||||
NS_IMETHOD SetEndParent(nsIDOMNode* aEndParent);
|
||||
|
||||
NS_IMETHOD GetEndOffset(PRInt32* aEndOffset);
|
||||
NS_IMETHOD SetEndOffset(PRInt32 aEndOffset);
|
||||
|
||||
NS_IMETHOD GetIsCollapsed(PRBool* aIsCollapsed);
|
||||
NS_IMETHOD SetIsCollapsed(PRBool aIsCollapsed);
|
||||
|
||||
NS_IMETHOD GetCommonParent(nsIDOMNode** aCommonParent);
|
||||
NS_IMETHOD SetCommonParent(nsIDOMNode* aCommonParent);
|
||||
|
||||
NS_IMETHOD SetStart(nsIDOMNode* aParent, PRInt32 aOffset);
|
||||
NS_IMETHOD SetStartBefore(nsIDOMNode* sibling);
|
||||
NS_IMETHOD SetStartAfter(nsIDOMNode* sibling);
|
||||
|
||||
NS_IMETHOD SetEnd(nsIDOMNode* aParent, PRInt32 aOffset);
|
||||
NS_IMETHOD SetEndBefore(nsIDOMNode* sibling);
|
||||
NS_IMETHOD SetEndAfter(nsIDOMNode* sibling);
|
||||
|
||||
NS_IMETHOD Collapse(PRBool aToStart);
|
||||
|
||||
NS_IMETHOD Unposition();
|
||||
|
||||
NS_IMETHOD SelectNode(nsIDOMNode* aN);
|
||||
|
||||
NS_IMETHOD SelectNodeContents(nsIDOMNode* aN);
|
||||
|
||||
NS_IMETHOD CompareEndPoints(PRUint16 how, nsIDOMRange* srcRange, PRInt32* ret);
|
||||
|
||||
NS_IMETHOD DeleteContents();
|
||||
|
||||
NS_IMETHOD ExtractContents(nsIDOMDocumentFragment** aReturn);
|
||||
|
||||
NS_IMETHOD CopyContents(nsIDOMDocumentFragment** aReturn);
|
||||
NS_IMETHOD CloneContents(nsIDOMDocumentFragment** aReturn);
|
||||
|
||||
NS_IMETHOD InsertNode(nsIDOMNode* aN);
|
||||
|
||||
NS_IMETHOD SurroundContents(nsIDOMNode* aN);
|
||||
|
||||
NS_IMETHOD Clone(nsIDOMRange** aReturn);
|
||||
|
@ -727,6 +722,16 @@ nsresult nsRange::SetStart(nsIDOMNode* aParent, PRInt32 aOffset)
|
|||
return res;
|
||||
}
|
||||
|
||||
nsresult nsRange::SetStartBefore(nsIDOMNode* sibling)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult nsRange::SetStartAfter(nsIDOMNode* sibling)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult nsRange::SetEnd(nsIDOMNode* aParent, PRInt32 aOffset)
|
||||
{
|
||||
nsresult res;
|
||||
|
@ -750,6 +755,16 @@ nsresult nsRange::SetEnd(nsIDOMNode* aParent, PRInt32 aOffset)
|
|||
return res;
|
||||
}
|
||||
|
||||
nsresult nsRange::SetEndBefore(nsIDOMNode* sibling)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult nsRange::SetEndAfter(nsIDOMNode* sibling)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult nsRange::Collapse(PRBool aToStart)
|
||||
{
|
||||
if (!mIsPositioned)
|
||||
|
@ -879,10 +894,40 @@ nsresult nsRange::DeleteContents()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsRange::ExtractContents(nsIDOMDocumentFragment** aReturn)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
nsresult nsRange::CompareEndPoints(PRUint16 how, nsIDOMRange* srcRange, PRInt32* ret)
|
||||
{
|
||||
if (ret == 0)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (srcRange == 0)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
nsresult nsRange::CopyContents(nsIDOMDocumentFragment** aReturn)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
#if 0
|
||||
switch (how)
|
||||
{
|
||||
case nsIDOMRange::START_TO_START:
|
||||
case nsIDOMRange::START_TO_END:
|
||||
case nsIDOMRange::END_TO_START:
|
||||
case nsIDOMRange::END_TO_END:
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
default: // shouldn't get here
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult nsRange::ExtractContents(nsIDOMDocumentFragment** aReturn)
|
||||
{
|
||||
nsresult res = CloneContents(aReturn);
|
||||
if (!NS_SUCCEEDED(res))
|
||||
return res;
|
||||
res = DeleteContents();
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsRange::CloneContents(nsIDOMDocumentFragment** aReturn)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
nsresult nsRange::InsertNode(nsIDOMNode* aN)
|
||||
|
@ -897,29 +942,3 @@ nsresult nsRange::Clone(nsIDOMRange** aReturn)
|
|||
nsresult nsRange::ToString(nsString& aReturn)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
//
|
||||
// We don't actually want to allow setting this ...
|
||||
// These are all read only attributes that the idl
|
||||
// is generating setters for
|
||||
//
|
||||
nsresult nsRange::SetIsPositioned(PRBool aIsPositioned)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
nsresult nsRange::SetStartParent(nsIDOMNode* aNode)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
nsresult nsRange::SetStartOffset(PRInt32 aOffset)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
nsresult nsRange::SetEndParent(nsIDOMNode* aNode)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
nsresult nsRange::SetEndOffset(PRInt32 aOffset)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
nsresult nsRange::SetIsCollapsed(PRBool aIsCollapsed)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
nsresult nsRange::SetCommonParent(nsIDOMNode* aCommonParent)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
|
|
|
@ -34,45 +34,50 @@ class nsIDOMRange;
|
|||
|
||||
class nsIDOMRange : public nsISupports {
|
||||
public:
|
||||
|
||||
NS_IMETHOD GetIsPositioned(PRBool* aIsPositioned)=0;
|
||||
NS_IMETHOD SetIsPositioned(PRBool aIsPositioned)=0;
|
||||
enum {
|
||||
START_TO_START = 0,
|
||||
START_TO_END = 1,
|
||||
END_TO_START = 2,
|
||||
END_TO_END = 3
|
||||
};
|
||||
|
||||
NS_IMETHOD GetStartParent(nsIDOMNode** aStartParent)=0;
|
||||
NS_IMETHOD SetStartParent(nsIDOMNode* aStartParent)=0;
|
||||
|
||||
NS_IMETHOD GetStartOffset(PRInt32* aStartOffset)=0;
|
||||
NS_IMETHOD SetStartOffset(PRInt32 aStartOffset)=0;
|
||||
|
||||
NS_IMETHOD GetEndParent(nsIDOMNode** aEndParent)=0;
|
||||
NS_IMETHOD SetEndParent(nsIDOMNode* aEndParent)=0;
|
||||
|
||||
NS_IMETHOD GetEndOffset(PRInt32* aEndOffset)=0;
|
||||
NS_IMETHOD SetEndOffset(PRInt32 aEndOffset)=0;
|
||||
|
||||
NS_IMETHOD GetIsCollapsed(PRBool* aIsCollapsed)=0;
|
||||
NS_IMETHOD SetIsCollapsed(PRBool aIsCollapsed)=0;
|
||||
|
||||
NS_IMETHOD GetCommonParent(nsIDOMNode** aCommonParent)=0;
|
||||
NS_IMETHOD SetCommonParent(nsIDOMNode* aCommonParent)=0;
|
||||
|
||||
NS_IMETHOD SetStart(nsIDOMNode* aParent, PRInt32 aOffset)=0;
|
||||
|
||||
NS_IMETHOD SetStartBefore(nsIDOMNode* aSibling)=0;
|
||||
|
||||
NS_IMETHOD SetStartAfter(nsIDOMNode* aSibling)=0;
|
||||
|
||||
NS_IMETHOD SetEnd(nsIDOMNode* aParent, PRInt32 aOffset)=0;
|
||||
|
||||
NS_IMETHOD Collapse(PRBool aToStart)=0;
|
||||
NS_IMETHOD SetEndBefore(nsIDOMNode* aSibling)=0;
|
||||
|
||||
NS_IMETHOD Unposition()=0;
|
||||
NS_IMETHOD SetEndAfter(nsIDOMNode* aSibling)=0;
|
||||
|
||||
NS_IMETHOD Collapse(PRBool aToStart)=0;
|
||||
|
||||
NS_IMETHOD SelectNode(nsIDOMNode* aN)=0;
|
||||
|
||||
NS_IMETHOD SelectNodeContents(nsIDOMNode* aN)=0;
|
||||
|
||||
NS_IMETHOD CompareEndPoints(PRUint16 aHow, nsIDOMRange* aSrcRange, PRInt32* aReturn)=0;
|
||||
|
||||
NS_IMETHOD DeleteContents()=0;
|
||||
|
||||
NS_IMETHOD ExtractContents(nsIDOMDocumentFragment** aReturn)=0;
|
||||
|
||||
NS_IMETHOD CopyContents(nsIDOMDocumentFragment** aReturn)=0;
|
||||
NS_IMETHOD CloneContents(nsIDOMDocumentFragment** aReturn)=0;
|
||||
|
||||
NS_IMETHOD InsertNode(nsIDOMNode* aN)=0;
|
||||
|
||||
|
@ -85,29 +90,25 @@ public:
|
|||
|
||||
|
||||
#define NS_DECL_IDOMRANGE \
|
||||
NS_IMETHOD GetIsPositioned(PRBool* aIsPositioned); \
|
||||
NS_IMETHOD SetIsPositioned(PRBool aIsPositioned); \
|
||||
NS_IMETHOD GetStartParent(nsIDOMNode** aStartParent); \
|
||||
NS_IMETHOD SetStartParent(nsIDOMNode* aStartParent); \
|
||||
NS_IMETHOD GetStartOffset(PRInt32* aStartOffset); \
|
||||
NS_IMETHOD SetStartOffset(PRInt32 aStartOffset); \
|
||||
NS_IMETHOD GetEndParent(nsIDOMNode** aEndParent); \
|
||||
NS_IMETHOD SetEndParent(nsIDOMNode* aEndParent); \
|
||||
NS_IMETHOD GetEndOffset(PRInt32* aEndOffset); \
|
||||
NS_IMETHOD SetEndOffset(PRInt32 aEndOffset); \
|
||||
NS_IMETHOD GetIsCollapsed(PRBool* aIsCollapsed); \
|
||||
NS_IMETHOD SetIsCollapsed(PRBool aIsCollapsed); \
|
||||
NS_IMETHOD GetCommonParent(nsIDOMNode** aCommonParent); \
|
||||
NS_IMETHOD SetCommonParent(nsIDOMNode* aCommonParent); \
|
||||
NS_IMETHOD SetStart(nsIDOMNode* aParent, PRInt32 aOffset); \
|
||||
NS_IMETHOD SetStartBefore(nsIDOMNode* aSibling); \
|
||||
NS_IMETHOD SetStartAfter(nsIDOMNode* aSibling); \
|
||||
NS_IMETHOD SetEnd(nsIDOMNode* aParent, PRInt32 aOffset); \
|
||||
NS_IMETHOD SetEndBefore(nsIDOMNode* aSibling); \
|
||||
NS_IMETHOD SetEndAfter(nsIDOMNode* aSibling); \
|
||||
NS_IMETHOD Collapse(PRBool aToStart); \
|
||||
NS_IMETHOD Unposition(); \
|
||||
NS_IMETHOD SelectNode(nsIDOMNode* aN); \
|
||||
NS_IMETHOD SelectNodeContents(nsIDOMNode* aN); \
|
||||
NS_IMETHOD CompareEndPoints(PRUint16 aHow, nsIDOMRange* aSrcRange, PRInt32* aReturn); \
|
||||
NS_IMETHOD DeleteContents(); \
|
||||
NS_IMETHOD ExtractContents(nsIDOMDocumentFragment** aReturn); \
|
||||
NS_IMETHOD CopyContents(nsIDOMDocumentFragment** aReturn); \
|
||||
NS_IMETHOD CloneContents(nsIDOMDocumentFragment** aReturn); \
|
||||
NS_IMETHOD InsertNode(nsIDOMNode* aN); \
|
||||
NS_IMETHOD SurroundContents(nsIDOMNode* aN); \
|
||||
NS_IMETHOD Clone(nsIDOMRange** aReturn); \
|
||||
|
@ -116,29 +117,25 @@ public:
|
|||
|
||||
|
||||
#define NS_FORWARD_IDOMRANGE(_to) \
|
||||
NS_IMETHOD GetIsPositioned(PRBool* aIsPositioned) { return _to##GetIsPositioned(aIsPositioned); } \
|
||||
NS_IMETHOD SetIsPositioned(PRBool aIsPositioned) { return _to##SetIsPositioned(aIsPositioned); } \
|
||||
NS_IMETHOD GetStartParent(nsIDOMNode** aStartParent) { return _to##GetStartParent(aStartParent); } \
|
||||
NS_IMETHOD SetStartParent(nsIDOMNode* aStartParent) { return _to##SetStartParent(aStartParent); } \
|
||||
NS_IMETHOD GetStartOffset(PRInt32* aStartOffset) { return _to##GetStartOffset(aStartOffset); } \
|
||||
NS_IMETHOD SetStartOffset(PRInt32 aStartOffset) { return _to##SetStartOffset(aStartOffset); } \
|
||||
NS_IMETHOD GetEndParent(nsIDOMNode** aEndParent) { return _to##GetEndParent(aEndParent); } \
|
||||
NS_IMETHOD SetEndParent(nsIDOMNode* aEndParent) { return _to##SetEndParent(aEndParent); } \
|
||||
NS_IMETHOD GetEndOffset(PRInt32* aEndOffset) { return _to##GetEndOffset(aEndOffset); } \
|
||||
NS_IMETHOD SetEndOffset(PRInt32 aEndOffset) { return _to##SetEndOffset(aEndOffset); } \
|
||||
NS_IMETHOD GetIsCollapsed(PRBool* aIsCollapsed) { return _to##GetIsCollapsed(aIsCollapsed); } \
|
||||
NS_IMETHOD SetIsCollapsed(PRBool aIsCollapsed) { return _to##SetIsCollapsed(aIsCollapsed); } \
|
||||
NS_IMETHOD GetCommonParent(nsIDOMNode** aCommonParent) { return _to##GetCommonParent(aCommonParent); } \
|
||||
NS_IMETHOD SetCommonParent(nsIDOMNode* aCommonParent) { return _to##SetCommonParent(aCommonParent); } \
|
||||
NS_IMETHOD SetStart(nsIDOMNode* aParent, PRInt32 aOffset) { return _to##SetStart(aParent, aOffset); } \
|
||||
NS_IMETHOD SetStartBefore(nsIDOMNode* aSibling) { return _to##SetStartBefore(aSibling); } \
|
||||
NS_IMETHOD SetStartAfter(nsIDOMNode* aSibling) { return _to##SetStartAfter(aSibling); } \
|
||||
NS_IMETHOD SetEnd(nsIDOMNode* aParent, PRInt32 aOffset) { return _to##SetEnd(aParent, aOffset); } \
|
||||
NS_IMETHOD SetEndBefore(nsIDOMNode* aSibling) { return _to##SetEndBefore(aSibling); } \
|
||||
NS_IMETHOD SetEndAfter(nsIDOMNode* aSibling) { return _to##SetEndAfter(aSibling); } \
|
||||
NS_IMETHOD Collapse(PRBool aToStart) { return _to##Collapse(aToStart); } \
|
||||
NS_IMETHOD Unposition() { return _to##Unposition(); } \
|
||||
NS_IMETHOD SelectNode(nsIDOMNode* aN) { return _to##SelectNode(aN); } \
|
||||
NS_IMETHOD SelectNodeContents(nsIDOMNode* aN) { return _to##SelectNodeContents(aN); } \
|
||||
NS_IMETHOD CompareEndPoints(PRUint16 aHow, nsIDOMRange* aSrcRange, PRInt32* aReturn) { return _to##CompareEndPoints(aHow, aSrcRange, aReturn); } \
|
||||
NS_IMETHOD DeleteContents() { return _to##DeleteContents(); } \
|
||||
NS_IMETHOD ExtractContents(nsIDOMDocumentFragment** aReturn) { return _to##ExtractContents(aReturn); } \
|
||||
NS_IMETHOD CopyContents(nsIDOMDocumentFragment** aReturn) { return _to##CopyContents(aReturn); } \
|
||||
NS_IMETHOD CloneContents(nsIDOMDocumentFragment** aReturn) { return _to##CloneContents(aReturn); } \
|
||||
NS_IMETHOD InsertNode(nsIDOMNode* aN) { return _to##InsertNode(aN); } \
|
||||
NS_IMETHOD SurroundContents(nsIDOMNode* aN) { return _to##SurroundContents(aN); } \
|
||||
NS_IMETHOD Clone(nsIDOMRange** aReturn) { return _to##Clone(aReturn); } \
|
||||
|
|
|
@ -2,35 +2,42 @@ interface Range {
|
|||
/* IID: { 0xa6cf90ce, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } */
|
||||
|
||||
attribute boolean isPositioned;
|
||||
const unsigned short START_TO_START = 0;
|
||||
const unsigned short START_TO_END = 1;
|
||||
const unsigned short END_TO_START = 2;
|
||||
const unsigned short END_TO_END = 3;
|
||||
|
||||
attribute Node startParent;
|
||||
attribute long startOffset;
|
||||
attribute Node endParent;
|
||||
attribute long endOffset;
|
||||
readonly attribute Node startParent;
|
||||
readonly attribute long startOffset;
|
||||
readonly attribute Node endParent;
|
||||
readonly attribute long endOffset;
|
||||
|
||||
void setStart(in Node parent, in long offset);
|
||||
void setEnd(in Node parent, in long offset);
|
||||
readonly attribute boolean isCollapsed;
|
||||
readonly attribute Node commonParent;
|
||||
|
||||
void collapse(in boolean toStart);
|
||||
attribute boolean isCollapsed;
|
||||
void setStart(in Node parent, in long offset);
|
||||
void setStartBefore(in Node sibling);
|
||||
void setStartAfter(in Node sibling);
|
||||
void setEnd(in Node parent, in long offset);
|
||||
void setEndBefore(in Node sibling);
|
||||
void setEndAfter(in Node sibling);
|
||||
|
||||
void unposition();
|
||||
void collapse(in boolean toStart);
|
||||
|
||||
void selectNode(in Node n);
|
||||
void selectNodeContents(in Node n);
|
||||
void selectNode(in Node n);
|
||||
void selectNodeContents(in Node n);
|
||||
|
||||
void deleteContents();
|
||||
int compareEndPoints(in unsigned short how, in Range srcRange);
|
||||
|
||||
DocumentFragment extractContents();
|
||||
DocumentFragment copyContents();
|
||||
void deleteContents();
|
||||
|
||||
void insertNode(in Node n);
|
||||
void surroundContents(in Node n);
|
||||
DocumentFragment extractContents();
|
||||
DocumentFragment cloneContents();
|
||||
|
||||
Range clone();
|
||||
void insertNode(in Node n);
|
||||
void surroundContents(in Node n);
|
||||
|
||||
attribute Node commonParent;
|
||||
Range clone();
|
||||
|
||||
DOMString toString();
|
||||
DOMString toString();
|
||||
};
|
||||
|
|
|
@ -46,13 +46,12 @@ NS_DEF_PTR(nsIDOMRange);
|
|||
// Range property ids
|
||||
//
|
||||
enum Range_slots {
|
||||
RANGE_ISPOSITIONED = -1,
|
||||
RANGE_STARTPARENT = -2,
|
||||
RANGE_STARTOFFSET = -3,
|
||||
RANGE_ENDPARENT = -4,
|
||||
RANGE_ENDOFFSET = -5,
|
||||
RANGE_ISCOLLAPSED = -6,
|
||||
RANGE_COMMONPARENT = -7
|
||||
RANGE_STARTPARENT = -1,
|
||||
RANGE_STARTOFFSET = -2,
|
||||
RANGE_ENDPARENT = -3,
|
||||
RANGE_ENDOFFSET = -4,
|
||||
RANGE_ISCOLLAPSED = -5,
|
||||
RANGE_COMMONPARENT = -6
|
||||
};
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -71,17 +70,6 @@ GetRangeProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case RANGE_ISPOSITIONED:
|
||||
{
|
||||
PRBool prop;
|
||||
if (NS_OK == a->GetIsPositioned(&prop)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return JS_FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RANGE_STARTPARENT:
|
||||
{
|
||||
nsIDOMNode* prop;
|
||||
|
@ -178,99 +166,7 @@ SetRangeProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case RANGE_ISPOSITIONED:
|
||||
{
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
a->SetIsPositioned(prop);
|
||||
|
||||
break;
|
||||
}
|
||||
case RANGE_STARTPARENT:
|
||||
{
|
||||
nsIDOMNode* prop;
|
||||
if (PR_FALSE == nsConvertJSValToObject((nsISupports **)&prop,
|
||||
kINodeIID, "Node",
|
||||
cx, *vp)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
a->SetStartParent(prop);
|
||||
NS_IF_RELEASE(prop);
|
||||
break;
|
||||
}
|
||||
case RANGE_STARTOFFSET:
|
||||
{
|
||||
PRInt32 prop;
|
||||
int32 temp;
|
||||
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
||||
prop = (PRInt32)temp;
|
||||
}
|
||||
else {
|
||||
JS_ReportError(cx, "Parameter must be a number");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
a->SetStartOffset(prop);
|
||||
|
||||
break;
|
||||
}
|
||||
case RANGE_ENDPARENT:
|
||||
{
|
||||
nsIDOMNode* prop;
|
||||
if (PR_FALSE == nsConvertJSValToObject((nsISupports **)&prop,
|
||||
kINodeIID, "Node",
|
||||
cx, *vp)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
a->SetEndParent(prop);
|
||||
NS_IF_RELEASE(prop);
|
||||
break;
|
||||
}
|
||||
case RANGE_ENDOFFSET:
|
||||
{
|
||||
PRInt32 prop;
|
||||
int32 temp;
|
||||
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
||||
prop = (PRInt32)temp;
|
||||
}
|
||||
else {
|
||||
JS_ReportError(cx, "Parameter must be a number");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
a->SetEndOffset(prop);
|
||||
|
||||
break;
|
||||
}
|
||||
case RANGE_ISCOLLAPSED:
|
||||
{
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
a->SetIsCollapsed(prop);
|
||||
|
||||
break;
|
||||
}
|
||||
case RANGE_COMMONPARENT:
|
||||
{
|
||||
nsIDOMNode* prop;
|
||||
if (PR_FALSE == nsConvertJSValToObject((nsISupports **)&prop,
|
||||
kINodeIID, "Node",
|
||||
cx, *vp)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
a->SetCommonParent(prop);
|
||||
NS_IF_RELEASE(prop);
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
default:
|
||||
return nsCallJSScriptObjectSetProperty(a, cx, id, vp);
|
||||
}
|
||||
|
@ -361,6 +257,90 @@ RangeSetStart(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval
|
|||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method SetStartBefore
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
RangeSetStartBefore(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMRange *nativeThis = (nsIDOMRange*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsIDOMNodePtr 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) {
|
||||
|
||||
if (JS_FALSE == nsConvertJSValToObject((nsISupports **)&b0,
|
||||
kINodeIID,
|
||||
"Node",
|
||||
cx,
|
||||
argv[0])) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
if (NS_OK != nativeThis->SetStartBefore(b0)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
*rval = JSVAL_VOID;
|
||||
}
|
||||
else {
|
||||
JS_ReportError(cx, "Function setStartBefore requires 1 parameters");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method SetStartAfter
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
RangeSetStartAfter(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMRange *nativeThis = (nsIDOMRange*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsIDOMNodePtr 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) {
|
||||
|
||||
if (JS_FALSE == nsConvertJSValToObject((nsISupports **)&b0,
|
||||
kINodeIID,
|
||||
"Node",
|
||||
cx,
|
||||
argv[0])) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
if (NS_OK != nativeThis->SetStartAfter(b0)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
*rval = JSVAL_VOID;
|
||||
}
|
||||
else {
|
||||
JS_ReportError(cx, "Function setStartAfter requires 1 parameters");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method SetEnd
|
||||
//
|
||||
|
@ -409,6 +389,90 @@ RangeSetEnd(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method SetEndBefore
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
RangeSetEndBefore(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMRange *nativeThis = (nsIDOMRange*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsIDOMNodePtr 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) {
|
||||
|
||||
if (JS_FALSE == nsConvertJSValToObject((nsISupports **)&b0,
|
||||
kINodeIID,
|
||||
"Node",
|
||||
cx,
|
||||
argv[0])) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
if (NS_OK != nativeThis->SetEndBefore(b0)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
*rval = JSVAL_VOID;
|
||||
}
|
||||
else {
|
||||
JS_ReportError(cx, "Function setEndBefore requires 1 parameters");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method SetEndAfter
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
RangeSetEndAfter(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMRange *nativeThis = (nsIDOMRange*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsIDOMNodePtr 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) {
|
||||
|
||||
if (JS_FALSE == nsConvertJSValToObject((nsISupports **)&b0,
|
||||
kINodeIID,
|
||||
"Node",
|
||||
cx,
|
||||
argv[0])) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
if (NS_OK != nativeThis->SetEndAfter(b0)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
*rval = JSVAL_VOID;
|
||||
}
|
||||
else {
|
||||
JS_ReportError(cx, "Function setEndAfter requires 1 parameters");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method Collapse
|
||||
//
|
||||
|
@ -447,39 +511,6 @@ RangeCollapse(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval
|
|||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method Unposition
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
RangeUnposition(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMRange *nativeThis = (nsIDOMRange*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == nativeThis) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if (argc >= 0) {
|
||||
|
||||
if (NS_OK != nativeThis->Unposition()) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
*rval = JSVAL_VOID;
|
||||
}
|
||||
else {
|
||||
JS_ReportError(cx, "Function unposition requires 0 parameters");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method SelectNode
|
||||
//
|
||||
|
@ -564,6 +595,55 @@ RangeSelectNodeContents(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
|
|||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method CompareEndPoints
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
RangeCompareEndPoints(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMRange *nativeThis = (nsIDOMRange*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
PRInt32 nativeRet;
|
||||
PRUint32 b0;
|
||||
nsIDOMRangePtr b1;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == nativeThis) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if (argc >= 2) {
|
||||
|
||||
if (!JS_ValueToInt32(cx, argv[0], (int32 *)&b0)) {
|
||||
JS_ReportError(cx, "Parameter must be a number");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
if (JS_FALSE == nsConvertJSValToObject((nsISupports **)&b1,
|
||||
kIRangeIID,
|
||||
"Range",
|
||||
cx,
|
||||
argv[1])) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
if (NS_OK != nativeThis->CompareEndPoints(b0, b1, &nativeRet)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
*rval = INT_TO_JSVAL(nativeRet);
|
||||
}
|
||||
else {
|
||||
JS_ReportError(cx, "Function compareEndPoints requires 2 parameters");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method DeleteContents
|
||||
//
|
||||
|
@ -632,10 +712,10 @@ RangeExtractContents(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsva
|
|||
|
||||
|
||||
//
|
||||
// Native method CopyContents
|
||||
// Native method CloneContents
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
RangeCopyContents(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
RangeCloneContents(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMRange *nativeThis = (nsIDOMRange*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
|
@ -650,14 +730,14 @@ RangeCopyContents(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *
|
|||
|
||||
if (argc >= 0) {
|
||||
|
||||
if (NS_OK != nativeThis->CopyContents(&nativeRet)) {
|
||||
if (NS_OK != nativeThis->CloneContents(&nativeRet)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
nsConvertObjectToJSVal(nativeRet, cx, rval);
|
||||
}
|
||||
else {
|
||||
JS_ReportError(cx, "Function copyContents requires 0 parameters");
|
||||
JS_ReportError(cx, "Function cloneContents requires 0 parameters");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
@ -840,13 +920,12 @@ JSClass RangeClass = {
|
|||
//
|
||||
static JSPropertySpec RangeProperties[] =
|
||||
{
|
||||
{"isPositioned", RANGE_ISPOSITIONED, JSPROP_ENUMERATE},
|
||||
{"startParent", RANGE_STARTPARENT, JSPROP_ENUMERATE},
|
||||
{"startOffset", RANGE_STARTOFFSET, JSPROP_ENUMERATE},
|
||||
{"endParent", RANGE_ENDPARENT, JSPROP_ENUMERATE},
|
||||
{"endOffset", RANGE_ENDOFFSET, JSPROP_ENUMERATE},
|
||||
{"isCollapsed", RANGE_ISCOLLAPSED, JSPROP_ENUMERATE},
|
||||
{"commonParent", RANGE_COMMONPARENT, JSPROP_ENUMERATE},
|
||||
{"startParent", RANGE_STARTPARENT, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"startOffset", RANGE_STARTOFFSET, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"endParent", RANGE_ENDPARENT, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"endOffset", RANGE_ENDOFFSET, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"isCollapsed", RANGE_ISCOLLAPSED, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"commonParent", RANGE_COMMONPARENT, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
@ -857,14 +936,18 @@ static JSPropertySpec RangeProperties[] =
|
|||
static JSFunctionSpec RangeMethods[] =
|
||||
{
|
||||
{"setStart", RangeSetStart, 2},
|
||||
{"setStartBefore", RangeSetStartBefore, 1},
|
||||
{"setStartAfter", RangeSetStartAfter, 1},
|
||||
{"setEnd", RangeSetEnd, 2},
|
||||
{"setEndBefore", RangeSetEndBefore, 1},
|
||||
{"setEndAfter", RangeSetEndAfter, 1},
|
||||
{"collapse", RangeCollapse, 1},
|
||||
{"unposition", RangeUnposition, 0},
|
||||
{"selectNode", RangeSelectNode, 1},
|
||||
{"selectNodeContents", RangeSelectNodeContents, 1},
|
||||
{"compareEndPoints", RangeCompareEndPoints, 2},
|
||||
{"deleteContents", RangeDeleteContents, 0},
|
||||
{"extractContents", RangeExtractContents, 0},
|
||||
{"copyContents", RangeCopyContents, 0},
|
||||
{"cloneContents", RangeCloneContents, 0},
|
||||
{"insertNode", RangeInsertNode, 1},
|
||||
{"surroundContents", RangeSurroundContents, 1},
|
||||
{"clone", RangeClone, 0},
|
||||
|
@ -915,6 +998,23 @@ nsresult NS_InitRangeClass(nsIScriptContext *aContext, void **aPrototype)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if ((PR_TRUE == JS_LookupProperty(jscontext, global, "Range", &vp)) &&
|
||||
JSVAL_IS_OBJECT(vp) &&
|
||||
((constructor = JSVAL_TO_OBJECT(vp)) != nsnull)) {
|
||||
vp = INT_TO_JSVAL(nsIDOMRange::START_TO_START);
|
||||
JS_SetProperty(jscontext, constructor, "START_TO_START", &vp);
|
||||
|
||||
vp = INT_TO_JSVAL(nsIDOMRange::START_TO_END);
|
||||
JS_SetProperty(jscontext, constructor, "START_TO_END", &vp);
|
||||
|
||||
vp = INT_TO_JSVAL(nsIDOMRange::END_TO_START);
|
||||
JS_SetProperty(jscontext, constructor, "END_TO_START", &vp);
|
||||
|
||||
vp = INT_TO_JSVAL(nsIDOMRange::END_TO_END);
|
||||
JS_SetProperty(jscontext, constructor, "END_TO_END", &vp);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else if ((nsnull != constructor) && JSVAL_IS_OBJECT(vp)) {
|
||||
proto = JSVAL_TO_OBJECT(vp);
|
||||
|
|
|
@ -38,47 +38,42 @@ public:
|
|||
nsRange();
|
||||
virtual ~nsRange();
|
||||
|
||||
// IsPositioned attribute disappeared from the dom spec
|
||||
NS_IMETHOD GetIsPositioned(PRBool* aIsPositioned);
|
||||
NS_IMETHOD SetIsPositioned(PRBool aIsPositioned);
|
||||
|
||||
NS_IMETHOD GetStartParent(nsIDOMNode** aStartParent);
|
||||
NS_IMETHOD SetStartParent(nsIDOMNode* aStartParent);
|
||||
|
||||
NS_IMETHOD GetStartOffset(PRInt32* aStartOffset);
|
||||
NS_IMETHOD SetStartOffset(PRInt32 aStartOffset);
|
||||
|
||||
NS_IMETHOD GetEndParent(nsIDOMNode** aEndParent);
|
||||
NS_IMETHOD SetEndParent(nsIDOMNode* aEndParent);
|
||||
|
||||
NS_IMETHOD GetEndOffset(PRInt32* aEndOffset);
|
||||
NS_IMETHOD SetEndOffset(PRInt32 aEndOffset);
|
||||
|
||||
NS_IMETHOD GetIsCollapsed(PRBool* aIsCollapsed);
|
||||
NS_IMETHOD SetIsCollapsed(PRBool aIsCollapsed);
|
||||
|
||||
NS_IMETHOD GetCommonParent(nsIDOMNode** aCommonParent);
|
||||
NS_IMETHOD SetCommonParent(nsIDOMNode* aCommonParent);
|
||||
|
||||
NS_IMETHOD SetStart(nsIDOMNode* aParent, PRInt32 aOffset);
|
||||
NS_IMETHOD SetStartBefore(nsIDOMNode* sibling);
|
||||
NS_IMETHOD SetStartAfter(nsIDOMNode* sibling);
|
||||
|
||||
NS_IMETHOD SetEnd(nsIDOMNode* aParent, PRInt32 aOffset);
|
||||
NS_IMETHOD SetEndBefore(nsIDOMNode* sibling);
|
||||
NS_IMETHOD SetEndAfter(nsIDOMNode* sibling);
|
||||
|
||||
NS_IMETHOD Collapse(PRBool aToStart);
|
||||
|
||||
NS_IMETHOD Unposition();
|
||||
|
||||
NS_IMETHOD SelectNode(nsIDOMNode* aN);
|
||||
|
||||
NS_IMETHOD SelectNodeContents(nsIDOMNode* aN);
|
||||
|
||||
NS_IMETHOD CompareEndPoints(PRUint16 how, nsIDOMRange* srcRange, PRInt32* ret);
|
||||
|
||||
NS_IMETHOD DeleteContents();
|
||||
|
||||
NS_IMETHOD ExtractContents(nsIDOMDocumentFragment** aReturn);
|
||||
|
||||
NS_IMETHOD CopyContents(nsIDOMDocumentFragment** aReturn);
|
||||
NS_IMETHOD CloneContents(nsIDOMDocumentFragment** aReturn);
|
||||
|
||||
NS_IMETHOD InsertNode(nsIDOMNode* aN);
|
||||
|
||||
NS_IMETHOD SurroundContents(nsIDOMNode* aN);
|
||||
|
||||
NS_IMETHOD Clone(nsIDOMRange** aReturn);
|
||||
|
@ -727,6 +722,16 @@ nsresult nsRange::SetStart(nsIDOMNode* aParent, PRInt32 aOffset)
|
|||
return res;
|
||||
}
|
||||
|
||||
nsresult nsRange::SetStartBefore(nsIDOMNode* sibling)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult nsRange::SetStartAfter(nsIDOMNode* sibling)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult nsRange::SetEnd(nsIDOMNode* aParent, PRInt32 aOffset)
|
||||
{
|
||||
nsresult res;
|
||||
|
@ -750,6 +755,16 @@ nsresult nsRange::SetEnd(nsIDOMNode* aParent, PRInt32 aOffset)
|
|||
return res;
|
||||
}
|
||||
|
||||
nsresult nsRange::SetEndBefore(nsIDOMNode* sibling)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult nsRange::SetEndAfter(nsIDOMNode* sibling)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult nsRange::Collapse(PRBool aToStart)
|
||||
{
|
||||
if (!mIsPositioned)
|
||||
|
@ -879,10 +894,40 @@ nsresult nsRange::DeleteContents()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsRange::ExtractContents(nsIDOMDocumentFragment** aReturn)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
nsresult nsRange::CompareEndPoints(PRUint16 how, nsIDOMRange* srcRange, PRInt32* ret)
|
||||
{
|
||||
if (ret == 0)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (srcRange == 0)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
nsresult nsRange::CopyContents(nsIDOMDocumentFragment** aReturn)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
#if 0
|
||||
switch (how)
|
||||
{
|
||||
case nsIDOMRange::START_TO_START:
|
||||
case nsIDOMRange::START_TO_END:
|
||||
case nsIDOMRange::END_TO_START:
|
||||
case nsIDOMRange::END_TO_END:
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
default: // shouldn't get here
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult nsRange::ExtractContents(nsIDOMDocumentFragment** aReturn)
|
||||
{
|
||||
nsresult res = CloneContents(aReturn);
|
||||
if (!NS_SUCCEEDED(res))
|
||||
return res;
|
||||
res = DeleteContents();
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsRange::CloneContents(nsIDOMDocumentFragment** aReturn)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
nsresult nsRange::InsertNode(nsIDOMNode* aN)
|
||||
|
@ -897,29 +942,3 @@ nsresult nsRange::Clone(nsIDOMRange** aReturn)
|
|||
nsresult nsRange::ToString(nsString& aReturn)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
//
|
||||
// We don't actually want to allow setting this ...
|
||||
// These are all read only attributes that the idl
|
||||
// is generating setters for
|
||||
//
|
||||
nsresult nsRange::SetIsPositioned(PRBool aIsPositioned)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
nsresult nsRange::SetStartParent(nsIDOMNode* aNode)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
nsresult nsRange::SetStartOffset(PRInt32 aOffset)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
nsresult nsRange::SetEndParent(nsIDOMNode* aNode)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
nsresult nsRange::SetEndOffset(PRInt32 aOffset)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
nsresult nsRange::SetIsCollapsed(PRBool aIsCollapsed)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
nsresult nsRange::SetCommonParent(nsIDOMNode* aCommonParent)
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче