aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmltablecellelement.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-12-07 23:01:35 -0800
committerPatrick Walton <pcwalton@mimiga.net>2014-12-15 17:41:51 -0800
commit56b78de5bce995198fbeb41adc58d7625ec93372 (patch)
tree3267aae2b7b71c577accf5307eb2a1fa707dbd05 /components/script/dom/htmltablecellelement.rs
parent14bafb11bec973cd1362ff38a8e4aa2385c6ff37 (diff)
downloadservo-56b78de5bce995198fbeb41adc58d7625ec93372.tar.gz
servo-56b78de5bce995198fbeb41adc58d7625ec93372.zip
style: Implement basic column spans.
This patch provides some of the groundwork for column spans greater than 1. It implements the column-span CSS property (prefixed so as not to be exposed to content) as well as the corresponding colspan attribute; although the former is not well-specified outside of CSS multi-column layout, INTRINSIC refers to it. Although width is distributed to spanning columns, they do not yet contribute minimum and preferred widths; this will be implemented in a follow-up. Additionally, this patch cleans up some miscellaneous formatting issues and improves the handling of table rowgroups.
Diffstat (limited to 'components/script/dom/htmltablecellelement.rs')
-rw-r--r--components/script/dom/htmltablecellelement.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/components/script/dom/htmltablecellelement.rs b/components/script/dom/htmltablecellelement.rs
index 25a5e9e78b0..81a6ba3f9f0 100644
--- a/components/script/dom/htmltablecellelement.rs
+++ b/components/script/dom/htmltablecellelement.rs
@@ -22,6 +22,7 @@ pub struct HTMLTableCellElement {
htmlelement: HTMLElement,
background_color: Cell<Option<SimpleColor>>,
border: Cell<Option<u32>>,
+ colspan: Cell<Option<u32>>,
width: Cell<LengthOrPercentageOrAuto>,
}
@@ -45,6 +46,7 @@ impl HTMLTableCellElement {
htmlelement: HTMLElement::new_inherited(type_id, tag_name, prefix, document),
background_color: Cell::new(None),
border: Cell::new(None),
+ colspan: Cell::new(None),
width: Cell::new(AutoLpa),
}
}
@@ -58,6 +60,7 @@ impl HTMLTableCellElement {
pub trait HTMLTableCellElementHelpers {
fn get_background_color(&self) -> Option<SimpleColor>;
fn get_border(&self) -> Option<u32>;
+ fn get_colspan(&self) -> Option<u32>;
fn get_width(&self) -> LengthOrPercentageOrAuto;
}
@@ -70,6 +73,10 @@ impl HTMLTableCellElementHelpers for HTMLTableCellElement {
self.border.get()
}
+ fn get_colspan(&self) -> Option<u32> {
+ self.colspan.get()
+ }
+
fn get_width(&self) -> LengthOrPercentageOrAuto {
self.width.get()
}
@@ -97,6 +104,9 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLTableCellElement> {
.as_slice()
.chars()).unwrap_or(1)))
}
+ &atom!("colspan") => {
+ self.colspan.set(str::parse_unsigned_integer(attr.value().as_slice().chars()));
+ }
&atom!("width") => self.width.set(str::parse_length(attr.value().as_slice())),
_ => ()
}
@@ -111,6 +121,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLTableCellElement> {
match attr.local_name() {
&atom!("bgcolor") => self.background_color.set(None),
&atom!("border") => self.border.set(None),
+ &atom!("colspan") => self.colspan.set(None),
&atom!("width") => self.width.set(AutoLpa),
_ => ()
}