Closed Bug 1066554 Opened 11 years ago Closed 11 years ago

[shadow-dom] The mathml.css stylesheet is not loaded when inserting shadow MathML

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla35

People

(Reporter: fredw, Assigned: jkitch)

References

()

Details

(Keywords: regression)

Attachments

(3 files, 4 obsolete files)

Attached file testcase.html
In the attached testcase, if you click "insert Shadow Math" you see a "X^X" formula with the exponent that incorrectly has the same size as the base. If you click "insert Math", you then get the correct rendering for the shadow formula. This would suggest that mathml.css (which contains -moz-increment-script-level rules) is not loaded when inserting Shadow Math. This used to work in Gecko 31 but is broken in nightly. I haven't tried to find a regression window, but bug 946065 might be a candidate. Note: the use case was for the <x-tex> custom element http://fred-wang.github.io/TeXZilla/examples/customElement.html
My guess is that some code uses GetCurrentDoc() which is null for shadow dom. It should use GetComposedDoc(). Where do we start loading mathml.css?
Oh, maybe it is a different issue http://mxr.mozilla.org/mozilla-central/source/dom/mathml/nsMathMLElement.cpp#92 See bug 1062578. Could you test the patch in that bug?
Last good revision: f5232023af37 First bad revision: a2f0e0619332 Pushlog: https://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=f52320 23af37&tochange=a2f0e0619332
(In reply to Olli Pettay [:smaug] from comment #2) > See bug 1062578. > Could you test the patch in that bug? No, that does not seem to help :-( (In reply to James Kitchener from comment #3) > https://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=f5232023af37&tochange=a2f0e0619332 So maybe bug 992521...
Attached patch path that seems to work (obsolete) — Splinter Review
The attached patch seems to fix it, however I do not know that bit of code well enough to be confident of correctness. https://tbpl.mozilla.org/?tree=Try&rev=ce7b4a241b9d
Please retest on top of the patch for bug 1062578?
Depends on: 1062578
And in particular, we need a clear understanding of what exactly the nsIDocument argument to BindToTree is supposed to mean in the Shadow DOM world. Just changing it ad-hoc in one particular spot definitely seems wrong.
Flags: needinfo?(wchen)
The nsIDocument passed to BindToTree is currently the uncomposed document, so it will be null for elements in a shadow tree.
Flags: needinfo?(wchen)
OK. Then we should probably change the mathml stylesheet loading bits somehow to look at the composed doc...
OK, of course I should have said that before but we probably want something similar for other UA stylesheets: http://dxr.mozilla.org/mozilla-central/search?q=EnsureOnDemandBuiltInUASheet (mmmh, BTW shouldn't SVGDocument::EnsureNonSVGUserAgentStyleSheetsLoaded also load the MathML stylesheet? That is, can we use a MathML document to do something like bug 1016145?)
> shouldn't SVGDocument::EnsureNonSVGUserAgentStyleSheetsLoaded also load the MathML > stylesheet No, since we have other codepaths that will load the mathml bits on demand.
Attached patch patch (obsolete) — Splinter Review
The initial patch was very wrong. The attached patch follows the suggestion from comment 9. The effects should be limited to MathML elements. Other issues involving SVG/XUL-specific stylesheets I would prefer to leave to someone with more experience in that area.
Attachment #8488984 - Flags: review?(bzbarsky)
Attached patch patch (obsolete) — Splinter Review
The patch wasn't refreshed before submission. nsMathMLElement::UnbindFromTree() now uses the composed document as well to be consistent.
Attachment #8488600 - Attachment is obsolete: true
Attachment #8488984 - Attachment is obsolete: true
Attachment #8488984 - Flags: review?(bzbarsky)
Attachment #8488985 - Flags: review?(bzbarsky)
Comment on attachment 8488985 [details] [diff] [review] patch Please don't change the link-update behavior; that stuff should be done in concert with other link-related code that assumes certain behavior from bind/unbind. And it really would be good to fix the other EnsureOnDemandBuiltInUASheet consumers too. They should need pretty identical changes. If you're not willing to do that, at the very least make sure there are followup bugs filed on them.
Attachment #8488985 - Flags: review?(bzbarsky) → review-
Attached patch patch (obsolete) — Splinter Review
Review comments have been addressed. If the XUL and SVG changes require their own tests, I'll split them off into followup bugs.
Assignee: nobody → jkitch.bug
Attachment #8488985 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #8490024 - Flags: review?(bzbarsky)
Attached file svg-shadow.html
For the tests, you might also consider == reftests if that's easier (normal DOM vs shadow DOM) although I don't don't know if we can use XUL in reftest pages. Here is a quick testcase for SVG.
Comment on attachment 8490024 [details] [diff] [review] patch Looks great, thanks! A test for SVG would be good, yes. Followup bug is OK. I wouldn't worry too much about a test for XUL if it's being too annoying.
Attachment #8490024 - Flags: review?(bzbarsky) → review+
Attached patch patchSplinter Review
Thank you for the SVG test. Both tests have been converted to reftests.
Attachment #8490024 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla35
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: