aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/element.rs
diff options
context:
space:
mode:
authorRavi Shankar <wafflespeanut@gmail.com>2017-01-16 01:34:54 +0530
committerRavi Shankar <wafflespeanut@gmail.com>2017-01-29 02:04:24 +0530
commit377a23df50e10595f3b3de7f1ef326d64fc488f7 (patch)
treeae6e231f405cd8f630cfbfc14ac5d35c0671e04e /components/script/dom/element.rs
parent4035bbd738772ce96d9f81470c76bf971d7accf9 (diff)
downloadservo-377a23df50e10595f3b3de7f1ef326d64fc488f7.tar.gz
servo-377a23df50e10595f3b3de7f1ef326d64fc488f7.zip
Refactor and modify stuff to make use of NoCalcLength
Diffstat (limited to 'components/script/dom/element.rs')
-rw-r--r--components/script/dom/element.rs19
1 files changed, 10 insertions, 9 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index 2ca775ed345..e0003ceae30 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -4,7 +4,6 @@
//! Element nodes.
-use app_units::Au;
use cssparser::Color;
use devtools_traits::AttrInfo;
use dom::activation::Activatable;
@@ -476,7 +475,7 @@ impl LayoutElementHelpers for LayoutJS<Element> {
};
if let Some(cellspacing) = cellspacing {
- let width_value = specified::Length::Absolute(Au::from_px(cellspacing as i32));
+ let width_value = specified::Length::from_px(cellspacing as f32);
hints.push(from_declaration(
PropertyDeclaration::BorderSpacing(DeclaredValue::Value(
border_spacing::SpecifiedValue {
@@ -509,7 +508,8 @@ impl LayoutElementHelpers for LayoutJS<Element> {
};
if let Some(size) = size {
- let value = specified::Length::ServoCharacterWidth(specified::CharacterWidth(size));
+ let value = specified::Length::NoCalc(
+ specified::NoCalcLength::ServoCharacterWidth(specified::CharacterWidth(size)));
hints.push(from_declaration(
PropertyDeclaration::Width(DeclaredValue::Value(
specified::LengthOrPercentageOrAuto::Length(value)))));
@@ -541,7 +541,7 @@ impl LayoutElementHelpers for LayoutJS<Element> {
}
LengthOrPercentageOrAuto::Length(length) => {
let width_value = specified::LengthOrPercentageOrAuto::Length(
- specified::Length::Absolute(length));
+ specified::Length::NoCalc(specified::NoCalcLength::Absolute(length)));
hints.push(from_declaration(
PropertyDeclaration::Width(DeclaredValue::Value(width_value))));
}
@@ -566,7 +566,7 @@ impl LayoutElementHelpers for LayoutJS<Element> {
}
LengthOrPercentageOrAuto::Length(length) => {
let height_value = specified::LengthOrPercentageOrAuto::Length(
- specified::Length::Absolute(length));
+ specified::Length::NoCalc(specified::NoCalcLength::Absolute(length)));
hints.push(from_declaration(
PropertyDeclaration::Height(DeclaredValue::Value(height_value))));
}
@@ -588,7 +588,8 @@ impl LayoutElementHelpers for LayoutJS<Element> {
// scrollbar size into consideration (but we don't have a scrollbar yet!)
//
// https://html.spec.whatwg.org/multipage/#textarea-effective-width
- let value = specified::Length::ServoCharacterWidth(specified::CharacterWidth(cols));
+ let value = specified::Length::NoCalc(
+ specified::NoCalcLength::ServoCharacterWidth(specified::CharacterWidth(cols)));
hints.push(from_declaration(
PropertyDeclaration::Width(DeclaredValue::Value(
specified::LengthOrPercentageOrAuto::Length(value)))));
@@ -608,7 +609,8 @@ impl LayoutElementHelpers for LayoutJS<Element> {
// TODO(mttr) This should take scrollbar size into consideration.
//
// https://html.spec.whatwg.org/multipage/#textarea-effective-height
- let value = specified::Length::FontRelative(specified::FontRelativeLength::Em(rows as CSSFloat));
+ let value = specified::Length::NoCalc(
+ specified::NoCalcLength::FontRelative(specified::FontRelativeLength::Em(rows as CSSFloat)));
hints.push(from_declaration(
PropertyDeclaration::Height(DeclaredValue::Value(
specified::LengthOrPercentageOrAuto::Length(value)))));
@@ -622,8 +624,7 @@ impl LayoutElementHelpers for LayoutJS<Element> {
};
if let Some(border) = border {
- let width_value = specified::BorderWidth::from_length(
- specified::Length::Absolute(Au::from_px(border as i32)));
+ let width_value = specified::BorderWidth::from_length(specified::Length::from_px(border as f32));
hints.push(from_declaration(
PropertyDeclaration::BorderTopWidth(DeclaredValue::Value(width_value.clone()))));
hints.push(from_declaration(