mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Elide most 'a lifetimes
This commit is contained in:
parent
35dd1816a9
commit
54c036cd66
33 changed files with 126 additions and 126 deletions
|
@ -1115,7 +1115,7 @@ impl DisplayItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn base<'a>(&'a self) -> &'a BaseDisplayItem {
|
pub fn base(&self) -> &BaseDisplayItem {
|
||||||
match *self {
|
match *self {
|
||||||
DisplayItem::SolidColorClass(ref solid_color) => &solid_color.base,
|
DisplayItem::SolidColorClass(ref solid_color) => &solid_color.base,
|
||||||
DisplayItem::TextClass(ref text) => &text.base,
|
DisplayItem::TextClass(ref text) => &text.base,
|
||||||
|
@ -1127,7 +1127,7 @@ impl DisplayItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mut_base<'a>(&'a mut self) -> &'a mut BaseDisplayItem {
|
pub fn mut_base(&mut self) -> &mut BaseDisplayItem {
|
||||||
match *self {
|
match *self {
|
||||||
DisplayItem::SolidColorClass(ref mut solid_color) => &mut solid_color.base,
|
DisplayItem::SolidColorClass(ref mut solid_color) => &mut solid_color.base,
|
||||||
DisplayItem::TextClass(ref mut text) => &mut text.base,
|
DisplayItem::TextClass(ref mut text) => &mut text.base,
|
||||||
|
|
|
@ -696,7 +696,7 @@ impl BlockFlow {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return this flow's fragment.
|
/// Return this flow's fragment.
|
||||||
pub fn fragment<'a>(&'a mut self) -> &'a mut Fragment {
|
pub fn fragment(&mut self) -> &mut Fragment {
|
||||||
&mut self.fragment
|
&mut self.fragment
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1624,11 +1624,11 @@ impl Flow for BlockFlow {
|
||||||
FlowClass::Block
|
FlowClass::Block
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
fn as_mut_block(&mut self) -> &mut BlockFlow {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_block<'a>(&'a self) -> &'a BlockFlow {
|
fn as_block(&self) -> &BlockFlow {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -348,7 +348,7 @@ impl StyleSharingCandidateCache {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn iter<'a>(&'a self) -> Iter<'a, (StyleSharingCandidate, ())> {
|
pub fn iter(&self) -> Iter<(StyleSharingCandidate, ())> {
|
||||||
self.cache.iter()
|
self.cache.iter()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -309,7 +309,7 @@ impl Flow for FlexFlow {
|
||||||
FlowClass::Flex
|
FlowClass::Flex
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
fn as_mut_block(&mut self) -> &mut BlockFlow {
|
||||||
&mut self.block_flow
|
&mut self.block_flow
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,108 +77,108 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
|
||||||
fn class(&self) -> FlowClass;
|
fn class(&self) -> FlowClass;
|
||||||
|
|
||||||
/// If this is a block flow, returns the underlying object. Fails otherwise.
|
/// If this is a block flow, returns the underlying object. Fails otherwise.
|
||||||
fn as_block<'a>(&'a self) -> &'a BlockFlow {
|
fn as_block(&self) -> &BlockFlow {
|
||||||
panic!("called as_block() on a non-block flow")
|
panic!("called as_block() on a non-block flow")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If this is a block flow, returns the underlying object, borrowed mutably. Fails otherwise.
|
/// If this is a block flow, returns the underlying object, borrowed mutably. Fails otherwise.
|
||||||
fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
fn as_mut_block(&mut self) -> &mut BlockFlow {
|
||||||
debug!("called as_mut_block() on a flow of type {:?}", self.class());
|
debug!("called as_mut_block() on a flow of type {:?}", self.class());
|
||||||
panic!("called as_mut_block() on a non-block flow")
|
panic!("called as_mut_block() on a non-block flow")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If this is an inline flow, returns the underlying object. Fails otherwise.
|
/// If this is an inline flow, returns the underlying object. Fails otherwise.
|
||||||
fn as_inline<'a>(&'a self) -> &'a InlineFlow {
|
fn as_inline(&self) -> &InlineFlow {
|
||||||
panic!("called as_inline() on a non-inline flow")
|
panic!("called as_inline() on a non-inline flow")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If this is an inline flow, returns the underlying object, borrowed mutably. Fails
|
/// If this is an inline flow, returns the underlying object, borrowed mutably. Fails
|
||||||
/// otherwise.
|
/// otherwise.
|
||||||
fn as_mut_inline<'a>(&'a mut self) -> &'a mut InlineFlow {
|
fn as_mut_inline(&mut self) -> &mut InlineFlow {
|
||||||
panic!("called as_mut_inline() on a non-inline flow")
|
panic!("called as_mut_inline() on a non-inline flow")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If this is a table wrapper flow, returns the underlying object, borrowed mutably. Fails
|
/// If this is a table wrapper flow, returns the underlying object, borrowed mutably. Fails
|
||||||
/// otherwise.
|
/// otherwise.
|
||||||
fn as_mut_table_wrapper<'a>(&'a mut self) -> &'a mut TableWrapperFlow {
|
fn as_mut_table_wrapper(&mut self) -> &mut TableWrapperFlow {
|
||||||
panic!("called as_mut_table_wrapper() on a non-tablewrapper flow")
|
panic!("called as_mut_table_wrapper() on a non-tablewrapper flow")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If this is a table wrapper flow, returns the underlying object. Fails otherwise.
|
/// If this is a table wrapper flow, returns the underlying object. Fails otherwise.
|
||||||
fn as_table_wrapper<'a>(&'a self) -> &'a TableWrapperFlow {
|
fn as_table_wrapper(&self) -> &TableWrapperFlow {
|
||||||
panic!("called as_table_wrapper() on a non-tablewrapper flow")
|
panic!("called as_table_wrapper() on a non-tablewrapper flow")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If this is a table flow, returns the underlying object, borrowed mutably. Fails otherwise.
|
/// If this is a table flow, returns the underlying object, borrowed mutably. Fails otherwise.
|
||||||
fn as_mut_table<'a>(&'a mut self) -> &'a mut TableFlow {
|
fn as_mut_table(&mut self) -> &mut TableFlow {
|
||||||
panic!("called as_mut_table() on a non-table flow")
|
panic!("called as_mut_table() on a non-table flow")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If this is a table flow, returns the underlying object. Fails otherwise.
|
/// If this is a table flow, returns the underlying object. Fails otherwise.
|
||||||
fn as_table<'a>(&'a self) -> &'a TableFlow {
|
fn as_table(&self) -> &TableFlow {
|
||||||
panic!("called as_table() on a non-table flow")
|
panic!("called as_table() on a non-table flow")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If this is a table colgroup flow, returns the underlying object, borrowed mutably. Fails
|
/// If this is a table colgroup flow, returns the underlying object, borrowed mutably. Fails
|
||||||
/// otherwise.
|
/// otherwise.
|
||||||
fn as_mut_table_colgroup<'a>(&'a mut self) -> &'a mut TableColGroupFlow {
|
fn as_mut_table_colgroup(&mut self) -> &mut TableColGroupFlow {
|
||||||
panic!("called as_mut_table_colgroup() on a non-tablecolgroup flow")
|
panic!("called as_mut_table_colgroup() on a non-tablecolgroup flow")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If this is a table rowgroup flow, returns the underlying object, borrowed mutably. Fails
|
/// If this is a table rowgroup flow, returns the underlying object, borrowed mutably. Fails
|
||||||
/// otherwise.
|
/// otherwise.
|
||||||
fn as_mut_table_rowgroup<'a>(&'a mut self) -> &'a mut TableRowGroupFlow {
|
fn as_mut_table_rowgroup(&mut self) -> &mut TableRowGroupFlow {
|
||||||
panic!("called as_mut_table_rowgroup() on a non-tablerowgroup flow")
|
panic!("called as_mut_table_rowgroup() on a non-tablerowgroup flow")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If this is a table rowgroup flow, returns the underlying object. Fails otherwise.
|
/// If this is a table rowgroup flow, returns the underlying object. Fails otherwise.
|
||||||
fn as_table_rowgroup<'a>(&'a self) -> &'a TableRowGroupFlow {
|
fn as_table_rowgroup(&self) -> &TableRowGroupFlow {
|
||||||
panic!("called as_table_rowgroup() on a non-tablerowgroup flow")
|
panic!("called as_table_rowgroup() on a non-tablerowgroup flow")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If this is a table row flow, returns the underlying object, borrowed mutably. Fails
|
/// If this is a table row flow, returns the underlying object, borrowed mutably. Fails
|
||||||
/// otherwise.
|
/// otherwise.
|
||||||
fn as_mut_table_row<'a>(&'a mut self) -> &'a mut TableRowFlow {
|
fn as_mut_table_row(&mut self) -> &mut TableRowFlow {
|
||||||
panic!("called as_mut_table_row() on a non-tablerow flow")
|
panic!("called as_mut_table_row() on a non-tablerow flow")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If this is a table row flow, returns the underlying object. Fails otherwise.
|
/// If this is a table row flow, returns the underlying object. Fails otherwise.
|
||||||
fn as_table_row<'a>(&'a self) -> &'a TableRowFlow {
|
fn as_table_row(&self) -> &TableRowFlow {
|
||||||
panic!("called as_table_row() on a non-tablerow flow")
|
panic!("called as_table_row() on a non-tablerow flow")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If this is a table cell flow, returns the underlying object, borrowed mutably. Fails
|
/// If this is a table cell flow, returns the underlying object, borrowed mutably. Fails
|
||||||
/// otherwise.
|
/// otherwise.
|
||||||
fn as_mut_table_caption<'a>(&'a mut self) -> &'a mut TableCaptionFlow {
|
fn as_mut_table_caption(&mut self) -> &mut TableCaptionFlow {
|
||||||
panic!("called as_mut_table_caption() on a non-tablecaption flow")
|
panic!("called as_mut_table_caption() on a non-tablecaption flow")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If this is a table cell flow, returns the underlying object, borrowed mutably. Fails
|
/// If this is a table cell flow, returns the underlying object, borrowed mutably. Fails
|
||||||
/// otherwise.
|
/// otherwise.
|
||||||
fn as_mut_table_cell<'a>(&'a mut self) -> &'a mut TableCellFlow {
|
fn as_mut_table_cell(&mut self) -> &mut TableCellFlow {
|
||||||
panic!("called as_mut_table_cell() on a non-tablecell flow")
|
panic!("called as_mut_table_cell() on a non-tablecell flow")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If this is a multicol flow, returns the underlying object, borrowed mutably. Fails
|
/// If this is a multicol flow, returns the underlying object, borrowed mutably. Fails
|
||||||
/// otherwise.
|
/// otherwise.
|
||||||
fn as_mut_multicol<'a>(&'a mut self) -> &'a mut MulticolFlow {
|
fn as_mut_multicol(&mut self) -> &mut MulticolFlow {
|
||||||
panic!("called as_mut_multicol() on a non-multicol flow")
|
panic!("called as_mut_multicol() on a non-multicol flow")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If this is a table cell flow, returns the underlying object. Fails otherwise.
|
/// If this is a table cell flow, returns the underlying object. Fails otherwise.
|
||||||
fn as_table_cell<'a>(&'a self) -> &'a TableCellFlow {
|
fn as_table_cell(&self) -> &TableCellFlow {
|
||||||
panic!("called as_table_cell() on a non-tablecell flow")
|
panic!("called as_table_cell() on a non-tablecell flow")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If this is a table row, table rowgroup, or table flow, returns column intrinsic
|
/// If this is a table row, table rowgroup, or table flow, returns column intrinsic
|
||||||
/// inline-sizes. Fails otherwise.
|
/// inline-sizes. Fails otherwise.
|
||||||
fn column_intrinsic_inline_sizes<'a>(&'a mut self) -> &'a mut Vec<ColumnIntrinsicInlineSize> {
|
fn column_intrinsic_inline_sizes(&mut self) -> &mut Vec<ColumnIntrinsicInlineSize> {
|
||||||
panic!("called column_intrinsic_inline_sizes() on non-table flow")
|
panic!("called column_intrinsic_inline_sizes() on non-table flow")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If this is a table row, table rowgroup, or table flow, returns column computed
|
/// If this is a table row, table rowgroup, or table flow, returns column computed
|
||||||
/// inline-sizes. Fails otherwise.
|
/// inline-sizes. Fails otherwise.
|
||||||
fn column_computed_inline_sizes<'a>(&'a mut self) -> &'a mut Vec<ColumnComputedInlineSize> {
|
fn column_computed_inline_sizes(&mut self) -> &mut Vec<ColumnComputedInlineSize> {
|
||||||
panic!("called column_intrinsic_inline_sizes() on non-table flow")
|
panic!("called column_intrinsic_inline_sizes() on non-table flow")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -756,7 +756,7 @@ impl AbsoluteDescendants {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return an iterator over the descendant flows.
|
/// Return an iterator over the descendant flows.
|
||||||
pub fn iter<'a>(&'a mut self) -> AbsoluteDescendantIter<'a> {
|
pub fn iter(&mut self) -> AbsoluteDescendantIter {
|
||||||
AbsoluteDescendantIter {
|
AbsoluteDescendantIter {
|
||||||
iter: self.descendant_links.iter_mut(),
|
iter: self.descendant_links.iter_mut(),
|
||||||
}
|
}
|
||||||
|
@ -1093,7 +1093,7 @@ impl BaseFlow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn child_iter<'a>(&'a mut self) -> MutFlowListIterator<'a> {
|
pub fn child_iter(&mut self) -> MutFlowListIterator {
|
||||||
self.children.iter_mut()
|
self.children.iter_mut()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1497,7 +1497,7 @@ impl ContainingBlockLink {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
pub unsafe fn get<'a>(&'a mut self) -> &'a mut Option<WeakFlowRef> {
|
pub unsafe fn get(&mut self) -> &mut Option<WeakFlowRef> {
|
||||||
&mut self.link
|
&mut self.link
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,27 +25,27 @@ pub struct MutFlowListIterator<'a> {
|
||||||
impl FlowList {
|
impl FlowList {
|
||||||
/// Provide a reference to the front element, or None if the list is empty
|
/// Provide a reference to the front element, or None if the list is empty
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn front<'a>(&'a self) -> Option<&'a Flow> {
|
pub fn front(&self) -> Option<&Flow> {
|
||||||
self.flows.front().map(|head| &**head)
|
self.flows.front().map(|head| &**head)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Provide a mutable reference to the front element, or None if the list is empty
|
/// Provide a mutable reference to the front element, or None if the list is empty
|
||||||
#[inline]
|
#[inline]
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
pub unsafe fn front_mut<'a>(&'a mut self) -> Option<&'a mut Flow> {
|
pub unsafe fn front_mut(&mut self) -> Option<&mut Flow> {
|
||||||
self.flows.front_mut().map(flow_ref::deref_mut)
|
self.flows.front_mut().map(flow_ref::deref_mut)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Provide a reference to the back element, or None if the list is empty
|
/// Provide a reference to the back element, or None if the list is empty
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn back<'a>(&'a self) -> Option<&'a Flow> {
|
pub fn back(&self) -> Option<&Flow> {
|
||||||
self.flows.back().map(|tail| &**tail)
|
self.flows.back().map(|tail| &**tail)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Provide a mutable reference to the back element, or None if the list is empty
|
/// Provide a mutable reference to the back element, or None if the list is empty
|
||||||
#[inline]
|
#[inline]
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
pub unsafe fn back_mut<'a>(&'a mut self) -> Option<&'a mut Flow> {
|
pub unsafe fn back_mut(&mut self) -> Option<&mut Flow> {
|
||||||
self.flows.back_mut().map(flow_ref::deref_mut)
|
self.flows.back_mut().map(flow_ref::deref_mut)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ impl FlowList {
|
||||||
|
|
||||||
/// Provide a forward iterator
|
/// Provide a forward iterator
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn iter<'a>(&'a self) -> FlowListIterator<'a> {
|
pub fn iter(&self) -> FlowListIterator {
|
||||||
FlowListIterator {
|
FlowListIterator {
|
||||||
it: self.flows.iter(),
|
it: self.flows.iter(),
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ impl FlowList {
|
||||||
|
|
||||||
/// Provide a forward iterator with mutable references
|
/// Provide a forward iterator with mutable references
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn iter_mut<'a>(&'a mut self) -> MutFlowListIterator<'a> {
|
pub fn iter_mut(&mut self) -> MutFlowListIterator {
|
||||||
MutFlowListIterator {
|
MutFlowListIterator {
|
||||||
it: self.flows.iter_mut(),
|
it: self.flows.iter_mut(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -841,12 +841,12 @@ impl InlineFragments {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A convenience function to return the fragment at a given index.
|
/// A convenience function to return the fragment at a given index.
|
||||||
pub fn get<'a>(&'a self, index: usize) -> &'a Fragment {
|
pub fn get(&self, index: usize) -> &Fragment {
|
||||||
&self.fragments[index]
|
&self.fragments[index]
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A convenience function to return a mutable reference to the fragment at a given index.
|
/// A convenience function to return a mutable reference to the fragment at a given index.
|
||||||
pub fn get_mut<'a>(&'a mut self, index: usize) -> &'a mut Fragment {
|
pub fn get_mut(&mut self, index: usize) -> &mut Fragment {
|
||||||
&mut self.fragments[index]
|
&mut self.fragments[index]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1314,11 +1314,11 @@ impl Flow for InlineFlow {
|
||||||
FlowClass::Inline
|
FlowClass::Inline
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_inline<'a>(&'a self) -> &'a InlineFlow {
|
fn as_inline(&self) -> &InlineFlow {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_mut_inline<'a>(&'a mut self) -> &'a mut InlineFlow {
|
fn as_mut_inline(&mut self) -> &mut InlineFlow {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1266,7 +1266,7 @@ impl LayoutTask {
|
||||||
animation::tick_all_animations(self, &mut rw_data)
|
animation::tick_all_animations(self, &mut rw_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tick_animations<'a>(&'a self, rw_data: &mut LayoutTaskData) {
|
pub fn tick_animations(&self, rw_data: &mut LayoutTaskData) {
|
||||||
let reflow_info = Reflow {
|
let reflow_info = Reflow {
|
||||||
goal: ReflowGoal::ForDisplay,
|
goal: ReflowGoal::ForDisplay,
|
||||||
page_clip_rect: MAX_RECT,
|
page_clip_rect: MAX_RECT,
|
||||||
|
|
|
@ -68,11 +68,11 @@ impl Flow for ListItemFlow {
|
||||||
FlowClass::ListItem
|
FlowClass::ListItem
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
fn as_mut_block(&mut self) -> &mut BlockFlow {
|
||||||
&mut self.block_flow
|
&mut self.block_flow
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_block<'a>(&'a self) -> &'a BlockFlow {
|
fn as_block(&self) -> &BlockFlow {
|
||||||
&self.block_flow
|
&self.block_flow
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,15 +36,15 @@ impl Flow for MulticolFlow {
|
||||||
FlowClass::Multicol
|
FlowClass::Multicol
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_mut_multicol<'a>(&'a mut self) -> &'a mut MulticolFlow {
|
fn as_mut_multicol(&mut self) -> &mut MulticolFlow {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
fn as_mut_block(&mut self) -> &mut BlockFlow {
|
||||||
&mut self.block_flow
|
&mut self.block_flow
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_block<'a>(&'a self) -> &'a BlockFlow {
|
fn as_block(&self) -> &BlockFlow {
|
||||||
&self.block_flow
|
&self.block_flow
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -191,15 +191,15 @@ impl Flow for TableFlow {
|
||||||
FlowClass::Table
|
FlowClass::Table
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_mut_table<'a>(&'a mut self) -> &'a mut TableFlow {
|
fn as_mut_table(&mut self) -> &mut TableFlow {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_table<'a>(&'a self) -> &'a TableFlow {
|
fn as_table(&self) -> &TableFlow {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
fn as_mut_block(&mut self) -> &mut BlockFlow {
|
||||||
&mut self.block_flow
|
&mut self.block_flow
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,11 +211,11 @@ impl Flow for TableFlow {
|
||||||
self.block_flow.mark_as_root();
|
self.block_flow.mark_as_root();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn column_intrinsic_inline_sizes<'a>(&'a mut self) -> &'a mut Vec<ColumnIntrinsicInlineSize> {
|
fn column_intrinsic_inline_sizes(&mut self) -> &mut Vec<ColumnIntrinsicInlineSize> {
|
||||||
&mut self.column_intrinsic_inline_sizes
|
&mut self.column_intrinsic_inline_sizes
|
||||||
}
|
}
|
||||||
|
|
||||||
fn column_computed_inline_sizes<'a>(&'a mut self) -> &'a mut Vec<ColumnComputedInlineSize> {
|
fn column_computed_inline_sizes(&mut self) -> &mut Vec<ColumnComputedInlineSize> {
|
||||||
&mut self.column_computed_inline_sizes
|
&mut self.column_computed_inline_sizes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,11 +36,11 @@ impl Flow for TableCaptionFlow {
|
||||||
FlowClass::TableCaption
|
FlowClass::TableCaption
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_mut_table_caption<'a>(&'a mut self) -> &'a mut TableCaptionFlow {
|
fn as_mut_table_caption(&mut self) -> &mut TableCaptionFlow {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
fn as_mut_block(&mut self) -> &mut BlockFlow {
|
||||||
&mut self.block_flow
|
&mut self.block_flow
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,11 +59,11 @@ impl TableCellFlow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn fragment<'a>(&'a mut self) -> &'a Fragment {
|
pub fn fragment(&mut self) -> &Fragment {
|
||||||
&self.block_flow.fragment
|
&self.block_flow.fragment
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mut_fragment<'a>(&'a mut self) -> &'a mut Fragment {
|
pub fn mut_fragment(&mut self) -> &mut Fragment {
|
||||||
&mut self.block_flow.fragment
|
&mut self.block_flow.fragment
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,15 +84,15 @@ impl Flow for TableCellFlow {
|
||||||
FlowClass::TableCell
|
FlowClass::TableCell
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_mut_table_cell<'a>(&'a mut self) -> &'a mut TableCellFlow {
|
fn as_mut_table_cell(&mut self) -> &mut TableCellFlow {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_table_cell<'a>(&'a self) -> &'a TableCellFlow {
|
fn as_table_cell(&self) -> &TableCellFlow {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
fn as_mut_block(&mut self) -> &mut BlockFlow {
|
||||||
&mut self.block_flow
|
&mut self.block_flow
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ impl Flow for TableColGroupFlow {
|
||||||
FlowClass::TableColGroup
|
FlowClass::TableColGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_mut_table_colgroup<'a>(&'a mut self) -> &'a mut TableColGroupFlow {
|
fn as_mut_table_colgroup(&mut self) -> &mut TableColGroupFlow {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ impl TableRowFlow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn fragment<'a>(&'a mut self) -> &'a Fragment {
|
pub fn fragment(&mut self) -> &Fragment {
|
||||||
&self.block_flow.fragment
|
&self.block_flow.fragment
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ impl TableRowFlow {
|
||||||
/// inline(always) because this is only ever called by in-order or non-in-order top-level
|
/// inline(always) because this is only ever called by in-order or non-in-order top-level
|
||||||
/// methods
|
/// methods
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn assign_block_size_table_row_base<'a>(&mut self, layout_context: &'a LayoutContext<'a>) {
|
fn assign_block_size_table_row_base(&mut self, layout_context: &LayoutContext) {
|
||||||
// Per CSS 2.1 § 17.5.3, find max_y = max(computed `block-size`, minimum block-size of all
|
// Per CSS 2.1 § 17.5.3, find max_y = max(computed `block-size`, minimum block-size of all
|
||||||
// cells).
|
// cells).
|
||||||
let mut max_block_size = Au(0);
|
let mut max_block_size = Au(0);
|
||||||
|
@ -202,15 +202,15 @@ impl Flow for TableRowFlow {
|
||||||
FlowClass::TableRow
|
FlowClass::TableRow
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_mut_table_row<'a>(&'a mut self) -> &'a mut TableRowFlow {
|
fn as_mut_table_row(&mut self) -> &mut TableRowFlow {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_table_row<'a>(&'a self) -> &'a TableRowFlow {
|
fn as_table_row(&self) -> &TableRowFlow {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
fn as_mut_block(&mut self) -> &mut BlockFlow {
|
||||||
&mut self.block_flow
|
&mut self.block_flow
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,11 +218,11 @@ impl Flow for TableRowFlow {
|
||||||
&self.block_flow
|
&self.block_flow
|
||||||
}
|
}
|
||||||
|
|
||||||
fn column_intrinsic_inline_sizes<'a>(&'a mut self) -> &'a mut Vec<ColumnIntrinsicInlineSize> {
|
fn column_intrinsic_inline_sizes(&mut self) -> &mut Vec<ColumnIntrinsicInlineSize> {
|
||||||
panic!("can't call column_intrinsic_inline_sizes() on table row")
|
panic!("can't call column_intrinsic_inline_sizes() on table row")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn column_computed_inline_sizes<'a>(&'a mut self) -> &'a mut Vec<ColumnComputedInlineSize> {
|
fn column_computed_inline_sizes(&mut self) -> &mut Vec<ColumnComputedInlineSize> {
|
||||||
&mut self.column_computed_inline_sizes
|
&mut self.column_computed_inline_sizes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,7 +407,7 @@ impl Flow for TableRowFlow {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assign_block_size<'a>(&mut self, layout_context: &'a LayoutContext<'a>) {
|
fn assign_block_size(&mut self, layout_context: &LayoutContext) {
|
||||||
debug!("assign_block_size: assigning block_size for table_row");
|
debug!("assign_block_size: assigning block_size for table_row");
|
||||||
self.assign_block_size_table_row_base(layout_context);
|
self.assign_block_size_table_row_base(layout_context);
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ impl TableRowGroupFlow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn fragment<'a>(&'a mut self) -> &'a Fragment {
|
pub fn fragment(&mut self) -> &Fragment {
|
||||||
&self.block_flow.fragment
|
&self.block_flow.fragment
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,15 +112,15 @@ impl Flow for TableRowGroupFlow {
|
||||||
FlowClass::TableRowGroup
|
FlowClass::TableRowGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_mut_table_rowgroup<'a>(&'a mut self) -> &'a mut TableRowGroupFlow {
|
fn as_mut_table_rowgroup(&mut self) -> &mut TableRowGroupFlow {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_table_rowgroup<'a>(&'a self) -> &'a TableRowGroupFlow {
|
fn as_table_rowgroup(&self) -> &TableRowGroupFlow {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
fn as_mut_block(&mut self) -> &mut BlockFlow {
|
||||||
&mut self.block_flow
|
&mut self.block_flow
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,11 +128,11 @@ impl Flow for TableRowGroupFlow {
|
||||||
&self.block_flow
|
&self.block_flow
|
||||||
}
|
}
|
||||||
|
|
||||||
fn column_intrinsic_inline_sizes<'a>(&'a mut self) -> &'a mut Vec<ColumnIntrinsicInlineSize> {
|
fn column_intrinsic_inline_sizes(&mut self) -> &mut Vec<ColumnIntrinsicInlineSize> {
|
||||||
&mut self.column_intrinsic_inline_sizes
|
&mut self.column_intrinsic_inline_sizes
|
||||||
}
|
}
|
||||||
|
|
||||||
fn column_computed_inline_sizes<'a>(&'a mut self) -> &'a mut Vec<ColumnComputedInlineSize> {
|
fn column_computed_inline_sizes(&mut self) -> &mut Vec<ColumnComputedInlineSize> {
|
||||||
&mut self.column_computed_inline_sizes
|
&mut self.column_computed_inline_sizes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -285,19 +285,19 @@ impl Flow for TableWrapperFlow {
|
||||||
FlowClass::TableWrapper
|
FlowClass::TableWrapper
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_mut_table_wrapper<'a>(&'a mut self) -> &'a mut TableWrapperFlow {
|
fn as_mut_table_wrapper(&mut self) -> &mut TableWrapperFlow {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_table_wrapper<'a>(&'a self) -> &'a TableWrapperFlow {
|
fn as_table_wrapper(&self) -> &TableWrapperFlow {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
fn as_mut_block(&mut self) -> &mut BlockFlow {
|
||||||
&mut self.block_flow
|
&mut self.block_flow
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_block<'a>(&'a self) -> &'a BlockFlow {
|
fn as_block(&self) -> &BlockFlow {
|
||||||
&self.block_flow
|
&self.block_flow
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ impl<'ln> LayoutNode<'ln> {
|
||||||
|
|
||||||
/// Returns the interior of this node as a `LayoutJS`. This is highly unsafe for layout to
|
/// Returns the interior of this node as a `LayoutJS`. This is highly unsafe for layout to
|
||||||
/// call and as such is marked `unsafe`.
|
/// call and as such is marked `unsafe`.
|
||||||
unsafe fn get_jsmanaged<'a>(&'a self) -> &'a LayoutJS<Node> {
|
unsafe fn get_jsmanaged(&self) -> &LayoutJS<Node> {
|
||||||
&self.node
|
&self.node
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ impl<'ln> LayoutNode<'ln> {
|
||||||
|
|
||||||
/// Borrows the layout data immutably. Fails on a conflicting borrow.
|
/// Borrows the layout data immutably. Fails on a conflicting borrow.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn borrow_layout_data<'a>(&'a self) -> Ref<'a, Option<LayoutDataWrapper>> {
|
pub fn borrow_layout_data(&self) -> Ref<Option<LayoutDataWrapper>> {
|
||||||
unsafe {
|
unsafe {
|
||||||
mem::transmute(self.get_jsmanaged().layout_data())
|
mem::transmute(self.get_jsmanaged().layout_data())
|
||||||
}
|
}
|
||||||
|
@ -288,7 +288,7 @@ impl<'ln> LayoutNode<'ln> {
|
||||||
|
|
||||||
/// Borrows the layout data mutably. Fails on a conflicting borrow.
|
/// Borrows the layout data mutably. Fails on a conflicting borrow.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn mutate_layout_data<'a>(&'a self) -> RefMut<'a, Option<LayoutDataWrapper>> {
|
pub fn mutate_layout_data(&self) -> RefMut<Option<LayoutDataWrapper>> {
|
||||||
unsafe {
|
unsafe {
|
||||||
mem::transmute(self.get_jsmanaged().layout_data_mut())
|
mem::transmute(self.get_jsmanaged().layout_data_mut())
|
||||||
}
|
}
|
||||||
|
@ -431,12 +431,12 @@ impl<'le> ::selectors::Element for LayoutElement<'le> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_local_name<'a>(&'a self) -> &'a Atom {
|
fn get_local_name(&self) -> &Atom {
|
||||||
self.element.local_name()
|
self.element.local_name()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_namespace<'a>(&'a self) -> &'a Namespace {
|
fn get_namespace(&self) -> &Namespace {
|
||||||
self.element.namespace()
|
self.element.namespace()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -666,7 +666,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
||||||
|
|
||||||
/// Returns the interior of this node as a `LayoutJS`. This is highly unsafe for layout to
|
/// Returns the interior of this node as a `LayoutJS`. This is highly unsafe for layout to
|
||||||
/// call and as such is marked `unsafe`.
|
/// call and as such is marked `unsafe`.
|
||||||
unsafe fn get_jsmanaged<'a>(&'a self) -> &'a LayoutJS<Node> {
|
unsafe fn get_jsmanaged(&self) -> &LayoutJS<Node> {
|
||||||
self.node.get_jsmanaged()
|
self.node.get_jsmanaged()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -739,7 +739,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
||||||
|
|
||||||
/// Borrows the layout data without checking.
|
/// Borrows the layout data without checking.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn borrow_layout_data_unchecked<'a>(&'a self) -> *const Option<LayoutDataWrapper> {
|
fn borrow_layout_data_unchecked(&self) -> *const Option<LayoutDataWrapper> {
|
||||||
unsafe {
|
unsafe {
|
||||||
self.node.borrow_layout_data_unchecked()
|
self.node.borrow_layout_data_unchecked()
|
||||||
}
|
}
|
||||||
|
@ -749,7 +749,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
||||||
///
|
///
|
||||||
/// TODO(pcwalton): Make this private. It will let us avoid borrow flag checks in some cases.
|
/// TODO(pcwalton): Make this private. It will let us avoid borrow flag checks in some cases.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn borrow_layout_data<'a>(&'a self) -> Ref<'a, Option<LayoutDataWrapper>> {
|
pub fn borrow_layout_data(&self) -> Ref<Option<LayoutDataWrapper>> {
|
||||||
self.node.borrow_layout_data()
|
self.node.borrow_layout_data()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -757,14 +757,14 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
||||||
///
|
///
|
||||||
/// TODO(pcwalton): Make this private. It will let us avoid borrow flag checks in some cases.
|
/// TODO(pcwalton): Make this private. It will let us avoid borrow flag checks in some cases.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn mutate_layout_data<'a>(&'a self) -> RefMut<'a, Option<LayoutDataWrapper>> {
|
pub fn mutate_layout_data(&self) -> RefMut<Option<LayoutDataWrapper>> {
|
||||||
self.node.mutate_layout_data()
|
self.node.mutate_layout_data()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the style results for the given node. If CSS selector matching
|
/// Returns the style results for the given node. If CSS selector matching
|
||||||
/// has not yet been performed, fails.
|
/// has not yet been performed, fails.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn style<'a>(&'a self) -> Ref<'a, Arc<ComputedValues>> {
|
pub fn style(&self) -> Ref<Arc<ComputedValues>> {
|
||||||
Ref::map(self.borrow_layout_data(), |layout_data_ref| {
|
Ref::map(self.borrow_layout_data(), |layout_data_ref| {
|
||||||
let layout_data = layout_data_ref.as_ref().expect("no layout data");
|
let layout_data = layout_data_ref.as_ref().expect("no layout data");
|
||||||
let style = match self.get_pseudo_element_type() {
|
let style = match self.get_pseudo_element_type() {
|
||||||
|
@ -1000,8 +1000,8 @@ pub struct ThreadSafeLayoutNodeChildrenIterator<'a> {
|
||||||
|
|
||||||
impl<'a> ThreadSafeLayoutNodeChildrenIterator<'a> {
|
impl<'a> ThreadSafeLayoutNodeChildrenIterator<'a> {
|
||||||
fn new(parent: ThreadSafeLayoutNode<'a>) -> ThreadSafeLayoutNodeChildrenIterator<'a> {
|
fn new(parent: ThreadSafeLayoutNode<'a>) -> ThreadSafeLayoutNodeChildrenIterator<'a> {
|
||||||
fn first_child<'a>(parent: ThreadSafeLayoutNode<'a>)
|
fn first_child(parent: ThreadSafeLayoutNode)
|
||||||
-> Option<ThreadSafeLayoutNode<'a>> {
|
-> Option<ThreadSafeLayoutNode> {
|
||||||
if parent.pseudo != PseudoElementType::Normal {
|
if parent.pseudo != PseudoElementType::Normal {
|
||||||
return None
|
return None
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ use std::borrow::ToOwned;
|
||||||
|
|
||||||
/// Trait for elements with defined activation behavior
|
/// Trait for elements with defined activation behavior
|
||||||
pub trait Activatable {
|
pub trait Activatable {
|
||||||
fn as_element<'a>(&'a self) -> &'a Element;
|
fn as_element(&self) -> ∈
|
||||||
|
|
||||||
// Is this particular instance of the element activatable?
|
// Is this particular instance of the element activatable?
|
||||||
fn is_instance_activatable(&self) -> bool;
|
fn is_instance_activatable(&self) -> bool;
|
||||||
|
|
|
@ -75,14 +75,14 @@ impl AttrValue {
|
||||||
AttrValue::Atom(value)
|
AttrValue::Atom(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn as_tokens<'a>(&'a self) -> &'a [Atom] {
|
pub fn as_tokens(&self) -> &[Atom] {
|
||||||
match *self {
|
match *self {
|
||||||
AttrValue::TokenList(_, ref tokens) => tokens,
|
AttrValue::TokenList(_, ref tokens) => tokens,
|
||||||
_ => panic!("Tokens not found"),
|
_ => panic!("Tokens not found"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn as_atom<'a>(&'a self) -> &'a Atom {
|
pub fn as_atom(&self) -> &Atom {
|
||||||
match *self {
|
match *self {
|
||||||
AttrValue::Atom(ref value) => value,
|
AttrValue::Atom(ref value) => value,
|
||||||
_ => panic!("Atom not found"),
|
_ => panic!("Atom not found"),
|
||||||
|
@ -104,7 +104,7 @@ impl AttrValue {
|
||||||
impl Deref for AttrValue {
|
impl Deref for AttrValue {
|
||||||
type Target = str;
|
type Target = str;
|
||||||
|
|
||||||
fn deref<'a>(&'a self) -> &'a str {
|
fn deref(&self) -> &str {
|
||||||
match *self {
|
match *self {
|
||||||
AttrValue::String(ref value) |
|
AttrValue::String(ref value) |
|
||||||
AttrValue::TokenList(ref value, _) |
|
AttrValue::TokenList(ref value, _) |
|
||||||
|
@ -152,17 +152,17 @@ impl Attr {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn name<'a>(&'a self) -> &'a Atom {
|
pub fn name(&self) -> &Atom {
|
||||||
&self.name
|
&self.name
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn namespace<'a>(&'a self) -> &'a Namespace {
|
pub fn namespace(&self) -> &Namespace {
|
||||||
&self.namespace
|
&self.namespace
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn prefix<'a>(&'a self) -> &'a Option<Atom> {
|
pub fn prefix(&self) -> &Option<Atom> {
|
||||||
&self.prefix
|
&self.prefix
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ impl<T> DOMRefCell<T> {
|
||||||
///
|
///
|
||||||
/// For use in the layout task only.
|
/// For use in the layout task only.
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
pub unsafe fn borrow_for_layout<'a>(&'a self) -> &'a T {
|
pub unsafe fn borrow_for_layout(&self) -> &T {
|
||||||
debug_assert!(task_state::get().is_layout());
|
debug_assert!(task_state::get().is_layout());
|
||||||
&*self.value.as_unsafe_cell().get()
|
&*self.value.as_unsafe_cell().get()
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ impl<T> DOMRefCell<T> {
|
||||||
/// This succeeds even if the object is mutably borrowed,
|
/// This succeeds even if the object is mutably borrowed,
|
||||||
/// so you have to be careful in trace code!
|
/// so you have to be careful in trace code!
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
pub unsafe fn borrow_for_gc_trace<'a>(&'a self) -> &'a T {
|
pub unsafe fn borrow_for_gc_trace(&self) -> &T {
|
||||||
// FIXME: IN_GC isn't reliable enough - doesn't catch minor GCs
|
// FIXME: IN_GC isn't reliable enough - doesn't catch minor GCs
|
||||||
// https://github.com/servo/servo/issues/6389
|
// https://github.com/servo/servo/issues/6389
|
||||||
//debug_assert!(task_state::get().contains(SCRIPT | IN_GC));
|
//debug_assert!(task_state::get().contains(SCRIPT | IN_GC));
|
||||||
|
@ -49,7 +49,7 @@ impl<T> DOMRefCell<T> {
|
||||||
/// Borrow the contents for the purpose of script deallocation.
|
/// Borrow the contents for the purpose of script deallocation.
|
||||||
///
|
///
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
pub unsafe fn borrow_for_script_deallocation<'a>(&'a self) -> &'a mut T {
|
pub unsafe fn borrow_for_script_deallocation(&self) -> &mut T {
|
||||||
debug_assert!(task_state::get().contains(SCRIPT));
|
debug_assert!(task_state::get().contains(SCRIPT));
|
||||||
&mut *self.value.as_unsafe_cell().get()
|
&mut *self.value.as_unsafe_cell().get()
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ impl<T> DOMRefCell<T> {
|
||||||
/// # Panics
|
/// # Panics
|
||||||
///
|
///
|
||||||
/// Panics if this is called off the script thread.
|
/// Panics if this is called off the script thread.
|
||||||
pub fn try_borrow<'a>(&'a self) -> Option<Ref<'a, T>> {
|
pub fn try_borrow(&self) -> Option<Ref<T>> {
|
||||||
debug_assert!(task_state::get().is_script());
|
debug_assert!(task_state::get().is_script());
|
||||||
match self.value.borrow_state() {
|
match self.value.borrow_state() {
|
||||||
BorrowState::Writing => None,
|
BorrowState::Writing => None,
|
||||||
|
@ -89,7 +89,7 @@ impl<T> DOMRefCell<T> {
|
||||||
/// # Panics
|
/// # Panics
|
||||||
///
|
///
|
||||||
/// Panics if this is called off the script thread.
|
/// Panics if this is called off the script thread.
|
||||||
pub fn try_borrow_mut<'a>(&'a self) -> Option<RefMut<'a, T>> {
|
pub fn try_borrow_mut(&self) -> Option<RefMut<T>> {
|
||||||
debug_assert!(task_state::get().is_script());
|
debug_assert!(task_state::get().is_script());
|
||||||
match self.value.borrow_state() {
|
match self.value.borrow_state() {
|
||||||
BorrowState::Unused => Some(self.value.borrow_mut()),
|
BorrowState::Unused => Some(self.value.borrow_mut()),
|
||||||
|
@ -127,7 +127,7 @@ impl<T> DOMRefCell<T> {
|
||||||
/// Panics if this is called off the script thread.
|
/// Panics if this is called off the script thread.
|
||||||
///
|
///
|
||||||
/// Panics if the value is currently mutably borrowed.
|
/// Panics if the value is currently mutably borrowed.
|
||||||
pub fn borrow<'a>(&'a self) -> Ref<'a, T> {
|
pub fn borrow(&self) -> Ref<T> {
|
||||||
self.try_borrow().expect("DOMRefCell<T> already mutably borrowed")
|
self.try_borrow().expect("DOMRefCell<T> already mutably borrowed")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ impl<T> DOMRefCell<T> {
|
||||||
/// Panics if this is called off the script thread.
|
/// Panics if this is called off the script thread.
|
||||||
///
|
///
|
||||||
/// Panics if the value is currently borrowed.
|
/// Panics if the value is currently borrowed.
|
||||||
pub fn borrow_mut<'a>(&'a self) -> RefMut<'a, T> {
|
pub fn borrow_mut(&self) -> RefMut<T> {
|
||||||
self.try_borrow_mut().expect("DOMRefCell<T> already borrowed")
|
self.try_borrow_mut().expect("DOMRefCell<T> already borrowed")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@ impl LayoutJS<Node> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Reflectable> Reflectable for JS<T> {
|
impl<T: Reflectable> Reflectable for JS<T> {
|
||||||
fn reflector<'a>(&'a self) -> &'a Reflector {
|
fn reflector(&self) -> &Reflector {
|
||||||
unsafe {
|
unsafe {
|
||||||
(**self.ptr).reflector()
|
(**self.ptr).reflector()
|
||||||
}
|
}
|
||||||
|
@ -310,11 +310,11 @@ impl<T: Reflectable> LayoutJS<T> {
|
||||||
pub trait RootedReference<T> {
|
pub trait RootedReference<T> {
|
||||||
/// Obtain a safe optional reference to the wrapped JS owned-value that
|
/// Obtain a safe optional reference to the wrapped JS owned-value that
|
||||||
/// cannot outlive the lifetime of this root.
|
/// cannot outlive the lifetime of this root.
|
||||||
fn r<'a>(&'a self) -> Option<&'a T>;
|
fn r(&self) -> Option<&T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Reflectable> RootedReference<T> for Option<Root<T>> {
|
impl<T: Reflectable> RootedReference<T> for Option<Root<T>> {
|
||||||
fn r<'a>(&'a self) -> Option<&'a T> {
|
fn r(&self) -> Option<&T> {
|
||||||
self.as_ref().map(|root| root.r())
|
self.as_ref().map(|root| root.r())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -323,11 +323,11 @@ impl<T: Reflectable> RootedReference<T> for Option<Root<T>> {
|
||||||
pub trait OptionalRootedReference<T> {
|
pub trait OptionalRootedReference<T> {
|
||||||
/// Obtain a safe optional optional reference to the wrapped JS owned-value
|
/// Obtain a safe optional optional reference to the wrapped JS owned-value
|
||||||
/// that cannot outlive the lifetime of this root.
|
/// that cannot outlive the lifetime of this root.
|
||||||
fn r<'a>(&'a self) -> Option<Option<&'a T>>;
|
fn r(&self) -> Option<Option<&T>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Reflectable> OptionalRootedReference<T> for Option<Option<Root<T>>> {
|
impl<T: Reflectable> OptionalRootedReference<T> for Option<Option<Root<T>>> {
|
||||||
fn r<'a>(&'a self) -> Option<Option<&'a T>> {
|
fn r(&self) -> Option<Option<&T>> {
|
||||||
self.as_ref().map(|inner| inner.r())
|
self.as_ref().map(|inner| inner.r())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -430,7 +430,7 @@ impl<T: Reflectable> Root<T> {
|
||||||
|
|
||||||
/// Obtain a safe reference to the wrapped JS owned-value that cannot
|
/// Obtain a safe reference to the wrapped JS owned-value that cannot
|
||||||
/// outlive the lifetime of this root.
|
/// outlive the lifetime of this root.
|
||||||
pub fn r<'a>(&'a self) -> &'a T {
|
pub fn r(&self) -> &T {
|
||||||
&**self
|
&**self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,7 +443,7 @@ impl<T: Reflectable> Root<T> {
|
||||||
|
|
||||||
impl<T: Reflectable> Deref for Root<T> {
|
impl<T: Reflectable> Deref for Root<T> {
|
||||||
type Target = T;
|
type Target = T;
|
||||||
fn deref<'a>(&'a self) -> &'a T {
|
fn deref(&self) -> &T {
|
||||||
unsafe { &**self.ptr.deref() }
|
unsafe { &**self.ptr.deref() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ impl ByteString {
|
||||||
|
|
||||||
/// Returns `self` as a string, if it encodes valid UTF-8, and `None`
|
/// Returns `self` as a string, if it encodes valid UTF-8, and `None`
|
||||||
/// otherwise.
|
/// otherwise.
|
||||||
pub fn as_str<'a>(&'a self) -> Option<&'a str> {
|
pub fn as_str(&self) -> Option<&str> {
|
||||||
let ByteString(ref vec) = *self;
|
let ByteString(ref vec) = *self;
|
||||||
str::from_utf8(&vec).ok()
|
str::from_utf8(&vec).ok()
|
||||||
}
|
}
|
||||||
|
|
|
@ -404,7 +404,7 @@ pub fn initialize_global(global: *mut JSObject) {
|
||||||
/// A trait to provide access to the `Reflector` for a DOM object.
|
/// A trait to provide access to the `Reflector` for a DOM object.
|
||||||
pub trait Reflectable {
|
pub trait Reflectable {
|
||||||
/// Returns the receiver's reflector.
|
/// Returns the receiver's reflector.
|
||||||
fn reflector<'a>(&'a self) -> &'a Reflector;
|
fn reflector(&self) -> &Reflector;
|
||||||
/// Initializes the Reflector
|
/// Initializes the Reflector
|
||||||
fn init_reflector(&mut self, _obj: *mut JSObject) {
|
fn init_reflector(&mut self, _obj: *mut JSObject) {
|
||||||
panic!("Cannot call init on this Reflectable");
|
panic!("Cannot call init on this Reflectable");
|
||||||
|
|
|
@ -179,13 +179,13 @@ impl CharacterData {
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
pub trait LayoutCharacterDataHelpers {
|
pub trait LayoutCharacterDataHelpers {
|
||||||
unsafe fn data_for_layout<'a>(&'a self) -> &'a str;
|
unsafe fn data_for_layout(&self) -> &str;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
impl LayoutCharacterDataHelpers for LayoutJS<CharacterData> {
|
impl LayoutCharacterDataHelpers for LayoutJS<CharacterData> {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn data_for_layout<'a>(&'a self) -> &'a str {
|
unsafe fn data_for_layout(&self) -> &str {
|
||||||
&(*self.unsafe_get()).data.borrow_for_layout()
|
&(*self.unsafe_get()).data.borrow_for_layout()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,17 +58,17 @@ impl DocumentType {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn name<'a>(&'a self) -> &'a DOMString {
|
pub fn name(&self) -> &DOMString {
|
||||||
&self.name
|
&self.name
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn public_id<'a>(&'a self) -> &'a DOMString {
|
pub fn public_id(&self) -> &DOMString {
|
||||||
&self.public_id
|
&self.public_id
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn system_id<'a>(&'a self) -> &'a DOMString {
|
pub fn system_id(&self) -> &DOMString {
|
||||||
&self.system_id
|
&self.system_id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -494,8 +494,8 @@ pub trait LayoutElementHelpers {
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe fn has_attr_for_layout(&self, namespace: &Namespace, name: &Atom) -> bool;
|
unsafe fn has_attr_for_layout(&self, namespace: &Namespace, name: &Atom) -> bool;
|
||||||
fn style_attribute(&self) -> *const Option<PropertyDeclarationBlock>;
|
fn style_attribute(&self) -> *const Option<PropertyDeclarationBlock>;
|
||||||
fn local_name<'a>(&'a self) -> &'a Atom;
|
fn local_name(&self) -> &Atom;
|
||||||
fn namespace<'a>(&'a self) -> &'a Namespace;
|
fn namespace(&self) -> &Namespace;
|
||||||
fn get_checked_state_for_layout(&self) -> bool;
|
fn get_checked_state_for_layout(&self) -> bool;
|
||||||
fn get_indeterminate_state_for_layout(&self) -> bool;
|
fn get_indeterminate_state_for_layout(&self) -> bool;
|
||||||
}
|
}
|
||||||
|
@ -524,14 +524,14 @@ impl LayoutElementHelpers for LayoutJS<Element> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn local_name<'a>(&'a self) -> &'a Atom {
|
fn local_name(&self) -> &Atom {
|
||||||
unsafe {
|
unsafe {
|
||||||
&(*self.unsafe_get()).local_name
|
&(*self.unsafe_get()).local_name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn namespace<'a>(&'a self) -> &'a Namespace {
|
fn namespace(&self) -> &Namespace {
|
||||||
unsafe {
|
unsafe {
|
||||||
&(*self.unsafe_get()).namespace
|
&(*self.unsafe_get()).namespace
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ impl Event {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn type_id<'a>(&'a self) -> &'a EventTypeId {
|
pub fn type_id(&self) -> &EventTypeId {
|
||||||
&self.type_id
|
&self.type_id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ use dom::node::Node;
|
||||||
use dom::virtualmethods::vtable_for;
|
use dom::virtualmethods::vtable_for;
|
||||||
|
|
||||||
// See https://dom.spec.whatwg.org/#concept-event-dispatch for the full dispatch algorithm
|
// See https://dom.spec.whatwg.org/#concept-event-dispatch for the full dispatch algorithm
|
||||||
pub fn dispatch_event<'a, 'b>(target: &'a EventTarget,
|
pub fn dispatch_event<'b>(target: &EventTarget,
|
||||||
pseudo_target: Option<&'b EventTarget>,
|
pseudo_target: Option<&'b EventTarget>,
|
||||||
event: &Event) -> bool {
|
event: &Event) -> bool {
|
||||||
assert!(!event.dispatching());
|
assert!(!event.dispatching());
|
||||||
|
|
|
@ -160,7 +160,7 @@ impl EventTarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn type_id<'a>(&'a self) -> &'a EventTargetTypeId {
|
pub fn type_id(&self) -> &EventTargetTypeId {
|
||||||
&self.type_id
|
&self.type_id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ impl File {
|
||||||
FileBinding::Wrap)
|
FileBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name<'a>(&'a self) -> &'a DOMString {
|
pub fn name(&self) -> &DOMString {
|
||||||
&self.name
|
&self.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -356,7 +356,7 @@ fn broadcast_radio_checked(broadcaster: &HTMLInputElement, group: Option<&str>)
|
||||||
do_broadcast(doc_node, broadcaster, owner.r(), group)
|
do_broadcast(doc_node, broadcaster, owner.r(), group)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn in_same_group<'a,'b>(other: &'a HTMLInputElement,
|
fn in_same_group<'b>(other: &HTMLInputElement,
|
||||||
owner: Option<&'b HTMLFormElement>,
|
owner: Option<&'b HTMLFormElement>,
|
||||||
group: Option<&str>) -> bool {
|
group: Option<&str>) -> bool {
|
||||||
let other_owner = other.form_owner();
|
let other_owner = other.form_owner();
|
||||||
|
|
|
@ -36,7 +36,7 @@ impl HTMLMediaElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn htmlelement<'a>(&'a self) -> &'a HTMLElement {
|
pub fn htmlelement(&self) -> &HTMLElement {
|
||||||
&self.htmlelement
|
&self.htmlelement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue