Last modified: 2014-08-31 12:39:14 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T72206, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 70206 - Improved browser fallback (future)
Improved browser fallback (future)
Status: NEW
Product: Mathoid
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
All All
: Low enhancement
: ---
Assigned To: Frédéric Wang
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-08-30 09:54 UTC by physikerwelt
Modified: 2014-08-31 12:39 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Testcase (3.04 KB, text/html)
2014-08-30 10:56 UTC, Frédéric Wang
Details

Description physikerwelt 2014-08-30 09:54:58 UTC
Discuss improved browser fallback as described here:
https://developer.mozilla.org/en-US/docs/Web/MathML/Authoring#Fallback_for_Browsers_without_MathML_support
Comment 1 physikerwelt 2014-08-30 09:58:33 UTC
Frédéric, maybe you share your ideas here?
Comment 2 Frédéric Wang 2014-08-30 10:17:26 UTC
I think our browser fallback is already good. It's just that we should try to use the standard MathML syntax

<math>
<semantics>
[MATHML]
[annotation SVG]
[annotation PNG]
</semantics>
</math>

or perhaps just one annotation (which works natively in recent Chrome versions)

<math>
<semantics>
[MATHML]
[annotation SVG]
</semantics>
</math>
<img PNG>

instead of

<math>MATHML</math>
<img SVG>
<img PNG>

and hide/show the MathML/annotation according to browser's capabilities. I don't remember why we didn't try that last time we discussed this.

Technically, that won't change much the rendering but at least this will be a more standard way and highlight that SVG/PNG are fallback.

The other thing was deciding between CSS hacks vs Javascript sniffing/feature detection, which are both bad practice anyway. But as I recall javascript could not be executed in time.
Comment 3 Frédéric Wang 2014-08-30 10:56:24 UTC
Created attachment 16320 [details]
Testcase

Here is a (valid HTML5) testcase to give the idea. Actually, the two <img> fallbacks can be in the same annotation-xml so that Blink will only display one by default.

A significant advantage of using this approach is that if we remove the style of the page (disabled by the user, copy into another document etc), Gecko, WebKit and recent versions of Blink will still display only one formula. Trident will still show the three MathML/SVG/PNG versions, though (the IE team rejected my proposal of annotation-xml for the next release).

A difficulty with that approach is the vertical/horizontal alignment of the fallback image (for which I believe we have problems/doubts anyway), but that should be studied more carefully.
Comment 4 Frédéric Wang 2014-08-30 11:07:29 UTC
Mmmh, it seems that my CSS does not work on IE, I'll need to check that later (I know it's possible to make it work since I submitted a "patch" to Microsoft!)

Another potential advantage of this approach is that it might become more friendly for accessibility tools (bug 66537), even if I suspect the "display: none" stuff is still problematic...
Comment 5 physikerwelt 2014-08-30 11:10:15 UTC
Thank you Frédéric,

do you think to include (and not link) the SVG to the MathML element here would be a good idea.
Comment 6 Frédéric Wang 2014-08-30 11:16:25 UTC
(In reply to physikerwelt from comment #5)
> Thank you Frédéric,
> 
> do you think to include (and not link) the SVG to the MathML element here
> would be a good idea.

This would make possible to keep the SVG fallback integrated into the doc when  doing copy & paste (better when one is offline). Also, I wonder if that helps for the size/alignment issues. However, this would add more code in the page itself so I suspect increased parsing time in browsers even when they don't use the SVG fallback. Also, this would be one more step away from our current approach, so this could be considered separately/later.
Comment 7 Frédéric Wang 2014-08-30 11:32:02 UTC
(In reply to Frédéric Wang from comment #4)

> Another potential advantage of this approach is that it might become more
> friendly for accessibility tools (bug 66537), even if I suspect the
> "display: none" stuff is still problematic...

Yet another advantage of this more standard approach: even if we default to PNG to start with, the "copy MathML / copy LaTeX" commands provided by https://addons.mozilla.org/en-US/firefox/addon/mathml-copy/ or similar tools will work. More generally this more standard approach could help any MathML-aware tools...
Comment 8 physikerwelt 2014-08-30 12:16:06 UTC
Initially we dropped this approach, because some browsers did ignore the MathML tag and showed all the embedded content.
Do you know how one could test the page rendering time.
I have not found a good way to do accurate measurements via the command line.
Comment 9 Frédéric Wang 2014-08-30 12:47:16 UTC
(In reply to physikerwelt from comment #8)
> Initially we dropped this approach, because some browsers did ignore the
> MathML tag and showed all the embedded content.

OK, I think that should no longer really be a problem now that we have a better idea on which "CSS hacks" allow to control which element to hide/display. The vertical & horizontal alignment might need more care, though.

> Do you know how one could test the page rendering time.
> I have not found a good way to do accurate measurements via the command line.

I'm not really sure. You might want to try to put some <script/> in the header or listening for "DOMContentLoaded" or "load". Note that the additional SVG code might also affect the server-side load time. I don't know to which extent.
Comment 10 Frédéric Wang 2014-08-30 13:02:15 UTC
So now I remember what was the problem: WebKit Nightly has support for semantics and always displays the first MathML child without the possibility to switch to the annotation fallback... (for Gecko, it is somewhat accidental that "display: none" on the first child allows to do that...)
Comment 11 physikerwelt 2014-08-31 12:39:14 UTC
Ok. We should somehow test with a lot of browsers before we publish something.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links