Closed Bug 159440 Opened 23 years ago Closed 19 years ago

[Pref Stylesheet]"allow docs to use other fonts" causes pre to use variable width font family

Categories

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

defect

Tracking

()

VERIFIED FIXED
mozilla1.9alpha1

People

(Reporter: jbayes, Assigned: dbaron)

References

(Blocks 1 open bug)

Details

(Keywords: regression, Whiteboard: [patch])

Attachments

(3 files, 2 obsolete files)

Steps to reproduce: 1. Run Mozilla 1.0 2. Uncheck "Allow documents to use other fonts" prefs->appearance->fonts. 3. Load a page with a style spec of pre {font-family: monospace} and some pre text. Actual Results: The text is rendered in a variable-width font. Expected Results: The text should be rendered in a monospace font. When I say to ignore document-specified fonts, Moz should default to a monospaced font for <pre> text no matter what the document says.
confirming with linux build 20020725 it looks like it goes overboard in ignoring the document-specified font and ignores the font spec for <pre> a standard <pre> tag (without specifying a font-family) works fine. this bug did not exist in 0.9.7 marking NEW
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression
this is not a DOM problem ==> StyleSystem (?)
Assignee: jst → dbaron
Component: DOM Style → Style System
Summary: "allow docs to use other fonts" causes pre to be variable width → [Pref Stylesheet]"allow docs to use other fonts" causes pre to be variable width
This bug still exists in RedHat 9's mozilla-1.2.1 and ????'s mozilla-1.3.1
Depends on: 225047
*** Bug 245649 has been marked as a duplicate of this bug. ***
Attached patch incomplete patch (obsolete) — Splinter Review
If the pre element(or TT, CODE, xml:space="preserve") has no font-family spcifiy, the content is displayed by monospace font. But _this_ is a bug for the current code. If we will implement "allow docs to use other fonts" completely, we need the information that is displaied by default variable font or default fixed font on every element. This patch is incompletely. Because this patch is not setting the infomation whitch elements should be displaied fixed font. I don't have idea for this initialization.
Comment on attachment 150438 [details] [diff] [review] incomplete patch You clearly didn't include the whole patch here, since mDefaultFontIsFixedPitch is never set. That said, it would probably be a good idea to explain what it is you're trying to do, since from the look of the partial patch here I'm don't think I like the approach you're taking. Your changes to the IsChrome() callers almost seem to be undoing changes I made a while back. Is this a merging problem, or intentional? Please use |diff -pu12| to show function names and more context.
Attachment #150438 - Flags: review-
I'd prefer fixing this by fixing bug 79074, and I'm not quite sure how you'd fix it without doing that. So the most important of the above comments is to explain the logic of what you're trying to do.
Oops, I apologize for not reading all of comment 7. Anyway, I still don't see what it is you're trying to do. I think the right thing to do is to fix bug 79074.
> Your changes to the IsChrome() callers almost seem to be undoing changes I made > a while back. Is this a merging problem, or intentional? It is intentional. I think that I wrote more simply than the present thing. The to get the font information and to get |useDocumentFonts| value are intermingled in the current code. I separated these codes. 1. Get the value of |useDocumentFonts|. 2. Get the font name from the value of |useDocumentFonts|. If you suppose the problem that |IsChrome()| is called twice, I will write "PRBool IsChromeContext = IsChrome(mContext);". > I still don't see what it is you're trying to do. I think that the current code ALWAYS get the value of font-family that is |eCSSUnit_String|. It is bug. The current code uses the font-family value before decideing the value of |useDocumentFonts|. Then, I think as following. 1. If |useDocumentFonts| is PR_TRUE, we can use specified value of 'font-family'. 2. If |useDocumentFonts| is PR_FALSE, we must ignore specified value of 'font-family'. And we must use "default font". 3. However, the current code has two default font(variable and fixed), but we cannot know that in the current element, which should be used. Thus, I think that the element have to have the information of to use which default font. # I will sleep...(now is 03:00-JST)
Comment on attachment 150452 [details] [diff] [review] incomplete patch(diff -pu12 ver.) My idea is wrong too. In following case, this patch is not working. <pre>fixed <em style="font-family: 'hoge';">non-fixed!</em> fixed</pre>
Attachment #150452 - Attachment is obsolete: true
*** Bug 233531 has been marked as a duplicate of this bug. ***
Summary: [Pref Stylesheet]"allow docs to use other fonts" causes pre to be variable width → [Pref Stylesheet]"allow docs to use other fonts" causes pre to use variable width font family
*** Bug 253132 has been marked as a duplicate of this bug. ***
*** Bug 264440 has been marked as a duplicate of this bug. ***
*** Bug 294448 has been marked as a duplicate of this bug. ***
Attached patch patch (diff -ub)Splinter Review
This fixes the bug by essentially fixing bug 79074, except only for the default vs. monospace case. I'm not sure the rest should be fixed, so I'm attaching it here instead. It pulls the ignoring of the font name out of SetFont into ComputeFontData. I cleaned up ComputeFontData a little by always getting useDocumentFonts (which is really cheap now). This allows the second font-family-related bit to be moved inside the first, since that's the only time when generic != kGenericFont_NONE can happen. There are really three important changes here: * change just checking for _moz_fixed to also check for monospace * extract a generic from a family name string rather than requiring that the font be only a generic * move ignoring the name out, as mentioned above
Attachment #211164 - Flags: superreview?(bzbarsky)
Attachment #211164 - Flags: review?(bzbarsky)
Status: NEW → ASSIGNED
OS: Linux → All
Priority: -- → P2
Hardware: PC → All
Target Milestone: --- → mozilla1.9alpha
Comment on attachment 211164 [details] [diff] [review] patch (diff -ub) >Index: nsRuleNode.cpp > nsRuleNode::SetFont(nsPresContext* aPresContext, >+ if (aFont->mFont.name.Length() != 0) "!aFont->mFont.name.IsEmpty()" would make more sense to me, I think. r+sr=bzbarsky either way.
Attachment #211164 - Flags: superreview?(bzbarsky)
Attachment #211164 - Flags: superreview+
Attachment #211164 - Flags: review?(bzbarsky)
Attachment #211164 - Flags: review+
Checked in to trunk.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Blocks: 79074
No longer depends on: 79074
-> v. Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20060212 Firefox/1.6a1 ID:2006021206
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: