Closed Bug 216456 Opened 22 years ago Closed 18 years ago

'font' with system font keyword and 'font-family' with generic font family keyword behaving incorrectly

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: stanio, Assigned: dbaron)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

(Keywords: qawanted, Whiteboard: [patch])

Attachments

(4 files, 2 obsolete files)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030815 Netscape/7.1 (ax; svg) Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030815 Read the notes in the test case for more info. Reproducible: Always Steps to Reproduce: 1. Open the test case. 2. Observe the results. 3. Check with the descriptions. Actual Results: Using: { font: message-box; font-family: sans-serif; } The 'font-family' statement resets all other font properties which should(!) be set by the 'font' shorthand property. This is a case with system font keyword used with 'font' and later generic font family keyword applied to the 'font-family' property. Expected Results: The 'font' shorthand property should set all other font properties in compliance with the CSS spec therefore the above test case should not to fail.
Attached image Mozilla screen shot
Mozilla screen shot of the browser window on my system.
Attached image IE screen shot
Internet Explorer screen shot of the browser window on my system. Here, IE shows the test case fine unlike Mozilla.
Could it be related to Bug 120903?
Keywords: qawanted
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows XP → All
Hardware: PC → All
To do this per CSS spec we'd probably need to resolve the system fonts into a family/size/etc in the CSS parser instead of whenever we actually end up doing it...
Attached file Simplified Test Page (INVALID) (obsolete) —
QA Contact: ian → style-system
Bug 377947 was supposed to fix this, but it looks like it didn't.
Comment on attachment 204104 [details] Simplified Test Page (INVALID) This testcase is invalid: system fonts are used in the font shorthand as only a standalone value; they can't be followed by a font-family value.
Attachment #204104 - Attachment description: Simplified Test Page → Simplified Test Page (INVALID)
Attachment #204104 - Attachment is obsolete: true
If I delete the second item of the testcase, the third one is corrected. That suggests there's a problem with nsRuleNode::ComputeFontData in the case where aStartStruct is non-null.
Attached patch patch (obsolete) — Splinter Review
This patch works, and also fixes bug 199755 fully. I'd like to think about it a little more before requesting review. This code goes back to the beginning of these functions: http://bonsai.mozilla.org/cvsblame.cgi?file=/mozilla/content/html/style/src/nsRuleNode.cpp&rev=3.22&mark=1913,1918-1920,1923-1925,1966-1968#1912
Comment on attachment 271007 [details] [diff] [review] patch We can't stomp on aFont as temporary storage because it's sometimes the only copy of aStartStruct we have, and we're not allowed to modify it. I'm comfortable passing parentFont twice, since the COMPUTE_START_* macros often set up the parent struct as the same as the struct, so we have to be able to handle that in general. And the code looks like it handles it fine. This code still scares me a little, but I think this is right.
Attachment #271007 - Flags: superreview?(bzbarsky)
Attachment #271007 - Flags: review?(bzbarsky)
Comment on attachment 271007 [details] [diff] [review] patch This seems to break generic fonts entirely, though.
Attachment #271007 - Flags: superreview?(bzbarsky)
Attachment #271007 - Flags: review?(bzbarsky)
I think the nsRuleNode code added in bug 74186/bug 99010 is fundamentally incompatible with the aStartStruct parameter; fixing this probably just depends on bug 380915.
Depends on: 380915
Attached patch patchSplinter Review
...but I can effectively skip the optimization by changing SetGenericFont, which fixes the major problems with this interaction (although I think some remain; see the XXXldb comment being added).
Attachment #271007 - Attachment is obsolete: true
Attachment #271263 - Flags: superreview?(bzbarsky)
Attachment #271263 - Flags: review?(bzbarsky)
Blocks: 175415
Comment on attachment 271263 [details] [diff] [review] patch >+ if (i != 0) >+ fontData.mFamily.Reset(); // avoid unnecessary operations in SetFont() Document that this is because i == 0 is our own context and we do care about the font-family then? r+sr=bzbarsky. Sorry for the delay; I have an irrational aversion to reviewing code I don't think I fully understand, so this took awhile. :(
Attachment #271263 - Flags: superreview?(bzbarsky)
Attachment #271263 - Flags: superreview+
Attachment #271263 - Flags: review?(bzbarsky)
Attachment #271263 - Flags: review+
Fix checked in to trunk.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Flags: in-testsuite?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: