Rename compute_absolute_position to compute_stacking_relative_position

This commit is contained in:
Matt Brubeck 2017-08-07 16:08:01 -07:00
parent 1f0e42e8fe
commit a08bc13df9
14 changed files with 30 additions and 29 deletions

View file

@ -1944,7 +1944,7 @@ impl Flow for BlockFlow {
}
}
fn compute_absolute_position(&mut self, _layout_context: &LayoutContext) {
fn compute_stacking_relative_position(&mut self, _layout_context: &LayoutContext) {
// FIXME (mbrubeck): Get the real container size, taking the container writing mode into
// account. Must handle vertical writing modes.
let container_size = Size2D::new(self.base.block_container_inline_size, Au(0));

View file

@ -949,8 +949,8 @@ impl Flow for FlexFlow {
}
}
fn compute_absolute_position(&mut self, layout_context: &LayoutContext) {
self.block_flow.compute_absolute_position(layout_context)
fn compute_stacking_relative_position(&mut self, layout_context: &LayoutContext) {
self.block_flow.compute_stacking_relative_position(layout_context)
}
fn place_float_if_applicable<'a>(&mut self) {

View file

@ -339,8 +339,9 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
mut_base(self).overflow = overflow
}
/// Phase 4 of reflow: computes absolute positions.
fn compute_absolute_position(&mut self, _: &LayoutContext) {
/// Phase 4 of reflow: Compute the stacking-relative position (origin of the content box,
/// in coordinates relative to the nearest ancestor stacking context).
fn compute_stacking_relative_position(&mut self, _: &LayoutContext) {
// The default implementation is a no-op.
mut_base(self).restyle_damage.remove(REPOSITION)
}

View file

@ -1534,7 +1534,7 @@ impl Flow for InlineFlow {
}
}
fn compute_absolute_position(&mut self, _: &LayoutContext) {
fn compute_stacking_relative_position(&mut self, _: &LayoutContext) {
// First, gather up the positions of all the containing blocks (if any).
//
// FIXME(pcwalton): This will get the absolute containing blocks inside `...` wrong in the

View file

@ -119,8 +119,8 @@ impl Flow for ListItemFlow {
}
}
fn compute_absolute_position(&mut self, layout_context: &LayoutContext) {
self.block_flow.compute_absolute_position(layout_context)
fn compute_stacking_relative_position(&mut self, layout_context: &LayoutContext) {
self.block_flow.compute_stacking_relative_position(layout_context)
}
fn place_float_if_applicable<'a>(&mut self) {

View file

@ -166,8 +166,8 @@ impl Flow for MulticolFlow {
}
}
fn compute_absolute_position(&mut self, layout_context: &LayoutContext) {
self.block_flow.compute_absolute_position(layout_context);
fn compute_stacking_relative_position(&mut self, layout_context: &LayoutContext) {
self.block_flow.compute_stacking_relative_position(layout_context);
let pitch = LogicalSize::new(self.block_flow.base.writing_mode, self.column_pitch, Au(0));
let pitch = pitch.to_physical(self.block_flow.base.writing_mode);
for (i, child) in self.block_flow.base.children.iter_mut().enumerate() {
@ -254,8 +254,8 @@ impl Flow for MulticolColumnFlow {
Flow::fragment(&mut self.block_flow, layout_context, fragmentation_context)
}
fn compute_absolute_position(&mut self, layout_context: &LayoutContext) {
self.block_flow.compute_absolute_position(layout_context)
fn compute_stacking_relative_position(&mut self, layout_context: &LayoutContext) {
self.block_flow.compute_stacking_relative_position(layout_context)
}
fn update_late_computed_inline_position_if_necessary(&mut self, inline_position: Au) {

View file

@ -473,8 +473,8 @@ impl Flow for TableFlow {
self.block_flow.assign_block_size_for_table_like_flow(vertical_spacing)
}
fn compute_absolute_position(&mut self, layout_context: &LayoutContext) {
self.block_flow.compute_absolute_position(layout_context)
fn compute_stacking_relative_position(&mut self, layout_context: &LayoutContext) {
self.block_flow.compute_stacking_relative_position(layout_context)
}
fn generated_containing_block_size(&self, flow: OpaqueFlow) -> LogicalSize<Au> {

View file

@ -62,8 +62,8 @@ impl Flow for TableCaptionFlow {
self.block_flow.assign_block_size(layout_context);
}
fn compute_absolute_position(&mut self, layout_context: &LayoutContext) {
self.block_flow.compute_absolute_position(layout_context)
fn compute_stacking_relative_position(&mut self, layout_context: &LayoutContext) {
self.block_flow.compute_stacking_relative_position(layout_context)
}
fn update_late_computed_inline_position_if_necessary(&mut self, inline_position: Au) {

View file

@ -230,8 +230,8 @@ impl Flow for TableCellFlow {
self.assign_block_size_table_cell_base(layout_context);
}
fn compute_absolute_position(&mut self, layout_context: &LayoutContext) {
self.block_flow.compute_absolute_position(layout_context)
fn compute_stacking_relative_position(&mut self, layout_context: &LayoutContext) {
self.block_flow.compute_stacking_relative_position(layout_context)
}
fn update_late_computed_inline_position_if_necessary(&mut self, inline_position: Au) {

View file

@ -452,8 +452,8 @@ impl Flow for TableRowFlow {
self.assign_block_size_table_row_base(layout_context);
}
fn compute_absolute_position(&mut self, layout_context: &LayoutContext) {
self.block_flow.compute_absolute_position(layout_context)
fn compute_stacking_relative_position(&mut self, layout_context: &LayoutContext) {
self.block_flow.compute_stacking_relative_position(layout_context)
}
fn update_late_computed_inline_position_if_necessary(&mut self, inline_position: Au) {

View file

@ -165,8 +165,8 @@ impl Flow for TableRowGroupFlow {
self.block_flow.assign_block_size_for_table_like_flow(self.spacing.vertical.0)
}
fn compute_absolute_position(&mut self, layout_context: &LayoutContext) {
self.block_flow.compute_absolute_position(layout_context)
fn compute_stacking_relative_position(&mut self, layout_context: &LayoutContext) {
self.block_flow.compute_stacking_relative_position(layout_context)
}
fn update_late_computed_inline_position_if_necessary(&mut self, inline_position: Au) {

View file

@ -428,8 +428,8 @@ impl Flow for TableWrapperFlow {
debug_assert!(remaining.is_none());
}
fn compute_absolute_position(&mut self, layout_context: &LayoutContext) {
self.block_flow.compute_absolute_position(layout_context)
fn compute_stacking_relative_position(&mut self, layout_context: &LayoutContext) {
self.block_flow.compute_stacking_relative_position(layout_context)
}
fn place_float_if_applicable<'a>(&mut self) {

View file

@ -201,14 +201,14 @@ impl<'a> PostorderFlowTraversal for AssignBSizes<'a> {
}
#[derive(Copy, Clone)]
pub struct ComputeAbsolutePositions<'a> {
pub struct ComputeStackingRelativePositions<'a> {
pub layout_context: &'a LayoutContext<'a>,
}
impl<'a> PreorderFlowTraversal for ComputeAbsolutePositions<'a> {
impl<'a> PreorderFlowTraversal for ComputeStackingRelativePositions<'a> {
#[inline]
fn process(&self, flow: &mut Flow) {
flow.compute_absolute_position(self.layout_context);
flow.compute_stacking_relative_position(self.layout_context);
}
}

View file

@ -82,7 +82,7 @@ use layout::query::{process_margin_style_query, process_node_overflow_request, p
use layout::query::{process_node_geometry_request, process_node_scroll_area_request};
use layout::query::{process_node_scroll_root_id_request, process_offset_parent_query};
use layout::sequential;
use layout::traversal::{ComputeAbsolutePositions, RecalcStyleAndConstructFlows};
use layout::traversal::{ComputeStackingRelativePositions, RecalcStyleAndConstructFlows};
use layout::webrender_helpers::WebRenderDisplayListConverter;
use layout::wrapper::LayoutNodeLayoutData;
use layout_traits::LayoutThreadFactory;
@ -975,7 +975,7 @@ impl LayoutThread {
flow::mut_base(layout_root).clip = data.page_clip_rect;
if flow::base(layout_root).restyle_damage.contains(REPOSITION) {
layout_root.traverse_preorder(&ComputeAbsolutePositions {
layout_root.traverse_preorder(&ComputeStackingRelativePositions {
layout_context: layout_context
});
}