Closed Bug 603106 Opened 15 years ago Closed 14 years ago

mfrac linethickness="medium" does not match the default linethickness

Categories

(Core :: MathML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla7

People

(Reporter: fredw, Assigned: fs)

References

()

Details

(Keywords: helpwanted, Whiteboard: [good first bug])

Attachments

(2 files, 4 obsolete files)

Attached file testcase
Attached patch patch with reftest (obsolete) — Splinter Review
I just dived into the Mozilla code and I think this worth a try now. Also added a reftest. Thoughts?
Thanks Florian. The reftest seems good. For the C++ part, I think we should try to have something symmetric. With the new value of MEDIUM_FRACTION_LINE, thin is expected to be twice thinner and thick twice thicker, so maybe something like MINIMUM_PIXELS: 1 (thin), 2 (medium) and 4 (thick) and in CalcLineThickness the conditions lineThickness <= defaultThickness - onePixel (thin) lineThickness = defaultThickness (medium) lineThickness >= defaultThickness + onePixel (thick) When aThicknessAttribute.IsEmpty(), the program should also follow the same path as "medium" (to set minimumThickness). I don't know how often the minimum case happens. If the values above change the default rendering in an undesired way, maybe you can try MINIMUM_PIXELS: 1 (thin), 1 (medium) and 2 (thick) instead.
Florian, please let me know if you are still working on this and need more hints.
Attached patch patch with reftest (obsolete) — Splinter Review
Thanks for your comments Frederic! I think in order to make the thickness of linethickness="1" and linethickness="medium" identical, we should use MINIMUM_PIXELS: 1 (thin), 1 (medium) and 2 (thick). I've updated the reftest to test: default == medium, default == 1 and 1 == medium. Also updated the conditions in CalcLineThickness and added a statement for aThicknessAttribute.IsEmpty() to address comment 2.
Attachment #536261 - Attachment is obsolete: true
> I think in order to make the thickness of linethickness="1" and > linethickness="medium" identical, we should use MINIMUM_PIXELS: 1 (thin), 1 > (medium) and 2 (thick). > > I've updated the reftest to test: default == medium, default == 1 and 1 == > medium. Also updated the conditions in CalcLineThickness and added a > statement for aThicknessAttribute.IsEmpty() to address comment 2. Yes, the REC says that linethickness="1" is also the default in the description of mstyle: http://www.w3.org/TR/MathML/chapter3.html#id.3.3.4.1 Your patch looks good to me, except that you can remove the following lines in the "medium" statement. if (lineThickness < defaultThickness) lineThickness = defaultThickness; because MEDIUM_FRACTION_LINE is now 1 and so lineThickness == defaultThickness. (Actually, because MEDIUM_FRACTION_LINE_MINIMUM_PIXELS and MEDIUM_FRACTION_LINE are now 1, I think the cases medium and default are useless, but you can leave them to understand better what's happening.) When you feel that your patch is ready, you can ask Karl to review it.
Assignee: nobody → elchi3
Status: NEW → ASSIGNED
Attached patch patch with reftest (obsolete) — Splinter Review
Removed unnecessary lines in the "medium" statement. > (Actually, because MEDIUM_FRACTION_LINE_MINIMUM_PIXELS and > MEDIUM_FRACTION_LINE are now 1, I think the cases medium and default are > useless, but you can leave them to understand better what's happening.) Yep, I think that's right. I kept them for now, though. So, what do you think about it Karl?
Attachment #540233 - Attachment is obsolete: true
Attachment #540308 - Flags: review?(karlt)
Attached patch patch with real reftest (obsolete) — Splinter Review
Attachment #540308 - Attachment is obsolete: true
Attachment #540310 - Flags: review?(karlt)
Attachment #540308 - Flags: review?(karlt)
Comment on attachment 540310 [details] [diff] [review] patch with real reftest Thank you for fixing this. >+ else { // use "medium" if ThicknessAttribute is not specified >+ lineThickness = NSToCoordRound(defaultThickness * MEDIUM_FRACTION_LINE); >+ minimumThickness = onePixel * MEDIUM_FRACTION_LINE_MINIMUM_PIXELS; >+ } I'd prefer to not add this case. As pointed out it is not necessary, and I think it is clearer to not have the case because there still needs to be default values set for when ParseNumericValue() fails. > else if (aThicknessAttribute.EqualsLiteral("medium")) { > lineThickness = NSToCoordRound(defaultThickness * MEDIUM_FRACTION_LINE); > minimumThickness = onePixel * MEDIUM_FRACTION_LINE_MINIMUM_PIXELS; There is value in having the "medium" condition block: it makes it clear that nothing funny is going to happen in ParseNumericValue(). However, I think it is best to remove the lineThickness and minimumThickness assignments here to have just an empty block with a comment saying that medium is default. MEDIUM_FRACTION_LINE and MEDIUM_FRACTION_LINE_MINIMUM_PIXELS can also be removed then.
Attachment #540310 - Flags: review?(karlt)
Attachment #540310 - Flags: review-
Attachment #540310 - Flags: feedback+
Yup, let's do it properly without the useless cases. I've updated the patch to address comment 8.
Attachment #540310 - Attachment is obsolete: true
Attachment #540818 - Flags: review?(karlt)
Comment on attachment 540818 [details] [diff] [review] patch with reftest Thanks!
Attachment #540818 - Flags: review?(karlt) → review+
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Flags: in-testsuite+
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla7
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: