Closed Bug 2010717 Opened 8 months ago Closed 4 months ago

Implement alignment-baseline: alphabetic/ideographic/central/mathematical/hanging

Categories

(Core :: Layout: Block and Inline, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
153 Branch
Tracking Status
relnote-firefox --- 153+
firefox153 --- fixed

People

(Reporter: sajidanwar, Assigned: sajidanwar)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-needed)

Attachments

(4 files)

The alignment-baseline: alphabetic keyword is new in css-inline-3 compared to vertical-align in CSS 2.1.

Blocks: 1403440

Updating this to be a single bug for implementation of alphabetic/ideographic/central/mathematical/hanging since their implementations are identical, other than the font baseline metric they're pulling from. The other existing bugs will be closed as duplicates of this one.

Summary: Implement alignment-baseline: alphabetic → Implement alignment-baseline: alphabetic/ideographic/central/mathematical/hanging
Duplicate of this bug: 2017197
Duplicate of this bug: 2010718
Duplicate of this bug: 2010719
Duplicate of this bug: 2010720
Assignee: nobody → sajidanwar94
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

This change seems to get implemented without being guarded behind a pref. Therefore, it should be documented on the right places once the patch for it lands.

Also, it seems introduction of baseline-shift and the related "shorthandification" of vertical-align got missed in the general 149 release notes. So I thought it's worth mentioning it now.

[Why is this notable]: New keywords for CSS property
[Affects Firefox for Android]: yes
[Suggested wording]: The alignment-baseline property got introduced in Firefox 149. Now it got some new keywords alphabetic, ideographic, central, mathematical, and hanging, extending the variaty of baselines to choose for alignment.
[Links (documentation, blog post, etc)]:
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/alignment-baseline
https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/149#css

relnote-firefox: --- → ?
Keywords: dev-doc-needed

Thanks Sebastian for providing that! Is that format sourced from a template somewhere?

Hi Sajid! The template for the comment is automatically added when you select the question mark from the relnote-firefox field (when editing the meta data of a bug).

Sebastian

Ah got it, good to know, thanks!

Pushed by dshin@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/482c9f881b6a https://hg.mozilla.org/integration/autoland/rev/c1fe9407a011 Implement alignment-baseline: alphabetic/ideographic/central/mathematical/hanging. r=layout-reviewers,firefox-style-system-reviewers,dshin
Pushed by asilaghi@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/e2f7575a37b1 https://hg.mozilla.org/integration/autoland/rev/89e720089ba3 Revert "Bug 2010717, Bug 2029869 - Implement alignment-baseline: alphabetic/ideographic/central/mathematical/hanging. r=layout-reviewers,firefox-style-system-reviewers,dshin" for causing wr and reftest failures

Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/59796 for changes under testing/web-platform/tests

Upstream PR was closed without merging

Flags: needinfo?(sajidanwar94)
Pushed by dshin@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/a3e1d680bbbb https://hg.mozilla.org/integration/autoland/rev/935e54490a48 Implement alignment-baseline: alphabetic/ideographic/central/mathematical/hanging. r=layout-reviewers,firefox-style-system-reviewers,dshin
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 153 Branch

Upstream PR merged by moz-wptsync-bot

Note added to our 153 nightly release notes in the Web Platform section with this wording:

The alignment-baseline property got introduced in Firefox 149. Now it got some new keywords alphabetic, ideographic, central, mathematical, and hanging, extending the variety of baselines to choose for alignment.

I am keeping the relnote-firefox? flag set until we include this note in our final 153 release notes, thanks.

Thanks Pascal! I have a suggested update to the wording to clarify its relationship to vertical-align:

The vertical-align property was converted into a shorthand for baseline-source, alignment-baseline, and baseline-shift in Firefox 149. Now, alignment-baseline supports the new keywords alphabetic, ideographic, central, mathematical, and hanging, extending the variety of baselines to choose for alignment.

Sebastian, what do you think of the above?

Flags: needinfo?(sebastianzartner)

Sounds good to me! So authors get to know about the bigger picture here, as well.

Sebastian

Flags: needinfo?(sebastianzartner)

Release note updated with comment #21 wording.

See Also: → 2043603

I am keeping the relnote-firefox? flag set until we include this note in our final 153 release notes, thanks.

(Change of internal process)

QA Whiteboard: [qa-triage-done-c154/b153]
Regressions: 2050458

Looking at the example on MDN - https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/alignment-baseline#example

this does not match what the other Browsers are doing. See attached screenshots.

I could not find an associated flag for this either

Flags: needinfo?(sajidanwar94)

This is covered by Bug 2010721 which is still open (and good reminder for me to get back to that). The example on MDN uses SVG which has only historically supported dominant-baseline in Firefox leading to the mismatch.

Flags: needinfo?(sajidanwar94)

I have tried to get this to work with:

I can not seem to make this work in any way, only the SVG <textPath> is working

Flags: needinfo?(sajidanwar94)

The specification says that aligning inline-level boxes aligns the alignment-baseline with the same baseline choice on the parent. So in your first sample, since the spans have the same font as their parents, their positions don't change since the baseline values are identical. If you did something like increase the font size of the spans or change the font family, you should observe the alignment differences.

Table cells are a bit peculiar because it's essentially a legacy mapping for the original vertical-align longhand. Previously, vertical-align: top/bottom/middle would change cell alignment; since it was converted to a shorthand, only the corresponding longhand values baseline-shift: top/bottom and alignment-baseline: middle have any effect on table cells. In your sample, if you add more lines to the cells in the first column, you should observe the middle cell with the modified alignment.

Flex items indeed have no behavior change with my implementation. I'll need to file some follow ups to determine what the right behavior here is. I actually don't see an effect on the <textPath> one right now but I'll make sure to cover it in the SVG implementation bug as I wasn't familiar with this element.

Thank you for this, the <textPath> example works in Safari & Chrome.

I have updated the <span> example - https://codepen.io/CodeRedDigital/pen/RNKyJmB?editors=1100

Ah, gotcha, that makes sense. Oh, an additional complication for the MDN docs: Chrome and Safari are listed as supporting alignment-baseline and many of the keyword values (and same for baseline-shift). But they only actually support these properties for SVG elements, as they're SVG presentation attributes that can be set with CSS. They don't support these properties for HTML elements, and Firefox is the first browser that implemented them (and did the conversion of vertical-align into a shorthand). The WPT suites show this divergence on the HTML side: https://wpt.fyi/css/css-inline/alignment-baseline and https://wpt.fyi/css/css-inline/baseline-shift

(Leaving the needinfo to remind myself to file bugs for the flex part of the specification)

Filed Bug 2062121 about alignment-baseline for flex items, and about the distinction between the alignment baseline and baseline sets more generally.

Flags: needinfo?(sajidanwar94)
See Also: → 2062121
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: