Factor out BlockFlow::background_border_section()

This commit is contained in:
Manish Goregaokar 2018-02-14 12:47:31 -08:00
parent 836e59e5b6
commit f3531d1d35
3 changed files with 23 additions and 19 deletions

View file

@ -38,6 +38,7 @@ use flow::{BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, ForceNonfloated
use flow::{ImmutableFlowUtils, LateAbsolutePositionInfo, OpaqueFlow, FragmentationContext, FlowFlags}; use flow::{ImmutableFlowUtils, LateAbsolutePositionInfo, OpaqueFlow, FragmentationContext, FlowFlags};
use flow_list::FlowList; use flow_list::FlowList;
use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow, FragmentFlags}; use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow, FragmentFlags};
use gfx::display_list::DisplayListSection;
use gfx_traits::print_tree::PrintTree; use gfx_traits::print_tree::PrintTree;
use incremental::RelayoutMode; use incremental::RelayoutMode;
use layout_debug; use layout_debug;
@ -1794,6 +1795,23 @@ impl BlockFlow {
as_margins.to_physical(writing_mode) 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 { impl Flow for BlockFlow {

View file

@ -2863,20 +2863,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
state: &mut DisplayListBuildState, state: &mut DisplayListBuildState,
border_painting_mode: BorderPaintingMode, border_painting_mode: BorderPaintingMode,
) { ) {
let background_border_section = if self.base.flags.is_float() { let background_border_section = self.background_border_section();
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
};
state.processing_scrolling_overflow_element = self.has_scrolling_overflow(); state.processing_scrolling_overflow_element = self.has_scrolling_overflow();

View file

@ -996,8 +996,8 @@ impl<'table> Iterator for TableCellStyleIterator<'table> {
let rowgroup_style = row_info.rowgroup.map(|r| r.style().get_background()); let rowgroup_style = row_info.rowgroup.map(|r| r.style().get_background());
let row_style = row_info.row.style().get_background(); let row_style = row_info.row.style().get_background();
let cell = cell.as_mut_table_cell(); let cell = cell.as_mut_table_cell();
let (col_style, colgroup_style) = if let Some(column_style) let (col_style, colgroup_style) = if let Some(column_style) =
= self.column_styles.get(self.column_index_relative as usize) { self.column_styles.get(self.column_index_relative as usize) {
let styles = (column_style.col_style.clone(), column_style.colgroup_style.clone()); let styles = (column_style.col_style.clone(), column_style.colgroup_style.clone());
// FIXME incoming_rowspan // FIXME incoming_rowspan
let cell_span = cell.fragment().column_span(); let cell_span = cell.fragment().column_span();
@ -1008,8 +1008,8 @@ impl<'table> Iterator for TableCellStyleIterator<'table> {
// move to the next column // move to the next column
self.column_index_relative += 1; self.column_index_relative += 1;
self.column_index_relative_offset -= current_col.span; self.column_index_relative_offset -= current_col.span;
if let Some(column_style) if let Some(column_style) =
= self.column_styles.get(self.column_index_relative as usize) { self.column_styles.get(self.column_index_relative as usize) {
current_col = column_style; current_col = column_style;
} else { } else {
break; break;
@ -1052,4 +1052,3 @@ impl<'table> Iterator for TableCellStyleIterator<'table> {
self.next() self.next()
} }
} }