servo: Merge #8111 - Compute value of float according to position value (from gilles-leblanc:issue-8002); r=SimonSapin

According to CSS2 Section 9.7, if 'position' has a value of 'absolute'
or 'fixed' the computed value of 'float' should be 'none'.

This changes the float to a single_keyword_computed which checks the
positioned value of the element to compute the float value.

Fixes #8002

Source-Repo: https://github.com/servo/servo
Source-Revision: 5070c873d03ef62a66f18596ccdf8a030107efd6
This commit is contained in:
Gilles Leblanc 2015-11-03 21:10:32 +05:01
Родитель 690f25f37c
Коммит 91208857f8
1 изменённых файлов: 19 добавлений и 1 удалений

Просмотреть файл

@ -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">