mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Remove HTMLTableElement::width struct field
This commit is contained in:
parent
73314ab10c
commit
71aa2392f8
2 changed files with 8 additions and 11 deletions
|
@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
||||||
use dom::bindings::inheritance::Castable;
|
use dom::bindings::inheritance::Castable;
|
||||||
use dom::bindings::js::{LayoutJS, Root, RootedReference};
|
use dom::bindings::js::{LayoutJS, Root, RootedReference};
|
||||||
use dom::document::Document;
|
use dom::document::Document;
|
||||||
use dom::element::{AttributeMutation, Element};
|
use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers};
|
||||||
use dom::htmlelement::HTMLElement;
|
use dom::htmlelement::HTMLElement;
|
||||||
use dom::htmltablecaptionelement::HTMLTableCaptionElement;
|
use dom::htmltablecaptionelement::HTMLTableCaptionElement;
|
||||||
use dom::htmltablesectionelement::HTMLTableSectionElement;
|
use dom::htmltablesectionelement::HTMLTableSectionElement;
|
||||||
|
@ -26,7 +26,6 @@ pub struct HTMLTableElement {
|
||||||
background_color: Cell<Option<RGBA>>,
|
background_color: Cell<Option<RGBA>>,
|
||||||
border: Cell<Option<u32>>,
|
border: Cell<Option<u32>>,
|
||||||
cellspacing: Cell<Option<u32>>,
|
cellspacing: Cell<Option<u32>>,
|
||||||
width: Cell<LengthOrPercentageOrAuto>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLTableElement {
|
impl HTMLTableElement {
|
||||||
|
@ -37,7 +36,6 @@ impl HTMLTableElement {
|
||||||
background_color: Cell::new(None),
|
background_color: Cell::new(None),
|
||||||
border: Cell::new(None),
|
border: Cell::new(None),
|
||||||
cellspacing: Cell::new(None),
|
cellspacing: Cell::new(None),
|
||||||
width: Cell::new(LengthOrPercentageOrAuto::Auto),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +149,11 @@ impl HTMLTableElementLayoutHelpers for LayoutJS<HTMLTableElement> {
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn get_width(&self) -> LengthOrPercentageOrAuto {
|
fn get_width(&self) -> LengthOrPercentageOrAuto {
|
||||||
unsafe {
|
unsafe {
|
||||||
(*self.unsafe_get()).width.get()
|
(*self.upcast::<Element>().unsafe_get())
|
||||||
|
.get_attr_for_layout(&ns!(""), &atom!("width"))
|
||||||
|
.map(AttrValue::as_dimension)
|
||||||
|
.cloned()
|
||||||
|
.unwrap_or(LengthOrPercentageOrAuto::Auto)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -180,12 +182,6 @@ impl VirtualMethods for HTMLTableElement {
|
||||||
str::parse_unsigned_integer(value.chars())
|
str::parse_unsigned_integer(value.chars())
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
atom!(width) => {
|
|
||||||
let width = mutation.new_value(attr).map(|value| {
|
|
||||||
str::parse_length(&value)
|
|
||||||
});
|
|
||||||
self.width.set(width.unwrap_or(LengthOrPercentageOrAuto::Auto));
|
|
||||||
},
|
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,6 +189,7 @@ impl VirtualMethods for HTMLTableElement {
|
||||||
fn parse_plain_attribute(&self, local_name: &Atom, value: DOMString) -> AttrValue {
|
fn parse_plain_attribute(&self, local_name: &Atom, value: DOMString) -> AttrValue {
|
||||||
match *local_name {
|
match *local_name {
|
||||||
atom!("border") => AttrValue::from_u32(value, 1),
|
atom!("border") => AttrValue::from_u32(value, 1),
|
||||||
|
atom!("width") => AttrValue::from_dimension(value),
|
||||||
_ => self.super_type().unwrap().parse_plain_attribute(local_name, value),
|
_ => self.super_type().unwrap().parse_plain_attribute(local_name, value),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,7 +238,7 @@ macro_rules! make_dimension_setter(
|
||||||
use dom::element::Element;
|
use dom::element::Element;
|
||||||
use string_cache::Atom;
|
use string_cache::Atom;
|
||||||
let element = self.upcast::<Element>();
|
let element = self.upcast::<Element>();
|
||||||
let value = AttrValue::parse_dimension(value);
|
let value = AttrValue::from_dimension(value);
|
||||||
// FIXME(pcwalton): Do this at compile time, not at runtime.
|
// FIXME(pcwalton): Do this at compile time, not at runtime.
|
||||||
element.set_attribute(&Atom::from_slice($htmlname), value)
|
element.set_attribute(&Atom::from_slice($htmlname), value)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue