Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 843759a5e680f823f6407133148a56abe6b0d96a
https://github.com/WebKit/WebKit/commit/843759a5e680f823f6407133148a56abe6b0d96a
Author: Alan Baradlay <[email protected]>
Date: 2026-07-16 (Thu, 16 Jul 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/css/css-align/abspos/justify-self-static-position-htb-ltr-htb-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/css-align/abspos/justify-self-static-position-htb-ltr-htb.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-align/abspos/justify-self-static-position-htb-rtl-htb-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/css-align/abspos/justify-self-static-position-htb-rtl-htb.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-align/abspos/justify-self-static-position-vlr-ltr-vlr-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/css-align/abspos/justify-self-static-position-vlr-ltr-vlr.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-align/abspos/justify-self-static-position-vrl-ltr-vrl-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/css-align/abspos/justify-self-static-position-vrl-ltr-vrl.html
M Source/WebCore/rendering/PositionedLayoutConstraints.cpp
M Source/WebCore/rendering/PositionedLayoutConstraints.h
Log Message:
-----------
[css-align] Support justify-self for out-of-flow boxes at the static position
https://bugs.webkit.org/show_bug.cgi?id=319534
rdar://problem/182362366
Reviewed by Antti Koivisto.
<div style="position: relative; width: 500px">
<div style="position: absolute; justify-self: center">hi</div>
</div>
The absolutely-positioned inner block has auto insets, so it is placed at its
static position and should be centered within the 500px containing block.
Instead
justify-self was ignored: the box stayed pinned to the inline-start edge.
When both inline-axis insets are auto, an out-of-flow box is placed at its
static
position. Per css-align-3, justify-self then aligns its margin box within the
box's
static-position rectangle, resolving against the containing block's writing
mode; a
justify-self of auto resolves to the parent's justify-items. (See
https://drafts.csswg.org/css-align-3/#justify-abspos and Appendix A.)
Align the box within the remaining inline space at the static position when
justify-self asks for it, gating the behavior with
shouldAlignStaticPositionInInlineAxis() so it applies only where it is both
correct
and covered by tests:
- the box's own inline axis (non-orthogonal); orthogonal / block-axis static
positioning keeps the existing static-position path,
- justify-self resolves (against the parent) to something other than normal;
normal / auto-resolving-to-normal keeps the box at its static position,
- the static-position containing block is a plain block container -- flex and
grid
containers place their abspos children with their own alignment rules, and
alignment does not apply to out-of-flow children of inline boxes.
Everything else falls back to the existing static-position placement, which
already
resolves the correct edge for every writing-mode / direction / orthogonal
combination via the parent-relative static inset. This gating matters because
the
existing path anchors to that parent-relative edge while resolveAlignmentShift()
reasons in the containing block's writing mode; the two diverge whenever the
parent's inline direction differs from the containing block's, so aligning
unconditionally mispositioned ordinary (justify-self: auto) abspos boxes. The
block-axis / align-self behavior is unchanged.
* Source/WebCore/rendering/PositionedLayoutConstraints.cpp:
(WebCore::PositionedLayoutConstraints::shouldAlignStaticPositionInInlineAxis
const):
(WebCore::PositionedLayoutConstraints::resolvePosition const):
(WebCore::PositionedLayoutConstraints::resolveAlignmentValue const):
* Source/WebCore/rendering/PositionedLayoutConstraints.h:
*
LayoutTests/imported/w3c/web-platform-tests/css/css-align/abspos/justify-self-static-position-htb-ltr-htb.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-align/abspos/justify-self-static-position-htb-ltr-htb-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-align/abspos/justify-self-static-position-htb-rtl-htb.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-align/abspos/justify-self-static-position-htb-rtl-htb-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-align/abspos/justify-self-static-position-vlr-ltr-vlr.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-align/abspos/justify-self-static-position-vlr-ltr-vlr-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-align/abspos/justify-self-static-position-vrl-ltr-vrl.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-align/abspos/justify-self-static-position-vrl-ltr-vrl-expected.txt:
Added.
Canonical link: https://commits.webkit.org/317349@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications