mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1156062 part 2 - Make GetBlockNodeParent and GetEnclosingTable return regular pointers; r=ehsan
This commit is contained in:
parent
7bf421040d
commit
158db25f7d
@ -817,7 +817,7 @@ nsHTMLEditor::SetDocumentTitle(const nsAString &aTitle)
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// GetBlockNodeParent: returns enclosing block level ancestor, if any
|
// GetBlockNodeParent: returns enclosing block level ancestor, if any
|
||||||
//
|
//
|
||||||
already_AddRefed<Element>
|
Element*
|
||||||
nsHTMLEditor::GetBlockNodeParent(nsINode* aNode)
|
nsHTMLEditor::GetBlockNodeParent(nsINode* aNode)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aNode);
|
MOZ_ASSERT(aNode);
|
||||||
@ -826,7 +826,7 @@ nsHTMLEditor::GetBlockNodeParent(nsINode* aNode)
|
|||||||
|
|
||||||
while (p) {
|
while (p) {
|
||||||
if (NodeIsBlockStatic(p)) {
|
if (NodeIsBlockStatic(p)) {
|
||||||
return p.forget().downcast<Element>();
|
return p->AsElement();
|
||||||
}
|
}
|
||||||
p = p->GetParentNode();
|
p = p->GetParentNode();
|
||||||
}
|
}
|
||||||
@ -834,7 +834,7 @@ nsHTMLEditor::GetBlockNodeParent(nsINode* aNode)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<nsIDOMNode>
|
nsIDOMNode*
|
||||||
nsHTMLEditor::GetBlockNodeParent(nsIDOMNode *aNode)
|
nsHTMLEditor::GetBlockNodeParent(nsIDOMNode *aNode)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
|
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
|
||||||
@ -844,9 +844,7 @@ nsHTMLEditor::GetBlockNodeParent(nsIDOMNode *aNode)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMNode> ret =
|
return GetAsDOMNode(GetBlockNodeParent(node));
|
||||||
dont_AddRef(GetAsDOMNode(GetBlockNodeParent(node).take()));
|
|
||||||
return ret.forget();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char16_t nbsp = 160;
|
static const char16_t nbsp = 160;
|
||||||
@ -1065,7 +1063,7 @@ nsHTMLEditor::TabInTable(bool inIsShift, bool* outHandled)
|
|||||||
node = iter->GetCurrentNode();
|
node = iter->GetCurrentNode();
|
||||||
|
|
||||||
if (node && nsHTMLEditUtils::IsTableCell(node) &&
|
if (node && nsHTMLEditUtils::IsTableCell(node) &&
|
||||||
nsCOMPtr<Element>(GetEnclosingTable(node)) == table) {
|
GetEnclosingTable(node) == table) {
|
||||||
CollapseSelectionToDeepestNonTableFirstChild(nullptr, node);
|
CollapseSelectionToDeepestNonTableFirstChild(nullptr, node);
|
||||||
*outHandled = true;
|
*outHandled = true;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@ -3656,7 +3654,7 @@ nsHTMLEditor::SetCaretInTableCell(nsIDOMElement* aElement)
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// GetEnclosingTable: find ancestor who is a table, if any
|
// GetEnclosingTable: find ancestor who is a table, if any
|
||||||
//
|
//
|
||||||
already_AddRefed<Element>
|
Element*
|
||||||
nsHTMLEditor::GetEnclosingTable(nsINode* aNode)
|
nsHTMLEditor::GetEnclosingTable(nsINode* aNode)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aNode);
|
MOZ_ASSERT(aNode);
|
||||||
@ -3665,13 +3663,13 @@ nsHTMLEditor::GetEnclosingTable(nsINode* aNode)
|
|||||||
block;
|
block;
|
||||||
block = GetBlockNodeParent(block)) {
|
block = GetBlockNodeParent(block)) {
|
||||||
if (nsHTMLEditUtils::IsTable(block)) {
|
if (nsHTMLEditUtils::IsTable(block)) {
|
||||||
return block.forget();
|
return block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMNode>
|
nsIDOMNode*
|
||||||
nsHTMLEditor::GetEnclosingTable(nsIDOMNode *aNode)
|
nsHTMLEditor::GetEnclosingTable(nsIDOMNode *aNode)
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(aNode, "null node passed to nsHTMLEditor::GetEnclosingTable");
|
NS_PRECONDITION(aNode, "null node passed to nsHTMLEditor::GetEnclosingTable");
|
||||||
|
@ -231,8 +231,8 @@ public:
|
|||||||
nsresult SetHTMLBackgroundColor(const nsAString& aColor);
|
nsresult SetHTMLBackgroundColor(const nsAString& aColor);
|
||||||
|
|
||||||
/* ------------ Block methods moved from nsEditor -------------- */
|
/* ------------ Block methods moved from nsEditor -------------- */
|
||||||
static already_AddRefed<mozilla::dom::Element> GetBlockNodeParent(nsINode* aNode);
|
static mozilla::dom::Element* GetBlockNodeParent(nsINode* aNode);
|
||||||
static already_AddRefed<nsIDOMNode> GetBlockNodeParent(nsIDOMNode *aNode);
|
static nsIDOMNode* GetBlockNodeParent(nsIDOMNode* aNode);
|
||||||
|
|
||||||
void IsNextCharInNodeWhitespace(nsIContent* aContent,
|
void IsNextCharInNodeWhitespace(nsIContent* aContent,
|
||||||
int32_t aOffset,
|
int32_t aOffset,
|
||||||
@ -495,9 +495,8 @@ protected:
|
|||||||
|
|
||||||
// End of Table Editing utilities
|
// End of Table Editing utilities
|
||||||
|
|
||||||
static already_AddRefed<mozilla::dom::Element>
|
static mozilla::dom::Element* GetEnclosingTable(nsINode* aNode);
|
||||||
GetEnclosingTable(nsINode* aNode);
|
static nsIDOMNode* GetEnclosingTable(nsIDOMNode *aNode);
|
||||||
static nsCOMPtr<nsIDOMNode> GetEnclosingTable(nsIDOMNode *aNode);
|
|
||||||
|
|
||||||
/** content-based query returns true if <aProperty aAttribute=aValue> effects aNode
|
/** content-based query returns true if <aProperty aAttribute=aValue> effects aNode
|
||||||
* If <aProperty aAttribute=aValue> contains aNode,
|
* If <aProperty aAttribute=aValue> contains aNode,
|
||||||
|
Loading…
Reference in New Issue
Block a user