mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Pass SharedStyleContext to explicit_block_containing_size.
This commit is contained in:
parent
6f4b8f2505
commit
f20ea08a1b
3 changed files with 13 additions and 11 deletions
|
@ -1136,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
|
||||||
}
|
}
|
||||||
|
@ -1331,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(layout_context.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)
|
||||||
|
@ -2844,7 +2844,7 @@ impl ISizeAndMarginsComputer for AbsoluteReplaced {
|
||||||
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(&layout_context.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(layout_context.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
|
||||||
|
@ -2903,7 +2903,7 @@ impl ISizeAndMarginsComputer for BlockReplaced {
|
||||||
parent_flow_inline_size: Au,
|
parent_flow_inline_size: Au,
|
||||||
layout_context: &LayoutContext)
|
layout_context: &LayoutContext)
|
||||||
-> MaybeAuto {
|
-> MaybeAuto {
|
||||||
let container_block_size = block.explicit_block_containing_size(layout_context);
|
let container_block_size = block.explicit_block_containing_size(layout_context.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
|
||||||
|
@ -2961,7 +2961,7 @@ impl ISizeAndMarginsComputer for FloatReplaced {
|
||||||
parent_flow_inline_size: Au,
|
parent_flow_inline_size: Au,
|
||||||
layout_context: &LayoutContext)
|
layout_context: &LayoutContext)
|
||||||
-> MaybeAuto {
|
-> MaybeAuto {
|
||||||
let container_block_size = block.explicit_block_containing_size(layout_context);
|
let container_block_size = block.explicit_block_containing_size(layout_context.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
|
||||||
|
@ -3049,7 +3049,7 @@ impl ISizeAndMarginsComputer for InlineBlockReplaced {
|
||||||
parent_flow_inline_size: Au,
|
parent_flow_inline_size: Au,
|
||||||
layout_context: &LayoutContext)
|
layout_context: &LayoutContext)
|
||||||
-> MaybeAuto {
|
-> MaybeAuto {
|
||||||
let container_block_size = block.explicit_block_containing_size(layout_context);
|
let container_block_size = block.explicit_block_containing_size(layout_context.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
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -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 {
|
||||||
|
|
|
@ -23,6 +23,7 @@ use inline::InlineMetrics;
|
||||||
use script_layout_interface::restyle_damage::RESOLVE_GENERATED_CONTENT;
|
use script_layout_interface::restyle_damage::RESOLVE_GENERATED_CONTENT;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use style::computed_values::{list_style_type, position};
|
use style::computed_values::{list_style_type, position};
|
||||||
|
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 text;
|
use text;
|
||||||
|
@ -88,7 +89,7 @@ impl Flow for ListItemFlow {
|
||||||
|
|
||||||
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(layout_context.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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue