mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 813532 - Part a: Some cleanup for GetPriorHTMLNode; r=ehsan
This commit is contained in:
parent
962b5131ac
commit
5ebe7ea292
@ -4062,24 +4062,30 @@ nsHTMLEditor::GetNextHTMLSibling(nsIDOMNode *inParent, int32_t inOffset, nsCOMPt
|
||||
// GetPriorHTMLNode: returns the previous editable leaf node, if there is
|
||||
// one within the <body>
|
||||
//
|
||||
nsresult
|
||||
nsHTMLEditor::GetPriorHTMLNode(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing)
|
||||
nsIContent*
|
||||
nsHTMLEditor::GetPriorHTMLNode(nsINode* aNode, bool aNoBlockCrossing)
|
||||
{
|
||||
NS_ENSURE_TRUE(outNode, NS_ERROR_NULL_POINTER);
|
||||
MOZ_ASSERT(aNode);
|
||||
|
||||
nsIContent* activeEditingHost = GetActiveEditingHost();
|
||||
if (!activeEditingHost) {
|
||||
*outNode = nullptr;
|
||||
return NS_OK;
|
||||
if (!GetActiveEditingHost()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsresult res = GetPriorNode(inNode, true, address_of(*outNode),
|
||||
bNoBlockCrossing);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
return GetPriorNode(aNode, true, aNoBlockCrossing);
|
||||
}
|
||||
|
||||
NS_ASSERTION(!*outNode || IsDescendantOfEditorRoot(*outNode),
|
||||
"GetPriorNode screwed up");
|
||||
return res;
|
||||
nsresult
|
||||
nsHTMLEditor::GetPriorHTMLNode(nsIDOMNode* aNode,
|
||||
nsCOMPtr<nsIDOMNode>* aResultNode,
|
||||
bool aNoBlockCrossing)
|
||||
{
|
||||
NS_ENSURE_TRUE(aResultNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
|
||||
NS_ENSURE_TRUE(node, NS_ERROR_NULL_POINTER);
|
||||
|
||||
*aResultNode = do_QueryInterface(GetPriorHTMLNode(node, aNoBlockCrossing));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -4090,6 +4096,8 @@ nsIContent*
|
||||
nsHTMLEditor::GetPriorHTMLNode(nsINode* aParent, int32_t aOffset,
|
||||
bool aNoBlockCrossing)
|
||||
{
|
||||
MOZ_ASSERT(aParent);
|
||||
|
||||
if (!GetActiveEditingHost()) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -4098,23 +4106,18 @@ nsHTMLEditor::GetPriorHTMLNode(nsINode* aParent, int32_t aOffset,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::GetPriorHTMLNode(nsIDOMNode *inParent, int32_t inOffset, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing)
|
||||
nsHTMLEditor::GetPriorHTMLNode(nsIDOMNode* aNode, int32_t aOffset,
|
||||
nsCOMPtr<nsIDOMNode>* aResultNode,
|
||||
bool aNoBlockCrossing)
|
||||
{
|
||||
NS_ENSURE_TRUE(outNode, NS_ERROR_NULL_POINTER);
|
||||
NS_ENSURE_TRUE(aResultNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsIContent* activeEditingHost = GetActiveEditingHost();
|
||||
if (!activeEditingHost) {
|
||||
*outNode = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
|
||||
NS_ENSURE_TRUE(node, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsresult res = GetPriorNode(inParent, inOffset, true, address_of(*outNode),
|
||||
bNoBlockCrossing);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
NS_ASSERTION(!*outNode || IsDescendantOfEditorRoot(*outNode),
|
||||
"GetPriorNode screwed up");
|
||||
return res;
|
||||
*aResultNode = do_QueryInterface(GetPriorHTMLNode(node, aOffset,
|
||||
aNoBlockCrossing));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -676,18 +676,23 @@ protected:
|
||||
bool IsOnlyAttribute(const nsIContent* aElement, const nsAString& aAttribute);
|
||||
|
||||
nsresult RemoveBlockContainer(nsIDOMNode *inNode);
|
||||
|
||||
nsIContent* GetPriorHTMLSibling(nsINode* aNode);
|
||||
nsresult GetPriorHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode);
|
||||
nsIContent* GetPriorHTMLSibling(nsINode* aParent, int32_t aOffset);
|
||||
nsresult GetPriorHTMLSibling(nsIDOMNode *inParent, int32_t inOffset, nsCOMPtr<nsIDOMNode> *outNode);
|
||||
|
||||
nsIContent* GetNextHTMLSibling(nsINode* aNode);
|
||||
nsresult GetNextHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode);
|
||||
nsIContent* GetNextHTMLSibling(nsINode* aParent, int32_t aOffset);
|
||||
nsresult GetNextHTMLSibling(nsIDOMNode *inParent, int32_t inOffset, nsCOMPtr<nsIDOMNode> *outNode);
|
||||
|
||||
nsIContent* GetPriorHTMLNode(nsINode* aNode, bool aNoBlockCrossing = false);
|
||||
nsresult GetPriorHTMLNode(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
|
||||
nsresult GetPriorHTMLNode(nsIDOMNode *inParent, int32_t inOffset, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
|
||||
nsIContent* GetPriorHTMLNode(nsINode* aParent, int32_t aOffset,
|
||||
bool aNoBlockCrossing = false);
|
||||
nsresult GetPriorHTMLNode(nsIDOMNode *inParent, int32_t inOffset, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
|
||||
|
||||
nsresult GetNextHTMLNode(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
|
||||
nsIContent* GetNextHTMLNode(nsINode* aParent, int32_t aOffset,
|
||||
bool aNoBlockCrossing = false);
|
||||
|
Loading…
Reference in New Issue
Block a user