Skip to content

Remove keyword values for mathsize when MathMLCore is enabled - #4851

Merged
webkit-early-warning-system merged 1 commit into
WebKit:mainfrom
fred-wang:eng/mathsize-named-values
Oct 4, 2022
Merged

webkit-early-warning-system merged 1 commit into
WebKit:mainfrom
fred-wang:eng/mathsize-named-values

Conversation

@fred-wang

@fred-wang fred-wang commented Sep 30, 2022 •

Copy link
Copy Markdown
Contributor

df8ef2e

Remove keyword values for mathsize when MathMLCore is enabled
https://bugs.webkit.org/show_bug.cgi?id=197493

Reviewed by Manuel Rego Casasnovas.

Currently the mathsize attribute relies on convertMathSizeIfNeeded to
convert legacy MathML3 names (`small`, `normal`, `big`) and converts
unitless values to percentages. It is then passed to the CSS parser
which accepts other `font-size` values (such as `x-small`, `larger`,
etc) [1] even if they are not part of MathML.

MathML Core only accepts `<length-percentage>` instead [2]. This commit
adds a new path when MathML Core is enabled. It passes the mathsize value
as it, removing CSS `<absolute-size>`, `<relative-size>` and `math`
keywords. This change is thus removing support for legacy MathML3 names,
nonzero unitless values and CSS keywords. However, due to some weird CSS
bug [3] we still need to explicitly disallow nonzero unitless values.

* LayoutTests/TestExpectations: Remove failures for three WPT tests.
* LayoutTests/imported/w3c/web-platform-tests/mathml/relations/css-styling/lengths-2.html: Ditto.
* LayoutTests/imported/w3c/web-platform-tests/mathml/relations/css-styling/lengths-2-expected.txt: Update expectation since we made some progress.
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/mathml/relations/css-styling/lengths-2-expected.txt: Ditto.
* LayoutTests/imported/w3c/web-platform-tests/mathml/relations/css-styling/mathsize-attribute-css-keywords.html: Force MathML Core to be enabled, so "small" is not allowed.
* LayoutTests/imported/w3c/web-platform-tests/mathml/relations/css-styling/mathsize-attribute-legacy-values.html: Ditto.
* LayoutTests/mathml/presentation/attributes-mathsize.html: Force MathML Core to be disabled, so legacy features are still supported.
* Source/WebCore/mathml/MathMLElement.cpp:
(WebCore::isDisallowedMathSizeAttribute): Helper function to remove CSS font-size keywords and nonzero unitless values (i.e. not <length-percentage>).
(WebCore::MathMLElement::collectPresentationalHintsForAttribute): Add new path explained above when MathML Core is enabled.

[1] https://www.w3.org/TR/css-fonts-4/#font-size-prop
[2] https://w3c.github.io/mathml-core/#dfn-mathsize
[3] https://bugs.webkit.org/show_bug.cgi?id=245927

Canonical link: https://commits.webkit.org/255112@main

8e8e63f

Misc iOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 🧪 win
✅ 🧪 bindings ✅ 🛠 ios-sim   🛠 mac-debug ✅ 🛠 gtk ✅ 🛠 wincairo
✅ 🧪 webkitperl   🧪 ios-wk2   🛠 mac-AS-debug ✅ 🧪 gtk-wk2
✅ 🧪 api-ios   🧪 api-mac ✅ 🧪 api-gtk
✅ 🛠 tv   🧪 mac-wk1
✅ 🛠 tv-sim ✅ 🧪 mac-wk2
✅ 🛠 🧪 merge ✅ 🛠 watch   🧪 mac-AS-debug-wk2
✅ 🛠 watch-sim ✅ 🧪 mac-wk2-stress

@fred-wang fred-wang self-assigned this Sep 30, 2022
@fred-wang
fred-wang requested a review from rwlbuis September 30, 2022 10:21
@fred-wang
fred-wang marked this pull request as draft October 1, 2022 07:01
@fred-wang
fred-wang marked this pull request as ready for review October 1, 2022 08:37
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 1, 2022

@mrego mrego left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how to comment on the commit message, so let's try here.

