diff options
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/devtools.rs | 9 | ||||
-rw-r--r-- | components/script/dom/element.rs | 60 | ||||
-rw-r--r-- | components/script/lib.rs | 1 |
3 files changed, 40 insertions, 30 deletions
diff --git a/components/script/devtools.rs b/components/script/devtools.rs index 58b0a7d20a7..7a24d959980 100644 --- a/components/script/devtools.rs +++ b/components/script/devtools.rs @@ -29,7 +29,6 @@ use js::rust::wrappers::ObjectClassName; use msg::constellation_msg::PipelineId; use std::ffi::CStr; use std::str; -use style::properties::longhands::{margin_bottom, margin_left, margin_right, margin_top}; use uuid::Uuid; #[allow(unsafe_code)] @@ -178,10 +177,10 @@ fn determine_auto_margins(window: &Window, node: &Node) -> AutoMargins { let style = window.style_query(node.to_trusted_node_address()).unwrap(); let margin = style.get_margin(); AutoMargins { - top: margin.margin_top == margin_top::computed_value::T::Auto, - right: margin.margin_right == margin_right::computed_value::T::Auto, - bottom: margin.margin_bottom == margin_bottom::computed_value::T::Auto, - left: margin.margin_left == margin_left::computed_value::T::Auto, + top: margin.margin_top.is_auto(), + right: margin.margin_right.is_auto(), + bottom: margin.margin_bottom.is_auto(), + left: margin.margin_left.is_auto(), } } diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 234a10f9448..dbcab42f11f 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -718,9 +718,11 @@ impl LayoutElementHelpers for LayoutDom<Element> { specified::NoCalcLength::ServoCharacterWidth(specified::CharacterWidth(size)); hints.push(from_declaration( shared_lock, - PropertyDeclaration::Width(specified::LengthPercentageOrAuto::LengthPercentage( - specified::LengthPercentage::Length(value), - )), + PropertyDeclaration::Width( + specified::NonNegativeLengthPercentageOrAuto::LengthPercentage(NonNegative( + specified::LengthPercentage::Length(value), + )), + ), )); } @@ -745,20 +747,22 @@ impl LayoutElementHelpers for LayoutDom<Element> { match width { LengthOrPercentageOrAuto::Auto => {}, LengthOrPercentageOrAuto::Percentage(percentage) => { - let width_value = specified::LengthPercentageOrAuto::LengthPercentage( - specified::LengthPercentage::Percentage(computed::Percentage(percentage)), - ); + let width_value = + specified::NonNegativeLengthPercentageOrAuto::LengthPercentage(NonNegative( + specified::LengthPercentage::Percentage(computed::Percentage(percentage)), + )); hints.push(from_declaration( shared_lock, PropertyDeclaration::Width(width_value), )); }, LengthOrPercentageOrAuto::Length(length) => { - let width_value = specified::LengthPercentageOrAuto::LengthPercentage( - specified::LengthPercentage::Length(specified::NoCalcLength::Absolute( - specified::AbsoluteLength::Px(length.to_f32_px()), - )), - ); + let width_value = + specified::NonNegativeLengthPercentageOrAuto::LengthPercentage(NonNegative( + specified::LengthPercentage::Length(specified::NoCalcLength::Absolute( + specified::AbsoluteLength::Px(length.to_f32_px()), + )), + )); hints.push(from_declaration( shared_lock, PropertyDeclaration::Width(width_value), @@ -779,20 +783,22 @@ impl LayoutElementHelpers for LayoutDom<Element> { match height { LengthOrPercentageOrAuto::Auto => {}, LengthOrPercentageOrAuto::Percentage(percentage) => { - let height_value = specified::LengthPercentageOrAuto::LengthPercentage( - specified::LengthPercentage::Percentage(computed::Percentage(percentage)), - ); + let height_value = + specified::NonNegativeLengthPercentageOrAuto::LengthPercentage(NonNegative( + specified::LengthPercentage::Percentage(computed::Percentage(percentage)), + )); hints.push(from_declaration( shared_lock, PropertyDeclaration::Height(height_value), )); }, LengthOrPercentageOrAuto::Length(length) => { - let height_value = specified::LengthPercentageOrAuto::LengthPercentage( - specified::LengthPercentage::Length(specified::NoCalcLength::Absolute( - specified::AbsoluteLength::Px(length.to_f32_px()), - )), - ); + let height_value = + specified::NonNegativeLengthPercentageOrAuto::LengthPercentage(NonNegative( + specified::LengthPercentage::Length(specified::NoCalcLength::Absolute( + specified::AbsoluteLength::Px(length.to_f32_px()), + )), + )); hints.push(from_declaration( shared_lock, PropertyDeclaration::Height(height_value), @@ -819,9 +825,11 @@ impl LayoutElementHelpers for LayoutDom<Element> { specified::NoCalcLength::ServoCharacterWidth(specified::CharacterWidth(cols)); hints.push(from_declaration( shared_lock, - PropertyDeclaration::Width(specified::LengthPercentageOrAuto::LengthPercentage( - specified::LengthPercentage::Length(value), - )), + PropertyDeclaration::Width( + specified::NonNegativeLengthPercentageOrAuto::LengthPercentage(NonNegative( + specified::LengthPercentage::Length(value), + )), + ), )); } @@ -843,9 +851,11 @@ impl LayoutElementHelpers for LayoutDom<Element> { )); hints.push(from_declaration( shared_lock, - PropertyDeclaration::Height(specified::LengthPercentageOrAuto::LengthPercentage( - specified::LengthPercentage::Length(value), - )), + PropertyDeclaration::Height( + specified::NonNegativeLengthPercentageOrAuto::LengthPercentage(NonNegative( + specified::LengthPercentage::Length(value), + )), + ), )); } diff --git a/components/script/lib.rs b/components/script/lib.rs index ce427aa3a56..1332e604fdb 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -8,6 +8,7 @@ #![feature(drain_filter)] #![feature(plugin)] #![feature(try_from)] +#![feature(type_alias_enum_variants)] #![deny(unsafe_code)] #![allow(non_snake_case)] #![doc = "The script crate contains all matters DOM."] |