mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1096635 - Update XBL insertion parent for dynamic default content. r=mrbkap
This commit is contained in:
parent
e22ff7388d
commit
29a1bd7d60
@ -55,12 +55,20 @@ public:
|
||||
{
|
||||
mInsertedChildren.AppendElement(aChild);
|
||||
aChild->SetXBLInsertionParent(GetParent());
|
||||
|
||||
// Appending an inserted child causes the inserted
|
||||
// children to be projected instead of default content.
|
||||
MaybeRemoveDefaultContent();
|
||||
}
|
||||
|
||||
void InsertInsertedChildAt(nsIContent* aChild, uint32_t aIndex)
|
||||
{
|
||||
mInsertedChildren.InsertElementAt(aIndex, aChild);
|
||||
aChild->SetXBLInsertionParent(GetParent());
|
||||
|
||||
// Inserting an inserted child causes the inserted
|
||||
// children to be projected instead of default content.
|
||||
MaybeRemoveDefaultContent();
|
||||
}
|
||||
|
||||
void RemoveInsertedChild(nsIContent* aChild)
|
||||
@ -70,6 +78,10 @@ public:
|
||||
//NS_ASSERTION(mInsertedChildren.Contains(aChild),
|
||||
// "Removing child that's not there");
|
||||
mInsertedChildren.RemoveElement(aChild);
|
||||
|
||||
// After removing the inserted child, default content
|
||||
// may be projected into this insertion point.
|
||||
MaybeSetupDefaultContent();
|
||||
}
|
||||
|
||||
void ClearInsertedChildren()
|
||||
@ -78,6 +90,10 @@ public:
|
||||
mInsertedChildren[c]->SetXBLInsertionParent(nullptr);
|
||||
}
|
||||
mInsertedChildren.Clear();
|
||||
|
||||
// After clearing inserted children, default content
|
||||
// will be projected into this insertion point.
|
||||
MaybeSetupDefaultContent();
|
||||
}
|
||||
|
||||
void MaybeSetupDefaultContent()
|
||||
|
@ -884,6 +884,19 @@ nsBindingManager::ContentAppended(nsIDocument* aDocument,
|
||||
// Try to find insertion points for all the new kids.
|
||||
XBLChildrenElement* point = nullptr;
|
||||
nsIContent* parent = aContainer;
|
||||
|
||||
// Handle appending of default content.
|
||||
if (parent && parent->IsActiveChildrenElement()) {
|
||||
XBLChildrenElement* childrenEl = static_cast<XBLChildrenElement*>(parent);
|
||||
if (childrenEl->HasInsertedChildren()) {
|
||||
// Appending default content that isn't being used. Ignore.
|
||||
return;
|
||||
}
|
||||
|
||||
childrenEl->MaybeSetupDefaultContent();
|
||||
parent = childrenEl->GetParent();
|
||||
}
|
||||
|
||||
bool first = true;
|
||||
do {
|
||||
nsXBLBinding* binding = GetBindingWithContent(parent);
|
||||
@ -957,6 +970,18 @@ nsBindingManager::ContentRemoved(nsIDocument* aDocument,
|
||||
|
||||
XBLChildrenElement* point = nullptr;
|
||||
nsIContent* parent = aContainer;
|
||||
|
||||
// Handle appending of default content.
|
||||
if (parent && parent->IsActiveChildrenElement()) {
|
||||
XBLChildrenElement* childrenEl = static_cast<XBLChildrenElement*>(parent);
|
||||
if (childrenEl->HasInsertedChildren()) {
|
||||
// Removing default content that isn't being used. Ignore.
|
||||
return;
|
||||
}
|
||||
|
||||
parent = childrenEl->GetParent();
|
||||
}
|
||||
|
||||
do {
|
||||
nsXBLBinding* binding = GetBindingWithContent(parent);
|
||||
if (!binding) {
|
||||
@ -1075,6 +1100,19 @@ nsBindingManager::HandleChildInsertion(nsIContent* aContainer,
|
||||
|
||||
XBLChildrenElement* point = nullptr;
|
||||
nsIContent* parent = aContainer;
|
||||
|
||||
// Handle insertion of default content.
|
||||
if (parent && parent->IsActiveChildrenElement()) {
|
||||
XBLChildrenElement* childrenEl = static_cast<XBLChildrenElement*>(parent);
|
||||
if (childrenEl->HasInsertedChildren()) {
|
||||
// Inserting default content that isn't being used. Ignore.
|
||||
return;
|
||||
}
|
||||
|
||||
childrenEl->MaybeSetupDefaultContent();
|
||||
parent = childrenEl->GetParent();
|
||||
}
|
||||
|
||||
while (parent) {
|
||||
nsXBLBinding* binding = GetBindingWithContent(parent);
|
||||
if (!binding) {
|
||||
|
Loading…
Reference in New Issue
Block a user