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:

Details

Reference
bz70119

Event Timeline

bzimport raised the priority of this task from to Normal.
bzimport set Reference to bz70119.
TheDJ created this task.Aug 28 2014, 10:37 AM

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?

fredw added a comment.Aug 28 2014, 4:41 PM

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

Pkra added a comment.Aug 28 2014, 5:46 PM

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.

TheDJ added a comment.Sep 3 2014, 2:15 PM

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.