layout: Implement opacity per CSS-COLOR § 3.2.

This adds the infrastructure necessary to support stacking contexts that
are not containing blocks for absolutely-positioned elements. Our
infrastructure did not support that before. This minor revamp actually
ended up simplifying the logic around display list building and
stacking-relative position computation for absolutely-positioned flows,
which was nice.
This commit is contained in:
Patrick Walton 2014-11-18 15:37:53 -08:00
parent 873ca6cadd
commit 1c1c507c03
17 changed files with 421 additions and 146 deletions

View file

@ -1208,6 +1208,37 @@ pub mod longhands {
${switch_to_style_struct("Box")}
${single_keyword("box-sizing", "content-box border-box")}
${new_style_struct("Effects", is_inherited=False)}
<%self:single_component_value name="opacity">
pub type SpecifiedValue = CSSFloat;
pub mod computed_value {
use super::super::CSSFloat;
pub type T = CSSFloat;
}
#[inline]
pub fn get_initial_value() -> computed_value::T {
1.0
}
#[inline]
pub fn to_computed_value(value: SpecifiedValue, _: &computed::Context)
-> computed_value::T {
if value < 0.0 {
0.0
} else if value > 1.0 {
1.0
} else {
value
}
}
fn from_component_value(input: &ComponentValue, _: &Url) -> Result<SpecifiedValue,()> {
match *input {
Number(ref value) => Ok(value.value),
_ => Err(())
}
}
</%self:single_component_value>
}