diff --git a/content/xbl/src/nsBindingManager.cpp b/content/xbl/src/nsBindingManager.cpp index 4a2edb4daf4f..1fee1b298c24 100644 --- a/content/xbl/src/nsBindingManager.cpp +++ b/content/xbl/src/nsBindingManager.cpp @@ -629,6 +629,18 @@ nsBindingManager::WalkRules(nsIStyleSet* aStyleSet, GetOutermostStyleScope(aContent, getter_AddRefs(parent)); WalkRules(aFunc, aData, parent, aContent); + + if (parent) { + // We cut ourselves off, but we still need to walk the document's attribute sheet + // so that inline style continues to work on anonymous content. + nsCOMPtr document; + aContent->GetDocument(*getter_AddRefs(document)); + nsCOMPtr container(do_QueryInterface(document)); + nsCOMPtr inlineSheet; + container->GetInlineStyleSheet(getter_AddRefs(inlineSheet)); + nsCOMPtr inlineCSS(do_QueryInterface(inlineSheet)); + (*aFunc)((nsISupports*)(inlineCSS.get()), aData); + } return NS_OK; } diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index d030c163873e..b0b05597d8a1 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -5434,6 +5434,14 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell, content->SetParent(aParent); content->SetDocument(aDocument, PR_TRUE, PR_TRUE); + content->SetBindingParent(content); + nsCOMPtr 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); diff --git a/layout/html/style/src/nsCSSFrameConstructor.cpp b/layout/html/style/src/nsCSSFrameConstructor.cpp index d030c163873e..b0b05597d8a1 100644 --- a/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -5434,6 +5434,14 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell, content->SetParent(aParent); content->SetDocument(aDocument, PR_TRUE, PR_TRUE); + content->SetBindingParent(content); + nsCOMPtr 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); diff --git a/layout/xbl/src/nsBindingManager.cpp b/layout/xbl/src/nsBindingManager.cpp index 4a2edb4daf4f..1fee1b298c24 100644 --- a/layout/xbl/src/nsBindingManager.cpp +++ b/layout/xbl/src/nsBindingManager.cpp @@ -629,6 +629,18 @@ nsBindingManager::WalkRules(nsIStyleSet* aStyleSet, GetOutermostStyleScope(aContent, getter_AddRefs(parent)); WalkRules(aFunc, aData, parent, aContent); + + if (parent) { + // We cut ourselves off, but we still need to walk the document's attribute sheet + // so that inline style continues to work on anonymous content. + nsCOMPtr document; + aContent->GetDocument(*getter_AddRefs(document)); + nsCOMPtr container(do_QueryInterface(document)); + nsCOMPtr inlineSheet; + container->GetInlineStyleSheet(getter_AddRefs(inlineSheet)); + nsCOMPtr inlineCSS(do_QueryInterface(inlineSheet)); + (*aFunc)((nsISupports*)(inlineCSS.get()), aData); + } return NS_OK; }