aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/table.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/layout/table.rs')
-rw-r--r--components/layout/table.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/components/layout/table.rs b/components/layout/table.rs
index 5068827c0d7..54e9b73d2fe 100644
--- a/components/layout/table.rs
+++ b/components/layout/table.rs
@@ -203,6 +203,34 @@ impl TableFlow {
}
self.spacing().horizontal() * (num_columns as i32 + 1)
}
+
+ fn column_styles(&self) -> Vec<ColumnStyle> {
+ let mut styles = vec![];
+ for group in self.block_flow.base.child_iter()
+ .filter(|kid| kid.is_table_colgroup()) {
+ // XXXManishearth these as_foo methods should return options
+ // so that we can filter_map
+ let group = group.as_table_colgroup();
+ let colgroup_style = group.fragment.as_ref().map(|f| f.style());
+
+ // The colgroup's span attribute is only relevant when
+ // it has no children
+ // https://html.spec.whatwg.org/multipage/#forming-a-table
+ if group.cols.is_empty() {
+ let span = group.fragment.as_ref().map(|f| f.column_span()).unwrap_or(1);
+ styles.push(ColumnStyle { span, colgroup_style, col_style: None });
+ } else {
+ for col in &group.cols {
+ styles.push(ColumnStyle {
+ span: col.column_span(),
+ colgroup_style,
+ col_style: Some(col.style()),
+ })
+ }
+ }
+ }
+ styles
+ }
}
impl Flow for TableFlow {
@@ -529,6 +557,13 @@ impl Flow for TableFlow {
}
}
+#[derive(Debug, Copy, Clone)]
+struct ColumnStyle<'a> {
+ span: u32,
+ colgroup_style: Option<&'a ComputedValues>,
+ col_style: Option<&'a ComputedValues>,
+}
+
impl fmt::Debug for TableFlow {
/// Outputs a debugging string describing this table flow.
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {