diff --git a/Tests/LibWeb/Layout/expected/block-and-inline/float-logical.txt b/Tests/LibWeb/Layout/expected/block-and-inline/float-logical.txt new file mode 100644 index 00000000000..8f1c52a1a23 --- /dev/null +++ b/Tests/LibWeb/Layout/expected/block-and-inline/float-logical.txt @@ -0,0 +1,17 @@ +Viewport <#document> at (0,0) content-size 800x600 children: not-inline + BlockContainer at (0,0) content-size 800x60 [BFC] children: not-inline + BlockContainer <(anonymous)> at (0,0) content-size 800x0 children: inline + TextNode <#text> + BlockContainer at (8,8) content-size 784x0 children: inline + TextNode <#text> + BlockContainer at (9,9) content-size 50x50 floating [BFC] children: not-inline + TextNode <#text> + BlockContainer at (741,9) content-size 50x50 floating [BFC] children: not-inline + TextNode <#text> + +ViewportPaintable (Viewport<#document>) [0,0 800x600] + PaintableWithLines (BlockContainer) [0,0 800x60] + PaintableWithLines (BlockContainer(anonymous)) [0,0 800x0] + PaintableWithLines (BlockContainer) [8,8 784x0] + PaintableWithLines (BlockContainer
#b) [8,8 52x52] + PaintableWithLines (BlockContainer
#c) [740,8 52x52] diff --git a/Tests/LibWeb/Layout/input/block-and-inline/float-logical.html b/Tests/LibWeb/Layout/input/block-and-inline/float-logical.html new file mode 100644 index 00000000000..ff69fb1c6bb --- /dev/null +++ b/Tests/LibWeb/Layout/input/block-and-inline/float-logical.html @@ -0,0 +1,23 @@ + + + + + + +
+
+ + diff --git a/Userland/Libraries/LibWeb/CSS/Enums.json b/Userland/Libraries/LibWeb/CSS/Enums.json index 53813ed7b09..7417904f0a8 100644 --- a/Userland/Libraries/LibWeb/CSS/Enums.json +++ b/Userland/Libraries/LibWeb/CSS/Enums.json @@ -195,7 +195,9 @@ "float": [ "none", "left", - "right" + "right", + "inline-start", + "inline-end" ], "font-variant": [ "normal", diff --git a/Userland/Libraries/LibWeb/CSS/Identifiers.json b/Userland/Libraries/LibWeb/CSS/Identifiers.json index a77ee7b0526..cc55d849049 100644 --- a/Userland/Libraries/LibWeb/CSS/Identifiers.json +++ b/Userland/Libraries/LibWeb/CSS/Identifiers.json @@ -188,8 +188,10 @@ "initial-only", "inline", "inline-block", + "inline-end", "inline-flex", "inline-grid", + "inline-start", "inline-table", "inset", "inside", diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index f7ac2665863..9eb384bc764 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -711,6 +711,19 @@ void StyleComputer::for_each_property_expanding_shorthands(PropertyID property_i return; } + if (property_id == CSS::PropertyID::Float) { + auto ident = value.to_identifier(); + + // FIXME: Honor writing-mode, direction and text-orientation. + if (ident == CSS::ValueID::InlineStart) { + set_longhand_property(CSS::PropertyID::Float, IdentifierStyleValue::create(CSS::ValueID::Left)); + return; + } else if (ident == CSS::ValueID::InlineEnd) { + set_longhand_property(CSS::PropertyID::Float, IdentifierStyleValue::create(CSS::ValueID::Right)); + return; + } + } + if (property_is_shorthand(property_id)) { // ShorthandStyleValue was handled already. // That means if we got here, that `value` must be a CSS-wide keyword, which we should apply to our longhand properties.