mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Pass SharedStyleContext to compute_used_inline_size.
This commit is contained in:
parent
018bebe90d
commit
9731a001db
6 changed files with 25 additions and 20 deletions
|
@ -590,56 +590,56 @@ impl BlockFlow {
|
|||
|
||||
/// Compute the actual inline size and position for this block.
|
||||
pub fn compute_used_inline_size(&mut self,
|
||||
layout_context: &LayoutContext,
|
||||
shared_context: &SharedStyleContext,
|
||||
containing_block_inline_size: Au) {
|
||||
let block_type = self.block_type();
|
||||
match block_type {
|
||||
BlockType::AbsoluteReplaced => {
|
||||
let inline_size_computer = AbsoluteReplaced;
|
||||
inline_size_computer.compute_used_inline_size(self,
|
||||
layout_context,
|
||||
shared_context,
|
||||
containing_block_inline_size);
|
||||
}
|
||||
BlockType::AbsoluteNonReplaced => {
|
||||
let inline_size_computer = AbsoluteNonReplaced;
|
||||
inline_size_computer.compute_used_inline_size(self,
|
||||
layout_context,
|
||||
shared_context,
|
||||
containing_block_inline_size);
|
||||
}
|
||||
BlockType::FloatReplaced => {
|
||||
let inline_size_computer = FloatReplaced;
|
||||
inline_size_computer.compute_used_inline_size(self,
|
||||
layout_context,
|
||||
shared_context,
|
||||
containing_block_inline_size);
|
||||
}
|
||||
BlockType::FloatNonReplaced => {
|
||||
let inline_size_computer = FloatNonReplaced;
|
||||
inline_size_computer.compute_used_inline_size(self,
|
||||
layout_context,
|
||||
shared_context,
|
||||
containing_block_inline_size);
|
||||
}
|
||||
BlockType::InlineBlockReplaced => {
|
||||
let inline_size_computer = InlineBlockReplaced;
|
||||
inline_size_computer.compute_used_inline_size(self,
|
||||
layout_context,
|
||||
shared_context,
|
||||
containing_block_inline_size);
|
||||
}
|
||||
BlockType::InlineBlockNonReplaced => {
|
||||
let inline_size_computer = InlineBlockNonReplaced;
|
||||
inline_size_computer.compute_used_inline_size(self,
|
||||
layout_context,
|
||||
shared_context,
|
||||
containing_block_inline_size);
|
||||
}
|
||||
BlockType::Replaced => {
|
||||
let inline_size_computer = BlockReplaced;
|
||||
inline_size_computer.compute_used_inline_size(self,
|
||||
layout_context,
|
||||
shared_context,
|
||||
containing_block_inline_size);
|
||||
}
|
||||
BlockType::NonReplaced => {
|
||||
let inline_size_computer = BlockNonReplaced;
|
||||
inline_size_computer.compute_used_inline_size(self,
|
||||
layout_context,
|
||||
shared_context,
|
||||
containing_block_inline_size);
|
||||
}
|
||||
}
|
||||
|
@ -1297,7 +1297,7 @@ impl BlockFlow {
|
|||
/// This is run in the `AssignISizes` traversal.
|
||||
fn propagate_and_compute_used_inline_size(&mut self, layout_context: &LayoutContext) {
|
||||
let containing_block_inline_size = self.base.block_container_inline_size;
|
||||
self.compute_used_inline_size(layout_context, containing_block_inline_size);
|
||||
self.compute_used_inline_size(layout_context.shared_context(), containing_block_inline_size);
|
||||
if self.base.flags.is_float() {
|
||||
self.float.as_mut().unwrap().containing_inline_size = containing_block_inline_size
|
||||
}
|
||||
|
@ -2403,14 +2403,14 @@ pub trait ISizeAndMarginsComputer {
|
|||
/// CSS Section 10.4: Minimum and Maximum inline-sizes
|
||||
fn compute_used_inline_size(&self,
|
||||
block: &mut BlockFlow,
|
||||
layout_context: &LayoutContext,
|
||||
shared_context: &SharedStyleContext,
|
||||
parent_flow_inline_size: Au) {
|
||||
let mut input = self.compute_inline_size_constraint_inputs(block,
|
||||
parent_flow_inline_size,
|
||||
layout_context.shared_context());
|
||||
shared_context);
|
||||
|
||||
let containing_block_inline_size =
|
||||
self.containing_block_inline_size(block, parent_flow_inline_size, layout_context.shared_context());
|
||||
self.containing_block_inline_size(block, parent_flow_inline_size, shared_context);
|
||||
|
||||
let mut solution = self.solve_inline_size_constraints(block, &input);
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ use script_layout_interface::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW};
|
|||
use std::cmp::max;
|
||||
use std::sync::Arc;
|
||||
use style::computed_values::flex_direction;
|
||||
use style::context::StyleContext;
|
||||
use style::logical_geometry::LogicalSize;
|
||||
use style::properties::{ComputedValues, ServoComputedValues};
|
||||
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
|
||||
|
@ -413,7 +414,7 @@ impl Flow for FlexFlow {
|
|||
// Our inline-size was set to the inline-size of the containing block by the flow's parent.
|
||||
// Now compute the real value.
|
||||
let containing_block_inline_size = self.block_flow.base.block_container_inline_size;
|
||||
self.block_flow.compute_used_inline_size(layout_context, containing_block_inline_size);
|
||||
self.block_flow.compute_used_inline_size(layout_context.shared_context(), containing_block_inline_size);
|
||||
if self.block_flow.base.flags.is_float() {
|
||||
self.block_flow.float.as_mut().unwrap().containing_inline_size = containing_block_inline_size
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ use style::computed_values::{border_collapse, border_spacing, table_layout};
|
|||
use style::context::StyleContext;
|
||||
use style::logical_geometry::LogicalSize;
|
||||
use style::properties::{ComputedValues, ServoComputedValues};
|
||||
use style::servo::SharedStyleContext;
|
||||
use style::values::CSSFloat;
|
||||
use style::values::computed::LengthOrPercentageOrAuto;
|
||||
use table_row::TableRowFlow;
|
||||
|
@ -348,7 +349,7 @@ impl Flow for TableFlow {
|
|||
border_collapse: self.block_flow.fragment.style.get_inheritedtable().border_collapse,
|
||||
};
|
||||
inline_size_computer.compute_used_inline_size(&mut self.block_flow,
|
||||
layout_context,
|
||||
layout_context.shared_context(),
|
||||
containing_block_inline_size);
|
||||
|
||||
let inline_start_content_edge = self.block_flow.fragment.border_padding.inline_start;
|
||||
|
@ -518,11 +519,11 @@ impl ISizeAndMarginsComputer for InternalTable {
|
|||
/// CSS Section 10.4: Minimum and Maximum inline-sizes
|
||||
fn compute_used_inline_size(&self,
|
||||
block: &mut BlockFlow,
|
||||
layout_context: &LayoutContext,
|
||||
shared_context: &SharedStyleContext,
|
||||
parent_flow_inline_size: Au) {
|
||||
let mut input = self.compute_inline_size_constraint_inputs(block,
|
||||
parent_flow_inline_size,
|
||||
layout_context.shared_context());
|
||||
shared_context);
|
||||
|
||||
// Tables are always at least as wide as their minimum inline size.
|
||||
let minimum_inline_size =
|
||||
|
|
|
@ -23,6 +23,7 @@ use script_layout_interface::wrapper_traits::ThreadSafeLayoutNode;
|
|||
use std::fmt;
|
||||
use std::sync::Arc;
|
||||
use style::computed_values::{border_collapse, border_top_style, vertical_align};
|
||||
use style::context::StyleContext;
|
||||
use style::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::{ComputedValues, ServoComputedValues};
|
||||
use table::InternalTable;
|
||||
|
@ -174,7 +175,7 @@ impl Flow for TableCellFlow {
|
|||
border_collapse: self.block_flow.fragment.style.get_inheritedtable().border_collapse,
|
||||
};
|
||||
inline_size_computer.compute_used_inline_size(&mut self.block_flow,
|
||||
layout_context,
|
||||
layout_context.shared_context(),
|
||||
containing_block_inline_size);
|
||||
|
||||
let inline_start_content_edge =
|
||||
|
|
|
@ -25,6 +25,7 @@ use std::fmt;
|
|||
use std::iter::{Enumerate, IntoIterator, Peekable};
|
||||
use std::sync::Arc;
|
||||
use style::computed_values::{border_collapse, border_spacing, border_top_style};
|
||||
use style::context::StyleContext;
|
||||
use style::logical_geometry::{LogicalSize, PhysicalSide, WritingMode};
|
||||
use style::properties::{ComputedValues, ServoComputedValues};
|
||||
use style::values::computed::LengthOrPercentageOrAuto;
|
||||
|
@ -327,7 +328,7 @@ impl Flow for TableRowFlow {
|
|||
border_collapse: self.block_flow.fragment.style.get_inheritedtable().border_collapse,
|
||||
};
|
||||
inline_size_computer.compute_used_inline_size(&mut self.block_flow,
|
||||
layout_context,
|
||||
layout_context.shared_context(),
|
||||
containing_block_inline_size);
|
||||
|
||||
// Spread out the completed inline sizes among columns with spans > 1.
|
||||
|
|
|
@ -21,6 +21,7 @@ use std::fmt;
|
|||
use std::iter::{IntoIterator, Iterator, Peekable};
|
||||
use std::sync::Arc;
|
||||
use style::computed_values::{border_collapse, border_spacing};
|
||||
use style::context::StyleContext;
|
||||
use style::logical_geometry::{LogicalSize, WritingMode};
|
||||
use style::properties::{ComputedValues, ServoComputedValues};
|
||||
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, TableLikeFlow};
|
||||
|
@ -154,7 +155,7 @@ impl Flow for TableRowGroupFlow {
|
|||
border_collapse: border_collapse,
|
||||
};
|
||||
inline_size_computer.compute_used_inline_size(&mut self.block_flow,
|
||||
layout_context,
|
||||
layout_context.shared_context(),
|
||||
containing_block_inline_size);
|
||||
|
||||
let column_computed_inline_sizes = &self.column_computed_inline_sizes;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue