[webkit-dev] MathML layout refactor proposal
Ryosuke Niwa
rniwa at webkit.org
Mon Dec 14 13:47:08 PST 2015
Hi Alex,
I think this refactoring makes a lot of sense. This is very close to
what I wanted to do with MathML four years ago so I'm very happy to
hear that you're taking the initiative here.
- R. Niwa
On Wed, Dec 9, 2015 at 3:35 AM, Alejandro Garcia Castro <alex at igalia.com> wrote:
>
> Hi,
>
> In the last months we have been working on refactoring the MathML
> layout code to make it more maintainable, because in the current point
> fixing issues or adding new features has been too complex.
>
> We have reached the point where we think we have to discuss whether
> this work makes sense and whether it is interesting for the WebKit
> community. If so, we will start pushing the initial patches from our
> branch to upstream.
>
> The idea behind the refactor is to remove FlexBox dependency and
> create its own layout MathML methods. The main reasons to do this are:
>
> - Reduce code complexity: Adapting FlexBox layout (which is already
> complex) in order to create the MahtML layout made the code too
> complex, a big technical debt that made the improvement of MathML
> more difficult every day.
>
> - Avoid just another FlexBox dependent code: When we had to add
> general layout alignment support we had a lot of problems trying
> to solve some the MathML issues because it was not clear how it
> worked with the FlexBox.
>
> - Improve performance: We do not need all the features FlexBox
> layout adds for most of the MathML blocks but we are executing
> all that code. We also can simplify the render tree structures
> that were created to make the FlexBox layout work.
>
> - Make easier to improve the MathML implementation: Using
> independent renderer classes gives more flexibility to get exact
> positioning and spacing required to get high-quality math
> rendering based on TeX rules and the OpenType MATH table. (cf
> http://www.mathml-association.org/MathMLinHTML5/)
>
> We have a working prototype that basically passes the current MathML
> tests and removes the FlexBox dependency in:
>
> https://github.com/alexgcastro/webkit/tree/MathMLLayout
>
> We have basically one commit per MathML renderer that we had to
> replace. This is still initial code and we need more work and add more
> tests to make sure we are improving the situation.
>
> We want to do it incrementally with 2 steps:
> 1. Remove FlexBox dependency but do not break the tests, this means
> keep the RenderTree structure. This is basically done, and we just
> need review and try to push them.
> 2. Refactor the RenderTree structure, removing the anonymous nodes
> created to make FlexBox work and all the code that it was
> required. We already have the Fractions and Underover implemented
> and the code is much clearer. This will break the tests relying on
> a PNG image or a render tree reference. Hence we will do it also
> per renderer and rebasing the tests after each commit.
>
> The main con of the change that the code could be bigger in some parts
> of the renderers, but more direct and simple, so it should be actually
> good regarding maintenance.
>
> If you have any question, proposal or comment just send it, it would
> be great to hear some more feedback, and check if we should proceed
> with this effort.
>
> Greetings,
>
> Alex
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev
More information about the webkit-dev
mailing list