[Webkit-unassigned] [Bug 265963] New: Fix precedence of relative position in vertical modes
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Dec 6 13:58:32 PST 2023
https://bugs.webkit.org/show_bug.cgi?id=265963
Bug ID: 265963
Summary: Fix precedence of relative position in vertical modes
Product: WebKit
Version: Safari Technology Preview
Hardware: Unspecified
OS: Unspecified
Status: NEW
Keywords: BrowserCompat, WPTImpact
Severity: Normal
Priority: P2
Component: CSS
Assignee: webkit-unassigned at lists.webkit.org
Reporter: ahmad.saleem792 at gmail.com
Hi Team,
While looking into WPT failures, I noticed that two of following tests can be progressed:
Tests: http://wpt.live/css/css-writing-modes/overconstrained-rel-pos-rtl-top-bottom-vlr-007.xht & http://wpt.live/css/css-writing-modes/overconstrained-rel-pos-rtl-left-right-vlr-009.xht
Blink Commit: https://chromium.googlesource.com/chromium/src.git/+/0f97b71bdc98d3c785b329c21134f3925f51ff3a
Merge this or take Rob's patch from bug 209080.
__
Rob's patch modified:
// https://drafts.csswg.org/css-grid/#grid-item-sizing
bool isLtr = containingBlock()->style().isLeftToRightDirection();
auto writingMode = containingBlock()->style().writingMode();
if (!style().left().isAuto() || !style().right().isAuto()) {
LayoutUnit availableWidth = hasOverridingContainingBlockContentWidth()
? valueOrDefault(overridingContainingBlockContentWidth()) : containingBlock()->availableWidth();
switch (writingMode) {
case WritingMode::HorizontalTb:
if (!style().left().isAuto()) {
if (!style().right().isAuto() && !containingBlock()->style().isLeftToRightDirection())
offset.setWidth(-valueForLength(style().right(), !style().right().isFixed() ? availableWidth : 0_lu));
else offset.expand(valueForLength(style().left(), !style().left().isFixed() ? availableWidth : 0_lu), 0_lu);
} else if (!style().right().isAuto())
offset.expand(-valueForLength(style().right(), !style().right().isFixed() ? availableWidth : 0_lu), 0_lu);
break;
case WritingMode::VerticalRl:
if (!style().left().isAuto()) {
if (!style().right().isAuto())
offset.setWidth(-valueForLength(style().right(), !style().right().isFixed() ? availableWidth : 0_lu));
else
offset.setWidth(valueForLength(style().left(), !style().left().isFixed() ? availableWidth : 0_lu));
} else if (!style().right().isAuto())
offset.setWidth(-valueForLength(style().right(), !style().right().isFixed() ? availableWidth : 0_lu));
break;
case WritingMode::VerticalLr:
if (!style().left().isAuto())
offset.expand(valueForLength(style().left(), !style().left().isFixed() ? availableWidth : 0_lu), 0_lu);
else if (!style().right().isAuto())
offset.expand(-valueForLength(style().right(), !style().right().isFixed() ? availableWidth : 0_lu), 0_lu);
break;
default:
break;
}
}
// If the containing block of a relatively positioned element does not
// See <https://bugs.webkit.org/show_bug.cgi?id=26396>.
// Another exception is a grid item, as the containing block is the grid area:
// https://drafts.csswg.org/css-grid/#grid-item-sizing
std::optional<LayoutUnit> top;
std::optional<LayoutUnit> bottom;
if (!style().top().isAuto()
&& (!style().top().isPercentOrCalculated()
|| !containingBlock()->hasAutoHeightOrContainingBlockWithAutoHeight()
// FIXME: The computation of the available height is repeated later for "bottom".
// We could refactor this and move it to some common code for both ifs, however moving it outside of the ifs
// is not possible as it'd cause performance regressions.
top = valueForLength(style().top(), !style().top().isFixed()
? (hasOverridingContainingBlockContentHeight() ? overridingContainingBlockContentHeight().value_or(0_lu) : containingBlock()->availableHeight())
: LayoutUnit());
}
if (!style().bottom().isAuto()
&& (!style().bottom().isPercentOrCalculated()
|| !containingBlock()->hasAutoHeightOrContainingBlockWithAutoHeight()
|| containingBlock()->stretchesToViewport()
|| hasOverridingContainingBlockContentHeight())) {
// FIXME: Check comment above for "top", it applies here too.
bottom = valueForLength(style().bottom(), !style().bottom().isFixed()
? (hasOverridingContainingBlockContentHeight() ? overridingContainingBlockContentHeight().value_or(0_lu) : containingBlock()->availableHeight())
: LayoutUnit());
}
if (!top && !bottom) {
top = LayoutUnit();
bottom = LayoutUnit();
}
if (!top)
top = -bottom.value();
if (!bottom)
bottom = -top.value();
switch (writingMode) {
case WritingMode::HorizontalTb:
offset.expand(0_lu, top.value());
break;
case WritingMode::VerticalRl:
case WritingMode::VerticalLr:
if (isLtr)
offset.expand(0_lu, top.value());
else
offset.setHeight(-bottom.value());
break;
default:
break;
}
___
This compiles and progress above two test cases.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20231206/57c0f82f/attachment.htm>
More information about the webkit-unassigned
mailing list