aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmltablecellelement.rs
diff options
context:
space:
mode:
authorMatt Brubeck <mbrubeck@limpet.net>2016-11-22 13:24:06 -0800
committerMatt Brubeck <mbrubeck@limpet.net>2016-12-14 09:58:23 -0800
commite982d6003fb0e4bc0a26cb5cf488bc8c2bc117f8 (patch)
tree8fa150b0d5e7ec8c5f6167620d613451fa6b7c0a /components/script/dom/htmltablecellelement.rs
parentb77a0a89cf76a15346345c74e712a8d56b6ee517 (diff)
downloadservo-e982d6003fb0e4bc0a26cb5cf488bc8c2bc117f8.tar.gz
servo-e982d6003fb0e4bc0a26cb5cf488bc8c2bc117f8.zip
Add the HTMLTableCellElement::rowspan property
Diffstat (limited to 'components/script/dom/htmltablecellelement.rs')
-rw-r--r--components/script/dom/htmltablecellelement.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/components/script/dom/htmltablecellelement.rs b/components/script/dom/htmltablecellelement.rs
index 1ec389d9977..b4bd885d4ed 100644
--- a/components/script/dom/htmltablecellelement.rs
+++ b/components/script/dom/htmltablecellelement.rs
@@ -18,6 +18,7 @@ use html5ever_atoms::LocalName;
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
const DEFAULT_COLSPAN: u32 = 1;
+const DEFAULT_ROWSPAN: u32 = 1;
#[dom_struct]
pub struct HTMLTableCellElement {
@@ -47,6 +48,12 @@ impl HTMLTableCellElementMethods for HTMLTableCellElement {
// https://html.spec.whatwg.org/multipage/#dom-tdth-colspan
make_uint_setter!(SetColSpan, "colspan", DEFAULT_COLSPAN);
+ // https://html.spec.whatwg.org/multipage/#dom-tdth-rowspan
+ make_uint_getter!(RowSpan, "rowspan", DEFAULT_ROWSPAN);
+
+ // https://html.spec.whatwg.org/multipage/#dom-tdth-rowspan
+ make_uint_setter!(SetRowSpan, "rowspan", DEFAULT_ROWSPAN);
+
// https://html.spec.whatwg.org/multipage/#dom-tdth-bgcolor
make_getter!(BgColor, "bgcolor");
@@ -80,6 +87,7 @@ impl HTMLTableCellElementMethods for HTMLTableCellElement {
pub trait HTMLTableCellElementLayoutHelpers {
fn get_background_color(&self) -> Option<RGBA>;
fn get_colspan(&self) -> Option<u32>;
+ fn get_rowspan(&self) -> Option<u32>;
fn get_width(&self) -> LengthOrPercentageOrAuto;
}
@@ -102,6 +110,14 @@ impl HTMLTableCellElementLayoutHelpers for LayoutJS<HTMLTableCellElement> {
}
}
+ fn get_rowspan(&self) -> Option<u32> {
+ unsafe {
+ (&*self.upcast::<Element>().unsafe_get())
+ .get_attr_for_layout(&ns!(), &local_name!("rowspan"))
+ .map(AttrValue::as_uint)
+ }
+ }
+
fn get_width(&self) -> LengthOrPercentageOrAuto {
unsafe {
(&*self.upcast::<Element>().unsafe_get())
@@ -121,6 +137,7 @@ impl VirtualMethods for HTMLTableCellElement {
fn parse_plain_attribute(&self, local_name: &LocalName, value: DOMString) -> AttrValue {
match *local_name {
local_name!("colspan") => AttrValue::from_u32(value.into(), DEFAULT_COLSPAN),
+ local_name!("rowspan") => AttrValue::from_u32(value.into(), DEFAULT_ROWSPAN),
local_name!("bgcolor") => AttrValue::from_legacy_color(value.into()),
local_name!("width") => AttrValue::from_nonzero_dimension(value.into()),
_ => self.super_type().unwrap().parse_plain_attribute(local_name, value),