LibWeb/CSS: Add support for unicode-bidi
property
This commit is contained in:
parent
16f2f6aa42
commit
77761e123d
Notes:
github-actions[bot]
2024-10-07 13:58:14 +00:00
Author: https://github.com/khaledev Commit: https://github.com/LadybirdBrowser/ladybird/commit/77761e123d6 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1618 Reviewed-by: https://github.com/AtkinsSJ ✅
10 changed files with 75 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
normal
|
||||
embed
|
||||
isolate
|
||||
bidi-override
|
||||
isolate-override
|
||||
plaintext
|
||||
normal
|
||||
normal
|
||||
normal
|
||||
normal
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="../include.js"></script>
|
||||
|
||||
<script>
|
||||
test(() => {
|
||||
const propertyName = "unicode-bidi";
|
||||
const propertyValues = [
|
||||
"normal",
|
||||
"embed",
|
||||
"isolate",
|
||||
"bidi-override",
|
||||
"isolate-override",
|
||||
"plaintext",
|
||||
"bad-value",
|
||||
"bidi-override isolate-override",
|
||||
"normal bad-value",
|
||||
"bad-value normal",
|
||||
];
|
||||
|
||||
for (const propertyValue of propertyValues) {
|
||||
const element = document.createElement("span");
|
||||
element.style.setProperty(propertyName, propertyValue);
|
||||
document.body.appendChild(element);
|
||||
const computedValue = getComputedStyle(element).getPropertyValue(propertyName);
|
||||
println(computedValue);
|
||||
element.remove();
|
||||
}
|
||||
});
|
||||
</script>
|
|
@ -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<MaskReference> 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; }
|
||||
|
|
|
@ -463,6 +463,14 @@
|
|||
"stroke-box",
|
||||
"view-box "
|
||||
],
|
||||
"unicode-bidi": [
|
||||
"bidi-override",
|
||||
"embed",
|
||||
"isolate",
|
||||
"isolate-override",
|
||||
"normal",
|
||||
"plaintext"
|
||||
],
|
||||
"vertical-align": [
|
||||
"baseline",
|
||||
"bottom",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -1189,6 +1189,12 @@ Optional<CSS::Direction> StyleProperties::direction() const
|
|||
return keyword_to_direction(value->to_keyword());
|
||||
}
|
||||
|
||||
Optional<CSS::UnicodeBidi> StyleProperties::unicode_bidi() const
|
||||
{
|
||||
auto value = property(CSS::PropertyID::UnicodeBidi);
|
||||
return keyword_to_unicode_bidi(value->to_keyword());
|
||||
}
|
||||
|
||||
Optional<CSS::MaskType> StyleProperties::mask_type() const
|
||||
{
|
||||
auto value = property(CSS::PropertyID::MaskType);
|
||||
|
|
|
@ -166,6 +166,7 @@ public:
|
|||
CSS::ObjectPosition object_position() const;
|
||||
Optional<CSS::TableLayout> table_layout() const;
|
||||
Optional<CSS::Direction> direction() const;
|
||||
Optional<CSS::UnicodeBidi> unicode_bidi() const;
|
||||
|
||||
static Vector<CSS::Transformation> transformations_for_style_value(CSSStyleValue const& value);
|
||||
Vector<CSS::Transformation> transformations() const;
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue