mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb: Don't resolve flow-relative values for float
too early
This allows `getComputedStyle()` to return the correct value if `float` is set to `inline-start` or `inline-end`
This commit is contained in:
parent
3f5c339d59
commit
28b24b72bc
Notes:
github-actions[bot]
2025-06-17 07:27:49 +00:00
Author: https://github.com/tcl3
Commit: 28b24b72bc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5109
Reviewed-by: https://github.com/gmta ✅
4 changed files with 36 additions and 15 deletions
|
@ -975,19 +975,6 @@ void StyleComputer::for_each_property_expanding_shorthands(PropertyID property_i
|
|||
return;
|
||||
}
|
||||
|
||||
if (property_id == CSS::PropertyID::Float) {
|
||||
auto keyword = value.to_keyword();
|
||||
|
||||
// FIXME: Honor writing-mode, direction and text-orientation.
|
||||
if (keyword == Keyword::InlineStart) {
|
||||
set_longhand_property(CSS::PropertyID::Float, CSSKeywordValue::create(Keyword::Left));
|
||||
return;
|
||||
} else if (keyword == Keyword::InlineEnd) {
|
||||
set_longhand_property(CSS::PropertyID::Float, CSSKeywordValue::create(Keyword::Right));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (property_is_shorthand(property_id)) {
|
||||
// ShorthandStyleValue was handled already, as were unresolved shorthands.
|
||||
// That means the only values we should see are the CSS-wide keywords, or the guaranteed-invalid value.
|
||||
|
|
|
@ -1164,9 +1164,10 @@ void BlockFormattingContext::layout_floating_box(Box const& box, BlockContainer
|
|||
};
|
||||
|
||||
// Next, float to the left and/or right
|
||||
if (box.computed_values().float_() == CSS::Float::Left) {
|
||||
// FIXME: Honor writing-mode, direction and text-orientation.
|
||||
if (box.computed_values().float_() == CSS::Float::Left || box.computed_values().float_() == CSS::Float::InlineStart) {
|
||||
float_box(FloatSide::Left, m_left_floats);
|
||||
} else if (box.computed_values().float_() == CSS::Float::Right) {
|
||||
} else if (box.computed_values().float_() == CSS::Float::Right || box.computed_values().float_() == CSS::Float::InlineEnd) {
|
||||
float_box(FloatSide::Right, m_right_floats);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
Harness status: OK
|
||||
|
||||
Found 5 tests
|
||||
|
||||
5 Pass
|
||||
Pass Property float value 'none'
|
||||
Pass Property float value 'left'
|
||||
Pass Property float value 'right'
|
||||
Pass Property float value 'inline-start'
|
||||
Pass Property float value 'inline-end'
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS basic box model: getComputedStyle().float</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-float">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-logical/#float-clear">
|
||||
<script src="../../../resources/testharness.js"></script>
|
||||
<script src="../../../resources/testharnessreport.js"></script>
|
||||
<script src="../../../css/support/computed-testcommon.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="target"></div>
|
||||
<script>
|
||||
test_computed_value("float", "none");
|
||||
test_computed_value("float", "left");
|
||||
test_computed_value("float", "right");
|
||||
|
||||
test_computed_value("float", "inline-start");
|
||||
test_computed_value("float", "inline-end");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue