Closed Bug 1809568 Opened 2 years ago Closed 1 year ago

[css-inline-3] Implement CSS "baseline-source: auto | first | last"

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
115 Branch
Tracking Status
firefox115 --- fixed

People

(Reporter: dholbert, Assigned: dshin)

References

(Blocks 3 open bugs)

Details

(Keywords: dev-doc-needed)

Attachments

(3 files)

https://drafts.csswg.org/css-inline-3/#baseline-source

This lets you control which baseline to use, when baseline-aligning an inline-level box that has multiple baselines (e.g. inline-block or inline-flex).

Values:

auto
  Specifies last-baseline alignment for inline-block,
  first-baseline alignment for everything else. 
first
  Specifies first-baseline alignment. 
last
  Specifies last-baseline alignment. 

WPT tests already exist; see bug 1805273 for the current test-failures that are testing this feature.

IanK posted a demo on twitter.
Tweet: https://twitter.com/bfgeek/status/1612518098611089408
Demo (doesn't work anywhere right now, except maybe bleeding edge Chrome): https://jsfiddle.net/pj7vudxq/
Screenshot of the demo's rendering, with the feature implemented: https://twitter.com/bfgeek/status/1612518098611089408/photo/1

Assignee: nobody → dshin
Depends on: 1811311
Depends on: 1812679
See Also: → 1812679

Some baseline exports are context-sensitive. One example: In line-layout scenario,
the last baseline of a scroll container is always the margin-end. In other (e.g.
flex, grid) scenarios, it's the border-box clamped offset to the last line in the
container.
This enables the required 3 different behaviours for inline-block scroll containers
for 3 different baseline-source values:

  • auto: Last baseline, margin-end
  • first: Border-box clamped offset to the first line
  • last: Border-box clamped offset to the last line

Depends on D173884

Remaining failures relate to table captions missing & webkit-line-clamp.

Depends on D173886

Blocks: 1827481
Blocks: 1827483
Blocks: 1827484
Pushed by dshin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7ecabe895121 Part 1: Implement parsing for `baseline-source`. r=emilio https://hg.mozilla.org/integration/autoland/rev/b8401947aea0 Part 2: Provide `GetNaturalBaselineBOffset` with baseline export context. r=emilio https://hg.mozilla.org/integration/autoland/rev/573dc0bd9554 Part 3: Implement `baseline-source` behaviour. r=emilio

Backed out for causing build bustages on nsLineLayout.cpp.

LATER EDIT: some other failures appeared:

[task 2023-05-01T14:44:11.662Z] 14:44:11     INFO -  gmake[4]: Entering directory '/builds/worker/workspace/obj-build/layout/generic'
[task 2023-05-01T14:44:11.665Z] 14:44:11     INFO -  /builds/worker/fetches/sccache/sccache /builds/worker/fetches/clang/bin/clang++ -Qunused-arguments --target=i686-linux-android16 -o Unified_cpp_layout_generic3.o -c  -I/builds/worker/workspace/obj-build/dist/stl_wrappers -I/builds/worker/workspace/obj-build/dist/system_wrappers -include /builds/worker/checkouts/gecko/config/gcc_hidden.h -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fstack-clash-protection -DNDEBUG=1 -DTRIMMED=1 -DOS_POSIX=1 -DOS_LINUX=1 -DMOZ_HAS_MOZGLUE -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL -DSTATIC_EXPORTABLE_JS_API -I/builds/worker/checkouts/gecko/layout/generic -I/builds/worker/workspace/obj-build/layout/generic -I/builds/worker/workspace/obj-build/ipc/ipdl/_ipdlheaders -I/builds/worker/checkouts/gecko/ipc/chromium/src -I/builds/worker/checkouts/gecko/layout/base -I/builds/worker/checkouts/gecko/layout/forms -I/builds/worker/checkouts/gecko/layout/painting -I/builds/worker/checkouts/gecko/layout/style -I/builds/worker/checkouts/gecko/layout/tables -I/builds/worker/checkouts/gecko/layout/xul -I/builds/worker/checkouts/gecko/docshell/base -I/builds/worker/checkouts/gecko/dom/base -I/builds/worker/checkouts/gecko/dom/html -I/builds/worker/checkouts/gecko/dom/xul -I/builds/worker/checkouts/gecko/gfx/cairo/cairo/src -I/builds/worker/workspace/obj-build/dist/include -I/builds/worker/workspace/obj-build/dist/include/nspr -I/builds/worker/workspace/obj-build/dist/include/nss -DMOZILLA_CLIENT -include /builds/worker/workspace/obj-build/mozilla-config.h --sysroot=/builds/worker/fetches/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot --gcc-toolchain=/builds/worker/fetches/android-ndk/toolchains/llvm/prebuilt/linux-x86_64 -fno-sized-deallocation -fno-aligned-new -fno-short-enums -fcrash-diagnostics-dir=/builds/worker/artifacts -fno-exceptions -fPIC -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pipe -gdwarf-4 -Xclang -load -Xclang /builds/worker/workspace/obj-build/build/clang-plugin/libclang-plugin.so -Xclang -add-plugin -Xclang moz-check -Oz -mno-outline -fno-omit-frame-pointer -funwind-tables -Werror -Wall -Wbitfield-enum-conversion -Wdeprecated-this-capture -Wempty-body -Wformat-type-confusion -Wignored-qualifiers -Wpointer-arith -Wshadow-field-in-constructor-modified -Wsign-compare -Wtautological-constant-in-range-compare -Wtype-limits -Wno-error=tautological-type-limit-compare -Wunreachable-code -Wunreachable-code-return -Wunused-but-set-parameter -Wno-invalid-offsetof -Wclass-varargs -Wempty-init-stmt -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wloop-analysis -Wno-range-loop-analysis -Wc++2a-compat -Wenum-compare-conditional -Wenum-float-conversion -Wno-ambiguous-reversed-operator -Wno-error=deprecated -Wno-error=deprecated-anon-enum-enum-conversion -Wno-error=deprecated-enum-enum-conversion -Wno-error=deprecated-pragma -Wno-error=deprecated-this-capture -Wcomma -Wimplicit-fallthrough -Wstring-conversion -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=free-nonheap-object -Wno-error=atomic-alignment -Wno-error=deprecated-builtins -Wformat -Wformat-security -Wno-psabi -Wthread-safety -Wno-unknown-warning-option -fno-strict-aliasing -ffp-contract=off  -MD -MP -MF .deps/Unified_cpp_layout_generic3.o.pp   Unified_cpp_layout_generic3.cpp
[task 2023-05-01T14:44:11.665Z] 14:44:11     INFO -  In file included from Unified_cpp_layout_generic3.cpp:20:
[task 2023-05-01T14:44:11.665Z] 14:44:11    ERROR -  /builds/worker/checkouts/gecko/layout/generic/nsLineLayout.cpp:1382:7: error: non-void lambda does not return a value in all control paths [-Werror,-Wreturn-type]
[task 2023-05-01T14:44:11.665Z] 14:44:11     INFO -        }();
[task 2023-05-01T14:44:11.665Z] 14:44:11     INFO -        ^
[task 2023-05-01T14:44:11.665Z] 14:44:11     INFO -  1 error generated.
[task 2023-05-01T14:44:11.666Z] 14:44:11    ERROR -  gmake[4]: *** [/builds/worker/checkouts/gecko/config/rules.mk:670: Unified_cpp_layout_generic3.o] Error 1
[task 2023-05-01T14:44:11.666Z] 14:44:11     INFO -  gmake[4]: Leaving directory '/builds/worker/workspace/obj-build/layout/generic'
Flags: needinfo?(dshin)

