Page MenuHomePhabricator

SVG height incorrect
Closed, ResolvedPublic

Description

screenshot

I tested the MathML SVG mode and it seems that the height is incorrect and the bottom of the image is cut-off.

http://en.wikipedia.beta.wmflabs.org/wiki/User:Physikerwelt

screenshot attached. Apple Safari


Version: unspecified
Severity: normal
URL: http://en.wikipedia.beta.wmflabs.org/wiki/User:Physikerwelt

Attached:

Screen_Shot_2014-08-28_at_12.34.51.png (381×694 px, 87 KB)

Details

Reference
bz70119

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:32 AM
bzimport set Reference to bz70119.

physik wrote:

Thanks for reporting this.
I'm not sure if that's a problem of the Math extension of a problem of the SVG itself.
Does the SVG http://en.wikipedia.beta.wmflabs.org/w/index.php?title=Special:MathShowImage&hash=826676a6a5ad24552f0d5af1593434cc&mode=5 cropped for you as well?

physik wrote:

I played a bit with the options. I think the hight is too small. If we'd add a few percent to the height the problem would be solved. Do you think that would be a good solution?

Does MathJax still returns the image height in relative CSS units (ex)? I'm not sure we can be convert them reliably into px...

I don't think the problem is in the height (increasing it will only scale the image) but other CSS effects, leading to clipping. From a quick try, stripping the style from the SVG seems to fix this so perhaps having the inline style both within the SVG and on the img tag is causing trouble.

Found it.

It's primarily the styling on the SVG element itself. That adds two 2px of margin (which are not part of the SVG sizes).

Then on the inline image element, we add another 2px. Remove those two and everything works just fine.

physik wrote:

That means it's a problem on the server side.

Change 165861 had a related patch set uploaded by GWicke:
Bug 70119: Strip style from SVG image

https://gerrit.wikimedia.org/r/165861

Change 165861 merged by jenkins-bot:
Bug 70119: Strip style from SVG image

https://gerrit.wikimedia.org/r/165861

Change 165949 had a related patch set uploaded by GWicke:
Revert "Bug 70119: Strip style from SVG image"

https://gerrit.wikimedia.org/r/165949

Change 165949 merged by GWicke:
Revert "Bug 70119: Strip style from SVG image"

https://gerrit.wikimedia.org/r/165949

This should be basically fixed for new formulas. Old formulas already in the database might still have the old margins, and will need to be cleared.

I believe that one way to do this is is ?action=purge&mathpurge=true, although in my tests that did not work reliably. I'm keeping this bug open until this is verified fixed in production.