mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Introduce a get_colspan method on LayoutJS<Element>.
This commit is contained in:
parent
8f2a3a64f1
commit
5417df6397
3 changed files with 20 additions and 3 deletions
|
@ -20,7 +20,6 @@ use model::MaybeAuto;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use style::computed_values::{border_collapse, border_top_style};
|
use style::computed_values::{border_collapse, border_top_style};
|
||||||
use style::legacy::UnsignedIntegerAttribute;
|
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use table::InternalTable;
|
use table::InternalTable;
|
||||||
use table_row::{CollapsedBorder, CollapsedBorderProvenance};
|
use table_row::{CollapsedBorder, CollapsedBorderProvenance};
|
||||||
|
@ -52,8 +51,7 @@ impl TableCellFlow {
|
||||||
TableCellFlow {
|
TableCellFlow {
|
||||||
block_flow: BlockFlow::from_fragment(fragment, None),
|
block_flow: BlockFlow::from_fragment(fragment, None),
|
||||||
collapsed_borders: CollapsedBordersForCell::new(),
|
collapsed_borders: CollapsedBordersForCell::new(),
|
||||||
column_span: node.get_unsigned_integer_attribute(UnsignedIntegerAttribute::ColSpan)
|
column_span: node.get_colspan(),
|
||||||
.unwrap_or(1),
|
|
||||||
visible: visible,
|
visible: visible,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1039,6 +1039,12 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
||||||
iframe_element.pipeline_id().unwrap()
|
iframe_element.pipeline_id().unwrap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_colspan(&self) -> u32 {
|
||||||
|
unsafe {
|
||||||
|
self.get_jsmanaged().downcast::<Element>().unwrap().get_colspan()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ThreadSafeLayoutNodeChildrenIterator<'a> {
|
pub struct ThreadSafeLayoutNodeChildrenIterator<'a> {
|
||||||
|
|
|
@ -225,6 +225,8 @@ pub trait LayoutElementHelpers {
|
||||||
unsafe fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, &mut V)
|
unsafe fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, &mut V)
|
||||||
where V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>>;
|
where V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>>;
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
|
unsafe fn get_colspan(self) -> u32;
|
||||||
|
#[allow(unsafe_code)]
|
||||||
unsafe fn get_unsigned_integer_attribute_for_layout(&self, attribute: UnsignedIntegerAttribute)
|
unsafe fn get_unsigned_integer_attribute_for_layout(&self, attribute: UnsignedIntegerAttribute)
|
||||||
-> Option<u32>;
|
-> Option<u32>;
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
|
@ -499,6 +501,17 @@ impl LayoutElementHelpers for LayoutJS<Element> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(unsafe_code)]
|
||||||
|
unsafe fn get_colspan(self) -> u32 {
|
||||||
|
if let Some(this) = self.downcast::<HTMLTableCellElement>() {
|
||||||
|
this.get_colspan().unwrap_or(1)
|
||||||
|
} else {
|
||||||
|
// Don't panic since `display` can cause this to be called on arbitrary
|
||||||
|
// elements.
|
||||||
|
1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe fn get_unsigned_integer_attribute_for_layout(&self,
|
unsafe fn get_unsigned_integer_attribute_for_layout(&self,
|
||||||
attribute: UnsignedIntegerAttribute)
|
attribute: UnsignedIntegerAttribute)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue