diff --git a/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp b/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp index a3292c10630..244bfe251af 100644 --- a/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp +++ b/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp @@ -241,7 +241,7 @@ RefPtr ResolvedCSSStyleDeclaration::style_value_for_propert return LengthStyleValue::create(Length::make_px(layout_node.computed_values().line_height())); } - // FIXME: -> block-size + // -> block-size // -> height // FIXME: -> inline-size // -> margin-block-end @@ -264,6 +264,13 @@ RefPtr ResolvedCSSStyleDeclaration::style_value_for_propert // If the property applies to the element or pseudo-element and the resolved value of the // display property is not none or contents, then the resolved value is the used value. // Otherwise the resolved value is the computed value. + case PropertyID::BlockSize: { + auto writing_mode = layout_node.computed_values().writing_mode(); + auto is_vertically_oriented = first_is_one_of(writing_mode, WritingMode::VerticalLr, WritingMode::VerticalRl); + if (is_vertically_oriented) + return style_value_for_property(layout_node, PropertyID::Width); + return style_value_for_property(layout_node, PropertyID::Height); + } case PropertyID::Height: { auto maybe_used_height = used_value_for_property([](auto const& paintable_box) { return paintable_box.content_height(); }); if (maybe_used_height.has_value()) diff --git a/Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-all-supported-properties-and-default-values.txt b/Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-all-supported-properties-and-default-values.txt index b4108636ba4..8b3ec729747 100644 --- a/Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-all-supported-properties-and-default-values.txt +++ b/Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-all-supported-properties-and-default-values.txt @@ -183,8 +183,8 @@ All supported properties and their default values exposed from CSSStyleDeclarati 'background-repeat': 'repeat' 'backgroundSize': 'auto auto' 'background-size': 'auto auto' -'blockSize': 'auto' -'block-size': 'auto' +'blockSize': '0px' +'block-size': '0px' 'border': 'medium none rgb(0, 0, 0)' 'borderBottom': 'medium none rgb(0, 0, 0)' 'border-bottom': 'medium none rgb(0, 0, 0)' diff --git a/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt b/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt index e826e6fb3a3..6eca7cfd63f 100644 --- a/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt +++ b/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt @@ -83,7 +83,7 @@ background-position-x: 0% background-position-y: 0% background-repeat: repeat background-size: auto auto -block-size: auto +block-size: 1190px border-bottom-color: rgb(0, 0, 0) border-bottom-left-radius: 0px border-bottom-right-radius: 0px diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-logical/parsing/block-size-computed.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-logical/parsing/block-size-computed.txt new file mode 100644 index 00000000000..c948e644281 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-logical/parsing/block-size-computed.txt @@ -0,0 +1,12 @@ +Harness status: OK + +Found 7 tests + +7 Pass +Pass Property block-size value 'auto' +Pass Property block-size value '10px' +Pass Property block-size value '20%' +Pass Property block-size value 'calc(0.5em + 10px)' +Pass Property block-size value 'calc(-0.5em + 10px)' +Pass Property block-size value 'min-content' +Pass Property block-size value 'max-content' \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-logical/parsing/block-size-computed.html b/Tests/LibWeb/Text/input/wpt-import/css/css-logical/parsing/block-size-computed.html new file mode 100644 index 00000000000..68ac0bb4561 --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/css/css-logical/parsing/block-size-computed.html @@ -0,0 +1,44 @@ + + + + +CSS Logical Properties and Values: getComputedStyle().blockSize + + + + + + + + +
+
+
+
+
+
+ + +