зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1432186 part 17. Remove nsIDOMNode's parentNode attribute. r=mccr8
MozReview-Commit-ID: 4xzDwwEqnvE
This commit is contained in:
Родитель
37aaea3c1f
Коммит
4d88c28e4d
|
@ -1550,11 +1550,11 @@ nsHTMLCopyEncoder::PromoteAncestorChain(nsCOMPtr<nsIDOMNode> *ioNode,
|
|||
// loop for as long as we can promote both endpoints
|
||||
while (!done)
|
||||
{
|
||||
rv = (*ioNode)->GetParentNode(getter_AddRefs(parent));
|
||||
if ((NS_FAILED(rv)) || !parent)
|
||||
node = do_QueryInterface(*ioNode);
|
||||
parent = do_QueryInterface(node->GetParentNode());
|
||||
if (!parent) {
|
||||
done = true;
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// passing parent as last param to GetPromotedPoint() allows it to promote only one level
|
||||
// up the hierarchy.
|
||||
rv = GetPromotedPoint( kStart, *ioNode, *ioStartOffset, address_of(frontNode), &frontOffset, parent);
|
||||
|
@ -1791,21 +1791,23 @@ nsHTMLCopyEncoder::GetNodeLocation(nsIDOMNode *inChild,
|
|||
int32_t *outOffset)
|
||||
{
|
||||
NS_ASSERTION((inChild && outParent && outOffset), "bad args");
|
||||
nsresult result = NS_ERROR_NULL_POINTER;
|
||||
if (inChild && outParent && outOffset)
|
||||
{
|
||||
result = inChild->GetParentNode(getter_AddRefs(*outParent));
|
||||
if ((NS_SUCCEEDED(result)) && (*outParent))
|
||||
{
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(*outParent);
|
||||
nsCOMPtr<nsIContent> cChild = do_QueryInterface(inChild);
|
||||
if (!cChild || !content)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*outOffset = content->ComputeIndexOf(cChild);
|
||||
nsCOMPtr<nsIContent> child = do_QueryInterface(inChild);
|
||||
if (!child) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
nsIContent* parent = child->GetParent();
|
||||
if (!parent) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*outParent = do_QueryInterface(parent);
|
||||
*outOffset = parent->ComputeIndexOf(child);
|
||||
return NS_OK;
|
||||
}
|
||||
return result;
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -514,16 +514,6 @@ nsINode::IsAnonymousContentInSVGUseSubtree() const
|
|||
return parent && parent->IsSVGElement(nsGkAtoms::use);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsINode::GetParentNode(nsIDOMNode** aParentNode)
|
||||
{
|
||||
*aParentNode = nullptr;
|
||||
|
||||
nsINode *parent = GetParentNode();
|
||||
|
||||
return parent ? CallQueryInterface(parent, aParentNode) : NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsINode::GetNodeValueInternal(nsAString& aNodeValue)
|
||||
{
|
||||
|
|
|
@ -2074,10 +2074,6 @@ protected:
|
|||
virtual void CheckNotNativeAnonymous() const;
|
||||
#endif
|
||||
|
||||
// These are just used to implement nsIDOMNode using
|
||||
// NS_FORWARD_NSIDOMNODE_TO_NSINODE_HELPER and for quickstubs.
|
||||
nsresult GetParentNode(nsIDOMNode** aParentNode);
|
||||
|
||||
void EnsurePreInsertionValidity1(nsINode& aNewChild, nsINode* aRefChild,
|
||||
mozilla::ErrorResult& aError);
|
||||
void EnsurePreInsertionValidity2(bool aReplace, nsINode& aNewChild,
|
||||
|
@ -2262,16 +2258,8 @@ ToCanonicalSupports(nsINode* aPointer)
|
|||
return aPointer;
|
||||
}
|
||||
|
||||
#define NS_FORWARD_NSIDOMNODE_TO_NSINODE_HELPER(...) \
|
||||
NS_IMETHOD GetParentNode(nsIDOMNode** aParentNode) __VA_ARGS__ override \
|
||||
{ \
|
||||
return nsINode::GetParentNode(aParentNode); \
|
||||
}
|
||||
#define NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
|
||||
#define NS_FORWARD_NSIDOMNODE_TO_NSINODE \
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE_HELPER(final)
|
||||
|
||||
#define NS_FORWARD_NSIDOMNODE_TO_NSINODE_OVERRIDABLE \
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE_HELPER()
|
||||
#define NS_FORWARD_NSIDOMNODE_TO_NSINODE_OVERRIDABLE
|
||||
|
||||
#endif /* nsINode_h___ */
|
||||
|
|
|
@ -31,6 +31,4 @@ interface nsIDOMNode : nsISupports
|
|||
const unsigned short DOCUMENT_TYPE_NODE = 10;
|
||||
const unsigned short DOCUMENT_FRAGMENT_NODE = 11;
|
||||
const unsigned short NOTATION_NODE = 12;
|
||||
|
||||
readonly attribute nsIDOMNode parentNode;
|
||||
};
|
||||
|
|
|
@ -3560,9 +3560,9 @@ EditorBase::GetNodeLocation(nsIDOMNode* aChild,
|
|||
NS_ENSURE_TRUE(aChild && outOffset, nullptr);
|
||||
*outOffset = -1;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
nsCOMPtr<nsINode> child = do_QueryInterface(aChild);
|
||||
nsCOMPtr<nsIDOMNode> parent = do_QueryInterface(child->GetParentNode());
|
||||
|
||||
MOZ_ALWAYS_SUCCEEDS(aChild->GetParentNode(getter_AddRefs(parent)));
|
||||
if (parent) {
|
||||
*outOffset = GetChildOffset(aChild, parent);
|
||||
}
|
||||
|
@ -4983,16 +4983,15 @@ EditorBase::AppendNodeToSelectionAsRange(nsIDOMNode* aNode)
|
|||
RefPtr<Selection> selection = GetSelection();
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> parentNode;
|
||||
nsresult rv = aNode->GetParentNode(getter_AddRefs(parentNode));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
|
||||
nsCOMPtr<nsIDOMNode> parentNode = do_QueryInterface(node->GetParentNode());
|
||||
NS_ENSURE_TRUE(parentNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
int32_t offset = GetChildOffset(aNode, parentNode);
|
||||
|
||||
RefPtr<nsRange> range;
|
||||
rv = CreateRange(parentNode, offset, parentNode, offset + 1,
|
||||
getter_AddRefs(range));
|
||||
nsresult rv = CreateRange(parentNode, offset, parentNode, offset + 1,
|
||||
getter_AddRefs(range));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(range, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
|
|
@ -1004,7 +1004,7 @@ HTMLEditRules::GetIndentState(bool* aCanIndent,
|
|||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
bool useCSS = mHTMLEditor->IsCSSEnabled();
|
||||
for (auto& curNode : Reversed(arrayOfNodes)) {
|
||||
if (HTMLEditUtils::IsNodeThatCanOutdent(GetAsDOMNode(curNode))) {
|
||||
if (HTMLEditUtils::IsNodeThatCanOutdent(curNode)) {
|
||||
*aCanOutdent = true;
|
||||
break;
|
||||
} else if (useCSS) {
|
||||
|
@ -1037,7 +1037,7 @@ HTMLEditRules::GetIndentState(bool* aCanIndent,
|
|||
|
||||
// gather up info we need for test
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
nsCOMPtr<nsIDOMNode> parent, tmp, root = do_QueryInterface(mHTMLEditor->GetRoot());
|
||||
nsCOMPtr<nsINode> parent, root = mHTMLEditor->GetRoot();
|
||||
NS_ENSURE_TRUE(root, NS_ERROR_NULL_POINTER);
|
||||
int32_t selOffset;
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
|
@ -1053,8 +1053,7 @@ HTMLEditRules::GetIndentState(bool* aCanIndent,
|
|||
*aCanOutdent = true;
|
||||
break;
|
||||
}
|
||||
tmp = parent;
|
||||
tmp->GetParentNode(getter_AddRefs(parent));
|
||||
parent = parent->GetParentNode();
|
||||
}
|
||||
|
||||
// test end parent hierarchy
|
||||
|
@ -1066,8 +1065,7 @@ HTMLEditRules::GetIndentState(bool* aCanIndent,
|
|||
*aCanOutdent = true;
|
||||
break;
|
||||
}
|
||||
tmp = parent;
|
||||
tmp->GetParentNode(getter_AddRefs(parent));
|
||||
parent = parent->GetParentNode();
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -1123,7 +1121,7 @@ HTMLEditRules::GetParagraphState(bool* aMixed,
|
|||
|
||||
// remember root node
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
nsCOMPtr<nsIDOMElement> rootElem = do_QueryInterface(mHTMLEditor->GetRoot());
|
||||
nsCOMPtr<Element> rootElem = mHTMLEditor->GetRoot();
|
||||
NS_ENSURE_TRUE(rootElem, NS_ERROR_NULL_POINTER);
|
||||
|
||||
// loop through the nodes in selection and examine their paragraph format
|
||||
|
@ -1131,7 +1129,7 @@ HTMLEditRules::GetParagraphState(bool* aMixed,
|
|||
nsAutoString format;
|
||||
// if it is a known format node we have it easy
|
||||
if (HTMLEditUtils::IsFormatNode(curNode)) {
|
||||
GetFormatString(GetAsDOMNode(curNode), format);
|
||||
GetFormatString(curNode, format);
|
||||
} else if (IsBlockNode(curNode)) {
|
||||
// this is a div or some other non-format block.
|
||||
// we should ignore it. Its children were appended to this list
|
||||
|
@ -1139,8 +1137,7 @@ HTMLEditRules::GetParagraphState(bool* aMixed,
|
|||
// info when we examine them instead.
|
||||
continue;
|
||||
} else {
|
||||
nsCOMPtr<nsIDOMNode> node, tmp = GetAsDOMNode(curNode);
|
||||
tmp->GetParentNode(getter_AddRefs(node));
|
||||
nsINode* node = curNode->GetParentNode();
|
||||
while (node) {
|
||||
if (node == rootElem) {
|
||||
format.Truncate(0);
|
||||
|
@ -1150,8 +1147,7 @@ HTMLEditRules::GetParagraphState(bool* aMixed,
|
|||
break;
|
||||
}
|
||||
// else keep looking up
|
||||
tmp = node;
|
||||
tmp->GetParentNode(getter_AddRefs(node));
|
||||
node = node->GetParentNode();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1202,14 +1198,13 @@ HTMLEditRules::AppendInnerFormatNodes(nsTArray<OwningNonNull<nsINode>>& aArray,
|
|||
}
|
||||
|
||||
nsresult
|
||||
HTMLEditRules::GetFormatString(nsIDOMNode* aNode,
|
||||
HTMLEditRules::GetFormatString(nsINode* aNode,
|
||||
nsAString& outFormat)
|
||||
{
|
||||
NS_ENSURE_TRUE(aNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
if (HTMLEditUtils::IsFormatNode(aNode)) {
|
||||
RefPtr<nsAtom> atom = EditorBase::GetTag(aNode);
|
||||
atom->ToString(outFormat);
|
||||
aNode->NodeInfo()->NameAtom()->ToString(outFormat);
|
||||
} else {
|
||||
outFormat.Truncate();
|
||||
}
|
||||
|
@ -1864,8 +1859,8 @@ HTMLEditRules::InsertBRElement(Selection& aSelection,
|
|||
}
|
||||
// If the container of the break is a link, we need to split it and
|
||||
// insert new <br> between the split links.
|
||||
nsCOMPtr<nsIDOMNode> linkDOMNode;
|
||||
if (htmlEditor->IsInLink(pointToBreak.GetContainerAsDOMNode(),
|
||||
nsCOMPtr<nsINode> linkDOMNode;
|
||||
if (htmlEditor->IsInLink(pointToBreak.GetContainer(),
|
||||
address_of(linkDOMNode))) {
|
||||
nsCOMPtr<Element> linkNode = do_QueryInterface(linkDOMNode);
|
||||
if (NS_WARN_IF(!linkNode)) {
|
||||
|
|
|
@ -281,7 +281,7 @@ protected:
|
|||
nsresult AlignBlockContents(nsIDOMNode* aNode, const nsAString* alignType);
|
||||
nsresult AppendInnerFormatNodes(nsTArray<OwningNonNull<nsINode>>& aArray,
|
||||
nsINode* aNode);
|
||||
nsresult GetFormatString(nsIDOMNode* aNode, nsAString &outFormat);
|
||||
nsresult GetFormatString(nsINode* aNode, nsAString &outFormat);
|
||||
enum class Lists { no, yes };
|
||||
enum class Tables { no, yes };
|
||||
void GetInnerContent(nsINode& aNode,
|
||||
|
|
|
@ -85,17 +85,16 @@ HTMLEditUtils::IsFormatNode(nsINode* aNode)
|
|||
* blockquote.
|
||||
*/
|
||||
bool
|
||||
HTMLEditUtils::IsNodeThatCanOutdent(nsIDOMNode* aNode)
|
||||
HTMLEditUtils::IsNodeThatCanOutdent(nsINode* aNode)
|
||||
{
|
||||
MOZ_ASSERT(aNode);
|
||||
RefPtr<nsAtom> nodeAtom = EditorBase::GetTag(aNode);
|
||||
return (nodeAtom == nsGkAtoms::ul)
|
||||
|| (nodeAtom == nsGkAtoms::ol)
|
||||
|| (nodeAtom == nsGkAtoms::dl)
|
||||
|| (nodeAtom == nsGkAtoms::li)
|
||||
|| (nodeAtom == nsGkAtoms::dd)
|
||||
|| (nodeAtom == nsGkAtoms::dt)
|
||||
|| (nodeAtom == nsGkAtoms::blockquote);
|
||||
return aNode->IsAnyOfHTMLElements(nsGkAtoms::ul,
|
||||
nsGkAtoms::ol,
|
||||
nsGkAtoms::dl,
|
||||
nsGkAtoms::li,
|
||||
nsGkAtoms::dd,
|
||||
nsGkAtoms::dt,
|
||||
nsGkAtoms::blockquote);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
static bool IsInlineStyle(nsIDOMNode *aNode);
|
||||
static bool IsFormatNode(nsINode* aNode);
|
||||
static bool IsFormatNode(nsIDOMNode* aNode);
|
||||
static bool IsNodeThatCanOutdent(nsIDOMNode* aNode);
|
||||
static bool IsNodeThatCanOutdent(nsINode* aNode);
|
||||
static bool IsHeader(nsINode& aNode);
|
||||
static bool IsHeader(nsIDOMNode* aNode);
|
||||
static bool IsParagraph(nsIDOMNode* aNode);
|
||||
|
|
|
@ -1628,9 +1628,7 @@ HTMLEditor::SetCaretAfterElement(nsIDOMElement* aElement)
|
|||
|
||||
RefPtr<Selection> selection = GetSelection();
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
|
||||
nsCOMPtr<nsIDOMNode>parent;
|
||||
nsresult rv = aElement->GetParentNode(getter_AddRefs(parent));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsINode> parent = element->GetParentNode();
|
||||
NS_ENSURE_TRUE(parent, NS_ERROR_NULL_POINTER);
|
||||
// Collapse selection to just after desired element,
|
||||
EditorRawDOMPoint afterElement(element);
|
||||
|
|
|
@ -726,7 +726,7 @@ protected:
|
|||
nsresult ParseCFHTML(nsCString& aCfhtml, char16_t** aStuffToPaste,
|
||||
char16_t** aCfcontext);
|
||||
|
||||
bool IsInLink(nsIDOMNode* aNode, nsCOMPtr<nsIDOMNode>* outLink = nullptr);
|
||||
bool IsInLink(nsINode* aNode, nsCOMPtr<nsINode>* outLink = nullptr);
|
||||
nsresult StripFormattingNodes(nsIContent& aNode, bool aOnlyList = false);
|
||||
nsresult CreateDOMFragmentFromPaste(const nsAString& aInputString,
|
||||
const nsAString& aContextStr,
|
||||
|
|
|
@ -360,7 +360,7 @@ HTMLEditor::DoInsertHTMLWithContext(const nsAString& aInputString,
|
|||
}
|
||||
|
||||
// Remember if we are in a link.
|
||||
bool bStartedInLink = IsInLink(pointToInsert.GetContainerAsDOMNode());
|
||||
bool bStartedInLink = IsInLink(pointToInsert.GetContainer());
|
||||
|
||||
// Are we in a text node? If so, split it.
|
||||
if (pointToInsert.IsInTextNode()) {
|
||||
|
@ -658,9 +658,9 @@ HTMLEditor::DoInsertHTMLWithContext(const nsAString& aInputString,
|
|||
selection->Collapse(selNode, selOffset);
|
||||
|
||||
// if we just pasted a link, discontinue link style
|
||||
nsCOMPtr<nsIDOMNode> link;
|
||||
nsCOMPtr<nsINode> link;
|
||||
if (!bStartedInLink &&
|
||||
IsInLink(GetAsDOMNode(selNode), address_of(link))) {
|
||||
IsInLink(selNode, address_of(link))) {
|
||||
// so, if we just pasted a link, I split it. Why do that instead of just
|
||||
// nudging selection point beyond it? Because it might have ended in a BR
|
||||
// that is not visible. If so, the code above just placed selection
|
||||
|
@ -686,14 +686,14 @@ HTMLEditor::DoInsertHTMLWithContext(const nsAString& aInputString,
|
|||
}
|
||||
|
||||
bool
|
||||
HTMLEditor::IsInLink(nsIDOMNode* aNode,
|
||||
nsCOMPtr<nsIDOMNode>* outLink)
|
||||
HTMLEditor::IsInLink(nsINode* aNode,
|
||||
nsCOMPtr<nsINode>* outLink)
|
||||
{
|
||||
NS_ENSURE_TRUE(aNode, false);
|
||||
if (outLink) {
|
||||
*outLink = nullptr;
|
||||
}
|
||||
nsCOMPtr<nsIDOMNode> tmp, node = aNode;
|
||||
nsINode* node = aNode;
|
||||
while (node) {
|
||||
if (HTMLEditUtils::IsLink(node)) {
|
||||
if (outLink) {
|
||||
|
@ -701,8 +701,7 @@ HTMLEditor::IsInLink(nsIDOMNode* aNode,
|
|||
}
|
||||
return true;
|
||||
}
|
||||
tmp = node;
|
||||
tmp->GetParentNode(getter_AddRefs(node));
|
||||
node = node->GetParentNode();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -2864,18 +2864,17 @@ HTMLEditor::GetCellContext(Selection** aSelection,
|
|||
}
|
||||
}
|
||||
if (aCellParent) {
|
||||
nsCOMPtr <nsIDOMNode> cellParent;
|
||||
nsCOMPtr<nsINode> cellNode = do_QueryInterface(cell);
|
||||
// Get the immediate parent of the cell
|
||||
rv = cell->GetParentNode(getter_AddRefs(cellParent));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsINode* cellParent = cellNode->GetParentNode();
|
||||
// Cell has to have a parent, so fail if not found
|
||||
NS_ENSURE_TRUE(cellParent, NS_ERROR_FAILURE);
|
||||
|
||||
*aCellParent = cellParent.get();
|
||||
*aCellParent = cellParent->AsDOMNode();
|
||||
NS_ADDREF(*aCellParent);
|
||||
|
||||
if (aCellOffset) {
|
||||
*aCellOffset = GetChildOffset(cell, cellParent);
|
||||
*aCellOffset = GetChildOffset(cell, cellParent->AsDOMNode());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3132,9 +3131,8 @@ HTMLEditor::SetSelectionAfterTableEdit(nsIDOMElement* aTable,
|
|||
|
||||
// We didn't find a cell
|
||||
// Set selection to just before the table
|
||||
nsCOMPtr<nsIDOMNode> tableParent;
|
||||
nsresult rv = aTable->GetParentNode(getter_AddRefs(tableParent));
|
||||
if (NS_SUCCEEDED(rv) && tableParent) {
|
||||
nsCOMPtr<nsINode> table = do_QueryInterface(aTable);
|
||||
if (table->GetParentNode()) {
|
||||
nsCOMPtr<nsIContent> table = do_QueryInterface(aTable);
|
||||
if (NS_WARN_IF(!table)) {
|
||||
return;
|
||||
|
|
|
@ -3668,27 +3668,26 @@ nsDocumentViewer::GetPopupLinkNode(nsIDOMNode** aNode)
|
|||
*aNode = nullptr;
|
||||
|
||||
// find popup node
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsresult rv = GetPopupNode(getter_AddRefs(node));
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
nsresult rv = GetPopupNode(getter_AddRefs(domNode));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(domNode);
|
||||
|
||||
// find out if we have a link in our ancestry
|
||||
while (node) {
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
|
||||
if (content) {
|
||||
nsCOMPtr<nsIURI> hrefURI = content->GetHrefURI();
|
||||
if (hrefURI) {
|
||||
*aNode = node;
|
||||
*aNode = node->AsDOMNode();
|
||||
NS_IF_ADDREF(*aNode); // addref
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
// get our parent and keep trying...
|
||||
nsCOMPtr<nsIDOMNode> parentNode;
|
||||
node->GetParentNode(getter_AddRefs(parentNode));
|
||||
node = parentNode;
|
||||
node = node->GetParentNode();
|
||||
}
|
||||
|
||||
// if we have no node, fail
|
||||
|
|
|
@ -899,17 +899,18 @@ nsFind::SkipNode(nsIContent* aContent)
|
|||
nsresult
|
||||
nsFind::GetBlockParent(nsIDOMNode* aNode, nsIDOMNode** aParent)
|
||||
{
|
||||
while (aNode) {
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
nsresult rv = aNode->GetParentNode(getter_AddRefs(parent));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(parent));
|
||||
if (content && IsBlockNode(content)) {
|
||||
*aParent = parent;
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
|
||||
// non-nsCOMPtr temporary so we don't keep addrefing/releasing as we
|
||||
// go up the tree.
|
||||
nsINode* curNode = node;
|
||||
while (curNode) {
|
||||
nsIContent* parent = curNode->GetParent();
|
||||
if (parent && IsBlockNode(parent)) {
|
||||
*aParent = parent->AsDOMNode();
|
||||
NS_ADDREF(*aParent);
|
||||
return NS_OK;
|
||||
}
|
||||
aNode = parent;
|
||||
curNode = parent;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
|
|
@ -569,8 +569,9 @@ nsTypeAheadFind::FindItNow(nsIPresShell *aPresShell, bool aIsLinksOnly,
|
|||
// We may be inside an editable element, and therefore the selection
|
||||
// may be controlled by a different selection controller. Walk up the
|
||||
// chain of parent nodes to see if we find one.
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
returnRange->GetStartContainer(getter_AddRefs(node));
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
returnRange->GetStartContainer(getter_AddRefs(domNode));
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(domNode);
|
||||
while (node) {
|
||||
nsCOMPtr<nsIDOMNSEditableElement> editable = do_QueryInterface(node);
|
||||
if (editable) {
|
||||
|
@ -599,8 +600,7 @@ nsTypeAheadFind::FindItNow(nsIPresShell *aPresShell, bool aIsLinksOnly,
|
|||
fm->SetFocus(mFoundEditable, 0);
|
||||
break;
|
||||
}
|
||||
nsIDOMNode* tmp = node;
|
||||
tmp->GetParentNode(getter_AddRefs(node));
|
||||
node = node->GetParentNode();
|
||||
}
|
||||
|
||||
// If we reach here without setting mFoundEditable, then something
|
||||
|
|
Загрузка…
Ссылка в новой задаче