Fix in to ensure that when the unreachable assert gets taken out in opt build, we return something

Flags: needinfo?(dshin)
Pushed by dshin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a481bf06452b Part 1: Implement parsing for `baseline-source`. r=emilio https://hg.mozilla.org/integration/autoland/rev/ab0f2bcb2d9b Part 2: Provide `GetNaturalBaselineBOffset` with baseline export context. r=emilio https://hg.mozilla.org/integration/autoland/rev/eaa7fe280317 Part 3: Implement `baseline-source` behaviour. r=emilio
Blocks: 1830771

Build bustage is interesting - Seems like the compiler matched the concrete LineIterator type instead of the template parameter of the same name. Probably change the name to be distinct anyway
Mochitests fixed.

Flags: needinfo?(dshin)
Pushed by dshin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6060fc7d49d4 Part 1: Implement parsing for `baseline-source`. r=emilio https://hg.mozilla.org/integration/autoland/rev/0a20b91de67b Part 2: Provide `GetNaturalBaselineBOffset` with baseline export context. r=emilio https://hg.mozilla.org/integration/autoland/rev/e862b1560caa Part 3: Implement `baseline-source` behaviour. r=emilio

Backed out for causing build bustages

Flags: needinfo?(dshin)

That is strange that the compiler doesn't like it. it's a switch statement for a enum class that handles all enums, so that should not cause any issues...
Nevertheless, the function in question isn't needed anymore.

Flags: needinfo?(dshin)

(In reply to David Shin[:dshin] from comment #14)

That is strange that the compiler doesn't like it. it's a switch statement for a enum class that handles all enums, so that should not cause any issues...

I think that's https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87950 and also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53479

(It sounds like gcc is erring on the side of caution, in case the enum instance was constructed from an integer literal; or if it represents a bitmask, for example, and there are masked combinations-of-bits that may not have names & aren't handled by the switch statement.)

Pushed by dshin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/cc00422f050a Part 1: Implement parsing for `baseline-source`. r=emilio,devtools-reviewers https://hg.mozilla.org/integration/autoland/rev/5a91ce4870e4 Part 2: Provide `GetNaturalBaselineBOffset` with baseline export context. r=emilio https://hg.mozilla.org/integration/autoland/rev/56ce741da8f5 Part 3: Implement `baseline-source` behaviour. r=emilio

Hm, this test passes locally, and doesn't seem related to changes I made, but I might be missing something.
:apoirot, does this test need to be updated for the CSS property?

Status: NEW → RESOLVED
Closed: 1 year ago
Flags: needinfo?(dshin) → needinfo?(poirot.alex)
Resolution: --- → FIXED

Hm, retriggers were successful - seems like an intermittent. Bug 1833475 filed, re-landing.

Flags: needinfo?(poirot.alex)
See Also: → 1833475
Pushed by dshin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2407088e9b49 Part 1: Implement parsing for `baseline-source`. r=emilio,devtools-reviewers https://hg.mozilla.org/integration/autoland/rev/b518133a5c34 Part 2: Provide `GetNaturalBaselineBOffset` with baseline export context. r=emilio https://hg.mozilla.org/integration/autoland/rev/6c5bbcbafce9 Part 3: Implement `baseline-source` behaviour. r=emilio
Pushed by dshin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/84adbd6c4347 Part 1: Implement parsing for `baseline-source`. r=emilio,devtools-reviewers https://hg.mozilla.org/integration/autoland/rev/c5bd896169e2 Part 2: Provide `GetNaturalBaselineBOffset` with baseline export context. r=emilio https://hg.mozilla.org/integration/autoland/rev/fbd094ba98b7 Part 3: Implement `baseline-source` behaviour. r=emilio

MDN apparently wasn't updated for this.

Keywords: dev-doc-needed
Target Milestone: --- → 115 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: