diff --git a/components/style/properties.mako.rs b/components/style/properties.mako.rs index 2912d4ea871..760672efdbd 100644 --- a/components/style/properties.mako.rs +++ b/components/style/properties.mako.rs @@ -546,7 +546,25 @@ pub mod longhands { %self:longhand> ${single_keyword("position", "static absolute relative fixed")} - ${single_keyword("float", "none left right")} + + <%self:single_keyword_computed name="float" values="none left right"> + use values::computed::Context; + + impl ToComputedValue for SpecifiedValue { + type ComputedValue = computed_value::T; + + #[inline] + fn to_computed_value(&self, context: &Context) -> computed_value::T { + if context.positioned { + SpecifiedValue::none + } else { + *self + } + } + } + + %self:single_keyword_computed> + ${single_keyword("clear", "none left right both")} <%self:longhand name="-servo-display-for-hypothetical-box" derived_from="display"> diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index c5c75cff9a5..39fc9811d6a 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -4165,6 +4165,12 @@ ] }, "testharness": { + "css/float_relative_to_position.html": [ + { + "path": "css/float_relative_to_position.html", + "url": "/_mozilla/css/float_relative_to_position.html" + } + ], "css/test_variable_legal_values.html": [ { "path": "css/test_variable_legal_values.html", diff --git a/tests/wpt/mozilla/tests/css/float_relative_to_position.html b/tests/wpt/mozilla/tests/css/float_relative_to_position.html new file mode 100644 index 00000000000..bdeb133ef11 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/float_relative_to_position.html @@ -0,0 +1,40 @@ + + +
+ +