зеркало из https://github.com/mozilla/gecko-dev.git
Clean-up
1) fixed unit tests 2) fixed a bunch of leaks having to do with using enumerators. Thanks for noticing these, Simon. 3) fixed a tiny problem in nsTextEditRules::WillDoAction(). This method was overly aggressive in checking input args, sel can be null for some operations.
This commit is contained in:
Родитель
cc193da91f
Коммит
cc49e3182a
|
@ -146,7 +146,7 @@ nsresult TextEditorTest::TestTextProperties()
|
|||
nodeList->GetLength(&count);
|
||||
NS_ASSERTION(0!=count, "there are no text nodes in the document!");
|
||||
nsCOMPtr<nsIDOMNode>textNode;
|
||||
result = nodeList->Item(2, getter_AddRefs(textNode));
|
||||
result = nodeList->Item(count-1, getter_AddRefs(textNode));
|
||||
TEST_RESULT(result);
|
||||
TEST_POINTER(textNode.get());
|
||||
|
||||
|
@ -223,7 +223,7 @@ nsresult TextEditorTest::TestTextProperties()
|
|||
TEST_POINTER(nodeList.get());
|
||||
nodeList->GetLength(&count);
|
||||
NS_ASSERTION(0!=count, "there are no text nodes in the document!");
|
||||
result = nodeList->Item(3, getter_AddRefs(textNode));
|
||||
result = nodeList->Item(count-2, getter_AddRefs(textNode));
|
||||
TEST_RESULT(result);
|
||||
TEST_POINTER(textNode.get());
|
||||
textData = do_QueryInterface(textNode);
|
||||
|
|
|
@ -339,6 +339,7 @@ nsEditor::nsEditor()
|
|||
|
||||
nsEditor::~nsEditor()
|
||||
{
|
||||
|
||||
if (mActionListeners)
|
||||
{
|
||||
PRInt32 i;
|
||||
|
@ -363,6 +364,7 @@ nsEditor::~nsEditor()
|
|||
// Release service pointers
|
||||
if (mPrefs)
|
||||
nsServiceManager::ReleaseService(kPrefCID, mPrefs);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1902,9 +1904,9 @@ NS_IMETHODIMP nsEditor::CreateTxnForInsertText(const nsString & aStringToInsert,
|
|||
if (NS_SUCCEEDED(result) && enumerator)
|
||||
{
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
result = enumerator->CurrentItem(¤tItem);
|
||||
if ((NS_SUCCEEDED(result)) && (nsnull!=currentItem))
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
result = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
if ((NS_SUCCEEDED(result)) && (currentItem))
|
||||
{
|
||||
result = NS_ERROR_UNEXPECTED;
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
|
@ -2260,8 +2262,8 @@ NS_IMETHODIMP nsEditor::CreateTxnForDeleteSelection(nsIEditor::ECollapsedSelecti
|
|||
{
|
||||
for (enumerator->First(); NS_OK!=enumerator->IsDone(); enumerator->Next())
|
||||
{
|
||||
nsISupports *currentItem=nsnull;
|
||||
result = enumerator->CurrentItem(¤tItem);
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
result = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
if ((NS_SUCCEEDED(result)) && (currentItem))
|
||||
{
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
|
@ -3546,9 +3548,9 @@ nsEditor::BeginComposition(void)
|
|||
if (NS_SUCCEEDED(result) && enumerator)
|
||||
{
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
result = enumerator->CurrentItem(¤tItem);
|
||||
if ((NS_SUCCEEDED(result)) && (nsnull!=currentItem))
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
result = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
if ((NS_SUCCEEDED(result)) && (currentItem))
|
||||
{
|
||||
result = NS_ERROR_UNEXPECTED;
|
||||
nsCOMPtr<nsIDOMRange> range(do_QueryInterface(currentItem));
|
||||
|
@ -4250,8 +4252,8 @@ nsEditor::GetStartNodeAndOffset(nsIDOMSelection *aSelection,
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
if ((NS_FAILED(enumerator->CurrentItem(¤tItem))) || !currentItem)
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
if ((NS_FAILED(enumerator->CurrentItem(getter_AddRefs(currentItem)))) || !currentItem)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
|
@ -4285,8 +4287,8 @@ nsEditor::GetEndNodeAndOffset(nsIDOMSelection *aSelection,
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
if ((NS_FAILED(enumerator->CurrentItem(¤tItem))) || !currentItem)
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
if ((NS_FAILED(enumerator->CurrentItem(getter_AddRefs(currentItem)))) || !currentItem)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
|
|
|
@ -820,9 +820,9 @@ nsHTMLEditor::GetParagraphStyle(nsStringArray *aTagList)
|
|||
if (NS_SUCCEEDED(res) && enumerator)
|
||||
{
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
res = enumerator->CurrentItem(¤tItem);
|
||||
if ((NS_SUCCEEDED(res)) && (nsnull!=currentItem))
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
if ((NS_SUCCEEDED(res)) && (currentItem))
|
||||
{
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
// scan the range for all the independent block content blockSections
|
||||
|
@ -900,9 +900,9 @@ nsHTMLEditor::AddBlockParent(nsString& aParentTag)
|
|||
if (enumerator)
|
||||
{
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
res = enumerator->CurrentItem(¤tItem);
|
||||
if ((NS_SUCCEEDED(res)) && (nsnull!=currentItem))
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
if ((NS_SUCCEEDED(res)) && (currentItem))
|
||||
{
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
// scan the range for all the independent block content blockSections
|
||||
|
@ -951,9 +951,9 @@ nsHTMLEditor::ReplaceBlockParent(nsString& aParentTag)
|
|||
if (NS_SUCCEEDED(res) && enumerator)
|
||||
{
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
res = enumerator->CurrentItem(¤tItem);
|
||||
if ((NS_SUCCEEDED(res)) && (nsnull!=currentItem))
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
if ((NS_SUCCEEDED(res)) && (currentItem))
|
||||
{
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
// scan the range for all the independent block content blockSections
|
||||
|
@ -1342,9 +1342,9 @@ nsHTMLEditor::RemoveParagraphStyle()
|
|||
if (NS_SUCCEEDED(res) && enumerator)
|
||||
{
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
res = enumerator->CurrentItem(¤tItem);
|
||||
if ((NS_SUCCEEDED(res)) && (nsnull!=currentItem))
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
if ((NS_SUCCEEDED(res)) && (currentItem))
|
||||
{
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
res = RemoveParagraphStyleFromRange(range);
|
||||
|
@ -1462,9 +1462,9 @@ nsHTMLEditor::RemoveParent(const nsString &aParentTag)
|
|||
if (NS_SUCCEEDED(res) && enumerator)
|
||||
{
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
res = enumerator->CurrentItem(¤tItem);
|
||||
if ((NS_SUCCEEDED(res)) && (nsnull!=currentItem))
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
if ((NS_SUCCEEDED(res)) && (currentItem))
|
||||
{
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
res = RemoveParentFromRange(aParentTag, range);
|
||||
|
@ -2106,8 +2106,8 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu
|
|||
if (NS_SUCCEEDED(res) && enumerator)
|
||||
{
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
res = enumerator->CurrentItem(¤tItem);
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
if ((NS_SUCCEEDED(res)) && currentItem)
|
||||
{
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
|
|
|
@ -115,7 +115,8 @@ NS_IMETHODIMP
|
|||
nsTextEditRules::WillDoAction(nsIDOMSelection *aSelection,
|
||||
nsRulesInfo *aInfo, PRBool *aCancel)
|
||||
{
|
||||
if (!aSelection || !aInfo || !aCancel) { return NS_ERROR_NULL_POINTER; }
|
||||
// null selection is legal
|
||||
if (!aInfo || !aCancel) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
*aCancel = PR_FALSE;
|
||||
|
||||
|
|
|
@ -414,9 +414,9 @@ NS_IMETHODIMP nsTextEditor::SetTextProperty(nsIAtom *aProperty,
|
|||
if (NS_SUCCEEDED(result) && enumerator)
|
||||
{
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
result = enumerator->CurrentItem(¤tItem);
|
||||
if ((NS_SUCCEEDED(result)) && (nsnull!=currentItem))
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
result = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
if ((NS_SUCCEEDED(result)) && (currentItem))
|
||||
{
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
nsCOMPtr<nsIDOMNode>commonParent;
|
||||
|
@ -531,8 +531,8 @@ NS_IMETHODIMP nsTextEditor::GetTextProperty(nsIAtom *aProperty,
|
|||
if (NS_SUCCEEDED(result) && enumerator)
|
||||
{
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
result = enumerator->CurrentItem(¤tItem);
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
result = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
// XXX: should be a while loop, to get each separate range
|
||||
if ((NS_SUCCEEDED(result)) && currentItem)
|
||||
{
|
||||
|
@ -758,9 +758,9 @@ NS_IMETHODIMP nsTextEditor::RemoveTextProperty(nsIAtom *aProperty, const nsStrin
|
|||
if (NS_SUCCEEDED(result) && enumerator)
|
||||
{
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
result = enumerator->CurrentItem(¤tItem);
|
||||
if ((NS_SUCCEEDED(result)) && (nsnull!=currentItem))
|
||||
nsCOMPtr<nsISupports>currentItem;
|
||||
result = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
if ((NS_SUCCEEDED(result)) && (currentItem))
|
||||
{
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
nsCOMPtr<nsIDOMNode>commonParent;
|
||||
|
@ -857,9 +857,9 @@ void nsTextEditor::GetTextSelectionOffsetsForRange(nsIDOMSelection *aSelection,
|
|||
if (NS_SUCCEEDED(result) && enumerator)
|
||||
{
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
result = enumerator->CurrentItem(¤tItem);
|
||||
if ((NS_SUCCEEDED(result)) && (nsnull!=currentItem))
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
result = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
if ((NS_SUCCEEDED(result)) && currentItem)
|
||||
{
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
range->GetCommonParent(aParent);
|
||||
|
@ -1508,7 +1508,8 @@ NS_IMETHODIMP nsTextEditor::OutputToString(nsString& aOutputString,
|
|||
nsTextRulesInfo ruleInfo(nsTextEditRules::kOutputText);
|
||||
ruleInfo.outString = &resultString;
|
||||
nsresult rv = mRules->WillDoAction(nsnull, &ruleInfo, &cancel);
|
||||
if ((PR_TRUE==cancel) && (NS_SUCCEEDED(rv)))
|
||||
if (NS_FAILED(rv)) { return rv; }
|
||||
if (PR_TRUE==cancel)
|
||||
{ // this case will get triggered by password fields
|
||||
aOutputString = *(ruleInfo.outString);
|
||||
}
|
||||
|
@ -2984,9 +2985,9 @@ nsresult nsTextEditor::GetTextSelectionOffsets(nsIDOMSelection *aSelection,
|
|||
{
|
||||
// don't use "result" in this block
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
nsresult findParentResult = enumerator->CurrentItem(¤tItem);
|
||||
if ((NS_SUCCEEDED(findParentResult)) && (nsnull!=currentItem))
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
nsresult findParentResult = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
if ((NS_SUCCEEDED(findParentResult)) && (currentItem))
|
||||
{
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
range->GetCommonParent(getter_AddRefs(parentNode));
|
||||
|
|
|
@ -339,6 +339,7 @@ nsEditor::nsEditor()
|
|||
|
||||
nsEditor::~nsEditor()
|
||||
{
|
||||
|
||||
if (mActionListeners)
|
||||
{
|
||||
PRInt32 i;
|
||||
|
@ -363,6 +364,7 @@ nsEditor::~nsEditor()
|
|||
// Release service pointers
|
||||
if (mPrefs)
|
||||
nsServiceManager::ReleaseService(kPrefCID, mPrefs);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1902,9 +1904,9 @@ NS_IMETHODIMP nsEditor::CreateTxnForInsertText(const nsString & aStringToInsert,
|
|||
if (NS_SUCCEEDED(result) && enumerator)
|
||||
{
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
result = enumerator->CurrentItem(¤tItem);
|
||||
if ((NS_SUCCEEDED(result)) && (nsnull!=currentItem))
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
result = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
if ((NS_SUCCEEDED(result)) && (currentItem))
|
||||
{
|
||||
result = NS_ERROR_UNEXPECTED;
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
|
@ -2260,8 +2262,8 @@ NS_IMETHODIMP nsEditor::CreateTxnForDeleteSelection(nsIEditor::ECollapsedSelecti
|
|||
{
|
||||
for (enumerator->First(); NS_OK!=enumerator->IsDone(); enumerator->Next())
|
||||
{
|
||||
nsISupports *currentItem=nsnull;
|
||||
result = enumerator->CurrentItem(¤tItem);
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
result = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
if ((NS_SUCCEEDED(result)) && (currentItem))
|
||||
{
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
|
@ -3546,9 +3548,9 @@ nsEditor::BeginComposition(void)
|
|||
if (NS_SUCCEEDED(result) && enumerator)
|
||||
{
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
result = enumerator->CurrentItem(¤tItem);
|
||||
if ((NS_SUCCEEDED(result)) && (nsnull!=currentItem))
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
result = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
if ((NS_SUCCEEDED(result)) && (currentItem))
|
||||
{
|
||||
result = NS_ERROR_UNEXPECTED;
|
||||
nsCOMPtr<nsIDOMRange> range(do_QueryInterface(currentItem));
|
||||
|
@ -4250,8 +4252,8 @@ nsEditor::GetStartNodeAndOffset(nsIDOMSelection *aSelection,
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
if ((NS_FAILED(enumerator->CurrentItem(¤tItem))) || !currentItem)
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
if ((NS_FAILED(enumerator->CurrentItem(getter_AddRefs(currentItem)))) || !currentItem)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
|
@ -4285,8 +4287,8 @@ nsEditor::GetEndNodeAndOffset(nsIDOMSelection *aSelection,
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
if ((NS_FAILED(enumerator->CurrentItem(¤tItem))) || !currentItem)
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
if ((NS_FAILED(enumerator->CurrentItem(getter_AddRefs(currentItem)))) || !currentItem)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
|
|
|
@ -146,7 +146,7 @@ nsresult TextEditorTest::TestTextProperties()
|
|||
nodeList->GetLength(&count);
|
||||
NS_ASSERTION(0!=count, "there are no text nodes in the document!");
|
||||
nsCOMPtr<nsIDOMNode>textNode;
|
||||
result = nodeList->Item(2, getter_AddRefs(textNode));
|
||||
result = nodeList->Item(count-1, getter_AddRefs(textNode));
|
||||
TEST_RESULT(result);
|
||||
TEST_POINTER(textNode.get());
|
||||
|
||||
|
@ -223,7 +223,7 @@ nsresult TextEditorTest::TestTextProperties()
|
|||
TEST_POINTER(nodeList.get());
|
||||
nodeList->GetLength(&count);
|
||||
NS_ASSERTION(0!=count, "there are no text nodes in the document!");
|
||||
result = nodeList->Item(3, getter_AddRefs(textNode));
|
||||
result = nodeList->Item(count-2, getter_AddRefs(textNode));
|
||||
TEST_RESULT(result);
|
||||
TEST_POINTER(textNode.get());
|
||||
textData = do_QueryInterface(textNode);
|
||||
|
|
|
@ -820,9 +820,9 @@ nsHTMLEditor::GetParagraphStyle(nsStringArray *aTagList)
|
|||
if (NS_SUCCEEDED(res) && enumerator)
|
||||
{
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
res = enumerator->CurrentItem(¤tItem);
|
||||
if ((NS_SUCCEEDED(res)) && (nsnull!=currentItem))
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
if ((NS_SUCCEEDED(res)) && (currentItem))
|
||||
{
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
// scan the range for all the independent block content blockSections
|
||||
|
@ -900,9 +900,9 @@ nsHTMLEditor::AddBlockParent(nsString& aParentTag)
|
|||
if (enumerator)
|
||||
{
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
res = enumerator->CurrentItem(¤tItem);
|
||||
if ((NS_SUCCEEDED(res)) && (nsnull!=currentItem))
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
if ((NS_SUCCEEDED(res)) && (currentItem))
|
||||
{
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
// scan the range for all the independent block content blockSections
|
||||
|
@ -951,9 +951,9 @@ nsHTMLEditor::ReplaceBlockParent(nsString& aParentTag)
|
|||
if (NS_SUCCEEDED(res) && enumerator)
|
||||
{
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
res = enumerator->CurrentItem(¤tItem);
|
||||
if ((NS_SUCCEEDED(res)) && (nsnull!=currentItem))
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
if ((NS_SUCCEEDED(res)) && (currentItem))
|
||||
{
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
// scan the range for all the independent block content blockSections
|
||||
|
@ -1342,9 +1342,9 @@ nsHTMLEditor::RemoveParagraphStyle()
|
|||
if (NS_SUCCEEDED(res) && enumerator)
|
||||
{
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
res = enumerator->CurrentItem(¤tItem);
|
||||
if ((NS_SUCCEEDED(res)) && (nsnull!=currentItem))
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
if ((NS_SUCCEEDED(res)) && (currentItem))
|
||||
{
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
res = RemoveParagraphStyleFromRange(range);
|
||||
|
@ -1462,9 +1462,9 @@ nsHTMLEditor::RemoveParent(const nsString &aParentTag)
|
|||
if (NS_SUCCEEDED(res) && enumerator)
|
||||
{
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
res = enumerator->CurrentItem(¤tItem);
|
||||
if ((NS_SUCCEEDED(res)) && (nsnull!=currentItem))
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
if ((NS_SUCCEEDED(res)) && (currentItem))
|
||||
{
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
res = RemoveParentFromRange(aParentTag, range);
|
||||
|
@ -2106,8 +2106,8 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu
|
|||
if (NS_SUCCEEDED(res) && enumerator)
|
||||
{
|
||||
enumerator->First();
|
||||
nsISupports *currentItem;
|
||||
res = enumerator->CurrentItem(¤tItem);
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
if ((NS_SUCCEEDED(res)) && currentItem)
|
||||
{
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
|
|
|
@ -115,7 +115,8 @@ NS_IMETHODIMP
|
|||
nsTextEditRules::WillDoAction(nsIDOMSelection *aSelection,
|
||||
nsRulesInfo *aInfo, PRBool *aCancel)
|
||||
{
|
||||
if (!aSelection || !aInfo || !aCancel) { return NS_ERROR_NULL_POINTER; }
|
||||
// null selection is legal
|
||||
if (!aInfo || !aCancel) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
*aCancel = PR_FALSE;
|
||||
|
||||
|
|
|
@ -40,11 +40,6 @@ class nsIFileSpec;
|
|||
#define TEXT_EDITOR_FLAG_DISABLED 0x10 // all events are disabled (like scrolling). Editor will not accept focus.
|
||||
#define TEXT_EDITOR_FLAG_FILTER 0x20 // text input is limited to certain character types, use mFilter
|
||||
|
||||
// XXX Text filters are extremely preliminary and should not yet be used!
|
||||
// Need to work with international group to rationalize restricted input
|
||||
#define TEXT_EDITOR_FILTER_NUMBERS 0x01 // ignore numbers
|
||||
#define TEXT_EDITOR_FILTER_LETTERS 0x02 // ignore a-z,A-Z
|
||||
#define TEXT_EDITOR_FILTER_NONALPHANUMBERIC 0x04 // accept only numbers and letters
|
||||
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче