Skip to content

Truly independent web browser

LibWeb: Parse the interpolate-size property

Andreas Klingf0276a5d4315
diff --git a/Libraries/LibWeb/CSS/Enums.json b/Libraries/LibWeb/CSS/Enums.json
index 17b921303dc..aae17020a1f 100644
--- a/Libraries/LibWeb/CSS/Enums.json
+++ b/Libraries/LibWeb/CSS/Enums.json
@@ -705,6 +705,10 @@
"optimizespeed",
"optimizequality"
],
+ "interpolate-size": [
+ "numeric-only",
+ "allow-keywords"
+ ],
"isolation": [
"auto",
"isolate"
diff --git a/Libraries/LibWeb/CSS/Keywords.json b/Libraries/LibWeb/CSS/Keywords.json
index f70922178b1..d764a4d1010 100644
--- a/Libraries/LibWeb/CSS/Keywords.json
+++ b/Libraries/LibWeb/CSS/Keywords.json
@@ -36,6 +36,7 @@
"all-scroll",
"all-small-caps",
"allow-discrete",
+ "allow-keywords",
"alpha",
"alphabetic",
"alternate",
@@ -496,6 +497,7 @@
"ns-resize",
"numbers",
"numeric",
+ "numeric-only",
"nw-resize",
"nwse-resize",
"oblique",
diff --git a/Libraries/LibWeb/CSS/Properties.json b/Libraries/LibWeb/CSS/Properties.json
index d71defb68e3..9b951fe215f 100644
--- a/Libraries/LibWeb/CSS/Properties.json
+++ b/Libraries/LibWeb/CSS/Properties.json
@@ -2990,6 +2990,17 @@
"max-values": 1,
"needs-layout-for-getcomputedstyle": true
},
+ "interpolate-size": {
+ "style-group": "InheritedUIValues",
+ "affects-layout": false,
+ "animation-type": "none",
+ "inherited": true,
+ "initial": "numeric-only",
+ "requires-computation": "never",
+ "valid-types": [
+ "interpolate-size"
+ ]
+ },
"isolation": {
"style-group": "EffectsValues",
"affects-stacking-context": true,
diff --git a/Libraries/LibWeb/Rust/src/css/computed_value_types.rs b/Libraries/LibWeb/Rust/src/css/computed_value_types.rs
index 8b2f80d4ff1..eabd4e420a1 100644
--- a/Libraries/LibWeb/Rust/src/css/computed_value_types.rs
+++ b/Libraries/LibWeb/Rust/src/css/computed_value_types.rs
@@ -894,6 +894,7 @@ pub struct InheritedUIValues {
pub accent_color: ComputedColorOrAuto,
pub cursor: RetainedComputedCursorList,
pub pointer_events: u8,
+ pub interpolate_size: u8,
pub scrollbar_color: ComputedScrollbarColor,
pub color_scheme: u8,
pub color_schemes: crate::css::retained_fly_string::RetainedUtf16FlyStringList,
diff --git a/Libraries/LibWeb/Rust/src/css/computed_values.rs b/Libraries/LibWeb/Rust/src/css/computed_values.rs
index 03b60cb2ef3..7fa8e0872c0 100644
--- a/Libraries/LibWeb/Rust/src/css/computed_values.rs
+++ b/Libraries/LibWeb/Rust/src/css/computed_values.rs
@@ -906,6 +906,7 @@ impl_computed_payload_clone_and_eq!(InheritedUIValues {
accent_color,
cursor,
pointer_events,
+ interpolate_size,
scrollbar_color,
color_scheme,
color_schemes,
@@ -2122,6 +2123,7 @@ pub(crate) fn group_field_descriptors(group: usize) -> &'static [GroupFieldDescr
ACCENT_COLOR => RequireKeyword(k::AUTO),
CURSOR => RequireKeyword(k::AUTO),
POINTER_EVENTS @ pointer_events => EnumKeyword(enums::keyword_to_pointer_events),
+ INTERPOLATE_SIZE @ interpolate_size => EnumKeyword(enums::keyword_to_interpolate_size),
SCROLLBAR_COLOR => RequireKeyword(k::AUTO),
COLOR_SCHEME @ color_scheme => ResolvedU8,
COLOR_SCHEME => RequireInitialValue,
@@ -3110,6 +3112,7 @@ impl InheritedUIValues {
predefined: crate::css::css_enums::cursor_predefined::AUTO,
}]),
pointer_events: crate::css::css_enums::pointer_events::AUTO,
+ interpolate_size: crate::css::css_enums::interpolate_size::NUMERIC_ONLY,
scrollbar_color: crate::css::computed_value_types::ComputedScrollbarColor {
thumb_color: 0,
track_color: 0,
diff --git a/Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-has-indexed-property-getter.txt b/Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-has-indexed-property-getter.txt
index a4c022e2354..202c0db260b 100644
--- a/Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-has-indexed-property-getter.txt
+++ b/Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-has-indexed-property-getter.txt
@@ -38,6 +38,7 @@ All properties associated with getComputedStyle(document.body):
"font-weight",
"font-width",
"image-rendering",
+ "interpolate-size",
"letter-spacing",
"line-height",
"list-style-image",
diff --git a/Tests/LibWeb/Text/expected/css/CSSStyleProperties-all-supported-properties-and-default-values.txt b/Tests/LibWeb/Text/expected/css/CSSStyleProperties-all-supported-properties-and-default-values.txt
index e58ca2ae5fe..4e64b081b38 100644
--- a/Tests/LibWeb/Text/expected/css/CSSStyleProperties-all-supported-properties-and-default-values.txt
+++ b/Tests/LibWeb/Text/expected/css/CSSStyleProperties-all-supported-properties-and-default-values.txt
@@ -617,6 +617,8 @@ All supported properties and their default values exposed from CSSStylePropertie
'inset-inline-end': 'auto'
'insetInlineStart': 'auto'
'inset-inline-start': 'auto'
+'interpolateSize': 'numeric-only'
+'interpolate-size': 'numeric-only'
'isolation': 'auto'
'justifyContent': 'normal'
'justify-content': 'normal'
diff --git a/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt b/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt
index 7e568860317..18769f057d8 100644
--- a/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt
+++ b/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt
@@ -36,6 +36,7 @@ font-variation-settings: normal
font-weight: 400
font-width: 100%
image-rendering: auto
+interpolate-size: numeric-only
letter-spacing: normal
line-height: normal
list-style-image: none
@@ -110,7 +111,7 @@ background-position-x: 0%
background-position-y: 0%
background-repeat: repeat
background-size: auto
-block-size: 1456px
+block-size: 1469px
border-block-end-color: rgb(0, 0, 0)
border-block-end-style: none
border-block-end-width: 0px
@@ -212,7 +213,7 @@ grid-row-start: auto
grid-template-areas: none
grid-template-columns: none
grid-template-rows: none
-height: 2782px
+height: 2795px
inline-size: 784px
inset-block-end: auto
inset-block-start: auto
@@ -338,7 +339,7 @@ top: auto
touch-action: auto
transform: none
transform-box: view-box
-transform-origin: 392px 2210px
+transform-origin: 392px 2216.5px
transform-style: flat
transition-behavior: normal
transition-delay: 0s
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-values/calc-size/interpolate-size-computed.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-values/calc-size/interpolate-size-computed.txt
new file mode 100644
index 00000000000..65544d23298
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-values/calc-size/interpolate-size-computed.txt
@@ -0,0 +1,7 @@
+Harness status: OK
+
+Found 2 tests
+
+2 Pass
+Pass Property interpolate-size value 'numeric-only'
+Pass Property interpolate-size value 'allow-keywords'
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-values/calc-size/interpolate-size-parsing.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-values/calc-size/interpolate-size-parsing.txt
new file mode 100644
index 00000000000..3fdcfde0b46
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-values/calc-size/interpolate-size-parsing.txt
@@ -0,0 +1,10 @@
+Harness status: OK
+
+Found 5 tests
+
+5 Pass
+Pass e.style['interpolate-size'] = "numeric-only" should set the property value
+Pass e.style['interpolate-size'] = "allow-keywords" should set the property value
+Pass e.style['interpolate-size'] = "auto" should not set the property value
+Pass e.style['interpolate-size'] = "none" should not set the property value
+Pass e.style['interpolate-size'] = "100%" should not set the property value
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-values/calc-size/interpolate-size-computed.html b/Tests/LibWeb/Text/input/wpt-import/css/css-values/calc-size/interpolate-size-computed.html
new file mode 100644
index 00000000000..59306b036d5
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-values/calc-size/interpolate-size-computed.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<meta charset="UTF-8">
+<title>The interpolate-size property: computed values</title>
+<link rel="help" href="https://drafts.csswg.org/css-values-5/#interpolate-size">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../css/support/computed-testcommon.js"></script>
+<div id="target"></div>
+<script>
+test_computed_value('interpolate-size', 'numeric-only');
+test_computed_value('interpolate-size', 'allow-keywords');
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-values/calc-size/interpolate-size-parsing.html b/Tests/LibWeb/Text/input/wpt-import/css/css-values/calc-size/interpolate-size-parsing.html
new file mode 100644
index 00000000000..236783b5893
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-values/calc-size/interpolate-size-parsing.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<meta charset="UTF-8">
+<title>The interpolate-size property: parsing</title>
+<link rel="help" href="https://drafts.csswg.org/css-values-5/#interpolate-size">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../css/support/parsing-testcommon.js"></script>
+
+<script>
+test_valid_value('interpolate-size', 'numeric-only');
+test_valid_value('interpolate-size', 'allow-keywords');
+
+test_invalid_value('interpolate-size', 'auto');
+test_invalid_value('interpolate-size', 'none');
+test_invalid_value('interpolate-size', '100%');
+</script>