-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Implement text-transform: math-auto. #51271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
EWS run on previous version of this PR (hash ff2cbd6) Details |
|
EWS run on previous version of this PR (hash 4ef6bd7) Details |
|
EWS run on previous version of this PR (hash 4c63398) Details |
|
EWS run on previous version of this PR (hash 7bcea8b) Details |
|
EWS run on previous version of this PR (hash c0a2731) Details |
|
Hi @Ahmad-S792, whenever you can would it be ok for you to review this patch? Or maybe point me to another reviewer. Thanks! :) |
...ts/imported/w3c/web-platform-tests/css/css-text/parsing/text-transform-computed-expected.txt
Show resolved
Hide resolved
Unfortunately, I don't have reviewer rights, so I would defer the review from Apple side to @nt1m or @mdubet or @vitorroriz . |
|
EWS run on previous version of this PR (hash 1e38be2) Details |
|
Since this is quite a large diff from the previous version, here is a list of changes and the motivation behind them:
Additionally I removed the exceptions in the test expectations for iOS and Mac, let's see what the failures are in the EWS. Maybe they are not doing the text transform properly or maybe it's an issue with fonts. |
| WebKitLegacy: | ||
| default: false | ||
| WebKit: | ||
| "PLATFORM(GTK) || PLATFORM(WPE)": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this on by default for these platforms?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially I started developing this under coreMathMLEnabled, which is on for GTK and WPE. We thought it was better to move it to a standalone preference, so when I was making it I set the same defaults as the previous one. The next step should be disabling the legacy mathvariant behaviour when MathML Core and this preference are enabled, so I think it makes sense having that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could enable text-transform: math-auto on all platforms. However, this is interacting with the mathvariant attribute and may lead to unexpected results for web developers when the legacy mathvariant attribute values are enabled. So probably better to keep math-auto disabled on platforms that have MathML Core disabled.
|
EWS run on previous version of this PR (hash a21e804) Details |
https://bugs.webkit.org/show_bug.cgi?id=202302 Reviewed by NOBODY (OOPS!). Part of WebKit#51271. Moves the MathVariant enum and the mathVariant function to the TextTransform file, making it easier to implement text-transform: math-auto in the next patch without having RenderText depend on various MathML classes. Also moves the convertToSingleCodePoint function there, which now doesn't perform whitespace trimming of the input string, as MathML Core doesn't define this. The two existing callers of this function are changed to do the trimming beforehand. No behaviour change. * Source/WebCore/mathml/MathMLElement.h: * Source/WebCore/mathml/MathMLOperatorElement.cpp: (WebCore::MathMLOperatorElement::parseOperatorChar): * Source/WebCore/mathml/MathMLPresentationElement.cpp: (WebCore::MathMLPresentationElement::parseMathVariantAttribute): (WebCore::MathMLPresentationElement::specifiedMathVariant): * Source/WebCore/mathml/MathMLTokenElement.cpp: (WebCore::MathMLTokenElement::convertToSingleCodePoint): Deleted. * Source/WebCore/mathml/MathMLTokenElement.h: * Source/WebCore/platform/graphics/TextTransform.cpp: (WebCore::convertToSingleCodePoint): (WebCore::ExtractKey): (WebCore::MathVariantMappingSearch): (WebCore::legacyMathVariant): * Source/WebCore/platform/graphics/TextTransform.h: * Source/WebCore/rendering/mathml/MathMLStyle.cpp: (WebCore::MathMLStyle::updateStyleIfNeeded): (WebCore::MathMLStyle::resolveMathMLStyle): * Source/WebCore/rendering/mathml/MathMLStyle.h: * Source/WebCore/rendering/mathml/RenderMathMLToken.cpp: (WebCore::RenderMathMLToken::updateMathVariantGlyph): (WebCore::ExtractKey): Deleted. (WebCore::MathVariantMappingSearch): Deleted. (WebCore::mathVariant): Deleted.
fred-wang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit difficult for me to understand this code without digging more, so I'll defer to other reviewers.
But as I see math-auto cannot be combined with other values per https://www.w3.org/TR/css-text-4/#text-transform-property
So your code does really follow the spec.
Do we have WPT tests to check different cases of math-auto combined with other values? Can we add some?
...eb-platform-tests/css/css-text/text-transform/math/text-transform-math-auto-003-expected.txt
Show resolved
Hide resolved
Source/WebInspectorUI/UserInterface/External/CSSDocumentation/CSSDocumentation.js
Outdated
Show resolved
Hide resolved
|
EWS run on previous version of this PR (hash 27d65ff) Details |
|
EWS run on previous version of this PR (hash 748d8ee) Details |
|
EWS run on previous version of this PR (hash 162963c) Details |
|
EWS run on current version of this PR (hash 38de434) Details |
fred-wang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but deferring to CSS reviewers.
|
@nt1m, @vitorroriz could you take a look at the updated version whenever you can? Thanks! |
|
Safe-Merge-Queue: Build #72940. |
https://bugs.webkit.org/show_bug.cgi?id=202302 Reviewed by Frédéric Wang and Tim Nguyen. MathML Core defines the math-auto text-transform (https://w3c.github.io/mathml-core/#math-auto-transform). On text nodes containing a single character, it maps it to the italic counterpart. * LayoutTests/TestExpectations: * LayoutTests/imported/w3c/web-platform-tests/css/css-text/parsing/text-transform-computed-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-text/parsing/text-transform-valid-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-text/text-transform/math/text-transform-math-auto-003-expected.txt: * Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: * Source/WebCore/css/CSSPrimitiveValueMappings.h: * Source/WebCore/css/CSSProperties.json: * Source/WebCore/css/CSSValueKeywords.in: * Source/WebCore/css/parser/CSSParserContext.cpp: (WebCore::applyUASheetBehaviorsToContext): (WebCore::add): * Source/WebCore/css/parser/CSSParserContext.h: * Source/WebCore/rendering/RenderText.cpp: (WebCore::convertToMathAuto): (WebCore::applyTextTransform): * Source/WebCore/rendering/style/RenderStyle.h: * Source/WebCore/rendering/style/RenderStyleConstants.cpp: (WebCore::operator<<): * Source/WebCore/rendering/style/RenderStyleConstants.h: * Source/WebCore/style/StyleBuilderConverter.h: (WebCore::Style::BuilderConverter::convertTextTransform): * Source/WebCore/style/StyleExtractorConverter.h: (WebCore::Style::ExtractorConverter::convertTextTransform): * Source/WebCore/style/StyleExtractorSerializer.h: (WebCore::Style::ExtractorSerializer::serializeTextTransform): * Source/WebInspectorUI/UserInterface/External/CSSDocumentation/CSSDocumentation.js: Canonical link: https://commits.webkit.org/302003@main
38de434 to
80e858b
Compare
|
Committed 302003@main (80e858b): https://commits.webkit.org/302003@main Reviewed commits have been landed. Closing PR #51271 and removing active labels. |
|
This broke PlayStation (which has a committer-restricted EWS) due to a missing include (or #if): This should be trivial enough to not warrant a revert; let me know if you can fix this quickly, otherwise I can do so this time. |
|
Fixing in #52864. |
|
Thanks for the quick fix @rkirsling |
80e858b
38de434
🛠 playstation