Closed Bug 17911 Opened 25 years ago Closed 24 years ago

[Content Sink] Body bgcolor not working in XML

Categories

(Core :: XML, defect, P3)

All
Windows 95
defect

Tracking

()

VERIFIED FIXED
Future

People

(Reporter: christinehoff4, Assigned: attinasi)

References

Details

(Whiteboard: [FIX IN HAND][nsbeta3+])

Attachments

(4 files)

Using build 1999110308 on Win 95. Also tested on Mac and Linux. Behavior is
cross platform

Steps to Reproduce:
1. Open attached file. Document uses HTML namespace. Body bgcolor is assigned a
value or red.

Expected result: Body should display in red.
Actual result: Body has not color.

This worked in previous 5.0 version (10/3, for example).
Summary: Body bgcolor not working in XML
This is caused by having a BODY element that's not a child of the HTML element.
I suspect the body background fixup rule.  I think if the parent isn't HTML, you
should cancel the fixup rule...

Troy?
David's analysis is correct: when the document is changed so that the parent
element of the BODY element is an HTML element in the HTML namespace, the
background misteriously appears.
Yes, the fixup rule should only apply for HTML documents (and hence the parent
is the document element)
Status: NEW → ASSIGNED
Target Milestone: M16
Acceptign bug and setting target milestone to M16...
Moving bugs out by one milestone...
Target Milestone: M16 → M17
Move back into M16 because this is related to the XML/HTML content sink 
factoring work that I want to do in M16...
Target Milestone: M17 → M16
Moving XML/HTML content sink factoring related bugs out to M17...
Target Milestone: M16 → M17
*** Bug 41431 has been marked as a duplicate of this bug. ***
Nominating for beta 3...
Keywords: nsbeta3
Summary: Body bgcolor not working in XML → [Content Sink] Body bgcolor not working in XML
correctness. Is it a usable workaround to specify the background color on the
BODY in a (possibly external) CSS stylesheet instead?
Keywords: correctness
nsbeta3-, ->future, since a workaround exists.
Whiteboard: [nsbeta3-]
Target Milestone: M17 → Future
Requesting reevaluation for nsbeta3
 1) I think this should be a reasonably simple fix to the BodyFixupRule (don't
do anything if HTML not parent)
 2) What workaround??
Whiteboard: [nsbeta3-]
Hmmmm. Works for me (background is red) using a trunk build from Wed 8/9 on NT
and Linux.

Can somebody confirm this please?

I agree with David, however, that the BodyFixupRule shoul donly apply if the
document is an HTML file. This can be done in the method
nsHTMLBodyElement::GetInlineStyleRules I believe, where the BodyFixupRule is
created. Nonetheless, I think this bug is WORKSFORME.
No, the BODY is *not* red. The root element is red.

The body is a one line element in that document.
Oops - sorry, you are right, of course. I'll look at cutting off the
BodyFixupRule when the parent of the HTMLBodyElement is not the HTMLElement -
should be easy.
Nisheeth, I hope you don't mind me taking this (it is Future'd) but I have a 
really simple fix for it... I'll attach it as a patch for consideration.
Assignee: nisheeth → attinasi
Status: ASSIGNED → NEW
Simple patch attached. Can somebody please review?
Status: NEW → ASSIGNED
Keywords: patch
Whiteboard: [FIX IN HAND]
CC'ing David Baron - can you check out the attached patch?
Hmmm.  Don't you want to put the new stuff after the
|mInner.GetInlineStyleRules(aRules)| ?
Good catch David, you are absoluttely right, thanks. 

Attaching a new patch that avoids the body fixup rule but still allows the 
inline style rules from the inner to be used.
Attached patch Corrected patchSplinter Review
Hate to say this now... but one more thing.  If someone makes body the root in a
XML doc, won't this fail because the GetParent returns null?  So should you
initialize to FALSE and set to TRUE at the inside if the tag does match?
David, if the body was the root element then we would end up creating the 
BodyFixupRule, which would be OK because it checks to make sure that the parent 
of the body is not null (the style contexts, not the content elements). However, 
it is better to check for it before creating the rule, as you suggested, and 
avoid the overhead of the rule since it won't apply anyway. One more time now...
r=dbaron, as long as there are no regressions on Ian's background tests.  (Boy,
I'm picky...)
Believe it or not, your pickiness is a tremendous asset! Thanks, David.
Approving for beta3: fix in hand, reviewed and tested. Localized change that 
will improve correctness and eliminate a tiny amount of bloat on some XML 
documents.
Whiteboard: [FIX IN HAND] → [FIX IN HAND][nsbeta3+]
Fix checked in (nsHTMLBodyElement.cpp)
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
QA Contact: chrisd → petersen
Verified fixed with 8/23 build
Status: RESOLVED → VERIFIED
see bug 73294 before reopening this bug
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: