Closed Bug 1807035 Opened 2 years ago Closed 2 years ago

[wpt-sync] Sync PR 37651 - [mathml] Refactor parsing of mspace and mpadded attributes

Categories

(Core :: MathML, task, P4)

task

Tracking

()

RESOLVED FIXED
111 Branch
Tracking Status
firefox111 --- fixed

People

(Reporter: mozilla.org, Unassigned)

References

(Depends on 1 open bug, )

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 37651 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/37651
Details from upstream follow.

Frédéric Wang <fwang@igalia.com> wrote:

[mathml] Refactor parsing of mspace and mpadded attributes

Currently, the mspace and mpadded elements use different approaches
to parse the width/height/depth/lspace/voffset attributes:

  • AddPropertyToPresentationAttributeStyle for the value (sometimes
    excluding values that ends with a '%' character).

  • AddPropertyToPresentationAttributeStyle for a calc expression
    built from the values of the height and depth attributes.

  • Using AddMathLengthToComputedStyle (sometimes accepting percentage)
    which relies on CSSParser::ParseLengthPercentage, but these parsing
    methods seem incorrect.

The initial goal was to use the default value when a percentage is
specified and this is what is currently specified in MathML Core
[1] [2]. However, the current implementation has bugs that make
percentage accepted in some cases [3] or unnecessarily mapping
invalid values to presentational hints.

This CL tries to bring more consistency on the parsing side by always
delegating the parsing of the attribute value to
CSSParser::ParseLengthPercentage before mapping it to presentational
hint or internal properties. The parsing parameter
AllowPercentages::kNo is used to ensure percentages are always
treated as invalid. CSSParser::ParseLengthPercentage is also refine to
always trim whitespaces, and check there is no remaining token after
the parsed \<length-percentage>.

This refactoring will facilitate specifying Chrome's behavior in
MathML Core regarding interaction with CSS width/height properties,
handling of percentages and use of presentational hints [4].

[1] https://w3c.github.io/mathml-core/#space-mspace
[2] https://w3c.github.io/mathml-core/#inner-box-and-requested-parameters
[3] crbug.com/1402998
[4] https://github.com/w3c/mathml-core/issues/75#issuecomment-1359541618

Bug: 6606, 1402998
Change-Id: Ibe4e49af4c3f4aeb5c153e10b4ba93d26db20849

Reviewed-on: https://chromium-review.googlesource.com/4120274
WPT-Export-Revision: 789122ba7c13ab6a1ad4878956447ea19cdc46a3

Component: web-platform-tests → MathML
Product: Testing → Core

CI Results

Ran 0 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 3 tests

Status Summary

Firefox

OK : 1
PASS: 4
FAIL: 3

Chrome

OK : 1
PASS: 5
FAIL: 2

Safari

OK : 1
PASS: 4
FAIL: 3

Links

GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ef3dc57c21dc [wpt PR 37651] - [mathml] Refactor parsing of mspace and mpadded attributes, a=testonly https://hg.mozilla.org/integration/autoland/rev/ebfd66be1e67 [wpt PR 37651] - Update wpt metadata, a=testonly
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 111 Branch
You need to log in before you can comment on or make changes to this bug.