mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #11822 - Ms2ger:sharedcontext, r=nox
Avoid creating a LayoutContext in parallel::assign_inline_sizes. <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11822) <!-- Reviewable:end -->
This commit is contained in:
commit
44b0bddf41
16 changed files with 127 additions and 112 deletions
|
@ -58,6 +58,7 @@ use style::computed_values::{position, text_align, transform, transform_style};
|
||||||
use style::context::StyleContext;
|
use style::context::StyleContext;
|
||||||
use style::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMode};
|
use style::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMode};
|
||||||
use style::properties::{ComputedValues, ServoComputedValues};
|
use style::properties::{ComputedValues, ServoComputedValues};
|
||||||
|
use style::servo::SharedStyleContext;
|
||||||
use style::values::computed::{LengthOrNone, LengthOrPercentageOrNone};
|
use style::values::computed::{LengthOrNone, LengthOrPercentageOrNone};
|
||||||
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto};
|
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto};
|
||||||
use util::geometry::MAX_RECT;
|
use util::geometry::MAX_RECT;
|
||||||
|
@ -451,7 +452,7 @@ fn translate_including_floats(cur_b: &mut Au, delta: Au, floats: &mut Floats) {
|
||||||
///
|
///
|
||||||
/// Note that flows with position 'fixed' just form a flat list as they all
|
/// Note that flows with position 'fixed' just form a flat list as they all
|
||||||
/// have the Root flow as their CB.
|
/// have the Root flow as their CB.
|
||||||
pub struct AbsoluteAssignBSizesTraversal<'a>(pub &'a LayoutContext<'a>);
|
pub struct AbsoluteAssignBSizesTraversal<'a>(pub &'a SharedStyleContext);
|
||||||
|
|
||||||
impl<'a> PreorderFlowTraversal for AbsoluteAssignBSizesTraversal<'a> {
|
impl<'a> PreorderFlowTraversal for AbsoluteAssignBSizesTraversal<'a> {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -474,7 +475,7 @@ impl<'a> PreorderFlowTraversal for AbsoluteAssignBSizesTraversal<'a> {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
block.calculate_absolute_block_size_and_margins(&self.0);
|
block.calculate_absolute_block_size_and_margins(self.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -589,56 +590,56 @@ impl BlockFlow {
|
||||||
|
|
||||||
/// Compute the actual inline size and position for this block.
|
/// Compute the actual inline size and position for this block.
|
||||||
pub fn compute_used_inline_size(&mut self,
|
pub fn compute_used_inline_size(&mut self,
|
||||||
layout_context: &LayoutContext,
|
shared_context: &SharedStyleContext,
|
||||||
containing_block_inline_size: Au) {
|
containing_block_inline_size: Au) {
|
||||||
let block_type = self.block_type();
|
let block_type = self.block_type();
|
||||||
match block_type {
|
match block_type {
|
||||||
BlockType::AbsoluteReplaced => {
|
BlockType::AbsoluteReplaced => {
|
||||||
let inline_size_computer = AbsoluteReplaced;
|
let inline_size_computer = AbsoluteReplaced;
|
||||||
inline_size_computer.compute_used_inline_size(self,
|
inline_size_computer.compute_used_inline_size(self,
|
||||||
layout_context,
|
shared_context,
|
||||||
containing_block_inline_size);
|
containing_block_inline_size);
|
||||||
}
|
}
|
||||||
BlockType::AbsoluteNonReplaced => {
|
BlockType::AbsoluteNonReplaced => {
|
||||||
let inline_size_computer = AbsoluteNonReplaced;
|
let inline_size_computer = AbsoluteNonReplaced;
|
||||||
inline_size_computer.compute_used_inline_size(self,
|
inline_size_computer.compute_used_inline_size(self,
|
||||||
layout_context,
|
shared_context,
|
||||||
containing_block_inline_size);
|
containing_block_inline_size);
|
||||||
}
|
}
|
||||||
BlockType::FloatReplaced => {
|
BlockType::FloatReplaced => {
|
||||||
let inline_size_computer = FloatReplaced;
|
let inline_size_computer = FloatReplaced;
|
||||||
inline_size_computer.compute_used_inline_size(self,
|
inline_size_computer.compute_used_inline_size(self,
|
||||||
layout_context,
|
shared_context,
|
||||||
containing_block_inline_size);
|
containing_block_inline_size);
|
||||||
}
|
}
|
||||||
BlockType::FloatNonReplaced => {
|
BlockType::FloatNonReplaced => {
|
||||||
let inline_size_computer = FloatNonReplaced;
|
let inline_size_computer = FloatNonReplaced;
|
||||||
inline_size_computer.compute_used_inline_size(self,
|
inline_size_computer.compute_used_inline_size(self,
|
||||||
layout_context,
|
shared_context,
|
||||||
containing_block_inline_size);
|
containing_block_inline_size);
|
||||||
}
|
}
|
||||||
BlockType::InlineBlockReplaced => {
|
BlockType::InlineBlockReplaced => {
|
||||||
let inline_size_computer = InlineBlockReplaced;
|
let inline_size_computer = InlineBlockReplaced;
|
||||||
inline_size_computer.compute_used_inline_size(self,
|
inline_size_computer.compute_used_inline_size(self,
|
||||||
layout_context,
|
shared_context,
|
||||||
containing_block_inline_size);
|
containing_block_inline_size);
|
||||||
}
|
}
|
||||||
BlockType::InlineBlockNonReplaced => {
|
BlockType::InlineBlockNonReplaced => {
|
||||||
let inline_size_computer = InlineBlockNonReplaced;
|
let inline_size_computer = InlineBlockNonReplaced;
|
||||||
inline_size_computer.compute_used_inline_size(self,
|
inline_size_computer.compute_used_inline_size(self,
|
||||||
layout_context,
|
shared_context,
|
||||||
containing_block_inline_size);
|
containing_block_inline_size);
|
||||||
}
|
}
|
||||||
BlockType::Replaced => {
|
BlockType::Replaced => {
|
||||||
let inline_size_computer = BlockReplaced;
|
let inline_size_computer = BlockReplaced;
|
||||||
inline_size_computer.compute_used_inline_size(self,
|
inline_size_computer.compute_used_inline_size(self,
|
||||||
layout_context,
|
shared_context,
|
||||||
containing_block_inline_size);
|
containing_block_inline_size);
|
||||||
}
|
}
|
||||||
BlockType::NonReplaced => {
|
BlockType::NonReplaced => {
|
||||||
let inline_size_computer = BlockNonReplaced;
|
let inline_size_computer = BlockNonReplaced;
|
||||||
inline_size_computer.compute_used_inline_size(self,
|
inline_size_computer.compute_used_inline_size(self,
|
||||||
layout_context,
|
shared_context,
|
||||||
containing_block_inline_size);
|
containing_block_inline_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -696,8 +697,8 @@ impl BlockFlow {
|
||||||
///
|
///
|
||||||
/// TODO(#2017, pcwalton): This is somewhat inefficient (traverses kids twice); can we do
|
/// TODO(#2017, pcwalton): This is somewhat inefficient (traverses kids twice); can we do
|
||||||
/// better?
|
/// better?
|
||||||
fn adjust_fragments_for_collapsed_margins_if_root<'a>(&mut self,
|
fn adjust_fragments_for_collapsed_margins_if_root(&mut self,
|
||||||
layout_context: &'a LayoutContext<'a>) {
|
shared_context: &SharedStyleContext) {
|
||||||
if !self.is_root() {
|
if !self.is_root() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -727,7 +728,7 @@ impl BlockFlow {
|
||||||
// infrastructure to make it scrollable.
|
// infrastructure to make it scrollable.
|
||||||
let viewport_size =
|
let viewport_size =
|
||||||
LogicalSize::from_physical(self.fragment.style.writing_mode,
|
LogicalSize::from_physical(self.fragment.style.writing_mode,
|
||||||
layout_context.shared_context().viewport_size);
|
shared_context.viewport_size);
|
||||||
let block_size = max(viewport_size.block,
|
let block_size = max(viewport_size.block,
|
||||||
self.fragment.border_box.size.block + block_start_margin_value +
|
self.fragment.border_box.size.block + block_start_margin_value +
|
||||||
block_end_margin_value);
|
block_end_margin_value);
|
||||||
|
@ -1030,7 +1031,7 @@ impl BlockFlow {
|
||||||
self.fragment.inline_start_offset(),
|
self.fragment.inline_start_offset(),
|
||||||
Au(0)));
|
Au(0)));
|
||||||
self.base.floats = floats.clone();
|
self.base.floats = floats.clone();
|
||||||
self.adjust_fragments_for_collapsed_margins_if_root(layout_context);
|
self.adjust_fragments_for_collapsed_margins_if_root(layout_context.shared_context());
|
||||||
} else {
|
} else {
|
||||||
// We don't need to reflow, but we still need to perform in-order traversals if
|
// We don't need to reflow, but we still need to perform in-order traversals if
|
||||||
// necessary.
|
// necessary.
|
||||||
|
@ -1045,7 +1046,7 @@ impl BlockFlow {
|
||||||
// This is preorder because the block-size of an absolute flow may depend on
|
// This is preorder because the block-size of an absolute flow may depend on
|
||||||
// the block-size of its containing block, which may also be an absolute flow.
|
// the block-size of its containing block, which may also be an absolute flow.
|
||||||
(&mut *self as &mut Flow).traverse_preorder_absolute_flows(
|
(&mut *self as &mut Flow).traverse_preorder_absolute_flows(
|
||||||
&mut AbsoluteAssignBSizesTraversal(layout_context));
|
&mut AbsoluteAssignBSizesTraversal(layout_context.shared_context()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't remove the dirty bits yet if we're absolutely-positioned, since our final size
|
// Don't remove the dirty bits yet if we're absolutely-positioned, since our final size
|
||||||
|
@ -1135,14 +1136,14 @@ impl BlockFlow {
|
||||||
self.base.position.size);
|
self.base.position.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn explicit_block_containing_size(&self, layout_context: &LayoutContext) -> Option<Au> {
|
pub fn explicit_block_containing_size(&self, shared_context: &SharedStyleContext) -> Option<Au> {
|
||||||
if self.is_root() || self.is_fixed() {
|
if self.is_root() || self.is_fixed() {
|
||||||
let viewport_size = LogicalSize::from_physical(self.fragment.style.writing_mode,
|
let viewport_size = LogicalSize::from_physical(self.fragment.style.writing_mode,
|
||||||
layout_context.shared_context().viewport_size);
|
shared_context.viewport_size);
|
||||||
Some(viewport_size.block)
|
Some(viewport_size.block)
|
||||||
} else if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) &&
|
} else if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) &&
|
||||||
self.base.block_container_explicit_block_size.is_none() {
|
self.base.block_container_explicit_block_size.is_none() {
|
||||||
self.base.absolute_cb.explicit_block_containing_size(layout_context)
|
self.base.absolute_cb.explicit_block_containing_size(shared_context)
|
||||||
} else {
|
} else {
|
||||||
self.base.block_container_explicit_block_size
|
self.base.block_container_explicit_block_size
|
||||||
}
|
}
|
||||||
|
@ -1201,10 +1202,10 @@ impl BlockFlow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn calculate_absolute_block_size_and_margins(&mut self, layout_context: &LayoutContext) {
|
fn calculate_absolute_block_size_and_margins(&mut self, shared_context: &SharedStyleContext) {
|
||||||
let opaque_self = OpaqueFlow::from_flow(self);
|
let opaque_self = OpaqueFlow::from_flow(self);
|
||||||
let containing_block_block_size =
|
let containing_block_block_size =
|
||||||
self.containing_block_size(&layout_context.shared_context().viewport_size, opaque_self).block;
|
self.containing_block_size(&shared_context.viewport_size, opaque_self).block;
|
||||||
|
|
||||||
// This is the stored content block-size value from assign-block-size
|
// This is the stored content block-size value from assign-block-size
|
||||||
let content_block_size = self.fragment.border_box.size.block;
|
let content_block_size = self.fragment.border_box.size.block;
|
||||||
|
@ -1294,9 +1295,9 @@ impl BlockFlow {
|
||||||
/// Compute inline size based using the `block_container_inline_size` set by the parent flow.
|
/// Compute inline size based using the `block_container_inline_size` set by the parent flow.
|
||||||
///
|
///
|
||||||
/// This is run in the `AssignISizes` traversal.
|
/// This is run in the `AssignISizes` traversal.
|
||||||
fn propagate_and_compute_used_inline_size(&mut self, layout_context: &LayoutContext) {
|
fn propagate_and_compute_used_inline_size(&mut self, shared_context: &SharedStyleContext) {
|
||||||
let containing_block_inline_size = self.base.block_container_inline_size;
|
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(shared_context, containing_block_inline_size);
|
||||||
if self.base.flags.is_float() {
|
if self.base.flags.is_float() {
|
||||||
self.float.as_mut().unwrap().containing_inline_size = containing_block_inline_size
|
self.float.as_mut().unwrap().containing_inline_size = containing_block_inline_size
|
||||||
}
|
}
|
||||||
|
@ -1310,7 +1311,7 @@ impl BlockFlow {
|
||||||
/// and the code for block layout is significantly simpler.
|
/// and the code for block layout is significantly simpler.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn propagate_assigned_inline_size_to_children<F>(&mut self,
|
pub fn propagate_assigned_inline_size_to_children<F>(&mut self,
|
||||||
layout_context: &LayoutContext,
|
shared_context: &SharedStyleContext,
|
||||||
inline_start_content_edge: Au,
|
inline_start_content_edge: Au,
|
||||||
inline_end_content_edge: Au,
|
inline_end_content_edge: Au,
|
||||||
content_inline_size: Au,
|
content_inline_size: Au,
|
||||||
|
@ -1330,7 +1331,7 @@ impl BlockFlow {
|
||||||
box_sizing::T::border_box => self.fragment.border_padding.block_start_end(),
|
box_sizing::T::border_box => self.fragment.border_padding.block_start_end(),
|
||||||
box_sizing::T::content_box => Au(0),
|
box_sizing::T::content_box => Au(0),
|
||||||
};
|
};
|
||||||
let parent_container_size = self.explicit_block_containing_size(layout_context);
|
let parent_container_size = self.explicit_block_containing_size(shared_context);
|
||||||
// https://drafts.csswg.org/css-ui-3/#box-sizing
|
// https://drafts.csswg.org/css-ui-3/#box-sizing
|
||||||
let explicit_content_size = self
|
let explicit_content_size = self
|
||||||
.explicit_block_size(parent_container_size)
|
.explicit_block_size(parent_container_size)
|
||||||
|
@ -1338,7 +1339,7 @@ impl BlockFlow {
|
||||||
|
|
||||||
// Calculate containing block inline size.
|
// Calculate containing block inline size.
|
||||||
let containing_block_size = if flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
let containing_block_size = if flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||||
self.containing_block_size(&layout_context.shared_context().viewport_size, opaque_self).inline
|
self.containing_block_size(&shared_context.viewport_size, opaque_self).inline
|
||||||
} else {
|
} else {
|
||||||
content_inline_size
|
content_inline_size
|
||||||
};
|
};
|
||||||
|
@ -1615,7 +1616,7 @@ impl BlockFlow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn compute_inline_sizes(&mut self, layout_context: &LayoutContext) {
|
pub fn compute_inline_sizes(&mut self, shared_context: &SharedStyleContext) {
|
||||||
if !self.base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) {
|
if !self.base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1633,13 +1634,13 @@ impl BlockFlow {
|
||||||
debug!("Setting root position");
|
debug!("Setting root position");
|
||||||
self.base.position.start = LogicalPoint::zero(self.base.writing_mode);
|
self.base.position.start = LogicalPoint::zero(self.base.writing_mode);
|
||||||
self.base.block_container_inline_size = LogicalSize::from_physical(
|
self.base.block_container_inline_size = LogicalSize::from_physical(
|
||||||
self.base.writing_mode, layout_context.shared_context().viewport_size).inline;
|
self.base.writing_mode, shared_context.viewport_size).inline;
|
||||||
self.base.block_container_writing_mode = self.base.writing_mode;
|
self.base.block_container_writing_mode = self.base.writing_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Our inline-size was set to the inline-size of the containing block by the flow's parent.
|
// Our inline-size was set to the inline-size of the containing block by the flow's parent.
|
||||||
// Now compute the real value.
|
// Now compute the real value.
|
||||||
self.propagate_and_compute_used_inline_size(layout_context);
|
self.propagate_and_compute_used_inline_size(shared_context);
|
||||||
|
|
||||||
// Now for some speculation.
|
// Now for some speculation.
|
||||||
match self.formatting_context_type() {
|
match self.formatting_context_type() {
|
||||||
|
@ -1718,10 +1719,10 @@ impl Flow for BlockFlow {
|
||||||
///
|
///
|
||||||
/// Dual fragments consume some inline-size first, and the remainder is assigned to all child
|
/// Dual fragments consume some inline-size first, and the remainder is assigned to all child
|
||||||
/// (block) contexts.
|
/// (block) contexts.
|
||||||
fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) {
|
fn assign_inline_sizes(&mut self, shared_context: &SharedStyleContext) {
|
||||||
let _scope = layout_debug_scope!("block::assign_inline_sizes {:x}", self.base.debug_id());
|
let _scope = layout_debug_scope!("block::assign_inline_sizes {:x}", self.base.debug_id());
|
||||||
|
|
||||||
self.compute_inline_sizes(layout_context);
|
self.compute_inline_sizes(shared_context);
|
||||||
|
|
||||||
// Move in from the inline-start border edge.
|
// Move in from the inline-start border edge.
|
||||||
let inline_start_content_edge = self.fragment.border_box.start.i +
|
let inline_start_content_edge = self.fragment.border_box.start.i +
|
||||||
|
@ -1736,7 +1737,7 @@ impl Flow for BlockFlow {
|
||||||
|
|
||||||
let content_inline_size = self.fragment.border_box.size.inline - padding_and_borders;
|
let content_inline_size = self.fragment.border_box.size.inline - padding_and_borders;
|
||||||
|
|
||||||
self.propagate_assigned_inline_size_to_children(layout_context,
|
self.propagate_assigned_inline_size_to_children(shared_context,
|
||||||
inline_start_content_edge,
|
inline_start_content_edge,
|
||||||
inline_end_content_edge,
|
inline_end_content_edge,
|
||||||
content_inline_size,
|
content_inline_size,
|
||||||
|
@ -2275,10 +2276,10 @@ pub trait ISizeAndMarginsComputer {
|
||||||
fn compute_inline_size_constraint_inputs(&self,
|
fn compute_inline_size_constraint_inputs(&self,
|
||||||
block: &mut BlockFlow,
|
block: &mut BlockFlow,
|
||||||
parent_flow_inline_size: Au,
|
parent_flow_inline_size: Au,
|
||||||
layout_context: &LayoutContext)
|
shared_context: &SharedStyleContext)
|
||||||
-> ISizeConstraintInput {
|
-> ISizeConstraintInput {
|
||||||
let containing_block_inline_size =
|
let containing_block_inline_size =
|
||||||
self.containing_block_inline_size(block, parent_flow_inline_size, layout_context);
|
self.containing_block_inline_size(block, parent_flow_inline_size, shared_context);
|
||||||
|
|
||||||
block.fragment.compute_block_direction_margins(containing_block_inline_size);
|
block.fragment.compute_block_direction_margins(containing_block_inline_size);
|
||||||
block.fragment.compute_inline_direction_margins(containing_block_inline_size);
|
block.fragment.compute_inline_direction_margins(containing_block_inline_size);
|
||||||
|
@ -2286,7 +2287,7 @@ pub trait ISizeAndMarginsComputer {
|
||||||
|
|
||||||
let mut computed_inline_size = self.initial_computed_inline_size(block,
|
let mut computed_inline_size = self.initial_computed_inline_size(block,
|
||||||
parent_flow_inline_size,
|
parent_flow_inline_size,
|
||||||
layout_context);
|
shared_context);
|
||||||
let style = block.fragment.style();
|
let style = block.fragment.style();
|
||||||
match (computed_inline_size, style.get_position().box_sizing) {
|
match (computed_inline_size, style.get_position().box_sizing) {
|
||||||
(MaybeAuto::Specified(size), box_sizing::T::border_box) => {
|
(MaybeAuto::Specified(size), box_sizing::T::border_box) => {
|
||||||
|
@ -2381,18 +2382,18 @@ pub trait ISizeAndMarginsComputer {
|
||||||
fn initial_computed_inline_size(&self,
|
fn initial_computed_inline_size(&self,
|
||||||
block: &mut BlockFlow,
|
block: &mut BlockFlow,
|
||||||
parent_flow_inline_size: Au,
|
parent_flow_inline_size: Au,
|
||||||
layout_context: &LayoutContext)
|
shared_context: &SharedStyleContext)
|
||||||
-> MaybeAuto {
|
-> MaybeAuto {
|
||||||
MaybeAuto::from_style(block.fragment().style().content_inline_size(),
|
MaybeAuto::from_style(block.fragment().style().content_inline_size(),
|
||||||
self.containing_block_inline_size(block,
|
self.containing_block_inline_size(block,
|
||||||
parent_flow_inline_size,
|
parent_flow_inline_size,
|
||||||
layout_context))
|
shared_context))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn containing_block_inline_size(&self,
|
fn containing_block_inline_size(&self,
|
||||||
_: &mut BlockFlow,
|
_: &mut BlockFlow,
|
||||||
parent_flow_inline_size: Au,
|
parent_flow_inline_size: Au,
|
||||||
_: &LayoutContext)
|
_: &SharedStyleContext)
|
||||||
-> Au {
|
-> Au {
|
||||||
parent_flow_inline_size
|
parent_flow_inline_size
|
||||||
}
|
}
|
||||||
|
@ -2402,14 +2403,14 @@ pub trait ISizeAndMarginsComputer {
|
||||||
/// CSS Section 10.4: Minimum and Maximum inline-sizes
|
/// CSS Section 10.4: Minimum and Maximum inline-sizes
|
||||||
fn compute_used_inline_size(&self,
|
fn compute_used_inline_size(&self,
|
||||||
block: &mut BlockFlow,
|
block: &mut BlockFlow,
|
||||||
layout_context: &LayoutContext,
|
shared_context: &SharedStyleContext,
|
||||||
parent_flow_inline_size: Au) {
|
parent_flow_inline_size: Au) {
|
||||||
let mut input = self.compute_inline_size_constraint_inputs(block,
|
let mut input = self.compute_inline_size_constraint_inputs(block,
|
||||||
parent_flow_inline_size,
|
parent_flow_inline_size,
|
||||||
layout_context);
|
shared_context);
|
||||||
|
|
||||||
let containing_block_inline_size =
|
let containing_block_inline_size =
|
||||||
self.containing_block_inline_size(block, parent_flow_inline_size, layout_context);
|
self.containing_block_inline_size(block, parent_flow_inline_size, shared_context);
|
||||||
|
|
||||||
let mut solution = self.solve_inline_size_constraints(block, &input);
|
let mut solution = self.solve_inline_size_constraints(block, &input);
|
||||||
|
|
||||||
|
@ -2727,10 +2728,10 @@ impl ISizeAndMarginsComputer for AbsoluteNonReplaced {
|
||||||
fn containing_block_inline_size(&self,
|
fn containing_block_inline_size(&self,
|
||||||
block: &mut BlockFlow,
|
block: &mut BlockFlow,
|
||||||
_: Au,
|
_: Au,
|
||||||
layout_context: &LayoutContext)
|
shared_context: &SharedStyleContext)
|
||||||
-> Au {
|
-> Au {
|
||||||
let opaque_block = OpaqueFlow::from_flow(block);
|
let opaque_block = OpaqueFlow::from_flow(block);
|
||||||
block.containing_block_size(&layout_context.shared_context().viewport_size, opaque_block).inline
|
block.containing_block_size(&shared_context.viewport_size, opaque_block).inline
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_inline_position_of_flow_if_necessary(&self,
|
fn set_inline_position_of_flow_if_necessary(&self,
|
||||||
|
@ -2838,12 +2839,12 @@ impl ISizeAndMarginsComputer for AbsoluteReplaced {
|
||||||
fn initial_computed_inline_size(&self,
|
fn initial_computed_inline_size(&self,
|
||||||
block: &mut BlockFlow,
|
block: &mut BlockFlow,
|
||||||
_: Au,
|
_: Au,
|
||||||
layout_context: &LayoutContext)
|
shared_context: &SharedStyleContext)
|
||||||
-> MaybeAuto {
|
-> MaybeAuto {
|
||||||
let opaque_block = OpaqueFlow::from_flow(block);
|
let opaque_block = OpaqueFlow::from_flow(block);
|
||||||
let containing_block_inline_size =
|
let containing_block_inline_size =
|
||||||
block.containing_block_size(&layout_context.shared_context().viewport_size, opaque_block).inline;
|
block.containing_block_size(&shared_context.viewport_size, opaque_block).inline;
|
||||||
let container_block_size = block.explicit_block_containing_size(layout_context);
|
let container_block_size = block.explicit_block_containing_size(shared_context);
|
||||||
let fragment = block.fragment();
|
let fragment = block.fragment();
|
||||||
fragment.assign_replaced_inline_size_if_necessary(containing_block_inline_size, container_block_size);
|
fragment.assign_replaced_inline_size_if_necessary(containing_block_inline_size, container_block_size);
|
||||||
// For replaced absolute flow, the rest of the constraint solving will
|
// For replaced absolute flow, the rest of the constraint solving will
|
||||||
|
@ -2854,10 +2855,10 @@ impl ISizeAndMarginsComputer for AbsoluteReplaced {
|
||||||
fn containing_block_inline_size(&self,
|
fn containing_block_inline_size(&self,
|
||||||
block: &mut BlockFlow,
|
block: &mut BlockFlow,
|
||||||
_: Au,
|
_: Au,
|
||||||
layout_context: &LayoutContext)
|
shared_context: &SharedStyleContext)
|
||||||
-> Au {
|
-> Au {
|
||||||
let opaque_block = OpaqueFlow::from_flow(block);
|
let opaque_block = OpaqueFlow::from_flow(block);
|
||||||
block.containing_block_size(&layout_context.shared_context().viewport_size, opaque_block).inline
|
block.containing_block_size(&shared_context.viewport_size, opaque_block).inline
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_inline_position_of_flow_if_necessary(&self,
|
fn set_inline_position_of_flow_if_necessary(&self,
|
||||||
|
@ -2900,9 +2901,9 @@ impl ISizeAndMarginsComputer for BlockReplaced {
|
||||||
fn initial_computed_inline_size(&self,
|
fn initial_computed_inline_size(&self,
|
||||||
block: &mut BlockFlow,
|
block: &mut BlockFlow,
|
||||||
parent_flow_inline_size: Au,
|
parent_flow_inline_size: Au,
|
||||||
layout_context: &LayoutContext)
|
shared_context: &SharedStyleContext)
|
||||||
-> MaybeAuto {
|
-> MaybeAuto {
|
||||||
let container_block_size = block.explicit_block_containing_size(layout_context);
|
let container_block_size = block.explicit_block_containing_size(shared_context);
|
||||||
let fragment = block.fragment();
|
let fragment = block.fragment();
|
||||||
fragment.assign_replaced_inline_size_if_necessary(parent_flow_inline_size, container_block_size);
|
fragment.assign_replaced_inline_size_if_necessary(parent_flow_inline_size, container_block_size);
|
||||||
// For replaced block flow, the rest of the constraint solving will
|
// For replaced block flow, the rest of the constraint solving will
|
||||||
|
@ -2958,9 +2959,9 @@ impl ISizeAndMarginsComputer for FloatReplaced {
|
||||||
fn initial_computed_inline_size(&self,
|
fn initial_computed_inline_size(&self,
|
||||||
block: &mut BlockFlow,
|
block: &mut BlockFlow,
|
||||||
parent_flow_inline_size: Au,
|
parent_flow_inline_size: Au,
|
||||||
layout_context: &LayoutContext)
|
shared_context: &SharedStyleContext)
|
||||||
-> MaybeAuto {
|
-> MaybeAuto {
|
||||||
let container_block_size = block.explicit_block_containing_size(layout_context);
|
let container_block_size = block.explicit_block_containing_size(shared_context);
|
||||||
let fragment = block.fragment();
|
let fragment = block.fragment();
|
||||||
fragment.assign_replaced_inline_size_if_necessary(parent_flow_inline_size, container_block_size);
|
fragment.assign_replaced_inline_size_if_necessary(parent_flow_inline_size, container_block_size);
|
||||||
// For replaced block flow, the rest of the constraint solving will
|
// For replaced block flow, the rest of the constraint solving will
|
||||||
|
@ -3046,9 +3047,9 @@ impl ISizeAndMarginsComputer for InlineBlockReplaced {
|
||||||
fn initial_computed_inline_size(&self,
|
fn initial_computed_inline_size(&self,
|
||||||
block: &mut BlockFlow,
|
block: &mut BlockFlow,
|
||||||
parent_flow_inline_size: Au,
|
parent_flow_inline_size: Au,
|
||||||
layout_context: &LayoutContext)
|
shared_context: &SharedStyleContext)
|
||||||
-> MaybeAuto {
|
-> MaybeAuto {
|
||||||
let container_block_size = block.explicit_block_containing_size(layout_context);
|
let container_block_size = block.explicit_block_containing_size(shared_context);
|
||||||
let fragment = block.fragment();
|
let fragment = block.fragment();
|
||||||
fragment.assign_replaced_inline_size_if_necessary(parent_flow_inline_size, container_block_size);
|
fragment.assign_replaced_inline_size_if_necessary(parent_flow_inline_size, container_block_size);
|
||||||
// For replaced block flow, the rest of the constraint solving will
|
// For replaced block flow, the rest of the constraint solving will
|
||||||
|
|
|
@ -27,6 +27,7 @@ use std::sync::Arc;
|
||||||
use style::computed_values::flex_direction;
|
use style::computed_values::flex_direction;
|
||||||
use style::logical_geometry::LogicalSize;
|
use style::logical_geometry::LogicalSize;
|
||||||
use style::properties::{ComputedValues, ServoComputedValues};
|
use style::properties::{ComputedValues, ServoComputedValues};
|
||||||
|
use style::servo::SharedStyleContext;
|
||||||
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
|
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
|
||||||
|
|
||||||
/// The size of an axis. May be a specified size, a min/max
|
/// The size of an axis. May be a specified size, a min/max
|
||||||
|
@ -184,7 +185,7 @@ impl FlexFlow {
|
||||||
// Currently, this is the core of BlockFlow::propagate_assigned_inline_size_to_children() with
|
// Currently, this is the core of BlockFlow::propagate_assigned_inline_size_to_children() with
|
||||||
// all float and table logic stripped out.
|
// all float and table logic stripped out.
|
||||||
fn block_mode_assign_inline_sizes(&mut self,
|
fn block_mode_assign_inline_sizes(&mut self,
|
||||||
_layout_context: &LayoutContext,
|
_shared_context: &SharedStyleContext,
|
||||||
inline_start_content_edge: Au,
|
inline_start_content_edge: Au,
|
||||||
inline_end_content_edge: Au,
|
inline_end_content_edge: Au,
|
||||||
content_inline_size: Au) {
|
content_inline_size: Au) {
|
||||||
|
@ -229,7 +230,7 @@ impl FlexFlow {
|
||||||
// Currently, this is the core of InlineFlow::propagate_assigned_inline_size_to_children() with
|
// Currently, this is the core of InlineFlow::propagate_assigned_inline_size_to_children() with
|
||||||
// fragment logic stripped out.
|
// fragment logic stripped out.
|
||||||
fn inline_mode_assign_inline_sizes(&mut self,
|
fn inline_mode_assign_inline_sizes(&mut self,
|
||||||
_layout_context: &LayoutContext,
|
_shared_context: &SharedStyleContext,
|
||||||
inline_start_content_edge: Au,
|
inline_start_content_edge: Au,
|
||||||
_inline_end_content_edge: Au,
|
_inline_end_content_edge: Au,
|
||||||
content_inline_size: Au) {
|
content_inline_size: Au) {
|
||||||
|
@ -402,7 +403,7 @@ impl Flow for FlexFlow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) {
|
fn assign_inline_sizes(&mut self, shared_context: &SharedStyleContext) {
|
||||||
let _scope = layout_debug_scope!("flex::assign_inline_sizes {:x}", self.block_flow.base.debug_id());
|
let _scope = layout_debug_scope!("flex::assign_inline_sizes {:x}", self.block_flow.base.debug_id());
|
||||||
debug!("assign_inline_sizes");
|
debug!("assign_inline_sizes");
|
||||||
|
|
||||||
|
@ -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.
|
// Our inline-size was set to the inline-size of the containing block by the flow's parent.
|
||||||
// Now compute the real value.
|
// Now compute the real value.
|
||||||
let containing_block_inline_size = self.block_flow.base.block_container_inline_size;
|
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(shared_context, containing_block_inline_size);
|
||||||
if self.block_flow.base.flags.is_float() {
|
if self.block_flow.base.flags.is_float() {
|
||||||
self.block_flow.float.as_mut().unwrap().containing_inline_size = containing_block_inline_size
|
self.block_flow.float.as_mut().unwrap().containing_inline_size = containing_block_inline_size
|
||||||
}
|
}
|
||||||
|
@ -460,7 +461,7 @@ impl Flow for FlexFlow {
|
||||||
Mode::Inline => {
|
Mode::Inline => {
|
||||||
self.available_main_size = available_inline_size;
|
self.available_main_size = available_inline_size;
|
||||||
self.available_cross_size = available_block_size;
|
self.available_cross_size = available_block_size;
|
||||||
self.inline_mode_assign_inline_sizes(layout_context,
|
self.inline_mode_assign_inline_sizes(shared_context,
|
||||||
inline_start_content_edge,
|
inline_start_content_edge,
|
||||||
inline_end_content_edge,
|
inline_end_content_edge,
|
||||||
content_inline_size)
|
content_inline_size)
|
||||||
|
@ -468,7 +469,7 @@ impl Flow for FlexFlow {
|
||||||
Mode::Block => {
|
Mode::Block => {
|
||||||
self.available_main_size = available_block_size;
|
self.available_main_size = available_block_size;
|
||||||
self.available_cross_size = available_inline_size;
|
self.available_cross_size = available_inline_size;
|
||||||
self.block_mode_assign_inline_sizes(layout_context,
|
self.block_mode_assign_inline_sizes(shared_context,
|
||||||
inline_start_content_edge,
|
inline_start_content_edge,
|
||||||
inline_end_content_edge,
|
inline_end_content_edge,
|
||||||
content_inline_size)
|
content_inline_size)
|
||||||
|
|
|
@ -52,6 +52,7 @@ use style::computed_values::{clear, display, empty_cells, float, position, overf
|
||||||
use style::dom::TRestyleDamage;
|
use style::dom::TRestyleDamage;
|
||||||
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
||||||
use style::properties::{self, ComputedValues, ServoComputedValues};
|
use style::properties::{self, ComputedValues, ServoComputedValues};
|
||||||
|
use style::servo::SharedStyleContext;
|
||||||
use style::values::computed::LengthOrPercentageOrAuto;
|
use style::values::computed::LengthOrPercentageOrAuto;
|
||||||
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, TableFlow};
|
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, TableFlow};
|
||||||
use table_caption::TableCaptionFlow;
|
use table_caption::TableCaptionFlow;
|
||||||
|
@ -193,7 +194,7 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Pass 2 of reflow: computes inline-size.
|
/// Pass 2 of reflow: computes inline-size.
|
||||||
fn assign_inline_sizes(&mut self, _ctx: &LayoutContext) {
|
fn assign_inline_sizes(&mut self, _shared_context: &SharedStyleContext) {
|
||||||
panic!("assign_inline_sizes not yet implemented")
|
panic!("assign_inline_sizes not yet implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1560,7 +1561,7 @@ impl ContainingBlockLink {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn explicit_block_containing_size(&self, layout_context: &LayoutContext) -> Option<Au> {
|
pub fn explicit_block_containing_size(&self, shared_context: &SharedStyleContext) -> Option<Au> {
|
||||||
match self.link {
|
match self.link {
|
||||||
None => {
|
None => {
|
||||||
panic!("Link to containing block not established; perhaps you forgot to call \
|
panic!("Link to containing block not established; perhaps you forgot to call \
|
||||||
|
@ -1569,7 +1570,7 @@ impl ContainingBlockLink {
|
||||||
Some(ref link) => {
|
Some(ref link) => {
|
||||||
let flow = link.upgrade().unwrap();
|
let flow = link.upgrade().unwrap();
|
||||||
if flow.is_block_like() {
|
if flow.is_block_like() {
|
||||||
flow.as_block().explicit_block_containing_size(layout_context)
|
flow.as_block().explicit_block_containing_size(shared_context)
|
||||||
} else if flow.is_inline_flow() {
|
} else if flow.is_inline_flow() {
|
||||||
Some(flow.as_inline().minimum_block_size_above_baseline)
|
Some(flow.as_inline().minimum_block_size_above_baseline)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -33,8 +33,10 @@ use std::sync::Arc;
|
||||||
use std::{fmt, i32, isize, mem};
|
use std::{fmt, i32, isize, mem};
|
||||||
use style::computed_values::{display, overflow_x, position, text_align, text_justify};
|
use style::computed_values::{display, overflow_x, position, text_align, text_justify};
|
||||||
use style::computed_values::{text_overflow, vertical_align, white_space};
|
use style::computed_values::{text_overflow, vertical_align, white_space};
|
||||||
|
use style::context::StyleContext;
|
||||||
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
||||||
use style::properties::{ComputedValues, ServoComputedValues};
|
use style::properties::{ComputedValues, ServoComputedValues};
|
||||||
|
use style::servo::SharedStyleContext;
|
||||||
use style::values::computed::LengthOrPercentage;
|
use style::values::computed::LengthOrPercentage;
|
||||||
use text;
|
use text;
|
||||||
use unicode_bidi;
|
use unicode_bidi;
|
||||||
|
@ -1348,7 +1350,7 @@ impl Flow for InlineFlow {
|
||||||
|
|
||||||
/// Recursively (top-down) determines the actual inline-size of child contexts and fragments.
|
/// Recursively (top-down) determines the actual inline-size of child contexts and fragments.
|
||||||
/// When called on this context, the context has had its inline-size set by the parent context.
|
/// When called on this context, the context has had its inline-size set by the parent context.
|
||||||
fn assign_inline_sizes(&mut self, _: &LayoutContext) {
|
fn assign_inline_sizes(&mut self, _: &SharedStyleContext) {
|
||||||
let _scope = layout_debug_scope!("inline::assign_inline_sizes {:x}", self.base.debug_id());
|
let _scope = layout_debug_scope!("inline::assign_inline_sizes {:x}", self.base.debug_id());
|
||||||
|
|
||||||
// Initialize content fragment inline-sizes if they haven't been initialized already.
|
// Initialize content fragment inline-sizes if they haven't been initialized already.
|
||||||
|
@ -1466,7 +1468,7 @@ impl Flow for InlineFlow {
|
||||||
// This is preorder because the block-size of an absolute flow may depend on
|
// This is preorder because the block-size of an absolute flow may depend on
|
||||||
// the block-size of its containing block, which may also be an absolute flow.
|
// the block-size of its containing block, which may also be an absolute flow.
|
||||||
(&mut *self as &mut Flow).traverse_preorder_absolute_flows(
|
(&mut *self as &mut Flow).traverse_preorder_absolute_flows(
|
||||||
&mut AbsoluteAssignBSizesTraversal(layout_context));
|
&mut AbsoluteAssignBSizesTraversal(layout_context.shared_context()));
|
||||||
}
|
}
|
||||||
|
|
||||||
self.base.position.size.block = match self.lines.last() {
|
self.base.position.size.block = match self.lines.last() {
|
||||||
|
|
|
@ -25,6 +25,7 @@ use std::sync::Arc;
|
||||||
use style::computed_values::{list_style_type, position};
|
use style::computed_values::{list_style_type, position};
|
||||||
use style::logical_geometry::LogicalSize;
|
use style::logical_geometry::LogicalSize;
|
||||||
use style::properties::{ComputedValues, ServoComputedValues};
|
use style::properties::{ComputedValues, ServoComputedValues};
|
||||||
|
use style::servo::SharedStyleContext;
|
||||||
use text;
|
use text;
|
||||||
|
|
||||||
/// A block with the CSS `display` property equal to `list-item`.
|
/// A block with the CSS `display` property equal to `list-item`.
|
||||||
|
@ -81,14 +82,14 @@ impl Flow for ListItemFlow {
|
||||||
self.block_flow.bubble_inline_sizes()
|
self.block_flow.bubble_inline_sizes()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) {
|
fn assign_inline_sizes(&mut self, shared_context: &SharedStyleContext) {
|
||||||
self.block_flow.assign_inline_sizes(layout_context);
|
self.block_flow.assign_inline_sizes(shared_context);
|
||||||
|
|
||||||
let mut marker_inline_start = self.block_flow.fragment.border_box.start.i;
|
let mut marker_inline_start = self.block_flow.fragment.border_box.start.i;
|
||||||
|
|
||||||
for marker in self.marker_fragments.iter_mut().rev() {
|
for marker in self.marker_fragments.iter_mut().rev() {
|
||||||
let containing_block_inline_size = self.block_flow.base.block_container_inline_size;
|
let containing_block_inline_size = self.block_flow.base.block_container_inline_size;
|
||||||
let container_block_size = self.block_flow.explicit_block_containing_size(layout_context);
|
let container_block_size = self.block_flow.explicit_block_containing_size(shared_context);
|
||||||
marker.assign_replaced_inline_size_if_necessary(containing_block_inline_size, container_block_size);
|
marker.assign_replaced_inline_size_if_necessary(containing_block_inline_size, container_block_size);
|
||||||
|
|
||||||
// Do this now. There's no need to do this in bubble-widths, since markers do not
|
// Do this now. There's no need to do this in bubble-widths, since markers do not
|
||||||
|
|
|
@ -23,6 +23,7 @@ use std::sync::Arc;
|
||||||
use style::context::StyleContext;
|
use style::context::StyleContext;
|
||||||
use style::logical_geometry::LogicalSize;
|
use style::logical_geometry::LogicalSize;
|
||||||
use style::properties::{ComputedValues, ServoComputedValues};
|
use style::properties::{ComputedValues, ServoComputedValues};
|
||||||
|
use style::servo::SharedStyleContext;
|
||||||
use style::values::computed::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
|
use style::values::computed::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
|
||||||
use util::print_tree::PrintTree;
|
use util::print_tree::PrintTree;
|
||||||
|
|
||||||
|
@ -77,9 +78,9 @@ impl Flow for MulticolFlow {
|
||||||
self.block_flow.bubble_inline_sizes();
|
self.block_flow.bubble_inline_sizes();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) {
|
fn assign_inline_sizes(&mut self, shared_context: &SharedStyleContext) {
|
||||||
debug!("assign_inline_sizes({}): assigning inline_size for flow", "multicol");
|
debug!("assign_inline_sizes({}): assigning inline_size for flow", "multicol");
|
||||||
self.block_flow.compute_inline_sizes(layout_context);
|
self.block_flow.compute_inline_sizes(shared_context);
|
||||||
|
|
||||||
// Move in from the inline-start border edge.
|
// Move in from the inline-start border edge.
|
||||||
let inline_start_content_edge = self.block_flow.fragment.border_box.start.i +
|
let inline_start_content_edge = self.block_flow.fragment.border_box.start.i +
|
||||||
|
@ -90,7 +91,7 @@ impl Flow for MulticolFlow {
|
||||||
self.block_flow.fragment.margin.inline_end +
|
self.block_flow.fragment.margin.inline_end +
|
||||||
self.block_flow.fragment.border_padding.inline_end;
|
self.block_flow.fragment.border_padding.inline_end;
|
||||||
|
|
||||||
self.block_flow.assign_inline_sizes(layout_context);
|
self.block_flow.assign_inline_sizes(shared_context);
|
||||||
let padding_and_borders = self.block_flow.fragment.border_padding.inline_start_end();
|
let padding_and_borders = self.block_flow.fragment.border_padding.inline_start_end();
|
||||||
let content_inline_size =
|
let content_inline_size =
|
||||||
self.block_flow.fragment.border_box.size.inline - padding_and_borders;
|
self.block_flow.fragment.border_box.size.inline - padding_and_borders;
|
||||||
|
@ -119,7 +120,7 @@ impl Flow for MulticolFlow {
|
||||||
self.block_flow.fragment.border_box.size.inline = content_inline_size + padding_and_borders;
|
self.block_flow.fragment.border_box.size.inline = content_inline_size + padding_and_borders;
|
||||||
|
|
||||||
self.block_flow.propagate_assigned_inline_size_to_children(
|
self.block_flow.propagate_assigned_inline_size_to_children(
|
||||||
layout_context, inline_start_content_edge, inline_end_content_edge, column_width,
|
shared_context, inline_start_content_edge, inline_end_content_edge, column_width,
|
||||||
|_, _, _, _, _, _| {});
|
|_, _, _, _, _, _| {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,9 +238,9 @@ impl Flow for MulticolColumnFlow {
|
||||||
self.block_flow.bubble_inline_sizes();
|
self.block_flow.bubble_inline_sizes();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) {
|
fn assign_inline_sizes(&mut self, shared_context: &SharedStyleContext) {
|
||||||
debug!("assign_inline_sizes({}): assigning inline_size for flow", "multicol column");
|
debug!("assign_inline_sizes({}): assigning inline_size for flow", "multicol column");
|
||||||
self.block_flow.assign_inline_sizes(layout_context);
|
self.block_flow.assign_inline_sizes(shared_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assign_block_size<'a>(&mut self, ctx: &'a LayoutContext<'a>) {
|
fn assign_block_size<'a>(&mut self, ctx: &'a LayoutContext<'a>) {
|
||||||
|
|
|
@ -203,9 +203,8 @@ impl<'a> ParallelPostorderFlowTraversal for AssignBSizes<'a> {}
|
||||||
fn assign_inline_sizes(unsafe_flows: UnsafeFlowList,
|
fn assign_inline_sizes(unsafe_flows: UnsafeFlowList,
|
||||||
proxy: &mut WorkerProxy<SharedLayoutContext, UnsafeFlowList>) {
|
proxy: &mut WorkerProxy<SharedLayoutContext, UnsafeFlowList>) {
|
||||||
let shared_layout_context = proxy.user_data();
|
let shared_layout_context = proxy.user_data();
|
||||||
let layout_context = LayoutContext::new(shared_layout_context);
|
|
||||||
let assign_inline_sizes_traversal = AssignISizes {
|
let assign_inline_sizes_traversal = AssignISizes {
|
||||||
layout_context: &layout_context,
|
shared_context: &shared_layout_context.style_context,
|
||||||
};
|
};
|
||||||
assign_inline_sizes_traversal.run_parallel(unsafe_flows, proxy)
|
assign_inline_sizes_traversal.run_parallel(unsafe_flows, proxy)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ use fragment::FragmentBorderBoxIterator;
|
||||||
use generated_content::ResolveGeneratedContent;
|
use generated_content::ResolveGeneratedContent;
|
||||||
use gfx::display_list::{DisplayItem, StackingContext};
|
use gfx::display_list::{DisplayItem, StackingContext};
|
||||||
use script_layout_interface::restyle_damage::{REFLOW, STORE_OVERFLOW};
|
use script_layout_interface::restyle_damage::{REFLOW, STORE_OVERFLOW};
|
||||||
|
use style::context::StyleContext;
|
||||||
use traversal::{AssignBSizes, AssignISizes, BubbleISizes, BuildDisplayList, ComputeAbsolutePositions};
|
use traversal::{AssignBSizes, AssignISizes, BubbleISizes, BuildDisplayList, ComputeAbsolutePositions};
|
||||||
use util::opts;
|
use util::opts;
|
||||||
|
|
||||||
|
@ -70,7 +71,7 @@ pub fn traverse_flow_tree_preorder(root: &mut FlowRef,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let assign_inline_sizes = AssignISizes { layout_context: &layout_context };
|
let assign_inline_sizes = AssignISizes { shared_context: layout_context.shared_context() };
|
||||||
let assign_block_sizes = AssignBSizes { layout_context: &layout_context };
|
let assign_block_sizes = AssignBSizes { layout_context: &layout_context };
|
||||||
|
|
||||||
doit(root, assign_inline_sizes, assign_block_sizes);
|
doit(root, assign_inline_sizes, assign_block_sizes);
|
||||||
|
|
|
@ -27,6 +27,7 @@ use std::sync::Arc;
|
||||||
use style::computed_values::{border_collapse, border_spacing, table_layout};
|
use style::computed_values::{border_collapse, border_spacing, table_layout};
|
||||||
use style::logical_geometry::LogicalSize;
|
use style::logical_geometry::LogicalSize;
|
||||||
use style::properties::{ComputedValues, ServoComputedValues};
|
use style::properties::{ComputedValues, ServoComputedValues};
|
||||||
|
use style::servo::SharedStyleContext;
|
||||||
use style::values::CSSFloat;
|
use style::values::CSSFloat;
|
||||||
use style::values::computed::LengthOrPercentageOrAuto;
|
use style::values::computed::LengthOrPercentageOrAuto;
|
||||||
use table_row::TableRowFlow;
|
use table_row::TableRowFlow;
|
||||||
|
@ -324,7 +325,7 @@ impl Flow for TableFlow {
|
||||||
|
|
||||||
/// Recursively (top-down) determines the actual inline-size of child contexts and fragments.
|
/// Recursively (top-down) determines the actual inline-size of child contexts and fragments.
|
||||||
/// When called on this context, the context has had its inline-size set by the parent context.
|
/// When called on this context, the context has had its inline-size set by the parent context.
|
||||||
fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) {
|
fn assign_inline_sizes(&mut self, shared_context: &SharedStyleContext) {
|
||||||
let _scope = layout_debug_scope!("table::assign_inline_sizes {:x}",
|
let _scope = layout_debug_scope!("table::assign_inline_sizes {:x}",
|
||||||
self.block_flow.base.debug_id());
|
self.block_flow.base.debug_id());
|
||||||
debug!("assign_inline_sizes({}): assigning inline_size for flow", "table");
|
debug!("assign_inline_sizes({}): assigning inline_size for flow", "table");
|
||||||
|
@ -347,7 +348,7 @@ impl Flow for TableFlow {
|
||||||
border_collapse: self.block_flow.fragment.style.get_inheritedtable().border_collapse,
|
border_collapse: self.block_flow.fragment.style.get_inheritedtable().border_collapse,
|
||||||
};
|
};
|
||||||
inline_size_computer.compute_used_inline_size(&mut self.block_flow,
|
inline_size_computer.compute_used_inline_size(&mut self.block_flow,
|
||||||
layout_context,
|
shared_context,
|
||||||
containing_block_inline_size);
|
containing_block_inline_size);
|
||||||
|
|
||||||
let inline_start_content_edge = self.block_flow.fragment.border_padding.inline_start;
|
let inline_start_content_edge = self.block_flow.fragment.border_padding.inline_start;
|
||||||
|
@ -398,7 +399,7 @@ impl Flow for TableFlow {
|
||||||
&self.collapsed_inline_direction_border_widths_for_table;
|
&self.collapsed_inline_direction_border_widths_for_table;
|
||||||
let mut collapsed_block_direction_border_widths_for_table =
|
let mut collapsed_block_direction_border_widths_for_table =
|
||||||
self.collapsed_block_direction_border_widths_for_table.iter().peekable();
|
self.collapsed_block_direction_border_widths_for_table.iter().peekable();
|
||||||
self.block_flow.propagate_assigned_inline_size_to_children(layout_context,
|
self.block_flow.propagate_assigned_inline_size_to_children(shared_context,
|
||||||
inline_start_content_edge,
|
inline_start_content_edge,
|
||||||
inline_end_content_edge,
|
inline_end_content_edge,
|
||||||
content_inline_size,
|
content_inline_size,
|
||||||
|
@ -517,11 +518,11 @@ impl ISizeAndMarginsComputer for InternalTable {
|
||||||
/// CSS Section 10.4: Minimum and Maximum inline-sizes
|
/// CSS Section 10.4: Minimum and Maximum inline-sizes
|
||||||
fn compute_used_inline_size(&self,
|
fn compute_used_inline_size(&self,
|
||||||
block: &mut BlockFlow,
|
block: &mut BlockFlow,
|
||||||
layout_context: &LayoutContext,
|
shared_context: &SharedStyleContext,
|
||||||
parent_flow_inline_size: Au) {
|
parent_flow_inline_size: Au) {
|
||||||
let mut input = self.compute_inline_size_constraint_inputs(block,
|
let mut input = self.compute_inline_size_constraint_inputs(block,
|
||||||
parent_flow_inline_size,
|
parent_flow_inline_size,
|
||||||
layout_context);
|
shared_context);
|
||||||
|
|
||||||
// Tables are always at least as wide as their minimum inline size.
|
// Tables are always at least as wide as their minimum inline size.
|
||||||
let minimum_inline_size =
|
let minimum_inline_size =
|
||||||
|
|
|
@ -19,6 +19,7 @@ use std::fmt;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use style::logical_geometry::LogicalSize;
|
use style::logical_geometry::LogicalSize;
|
||||||
use style::properties::ServoComputedValues;
|
use style::properties::ServoComputedValues;
|
||||||
|
use style::servo::SharedStyleContext;
|
||||||
use util::print_tree::PrintTree;
|
use util::print_tree::PrintTree;
|
||||||
|
|
||||||
/// A table formatting context.
|
/// A table formatting context.
|
||||||
|
@ -55,9 +56,9 @@ impl Flow for TableCaptionFlow {
|
||||||
self.block_flow.bubble_inline_sizes();
|
self.block_flow.bubble_inline_sizes();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assign_inline_sizes(&mut self, ctx: &LayoutContext) {
|
fn assign_inline_sizes(&mut self, shared_context: &SharedStyleContext) {
|
||||||
debug!("assign_inline_sizes({}): assigning inline_size for flow", "table_caption");
|
debug!("assign_inline_sizes({}): assigning inline_size for flow", "table_caption");
|
||||||
self.block_flow.assign_inline_sizes(ctx);
|
self.block_flow.assign_inline_sizes(shared_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assign_block_size<'a>(&mut self, layout_context: &'a LayoutContext<'a>) {
|
fn assign_block_size<'a>(&mut self, layout_context: &'a LayoutContext<'a>) {
|
||||||
|
|
|
@ -25,6 +25,7 @@ use std::sync::Arc;
|
||||||
use style::computed_values::{border_collapse, border_top_style, vertical_align};
|
use style::computed_values::{border_collapse, border_top_style, vertical_align};
|
||||||
use style::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode};
|
use style::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode};
|
||||||
use style::properties::{ComputedValues, ServoComputedValues};
|
use style::properties::{ComputedValues, ServoComputedValues};
|
||||||
|
use style::servo::SharedStyleContext;
|
||||||
use table::InternalTable;
|
use table::InternalTable;
|
||||||
use table_row::{CollapsedBorder, CollapsedBorderProvenance};
|
use table_row::{CollapsedBorder, CollapsedBorderProvenance};
|
||||||
use util::print_tree::PrintTree;
|
use util::print_tree::PrintTree;
|
||||||
|
@ -162,7 +163,7 @@ impl Flow for TableCellFlow {
|
||||||
/// Recursively (top-down) determines the actual inline-size of child contexts and fragments.
|
/// Recursively (top-down) determines the actual inline-size of child contexts and fragments.
|
||||||
/// When called on this context, the context has had its inline-size set by the parent table
|
/// When called on this context, the context has had its inline-size set by the parent table
|
||||||
/// row.
|
/// row.
|
||||||
fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) {
|
fn assign_inline_sizes(&mut self, shared_context: &SharedStyleContext) {
|
||||||
let _scope = layout_debug_scope!("table_cell::assign_inline_sizes {:x}",
|
let _scope = layout_debug_scope!("table_cell::assign_inline_sizes {:x}",
|
||||||
self.block_flow.base.debug_id());
|
self.block_flow.base.debug_id());
|
||||||
debug!("assign_inline_sizes({}): assigning inline_size for flow", "table_cell");
|
debug!("assign_inline_sizes({}): assigning inline_size for flow", "table_cell");
|
||||||
|
@ -174,7 +175,7 @@ impl Flow for TableCellFlow {
|
||||||
border_collapse: self.block_flow.fragment.style.get_inheritedtable().border_collapse,
|
border_collapse: self.block_flow.fragment.style.get_inheritedtable().border_collapse,
|
||||||
};
|
};
|
||||||
inline_size_computer.compute_used_inline_size(&mut self.block_flow,
|
inline_size_computer.compute_used_inline_size(&mut self.block_flow,
|
||||||
layout_context,
|
shared_context,
|
||||||
containing_block_inline_size);
|
containing_block_inline_size);
|
||||||
|
|
||||||
let inline_start_content_edge =
|
let inline_start_content_edge =
|
||||||
|
@ -188,7 +189,7 @@ impl Flow for TableCellFlow {
|
||||||
let content_inline_size =
|
let content_inline_size =
|
||||||
self.block_flow.fragment.border_box.size.inline - padding_and_borders;
|
self.block_flow.fragment.border_box.size.inline - padding_and_borders;
|
||||||
|
|
||||||
self.block_flow.propagate_assigned_inline_size_to_children(layout_context,
|
self.block_flow.propagate_assigned_inline_size_to_children(shared_context,
|
||||||
inline_start_content_edge,
|
inline_start_content_edge,
|
||||||
inline_end_content_edge,
|
inline_end_content_edge,
|
||||||
content_inline_size,
|
content_inline_size,
|
||||||
|
|
|
@ -20,6 +20,7 @@ use std::fmt;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use style::logical_geometry::LogicalSize;
|
use style::logical_geometry::LogicalSize;
|
||||||
use style::properties::ServoComputedValues;
|
use style::properties::ServoComputedValues;
|
||||||
|
use style::servo::SharedStyleContext;
|
||||||
use style::values::computed::LengthOrPercentageOrAuto;
|
use style::values::computed::LengthOrPercentageOrAuto;
|
||||||
|
|
||||||
/// A table formatting context.
|
/// A table formatting context.
|
||||||
|
@ -81,7 +82,7 @@ impl Flow for TableColGroupFlow {
|
||||||
|
|
||||||
/// Table column inline-sizes are assigned in the table flow and propagated to table row flows
|
/// Table column inline-sizes are assigned in the table flow and propagated to table row flows
|
||||||
/// and/or rowgroup flows. Therefore, table colgroup flows do not need to assign inline-sizes.
|
/// and/or rowgroup flows. Therefore, table colgroup flows do not need to assign inline-sizes.
|
||||||
fn assign_inline_sizes(&mut self, _: &LayoutContext) {
|
fn assign_inline_sizes(&mut self, _: &SharedStyleContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Table columns do not have block-size.
|
/// Table columns do not have block-size.
|
||||||
|
|
|
@ -27,6 +27,7 @@ use std::sync::Arc;
|
||||||
use style::computed_values::{border_collapse, border_spacing, border_top_style};
|
use style::computed_values::{border_collapse, border_spacing, border_top_style};
|
||||||
use style::logical_geometry::{LogicalSize, PhysicalSide, WritingMode};
|
use style::logical_geometry::{LogicalSize, PhysicalSide, WritingMode};
|
||||||
use style::properties::{ComputedValues, ServoComputedValues};
|
use style::properties::{ComputedValues, ServoComputedValues};
|
||||||
|
use style::servo::SharedStyleContext;
|
||||||
use style::values::computed::LengthOrPercentageOrAuto;
|
use style::values::computed::LengthOrPercentageOrAuto;
|
||||||
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt};
|
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt};
|
||||||
use table_cell::{CollapsedBordersForCell, TableCellFlow};
|
use table_cell::{CollapsedBordersForCell, TableCellFlow};
|
||||||
|
@ -311,7 +312,7 @@ impl Flow for TableRowFlow {
|
||||||
pref_inline_size);
|
pref_inline_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) {
|
fn assign_inline_sizes(&mut self, shared_context: &SharedStyleContext) {
|
||||||
let _scope = layout_debug_scope!("table_row::assign_inline_sizes {:x}",
|
let _scope = layout_debug_scope!("table_row::assign_inline_sizes {:x}",
|
||||||
self.block_flow.base.debug_id());
|
self.block_flow.base.debug_id());
|
||||||
debug!("assign_inline_sizes({}): assigning inline_size for flow", "table_row");
|
debug!("assign_inline_sizes({}): assigning inline_size for flow", "table_row");
|
||||||
|
@ -327,7 +328,7 @@ impl Flow for TableRowFlow {
|
||||||
border_collapse: self.block_flow.fragment.style.get_inheritedtable().border_collapse,
|
border_collapse: self.block_flow.fragment.style.get_inheritedtable().border_collapse,
|
||||||
};
|
};
|
||||||
inline_size_computer.compute_used_inline_size(&mut self.block_flow,
|
inline_size_computer.compute_used_inline_size(&mut self.block_flow,
|
||||||
layout_context,
|
shared_context,
|
||||||
containing_block_inline_size);
|
containing_block_inline_size);
|
||||||
|
|
||||||
// Spread out the completed inline sizes among columns with spans > 1.
|
// Spread out the completed inline sizes among columns with spans > 1.
|
||||||
|
@ -380,7 +381,7 @@ impl Flow for TableRowFlow {
|
||||||
let spacing = self.spacing;
|
let spacing = self.spacing;
|
||||||
let row_writing_mode = self.block_flow.base.writing_mode;
|
let row_writing_mode = self.block_flow.base.writing_mode;
|
||||||
let table_writing_mode = self.table_writing_mode;
|
let table_writing_mode = self.table_writing_mode;
|
||||||
self.block_flow.propagate_assigned_inline_size_to_children(layout_context,
|
self.block_flow.propagate_assigned_inline_size_to_children(shared_context,
|
||||||
inline_start_content_edge,
|
inline_start_content_edge,
|
||||||
inline_end_content_edge,
|
inline_end_content_edge,
|
||||||
containing_block_inline_size,
|
containing_block_inline_size,
|
||||||
|
|
|
@ -23,6 +23,7 @@ use std::sync::Arc;
|
||||||
use style::computed_values::{border_collapse, border_spacing};
|
use style::computed_values::{border_collapse, border_spacing};
|
||||||
use style::logical_geometry::{LogicalSize, WritingMode};
|
use style::logical_geometry::{LogicalSize, WritingMode};
|
||||||
use style::properties::{ComputedValues, ServoComputedValues};
|
use style::properties::{ComputedValues, ServoComputedValues};
|
||||||
|
use style::servo::SharedStyleContext;
|
||||||
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, TableLikeFlow};
|
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, TableLikeFlow};
|
||||||
use table_row;
|
use table_row;
|
||||||
use util::print_tree::PrintTree;
|
use util::print_tree::PrintTree;
|
||||||
|
@ -139,7 +140,7 @@ impl Flow for TableRowGroupFlow {
|
||||||
|
|
||||||
/// Recursively (top-down) determines the actual inline-size of child contexts and fragments.
|
/// Recursively (top-down) determines the actual inline-size of child contexts and fragments.
|
||||||
/// When called on this context, the context has had its inline-size set by the parent context.
|
/// When called on this context, the context has had its inline-size set by the parent context.
|
||||||
fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) {
|
fn assign_inline_sizes(&mut self, shared_context: &SharedStyleContext) {
|
||||||
let _scope = layout_debug_scope!("table_rowgroup::assign_inline_sizes {:x}",
|
let _scope = layout_debug_scope!("table_rowgroup::assign_inline_sizes {:x}",
|
||||||
self.block_flow.base.debug_id());
|
self.block_flow.base.debug_id());
|
||||||
debug!("assign_inline_sizes({}): assigning inline_size for flow", "table_rowgroup");
|
debug!("assign_inline_sizes({}): assigning inline_size for flow", "table_rowgroup");
|
||||||
|
@ -154,7 +155,7 @@ impl Flow for TableRowGroupFlow {
|
||||||
border_collapse: border_collapse,
|
border_collapse: border_collapse,
|
||||||
};
|
};
|
||||||
inline_size_computer.compute_used_inline_size(&mut self.block_flow,
|
inline_size_computer.compute_used_inline_size(&mut self.block_flow,
|
||||||
layout_context,
|
shared_context,
|
||||||
containing_block_inline_size);
|
containing_block_inline_size);
|
||||||
|
|
||||||
let column_computed_inline_sizes = &self.column_computed_inline_sizes;
|
let column_computed_inline_sizes = &self.column_computed_inline_sizes;
|
||||||
|
@ -164,7 +165,7 @@ impl Flow for TableRowGroupFlow {
|
||||||
&self.collapsed_inline_direction_border_widths_for_table;
|
&self.collapsed_inline_direction_border_widths_for_table;
|
||||||
let mut collapsed_block_direction_border_widths_for_table =
|
let mut collapsed_block_direction_border_widths_for_table =
|
||||||
self.collapsed_block_direction_border_widths_for_table.iter().peekable();
|
self.collapsed_block_direction_border_widths_for_table.iter().peekable();
|
||||||
self.block_flow.propagate_assigned_inline_size_to_children(layout_context,
|
self.block_flow.propagate_assigned_inline_size_to_children(shared_context,
|
||||||
inline_start_content_edge,
|
inline_start_content_edge,
|
||||||
inline_end_content_edge,
|
inline_end_content_edge,
|
||||||
content_inline_size,
|
content_inline_size,
|
||||||
|
|
|
@ -32,6 +32,7 @@ use std::sync::Arc;
|
||||||
use style::computed_values::{border_collapse, table_layout};
|
use style::computed_values::{border_collapse, table_layout};
|
||||||
use style::logical_geometry::LogicalSize;
|
use style::logical_geometry::LogicalSize;
|
||||||
use style::properties::{ComputedValues, ServoComputedValues};
|
use style::properties::{ComputedValues, ServoComputedValues};
|
||||||
|
use style::servo::SharedStyleContext;
|
||||||
use style::values::CSSFloat;
|
use style::values::CSSFloat;
|
||||||
use style::values::computed::LengthOrPercentageOrAuto;
|
use style::values::computed::LengthOrPercentageOrAuto;
|
||||||
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize};
|
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize};
|
||||||
|
@ -204,7 +205,7 @@ impl TableWrapperFlow {
|
||||||
|
|
||||||
fn compute_used_inline_size(
|
fn compute_used_inline_size(
|
||||||
&mut self,
|
&mut self,
|
||||||
layout_context: &LayoutContext,
|
shared_context: &SharedStyleContext,
|
||||||
parent_flow_inline_size: Au,
|
parent_flow_inline_size: Au,
|
||||||
intermediate_column_inline_sizes: &[IntermediateColumnInlineSize]) {
|
intermediate_column_inline_sizes: &[IntermediateColumnInlineSize]) {
|
||||||
let (border_padding, spacing) = self.border_padding_and_spacing();
|
let (border_padding, spacing) = self.border_padding_and_spacing();
|
||||||
|
@ -233,7 +234,7 @@ impl TableWrapperFlow {
|
||||||
let input =
|
let input =
|
||||||
inline_size_computer.compute_inline_size_constraint_inputs(&mut self.block_flow,
|
inline_size_computer.compute_inline_size_constraint_inputs(&mut self.block_flow,
|
||||||
parent_flow_inline_size,
|
parent_flow_inline_size,
|
||||||
layout_context);
|
shared_context);
|
||||||
|
|
||||||
let solution = inline_size_computer.solve_inline_size_constraints(&mut self.block_flow,
|
let solution = inline_size_computer.solve_inline_size_constraints(&mut self.block_flow,
|
||||||
&input);
|
&input);
|
||||||
|
@ -253,7 +254,7 @@ impl TableWrapperFlow {
|
||||||
let input =
|
let input =
|
||||||
inline_size_computer.compute_inline_size_constraint_inputs(&mut self.block_flow,
|
inline_size_computer.compute_inline_size_constraint_inputs(&mut self.block_flow,
|
||||||
parent_flow_inline_size,
|
parent_flow_inline_size,
|
||||||
layout_context);
|
shared_context);
|
||||||
|
|
||||||
let solution = inline_size_computer.solve_inline_size_constraints(&mut self.block_flow,
|
let solution = inline_size_computer.solve_inline_size_constraints(&mut self.block_flow,
|
||||||
&input);
|
&input);
|
||||||
|
@ -272,7 +273,7 @@ impl TableWrapperFlow {
|
||||||
let input =
|
let input =
|
||||||
inline_size_computer.compute_inline_size_constraint_inputs(&mut self.block_flow,
|
inline_size_computer.compute_inline_size_constraint_inputs(&mut self.block_flow,
|
||||||
parent_flow_inline_size,
|
parent_flow_inline_size,
|
||||||
layout_context);
|
shared_context);
|
||||||
|
|
||||||
let solution = inline_size_computer.solve_inline_size_constraints(&mut self.block_flow,
|
let solution = inline_size_computer.solve_inline_size_constraints(&mut self.block_flow,
|
||||||
&input);
|
&input);
|
||||||
|
@ -319,7 +320,7 @@ impl Flow for TableWrapperFlow {
|
||||||
self.block_flow.bubble_inline_sizes();
|
self.block_flow.bubble_inline_sizes();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) {
|
fn assign_inline_sizes(&mut self, shared_context: &SharedStyleContext) {
|
||||||
debug!("assign_inline_sizes({}): assigning inline_size for flow",
|
debug!("assign_inline_sizes({}): assigning inline_size for flow",
|
||||||
if self.block_flow.base.flags.is_float() {
|
if self.block_flow.base.flags.is_float() {
|
||||||
"floated table_wrapper"
|
"floated table_wrapper"
|
||||||
|
@ -344,7 +345,7 @@ impl Flow for TableWrapperFlow {
|
||||||
containing_block_inline_size;
|
containing_block_inline_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.compute_used_inline_size(layout_context,
|
self.compute_used_inline_size(shared_context,
|
||||||
containing_block_inline_size,
|
containing_block_inline_size,
|
||||||
&intermediate_column_inline_sizes);
|
&intermediate_column_inline_sizes);
|
||||||
|
|
||||||
|
@ -374,7 +375,7 @@ impl Flow for TableWrapperFlow {
|
||||||
match assigned_column_inline_sizes {
|
match assigned_column_inline_sizes {
|
||||||
None => {
|
None => {
|
||||||
self.block_flow
|
self.block_flow
|
||||||
.propagate_assigned_inline_size_to_children(layout_context,
|
.propagate_assigned_inline_size_to_children(shared_context,
|
||||||
inline_start_content_edge,
|
inline_start_content_edge,
|
||||||
inline_end_content_edge,
|
inline_end_content_edge,
|
||||||
content_inline_size,
|
content_inline_size,
|
||||||
|
@ -382,7 +383,7 @@ impl Flow for TableWrapperFlow {
|
||||||
}
|
}
|
||||||
Some(ref assigned_column_inline_sizes) => {
|
Some(ref assigned_column_inline_sizes) => {
|
||||||
self.block_flow
|
self.block_flow
|
||||||
.propagate_assigned_inline_size_to_children(layout_context,
|
.propagate_assigned_inline_size_to_children(shared_context,
|
||||||
inline_start_content_edge,
|
inline_start_content_edge,
|
||||||
inline_end_content_edge,
|
inline_end_content_edge,
|
||||||
content_inline_size,
|
content_inline_size,
|
||||||
|
@ -767,12 +768,12 @@ impl ISizeAndMarginsComputer for Table {
|
||||||
fn initial_computed_inline_size(&self,
|
fn initial_computed_inline_size(&self,
|
||||||
block: &mut BlockFlow,
|
block: &mut BlockFlow,
|
||||||
parent_flow_inline_size: Au,
|
parent_flow_inline_size: Au,
|
||||||
layout_context: &LayoutContext)
|
shared_context: &SharedStyleContext)
|
||||||
-> MaybeAuto {
|
-> MaybeAuto {
|
||||||
let containing_block_inline_size =
|
let containing_block_inline_size =
|
||||||
self.containing_block_inline_size(block,
|
self.containing_block_inline_size(block,
|
||||||
parent_flow_inline_size,
|
parent_flow_inline_size,
|
||||||
layout_context);
|
shared_context);
|
||||||
initial_computed_inline_size(block,
|
initial_computed_inline_size(block,
|
||||||
containing_block_inline_size,
|
containing_block_inline_size,
|
||||||
self.minimum_width_of_all_columns,
|
self.minimum_width_of_all_columns,
|
||||||
|
@ -802,12 +803,12 @@ impl ISizeAndMarginsComputer for FloatedTable {
|
||||||
fn initial_computed_inline_size(&self,
|
fn initial_computed_inline_size(&self,
|
||||||
block: &mut BlockFlow,
|
block: &mut BlockFlow,
|
||||||
parent_flow_inline_size: Au,
|
parent_flow_inline_size: Au,
|
||||||
layout_context: &LayoutContext)
|
shared_context: &SharedStyleContext)
|
||||||
-> MaybeAuto {
|
-> MaybeAuto {
|
||||||
let containing_block_inline_size =
|
let containing_block_inline_size =
|
||||||
self.containing_block_inline_size(block,
|
self.containing_block_inline_size(block,
|
||||||
parent_flow_inline_size,
|
parent_flow_inline_size,
|
||||||
layout_context);
|
shared_context);
|
||||||
initial_computed_inline_size(block,
|
initial_computed_inline_size(block,
|
||||||
containing_block_inline_size,
|
containing_block_inline_size,
|
||||||
self.minimum_width_of_all_columns,
|
self.minimum_width_of_all_columns,
|
||||||
|
@ -837,12 +838,12 @@ impl ISizeAndMarginsComputer for AbsoluteTable {
|
||||||
fn initial_computed_inline_size(&self,
|
fn initial_computed_inline_size(&self,
|
||||||
block: &mut BlockFlow,
|
block: &mut BlockFlow,
|
||||||
parent_flow_inline_size: Au,
|
parent_flow_inline_size: Au,
|
||||||
layout_context: &LayoutContext)
|
shared_context: &SharedStyleContext)
|
||||||
-> MaybeAuto {
|
-> MaybeAuto {
|
||||||
let containing_block_inline_size =
|
let containing_block_inline_size =
|
||||||
self.containing_block_inline_size(block,
|
self.containing_block_inline_size(block,
|
||||||
parent_flow_inline_size,
|
parent_flow_inline_size,
|
||||||
layout_context);
|
shared_context);
|
||||||
initial_computed_inline_size(block,
|
initial_computed_inline_size(block,
|
||||||
containing_block_inline_size,
|
containing_block_inline_size,
|
||||||
self.minimum_width_of_all_columns,
|
self.minimum_width_of_all_columns,
|
||||||
|
@ -852,9 +853,9 @@ impl ISizeAndMarginsComputer for AbsoluteTable {
|
||||||
fn containing_block_inline_size(&self,
|
fn containing_block_inline_size(&self,
|
||||||
block: &mut BlockFlow,
|
block: &mut BlockFlow,
|
||||||
parent_flow_inline_size: Au,
|
parent_flow_inline_size: Au,
|
||||||
layout_context: &LayoutContext)
|
shared_context: &SharedStyleContext)
|
||||||
-> Au {
|
-> Au {
|
||||||
AbsoluteNonReplaced.containing_block_inline_size(block, parent_flow_inline_size, layout_context)
|
AbsoluteNonReplaced.containing_block_inline_size(block, parent_flow_inline_size, shared_context)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn solve_inline_size_constraints(&self,
|
fn solve_inline_size_constraints(&self,
|
||||||
|
|
|
@ -18,6 +18,7 @@ use style::dom::TNode;
|
||||||
use style::matching::MatchMethods;
|
use style::matching::MatchMethods;
|
||||||
use style::properties::ServoComputedValues;
|
use style::properties::ServoComputedValues;
|
||||||
use style::selector_impl::ServoSelectorImpl;
|
use style::selector_impl::ServoSelectorImpl;
|
||||||
|
use style::servo::SharedStyleContext;
|
||||||
use style::traversal::{DomTraversalContext, STYLE_BLOOM};
|
use style::traversal::{DomTraversalContext, STYLE_BLOOM};
|
||||||
use style::traversal::{put_thread_local_bloom_filter, recalc_style_at};
|
use style::traversal::{put_thread_local_bloom_filter, recalc_style_at};
|
||||||
use util::opts;
|
use util::opts;
|
||||||
|
@ -168,13 +169,13 @@ impl<'a> PostorderFlowTraversal for BubbleISizes<'a> {
|
||||||
/// The assign-inline-sizes traversal. In Gecko this corresponds to `Reflow`.
|
/// The assign-inline-sizes traversal. In Gecko this corresponds to `Reflow`.
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub struct AssignISizes<'a> {
|
pub struct AssignISizes<'a> {
|
||||||
pub layout_context: &'a LayoutContext<'a>,
|
pub shared_context: &'a SharedStyleContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> PreorderFlowTraversal for AssignISizes<'a> {
|
impl<'a> PreorderFlowTraversal for AssignISizes<'a> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn process(&self, flow: &mut Flow) {
|
fn process(&self, flow: &mut Flow) {
|
||||||
flow.assign_inline_sizes(self.layout_context);
|
flow.assign_inline_sizes(self.shared_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue