Closed Bug 38026 Opened 24 years ago Closed 24 years ago

Need to have a Standard and NavQuirks Style sheets

Categories

(Core :: CSS Parsing and Computation, defect, P1)

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: rods, Assigned: attinasi)

References

Details

(Whiteboard: [nsbeta2+];seeking input from Ian Hickson-ckritzer;)

We have discussed this before, this should be made a priority for beta3
Setting to P1 for M17
Priority: P3 → P1
Target Milestone: --- → M17
Blocks: 28010
Sorry, it was "on top of my list" for the past 2 or 3 weeks.
Marc: this also requires cleaning up html.css and going through the code to 
remove all the quirks we have (not that many actually). Sometimes html.css has 
the standard behavior and the quirk is coded in C++, sometimes it's the opposite.
Blocks: 25580
Status: NEW → ASSIGNED
Blocks: 33300
Blocks: 32989
Here is the basic design idea:

The file ua.css currently imports two css files, html.css and xul.css
We will change this to import 4 files:
htmlw3c.css - W3C recommended ua style rules
htmlstd.css - standard mode style rules in addition to those from htmlw3c
htmlqui.css - NavQuirks style rules
xul.css - unchanged - XUL style rules

When a document is loaded, we will check for the mode a soon as possible. If 
NavQuirks mode is NOT enabled, we will remove the htmlqui.css stylesheet from 
the styleset and thus the rules in it will not be applied. If the mode is 
NavQuirks, we will make sure the htmlqui.css stylesheet is in the styleset and 
is enabled.

So the task is roughly borken down into the following: 
1) change the structure of the ua.css file
2) move style rules from html.css to the three new stylesheet files
3) eliminate any obviously redundant rules in the process of migrating the rules
4) provide a mechanism on the styleset to add/remove the quirksmode stylesheet
5) find a place to detect the mode and do the stylesheet removal/addition
If this still needs doing in 10 days (19th of May 2000) then I volunteer to do 
the first part (steps 1-3).
OS: Windows NT → All
A few things I had in mind:
- The quirks stylesheet should be synchronously loaded at startup time together 
with the rest of ua.css.
- We don't need to insert/remove the style sheet: we can just enable/disable it.
- The action should be "Disable the quirks sheet when we switch to Strict mode" 
instead of "Disable the sheet if we are not in Quirks mode".

I propose the following order (roughly the opposite of what you listed :-)
1) Find a place to detect the mode and do the stylesheet enabling/disabling.
2) Provide a mechanism on the styleset to enable/disable the quirks stylesheet.
3) Write a version of the quirks style sheet that contains just a few 
declarations in order to fix the bugs which have a dependency on this one. Leave 
htmlw3c.css empty for now.
5) Check in the changes as-is (if possible for M16) and re-assess the priority of 
this bug.
6) Build htmlw3c.css out of http://www.w3.org/TR/REC-CSS2/sample.html
7) Cleanup html.css (see bug 6625) and move the quirks where they belong.
Implementing the mechanism plus a basic version of the quirks stylesheet should 
take much less time that the overall cleanup of html.css (which will better be 
handled by Ian starting on May 19th). If it is a 1-day task, it would be nice to 
have it for M16. 
Blocks: 40134
I have this implemented and it works great! I'm nominating for nsbeta2 since 
another bug 28010 has been marked nsbeta2+ and it relies on this change.
Whiteboard: [Fix in hand]
Marc, do you want me to go through the stylesheets then?
Sure, Ian. I had posted a note to the layout ng and asked if anybody knew of any 
Quirk-only rules in html.css, only David relpied. So, if you want to go through 
the html.css and move the quirk-rules out to a file called 'quirk.css' that 
would be a great help.

I already have moved the following rules to quirk.css:

/* test rule: remove before shipping */
.moz-quirktest { text-decoration: underline; color: lime; }

/* Quirk: input images have a blue border (b=28010)*/
input[type=image] {
  border: 2px solid blue;
}

/* Quirk: DL under a OL has no margins (b=33300) */
ol dl {
  margin: 0 0 0 0;
}

/* Quirk: UL under a DL has no margins  (b=32989) */
dl ul {
  margin: 0 0 0 0;
  color: red;
}

/* make orphaned li's have inside bullet */
li {
  list-style-position: inside; 
}

/* restore outside position for lists inside li's */
li ul, li ol, li dir, li menu { 
  list-style-position: outside; 
}

/* undo previous two rules for properly nested lists */
ul li, dir li, menu li, ol li,
ul ul, ul dir, ul menu, ul ol,
dir ul, dir dir, dir menu, dir ol,
menu ul, menu dir, menu menu, menu ol,
ol ul, ol dir, ol menu, ol ol {
  list-style-position: inherit;
}

I don't have the go-ahead to checkin yet, but I think I will get it eventually.

Note that I have not broken out the W3C rules into their own files yet; that is 
secondary I think, and should probably be addressed separately.

Thanks, Ian!
It would appear that I've been unsubscribed from mozilla-layout (again). Great.

BTW, I'm not sure we really want to split html.css into htmlstd.css and 
htmlw3c.css, since they should hopefully be the same. Don't forget that the W3C 
recommended stylesheet is not exactly flawless.
No, I think you really do want a different style for some of the NavQuirks 
behavior. Some rules need !important on them for NavQuirks and the blue border 
around images is also a NavQuirks only issue.
No no, I agree that we need a _quirks mode_ stylesheet, I'm just wondering if
we need two others or just one.

At the moment, we are suggesting going with this:

   ua.css
     |
     +-- html w3c       (Always included)
     |
     +-- html standard  (Always included)
     |
     +-- html quirks    (ONLY included when in Quirks mode)
     |
     +-- xul            (Always included)

Is that right? If so, I'm asking why we need both the standard mode and the W3C
version. Why not just stick it all in the Standard mode sheet and not have a
W3C specific stylesheet.

My argument for this is that the W3C sheet won't be a copy of the W3C 
recommended sheet anyway, since that sheet is sub-optimal. And it will surely
save memory to only have three sheets instead of five.
Nominating for nsbeta2 because Marc has a fix in hand and it blocks 5 other bugs 
that could be very easily fixed if we had a NavQuirks stylesheet.
Keywords: nsbeta2
Target Milestone: M17 → M16
Whiteboard: [Fix in hand] → [nsbeta2+][Fix in hand]
[nsbeta2+]
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Fix did not include breaking out the W3C style sheet - I think that should wait 
until there is a normative one and not jsut an informative one (is that the 
right lingo?).

Changed files:
nsIStyleSet.h
nsPresContext.cpp
nsStyleSet.cpp
nsICSSStyleSheet.h
nsCSSParser.cpp
nsCSSStyleSheet.cpp
html.css
ua.css
quirk.css
html/document/src/makefile.[w]in
packages-unix, win, mak
builds/mac/NGLayoutBuildList.pm
Whiteboard: [nsbeta2+][Fix in hand] → [nsbeta2+]
rods, pierre, et al:  do we have a testcase that displays the differences between 
Standard and NavQuirks style sheets?
Whiteboard: [nsbeta2+] → [nsbeta2+] NEED TESTCASE -ckritzer
There is a test case which shows which mode the browser has selected, if that 
is what you mean:
   http://www.bath.ac.uk/%7Epy8ieh/cgi/compat-test.pl

The easiest way to verify this is to change your quirks.css file, reload 
Mozilla, and see if the quirks are taking place. For example, add 

   * { background: red ! important; color: yellow ! important; }

...and see if half the pages on the web turn red. 
I think this is all in and working correctly, but I'd like some input from Ian 
Hickson about a testcase I've constructed...already sent your way, Ian.
Whiteboard: [nsbeta2+] NEED TESTCASE -ckritzer → [nsbeta2+];seeking input from Ian Hickson-ckritzer;
Using an 'orphaned list' testcase with the following builds: 
Win 7_18_11
Mac 7_19_12
Linux 7_19_10
Verified bug fixed. Confirmed that quirks are taking place.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.