mirror of
https://github.com/servo/servo.git
synced 2025-07-12 18:03:49 +01:00
Pass SharedLayoutContext to Flow::compute_absolute_position.
This commit is contained in:
parent
05e9a9ac86
commit
871c207c44
13 changed files with 29 additions and 29 deletions
|
@ -28,7 +28,7 @@
|
|||
#![deny(unsafe_code)]
|
||||
|
||||
use app_units::{Au, MAX_AU};
|
||||
use context::LayoutContext;
|
||||
use context::{LayoutContext, SharedLayoutContext};
|
||||
use display_list_builder::BlockFlowDisplayListBuilding;
|
||||
use display_list_builder::{BorderPaintingMode, DisplayListBuildState, FragmentDisplayListBuilding};
|
||||
use euclid::{Point2D, Rect, Size2D};
|
||||
|
@ -1834,7 +1834,7 @@ impl Flow for BlockFlow {
|
|||
}
|
||||
}
|
||||
|
||||
fn compute_absolute_position(&mut self, layout_context: &LayoutContext) {
|
||||
fn compute_absolute_position(&mut self, layout_context: &SharedLayoutContext) {
|
||||
if self.base.flags.contains(NEEDS_LAYER) {
|
||||
self.fragment.flags.insert(HAS_LAYER)
|
||||
}
|
||||
|
@ -1969,12 +1969,12 @@ impl Flow for BlockFlow {
|
|||
let stacking_relative_position_of_display_port_for_children =
|
||||
if is_stacking_context || self.is_root() {
|
||||
let visible_rect =
|
||||
match layout_context.shared.visible_rects.get(&self.layer_id()) {
|
||||
match layout_context.visible_rects.get(&self.layer_id()) {
|
||||
Some(visible_rect) => *visible_rect,
|
||||
None => Rect::new(Point2D::zero(), layout_context.shared_context().viewport_size),
|
||||
None => Rect::new(Point2D::zero(), layout_context.style_context.viewport_size),
|
||||
};
|
||||
|
||||
let viewport_size = layout_context.shared_context().viewport_size;
|
||||
let viewport_size = layout_context.style_context.viewport_size;
|
||||
visible_rect.inflate(viewport_size.width * DISPLAY_PORT_SIZE_FACTOR,
|
||||
viewport_size.height * DISPLAY_PORT_SIZE_FACTOR)
|
||||
} else if is_stacking_context {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
use app_units::{Au, MAX_AU};
|
||||
use block::BlockFlow;
|
||||
use context::LayoutContext;
|
||||
use context::{LayoutContext, SharedLayoutContext};
|
||||
use display_list_builder::{DisplayListBuildState, FlexFlowDisplayListBuilding};
|
||||
use euclid::Point2D;
|
||||
use floats::FloatKind;
|
||||
|
@ -920,7 +920,7 @@ impl Flow for FlexFlow {
|
|||
}
|
||||
}
|
||||
|
||||
fn compute_absolute_position(&mut self, layout_context: &LayoutContext) {
|
||||
fn compute_absolute_position(&mut self, layout_context: &SharedLayoutContext) {
|
||||
self.block_flow.compute_absolute_position(layout_context)
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
use app_units::Au;
|
||||
use block::{BlockFlow, FormattingContextType};
|
||||
use context::LayoutContext;
|
||||
use context::{LayoutContext, SharedLayoutContext};
|
||||
use display_list_builder::DisplayListBuildState;
|
||||
use euclid::{Point2D, Rect, Size2D};
|
||||
use floats::{Floats, SpeculatedFloatPlacement};
|
||||
|
@ -318,7 +318,7 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
|
|||
}
|
||||
|
||||
/// Phase 4 of reflow: computes absolute positions.
|
||||
fn compute_absolute_position(&mut self, _: &LayoutContext) {
|
||||
fn compute_absolute_position(&mut self, _: &SharedLayoutContext) {
|
||||
// The default implementation is a no-op.
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
use app_units::Au;
|
||||
use block::AbsoluteAssignBSizesTraversal;
|
||||
use context::LayoutContext;
|
||||
use context::{LayoutContext, SharedLayoutContext};
|
||||
use display_list_builder::DisplayListBuildState;
|
||||
use display_list_builder::{FragmentDisplayListBuilding, InlineFlowDisplayListBuilding};
|
||||
use euclid::{Point2D, Size2D};
|
||||
|
@ -1532,7 +1532,7 @@ impl Flow for InlineFlow {
|
|||
}
|
||||
}
|
||||
|
||||
fn compute_absolute_position(&mut self, _: &LayoutContext) {
|
||||
fn compute_absolute_position(&mut self, _: &SharedLayoutContext) {
|
||||
// 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
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
use app_units::Au;
|
||||
use block::BlockFlow;
|
||||
use context::LayoutContext;
|
||||
use context::{LayoutContext, SharedLayoutContext};
|
||||
use display_list_builder::{DisplayListBuildState, ListItemFlowDisplayListBuilding};
|
||||
use euclid::Point2D;
|
||||
use floats::FloatKind;
|
||||
|
@ -124,7 +124,7 @@ impl Flow for ListItemFlow {
|
|||
}
|
||||
}
|
||||
|
||||
fn compute_absolute_position(&mut self, layout_context: &LayoutContext) {
|
||||
fn compute_absolute_position(&mut self, layout_context: &SharedLayoutContext) {
|
||||
self.block_flow.compute_absolute_position(layout_context)
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
use app_units::Au;
|
||||
use block::BlockFlow;
|
||||
use context::LayoutContext;
|
||||
use context::{LayoutContext, SharedLayoutContext};
|
||||
use display_list_builder::DisplayListBuildState;
|
||||
use euclid::Point2D;
|
||||
use euclid::Size2D;
|
||||
|
@ -163,7 +163,7 @@ impl Flow for MulticolFlow {
|
|||
}
|
||||
}
|
||||
|
||||
fn compute_absolute_position(&mut self, layout_context: &LayoutContext) {
|
||||
fn compute_absolute_position(&mut self, layout_context: &SharedLayoutContext) {
|
||||
self.block_flow.compute_absolute_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);
|
||||
|
@ -254,7 +254,7 @@ impl Flow for MulticolColumnFlow {
|
|||
Flow::fragment(&mut self.block_flow, layout_context, fragmentation_context)
|
||||
}
|
||||
|
||||
fn compute_absolute_position(&mut self, layout_context: &LayoutContext) {
|
||||
fn compute_absolute_position(&mut self, layout_context: &SharedLayoutContext) {
|
||||
self.block_flow.compute_absolute_position(layout_context)
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
use app_units::Au;
|
||||
use block::{BlockFlow, CandidateBSizeIterator, ISizeAndMarginsComputer};
|
||||
use block::{ISizeConstraintInput, ISizeConstraintSolution};
|
||||
use context::LayoutContext;
|
||||
use context::{LayoutContext, SharedLayoutContext};
|
||||
use display_list_builder::{BlockFlowDisplayListBuilding, BorderPaintingMode, DisplayListBuildState};
|
||||
use euclid::Point2D;
|
||||
use flow;
|
||||
|
@ -434,7 +434,7 @@ 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) {
|
||||
fn compute_absolute_position(&mut self, layout_context: &SharedLayoutContext) {
|
||||
self.block_flow.compute_absolute_position(layout_context)
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
use app_units::Au;
|
||||
use block::BlockFlow;
|
||||
use context::LayoutContext;
|
||||
use context::{LayoutContext, SharedLayoutContext};
|
||||
use display_list_builder::DisplayListBuildState;
|
||||
use euclid::Point2D;
|
||||
use flow::{Flow, FlowClass, OpaqueFlow};
|
||||
|
@ -66,7 +66,7 @@ impl Flow for TableCaptionFlow {
|
|||
self.block_flow.assign_block_size(layout_context);
|
||||
}
|
||||
|
||||
fn compute_absolute_position(&mut self, layout_context: &LayoutContext) {
|
||||
fn compute_absolute_position(&mut self, layout_context: &SharedLayoutContext) {
|
||||
self.block_flow.compute_absolute_position(layout_context)
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
use app_units::Au;
|
||||
use block::{BlockFlow, ISizeAndMarginsComputer, MarginsMayCollapseFlag};
|
||||
use context::LayoutContext;
|
||||
use context::{LayoutContext, SharedLayoutContext};
|
||||
use cssparser::Color;
|
||||
use display_list_builder::{BlockFlowDisplayListBuilding, BorderPaintingMode, DisplayListBuildState};
|
||||
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
||||
|
@ -208,7 +208,7 @@ impl Flow for TableCellFlow {
|
|||
self.assign_block_size_table_cell_base(layout_context);
|
||||
}
|
||||
|
||||
fn compute_absolute_position(&mut self, layout_context: &LayoutContext) {
|
||||
fn compute_absolute_position(&mut self, layout_context: &SharedLayoutContext) {
|
||||
self.block_flow.compute_absolute_position(layout_context)
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
use app_units::Au;
|
||||
use block::{BlockFlow, ISizeAndMarginsComputer};
|
||||
use context::LayoutContext;
|
||||
use context::{LayoutContext, SharedLayoutContext};
|
||||
use cssparser::{Color, RGBA};
|
||||
use display_list_builder::{BlockFlowDisplayListBuilding, BorderPaintingMode, DisplayListBuildState};
|
||||
use euclid::Point2D;
|
||||
|
@ -413,7 +413,7 @@ impl Flow for TableRowFlow {
|
|||
self.assign_block_size_table_row_base(layout_context);
|
||||
}
|
||||
|
||||
fn compute_absolute_position(&mut self, layout_context: &LayoutContext) {
|
||||
fn compute_absolute_position(&mut self, layout_context: &SharedLayoutContext) {
|
||||
self.block_flow.compute_absolute_position(layout_context)
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
use app_units::Au;
|
||||
use block::{BlockFlow, ISizeAndMarginsComputer};
|
||||
use context::LayoutContext;
|
||||
use context::{LayoutContext, SharedLayoutContext};
|
||||
use display_list_builder::DisplayListBuildState;
|
||||
use euclid::Point2D;
|
||||
use flow::{Flow, FlowClass, OpaqueFlow};
|
||||
|
@ -195,7 +195,7 @@ impl Flow for TableRowGroupFlow {
|
|||
self.block_flow.assign_block_size_for_table_like_flow(self.spacing.vertical)
|
||||
}
|
||||
|
||||
fn compute_absolute_position(&mut self, layout_context: &LayoutContext) {
|
||||
fn compute_absolute_position(&mut self, layout_context: &SharedLayoutContext) {
|
||||
self.block_flow.compute_absolute_position(layout_context)
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
use app_units::Au;
|
||||
use block::{AbsoluteNonReplaced, BlockFlow, FloatNonReplaced, ISizeAndMarginsComputer, ISizeConstraintInput};
|
||||
use block::{ISizeConstraintSolution, MarginsMayCollapseFlag};
|
||||
use context::LayoutContext;
|
||||
use context::{LayoutContext, SharedLayoutContext};
|
||||
use display_list_builder::DisplayListBuildState;
|
||||
use euclid::Point2D;
|
||||
use floats::FloatKind;
|
||||
|
@ -413,7 +413,7 @@ impl Flow for TableWrapperFlow {
|
|||
debug_assert!(remaining.is_none());
|
||||
}
|
||||
|
||||
fn compute_absolute_position(&mut self, layout_context: &LayoutContext) {
|
||||
fn compute_absolute_position(&mut self, layout_context: &SharedLayoutContext) {
|
||||
self.block_flow.compute_absolute_position(layout_context)
|
||||
}
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ pub struct ComputeAbsolutePositions<'a> {
|
|||
impl<'a> PreorderFlowTraversal for ComputeAbsolutePositions<'a> {
|
||||
#[inline]
|
||||
fn process(&self, flow: &mut Flow) {
|
||||
flow.compute_absolute_position(self.layout_context);
|
||||
flow.compute_absolute_position(self.layout_context.shared);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue