зеркало из https://github.com/mozilla/pjs.git
Bug 682366 - Remove nsINode::ChildIterator r=smaug
This commit is contained in:
Родитель
16f075408d
Коммит
97da6bec7d
|
@ -933,42 +933,6 @@ public:
|
||||||
*/
|
*/
|
||||||
nsIDocument* GetOwnerDocument() const;
|
nsIDocument* GetOwnerDocument() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Iterator that can be used to easily iterate over the children. This has
|
|
||||||
* the same restrictions on its use as GetChildArray does.
|
|
||||||
*/
|
|
||||||
class ChildIterator {
|
|
||||||
public:
|
|
||||||
ChildIterator(const nsINode* aNode) { Init(aNode); }
|
|
||||||
ChildIterator(const nsINode* aNode, PRUint32 aOffset) {
|
|
||||||
Init(aNode);
|
|
||||||
Advance(aOffset);
|
|
||||||
}
|
|
||||||
~ChildIterator() {
|
|
||||||
NS_ASSERTION(!mGuard.Mutated(0), "Unexpected mutations happened");
|
|
||||||
}
|
|
||||||
|
|
||||||
PRBool IsDone() const { return mCur == mEnd; }
|
|
||||||
operator nsIContent*() const { return *mCur; }
|
|
||||||
void Next() { NS_PRECONDITION(mCur != mEnd, "Check IsDone"); ++mCur; }
|
|
||||||
void Advance(PRUint32 aOffset) {
|
|
||||||
NS_ASSERTION(mCur + aOffset <= mEnd, "Unexpected offset");
|
|
||||||
mCur += aOffset;
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
void Init(const nsINode* aNode) {
|
|
||||||
NS_PRECONDITION(aNode, "Must have node here!");
|
|
||||||
PRUint32 childCount;
|
|
||||||
mCur = aNode->GetChildArray(&childCount);
|
|
||||||
mEnd = mCur + childCount;
|
|
||||||
}
|
|
||||||
#ifdef DEBUG
|
|
||||||
nsMutationGuard mGuard;
|
|
||||||
#endif
|
|
||||||
nsIContent* const * mCur;
|
|
||||||
nsIContent* const * mEnd;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default script type (language) ID for this node.
|
* The default script type (language) ID for this node.
|
||||||
* All nodes must support fetching the default script language.
|
* All nodes must support fetching the default script language.
|
||||||
|
|
|
@ -733,8 +733,10 @@ nsGenericHTMLElement::FireMutationEventsForDirectParsing(nsIDocument* aDoc,
|
||||||
NS_ASSERTION(newChildCount - aOldChildCount >= 0,
|
NS_ASSERTION(newChildCount - aOldChildCount >= 0,
|
||||||
"What, some unexpected dom mutation has happened?");
|
"What, some unexpected dom mutation has happened?");
|
||||||
childNodes.SetCapacity(newChildCount - aOldChildCount);
|
childNodes.SetCapacity(newChildCount - aOldChildCount);
|
||||||
for (nsINode::ChildIterator iter(aDest); !iter.IsDone(); iter.Next()) {
|
for (nsIContent* child = aDest->GetFirstChild();
|
||||||
childNodes.AppendElement(iter);
|
child;
|
||||||
|
child = child->GetNextSibling()) {
|
||||||
|
childNodes.AppendElement(child);
|
||||||
}
|
}
|
||||||
nsGenericElement::FireNodeInserted(aDoc, aDest, childNodes);
|
nsGenericElement::FireNodeInserted(aDoc, aDest, childNodes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2127,9 +2127,10 @@ nsXULTemplateBuilder::DetermineMemberVariable(nsIContent* aElement)
|
||||||
{
|
{
|
||||||
// recursively iterate over the children looking for an element
|
// recursively iterate over the children looking for an element
|
||||||
// with uri="?..."
|
// with uri="?..."
|
||||||
for (nsINode::ChildIterator iter(aElement); !iter.IsDone(); iter.Next()) {
|
for (nsIContent* child = aElement->GetFirstChild();
|
||||||
|
child;
|
||||||
|
child = child->GetNextSibling()) {
|
||||||
nsAutoString uri;
|
nsAutoString uri;
|
||||||
nsIContent *child = iter;
|
|
||||||
child->GetAttr(kNameSpaceID_None, nsGkAtoms::uri, uri);
|
child->GetAttr(kNameSpaceID_None, nsGkAtoms::uri, uri);
|
||||||
if (!uri.IsEmpty() && uri[0] == PRUnichar('?')) {
|
if (!uri.IsEmpty() && uri[0] == PRUnichar('?')) {
|
||||||
return NS_NewAtom(uri);
|
return NS_NewAtom(uri);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче