Bug 1372061 - Add node flag recording whether we might have anonymous children. r=bholley

MozReview-Commit-ID: CMaxJ1JnuYJ

--HG--
extra : rebase_source : ac5651b0d42125fd2a4ff3f5ce03f7a6c6ab1fbb
This commit is contained in:
Cameron McCormack 2017-06-27 23:56:12 -07:00
Родитель a9cf106a4a
Коммит 4cfbfe320e
4 изменённых файлов: 14 добавлений и 2 удалений

Просмотреть файл

@ -1566,6 +1566,9 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
if (aParent->HasFlag(NODE_CHROME_ONLY_ACCESS)) {
SetFlags(NODE_CHROME_ONLY_ACCESS);
}
if (HasFlag(NODE_IS_ANONYMOUS_ROOT)) {
aParent->SetMayHaveAnonymousChildren();
}
if (aParent->IsInShadowTree()) {
ClearSubtreeRootPointer();
SetFlags(NODE_IS_IN_SHADOW_TREE);

Просмотреть файл

@ -496,6 +496,9 @@ nsGenericDOMDataNode::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
if (aParent->HasFlag(NODE_CHROME_ONLY_ACCESS)) {
SetFlags(NODE_CHROME_ONLY_ACCESS);
}
if (HasFlag(NODE_IS_ANONYMOUS_ROOT)) {
aParent->SetMayHaveAnonymousChildren();
}
if (aParent->IsInShadowTree()) {
ClearSubtreeRootPointer();
SetFlags(NODE_IS_IN_SHADOW_TREE);

Просмотреть файл

@ -1561,6 +1561,9 @@ private:
ParserHasNotified,
// Sets if the node is apz aware or we have apz aware listeners.
MayBeApzAware,
// Set if the element might have any kind of anonymous content children,
// which would not be found through the element's children list.
ElementMayHaveAnonymousChildren,
// Guard value
BooleanFlagCount
};
@ -1699,6 +1702,10 @@ public:
{
return GetBoolFlag(MayBeApzAware);
}
void SetMayHaveAnonymousChildren() { SetBoolFlag(ElementMayHaveAnonymousChildren); }
bool MayHaveAnonymousChildren() const { return GetBoolFlag(ElementMayHaveAnonymousChildren); }
protected:
void SetParentIsContent(bool aValue) { SetBoolFlag(ParentIsContent, aValue); }
void SetIsInDocument() { SetBoolFlag(IsInDocument); }

Просмотреть файл

@ -215,6 +215,7 @@ nsXBLBinding::InstallAnonymousContent(nsIContent* aAnonParent, nsIContent* aElem
child->SetFlags(NODE_CHROME_ONLY_ACCESS |
NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS);
}
child->SetFlags(NODE_IS_ANONYMOUS_ROOT);
nsresult rv =
child->BindToTree(doc, aElement, mBoundElement, allowScripts);
if (NS_FAILED(rv)) {
@ -224,8 +225,6 @@ nsXBLBinding::InstallAnonymousContent(nsIContent* aAnonParent, nsIContent* aElem
return;
}
child->SetFlags(NODE_IS_ANONYMOUS_ROOT);
#ifdef MOZ_XUL
// To make XUL templates work (and other goodies that happen when
// an element is added to a XUL document), we need to notify the