mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 682611 - Part 3: Remove ns(I)RangeUtils; r=smaug
This commit is contained in:
parent
c7397d32ef
commit
452eb69c4e
@ -62,7 +62,6 @@ nsINameSpaceManager.h \
|
|||||||
nsINode.h \
|
nsINode.h \
|
||||||
nsINodeInfo.h \
|
nsINodeInfo.h \
|
||||||
nsINodeList.h \
|
nsINodeList.h \
|
||||||
nsIRangeUtils.h \
|
|
||||||
nsIScriptElement.h \
|
nsIScriptElement.h \
|
||||||
nsIStyleSheetLinkingElement.h \
|
nsIStyleSheetLinkingElement.h \
|
||||||
nsIContentSerializer.h \
|
nsIContentSerializer.h \
|
||||||
|
@ -178,10 +178,6 @@
|
|||||||
#define NS_XULDOCUMENT_CID \
|
#define NS_XULDOCUMENT_CID \
|
||||||
{ 0x541afcb2, 0xa9a3, 0x11d2, { 0x8e, 0xc5, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
|
{ 0x541afcb2, 0xa9a3, 0x11d2, { 0x8e, 0xc5, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
|
||||||
|
|
||||||
// {a6cf9126-15b3-11d2-932e-00805f8add32}
|
|
||||||
#define NS_RANGEUTILS_CID \
|
|
||||||
{ 0xa6cf9126, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
|
||||||
|
|
||||||
#define NS_SVGDOCUMENT_CID \
|
#define NS_SVGDOCUMENT_CID \
|
||||||
{ /* b7f44954-1dd1-11b2-8c2e-c2feab4186bc */ \
|
{ /* b7f44954-1dd1-11b2-8c2e-c2feab4186bc */ \
|
||||||
0xb7f44954, 0x11d1, 0x11b2, \
|
0xb7f44954, 0x11d1, 0x11b2, \
|
||||||
|
@ -333,6 +333,9 @@ public:
|
|||||||
static PRInt32 ComparePoints(nsINode* aParent1, PRInt32 aOffset1,
|
static PRInt32 ComparePoints(nsINode* aParent1, PRInt32 aOffset1,
|
||||||
nsINode* aParent2, PRInt32 aOffset2,
|
nsINode* aParent2, PRInt32 aOffset2,
|
||||||
bool* aDisconnected = nsnull);
|
bool* aDisconnected = nsnull);
|
||||||
|
static PRInt32 ComparePoints(nsIDOMNode* aParent1, PRInt32 aOffset1,
|
||||||
|
nsIDOMNode* aParent2, PRInt32 aOffset2,
|
||||||
|
bool* aDisconnected = nsnull);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Brute-force search of the element subtree rooted at aContent for
|
* Brute-force search of the element subtree rooted at aContent for
|
||||||
|
@ -1,72 +0,0 @@
|
|||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
||||||
*
|
|
||||||
* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla Public License Version
|
|
||||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
|
||||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
||||||
* for the specific language governing rights and limitations under the
|
|
||||||
* License.
|
|
||||||
*
|
|
||||||
* The Original Code is Mozilla Communicator client code, released
|
|
||||||
* March 31, 1998.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Netscape Communications Corporation.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
* 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"),
|
|
||||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
/* A class for range utilities. */
|
|
||||||
|
|
||||||
#ifndef nsIRangeUtils_h___
|
|
||||||
#define nsIRangeUtils_h___
|
|
||||||
|
|
||||||
#include "nsISupports.h"
|
|
||||||
|
|
||||||
// Forward declarations
|
|
||||||
class nsRange;
|
|
||||||
class nsIDOMNode;
|
|
||||||
class nsIContent;
|
|
||||||
|
|
||||||
// IID for the nsIRangeUtils interface
|
|
||||||
#define NS_IRANGEUTILS_IID \
|
|
||||||
{ 0xa6cf9127, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
|
||||||
|
|
||||||
class nsIRangeUtils : public nsISupports {
|
|
||||||
public:
|
|
||||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IRANGEUTILS_IID)
|
|
||||||
|
|
||||||
NS_IMETHOD_(PRInt32) ComparePoints(nsIDOMNode* aParent1, PRInt32 aOffset1,
|
|
||||||
nsIDOMNode* aParent2, PRInt32 aOffset2) = 0;
|
|
||||||
|
|
||||||
NS_IMETHOD CompareNodeToRange(nsIContent* aNode,
|
|
||||||
nsRange* aRange,
|
|
||||||
bool *outNodeBefore,
|
|
||||||
bool *outNodeAfter) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIRangeUtils, NS_IRANGEUTILS_IID)
|
|
||||||
|
|
||||||
#endif /* nsIRangeUtils_h___ */
|
|
||||||
|
|
@ -1730,6 +1730,18 @@ nsContentUtils::ComparePoints(nsINode* aParent1, PRInt32 aOffset1,
|
|||||||
return parent->IndexOf(child1) < aOffset2 ? -1 : 1;
|
return parent->IndexOf(child1) < aOffset2 ? -1 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
PRInt32
|
||||||
|
nsContentUtils::ComparePoints(nsIDOMNode* aParent1, PRInt32 aOffset1,
|
||||||
|
nsIDOMNode* aParent2, PRInt32 aOffset2,
|
||||||
|
bool* aDisconnected)
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsINode> parent1 = do_QueryInterface(aParent1);
|
||||||
|
nsCOMPtr<nsINode> parent2 = do_QueryInterface(aParent2);
|
||||||
|
NS_ENSURE_TRUE(parent1 && parent2, -1);
|
||||||
|
return ComparePoints(parent1, aOffset1, parent2, aOffset2);
|
||||||
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
IsCharInSet(const char* aSet,
|
IsCharInSet(const char* aSet,
|
||||||
const PRUnichar aChar)
|
const PRUnichar aChar)
|
||||||
|
@ -234,52 +234,6 @@ nsRange::IsNodeSelected(nsINode* aNode, PRUint32 aStartOffset,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************
|
|
||||||
* non members
|
|
||||||
******************************************************/
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
NS_NewRangeUtils(nsIRangeUtils** aResult)
|
|
||||||
{
|
|
||||||
NS_ENSURE_ARG_POINTER(aResult);
|
|
||||||
|
|
||||||
nsRangeUtils* rangeUtil = new nsRangeUtils();
|
|
||||||
if (!rangeUtil) {
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CallQueryInterface(rangeUtil, aResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************
|
|
||||||
* nsISupports
|
|
||||||
******************************************************/
|
|
||||||
NS_IMPL_ISUPPORTS1(nsRangeUtils, nsIRangeUtils)
|
|
||||||
|
|
||||||
/******************************************************
|
|
||||||
* nsIRangeUtils methods
|
|
||||||
******************************************************/
|
|
||||||
|
|
||||||
NS_IMETHODIMP_(PRInt32)
|
|
||||||
nsRangeUtils::ComparePoints(nsIDOMNode* aParent1, PRInt32 aOffset1,
|
|
||||||
nsIDOMNode* aParent2, PRInt32 aOffset2)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsINode> parent1 = do_QueryInterface(aParent1);
|
|
||||||
nsCOMPtr<nsINode> parent2 = do_QueryInterface(aParent2);
|
|
||||||
|
|
||||||
NS_ENSURE_TRUE(parent1 && parent2, -1);
|
|
||||||
|
|
||||||
return nsContentUtils::ComparePoints(parent1, aOffset1, parent2, aOffset2);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsRangeUtils::CompareNodeToRange(nsIContent* aNode, nsRange* aRange,
|
|
||||||
bool *outNodeBefore, bool *outNodeAfter)
|
|
||||||
{
|
|
||||||
return nsRange::CompareNodeToRange(aNode, aRange, outNodeBefore,
|
|
||||||
outNodeAfter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************
|
/******************************************************
|
||||||
* constructor/destructor
|
* constructor/destructor
|
||||||
******************************************************/
|
******************************************************/
|
||||||
|
@ -43,7 +43,6 @@
|
|||||||
#define nsRange_h___
|
#define nsRange_h___
|
||||||
|
|
||||||
#include "nsIDOMRange.h"
|
#include "nsIDOMRange.h"
|
||||||
#include "nsIRangeUtils.h"
|
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsIDOMDocumentFragment.h"
|
#include "nsIDOMDocumentFragment.h"
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
@ -270,23 +269,4 @@ protected:
|
|||||||
bool mInSelection;
|
bool mInSelection;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class nsRangeUtils : public nsIRangeUtils
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
|
|
||||||
// nsIRangeUtils interface
|
|
||||||
NS_IMETHOD_(PRInt32) ComparePoints(nsIDOMNode* aParent1, PRInt32 aOffset1,
|
|
||||||
nsIDOMNode* aParent2, PRInt32 aOffset2);
|
|
||||||
|
|
||||||
NS_IMETHOD CompareNodeToRange(nsIContent* aNode,
|
|
||||||
nsRange* aRange,
|
|
||||||
bool *outNodeBefore,
|
|
||||||
bool *outNodeAfter);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Make a new nsIRangeUtils object
|
|
||||||
nsresult NS_NewRangeUtils(nsIRangeUtils** aInstancePtrResult);
|
|
||||||
|
|
||||||
#endif /* nsRange_h___ */
|
#endif /* nsRange_h___ */
|
||||||
|
@ -60,7 +60,6 @@
|
|||||||
#include "nsISelectionPrivate.h"
|
#include "nsISelectionPrivate.h"
|
||||||
#include "nsISelectionController.h"
|
#include "nsISelectionController.h"
|
||||||
#include "nsIDOMRange.h"
|
#include "nsIDOMRange.h"
|
||||||
#include "nsIRangeUtils.h"
|
|
||||||
#include "nsIDOMCharacterData.h"
|
#include "nsIDOMCharacterData.h"
|
||||||
#include "nsIEnumerator.h"
|
#include "nsIEnumerator.h"
|
||||||
#include "nsIDOMNamedNodeMap.h"
|
#include "nsIDOMNamedNodeMap.h"
|
||||||
@ -5257,7 +5256,7 @@ nsHTMLEditRules::ExpandSelectionForDeletion(nsISelection *aSelection)
|
|||||||
|
|
||||||
// check if block is entirely inside range
|
// check if block is entirely inside range
|
||||||
nsCOMPtr<nsIContent> brContentBlock = do_QueryInterface(brBlock);
|
nsCOMPtr<nsIContent> brContentBlock = do_QueryInterface(brBlock);
|
||||||
res = mHTMLEditor->sRangeHelper->CompareNodeToRange(brContentBlock, range, &nodeBefore, &nodeAfter);
|
res = nsRange::CompareNodeToRange(brContentBlock, range, &nodeBefore, &nodeAfter);
|
||||||
|
|
||||||
// if block isn't contained, forgo grabbing the br in the expanded selection
|
// if block isn't contained, forgo grabbing the br in the expanded selection
|
||||||
if (nodeBefore || nodeAfter)
|
if (nodeBefore || nodeAfter)
|
||||||
@ -5489,9 +5488,11 @@ nsHTMLEditRules::NormalizeSelection(nsISelection *inSelection)
|
|||||||
// then just leave things alone.
|
// then just leave things alone.
|
||||||
|
|
||||||
PRInt16 comp;
|
PRInt16 comp;
|
||||||
comp = mHTMLEditor->sRangeHelper->ComparePoints(startNode, startOffset, newEndNode, newEndOffset);
|
comp = nsContentUtils::ComparePoints(startNode, startOffset,
|
||||||
|
newEndNode, newEndOffset);
|
||||||
if (comp == 1) return NS_OK; // new end before old start
|
if (comp == 1) return NS_OK; // new end before old start
|
||||||
comp = mHTMLEditor->sRangeHelper->ComparePoints(newStartNode, newStartOffset, endNode, endOffset);
|
comp = nsContentUtils::ComparePoints(newStartNode, newStartOffset,
|
||||||
|
endNode, endOffset);
|
||||||
if (comp == 1) return NS_OK; // new start after old end
|
if (comp == 1) return NS_OK; // new start after old end
|
||||||
|
|
||||||
// otherwise set selection to new values.
|
// otherwise set selection to new values.
|
||||||
@ -7637,7 +7638,7 @@ nsHTMLEditRules::PinSelectionToNewBlock(nsISelection *aSelection)
|
|||||||
nsCOMPtr<nsIContent> block (do_QueryInterface(mNewBlock));
|
nsCOMPtr<nsIContent> block (do_QueryInterface(mNewBlock));
|
||||||
NS_ENSURE_TRUE(block, NS_ERROR_NO_INTERFACE);
|
NS_ENSURE_TRUE(block, NS_ERROR_NO_INTERFACE);
|
||||||
bool nodeBefore, nodeAfter;
|
bool nodeBefore, nodeAfter;
|
||||||
res = mHTMLEditor->sRangeHelper->CompareNodeToRange(block, range, &nodeBefore, &nodeAfter);
|
res = nsRange::CompareNodeToRange(block, range, &nodeBefore, &nodeAfter);
|
||||||
NS_ENSURE_SUCCESS(res, res);
|
NS_ENSURE_SUCCESS(res, res);
|
||||||
|
|
||||||
if (nodeBefore && nodeAfter)
|
if (nodeBefore && nodeAfter)
|
||||||
|
@ -72,7 +72,6 @@
|
|||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsIContentIterator.h"
|
#include "nsIContentIterator.h"
|
||||||
#include "nsIDOMRange.h"
|
#include "nsIDOMRange.h"
|
||||||
#include "nsIRangeUtils.h"
|
|
||||||
#include "nsISupportsArray.h"
|
#include "nsISupportsArray.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsIDocumentEncoder.h"
|
#include "nsIDocumentEncoder.h"
|
||||||
@ -109,8 +108,6 @@ static char hrefText[] = "href";
|
|||||||
static char anchorTxt[] = "anchor";
|
static char anchorTxt[] = "anchor";
|
||||||
static char namedanchorText[] = "namedanchor";
|
static char namedanchorText[] = "namedanchor";
|
||||||
|
|
||||||
nsIRangeUtils* nsHTMLEditor::sRangeHelper;
|
|
||||||
|
|
||||||
#define IsLinkTag(s) (s.EqualsIgnoreCase(hrefText))
|
#define IsLinkTag(s) (s.EqualsIgnoreCase(hrefText))
|
||||||
#define IsNamedAnchorTag(s) (s.EqualsIgnoreCase(anchorTxt) || s.EqualsIgnoreCase(namedanchorText))
|
#define IsNamedAnchorTag(s) (s.EqualsIgnoreCase(anchorTxt) || s.EqualsIgnoreCase(namedanchorText))
|
||||||
|
|
||||||
@ -196,13 +193,6 @@ nsHTMLEditor::HideAnonymousEditingUIs()
|
|||||||
HideResizers();
|
HideResizers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
|
||||||
void
|
|
||||||
nsHTMLEditor::Shutdown()
|
|
||||||
{
|
|
||||||
NS_IF_RELEASE(sRangeHelper);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLEditor)
|
NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLEditor)
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLEditor, nsPlaintextEditor)
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLEditor, nsPlaintextEditor)
|
||||||
@ -272,13 +262,6 @@ nsHTMLEditor::Init(nsIDOMDocument *aDoc,
|
|||||||
|
|
||||||
nsresult result = NS_OK, rulesRes = NS_OK;
|
nsresult result = NS_OK, rulesRes = NS_OK;
|
||||||
|
|
||||||
// make a range util object for comparing dom points
|
|
||||||
if (!sRangeHelper) {
|
|
||||||
result = CallGetService("@mozilla.org/content/range-utils;1",
|
|
||||||
&sRangeHelper);
|
|
||||||
NS_ENSURE_TRUE(sRangeHelper, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (1)
|
if (1)
|
||||||
{
|
{
|
||||||
// block to scope nsAutoEditInitRulesTrigger
|
// block to scope nsAutoEditInitRulesTrigger
|
||||||
|
@ -79,7 +79,6 @@ class nsIClipboard;
|
|||||||
class TypeInState;
|
class TypeInState;
|
||||||
class nsIContentFilter;
|
class nsIContentFilter;
|
||||||
class nsIURL;
|
class nsIURL;
|
||||||
class nsIRangeUtils;
|
|
||||||
class nsILinkHandler;
|
class nsILinkHandler;
|
||||||
struct PropItem;
|
struct PropItem;
|
||||||
|
|
||||||
@ -772,13 +771,6 @@ protected:
|
|||||||
// for real-time spelling
|
// for real-time spelling
|
||||||
nsCOMPtr<nsITextServicesDocument> mTextServices;
|
nsCOMPtr<nsITextServicesDocument> mTextServices;
|
||||||
|
|
||||||
// And a static range utils service
|
|
||||||
static nsIRangeUtils* sRangeHelper;
|
|
||||||
|
|
||||||
public:
|
|
||||||
// ... which means that we need to listen to shutdown
|
|
||||||
static void Shutdown();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/* ANONYMOUS UTILS */
|
/* ANONYMOUS UTILS */
|
||||||
|
@ -43,8 +43,8 @@
|
|||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsIDOMCharacterData.h"
|
#include "nsIDOMCharacterData.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
#include "nsIRangeUtils.h"
|
|
||||||
#include "nsRange.h"
|
#include "nsRange.h"
|
||||||
|
#include "nsContentUtils.h"
|
||||||
|
|
||||||
const PRUnichar nbsp = 160;
|
const PRUnichar nbsp = 160;
|
||||||
|
|
||||||
@ -1602,7 +1602,7 @@ nsWSRunObject::DeleteChars(nsIDOMNode *aStartNode, PRInt32 aStartOffset,
|
|||||||
}
|
}
|
||||||
bool nodeBefore, nodeAfter;
|
bool nodeBefore, nodeAfter;
|
||||||
nsCOMPtr<nsIContent> content (do_QueryInterface(node));
|
nsCOMPtr<nsIContent> content (do_QueryInterface(node));
|
||||||
res = mHTMLEditor->sRangeHelper->CompareNodeToRange(content, range, &nodeBefore, &nodeAfter);
|
res = nsRange::CompareNodeToRange(content, range, &nodeBefore, &nodeAfter);
|
||||||
NS_ENSURE_SUCCESS(res, res);
|
NS_ENSURE_SUCCESS(res, res);
|
||||||
if (nodeAfter)
|
if (nodeAfter)
|
||||||
{
|
{
|
||||||
@ -1861,7 +1861,8 @@ nsWSRunObject::FindRun(nsIDOMNode *aNode, PRInt32 aOffset, WSFragment **outRun,
|
|||||||
WSFragment *run = mStartRun;
|
WSFragment *run = mStartRun;
|
||||||
while (run)
|
while (run)
|
||||||
{
|
{
|
||||||
PRInt16 comp = mHTMLEditor->sRangeHelper->ComparePoints(aNode, aOffset, run->mStartNode, run->mStartOffset);
|
PRInt16 comp = nsContentUtils::ComparePoints(aNode, aOffset, run->mStartNode,
|
||||||
|
run->mStartOffset);
|
||||||
if (comp <= 0)
|
if (comp <= 0)
|
||||||
{
|
{
|
||||||
if (after)
|
if (after)
|
||||||
@ -1875,7 +1876,8 @@ nsWSRunObject::FindRun(nsIDOMNode *aNode, PRInt32 aOffset, WSFragment **outRun,
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
comp = mHTMLEditor->sRangeHelper->ComparePoints(aNode, aOffset, run->mEndNode, run->mEndOffset);
|
comp = nsContentUtils::ComparePoints(aNode, aOffset,
|
||||||
|
run->mEndNode, run->mEndOffset);
|
||||||
if (comp < 0)
|
if (comp < 0)
|
||||||
{
|
{
|
||||||
*outRun = run;
|
*outRun = run;
|
||||||
@ -1948,7 +1950,7 @@ nsWSRunObject::GetWSPointAfter(nsIDOMNode *aNode, PRInt32 aOffset, WSPoint *outP
|
|||||||
while (curNum != lastNum)
|
while (curNum != lastNum)
|
||||||
{
|
{
|
||||||
curNode = mNodeArray[curNum];
|
curNode = mNodeArray[curNum];
|
||||||
cmp = mHTMLEditor->sRangeHelper->ComparePoints(aNode, aOffset, curNode, 0);
|
cmp = nsContentUtils::ComparePoints(aNode, aOffset, curNode, 0);
|
||||||
if (cmp < 0)
|
if (cmp < 0)
|
||||||
lastNum = curNum;
|
lastNum = curNum;
|
||||||
else
|
else
|
||||||
@ -1997,7 +1999,7 @@ nsWSRunObject::GetWSPointBefore(nsIDOMNode *aNode, PRInt32 aOffset, WSPoint *out
|
|||||||
while (curNum != lastNum)
|
while (curNum != lastNum)
|
||||||
{
|
{
|
||||||
curNode = mNodeArray[curNum];
|
curNode = mNodeArray[curNum];
|
||||||
cmp = mHTMLEditor->sRangeHelper->ComparePoints(aNode, aOffset, curNode, 0);
|
cmp = nsContentUtils::ComparePoints(aNode, aOffset, curNode, 0);
|
||||||
if (cmp < 0)
|
if (cmp < 0)
|
||||||
lastNum = curNum;
|
lastNum = curNum;
|
||||||
else
|
else
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsIEnumerator.h"
|
#include "nsIEnumerator.h"
|
||||||
|
|
||||||
#include "nsTextServicesDocument.h"
|
#include "nsContentUtils.h"
|
||||||
|
|
||||||
#include "nsIDOMNode.h"
|
#include "nsIDOMNode.h"
|
||||||
|
|
||||||
@ -254,14 +254,10 @@ ContentIsInTraversalRange(nsIContent *aContent, bool aIsPreMode,
|
|||||||
if (!aIsPreMode)
|
if (!aIsPreMode)
|
||||||
++indx;
|
++indx;
|
||||||
|
|
||||||
PRInt32 startRes;
|
PRInt32 startRes = nsContentUtils::ComparePoints(aStartNode, aStartOffset,
|
||||||
PRInt32 endRes;
|
parentNode, indx);
|
||||||
nsresult rv = nsTextServicesDocument::ComparePoints(aStartNode, aStartOffset, parentNode, indx, &startRes);
|
PRInt32 endRes = nsContentUtils::ComparePoints(aEndNode, aEndOffset,
|
||||||
NS_ENSURE_SUCCESS(rv, false);
|
parentNode, indx);
|
||||||
|
|
||||||
rv = nsTextServicesDocument::ComparePoints(aEndNode, aEndOffset, parentNode, indx, &endRes);
|
|
||||||
NS_ENSURE_SUCCESS(rv, false);
|
|
||||||
|
|
||||||
return (startRes <= 0) && (endRes >= 0);
|
return (startRes <= 0) && (endRes >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,6 @@
|
|||||||
#include "nsIAtom.h"
|
#include "nsIAtom.h"
|
||||||
#include "nsITextServicesFilter.h"
|
#include "nsITextServicesFilter.h"
|
||||||
#include "nsRange.h"
|
#include "nsRange.h"
|
||||||
#include "nsIRangeUtils.h"
|
|
||||||
#include "nsCycleCollectionParticipant.h"
|
#include "nsCycleCollectionParticipant.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
#include "nsIContentIterator.h"
|
#include "nsIContentIterator.h"
|
||||||
#include "nsIDOMNodeList.h"
|
#include "nsIDOMNodeList.h"
|
||||||
#include "nsIDOMRange.h"
|
#include "nsIDOMRange.h"
|
||||||
#include "nsIRangeUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsISelection.h"
|
#include "nsISelection.h"
|
||||||
#include "nsIPlaintextEditor.h"
|
#include "nsIPlaintextEditor.h"
|
||||||
#include "nsTextServicesDocument.h"
|
#include "nsTextServicesDocument.h"
|
||||||
@ -103,8 +103,6 @@ public:
|
|||||||
#include "nsTSAtomList.h"
|
#include "nsTSAtomList.h"
|
||||||
#undef TS_ATOM
|
#undef TS_ATOM
|
||||||
|
|
||||||
nsIRangeUtils* nsTextServicesDocument::sRangeHelper;
|
|
||||||
|
|
||||||
nsTextServicesDocument::nsTextServicesDocument()
|
nsTextServicesDocument::nsTextServicesDocument()
|
||||||
{
|
{
|
||||||
mRefCnt = 0;
|
mRefCnt = 0;
|
||||||
@ -139,13 +137,6 @@ nsTextServicesDocument::RegisterAtoms()
|
|||||||
NS_RegisterStaticAtoms(ts_atoms, ArrayLength(ts_atoms));
|
NS_RegisterStaticAtoms(ts_atoms, ArrayLength(ts_atoms));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
|
||||||
void
|
|
||||||
nsTextServicesDocument::Shutdown()
|
|
||||||
{
|
|
||||||
NS_IF_RELEASE(sRangeHelper);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsTextServicesDocument)
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsTextServicesDocument)
|
||||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsTextServicesDocument)
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsTextServicesDocument)
|
||||||
|
|
||||||
@ -2668,13 +2659,10 @@ nsTextServicesDocument::GetCollapsedSelection(nsITextServicesDocument::TSDBlockS
|
|||||||
|
|
||||||
NS_ENSURE_SUCCESS(result, result);
|
NS_ENSURE_SUCCESS(result, result);
|
||||||
|
|
||||||
result = ComparePoints(eStart->mNode, eStartOffset, parent, offset, &e1s1);
|
e1s1 = nsContentUtils::ComparePoints(eStart->mNode, eStartOffset,
|
||||||
|
parent, offset);
|
||||||
NS_ENSURE_SUCCESS(result, result);
|
e2s1 = nsContentUtils::ComparePoints(eEnd->mNode, eEndOffset,
|
||||||
|
parent, offset);
|
||||||
result = ComparePoints(eEnd->mNode, eEndOffset, parent, offset, &e2s1);
|
|
||||||
|
|
||||||
NS_ENSURE_SUCCESS(result, result);
|
|
||||||
|
|
||||||
if (e1s1 > 0 || e2s1 < 0)
|
if (e1s1 > 0 || e2s1 < 0)
|
||||||
{
|
{
|
||||||
@ -2962,13 +2950,10 @@ nsTextServicesDocument::GetUncollapsedSelection(nsITextServicesDocument::TSDBloc
|
|||||||
|
|
||||||
NS_ENSURE_SUCCESS(result, result);
|
NS_ENSURE_SUCCESS(result, result);
|
||||||
|
|
||||||
result = ComparePoints(eStart->mNode, eStartOffset, endParent, endOffset, &e1s2);
|
e1s2 = nsContentUtils::ComparePoints(eStart->mNode, eStartOffset,
|
||||||
|
endParent, endOffset);
|
||||||
NS_ENSURE_SUCCESS(result, result);
|
e2s1 = nsContentUtils::ComparePoints(eEnd->mNode, eEndOffset,
|
||||||
|
startParent, startOffset);
|
||||||
result = ComparePoints(eEnd->mNode, eEndOffset, startParent, startOffset, &e2s1);
|
|
||||||
|
|
||||||
NS_ENSURE_SUCCESS(result, result);
|
|
||||||
|
|
||||||
// Break out of the loop if the text block intersects the current range.
|
// Break out of the loop if the text block intersects the current range.
|
||||||
|
|
||||||
@ -2987,13 +2972,10 @@ nsTextServicesDocument::GetUncollapsedSelection(nsITextServicesDocument::TSDBloc
|
|||||||
|
|
||||||
// Now that we have an intersecting range, find out more info:
|
// Now that we have an intersecting range, find out more info:
|
||||||
|
|
||||||
result = ComparePoints(eStart->mNode, eStartOffset, startParent, startOffset, &e1s1);
|
e1s1 = nsContentUtils::ComparePoints(eStart->mNode, eStartOffset,
|
||||||
|
startParent, startOffset);
|
||||||
NS_ENSURE_SUCCESS(result, result);
|
e2s2 = nsContentUtils::ComparePoints(eEnd->mNode, eEndOffset,
|
||||||
|
endParent, endOffset);
|
||||||
result = ComparePoints(eEnd->mNode, eEndOffset, endParent, endOffset, &e2s2);
|
|
||||||
|
|
||||||
NS_ENSURE_SUCCESS(result, result);
|
|
||||||
|
|
||||||
if (rangeCount > 1)
|
if (rangeCount > 1)
|
||||||
{
|
{
|
||||||
@ -3211,24 +3193,6 @@ nsTextServicesDocument::SelectionIsValid()
|
|||||||
return(mSelStartIndex >= 0);
|
return(mSelStartIndex >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsTextServicesDocument::ComparePoints(nsIDOMNode* aParent1, PRInt32 aOffset1,
|
|
||||||
nsIDOMNode* aParent2, PRInt32 aOffset2,
|
|
||||||
PRInt32 *aResult)
|
|
||||||
{
|
|
||||||
*aResult = 0;
|
|
||||||
|
|
||||||
if (!sRangeHelper) {
|
|
||||||
nsresult result = CallGetService("@mozilla.org/content/range-utils;1",
|
|
||||||
&sRangeHelper);
|
|
||||||
NS_ENSURE_TRUE(sRangeHelper, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
*aResult = sRangeHelper->ComparePoints(aParent1, aOffset1,
|
|
||||||
aParent2, aOffset2);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsTextServicesDocument::GetRangeEndPoints(nsIDOMRange *aRange,
|
nsTextServicesDocument::GetRangeEndPoints(nsIDOMRange *aRange,
|
||||||
nsIDOMNode **aStartParent, PRInt32 *aStartOffset,
|
nsIDOMNode **aStartParent, PRInt32 *aStartOffset,
|
||||||
|
@ -52,7 +52,6 @@
|
|||||||
#include "nsWeakReference.h"
|
#include "nsWeakReference.h"
|
||||||
#include "nsCycleCollectionParticipant.h"
|
#include "nsCycleCollectionParticipant.h"
|
||||||
|
|
||||||
class nsIRangeUtils;
|
|
||||||
class OffsetEntry;
|
class OffsetEntry;
|
||||||
|
|
||||||
/** implementation of a text services object.
|
/** implementation of a text services object.
|
||||||
@ -114,8 +113,6 @@ private:
|
|||||||
|
|
||||||
nsCOMPtr<nsITextServicesFilter> mTxtSvcFilter;
|
nsCOMPtr<nsITextServicesFilter> mTxtSvcFilter;
|
||||||
|
|
||||||
static nsIRangeUtils* sRangeHelper;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** The default constructor.
|
/** The default constructor.
|
||||||
@ -130,10 +127,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
static void RegisterAtoms();
|
static void RegisterAtoms();
|
||||||
|
|
||||||
/** To be called at module shutdown
|
|
||||||
*/
|
|
||||||
static void Shutdown();
|
|
||||||
|
|
||||||
/* Macro for AddRef(), Release(), and QueryInterface() */
|
/* Macro for AddRef(), Release(), and QueryInterface() */
|
||||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsTextServicesDocument, nsITextServicesDocument)
|
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsTextServicesDocument, nsITextServicesDocument)
|
||||||
@ -192,7 +185,6 @@ public:
|
|||||||
NS_IMETHOD DidDeleteSelection(nsISelection *aSelection);
|
NS_IMETHOD DidDeleteSelection(nsISelection *aSelection);
|
||||||
|
|
||||||
/* Helper functions */
|
/* Helper functions */
|
||||||
static nsresult ComparePoints(nsIDOMNode *aParent1, PRInt32 aOffset1, nsIDOMNode *aParent2, PRInt32 aOffset2, PRInt32 *aResult);
|
|
||||||
static nsresult GetRangeEndPoints(nsIDOMRange *aRange, nsIDOMNode **aParent1, PRInt32 *aOffset1, nsIDOMNode **aParent2, PRInt32 *aOffset2);
|
static nsresult GetRangeEndPoints(nsIDOMRange *aRange, nsIDOMNode **aParent1, PRInt32 *aOffset1, nsIDOMNode **aParent2, PRInt32 *aOffset2);
|
||||||
static nsresult CreateRange(nsIDOMNode *aStartParent, PRInt32 aStartOffset, nsIDOMNode *aEndParent, PRInt32 aEndOffset, nsIDOMRange **aRange);
|
static nsresult CreateRange(nsIDOMNode *aStartParent, PRInt32 aStartOffset, nsIDOMNode *aEndParent, PRInt32 aEndOffset, nsIDOMRange **aRange);
|
||||||
|
|
||||||
|
@ -69,7 +69,6 @@
|
|||||||
#include "nsIObserver.h"
|
#include "nsIObserver.h"
|
||||||
#include "nsIObserverService.h"
|
#include "nsIObserverService.h"
|
||||||
#include "nsIPresShell.h"
|
#include "nsIPresShell.h"
|
||||||
#include "nsIRangeUtils.h"
|
|
||||||
#include "nsIScriptNameSpaceManager.h"
|
#include "nsIScriptNameSpaceManager.h"
|
||||||
#include "nsISelection.h"
|
#include "nsISelection.h"
|
||||||
#include "nsIXBLService.h"
|
#include "nsIXBLService.h"
|
||||||
@ -425,7 +424,6 @@ nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult);
|
|||||||
|
|
||||||
nsresult NS_NewDomSelection(nsISelection** aResult);
|
nsresult NS_NewDomSelection(nsISelection** aResult);
|
||||||
nsresult NS_NewContentViewer(nsIContentViewer** aResult);
|
nsresult NS_NewContentViewer(nsIContentViewer** aResult);
|
||||||
nsresult NS_NewRangeUtils(nsIRangeUtils** aResult);
|
|
||||||
nsresult NS_NewContentIterator(nsIContentIterator** aResult);
|
nsresult NS_NewContentIterator(nsIContentIterator** aResult);
|
||||||
nsresult NS_NewPreContentIterator(nsIContentIterator** aResult);
|
nsresult NS_NewPreContentIterator(nsIContentIterator** aResult);
|
||||||
nsresult NS_NewGenRegularIterator(nsIContentIterator** aResult);
|
nsresult NS_NewGenRegularIterator(nsIContentIterator** aResult);
|
||||||
@ -493,7 +491,6 @@ MAKE_CTOR(CreateXMLDocument, nsIDocument, NS_NewXML
|
|||||||
MAKE_CTOR(CreateSVGDocument, nsIDocument, NS_NewSVGDocument)
|
MAKE_CTOR(CreateSVGDocument, nsIDocument, NS_NewSVGDocument)
|
||||||
MAKE_CTOR(CreateImageDocument, nsIDocument, NS_NewImageDocument)
|
MAKE_CTOR(CreateImageDocument, nsIDocument, NS_NewImageDocument)
|
||||||
MAKE_CTOR(CreateDOMSelection, nsISelection, NS_NewDomSelection)
|
MAKE_CTOR(CreateDOMSelection, nsISelection, NS_NewDomSelection)
|
||||||
MAKE_CTOR(CreateRangeUtils, nsIRangeUtils, NS_NewRangeUtils)
|
|
||||||
MAKE_CTOR(CreateContentIterator, nsIContentIterator, NS_NewContentIterator)
|
MAKE_CTOR(CreateContentIterator, nsIContentIterator, NS_NewContentIterator)
|
||||||
MAKE_CTOR(CreatePreContentIterator, nsIContentIterator, NS_NewPreContentIterator)
|
MAKE_CTOR(CreatePreContentIterator, nsIContentIterator, NS_NewPreContentIterator)
|
||||||
MAKE_CTOR(CreateSubtreeIterator, nsIContentIterator, NS_NewContentSubtreeIterator)
|
MAKE_CTOR(CreateSubtreeIterator, nsIContentIterator, NS_NewContentSubtreeIterator)
|
||||||
@ -686,7 +683,6 @@ NS_DEFINE_NAMED_CID(NS_XMLDOCUMENT_CID);
|
|||||||
NS_DEFINE_NAMED_CID(NS_SVGDOCUMENT_CID);
|
NS_DEFINE_NAMED_CID(NS_SVGDOCUMENT_CID);
|
||||||
NS_DEFINE_NAMED_CID(NS_IMAGEDOCUMENT_CID);
|
NS_DEFINE_NAMED_CID(NS_IMAGEDOCUMENT_CID);
|
||||||
NS_DEFINE_NAMED_CID(NS_DOMSELECTION_CID);
|
NS_DEFINE_NAMED_CID(NS_DOMSELECTION_CID);
|
||||||
NS_DEFINE_NAMED_CID(NS_RANGEUTILS_CID);
|
|
||||||
NS_DEFINE_NAMED_CID(NS_CONTENTITERATOR_CID);
|
NS_DEFINE_NAMED_CID(NS_CONTENTITERATOR_CID);
|
||||||
NS_DEFINE_NAMED_CID(NS_PRECONTENTITERATOR_CID);
|
NS_DEFINE_NAMED_CID(NS_PRECONTENTITERATOR_CID);
|
||||||
NS_DEFINE_NAMED_CID(NS_SUBTREEITERATOR_CID);
|
NS_DEFINE_NAMED_CID(NS_SUBTREEITERATOR_CID);
|
||||||
@ -958,7 +954,6 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
|
|||||||
{ &kNS_SVGDOCUMENT_CID, false, NULL, CreateSVGDocument },
|
{ &kNS_SVGDOCUMENT_CID, false, NULL, CreateSVGDocument },
|
||||||
{ &kNS_IMAGEDOCUMENT_CID, false, NULL, CreateImageDocument },
|
{ &kNS_IMAGEDOCUMENT_CID, false, NULL, CreateImageDocument },
|
||||||
{ &kNS_DOMSELECTION_CID, false, NULL, CreateDOMSelection },
|
{ &kNS_DOMSELECTION_CID, false, NULL, CreateDOMSelection },
|
||||||
{ &kNS_RANGEUTILS_CID, false, NULL, CreateRangeUtils },
|
|
||||||
{ &kNS_CONTENTITERATOR_CID, false, NULL, CreateContentIterator },
|
{ &kNS_CONTENTITERATOR_CID, false, NULL, CreateContentIterator },
|
||||||
{ &kNS_PRECONTENTITERATOR_CID, false, NULL, CreatePreContentIterator },
|
{ &kNS_PRECONTENTITERATOR_CID, false, NULL, CreatePreContentIterator },
|
||||||
{ &kNS_SUBTREEITERATOR_CID, false, NULL, CreateSubtreeIterator },
|
{ &kNS_SUBTREEITERATOR_CID, false, NULL, CreateSubtreeIterator },
|
||||||
@ -1093,7 +1088,6 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
|
|||||||
{ "@mozilla.org/xml/xml-document;1", &kNS_XMLDOCUMENT_CID },
|
{ "@mozilla.org/xml/xml-document;1", &kNS_XMLDOCUMENT_CID },
|
||||||
{ "@mozilla.org/svg/svg-document;1", &kNS_SVGDOCUMENT_CID },
|
{ "@mozilla.org/svg/svg-document;1", &kNS_SVGDOCUMENT_CID },
|
||||||
{ "@mozilla.org/content/dom-selection;1", &kNS_DOMSELECTION_CID },
|
{ "@mozilla.org/content/dom-selection;1", &kNS_DOMSELECTION_CID },
|
||||||
{ "@mozilla.org/content/range-utils;1", &kNS_RANGEUTILS_CID },
|
|
||||||
{ "@mozilla.org/content/post-content-iterator;1", &kNS_CONTENTITERATOR_CID },
|
{ "@mozilla.org/content/post-content-iterator;1", &kNS_CONTENTITERATOR_CID },
|
||||||
{ "@mozilla.org/content/pre-content-iterator;1", &kNS_PRECONTENTITERATOR_CID },
|
{ "@mozilla.org/content/pre-content-iterator;1", &kNS_PRECONTENTITERATOR_CID },
|
||||||
{ "@mozilla.org/content/subtree-content-iterator;1", &kNS_SUBTREEITERATOR_CID },
|
{ "@mozilla.org/content/subtree-content-iterator;1", &kNS_SUBTREEITERATOR_CID },
|
||||||
|
@ -344,9 +344,6 @@ nsLayoutStatics::Shutdown()
|
|||||||
nsXBLWindowKeyHandler::ShutDown();
|
nsXBLWindowKeyHandler::ShutDown();
|
||||||
nsAutoCopyListener::Shutdown();
|
nsAutoCopyListener::Shutdown();
|
||||||
|
|
||||||
nsHTMLEditor::Shutdown();
|
|
||||||
nsTextServicesDocument::Shutdown();
|
|
||||||
|
|
||||||
#ifdef MOZ_SYDNEYAUDIO
|
#ifdef MOZ_SYDNEYAUDIO
|
||||||
nsAudioStream::ShutdownLibrary();
|
nsAudioStream::ShutdownLibrary();
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user