# Improve handling of attribute/child changes of MathML frames

RESOLVED FIXED in mozilla29

Core
MathML
P5
normal
RESOLVED FIXED
5 years ago
3 years ago

## Tracking

Trunk
mozilla29
Points:
---
Dependency tree / graph

## Details

(Reporter)

### Description

5 years ago
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.

### Comment 1

5 years ago
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.
(Reporter)

### Comment 2

5 years ago
(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.
(Reporter)

### Updated

5 years ago
Depends on: 477915

### Updated

5 years ago
Depends on: 745535
(Reporter)

### Updated

5 years ago
Depends on: 748779
(Reporter)

### Updated

5 years ago
Depends on: 750169
(Reporter)

### Updated

5 years ago
Depends on: 755541
(Reporter)

### Updated

5 years ago
Depends on: 522393
(Reporter)

### Updated

5 years ago
Priority: -- → P5

### Updated

4 years ago
Depends on: 832713
(Reporter)

### Updated

4 years ago
Depends on: 832800
(Reporter)

### Updated

3 years ago
No longer depends on: 750169
(Reporter)

### Comment 3

3 years ago
Closing this meta bug.
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED

### Updated

3 years ago
Target Milestone: --- → mozilla29
You need to log in before you can comment on or make changes to this bug.