Bug 180029 - MathML Lengths should take zoom level into account
Summary: MathML Lengths should take zoom level into account
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: MathML (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: 170229
  Show dependency treegraph
 
Reported: 2017-11-27 01:20 PST by Frédéric Wang (:fredw)
Modified: 2018-01-13 04:08 PST (History)
6 users (show)

See Also:


Attachments
Testcase (LayoutTests/mathml/presentation/mspace-units.html) (1.19 KB, text/html)
2017-11-27 01:20 PST, Frédéric Wang (:fredw)
no flags Details
Patch (917 bytes, patch)
2017-11-27 01:21 PST, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff
patch (14.80 KB, patch)
2018-01-13 01:19 PST, Minsheng Liu
fred.wang: review-
fred.wang: commit-queue-
Details | Formatted Diff | Diff
Patch (7.53 KB, patch)
2018-01-13 03:01 PST, Minsheng Liu
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Frédéric Wang (:fredw) 2017-11-27 01:20:14 PST
Created attachment 327623 [details]
Testcase (LayoutTests/mathml/presentation/mspace-units.html)

This is a particular case of bug 170229. If you zoom in and out the attached testcase (LayoutTests/mathml/presentation/mspace-units.html) then you see that the relative lengths of bars are inconsistent. This is not the case for the CSS-based reference (LayoutTests/mathml/presentation/mspace-units-expected.html). I believe RenderMathMLBlock's toUserUnits() should multiply some of the values by style.effectiveZoom().
Comment 1 Frédéric Wang (:fredw) 2017-11-27 01:21:48 PST
Created attachment 327624 [details]
Patch

This patch demonstrates how mspace-units.html fails for zoomlevel=3. This gives a way to write a test for this bug.
Comment 2 Frédéric Wang (:fredw) 2018-01-04 05:04:32 PST
@Minsheng: Did you get a chance to look into this? I suspect it should be relatively easy to address since it's just one function to modify and the test is already almost written ;-)
Comment 3 Minsheng Liu 2018-01-13 01:19:06 PST
Created attachment 331279 [details]
patch
Comment 4 Frédéric Wang (:fredw) 2018-01-13 02:22:10 PST
Comment on attachment 331279 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=331279&action=review

> LayoutTests/ChangeLog:10
> +        * mathml/presentation/mspace-units-expected.html: Remove the call to setPageZoomFactor().

mspace-units does not have setPageZoomFactor() and I believe the test should actually *not* be modified as it is not affected by this patch (and please don't do whitespace only change as that makes the history more complicated).

> LayoutTests/mathml/presentation/mspace-units-with-zoom-expected.html:8
> +    }

That's interesting and seems better than using window.internals. It's the only difference you make with respect to the mspace-units.html test, right?

> Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp:173
> +

Mmh, that seems complicated. Why don't you just do "* style.effectiveZoom()" in the 6 cases below? That would make things more readable.
Comment 5 Minsheng Liu 2018-01-13 02:31:39 PST
(In reply to Frédéric Wang (:fredw) from comment #4)
> Comment on attachment 331279 [details]
> patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=331279&action=review
> 
> > LayoutTests/ChangeLog:10
> > +        * mathml/presentation/mspace-units-expected.html: Remove the call to setPageZoomFactor().
> 
> mspace-units does not have setPageZoomFactor() and I believe the test should
> actually *not* be modified as it is not affected by this patch (and please
> don't do whitespace only change as that makes the history more complicated).
> 
> > LayoutTests/mathml/presentation/mspace-units-with-zoom-expected.html:8
> > +    }
> 
> That's interesting and seems better than using window.internals. It's the
> only difference you make with respect to the mspace-units.html test, right?

Oops! I mistook the file you provided on this page with the one we have in the repository.

Note that the old test does not check the unit "mu". I agree you with that a significant change to whitespace is not history-friendly, something I have not thought of before. So I will submit a separate patch to amend that test later. For this patch, I will only include the new mspace-units-with-zoom.

And yes, other than the CSS property "zoom" and the check for "mu", there is nothing new.

> > Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp:173
> > +
> 
> Mmh, that seems complicated. Why don't you just do "* style.effectiveZoom()"
> in the 6 cases below? That would make things more readable.

I had a hard time deciding between code duplication and readability. If we are using Rust or other switch-as-expression languages, I will try to argue. However, since I am duplicating lots of "break" anyway, I agree with your proposal.
Comment 6 Frédéric Wang (:fredw) 2018-01-13 02:56:16 PST
Comment on attachment 331279 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=331279&action=review

>>> LayoutTests/ChangeLog:10
>>> +        * mathml/presentation/mspace-units-expected.html: Remove the call to setPageZoomFactor().
>> 
>> mspace-units does not have setPageZoomFactor() and I believe the test should actually *not* be modified as it is not affected by this patch (and please don't do whitespace only change as that makes the history more complicated).
> 
> Oops! I mistook the file you provided on this page with the one we have in the repository.
> 
> Note that the old test does not check the unit "mu". I agree you with that a significant change to whitespace is not history-friendly, something I have not thought of before. So I will submit a separate patch to amend that test later. For this patch, I will only include the new mspace-units-with-zoom.
> 
> And yes, other than the CSS property "zoom" and the check for "mu", there is nothing new.

OK, I did not notice your addition of "mu" (that's another reason not to do whitespace-only changes as that makes review much harder). Note that "mu" is not a CSS property nor a MathML unit. It's just an internal property based on LaTeX to represent MathML's namedspace (see Source/WebCore/mathml/MathMLElement.h). So I don't think you need to test it but if you really want to, you should use namespaces like "verythickmathspace" not "mu".
Comment 7 Minsheng Liu 2018-01-13 02:57:25 PST
(In reply to Frédéric Wang (:fredw) from comment #6)
> Comment on attachment 331279 [details]
> patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=331279&action=review
> 
> >>> LayoutTests/ChangeLog:10
> >>> +        * mathml/presentation/mspace-units-expected.html: Remove the call to setPageZoomFactor().
> >> 
> >> mspace-units does not have setPageZoomFactor() and I believe the test should actually *not* be modified as it is not affected by this patch (and please don't do whitespace only change as that makes the history more complicated).
> > 
> > Oops! I mistook the file you provided on this page with the one we have in the repository.
> > 
> > Note that the old test does not check the unit "mu". I agree you with that a significant change to whitespace is not history-friendly, something I have not thought of before. So I will submit a separate patch to amend that test later. For this patch, I will only include the new mspace-units-with-zoom.
> > 
> > And yes, other than the CSS property "zoom" and the check for "mu", there is nothing new.
> 
> OK, I did not notice your addition of "mu" (that's another reason not to do
> whitespace-only changes as that makes review much harder). Note that "mu" is
> not a CSS property nor a MathML unit. It's just an internal property based
> on LaTeX to represent MathML's namedspace (see
> Source/WebCore/mathml/MathMLElement.h). So I don't think you need to test it
> but if you really want to, you should use namespaces like
> "verythickmathspace" not "mu".

I will not add it then.
Comment 8 Minsheng Liu 2018-01-13 03:01:04 PST
Created attachment 331282 [details]
Patch
Comment 9 Minsheng Liu 2018-01-13 03:01:39 PST
Note that I reorder the switch-block to put physical units together. I hope this could improve readability a bit.
Comment 10 Frédéric Wang (:fredw) 2018-01-13 03:44:43 PST
Comment on attachment 331282 [details]
Patch

Yes, I think that's better. Thanks!
Comment 11 WebKit Commit Bot 2018-01-13 04:07:57 PST
Comment on attachment 331282 [details]
Patch

Clearing flags on attachment: 331282

Committed r226936: <https://trac.webkit.org/changeset/226936>
Comment 12 WebKit Commit Bot 2018-01-13 04:07:59 PST
All reviewed patches have been landed.  Closing bug.
Comment 13 Radar WebKit Bug Importer 2018-01-13 04:08:35 PST
<rdar://problem/36495027>