diff --git a/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt b/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt index 0c18222b6cb..a67ee57e0e6 100644 --- a/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt +++ b/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt @@ -187,6 +187,7 @@ transition-delay: 0s transition-duration: 0s transition-property: all transition-timing-function: ease +unicode-bidi: normal user-select: auto vertical-align: baseline width: 784px diff --git a/Tests/LibWeb/Text/expected/css/unicode-bidi-computed-values.txt b/Tests/LibWeb/Text/expected/css/unicode-bidi-computed-values.txt new file mode 100644 index 00000000000..f4cfc15fe7f --- /dev/null +++ b/Tests/LibWeb/Text/expected/css/unicode-bidi-computed-values.txt @@ -0,0 +1,10 @@ +normal +embed +isolate +bidi-override +isolate-override +plaintext +normal +normal +normal +normal diff --git a/Tests/LibWeb/Text/input/css/unicode-bidi-computed-values.html b/Tests/LibWeb/Text/input/css/unicode-bidi-computed-values.html new file mode 100644 index 00000000000..45ee499f508 --- /dev/null +++ b/Tests/LibWeb/Text/input/css/unicode-bidi-computed-values.html @@ -0,0 +1,29 @@ + + + + diff --git a/Userland/Libraries/LibWeb/CSS/ComputedValues.h b/Userland/Libraries/LibWeb/CSS/ComputedValues.h index 7f2ff8d849a..ad7e094730f 100644 --- a/Userland/Libraries/LibWeb/CSS/ComputedValues.h +++ b/Userland/Libraries/LibWeb/CSS/ComputedValues.h @@ -183,6 +183,7 @@ public: static QuotesData quotes() { return QuotesData { .type = QuotesData::Type::Auto }; } static CSS::TransformBox transform_box() { return CSS::TransformBox::ViewBox; } static CSS::Direction direction() { return CSS::Direction::Ltr; } + static CSS::UnicodeBidi unicode_bidi() { return CSS::UnicodeBidi::Normal; } // https://www.w3.org/TR/SVG/geometry.html static LengthPercentage cx() { return CSS::Length::make_px(0); } @@ -431,6 +432,7 @@ public: CSS::ObjectFit object_fit() const { return m_noninherited.object_fit; } CSS::ObjectPosition object_position() const { return m_noninherited.object_position; } CSS::Direction direction() const { return m_inherited.direction; } + CSS::UnicodeBidi unicode_bidi() const { return m_noninherited.unicode_bidi; } CSS::LengthBox const& inset() const { return m_noninherited.inset; } const CSS::LengthBox& margin() const { return m_noninherited.margin; } @@ -647,6 +649,7 @@ protected: CSS::TableLayout table_layout { InitialValues::table_layout() }; CSS::ObjectFit object_fit { InitialValues::object_fit() }; CSS::ObjectPosition object_position { InitialValues::object_position() }; + CSS::UnicodeBidi unicode_bidi { InitialValues::unicode_bidi() }; Optional mask; CSS::MaskType mask_type { InitialValues::mask_type() }; @@ -782,6 +785,7 @@ public: void set_object_fit(CSS::ObjectFit value) { m_noninherited.object_fit = value; } void set_object_position(CSS::ObjectPosition value) { m_noninherited.object_position = value; } void set_direction(CSS::Direction value) { m_inherited.direction = value; } + void set_unicode_bidi(CSS::UnicodeBidi value) { m_noninherited.unicode_bidi = value; } void set_fill(SVGPaint value) { m_inherited.fill = value; } void set_stroke(SVGPaint value) { m_inherited.stroke = value; } diff --git a/Userland/Libraries/LibWeb/CSS/Enums.json b/Userland/Libraries/LibWeb/CSS/Enums.json index a7855c3bb51..3ab2b0c92e5 100644 --- a/Userland/Libraries/LibWeb/CSS/Enums.json +++ b/Userland/Libraries/LibWeb/CSS/Enums.json @@ -463,6 +463,14 @@ "stroke-box", "view-box " ], + "unicode-bidi": [ + "bidi-override", + "embed", + "isolate", + "isolate-override", + "normal", + "plaintext" + ], "vertical-align": [ "baseline", "bottom", diff --git a/Userland/Libraries/LibWeb/CSS/Keywords.json b/Userland/Libraries/LibWeb/CSS/Keywords.json index 2ad59f61112..a5b7208ad38 100644 --- a/Userland/Libraries/LibWeb/CSS/Keywords.json +++ b/Userland/Libraries/LibWeb/CSS/Keywords.json @@ -79,6 +79,7 @@ "background", "backwards", "baseline", + "bidi-override", "blink", "block", "bold", @@ -142,6 +143,7 @@ "ease-in-out", "ease-out", "ellipsis", + "embed", "enabled", "end", "evenodd", @@ -204,6 +206,8 @@ "interlace", "invert", "inverted", + "isolate", + "isolate-override", "italic", "jump-both", "jump-end", @@ -280,6 +284,7 @@ "paged", "paused", "pixelated", + "plaintext", "pointer", "portrait", "pre", diff --git a/Userland/Libraries/LibWeb/CSS/Properties.json b/Userland/Libraries/LibWeb/CSS/Properties.json index 627b33519c3..55891ea080e 100644 --- a/Userland/Libraries/LibWeb/CSS/Properties.json +++ b/Userland/Libraries/LibWeb/CSS/Properties.json @@ -2678,6 +2678,14 @@ "easing-function" ] }, + "unicode-bidi": { + "animation-type": "none", + "inherited": false, + "initial": "normal", + "valid-types": [ + "unicode-bidi" + ] + }, "user-select": { "affects-layout": false, "animation-type": "discrete", diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp index a7a861dfebe..ade20579b67 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp @@ -1189,6 +1189,12 @@ Optional StyleProperties::direction() const return keyword_to_direction(value->to_keyword()); } +Optional StyleProperties::unicode_bidi() const +{ + auto value = property(CSS::PropertyID::UnicodeBidi); + return keyword_to_unicode_bidi(value->to_keyword()); +} + Optional StyleProperties::mask_type() const { auto value = property(CSS::PropertyID::MaskType); diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.h b/Userland/Libraries/LibWeb/CSS/StyleProperties.h index 3e8c8e6e017..7d6f14e9950 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleProperties.h +++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.h @@ -166,6 +166,7 @@ public: CSS::ObjectPosition object_position() const; Optional table_layout() const; Optional direction() const; + Optional unicode_bidi() const; static Vector transformations_for_style_value(CSSStyleValue const& value); Vector transformations() const; diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp index 4dd06c2ee5d..19714009228 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.cpp +++ b/Userland/Libraries/LibWeb/Layout/Node.cpp @@ -896,6 +896,9 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style) if (auto direction = computed_style.direction(); direction.has_value()) computed_values.set_direction(direction.value()); + if (auto unicode_bidi = computed_style.unicode_bidi(); unicode_bidi.has_value()) + computed_values.set_unicode_bidi(unicode_bidi.value()); + if (auto scrollbar_width = computed_style.scrollbar_width(); scrollbar_width.has_value()) computed_values.set_scrollbar_width(scrollbar_width.value());