XBL fix for walling off style (46505). r=ben

This commit is contained in:
hyatt%netscape.com 2000-08-29 03:08:35 +00:00
Родитель 3d005fd23d
Коммит c8864cba14
8 изменённых файлов: 44 добавлений и 128 удалений

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

@ -1338,32 +1338,10 @@ nsGenericElement::GetParent(nsIContent*& aResult) const
return NS_OK;
}
static void UpdateBindingParent(nsIContent* aContent, nsIContent* aBindingParent)
{
aContent->SetBindingParent(aBindingParent);
PRInt32 count;
aContent->ChildCount(count);
for (PRInt32 i = 0; i < count; i++) {
nsCOMPtr<nsIContent> child;
aContent->ChildAt(i, *getter_AddRefs(child));
UpdateBindingParent(child, aBindingParent);
}
}
nsresult
nsGenericElement::SetParent(nsIContent* aParent)
{
mParent = aParent;
if (mParent) {
// Get the binding parent.
nsCOMPtr<nsIContent> bindingParent;
mParent->GetBindingParent(getter_AddRefs(bindingParent));
nsIContent* par = mDOMSlots ? mDOMSlots->mBindingParent : nsnull;
if (bindingParent && (bindingParent.get() != par))
UpdateBindingParent(mContent, bindingParent);
}
return NS_OK;
}
@ -1565,6 +1543,17 @@ nsGenericElement::SetBindingParent(nsIContent* aParent)
GetDOMSlots();
mDOMSlots->mBindingParent = aParent; // Weak, so no addref happens.
if (aParent) {
PRInt32 count;
mContent->ChildCount(count);
for (PRInt32 i = 0; i < count; i++) {
nsCOMPtr<nsIContent> child;
mContent->ChildAt(i, *getter_AddRefs(child));
child->SetBindingParent(aParent);
}
}
return NS_OK;
}

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

@ -396,18 +396,6 @@ nsXBLBinding::GetAnonymousContent(nsIContent** aResult)
return NS_OK;
}
static void UpdateBindingParent(nsIContent* aContent, nsIContent* aBindingParent)
{
aContent->SetBindingParent(aBindingParent);
PRInt32 count;
aContent->ChildCount(count);
for (PRInt32 i = 0; i < count; i++) {
nsCOMPtr<nsIContent> child;
aContent->ChildAt(i, *getter_AddRefs(child));
UpdateBindingParent(child, aBindingParent);
}
}
NS_IMETHODIMP
nsXBLBinding::SetAnonymousContent(nsIContent* aParent)
{
@ -430,7 +418,7 @@ nsXBLBinding::SetAnonymousContent(nsIContent* aParent)
nsCOMPtr<nsIContent> child;
mContent->ChildAt(i, *getter_AddRefs(child));
child->SetParent(mBoundElement);
UpdateBindingParent(child, mBoundElement);
child->SetBindingParent(mBoundElement);
}
// (3) We need to insert entries into our attribute table for any elements

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

@ -2318,31 +2318,10 @@ nsXULElement::GetParent(nsIContent*& aResult) const
return NS_OK;
}
static void UpdateBindingParent(nsIContent* aContent, nsIContent* aBindingParent)
{
aContent->SetBindingParent(aBindingParent);
PRInt32 count;
aContent->ChildCount(count);
for (PRInt32 i = 0; i < count; i++) {
nsCOMPtr<nsIContent> child;
aContent->ChildAt(i, *getter_AddRefs(child));
UpdateBindingParent(child, aBindingParent);
}
}
NS_IMETHODIMP
nsXULElement::SetParent(nsIContent* aParent)
{
mParent = aParent; // no refcount
if (mParent) {
// Get the binding parent.
nsCOMPtr<nsIContent> bindingParent;
mParent->GetBindingParent(getter_AddRefs(bindingParent));
if (bindingParent && (bindingParent.get() != mBindingParent))
UpdateBindingParent((nsIStyledContent*)this, bindingParent);
}
return NS_OK;
}
@ -4222,6 +4201,15 @@ NS_IMETHODIMP
nsXULElement::SetBindingParent(nsIContent* aParent)
{
mBindingParent = aParent; // [Weak] no addref
if (mBindingParent) {
PRInt32 count;
ChildCount(count);
for (PRInt32 i = 0; i < count; i++) {
nsCOMPtr<nsIContent> child;
ChildAt(i, *getter_AddRefs(child));
child->SetBindingParent(aParent);
}
}
return NS_OK;
}

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

