diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index c6549fde57c..f9a214daf20 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -71,7 +71,7 @@ use style::computed_values::content::ContentItem; use style::computed_values::{content, display, white_space}; use selectors::matching::DeclarationBlock; use selectors::parser::{NamespaceConstraint, AttrSelector}; -use style::legacy::{IntegerAttribute, UnsignedIntegerAttribute}; +use style::legacy::UnsignedIntegerAttribute; use style::node::{TElement, TElementAttributes, TNode}; use style::properties::{PropertyDeclaration, PropertyDeclarationBlock}; use util::smallvec::VecLike; @@ -656,12 +656,6 @@ impl<'le> TElementAttributes<'le> for LayoutElement<'le> { } } - fn get_integer_attribute(self, integer_attribute: IntegerAttribute) -> Option { - unsafe { - self.element.get_integer_attribute_for_layout(integer_attribute) - } - } - fn get_unsigned_integer_attribute(self, attribute: UnsignedIntegerAttribute) -> Option { unsafe { self.element.get_unsigned_integer_attribute_for_layout(attribute) diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 5034da72235..18481db2c2d 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -59,10 +59,11 @@ use dom::virtualmethods::{VirtualMethods, vtable_for}; use devtools_traits::AttrInfo; use style; -use style::legacy::{UnsignedIntegerAttribute, IntegerAttribute, from_declaration}; +use style::legacy::{UnsignedIntegerAttribute, from_declaration}; use style::properties::{PropertyDeclarationBlock, PropertyDeclaration, parse_style_attribute}; use style::properties::DeclaredValue::SpecifiedValue; -use style::properties::longhands::border_spacing; +use style::properties::longhands::{self, border_spacing}; +use style::values::CSSFloat; use style::values::specified::{self, CSSColor}; use util::geometry::Au; use util::namespace; @@ -164,8 +165,6 @@ pub trait RawLayoutElementHelpers { unsafe fn synthesize_presentational_hints_for_legacy_attributes(&self, &mut V) where V: VecLike>>; - unsafe fn get_integer_attribute_for_layout(&self, integer_attribute: IntegerAttribute) - -> Option; unsafe fn get_checked_state_for_layout(&self) -> bool; unsafe fn get_indeterminate_state_for_layout(&self) -> bool; unsafe fn get_unsigned_integer_attribute_for_layout(&self, attribute: UnsignedIntegerAttribute) @@ -330,26 +329,50 @@ impl RawLayoutElementHelpers for Element { PropertyDeclaration::Width(SpecifiedValue(width_value)))); } } - } - #[inline] - unsafe fn get_integer_attribute_for_layout(&self, integer_attribute: IntegerAttribute) - -> Option { - match integer_attribute { - IntegerAttribute::Cols => { - if !self.is_htmltextareaelement() { - panic!("I'm not a textarea element!") - } - let this: &HTMLTextAreaElement = mem::transmute(self); - Some(this.get_cols_for_layout() as i32) + + let cols = if self.is_htmltextareaelement() { + let this: &HTMLTextAreaElement = mem::transmute(self); + match this.get_cols_for_layout() { + 0 => None, + c => Some(c as i32), } - IntegerAttribute::Rows => { - if !self.is_htmltextareaelement() { - panic!("I'm not a textarea element!") - } - let this: &HTMLTextAreaElement = mem::transmute(self); - Some(this.get_rows_for_layout() as i32) + } else { + None + }; + + if let Some(cols) = cols { + // TODO(mttr) ServoCharacterWidth uses the size math for , but + // the math for