Bug 366946 - WRONG_DOCUMENT_ERR not thrown for Range.compareBoundaryPoints

p=Ryan Jones <sciguyryan@gmail.com>
r+sr=peterv
This commit is contained in:
asqueella%gmail.com 2007-02-17 18:53:01 +00:00
Родитель 986c85a51c
Коммит 3ef2085452
3 изменённых файлов: 11 добавлений и 4 удалений

Просмотреть файл

@ -52,13 +52,19 @@ public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IRANGE_IID)
nsIRange()
: mStartOffset(0),
: mRoot(nsnull),
mStartOffset(0),
mEndOffset(0),
mIsPositioned(PR_FALSE),
mIsDetached(PR_FALSE)
{
}
nsINode* GetRoot()
{
return mRoot;
}
nsINode* GetStartParent()
{
return mStartParent;
@ -100,6 +106,7 @@ public:
virtual void Reset() = 0;
protected:
nsINode* mRoot;
nsCOMPtr<nsINode> mStartParent;
nsCOMPtr<nsINode> mEndParent;
PRInt32 mStartOffset;

Просмотреть файл

@ -1236,6 +1236,9 @@ nsRange::CompareBoundaryPoints(PRUint16 aHow, nsIDOMRange* aOtherRange,
return NS_ERROR_ILLEGAL_VALUE;
}
if (mRoot != otherRange->GetRoot())
return NS_ERROR_DOM_WRONG_DOCUMENT_ERR;
*aCmpRet = nsContentUtils::ComparePoints(ourNode, ourOffset,
otherNode, otherOffset);

Просмотреть файл

@ -81,7 +81,6 @@ class nsRange : public nsIRange,
{
public:
nsRange()
: mRoot(nsnull)
{
}
virtual ~nsRange();
@ -130,8 +129,6 @@ public:
PRBool *outNodeAfter);
protected:
nsINode* mRoot;
void DoSetRange(nsINode* aStartN, PRInt32 aStartOffset,
nsINode* aEndN, PRInt32 aEndOffset,
nsINode* aRoot);