diff --git a/components/layout/block.rs b/components/layout/block.rs index f87c837daf2..2eb7f76857f 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -38,6 +38,7 @@ use flow::{BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, ForceNonfloated use flow::{ImmutableFlowUtils, LateAbsolutePositionInfo, OpaqueFlow, FragmentationContext, FlowFlags}; use flow_list::FlowList; use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow, FragmentFlags}; +use gfx::display_list::DisplayListSection; use gfx_traits::print_tree::PrintTree; use incremental::RelayoutMode; use layout_debug; @@ -1794,6 +1795,23 @@ impl BlockFlow { as_margins.to_physical(writing_mode) } + pub fn background_border_section(&self) -> DisplayListSection { + if self.base.flags.is_float() { + DisplayListSection::BackgroundAndBorders + } else if self.base + .flags + .contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) + { + if self.fragment.establishes_stacking_context() { + DisplayListSection::BackgroundAndBorders + } else { + DisplayListSection::BlockBackgroundsAndBorders + } + } else { + DisplayListSection::BlockBackgroundsAndBorders + } + } + } impl Flow for BlockFlow { diff --git a/components/layout/display_list/builder.rs b/components/layout/display_list/builder.rs index eb5475f3d0a..a57a625097d 100644 --- a/components/layout/display_list/builder.rs +++ b/components/layout/display_list/builder.rs @@ -2863,20 +2863,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow { state: &mut DisplayListBuildState, border_painting_mode: BorderPaintingMode, ) { - let background_border_section = if self.base.flags.is_float() { - DisplayListSection::BackgroundAndBorders - } else if self.base - .flags - .contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) - { - if self.fragment.establishes_stacking_context() { - DisplayListSection::BackgroundAndBorders - } else { - DisplayListSection::BlockBackgroundsAndBorders - } - } else { - DisplayListSection::BlockBackgroundsAndBorders - }; + let background_border_section = self.background_border_section(); state.processing_scrolling_overflow_element = self.has_scrolling_overflow(); diff --git a/components/layout/table.rs b/components/layout/table.rs index 7faf638f295..daea0bd600e 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -996,8 +996,8 @@ impl<'table> Iterator for TableCellStyleIterator<'table> { let rowgroup_style = row_info.rowgroup.map(|r| r.style().get_background()); let row_style = row_info.row.style().get_background(); let cell = cell.as_mut_table_cell(); - let (col_style, colgroup_style) = if let Some(column_style) - = self.column_styles.get(self.column_index_relative as usize) { + let (col_style, colgroup_style) = if let Some(column_style) = + self.column_styles.get(self.column_index_relative as usize) { let styles = (column_style.col_style.clone(), column_style.colgroup_style.clone()); // FIXME incoming_rowspan let cell_span = cell.fragment().column_span(); @@ -1008,8 +1008,8 @@ impl<'table> Iterator for TableCellStyleIterator<'table> { // move to the next column self.column_index_relative += 1; self.column_index_relative_offset -= current_col.span; - if let Some(column_style) - = self.column_styles.get(self.column_index_relative as usize) { + if let Some(column_style) = + self.column_styles.get(self.column_index_relative as usize) { current_col = column_style; } else { break; @@ -1052,4 +1052,3 @@ impl<'table> Iterator for TableCellStyleIterator<'table> { self.next() } } -