Closed Bug 84299 Opened 24 years ago Closed 24 years ago

we negate the alternate pseudo-attribute in <?xml-stylesheet alternate="yes"?>

Categories

(Core :: XML, defect, P1)

defect

Tracking

()

VERIFIED FIXED
mozilla0.9.2

People

(Reporter: brentmh, Assigned: ian)

References

Details

(Keywords: css1, Whiteboard: [Hixie-P2] [have fix])

Attachments

(4 files)

If multiple stylesheets are attached to an XML document with <?xml-stylesheet?> directives, mozilla should prefer to the one with alternate="no" (or with no alternate attribute since "no" is the default). On recent 0.9.1 branch builds on Linux, mozilla appears to be applying the wrong stylesheet. I'll attach an example case
Attached file XML file with two CSS stylesheets (deleted) —
Attached file Alternate stylesheet (deleted) —
Attached file Default stylesheet (deleted) —
Further investigation suggests that we simply interpret alternate="yes" as "no" and vice versa. The fix is a one character fix. Insert a "!" before the "*" on the line that does: if (*aIsAlternate) { ...of nsXMLProcessingInstruction::GetStyleSheetInfo in /content/xml/content/ src/nsXMLProcessingInstruction.cpp. This is exactly the way the way that it is done in nsHTMLLinkElement::GetStyleSheetInfo() in content/html/content/src/ nsHTMLLinkElement.cpp. Once again, the evil of cut and paste rears its head. cc'ing attinasi for sr= and check in, and dbaron for r= and a=. Thanks guys! :-)
Assignee: pierre → ian
Status: UNCONFIRMED → NEW
Component: Style System → XML
Ever confirmed: true
Keywords: css1
OS: Linux → All
Priority: -- → P1
QA Contact: ian → petersen
Hardware: PC → All
Summary: Mozilla selects wrong stylesheet for XML by default → we negate the alternate pseudo-attribute in <?xml-stylesheet alternate="yes"?>
Whiteboard: [Hixie-P2] [have fix]
Target Milestone: --- → mozilla0.9.2
The patch Ian suggested is: Index: nsXMLProcessingInstruction.cpp =================================================================== RCS file: /cvsroot/mozilla/content/xml/content/src/nsXMLProcessingInstruction.cpp,v retrieving revision 1.24 diff -u -d -r1.24 nsXMLProcessingInstruction.cpp --- nsXMLProcessingInstruction.cpp 2001/06/05 19:21:32 1.24 +++ nsXMLProcessingInstruction.cpp 2001/06/07 13:14:28 @@ -575,7 +575,7 @@ } rv = NS_MakeAbsoluteURI(aUrl, href, baseURL); - if (*aIsAlternate) { + if (!*aIsAlternate) { if (!aTitle.IsEmpty()) { // possibly preferred sheet nsAutoString prefStyle; mInner.mDocument->GetHeaderData(nsHTMLAtoms::headerDefaultStyle, r=dbaron
Ugh. r=peterv.
hyatt: dude, dbaron tells me attinasi's away, could I have your sr=? Thanks :-)
OK, I'm back. sr=attinasi for the inline patch
a= asa@mozilla.org for checkin to the trunk. (on behalf of drivers)
Blocks: 83989
Thanks Hixie. I checked this in, I hope you don't mind.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
peterv: Not at all! Thanks!
Marking verified in the June 27th branch build.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: