mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 682367 - Call nsINode::GetChildAt less. r=smaug
This commit is contained in:
parent
80c1d2656d
commit
f28bcb747a
@ -569,7 +569,7 @@ nsContentIterator::GetDeepFirstChild(nsINode *aRoot,
|
||||
}
|
||||
|
||||
nsINode *n = aRoot;
|
||||
nsINode *nChild = n->GetChildAt(0);
|
||||
nsINode *nChild = n->GetFirstChild();
|
||||
|
||||
while (nChild)
|
||||
{
|
||||
@ -579,7 +579,7 @@ nsContentIterator::GetDeepFirstChild(nsINode *aRoot,
|
||||
aIndexes->AppendElement(0);
|
||||
}
|
||||
n = nChild;
|
||||
nChild = n->GetChildAt(0);
|
||||
nChild = n->GetFirstChild();
|
||||
}
|
||||
|
||||
return n;
|
||||
@ -747,7 +747,7 @@ nsContentIterator::NextNode(nsINode *aNode, nsTArray<PRInt32> *aIndexes)
|
||||
// if it has children then next node is first child
|
||||
if (NodeHasChildren(n))
|
||||
{
|
||||
nsINode *nFirstChild = n->GetChildAt(0);
|
||||
nsINode *nFirstChild = n->GetFirstChild();
|
||||
|
||||
// update cache
|
||||
if (aIndexes)
|
||||
@ -889,7 +889,8 @@ nsContentIterator::PrevNode(nsINode *aNode, nsTArray<PRInt32> *aIndexes)
|
||||
// if it has children then prev node is last child
|
||||
if (numChildren)
|
||||
{
|
||||
nsINode *nLastChild = n->GetChildAt(--numChildren);
|
||||
nsINode *nLastChild = n->GetLastChild();
|
||||
numChildren--;
|
||||
|
||||
// update cache
|
||||
if (aIndexes)
|
||||
@ -1300,7 +1301,7 @@ nsresult nsContentSubtreeIterator::Init(nsIDOMRange* aRange)
|
||||
// short circuit when start node == end node
|
||||
if (startParent == endParent)
|
||||
{
|
||||
nsINode* nChild = nStartP->GetChildAt(0);
|
||||
nsINode* nChild = nStartP->GetFirstChild();
|
||||
|
||||
if (!nChild) // no children, must be a text node or empty container
|
||||
{
|
||||
@ -1490,7 +1491,7 @@ nsContentSubtreeIterator::Next()
|
||||
{
|
||||
// as long as we are finding ancestors of the endpoint of the range,
|
||||
// dive down into their children
|
||||
nextNode = nextNode->GetChildAt(0);
|
||||
nextNode = nextNode->GetFirstChild();
|
||||
NS_ASSERTION(nextNode, "Iterator error, expected a child node!");
|
||||
|
||||
// should be impossible to get a null pointer. If we went all the way
|
||||
|
@ -3782,9 +3782,9 @@ nsContentUtils::SetNodeTextContent(nsIContent* aContent,
|
||||
|
||||
static void AppendNodeTextContentsRecurse(nsINode* aNode, nsAString& aResult)
|
||||
{
|
||||
nsIContent* child;
|
||||
PRUint32 i;
|
||||
for (i = 0; (child = aNode->GetChildAt(i)); ++i) {
|
||||
for (nsIContent* child = aNode->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsElement()) {
|
||||
AppendNodeTextContentsRecurse(child, aResult);
|
||||
}
|
||||
@ -3806,9 +3806,9 @@ nsContentUtils::AppendNodeTextContent(nsINode* aNode, PRBool aDeep,
|
||||
AppendNodeTextContentsRecurse(aNode, aResult);
|
||||
}
|
||||
else {
|
||||
nsIContent* child;
|
||||
PRUint32 i;
|
||||
for (i = 0; (child = aNode->GetChildAt(i)); ++i) {
|
||||
for (nsIContent* child = aNode->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsNodeOfType(nsINode::eTEXT)) {
|
||||
child->AppendTextTo(aResult);
|
||||
}
|
||||
@ -3819,9 +3819,9 @@ nsContentUtils::AppendNodeTextContent(nsINode* aNode, PRBool aDeep,
|
||||
PRBool
|
||||
nsContentUtils::HasNonEmptyTextContent(nsINode* aNode)
|
||||
{
|
||||
nsIContent* child;
|
||||
PRUint32 i;
|
||||
for (i = 0; (child = aNode->GetChildAt(i)); ++i) {
|
||||
for (nsIContent* child = aNode->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsNodeOfType(nsINode::eTEXT) &&
|
||||
child->TextLength() > 0) {
|
||||
return PR_TRUE;
|
||||
|
@ -4933,12 +4933,11 @@ GetElementByAttribute(nsIContent* aContent, nsIAtom* aAttrName,
|
||||
return CallQueryInterface(aContent, aResult);
|
||||
}
|
||||
|
||||
PRUint32 childCount = aContent->GetChildCount();
|
||||
for (nsIContent* child = aContent->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
|
||||
for (PRUint32 i = 0; i < childCount; ++i) {
|
||||
nsIContent *current = aContent->GetChildAt(i);
|
||||
|
||||
GetElementByAttribute(current, aAttrName, aAttrValue, aUniversalMatch,
|
||||
GetElementByAttribute(child, aAttrName, aAttrValue, aUniversalMatch,
|
||||
aResult);
|
||||
|
||||
if (*aResult)
|
||||
@ -5115,10 +5114,11 @@ nsIDocument::GetHtmlChildElement(nsIAtom* aTag)
|
||||
|
||||
// Look for the element with aTag inside html. This needs to run
|
||||
// forwards to find the first such element.
|
||||
for (PRUint32 i = 0; i < html->GetChildCount(); ++i) {
|
||||
nsIContent* result = html->GetChildAt(i);
|
||||
if (result->Tag() == aTag && result->IsHTML())
|
||||
return result->AsElement();
|
||||
for (nsIContent* child = html->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsHTML(aTag))
|
||||
return child->AsElement();
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
@ -6013,7 +6013,7 @@ BlastSubtreeToPieces(nsINode *aNode)
|
||||
|
||||
count = aNode->GetChildCount();
|
||||
for (i = 0; i < count; ++i) {
|
||||
BlastSubtreeToPieces(aNode->GetChildAt(0));
|
||||
BlastSubtreeToPieces(aNode->GetFirstChild());
|
||||
#ifdef DEBUG
|
||||
nsresult rv =
|
||||
#endif
|
||||
|
@ -458,7 +458,7 @@ nsINode::GetChildNodes(nsIDOMNodeList** aChildNodes)
|
||||
nsresult
|
||||
nsINode::GetFirstChild(nsIDOMNode** aNode)
|
||||
{
|
||||
nsIContent* child = GetChildAt(0);
|
||||
nsIContent* child = GetFirstChild();
|
||||
if (child) {
|
||||
return CallQueryInterface(child, aNode);
|
||||
}
|
||||
@ -2875,9 +2875,9 @@ BindNodesInInsertPoints(nsXBLBinding* aBinding, nsIContent* aInsertParent,
|
||||
nsCOMPtr<nsIContent> insertRoot =
|
||||
inserts->ElementAt(i)->GetDefaultContent();
|
||||
if (insertRoot) {
|
||||
PRUint32 j;
|
||||
for (j = 0; j < insertRoot->GetChildCount(); ++j) {
|
||||
nsCOMPtr<nsIContent> child = insertRoot->GetChildAt(j);
|
||||
for (nsCOMPtr<nsIContent> child = insertRoot->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
rv = child->BindToTree(aDocument, aInsertParent,
|
||||
aBinding->GetBoundElement(), allowScripts);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -3009,9 +3009,9 @@ nsGenericElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
if (contBinding) {
|
||||
nsCOMPtr<nsIContent> anonRoot = contBinding->GetAnonymousContent();
|
||||
PRBool allowScripts = contBinding->AllowScripts();
|
||||
PRUint32 i;
|
||||
for (i = 0; i < anonRoot->GetChildCount(); ++i) {
|
||||
nsCOMPtr<nsIContent> child = anonRoot->GetChildAt(i);
|
||||
for (nsCOMPtr<nsIContent> child = anonRoot->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
rv = child->BindToTree(aDocument, this, this, allowScripts);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
@ -3941,11 +3941,10 @@ PRBool IsAllowedAsChild(nsIContent* aNewChild, nsINode* aParent,
|
||||
}
|
||||
|
||||
PRBool sawElement = PR_FALSE;
|
||||
PRUint32 count = aNewChild->GetChildCount();
|
||||
for (PRUint32 index = 0; index < count; ++index) {
|
||||
nsIContent* childContent = aNewChild->GetChildAt(index);
|
||||
NS_ASSERTION(childContent, "Something went wrong");
|
||||
if (childContent->IsElement()) {
|
||||
for (nsIContent* child = aNewChild->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsElement()) {
|
||||
if (sawElement) {
|
||||
// Can't put two elements into a document
|
||||
return PR_FALSE;
|
||||
@ -3954,7 +3953,7 @@ PRBool IsAllowedAsChild(nsIContent* aNewChild, nsINode* aParent,
|
||||
}
|
||||
// If we can put this content at the the right place, we might be ok;
|
||||
// if not, we bail out.
|
||||
if (!IsAllowedAsChild(childContent, aParent, aIsReplace, aRefChild)) {
|
||||
if (!IsAllowedAsChild(child, aParent, aIsReplace, aRefChild)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
@ -4128,8 +4127,9 @@ nsINode::ReplaceOrInsertBefore(PRBool aReplace, nsINode* aNewChild,
|
||||
// mutations to the fragment while we're inserting.
|
||||
nsAutoTArray<nsCOMPtr<nsIContent>, 50> fragChildren;
|
||||
fragChildren.SetCapacity(count);
|
||||
for (PRUint32 i = 0; i < count; i++) {
|
||||
nsIContent* child = newContent->GetChildAt(i);
|
||||
for (nsIContent* child = newContent->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
NS_ASSERTION(child->GetCurrentDoc() == nsnull,
|
||||
"How did we get a child with a current doc?");
|
||||
fragChildren.AppendElement(child);
|
||||
@ -5000,13 +5000,12 @@ nsGenericElement::List(FILE* out, PRInt32 aIndent,
|
||||
fprintf(out, " primaryframe=%p", static_cast<void*>(GetPrimaryFrame()));
|
||||
fprintf(out, " refcount=%d<", mRefCnt.get());
|
||||
|
||||
PRUint32 i, length = GetChildCount();
|
||||
if (length > 0) {
|
||||
nsIContent* child = GetFirstChild();
|
||||
if (child) {
|
||||
fputs("\n", out);
|
||||
|
||||
for (i = 0; i < length; ++i) {
|
||||
nsIContent *kid = GetChildAt(i);
|
||||
kid->List(out, aIndent + 1);
|
||||
|
||||
for (; child; child = child->GetNextSibling()) {
|
||||
child->List(out, aIndent + 1);
|
||||
}
|
||||
|
||||
for (indent = aIndent; --indent >= 0; ) fputs(" ", out);
|
||||
@ -5027,12 +5026,13 @@ nsGenericElement::List(FILE* out, PRInt32 aIndent,
|
||||
getter_AddRefs(anonymousChildren));
|
||||
|
||||
if (anonymousChildren) {
|
||||
PRUint32 length;
|
||||
anonymousChildren->GetLength(&length);
|
||||
if (length > 0) {
|
||||
for (indent = aIndent; --indent >= 0; ) fputs(" ", out);
|
||||
fputs("anonymous-children<\n", out);
|
||||
|
||||
for (i = 0; i < length; ++i) {
|
||||
for (PRUint32 i = 0; i < length; ++i) {
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
anonymousChildren->Item(i, getter_AddRefs(node));
|
||||
nsCOMPtr<nsIContent> child = do_QueryInterface(node);
|
||||
@ -5050,13 +5050,14 @@ nsGenericElement::List(FILE* out, PRInt32 aIndent,
|
||||
getter_AddRefs(contentList));
|
||||
|
||||
NS_ASSERTION(contentList != nsnull, "oops, binding manager lied");
|
||||
|
||||
|
||||
PRUint32 length;
|
||||
contentList->GetLength(&length);
|
||||
if (length > 0) {
|
||||
for (indent = aIndent; --indent >= 0; ) fputs(" ", out);
|
||||
fputs("content-list<\n", out);
|
||||
|
||||
for (i = 0; i < length; ++i) {
|
||||
for (PRUint32 i = 0; i < length; ++i) {
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
contentList->Item(i, getter_AddRefs(node));
|
||||
nsCOMPtr<nsIContent> child = do_QueryInterface(node);
|
||||
@ -5087,11 +5088,11 @@ nsGenericElement::DumpContent(FILE* out, PRInt32 aIndent,
|
||||
|
||||
if(aIndent) fputs("\n", out);
|
||||
|
||||
PRInt32 index, kids = GetChildCount();
|
||||
for (index = 0; index < kids; index++) {
|
||||
nsIContent *kid = GetChildAt(index);
|
||||
for (nsIContent* child = GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
PRInt32 indent = aIndent ? aIndent + 1 : 0;
|
||||
kid->DumpContent(out, indent, aDumpAll);
|
||||
child->DumpContent(out, indent, aDumpAll);
|
||||
}
|
||||
for (indent = aIndent; --indent >= 0; ) fputs(" ", out);
|
||||
fputs("</", out);
|
||||
|
@ -659,10 +659,11 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, PRBool aClone, PRBool aDeep,
|
||||
// XXX End of workaround for broken attribute nodes.
|
||||
else if (aDeep || aNode->IsNodeOfType(nsINode::eATTRIBUTE)) {
|
||||
// aNode's children.
|
||||
PRUint32 i, length = aNode->GetChildCount();
|
||||
for (i = 0; i < length; ++i) {
|
||||
for (nsIContent* cloneChild = aNode->GetFirstChild();
|
||||
cloneChild;
|
||||
cloneChild = cloneChild->GetNextSibling()) {
|
||||
nsCOMPtr<nsINode> child;
|
||||
rv = CloneAndAdopt(aNode->GetChildAt(i), aClone, PR_TRUE, nodeInfoManager,
|
||||
rv = CloneAndAdopt(cloneChild, aClone, PR_TRUE, nodeInfoManager,
|
||||
aCx, aNewScope, aNodesWithProperties, clone,
|
||||
getter_AddRefs(child));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -1926,13 +1926,10 @@ nsObjectLoadingContent::GetPluginSupportState(nsIContent* aContent,
|
||||
PRBool hasAlternateContent = PR_FALSE;
|
||||
|
||||
// Search for a child <param> with a pluginurl name
|
||||
PRUint32 count = aContent->GetChildCount();
|
||||
for (PRUint32 i = 0; i < count; ++i) {
|
||||
nsIContent* child = aContent->GetChildAt(i);
|
||||
NS_ASSERTION(child, "GetChildCount lied!");
|
||||
|
||||
if (child->IsHTML() &&
|
||||
child->Tag() == nsGkAtoms::param) {
|
||||
for (nsIContent* child = aContent->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsHTML(nsGkAtoms::param)) {
|
||||
if (child->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
|
||||
NS_LITERAL_STRING("pluginurl"), eIgnoreCase)) {
|
||||
return GetPluginDisabledState(aContentType);
|
||||
|
@ -498,11 +498,10 @@ nsXHTMLContentSerializer::AfterElementStart(nsIContent * aContent,
|
||||
// If there are, they will be modified to use the correct charset.
|
||||
// If there aren't, we'll insert one here.
|
||||
PRBool hasMeta = PR_FALSE;
|
||||
PRUint32 i, childCount = aContent->GetChildCount();
|
||||
for (i = 0; i < childCount; ++i) {
|
||||
nsIContent* child = aContent->GetChildAt(i);
|
||||
if (child->IsHTML() &&
|
||||
child->Tag() == nsGkAtoms::meta &&
|
||||
for (nsIContent* child = aContent->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsHTML(nsGkAtoms::meta) &&
|
||||
child->HasAttr(kNameSpaceID_None, nsGkAtoms::content)) {
|
||||
nsAutoString header;
|
||||
child->GetAttr(kNameSpaceID_None, nsGkAtoms::httpEquiv, header);
|
||||
@ -1019,12 +1018,10 @@ nsXHTMLContentSerializer::IsFirstChildOfOL(nsIContent* aElement)
|
||||
PRBool
|
||||
nsXHTMLContentSerializer::HasNoChildren(nsIContent * aContent) {
|
||||
|
||||
PRUint32 i, childCount = aContent->GetChildCount();
|
||||
|
||||
for (i = 0; i < childCount; ++i) {
|
||||
|
||||
nsIContent* child = aContent->GetChildAt(i);
|
||||
|
||||
for (nsIContent* child = aContent->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
|
||||
if (!child->IsNodeOfType(nsINode::eTEXT))
|
||||
return PR_FALSE;
|
||||
|
||||
|
@ -3661,14 +3661,10 @@ nsGenericHTMLElement::SyncEditorsOnSubtree(nsIContent* content)
|
||||
}
|
||||
|
||||
/* Sync all children */
|
||||
PRUint32 childCount = content->GetChildCount();
|
||||
for (PRUint32 i = 0; i < childCount; ++i) {
|
||||
nsIContent* childContent = content->GetChildAt(i);
|
||||
NS_ASSERTION(childContent,
|
||||
"DOM mutated unexpectedly while syncing editors!");
|
||||
if (childContent) {
|
||||
SyncEditorsOnSubtree(childContent);
|
||||
}
|
||||
for (nsIContent* child = content->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
SyncEditorsOnSubtree(child);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -603,13 +603,10 @@ NS_IMETHODIMP nsHTMLMediaElement::Load()
|
||||
|
||||
static PRBool HasSourceChildren(nsIContent *aElement)
|
||||
{
|
||||
PRUint32 count = aElement->GetChildCount();
|
||||
for (PRUint32 i = 0; i < count; ++i) {
|
||||
nsIContent* child = aElement->GetChildAt(i);
|
||||
NS_ASSERTION(child, "GetChildCount lied!");
|
||||
if (child &&
|
||||
child->Tag() == nsGkAtoms::source &&
|
||||
child->IsHTML())
|
||||
for (nsIContent* child = aElement->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsHTML(nsGkAtoms::source))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -2528,9 +2525,7 @@ nsIContent* nsHTMLMediaElement::GetNextSource()
|
||||
nsIContent* child = GetChildAt(startOffset);
|
||||
|
||||
// If child is a <source> element, it is the next candidate.
|
||||
if (child &&
|
||||
child->Tag() == nsGkAtoms::source &&
|
||||
child->IsHTML())
|
||||
if (child && child->IsHTML(nsGkAtoms::source))
|
||||
{
|
||||
mSourceLoadCandidate = child;
|
||||
return child;
|
||||
|
@ -391,9 +391,10 @@ nsHTMLSelectElement::InsertOptionsIntoListRecurse(nsIContent* aOptions,
|
||||
if (aOptions->IsHTML(nsGkAtoms::optgroup)) {
|
||||
mOptGroupCount++;
|
||||
|
||||
PRUint32 numChildren = aOptions->GetChildCount();
|
||||
for (PRUint32 i = 0; i < numChildren; ++i) {
|
||||
nsresult rv = InsertOptionsIntoListRecurse(aOptions->GetChildAt(i),
|
||||
for (nsIContent* child = aOptions->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
nsresult rv = InsertOptionsIntoListRecurse(child,
|
||||
aInsertIndex, aDepth+1);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
@ -435,9 +436,11 @@ nsHTMLSelectElement::RemoveOptionsFromListRecurse(nsIContent* aOptions,
|
||||
if (mOptGroupCount && aOptions->IsHTML(nsGkAtoms::optgroup)) {
|
||||
mOptGroupCount--;
|
||||
|
||||
PRUint32 numChildren = aOptions->GetChildCount();
|
||||
for (PRUint32 i = 0; i < numChildren; ++i) {
|
||||
nsresult rv = RemoveOptionsFromListRecurse(aOptions->GetChildAt(i),
|
||||
for (nsIContent* child = aOptions->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
|
||||
nsresult rv = RemoveOptionsFromListRecurse(child,
|
||||
aRemoveIndex,
|
||||
aNumRemoved,
|
||||
aDepth + 1);
|
||||
|
@ -410,12 +410,11 @@ nsHTMLTableElement::SetCaption(nsIDOMHTMLTableCaptionElement* aValue)
|
||||
already_AddRefed<nsIDOMHTMLTableSectionElement>
|
||||
nsHTMLTableElement::GetSection(nsIAtom *aTag)
|
||||
{
|
||||
PRUint32 childCount = GetChildCount();
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLTableSectionElement> section;
|
||||
|
||||
for (PRUint32 i = 0; i < childCount; ++i) {
|
||||
nsIContent *child = GetChildAt(i);
|
||||
for (nsIContent* child = nsINode::GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
|
||||
section = do_QueryInterface(child);
|
||||
|
||||
@ -767,9 +766,9 @@ nsHTMLTableElement::InsertRow(PRInt32 aIndex, nsIDOMHTMLElement** aValue)
|
||||
nsCOMPtr<nsIDOMNode> rowGroup;
|
||||
|
||||
PRInt32 namespaceID = mNodeInfo->NamespaceID();
|
||||
PRUint32 childCount = GetChildCount();
|
||||
for (PRUint32 i = 0; i < childCount; ++i) {
|
||||
nsIContent* child = GetChildAt(i);
|
||||
for (nsIContent* child = nsINode::GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
nsINodeInfo *childInfo = child->NodeInfo();
|
||||
nsIAtom *localName = childInfo->NameAtom();
|
||||
if (childInfo->NamespaceID() == namespaceID &&
|
||||
|
@ -531,7 +531,7 @@ nsTextInputSelectionImpl::CompleteMove(PRBool aForward, PRBool aExtend)
|
||||
|
||||
if (offset > 0)
|
||||
{
|
||||
nsIContent *child = parentDIV->GetChildAt(offset - 1);
|
||||
nsIContent *child = parentDIV->GetLastChild();
|
||||
|
||||
if (child->Tag() == nsGkAtoms::br)
|
||||
{
|
||||
@ -1753,7 +1753,7 @@ nsTextEditorState::SetValue(const nsAString& aValue, PRBool aUserInput)
|
||||
// Grab the current value directly from the text node to make sure that we
|
||||
// deal with stale data correctly.
|
||||
NS_ASSERTION(mRootNode, "We should have a root node here");
|
||||
nsIContent *textContent = mRootNode->GetChildAt(0);
|
||||
nsIContent *textContent = mRootNode->GetFirstChild();
|
||||
nsCOMPtr<nsIDOMCharacterData> textNode = do_QueryInterface(textContent);
|
||||
if (textNode) {
|
||||
textNode->GetData(currentValue);
|
||||
@ -1978,8 +1978,8 @@ nsTextEditorState::UpdatePlaceholderText(PRBool aNotify)
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
|
||||
content->GetAttr(kNameSpaceID_None, nsGkAtoms::placeholder, placeholderValue);
|
||||
nsContentUtils::RemoveNewlines(placeholderValue);
|
||||
NS_ASSERTION(mPlaceholderDiv->GetChildAt(0), "placeholder div has no child");
|
||||
mPlaceholderDiv->GetChildAt(0)->SetText(placeholderValue, aNotify);
|
||||
NS_ASSERTION(mPlaceholderDiv->GetFirstChild(), "placeholder div has no child");
|
||||
mPlaceholderDiv->GetFirstChild()->SetText(placeholderValue, aNotify);
|
||||
ValueWasChanged(aNotify);
|
||||
}
|
||||
|
||||
|
@ -2700,9 +2700,9 @@ static void
|
||||
NotifyEditableStateChange(nsINode *aNode, nsIDocument *aDocument,
|
||||
PRBool aEditable)
|
||||
{
|
||||
PRUint32 i, n = aNode->GetChildCount();
|
||||
for (i = 0; i < n; ++i) {
|
||||
nsIContent *child = aNode->GetChildAt(i);
|
||||
for (nsIContent* child = aNode->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->HasFlag(NODE_IS_EDITABLE) != aEditable &&
|
||||
child->IsElement()) {
|
||||
child->AsElement()->UpdateState(true);
|
||||
|
@ -157,9 +157,9 @@ SVGMotionSMILAnimationFunction::GetCalcMode() const
|
||||
static nsSVGMpathElement*
|
||||
GetFirstMpathChild(nsIContent* aElem)
|
||||
{
|
||||
PRUint32 childCount = aElem->GetChildCount();
|
||||
for (PRUint32 i = 0; i < childCount; ++i) {
|
||||
nsIContent* child = aElem->GetChildAt(i);
|
||||
for (nsIContent* child = aElem->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->Tag() == nsGkAtoms::mpath &&
|
||||
child->GetNameSpaceID() == kNameSpaceID_SVG) {
|
||||
return static_cast<nsSVGMpathElement*>(child);
|
||||
|
@ -1826,10 +1826,12 @@ nsSVGFEComponentTransferElement::Filter(nsSVGFilterInstance *instance,
|
||||
for (int i=0; i<256; i++)
|
||||
tableR[i] = tableG[i] = tableB[i] = tableA[i] = i;
|
||||
PRUint8* tables[] = { tableR, tableG, tableB, tableA };
|
||||
PRUint32 count = GetChildCount();
|
||||
for (PRUint32 k = 0; k < count; k++) {
|
||||
for (nsIContent* childContent = nsINode::GetFirstChild();
|
||||
childContent;
|
||||
childContent = childContent->GetNextSibling()) {
|
||||
|
||||
nsRefPtr<nsSVGComponentTransferFunctionElement> child;
|
||||
CallQueryInterface(GetChildAt(k),
|
||||
CallQueryInterface(childContent,
|
||||
(nsSVGComponentTransferFunctionElement**)getter_AddRefs(child));
|
||||
if (child) {
|
||||
child->GenerateLookupTable(tables[child->GetChannel()]);
|
||||
@ -2377,9 +2379,9 @@ nsSVGFEMergeElement::Filter(nsSVGFilterInstance *instance,
|
||||
void
|
||||
nsSVGFEMergeElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
|
||||
{
|
||||
PRUint32 count = GetChildCount();
|
||||
for (PRUint32 i = 0; i < count; i++) {
|
||||
nsIContent* child = GetChildAt(i);
|
||||
for (nsIContent* child = nsINode::GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
nsRefPtr<nsSVGFEMergeNodeElement> node;
|
||||
CallQueryInterface(child, (nsSVGFEMergeNodeElement**)getter_AddRefs(node));
|
||||
if (node) {
|
||||
@ -4868,10 +4870,10 @@ nsSVGFELightingElement::Filter(nsSVGFilterInstance *instance,
|
||||
|
||||
nscolor lightColor = style->GetStyleSVGReset()->mLightingColor;
|
||||
|
||||
// find specified light
|
||||
PRUint32 count = GetChildCount();
|
||||
for (PRUint32 k = 0; k < count; k++) {
|
||||
nsCOMPtr<nsIContent> child = GetChildAt(k);
|
||||
// find specified light
|
||||
for (nsCOMPtr<nsIContent> child = nsINode::GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
distantLight = do_QueryInterface(child);
|
||||
pointLight = do_QueryInterface(child);
|
||||
spotLight = do_QueryInterface(child);
|
||||
|
@ -167,13 +167,12 @@ nsSVGSwitchElement::FindActiveChild() const
|
||||
const nsAdoptingString& acceptLangs =
|
||||
Preferences::GetLocalizedString("intl.accept_languages");
|
||||
|
||||
PRUint32 count = GetChildCount();
|
||||
|
||||
if (allowReorder && !acceptLangs.IsEmpty()) {
|
||||
PRInt32 bestLanguagePreferenceRank = -1;
|
||||
nsIContent *bestChild = nsnull;
|
||||
for (PRUint32 i = 0; i < count; i++) {
|
||||
nsIContent *child = GetChildAt(i);
|
||||
for (nsIContent* child = nsINode::GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (nsSVGFeatures::PassesConditionalProcessingTests(
|
||||
child, nsSVGFeatures::kIgnoreSystemLanguage)) {
|
||||
nsAutoString value;
|
||||
@ -204,8 +203,9 @@ nsSVGSwitchElement::FindActiveChild() const
|
||||
return bestChild;
|
||||
}
|
||||
|
||||
for (PRUint32 i = 0; i < count; i++) {
|
||||
nsIContent *child = GetChildAt(i);
|
||||
for (nsIContent* child = nsINode::GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (nsSVGFeatures::PassesConditionalProcessingTests(child, &acceptLangs)) {
|
||||
return child;
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ nsSVGUseElement::CreateAnonymousContent()
|
||||
// move the children over
|
||||
PRUint32 num = newcontent->GetChildCount();
|
||||
for (i = 0; i < num; i++) {
|
||||
nsCOMPtr<nsIContent> child = newcontent->GetChildAt(0);
|
||||
nsCOMPtr<nsIContent> child = newcontent->GetFirstChild();
|
||||
newcontent->RemoveChildAt(0, PR_FALSE);
|
||||
svgNode->InsertChildAt(child, i, PR_TRUE);
|
||||
}
|
||||
|
@ -349,10 +349,9 @@ nsXBLBinding::InstallAnonymousContent(nsIContent* aAnonParent, nsIContent* aElem
|
||||
PRBool allowScripts = AllowScripts();
|
||||
|
||||
nsAutoScriptBlocker scriptBlocker;
|
||||
|
||||
PRUint32 childCount = aAnonParent->GetChildCount();
|
||||
for (PRUint32 i = 0; i < childCount; i++) {
|
||||
nsIContent *child = aAnonParent->GetChildAt(i);
|
||||
for (nsIContent* child = aAnonParent->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
child->UnbindFromTree();
|
||||
nsresult rv =
|
||||
child->BindToTree(doc, aElement, mBoundElement, allowScripts);
|
||||
@ -387,9 +386,9 @@ nsXBLBinding::UninstallAnonymousContent(nsIDocument* aDocument,
|
||||
nsCOMPtr<nsIXULDocument> xuldoc =
|
||||
do_QueryInterface(aDocument);
|
||||
#endif
|
||||
PRUint32 childCount = aAnonParent->GetChildCount();
|
||||
for (PRUint32 i = 0; i < childCount; ++i) {
|
||||
nsIContent* child = aAnonParent->GetChildAt(i);
|
||||
for (nsIContent* child = aAnonParent->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
child->UnbindFromTree();
|
||||
#ifdef MOZ_XUL
|
||||
if (xuldoc) {
|
||||
@ -576,11 +575,11 @@ RealizeDefaultContent(nsISupports* aKey,
|
||||
|
||||
// Now make sure the kids of the clone are added to the insertion point as
|
||||
// children.
|
||||
PRUint32 cloneKidCount = clonedContent->GetChildCount();
|
||||
for (PRUint32 k = 0; k < cloneKidCount; k++) {
|
||||
nsIContent *cloneChild = clonedContent->GetChildAt(k);
|
||||
bm->SetInsertionParent(cloneChild, insParent);
|
||||
currPoint->AddChild(cloneChild);
|
||||
for (nsIContent* child = clonedContent->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
bm->SetInsertionParent(child, insParent);
|
||||
currPoint->AddChild(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1178,11 +1177,10 @@ nsXBLBinding::ChangeDocument(nsIDocument* aOldDocument, nsIDocument* aNewDocumen
|
||||
// Make sure that henceforth we don't claim that mBoundElement's children
|
||||
// have insertion parents in the old document.
|
||||
nsBindingManager* bindingManager = aOldDocument->BindingManager();
|
||||
for (PRUint32 i = mBoundElement->GetChildCount(); i > 0; --i) {
|
||||
NS_ASSERTION(mBoundElement->GetChildAt(i-1),
|
||||
"Must have child at i for 0 <= i < GetChildCount()!");
|
||||
bindingManager->SetInsertionParent(mBoundElement->GetChildAt(i-1),
|
||||
nsnull);
|
||||
for (nsIContent* child = mBoundElement->GetLastChild();
|
||||
child;
|
||||
child = child->GetPreviousSibling()) {
|
||||
bindingManager->SetInsertionParent(child, nsnull);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -814,10 +814,9 @@ nsXBLPrototypeBinding::ImplementsInterface(REFNSIID aIID) const
|
||||
nsIContent*
|
||||
nsXBLPrototypeBinding::GetImmediateChild(nsIAtom* aTag)
|
||||
{
|
||||
PRUint32 childCount = mBinding->GetChildCount();
|
||||
|
||||
for (PRUint32 i = 0; i < childCount; i++) {
|
||||
nsIContent* child = mBinding->GetChildAt(i);
|
||||
for (nsIContent* child = mBinding->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->NodeInfo()->Equals(aTag, kNameSpaceID_XBL)) {
|
||||
return child;
|
||||
}
|
||||
@ -1180,9 +1179,10 @@ nsXBLPrototypeBinding::ConstructAttributeTable(nsIContent* aElement)
|
||||
}
|
||||
|
||||
// Recur into our children.
|
||||
PRUint32 childCount = aElement->GetChildCount();
|
||||
for (PRUint32 i = 0; i < childCount; i++) {
|
||||
ConstructAttributeTable(aElement->GetChildAt(i));
|
||||
for (nsIContent* child = aElement->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
ConstructAttributeTable(child);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1362,10 +1362,9 @@ nsXBLPrototypeBinding::GetNestedChildren(nsIAtom* aTag, PRInt32 aNamespace,
|
||||
nsIContent* aContent,
|
||||
nsCOMArray<nsIContent> & aList)
|
||||
{
|
||||
PRUint32 childCount = aContent->GetChildCount();
|
||||
|
||||
for (PRUint32 i = 0; i < childCount; i++) {
|
||||
nsIContent *child = aContent->GetChildAt(i);
|
||||
for (nsIContent* child = aContent->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
|
||||
if (child->NodeInfo()->Equals(aTag, aNamespace)) {
|
||||
aList.AppendObject(child);
|
||||
|
@ -211,8 +211,9 @@ BuildHandlerChain(nsIContent* aContent, nsXBLPrototypeHandler** aResult)
|
||||
// Since we chain each handler onto the next handler,
|
||||
// we'll enumerate them here in reverse so that when we
|
||||
// walk the chain they'll come out in the original order
|
||||
for (PRUint32 j = aContent->GetChildCount(); j--; ) {
|
||||
nsIContent *key = aContent->GetChildAt(j);
|
||||
for (nsIContent* key = aContent->GetLastChild();
|
||||
key;
|
||||
key = key->GetPreviousSibling()) {
|
||||
|
||||
if (key->NodeInfo()->Equals(nsGkAtoms::key, kNameSpaceID_XUL)) {
|
||||
// Check whether the key element has empty value at key/char attribute.
|
||||
|
@ -306,9 +306,9 @@ nsXMLContentSink::DidBuildModel(PRBool aTerminated)
|
||||
mIsDocumentObserver = PR_FALSE;
|
||||
|
||||
// Check for xslt-param and xslt-param-namespace PIs
|
||||
PRUint32 i;
|
||||
nsIContent* child;
|
||||
for (i = 0; (child = mDocument->GetChildAt(i)); ++i) {
|
||||
for (nsIContent* child = mDocument->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsNodeOfType(nsINode::ePROCESSING_INSTRUCTION)) {
|
||||
nsCOMPtr<nsIDOMProcessingInstruction> pi = do_QueryInterface(child);
|
||||
CheckXSLTParamPI(pi, mXSLTProcessor, mDocument);
|
||||
|
@ -209,7 +209,7 @@ txXPathTreeWalker::moveToFirstChild()
|
||||
NS_ASSERTION(mCurrentIndex != kUnknownIndex || mDescendants.IsEmpty(),
|
||||
"Index should be known if parents index are");
|
||||
|
||||
nsIContent* child = mPosition.mNode->GetChildAt(0);
|
||||
nsIContent* child = mPosition.mNode->GetFirstChild();
|
||||
if (!child) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
@ -242,7 +242,7 @@ txXPathTreeWalker::moveToLastChild()
|
||||
if (!total) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
mPosition.mNode = mPosition.mNode->GetChildAt(total - 1);
|
||||
mPosition.mNode = mPosition.mNode->GetLastChild();
|
||||
|
||||
if (mCurrentIndex != kUnknownIndex &&
|
||||
!mDescendants.AppendValue(mCurrentIndex)) {
|
||||
|
@ -604,14 +604,12 @@ handleNode(nsINode* aNode, txStylesheetCompiler* aCompiler)
|
||||
// explicitly destroy the attrs here since we no longer need it
|
||||
atts = nsnull;
|
||||
|
||||
PRUint32 childCount = element->GetChildCount();
|
||||
if (childCount > 0) {
|
||||
PRUint32 counter = 0;
|
||||
nsIContent *child;
|
||||
while ((child = element->GetChildAt(counter++))) {
|
||||
rv = handleNode(child, aCompiler);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
for (nsIContent* child = element->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
|
||||
rv = handleNode(child, aCompiler);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
rv = aCompiler->endElement();
|
||||
@ -624,11 +622,10 @@ handleNode(nsINode* aNode, txStylesheetCompiler* aCompiler)
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
else if (aNode->IsNodeOfType(nsINode::eDOCUMENT)) {
|
||||
nsIDocument* document = static_cast<nsIDocument*>(aNode);
|
||||
|
||||
PRUint32 counter = 0;
|
||||
nsIContent *child;
|
||||
while ((child = document->GetChildAt(counter++))) {
|
||||
for (nsIContent* child = aNode->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
|
||||
rv = handleNode(child, aCompiler);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
@ -316,21 +316,19 @@ nsXULPopupListener::ClosePopup()
|
||||
}
|
||||
} // ClosePopup
|
||||
|
||||
static void
|
||||
GetImmediateChild(nsIContent* aContent, nsIAtom *aTag, nsIContent** aResult)
|
||||
static already_AddRefed<nsIContent>
|
||||
GetImmediateChild(nsIContent* aContent, nsIAtom *aTag)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
PRInt32 childCount = aContent->GetChildCount();
|
||||
for (PRInt32 i = 0; i < childCount; i++) {
|
||||
nsIContent *child = aContent->GetChildAt(i);
|
||||
for (nsIContent* child = aContent->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->Tag() == aTag) {
|
||||
*aResult = child;
|
||||
NS_ADDREF(*aResult);
|
||||
return;
|
||||
NS_ADDREF(child);
|
||||
return child;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
//
|
||||
@ -384,9 +382,7 @@ nsXULPopupListener::LaunchPopup(nsIDOMEvent* aEvent, nsIContent* aTargetContent)
|
||||
nsCOMPtr<nsIDOMElement> popupElement;
|
||||
|
||||
if (identifier.EqualsLiteral("_child")) {
|
||||
nsCOMPtr<nsIContent> popup;
|
||||
|
||||
GetImmediateChild(content, nsGkAtoms::menupopup, getter_AddRefs(popup));
|
||||
nsCOMPtr<nsIContent> popup = GetImmediateChild(content, nsGkAtoms::menupopup);
|
||||
if (popup)
|
||||
popupElement = do_QueryInterface(popup);
|
||||
else {
|
||||
|
@ -930,14 +930,14 @@ nsXULDocument::ExecuteOnBroadcastHandlerFor(nsIContent* aBroadcaster,
|
||||
// execute the handler.
|
||||
|
||||
nsCOMPtr<nsIContent> listener = do_QueryInterface(aListener);
|
||||
PRUint32 count = listener->GetChildCount();
|
||||
for (PRUint32 i = 0; i < count; ++i) {
|
||||
for (nsIContent* child = listener->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
|
||||
// Look for an <observes> element beneath the listener. This
|
||||
// ought to have an |element| attribute that refers to
|
||||
// aBroadcaster, and an |attribute| element that tells us what
|
||||
// attriubtes we're listening for.
|
||||
nsIContent *child = listener->GetChildAt(i);
|
||||
|
||||
if (!child->NodeInfo()->Equals(nsGkAtoms::observes, kNameSpaceID_XUL))
|
||||
continue;
|
||||
|
||||
@ -1764,10 +1764,11 @@ nsXULDocument::AddSubtreeToDocument(nsIContent* aContent)
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Recurse to children
|
||||
PRUint32 count = aElement->GetChildCount();
|
||||
for (nsIContent* child = aElement->GetLastChild();
|
||||
child;
|
||||
child = child->GetPreviousSibling()) {
|
||||
|
||||
while (count-- > 0) {
|
||||
rv = AddSubtreeToDocument(aElement->GetChildAt(count));
|
||||
rv = AddSubtreeToDocument(child);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
@ -1798,10 +1799,11 @@ nsXULDocument::RemoveSubtreeFromDocument(nsIContent* aContent)
|
||||
}
|
||||
|
||||
// 1. Remove any children from the document.
|
||||
PRUint32 count = aElement->GetChildCount();
|
||||
for (nsIContent* child = aElement->GetLastChild();
|
||||
child;
|
||||
child = child->GetPreviousSibling()) {
|
||||
|
||||
while (count-- > 0) {
|
||||
rv = RemoveSubtreeFromDocument(aElement->GetChildAt(count));
|
||||
rv = RemoveSubtreeFromDocument(child);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
@ -4077,7 +4079,7 @@ nsXULDocument::OverlayForwardReference::Merge(nsIContent* aTargetNode,
|
||||
nsCOMPtr<nsIContent> currContent;
|
||||
|
||||
for (i = 0; i < childCount; ++i) {
|
||||
currContent = aOverlayNode->GetChildAt(0);
|
||||
currContent = aOverlayNode->GetFirstChild();
|
||||
|
||||
nsIAtom *idAtom = currContent->GetID();
|
||||
|
||||
|
@ -59,13 +59,12 @@ nsContentSupportMap::Remove(nsIContent* aElement)
|
||||
{
|
||||
if (!mMap.ops)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
PL_DHashTableOperate(&mMap, aElement, PL_DHASH_REMOVE);
|
||||
|
||||
PRUint32 count = aElement->GetChildCount();
|
||||
for (PRUint32 i = 0; i < count; ++i) {
|
||||
Remove(aElement->GetChildAt(i));
|
||||
}
|
||||
|
||||
nsIContent* child = aElement;
|
||||
do {
|
||||
PL_DHashTableOperate(&mMap, child, PL_DHASH_REMOVE);
|
||||
child = child->GetNextNode(aElement);
|
||||
} while(child);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -81,9 +81,10 @@ public:
|
||||
Remove(nsIContent* aContent) {
|
||||
PL_DHashTableOperate(&mTable, aContent, PL_DHASH_REMOVE);
|
||||
|
||||
PRUint32 count = aContent->GetChildCount();
|
||||
for (PRUint32 i = 0; i < count; ++i) {
|
||||
Remove(aContent->GetChildAt(i));
|
||||
for (nsIContent* child = aContent->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
Remove(child);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -498,10 +498,9 @@ nsXULContentBuilder::BuildContentFromTemplate(nsIContent *aTemplateNode,
|
||||
|
||||
// Iterate through all of the template children, constructing
|
||||
// "real" content model nodes for each "template" child.
|
||||
PRUint32 count = aTemplateNode->GetChildCount();
|
||||
|
||||
for (PRUint32 kid = 0; kid < count; kid++) {
|
||||
nsIContent *tmplKid = aTemplateNode->GetChildAt(kid);
|
||||
for (nsIContent* tmplKid = aTemplateNode->GetFirstChild();
|
||||
tmplKid;
|
||||
tmplKid = tmplKid->GetNextSibling()) {
|
||||
|
||||
PRInt32 nameSpaceID = tmplKid->GetNameSpaceID();
|
||||
|
||||
@ -1935,8 +1934,10 @@ nsXULContentBuilder::InsertSortedNode(nsIContent* aContainer,
|
||||
staticCount = 0;
|
||||
} else {
|
||||
// compute the "static" XUL element count
|
||||
for (PRUint32 childLoop = 0; childLoop < numChildren; ++childLoop) {
|
||||
child = aContainer->GetChildAt(childLoop);
|
||||
for (nsIContent* child = aContainer->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
|
||||
if (nsContentUtils::HasNonEmptyAttr(child, kNameSpaceID_None,
|
||||
nsGkAtoms::_template))
|
||||
break;
|
||||
|
@ -201,13 +201,12 @@ nsXULContentUtils::FindChildByTag(nsIContent* aElement,
|
||||
nsIAtom* aTag,
|
||||
nsIContent** aResult)
|
||||
{
|
||||
PRUint32 count = aElement->GetChildCount();
|
||||
for (nsIContent* child = aElement->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
|
||||
for (PRUint32 i = 0; i < count; ++i) {
|
||||
nsIContent *kid = aElement->GetChildAt(i);
|
||||
|
||||
if (kid->NodeInfo()->Equals(aTag, aNameSpaceID)) {
|
||||
NS_ADDREF(*aResult = kid);
|
||||
if (child->NodeInfo()->Equals(aTag, aNameSpaceID)) {
|
||||
NS_ADDREF(*aResult = child);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -109,11 +109,9 @@ XULSortServiceImpl::SetSortColumnHints(nsIContent *content,
|
||||
{
|
||||
// set sort info on current column. This ensures that the
|
||||
// column header sort indicator is updated properly.
|
||||
PRUint32 numChildren = content->GetChildCount();
|
||||
|
||||
for (PRUint32 childIndex = 0; childIndex < numChildren; ++childIndex) {
|
||||
nsIContent *child = content->GetChildAt(childIndex);
|
||||
|
||||
for (nsIContent* child = content->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsXUL()) {
|
||||
nsIAtom *tag = child->Tag();
|
||||
|
||||
@ -177,11 +175,10 @@ XULSortServiceImpl::GetItemsToSort(nsIContent *aContainer,
|
||||
|
||||
aContainer = treechildren;
|
||||
}
|
||||
|
||||
PRUint32 count = aContainer->GetChildCount();
|
||||
for (PRUint32 c = 0; c < count; c++) {
|
||||
nsIContent *child = aContainer->GetChildAt(c);
|
||||
|
||||
|
||||
for (nsIContent* child = aContainer->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
contentSortInfo* cinfo = aSortItems.AppendElement();
|
||||
if (!cinfo)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
@ -199,9 +196,9 @@ XULSortServiceImpl::GetTemplateItemsToSort(nsIContent* aContainer,
|
||||
nsSortState* aSortState,
|
||||
nsTArray<contentSortInfo>& aSortItems)
|
||||
{
|
||||
PRUint32 numChildren = aContainer->GetChildCount();
|
||||
for (PRUint32 childIndex = 0; childIndex < numChildren; childIndex++) {
|
||||
nsIContent *child = aContainer->GetChildAt(childIndex);
|
||||
for (nsIContent* child = aContainer->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
|
||||
nsCOMPtr<nsIDOMElement> childnode = do_QueryInterface(child);
|
||||
|
||||
@ -347,9 +344,9 @@ XULSortServiceImpl::SortContainer(nsIContent *aContainer, nsSortState* aSortStat
|
||||
nsGkAtoms::_true, eCaseMatters))
|
||||
continue;
|
||||
|
||||
PRUint32 numChildren = child->GetChildCount();
|
||||
for (PRUint32 gcindex = 0; gcindex < numChildren; gcindex++) {
|
||||
nsIContent *grandchild = child->GetChildAt(gcindex);
|
||||
for (nsIContent* grandchild = child->GetFirstChild();
|
||||
grandchild;
|
||||
grandchild = grandchild->GetNextSibling()) {
|
||||
nsINodeInfo *ni = grandchild->NodeInfo();
|
||||
nsIAtom *localName = ni->NameAtom();
|
||||
if (ni->NamespaceID() == kNameSpaceID_XUL &&
|
||||
|
@ -1699,10 +1699,9 @@ nsXULTemplateBuilder::GetTemplateRoot(nsIContent** aResult)
|
||||
{
|
||||
// If root node has no template attribute, then look for a child
|
||||
// node which is a template tag
|
||||
PRUint32 count = mRoot->GetChildCount();
|
||||
|
||||
for (PRUint32 i = 0; i < count; ++i) {
|
||||
nsIContent *child = mRoot->GetChildAt(i);
|
||||
for (nsIContent* child = mRoot->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
|
||||
if (IsTemplateElement(child)) {
|
||||
NS_ADDREF(*aResult = child);
|
||||
@ -1856,10 +1855,10 @@ nsXULTemplateBuilder::CompileTemplate(nsIContent* aTemplate,
|
||||
PRBool isQuerySetMode = PR_FALSE;
|
||||
PRBool hasQuerySet = PR_FALSE, hasRule = PR_FALSE, hasQuery = PR_FALSE;
|
||||
|
||||
PRUint32 count = aTemplate->GetChildCount();
|
||||
for (nsIContent* rulenode = aTemplate->GetFirstChild();
|
||||
rulenode;
|
||||
rulenode = rulenode->GetNextSibling()) {
|
||||
|
||||
for (PRUint32 i = 0; i < count; i++) {
|
||||
nsIContent *rulenode = aTemplate->GetChildAt(i);
|
||||
nsINodeInfo *ni = rulenode->NodeInfo();
|
||||
|
||||
// don't allow more queries than can be supported
|
||||
@ -2243,12 +2242,11 @@ nsXULTemplateBuilder::CompileConditions(nsTemplateRule* aRule,
|
||||
aRule->SetTag(tagatom);
|
||||
}
|
||||
|
||||
PRUint32 count = aCondition->GetChildCount();
|
||||
|
||||
nsTemplateCondition* currentCondition = nsnull;
|
||||
|
||||
for (PRUint32 i = 0; i < count; i++) {
|
||||
nsIContent *node = aCondition->GetChildAt(i);
|
||||
for (nsIContent* node = aCondition->GetFirstChild();
|
||||
node;
|
||||
node = node->GetNextSibling()) {
|
||||
|
||||
if (node->NodeInfo()->Equals(nsGkAtoms::where, kNameSpaceID_XUL)) {
|
||||
nsresult rv = CompileWhereCondition(aRule, node, ¤tCondition);
|
||||
@ -2366,10 +2364,9 @@ nsXULTemplateBuilder::CompileBindings(nsTemplateRule* aRule, nsIContent* aBindin
|
||||
// Add an extended rule's bindings.
|
||||
nsresult rv;
|
||||
|
||||
PRUint32 count = aBindings->GetChildCount();
|
||||
|
||||
for (PRUint32 i = 0; i < count; ++i) {
|
||||
nsIContent *binding = aBindings->GetChildAt(i);
|
||||
for (nsIContent* binding = aBindings->GetFirstChild();
|
||||
binding;
|
||||
binding = binding->GetNextSibling()) {
|
||||
|
||||
if (binding->NodeInfo()->Equals(nsGkAtoms::binding,
|
||||
kNameSpaceID_XUL)) {
|
||||
@ -2481,10 +2478,11 @@ nsXULTemplateBuilder::AddSimpleRuleBindings(nsTemplateRule* aRule,
|
||||
}
|
||||
|
||||
// Push kids onto the stack, and search them next.
|
||||
count = element->GetChildCount();
|
||||
for (nsIContent* child = element->GetLastChild();
|
||||
child;
|
||||
child = child->GetPreviousSibling()) {
|
||||
|
||||
while (count-- > 0) {
|
||||
if (elements.AppendElement(element->GetChildAt(count)) == nsnull)
|
||||
if (!elements.AppendElement(child))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
@ -1273,14 +1273,13 @@ nsXULTemplateQueryProcessorRDF::CompileExtendedQuery(nsRDFQuery* aQuery,
|
||||
|
||||
TestNode* prevnode = idnode;
|
||||
|
||||
PRUint32 count = aConditions->GetChildCount();
|
||||
|
||||
for (PRUint32 i = 0; i < count; ++i) {
|
||||
nsIContent *condition = aConditions->GetChildAt(i);
|
||||
for (nsIContent* condition = aConditions->GetFirstChild();
|
||||
condition;
|
||||
condition = condition->GetNextSibling()) {
|
||||
|
||||
// the <content> condition should always be the first child
|
||||
if (condition->Tag() == nsGkAtoms::content) {
|
||||
if (i) {
|
||||
if (condition != aConditions->GetFirstChild()) {
|
||||
nsXULContentUtils::LogTemplateError(ERROR_TEMPLATE_CONTENT_NOT_FIRST);
|
||||
continue;
|
||||
}
|
||||
|
@ -328,10 +328,9 @@ nsXULTemplateQueryProcessorStorage::CompileQuery(nsIXULTemplateBuilder* aBuilder
|
||||
}
|
||||
|
||||
PRUint32 parameterCount = 0;
|
||||
PRUint32 count = queryContent->GetChildCount();
|
||||
|
||||
for (PRUint32 i = 0; i < count; ++i) {
|
||||
nsIContent *child = queryContent->GetChildAt(i);
|
||||
for (nsIContent* child = queryContent->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
|
||||
if (child->NodeInfo()->Equals(nsGkAtoms::param, kNameSpaceID_XUL)) {
|
||||
nsAutoString value;
|
||||
|
@ -305,9 +305,10 @@ nsXULTemplateQueryProcessorXML::CompileQuery(nsIXULTemplateBuilder* aBuilder,
|
||||
new nsXMLQuery(this, aMemberVariable, compiledexpr);
|
||||
NS_ENSURE_TRUE(query, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
PRUint32 count = content->GetChildCount();
|
||||
for (PRUint32 i = 0; i < count; ++i) {
|
||||
nsIContent *condition = content->GetChildAt(i);
|
||||
for (nsIContent* condition = content->GetFirstChild();
|
||||
condition;
|
||||
condition = condition->GetNextSibling()) {
|
||||
|
||||
if (condition->NodeInfo()->Equals(nsGkAtoms::assign,
|
||||
kNameSpaceID_XUL)) {
|
||||
nsAutoString var;
|
||||
|
@ -96,9 +96,10 @@ nsXULTemplateResultXML::GetIsEmpty(PRBool* aIsEmpty)
|
||||
// a node is considered empty if it has no elements as children
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mNode);
|
||||
if (content) {
|
||||
PRUint32 count = content->GetChildCount();
|
||||
for (PRUint32 c = 0; c < count; c++) {
|
||||
if (content->GetChildAt(c)->IsElement()) {
|
||||
for (nsIContent* child = content->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsElement()) {
|
||||
*aIsEmpty = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1362,10 +1362,10 @@ nsXULTreeBuilder::EnsureSortVariables()
|
||||
|
||||
if (!treecols)
|
||||
return NS_OK;
|
||||
|
||||
PRUint32 count = treecols->GetChildCount();
|
||||
for (PRUint32 i = 0; i < count; ++i) {
|
||||
nsIContent *child = treecols->GetChildAt(i);
|
||||
|
||||
for (nsIContent* child = treecols->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
|
||||
if (child->NodeInfo()->Equals(nsGkAtoms::treecol,
|
||||
kNameSpaceID_XUL)) {
|
||||
@ -1501,11 +1501,11 @@ nsXULTreeBuilder::GetTemplateActionCellFor(PRInt32 aRow,
|
||||
aCol->GetAtom(getter_AddRefs(colAtom));
|
||||
aCol->GetIndex(&colIndex);
|
||||
|
||||
PRUint32 count = row->GetChildCount();
|
||||
PRUint32 j = 0;
|
||||
for (PRUint32 i = 0; i < count; ++i) {
|
||||
nsIContent *child = row->GetChildAt(i);
|
||||
|
||||
for (nsIContent* child = row->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
|
||||
if (child->NodeInfo()->Equals(nsGkAtoms::treecell,
|
||||
kNameSpaceID_XUL)) {
|
||||
if (colAtom &&
|
||||
|
Loading…
Reference in New Issue
Block a user