Closed
Bug 468059
Opened 17 years ago
Closed 15 years ago
MathML inside a <semantics/> element is not inheriting displaystyle="true"
Categories
(Core :: MathML, defect)
Core
MathML
Tracking
()
RESOLVED
FIXED
mozilla1.9.3a5
People
(Reporter: davemckain, Assigned: fredw)
References
()
Details
(Keywords: helpwanted)
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.0.4) Gecko/2008110510 Red Hat/3.0.4-1.el4 Firefox/3.0.4
Build Identifier: Various, up to and including Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2a1pre) Gecko/20081204 Minefield/3.2a1pre
Presentation MathML which has been wrapped within a <semantics/> wrapper (e.g. if it is being accompanied by an annotation) is being rendered with displaystyle="false", even if the containing <math/> element has display="block".
This issue appears to arise consistently across all versions of FF3 on all platforms. FF2 and below works as expected.
Reproducible: Always
Steps to Reproduce:
Visit the URL shown. This shows the same example wrapped up in three different ways.
Actual Results:
Looking at the test page I've created, Example 1 demonstrates the output obtained when there is no <semantics/> wrapper. This is rendered correctly in displaystyle="true" mode (i.e. limits above and below the sum, large fraction).
Example 2 shows what happens if there is a <semantics/> wrapper. In this case, the MathML is rendered in displaystyle="false" mode.
As a further example, Example 3 shows that putting an additional <mstyle displaystyle="true"> inside the <semantics/> elements gives the desired output, which can be used as a temporary workaround.
Expected Results:
In all cases, the same equation should be rendered in the same way, with displaystyle="true".
It seems as if the displaystyle setting is not being inherited through the <semantics/> element?
I've tried this on various releases of FF3 on various platforms (Win, Linux, Mac), including the most recent nightly for Mac OS X.
Updated•16 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee | ||
Comment 1•15 years ago
|
||
The displaystyle attribute is inherited from the parent via the nsMathMLFrame::InheritAutomaticData. We have the inheritance nsMathMLFrame > nsMathMLContainerFrame > nsMathML[MathMLelement]Frame so MathML elements can use or override this InheritAutomaticData function. However, the <semantics/> element does not currently use any nsMathMLsemanticsFrame. Rather, we simply use CSS to display the first element and hide the other. This problem is likely to happen for other MathML elements without nsMathML[MathMLelement]Frame (for example <annotation-xml>) as well as for other data inherited/transmitted between frames.
I think one way to fix this bug is to create a new function in http://mxr.mozilla.org/mozilla-central/source/layout/mathml/nsMathMLContainerFrame.cpp#1484
nsIFrame*
NS_NewMathMLContainerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
return new (aPresShell) nsMathMLContainerFrame(aContext);
}
and to add a new entry in http://mxr.mozilla.org/mozilla-central/source/layout/base/nsCSSFrameConstructor.cpp#4653
SIMPLE_MATHML_CREATE(semantics_, NS_NewMathMLContainerFrame)
This NS_NewMathMLContainerFrame can be reused for other MathML elements without their own frame implementations. We can also implement a nsMathMLsemanticsFrame that inherits nsMathMLContainerFrame. This will help having a better behaviour for <semantics/> that the one given by CSS and fix other bugs (see bug 556767).
Keywords: helpwanted
Updated•15 years ago
|
Assignee | ||
Comment 2•15 years ago
|
||
Fixed by the patch of bug 556767.
Assignee: nobody → fred.wang
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Assignee | ||
Updated•15 years ago
|
Target Milestone: --- → mozilla1.9.3a5
Comment 3•10 years ago
|
||
I'm wondering if the following is related or if I should file a separate bug.
The following snippet
<math display="block" xmlns="http://www.w3.org/1998/Math/MathML">
<semantics>
<mtable width="100%" mathbackground="red">
<mtr> <mtd><mi>x</mi></mtd> </mtr>
</mtable>
<annotation encoding="application/x-tex">x</annotation>
</semantics>
</math>
does not render as expected, i.e., at full width as would
<math display="block" xmlns="http://www.w3.org/1998/Math/MathML">
<mtable width="100%" mathbackground="red">
<mtr> <mtd><mi>x</mi></mtd> </mtr>
</mtable>
</math>
Similarly to the case above, we can work around this by repeating the styling.
<math display="block" xmlns="http://www.w3.org/1998/Math/MathML">
<semantics style="width:100%">
<mtable width="100%" mathbackground="red">
<mtr> <mtd><mi>x</mi></mtd> </mtr>
</mtable>
<annotation encoding="application/x-tex">x</annotation>
</semantics>
</math>
I asked the WG via www-math and it seems the spec leaves this kind of CSS interactions open. (Though I think the original report is definitely a bug from the point of view of the spec.)
Anyway, it seems unexpected to us at MathJax (and MathJax renders all three cases identically) and it would be great to agree with other MathML renderers on the expected behavior.
You need to log in
before you can comment on or make changes to this bug.
Description
•