**
****Etherpad users!** We are developing an extension that will allow you to create pages from etherpads quickly and easily.
Please visit our sandbox and help us test it.

# SummerOfCode/2012/DynamicMathML

## Contents

## Project Summary

The ability for Web authors to make dynamic pages is important and was requested by many users. In the case of MathML it allows such things as writing interactive pages, i.e. math quiz or similar. For the simplest interactions, the MathML specification provides the *maction* element, which is partially implemented in Mozilla's MathML engine.

However, Mozilla's maction implementation has several bugs/spec violations and some features asked by users such as the *tooltip actiontype* are not still implemented. Similarly, the rendering of MathML formulas created by Javascript is not always updated correctly. This is problematic, for example to render the MathML code generated by the MathJax library.

In this project I intend to do several things. Firstly, I intend to develop a full maction support (for example, to implement the tooltip actiontype) and to fix known maction bugs. I intend to write tests for maction and dynamic MathML rendering in general to reveal previously unknown bugs and make the implementation more reliable. Also Mozilla's MathML demo pages are incomplete and out of date, so I want to update them to follow our current maction implementation and to use MathML syntax instead of HTML+CSS.

Finally, there are some things in MathML REC that are not clear and cases when Mozilla's implementation differs from the REC, e.g. bug 749044. During this summer I plan to discuss these issues with MathML WG, fix them in Mozilla's MathML engine and possibly implement more features from the MathML spec.

## Project Goals

- To implement the "tooltip" actiontype. "Tooltip" actiontype provides the ability to display a tooltip when the cursor is pointed over the expression.

[bug 544001] - To improve implementation of maction, fix known maction bugs. [bug 734729][bug 748779][bug 749044][tracking bug 544036]
- To improve handling of attribute/child changes of MathML frames. [bug 734729][bug 750169][tracking bug 744783]
- To verify that Javascript works well with MathML, report and fix related bugs.
- To rewrite MathML demo pages using MathML REC syntax (this should be done after implementing "tooltip"). [bug 700440][bug 749103]

[MathML demo pages tracking bug 585142] - To write reftests to compare dynamically generated MathML / static MathML.

## Work done before the coding period

- maction statusline syntax was changed to follow MathML specification. [Gecko-specific notes][bug 729924]
- Fixed the bug related to maction selection attribute. According to MathML spec, it should be taken into account only with actiontype
*toggle*. [bug 739556] - Detected and fixed the bug when dynamic change of the maction actiontype attribute didn't work. [bug 745535]

## Weekly updates

### 21/05 - 27/05

This week I've been doing two things. I started to work on MathML tooltip implementation and started to work on bug 749044.

It seems that there are 3 options for tooltip implementation:

- First option is implementing it using tooltip implementation in browser.js (and also mirrored here). The problem with this option may be that this part of the code is marked as temporary, and I don't know if I can modify it. Now I am trying to contact UI team to find it out.
- Second option is about modifying mathml.css file, similar to this implementation (maction is in the bottom). The advantage of this implementation is that it allows to implement both text and MathML messages, but the disadvantage is that we will get the message in the top right corner instead of placing it near the object.
- Finally, the third option is implementing tooltip using XUL tooltip implementation. I haven't quite considered this option, so I just leave it for now.

Along with the tooltip, I am also working with bug 749044, which is a regression from bug 739556, where I fixed an issue related to maction selection attribute. By MathML REC it shouldn't be taken into account when actiontype="statusline" or "tooltip". This was done in the patch, but the behavior of the unknown actiontype was implemented improperly. There was some discussion in the MathML list, and though there was no answer from MathML WG yet, we think that selection attribute should be considered by default.

### 28/05 - 03/06

This week I was continuing my work on the MathML tooltip implementation and on bug 749044.

Investigation of the HTML tooltip implementation revealed that MathML tooltip can be implemented in browser.js simply by attaching the <math> element to the <tooltip> element that is shown. This will make code is browser.js a bit more complex, but I hope that UI reviewers will accept the code. Otherwise, I'll have to switch to other options, listed in my previous update.

I uploaded the patch to bug 749044 and now I'm waiting for a review. List of changes:

- Selection attribute on <maction> is now considered by default, i.e. when actiontype is unknown.
- MathML error is now generated when there is no actiontype attribute in <maction> element.
- MathML error is now generated when <maction> selection attribute is out of range (except in cases when actiontype attribute allows to ignore selection, e.g. statusline or tooltip).
- Fixed a bug when <maction> element could never throw a MathML error.

Also I updated my project summary, to give out some more information about the project. Next week I will continue to work on tooltip implementation, and if everything goes well, next week I could also work on MathML tooltip demo pages as well.

### 04/06 - 10/06

Another GSoC week has passed. During this week I was finishing work on previously mentioned bugs and starting to write Mochitest tests and demo pages for <maction> element. Bug 749044 was already pushed into the tree, but unfortunately some Android tests have failed. However, it needs only a small fix, which I will upload shortly. (*update*: patch is pushed into m-c)

I am sorry to announce that after an attempt to implement MathML tooltip we agreed to abandon this enhancement due to increased code complexity and security issues. For now only <mtext> tooltip will be supported, patch is already uploaded and is waiting for a review. I want to mention that MathML tooltip is not a MathML REC requirement:

*QUOTE*: "The renderer displays the first child. When the pointer pauses over the expression for a long enough delay time, the renderer displays a rendering of the message in a pop-up "tooltip" box near the expression. Many systems may limit the popup to be text, so the second child should be an mtext element in most circumstances. For non-mtext messages, renderers may provide a natural language translation of the markup if full MathML rendering is not practical, but this is not required." [Presentation Markup]

Next week I am going to finish my work on bug 544001, write Mochitest tests and update MathML demo pages according to our current syntax.