зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1360154 - Part 1. DocumentIsBody should return bool, not nsresult. r=masayuki
nsIEditRules::GetDocumentIsEmpty doesn't return error without null parameter, so we should use bool as return value instead. MozReview-Commit-ID: HIoQmKu6ETF --HG-- extra : rebase_source : 570452e7072d8e0e837bb2822c9c0ab9c0d1a8cf
This commit is contained in:
Родитель
2bf9485071
Коммит
353b47086e
|
@ -3576,15 +3576,11 @@ HTMLEditor::SelectEntireDocument(Selection* aSelection)
|
|||
// Protect the edit rules object from dying
|
||||
nsCOMPtr<nsIEditRules> rules(mRules);
|
||||
|
||||
// get editor root node
|
||||
nsCOMPtr<nsIDOMElement> rootElement = do_QueryInterface(GetRoot());
|
||||
|
||||
// is doc empty?
|
||||
bool bDocIsEmpty;
|
||||
nsresult rv = rules->DocumentIsEmpty(&bDocIsEmpty);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (rules->DocumentIsEmpty()) {
|
||||
// get editor root node
|
||||
Element* rootElement = GetRoot();
|
||||
|
||||
if (bDocIsEmpty) {
|
||||
// if its empty dont select entire doc - that would select the bogus node
|
||||
return aSelection->Collapse(rootElement, 0);
|
||||
}
|
||||
|
|
|
@ -326,13 +326,10 @@ TextEditRules::DidDoAction(Selection* aSelection,
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TextEditRules::DocumentIsEmpty(bool* aDocumentIsEmpty)
|
||||
NS_IMETHODIMP_(bool)
|
||||
TextEditRules::DocumentIsEmpty()
|
||||
{
|
||||
NS_ENSURE_TRUE(aDocumentIsEmpty, NS_ERROR_NULL_POINTER);
|
||||
|
||||
*aDocumentIsEmpty = (mBogusNode != nullptr);
|
||||
return NS_OK;
|
||||
return (mBogusNode != nullptr);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
bool* aCancel, bool* aHandled) override;
|
||||
NS_IMETHOD DidDoAction(Selection* aSelection, RulesInfo* aInfo,
|
||||
nsresult aResult) override;
|
||||
NS_IMETHOD DocumentIsEmpty(bool* aDocumentIsEmpty) override;
|
||||
NS_IMETHOD_(bool) DocumentIsEmpty() override;
|
||||
NS_IMETHOD DocumentModified() override;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -862,8 +862,8 @@ TextEditor::GetDocumentIsEmpty(bool* aDocumentIsEmpty)
|
|||
|
||||
// Protect the edit rules object from dying
|
||||
nsCOMPtr<nsIEditRules> rules(mRules);
|
||||
|
||||
return rules->DocumentIsEmpty(aDocumentIsEmpty);
|
||||
*aDocumentIsEmpty = rules->DocumentIsEmpty();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1549,8 +1549,7 @@ TextEditor::SelectEntireDocument(Selection* aSelection)
|
|||
nsCOMPtr<nsIEditRules> rules(mRules);
|
||||
|
||||
// is doc empty?
|
||||
bool bDocIsEmpty;
|
||||
if (NS_SUCCEEDED(rules->DocumentIsEmpty(&bDocIsEmpty)) && bDocIsEmpty) {
|
||||
if (rules->DocumentIsEmpty()) {
|
||||
// get root node
|
||||
nsCOMPtr<nsIDOMElement> rootElement = do_QueryInterface(GetRoot());
|
||||
NS_ENSURE_TRUE(rootElement, NS_ERROR_FAILURE);
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
bool* aHandled) = 0;
|
||||
NS_IMETHOD DidDoAction(mozilla::dom::Selection* aSelection,
|
||||
mozilla::RulesInfo* aInfo, nsresult aResult) = 0;
|
||||
NS_IMETHOD DocumentIsEmpty(bool* aDocumentIsEmpty) = 0;
|
||||
NS_IMETHOD_(bool) DocumentIsEmpty() = 0;
|
||||
NS_IMETHOD DocumentModified() = 0;
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче