mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Fixed the application of the BodyFixupRule so that it is only created when the BODY element has the HTML element as its parent. b=17911 r=dbaron@fas.harvard.edu
This commit is contained in:
parent
49833bd619
commit
1139956e4c
@ -974,9 +974,27 @@ static nsIHTMLCSSStyleSheet* GetInlineStyleSheet(nsIDocument* aDocument)
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBodyElement::GetInlineStyleRules(nsISupportsArray* aRules)
|
||||
{
|
||||
PRBool useBodyFixupRule = PR_FALSE;
|
||||
|
||||
mInner.GetInlineStyleRules(aRules);
|
||||
|
||||
if (nsnull == mInner.mInlineStyleRule) {
|
||||
// The BodyFixupRule only applies when we have HTML as the parent of the BODY
|
||||
// - check if this is the case, and set the flag to use the rule only if
|
||||
// the HTML is the parent of the BODY
|
||||
nsCOMPtr<nsIContent> parentElement;
|
||||
GetParent(*getter_AddRefs(parentElement));
|
||||
if (parentElement) {
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
if (NS_SUCCEEDED(parentElement->GetTag(*getter_AddRefs(tag))) && tag){
|
||||
if (tag.get() == nsHTMLAtoms::html) {
|
||||
// create the fixup rule
|
||||
useBodyFixupRule = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nsnull == mInner.mInlineStyleRule &&
|
||||
useBodyFixupRule) {
|
||||
nsIHTMLCSSStyleSheet* sheet = nsnull;
|
||||
|
||||
if (nsnull != mInner.mDocument) { // find style sheet
|
||||
|
@ -974,9 +974,27 @@ static nsIHTMLCSSStyleSheet* GetInlineStyleSheet(nsIDocument* aDocument)
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBodyElement::GetInlineStyleRules(nsISupportsArray* aRules)
|
||||
{
|
||||
PRBool useBodyFixupRule = PR_FALSE;
|
||||
|
||||
mInner.GetInlineStyleRules(aRules);
|
||||
|
||||
if (nsnull == mInner.mInlineStyleRule) {
|
||||
// The BodyFixupRule only applies when we have HTML as the parent of the BODY
|
||||
// - check if this is the case, and set the flag to use the rule only if
|
||||
// the HTML is the parent of the BODY
|
||||
nsCOMPtr<nsIContent> parentElement;
|
||||
GetParent(*getter_AddRefs(parentElement));
|
||||
if (parentElement) {
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
if (NS_SUCCEEDED(parentElement->GetTag(*getter_AddRefs(tag))) && tag){
|
||||
if (tag.get() == nsHTMLAtoms::html) {
|
||||
// create the fixup rule
|
||||
useBodyFixupRule = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nsnull == mInner.mInlineStyleRule &&
|
||||
useBodyFixupRule) {
|
||||
nsIHTMLCSSStyleSheet* sheet = nsnull;
|
||||
|
||||
if (nsnull != mInner.mDocument) { // find style sheet
|
||||
|
Loading…
Reference in New Issue
Block a user