@ -5435,14 +5435,7 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell,
content->SetParent(aParent);
content->SetDocument(aDocument, PR_TRUE, PR_TRUE);
content->SetBindingParent(content);
nsCOMPtr<nsIContent> child;
PRInt32 childCount;
content->ChildCount(childCount);
for (PRInt32 j = 0; j < childCount; j++) {
content->ChildAt(j, *getter_AddRefs(child));
child->SetParent(content);
}
nsIFrame * newFrame = nsnull;
nsresult rv = creator->CreateFrameFor(aPresContext, content, &newFrame);
if (NS_SUCCEEDED(rv) && newFrame != nsnull) {

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

@ -1338,32 +1338,10 @@ nsGenericElement::GetParent(nsIContent*& aResult) const
return NS_OK;
}
static void UpdateBindingParent(nsIContent* aContent, nsIContent* aBindingParent)
{
aContent->SetBindingParent(aBindingParent);
PRInt32 count;
aContent->ChildCount(count);
for (PRInt32 i = 0; i < count; i++) {
nsCOMPtr<nsIContent> child;
aContent->ChildAt(i, *getter_AddRefs(child));
UpdateBindingParent(child, aBindingParent);
}
}
nsresult
nsGenericElement::SetParent(nsIContent* aParent)
{
mParent = aParent;
if (mParent) {
// Get the binding parent.
nsCOMPtr<nsIContent> bindingParent;
mParent->GetBindingParent(getter_AddRefs(bindingParent));
nsIContent* par = mDOMSlots ? mDOMSlots->mBindingParent : nsnull;
if (bindingParent && (bindingParent.get() != par))
UpdateBindingParent(mContent, bindingParent);
}
return NS_OK;
}
@ -1565,6 +1543,17 @@ nsGenericElement::SetBindingParent(nsIContent* aParent)
GetDOMSlots();
mDOMSlots->mBindingParent = aParent; // Weak, so no addref happens.
if (aParent) {
PRInt32 count;
mContent->ChildCount(count);
for (PRInt32 i = 0; i < count; i++) {
nsCOMPtr<nsIContent> child;
mContent->ChildAt(i, *getter_AddRefs(child));
child->SetBindingParent(aParent);
}
}
return NS_OK;
}

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

@ -5435,14 +5435,7 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell,
content->SetParent(aParent);
content->SetDocument(aDocument, PR_TRUE, PR_TRUE);
content->SetBindingParent(content);
nsCOMPtr<nsIContent> child;
PRInt32 childCount;
content->ChildCount(childCount);
for (PRInt32 j = 0; j < childCount; j++) {
content->ChildAt(j, *getter_AddRefs(child));
child->SetParent(content);
}
nsIFrame * newFrame = nsnull;
nsresult rv = creator->CreateFrameFor(aPresContext, content, &newFrame);
if (NS_SUCCEEDED(rv) && newFrame != nsnull) {

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

@ -396,18 +396,6 @@ nsXBLBinding::GetAnonymousContent(nsIContent** aResult)
return NS_OK;
}
static void UpdateBindingParent(nsIContent* aContent, nsIContent* aBindingParent)
{
aContent->SetBindingParent(aBindingParent);
PRInt32 count;
aContent->ChildCount(count);
for (PRInt32 i = 0; i < count; i++) {
nsCOMPtr<nsIContent> child;
aContent->ChildAt(i, *getter_AddRefs(child));
UpdateBindingParent(child, aBindingParent);
}
}
NS_IMETHODIMP
nsXBLBinding::SetAnonymousContent(nsIContent* aParent)
{
@ -430,7 +418,7 @@ nsXBLBinding::SetAnonymousContent(nsIContent* aParent)
nsCOMPtr<nsIContent> child;
mContent->ChildAt(i, *getter_AddRefs(child));
child->SetParent(mBoundElement);
UpdateBindingParent(child, mBoundElement);
child->SetBindingParent(mBoundElement);
}
// (3) We need to insert entries into our attribute table for any elements

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

@ -2318,31 +2318,10 @@ nsXULElement::GetParent(nsIContent*& aResult) const
return NS_OK;
}
static void UpdateBindingParent(nsIContent* aContent, nsIContent* aBindingParent)
{
aContent->SetBindingParent(aBindingParent);
PRInt32 count;
aContent->ChildCount(count);
for (PRInt32 i = 0; i < count; i++) {
nsCOMPtr<nsIContent> child;
aContent->ChildAt(i, *getter_AddRefs(child));
UpdateBindingParent(child, aBindingParent);
}
}
NS_IMETHODIMP
nsXULElement::SetParent(nsIContent* aParent)
{
mParent = aParent; // no refcount
if (mParent) {
// Get the binding parent.
nsCOMPtr<nsIContent> bindingParent;
mParent->GetBindingParent(getter_AddRefs(bindingParent));
if (bindingParent && (bindingParent.get() != mBindingParent))
UpdateBindingParent((nsIStyledContent*)this, bindingParent);
}
return NS_OK;
}
@ -4222,6 +4201,15 @@ NS_IMETHODIMP
nsXULElement::SetBindingParent(nsIContent* aParent)
{
mBindingParent = aParent; // [Weak] no addref
if (mBindingParent) {
PRInt32 count;
ChildCount(count);
for (PRInt32 i = 0; i < count; i++) {
nsCOMPtr<nsIContent> child;
ChildAt(i, *getter_AddRefs(child));
child->SetBindingParent(aParent);
}
}
return NS_OK;
}