Closed Bug 744783 Opened 12 years ago Closed 10 years ago

Improve handling of attribute/child changes of MathML frames

Categories

(Core :: MathML, defect, P5)

defect

Tracking

()

RESOLVED FIXED
mozilla29

People

(Reporter: fredw, Unassigned)

References

Details

This is a bug for issues related to attribute/child changes of MathML frames. I make it depends on a couple of other bugs already reported. Andrii Zui has shown interest in working on these issues this summer. I also suggested him to write a couple of tests for dynamic changes in MathML expressions because I suspect there are other bugs currently unknown. Possible related issues to consider are attribute changes on an mstyle element, change of the selected child in maction@toggle, propagations of PresentationData / EmbellishData.

First there are two XXXldb comments in functions handling child changes

http://mxr.mozilla.org/mozilla-central/source/layout/mathml/nsMathMLContainerFrame.cpp#745
http://mxr.mozilla.org/mozilla-central/source/layout/mathml/nsMathMLContainerFrame.cpp#789

saying that we don't need to add dirty flags to all the descendants, just marking the ancestor dirty is enough. I'm also wondering why we do that. If that turns out to be unnecessary then we can just remove these operations.

There is also another XXXldb in nsMathMLContainerFrame::AttributeChanged:

http://mxr.mozilla.org/mozilla-central/source/layout/mathml/nsMathMLContainerFrame.cpp#835

This function is sometimes overridden in child classes but I expect we can do a much better job here. Currently, it seems that we essentially almost always reflow the frame when an attribute changes.
Performance of dynamic changes to MathML DOMs shouldn't matter in practice, should it? Let's not spend energy or code on issues that don't matter.

(In reply to Frédéric Wang from comment #0)
> http://mxr.mozilla.org/mozilla-central/source/layout/mathml/
> nsMathMLContainerFrame.cpp#745
> http://mxr.mozilla.org/mozilla-central/source/layout/mathml/
> nsMathMLContainerFrame.cpp#789
> 
> saying that we don't need to add dirty flags to all the descendants, just
> marking the ancestor dirty is enough. I'm also wondering why we do that. If
> that turns out to be unnecessary then we can just remove these operations.

It is unnecessary. Just remove them.
(In reply to Robert O'Callahan (:roc) (Mozilla Corporation) from comment #1)
> Performance of dynamic changes to MathML DOMs shouldn't matter in practice,
> should it? Let's not spend energy or code on issues that don't matter.

My impression is that there are more and more people willing to use javascript and MathML (I just saw yet another message on the MathJax user list yesterday), and more specifically to write interactive MathML editor (e.g. see the recent HostMath spams on various mailing lists). I don't think most of them are currently interested in speed (they generally use MathJax to redisplay the whole formula at each change). However, I saw that optimization was at least important for this person who decided to stop using MathJax for that purpose:

http://www.stephendiehl.com/?p=237
http://www.stephendiehl.com/?p=224
http://www.stephendiehl.com/?p=254

But the real point of this report was really to fix the known bugs about dynamic MathML formulas. Indeed, even with this drastic reflow method used, some formulas are still not rendered correctly after DOM updates. So we should fix these bugs and I think it's worth trying to find other similar bugs that are likely to exist and to write nonregression tests for them. If at the same time we can optimize a bit the AttributeChanged function, that's even better.
Depends on: 477915
Depends on: 745535
Depends on: 748779
Depends on: 750169
Depends on: 755541
Depends on: 522393
Priority: -- → P5
Depends on: 832713
Depends on: 832800
No longer depends on: 750169
Closing this meta bug.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
You need to log in before you can comment on or make changes to this bug.