зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1900231: Parse anchor-center for self-alignment properties. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D221872
This commit is contained in:
Родитель
0137e37f18
Коммит
150d59da52
|
@ -116,7 +116,9 @@ nscoord CSSAlignUtils::AlignJustifySelf(const StyleAlignFlags& aAlignment,
|
|||
} else if (alignment == StyleAlignFlags::END) {
|
||||
nscoord size = aChildSize.Size(aAxis, wm);
|
||||
offset = aCBSize - (size + marginEnd);
|
||||
} else if (alignment == StyleAlignFlags::CENTER) {
|
||||
} else if (alignment == StyleAlignFlags::CENTER ||
|
||||
alignment == StyleAlignFlags::ANCHOR_CENTER) {
|
||||
// TODO(dshin, Bug 1909339): For now, treat `anchor-center` as `center`.
|
||||
nscoord size = aChildSize.Size(aAxis, wm);
|
||||
offset = (aCBSize - size + marginStart - marginEnd) / 2;
|
||||
} else {
|
||||
|
|
|
@ -3992,7 +3992,9 @@ void SingleLineCrossAxisPositionTracker::EnterAlignPackingSpace(
|
|||
// No space to skip over -- we're done.
|
||||
} else if (alignSelf == StyleAlignFlags::FLEX_END) {
|
||||
mPosition += aLine.LineCrossSize() - aItem.OuterCrossSize();
|
||||
} else if (alignSelf == StyleAlignFlags::CENTER) {
|
||||
} else if (alignSelf == StyleAlignFlags::CENTER ||
|
||||
alignSelf == StyleAlignFlags::ANCHOR_CENTER) {
|
||||
// TODO(dshin, Bug 1909339): For now, treat `anchor-center` as `center`.
|
||||
// Note: If cross-size is odd, the "after" space will get the extra unit.
|
||||
mPosition += (aLine.LineCrossSize() - aItem.OuterCrossSize()) / 2;
|
||||
} else if (alignSelf == StyleAlignFlags::BASELINE ||
|
||||
|
|
|
@ -55,6 +55,8 @@ bitflags! {
|
|||
const SPACE_AROUND = 15;
|
||||
/// 'space-evenly'
|
||||
const SPACE_EVENLY = 16;
|
||||
/// `anchor-center`
|
||||
const ANCHOR_CENTER = 17;
|
||||
|
||||
// Additional flags stored in the upper bits:
|
||||
/// 'legacy' (mutually exclusive w. SAFE & UNSAFE)
|
||||
|
@ -124,6 +126,7 @@ impl ToCss for AlignFlags {
|
|||
AlignFlags::SPACE_BETWEEN => "space-between",
|
||||
AlignFlags::SPACE_AROUND => "space-around",
|
||||
AlignFlags::SPACE_EVENLY => "space-evenly",
|
||||
AlignFlags::ANCHOR_CENTER => "anchor-center",
|
||||
_ => unreachable!(),
|
||||
})
|
||||
}
|
||||
|
@ -718,6 +721,7 @@ fn parse_self_position<'i, 't>(
|
|||
"self-end" => AlignFlags::SELF_END,
|
||||
"left" if axis == AxisDirection::Inline => AlignFlags::LEFT,
|
||||
"right" if axis == AxisDirection::Inline => AlignFlags::RIGHT,
|
||||
"anchor-center" if static_prefs::pref!("layout.css.anchor-positioning.enabled") => AlignFlags::ANCHOR_CENTER,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -730,6 +734,7 @@ fn list_self_position_keywords(f: KeywordsCollectFn, axis: AxisDirection) {
|
|||
"center",
|
||||
"self-start",
|
||||
"self-end",
|
||||
"anchor-center",
|
||||
]);
|
||||
if axis == AxisDirection::Inline {
|
||||
f(&["left", "right"]);
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
[anchor-center-001.html]
|
||||
[e.style['align-self'\] = "anchor-center" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['align-items'\] = "anchor-center" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['justify-self'\] = "anchor-center" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['justify-items'\] = "anchor-center" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[Property align-self value 'anchor-center']
|
||||
expected: FAIL
|
||||
|
||||
[Property align-items value 'anchor-center']
|
||||
expected: FAIL
|
||||
|
||||
[Property justify-self value 'anchor-center']
|
||||
expected: FAIL
|
||||
|
||||
[Property justify-items value 'anchor-center']
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[anchor-center-002.html]
|
||||
expected: FAIL
|
Загрузка…
Ссылка в новой задаче