Whey is this [GTK][WPE] only?

And about the commit message it looks we're missing something at:

MathML Core only accepts instead [2]

Also there are some weird double spacing there and lately in the message. Could you review and update it?

@fred-wang fred-wang removed the merging-blocked Applied to prevent a change from being merged label Oct 4, 2022
@fred-wang fred-wang changed the title [GTK][WPE] Remove keyword values for mathsize Remove keyword values for mathsize when MathMLCore is enabled Oct 4, 2022
@fred-wang fred-wang added MathML For bugs specific to MathML. WebKit Nightly Build labels Oct 4, 2022
@fred-wang

Copy link
Copy Markdown
Contributor Author

I don't know how to comment on the commit message, so let's try here.

Not sure whether that's possible with github...

Whey is this [GTK][WPE] only?

This was the original bug title. We only remove this on GTK/WPE because maintainers of other ports (e.g. Apple) may not want to unship existing features.

And about the commit message it looks we're missing something at:
Also there are some weird double spacing there and lately in the message. Could you review and update it?

I think I previously did a force push and copied the commit message by hand. I tried to fix things a bit and ran git-webkit pr again, looks better now.

@fred-wang fred-wang added the merge-queue Applied to send a pull request to merge-queue label Oct 4, 2022
https://bugs.webkit.org/show_bug.cgi?id=197493

Reviewed by Manuel Rego Casasnovas.

Currently the mathsize attribute relies on convertMathSizeIfNeeded to
convert legacy MathML3 names (`small`, `normal`, `big`) and converts
unitless values to percentages. It is then passed to the CSS parser
which accepts other `font-size` values (such as `x-small`, `larger`,
etc) [1] even if they are not part of MathML.

MathML Core only accepts `<length-percentage>` instead [2]. This commit
adds a new path when MathML Core is enabled. It passes the mathsize value
as it, removing CSS `<absolute-size>`, `<relative-size>` and `math`
keywords. This change is thus removing support for legacy MathML3 names,
nonzero unitless values and CSS keywords. However, due to some weird CSS
bug [3] we still need to explicitly disallow nonzero unitless values.

* LayoutTests/TestExpectations: Remove failures for three WPT tests.
* LayoutTests/imported/w3c/web-platform-tests/mathml/relations/css-styling/lengths-2.html: Ditto.
* LayoutTests/imported/w3c/web-platform-tests/mathml/relations/css-styling/lengths-2-expected.txt: Update expectation since we made some progress.
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/mathml/relations/css-styling/lengths-2-expected.txt: Ditto.
* LayoutTests/imported/w3c/web-platform-tests/mathml/relations/css-styling/mathsize-attribute-css-keywords.html: Force MathML Core to be enabled, so "small" is not allowed.
* LayoutTests/imported/w3c/web-platform-tests/mathml/relations/css-styling/mathsize-attribute-legacy-values.html: Ditto.
* LayoutTests/mathml/presentation/attributes-mathsize.html: Force MathML Core to be disabled, so legacy features are still supported.
* Source/WebCore/mathml/MathMLElement.cpp:
(WebCore::isDisallowedMathSizeAttribute): Helper function to remove CSS font-size keywords and nonzero unitless values (i.e. not <length-percentage>).
(WebCore::MathMLElement::collectPresentationalHintsForAttribute): Add new path explained above when MathML Core is enabled.

[1] https://www.w3.org/TR/css-fonts-4/#font-size-prop
[2] https://w3c.github.io/mathml-core/#dfn-mathsize
[3] https://bugs.webkit.org/show_bug.cgi?id=245927

Canonical link: https://commits.webkit.org/255112@main
@webkit-commit-queue

Copy link
Copy Markdown
Collaborator

Committed 255112@main (df8ef2e): https://commits.webkit.org/255112@main

Reviewed commits have been landed. Closing PR #4851 and removing active labels.

@webkit-early-warning-system
webkit-early-warning-system merged commit df8ef2e into WebKit:main Oct 4, 2022
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Oct 4, 2022
@fred-wang
fred-wang deleted the eng/mathsize-named-values branch October 4, 2022 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

MathML For bugs specific to MathML.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants