mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Make naming of variables consistent with SpecificLayoutInfo
(#35104)
This is a followup to #34926. Fixes #35078. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
a54add0159
commit
102b77aef8
10 changed files with 41 additions and 41 deletions
|
@ -904,7 +904,7 @@ impl<'a> BuilderForBoxFragment<'a> {
|
|||
|
||||
fn build_collapsed_table_borders(&mut self, builder: &mut DisplayListBuilder) {
|
||||
let Some(SpecificLayoutInfo::TableGridWithCollapsedBorders(table_info)) =
|
||||
&self.fragment.detailed_layout_info
|
||||
&self.fragment.specific_layout_info
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
|
|
@ -1212,7 +1212,7 @@ impl BoxFragment {
|
|||
|
||||
if let Fragment::Box(box_fragment) = &fragment {
|
||||
if matches!(
|
||||
box_fragment.borrow().detailed_layout_info,
|
||||
box_fragment.borrow().specific_layout_info,
|
||||
Some(SpecificLayoutInfo::TableGridWithCollapsedBorders(_))
|
||||
) {
|
||||
add_fragment(StackingContextSection::CollapsedTableBorders);
|
||||
|
|
|
@ -979,7 +979,7 @@ impl FlexContainer {
|
|||
content_inline_size_for_table: None,
|
||||
baselines,
|
||||
depends_on_block_constraints,
|
||||
detailed_layout_info: None,
|
||||
specific_layout_info: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -389,7 +389,7 @@ impl BlockFormattingContext {
|
|||
content_inline_size_for_table: None,
|
||||
baselines: flow_layout.baselines,
|
||||
depends_on_block_constraints: flow_layout.depends_on_block_constraints,
|
||||
detailed_layout_info: None,
|
||||
specific_layout_info: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1157,7 +1157,7 @@ impl IndependentNonReplacedContents {
|
|||
block_margins_collapsed_with_children,
|
||||
)
|
||||
.with_baselines(layout.baselines)
|
||||
.with_detailed_layout_info(layout.detailed_layout_info)
|
||||
.with_specific_layout_info(layout.specific_layout_info)
|
||||
}
|
||||
|
||||
/// Lay out a normal in flow non-replaced block that establishes an independent
|
||||
|
@ -1469,7 +1469,7 @@ impl IndependentNonReplacedContents {
|
|||
CollapsedBlockMargins::from_margin(&margin),
|
||||
)
|
||||
.with_baselines(layout.baselines)
|
||||
.with_detailed_layout_info(layout.detailed_layout_info)
|
||||
.with_specific_layout_info(layout.specific_layout_info)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ pub(crate) struct IndependentLayout {
|
|||
pub depends_on_block_constraints: bool,
|
||||
|
||||
/// Additional information of this layout that could be used by Javascripts and devtools.
|
||||
pub detailed_layout_info: Option<SpecificLayoutInfo>,
|
||||
pub specific_layout_info: Option<SpecificLayoutInfo>,
|
||||
}
|
||||
|
||||
pub(crate) struct IndependentLayoutResult {
|
||||
|
|
|
@ -89,7 +89,7 @@ pub(crate) struct BoxFragment {
|
|||
pub background_mode: BackgroundMode,
|
||||
|
||||
/// Additional information of from layout that could be used by Javascripts and devtools.
|
||||
pub detailed_layout_info: Option<SpecificLayoutInfo>,
|
||||
pub specific_layout_info: Option<SpecificLayoutInfo>,
|
||||
}
|
||||
|
||||
impl BoxFragment {
|
||||
|
@ -124,7 +124,7 @@ impl BoxFragment {
|
|||
scrollable_overflow_from_children,
|
||||
resolved_sticky_insets: AtomicRefCell::default(),
|
||||
background_mode: BackgroundMode::Normal,
|
||||
detailed_layout_info: None,
|
||||
specific_layout_info: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -177,8 +177,8 @@ impl BoxFragment {
|
|||
self.background_mode = BackgroundMode::None;
|
||||
}
|
||||
|
||||
pub fn with_detailed_layout_info(mut self, info: Option<SpecificLayoutInfo>) -> Self {
|
||||
self.detailed_layout_info = info;
|
||||
pub fn with_specific_layout_info(mut self, info: Option<SpecificLayoutInfo>) -> Self {
|
||||
self.specific_layout_info = info;
|
||||
self
|
||||
}
|
||||
|
||||
|
@ -354,13 +354,13 @@ impl BoxFragment {
|
|||
/// <https://www.w3.org/TR/css-tables-3/#table-wrapper-box>
|
||||
pub(crate) fn is_table_wrapper(&self) -> bool {
|
||||
matches!(
|
||||
self.detailed_layout_info,
|
||||
self.specific_layout_info,
|
||||
Some(SpecificLayoutInfo::TableWrapper)
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) fn has_collapsed_borders(&self) -> bool {
|
||||
match &self.detailed_layout_info {
|
||||
match &self.specific_layout_info {
|
||||
Some(SpecificLayoutInfo::TableCellWithCollapsedBorders) => true,
|
||||
Some(SpecificLayoutInfo::TableGridWithCollapsedBorders(_)) => true,
|
||||
Some(SpecificLayoutInfo::TableWrapper) => {
|
||||
|
|
|
@ -579,7 +579,7 @@ impl HoistedAbsolutelyPositionedBox {
|
|||
let mut new_fragment = {
|
||||
let content_size: LogicalVec2<Au>;
|
||||
let fragments;
|
||||
let mut detailed_layout_info: Option<SpecificLayoutInfo> = None;
|
||||
let mut specific_layout_info: Option<SpecificLayoutInfo> = None;
|
||||
match &context.contents {
|
||||
IndependentFormattingContextContents::Replaced(replaced) => {
|
||||
// https://drafts.csswg.org/css2/visudet.html#abs-replaced-width
|
||||
|
@ -648,7 +648,7 @@ impl HoistedAbsolutelyPositionedBox {
|
|||
block: block_size,
|
||||
};
|
||||
fragments = independent_layout.fragments;
|
||||
detailed_layout_info = independent_layout.detailed_layout_info;
|
||||
specific_layout_info = independent_layout.specific_layout_info;
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -696,7 +696,7 @@ impl HoistedAbsolutelyPositionedBox {
|
|||
// elements are not inflow.
|
||||
CollapsedBlockMargins::zero(),
|
||||
)
|
||||
.with_detailed_layout_info(detailed_layout_info)
|
||||
.with_specific_layout_info(specific_layout_info)
|
||||
};
|
||||
positioning_context.layout_collected_children(layout_context, &mut new_fragment);
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ pub fn process_resolved_style_request<'dom>(
|
|||
return None;
|
||||
}
|
||||
|
||||
let (content_rect, margins, padding, detailed_layout_info) = match fragment {
|
||||
let (content_rect, margins, padding, specific_layout_info) = match fragment {
|
||||
Fragment::Box(ref box_fragment) | Fragment::Float(ref box_fragment) => {
|
||||
let box_fragment = box_fragment.borrow();
|
||||
if style.get_box().position != Position::Static {
|
||||
|
@ -214,8 +214,8 @@ pub fn process_resolved_style_request<'dom>(
|
|||
let content_rect = box_fragment.content_rect;
|
||||
let margins = box_fragment.margin;
|
||||
let padding = box_fragment.padding;
|
||||
let detailed_layout_info = box_fragment.detailed_layout_info.clone();
|
||||
(content_rect, margins, padding, detailed_layout_info)
|
||||
let specific_layout_info = box_fragment.specific_layout_info.clone();
|
||||
(content_rect, margins, padding, specific_layout_info)
|
||||
},
|
||||
Fragment::Positioning(positioning_fragment) => {
|
||||
let content_rect = positioning_fragment.borrow().rect;
|
||||
|
@ -235,7 +235,7 @@ pub fn process_resolved_style_request<'dom>(
|
|||
//
|
||||
// > When an element generates a grid container box...
|
||||
if display.inside() == DisplayInside::Grid {
|
||||
if let Some(SpecificLayoutInfo::Grid(info)) = detailed_layout_info {
|
||||
if let Some(SpecificLayoutInfo::Grid(info)) = specific_layout_info {
|
||||
if let Some(value) = resolve_grid_template(&info, style, longhand_id) {
|
||||
return Some(value);
|
||||
}
|
||||
|
|
|
@ -1566,7 +1566,7 @@ impl<'a> TableLayout<'a> {
|
|||
content_inline_size_for_table: None,
|
||||
baselines: Baselines::default(),
|
||||
depends_on_block_constraints,
|
||||
detailed_layout_info: Some(SpecificLayoutInfo::TableWrapper),
|
||||
specific_layout_info: Some(SpecificLayoutInfo::TableWrapper),
|
||||
};
|
||||
|
||||
table_layout
|
||||
|
@ -1759,7 +1759,7 @@ impl<'a> TableLayout<'a> {
|
|||
None, /* clearance */
|
||||
CollapsedBlockMargins::zero(),
|
||||
)
|
||||
.with_detailed_layout_info(self.specific_layout_info_for_grid());
|
||||
.with_specific_layout_info(self.specific_layout_info_for_grid());
|
||||
}
|
||||
|
||||
let mut table_fragments = Vec::new();
|
||||
|
@ -1886,7 +1886,7 @@ impl<'a> TableLayout<'a> {
|
|||
CollapsedBlockMargins::zero(),
|
||||
)
|
||||
.with_baselines(baselines)
|
||||
.with_detailed_layout_info(self.specific_layout_info_for_grid())
|
||||
.with_specific_layout_info(self.specific_layout_info_for_grid())
|
||||
}
|
||||
|
||||
fn specific_layout_info_for_grid(&mut self) -> Option<SpecificLayoutInfo> {
|
||||
|
@ -2818,7 +2818,7 @@ impl TableSlotCell {
|
|||
);
|
||||
positioning_context.append(layout.positioning_context);
|
||||
|
||||
let detailed_layout_info = (table_style.get_inherited_table().border_collapse ==
|
||||
let specific_layout_info = (table_style.get_inherited_table().border_collapse ==
|
||||
BorderCollapse::Collapse)
|
||||
.then_some(SpecificLayoutInfo::TableCellWithCollapsedBorders);
|
||||
|
||||
|
@ -2834,7 +2834,7 @@ impl TableSlotCell {
|
|||
CollapsedBlockMargins::zero(),
|
||||
)
|
||||
.with_baselines(layout.layout.baselines)
|
||||
.with_detailed_layout_info(detailed_layout_info)
|
||||
.with_specific_layout_info(specific_layout_info)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,10 +65,10 @@ struct TaffyContainerContext<'a> {
|
|||
positioning_context: &'a mut PositioningContext,
|
||||
content_box_size_override: &'a ContainingBlock<'a>,
|
||||
style: &'a ComputedValues,
|
||||
detailed_layout_info: Option<SpecificLayoutInfo>,
|
||||
specific_layout_info: Option<SpecificLayoutInfo>,
|
||||
|
||||
/// Temporary location for children detailed info, which will be moved into child fragments
|
||||
child_detailed_layout_infos: Vec<Option<SpecificLayoutInfo>>,
|
||||
child_specific_layout_infos: Vec<Option<SpecificLayoutInfo>>,
|
||||
}
|
||||
|
||||
struct ChildIter(std::ops::Range<usize>);
|
||||
|
@ -268,8 +268,8 @@ impl taffy::LayoutPartialTree for TaffyContainerContext<'_> {
|
|||
};
|
||||
|
||||
child.child_fragments = layout.fragments;
|
||||
self.child_detailed_layout_infos[usize::from(node_id)] =
|
||||
layout.detailed_layout_info;
|
||||
self.child_specific_layout_infos[usize::from(node_id)] =
|
||||
layout.specific_layout_info;
|
||||
|
||||
let block_size = layout.content_block_size.to_f32_px();
|
||||
|
||||
|
@ -324,10 +324,10 @@ impl taffy::LayoutGridContainer for TaffyContainerContext<'_> {
|
|||
fn set_detailed_grid_info(
|
||||
&mut self,
|
||||
_node_id: taffy::NodeId,
|
||||
detailed_layout_info: taffy::DetailedGridInfo,
|
||||
specific_layout_info: taffy::DetailedGridInfo,
|
||||
) {
|
||||
self.detailed_layout_info = Some(SpecificLayoutInfo::Grid(Box::new(
|
||||
SpecificTaffyGridInfo::from_detailed_grid_layout(detailed_layout_info),
|
||||
self.specific_layout_info = Some(SpecificLayoutInfo::Grid(Box::new(
|
||||
SpecificTaffyGridInfo::from_detailed_grid_layout(specific_layout_info),
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
@ -371,8 +371,8 @@ impl ComputeInlineContentSizes for TaffyContainer {
|
|||
content_box_size_override: containing_block,
|
||||
style,
|
||||
source_child_nodes: &self.children,
|
||||
detailed_layout_info: None,
|
||||
child_detailed_layout_infos: vec![None; self.children.len()],
|
||||
specific_layout_info: None,
|
||||
child_specific_layout_infos: vec![None; self.children.len()],
|
||||
};
|
||||
|
||||
let (max_content_output, min_content_output) = match style.clone_display().inside() {
|
||||
|
@ -427,8 +427,8 @@ impl TaffyContainer {
|
|||
content_box_size_override,
|
||||
style: content_box_size_override.style,
|
||||
source_child_nodes: &self.children,
|
||||
detailed_layout_info: None,
|
||||
child_detailed_layout_infos: vec![None; self.children.len()],
|
||||
specific_layout_info: None,
|
||||
child_specific_layout_infos: vec![None; self.children.len()],
|
||||
};
|
||||
|
||||
let container_style = &content_box_size_override.style;
|
||||
|
@ -473,7 +473,7 @@ impl TaffyContainer {
|
|||
};
|
||||
|
||||
// Convert `taffy::Layout` into Servo `Fragment`s
|
||||
// with container_ctx.child_detailed_layout_infos will also moved to the corresponding `Fragment`s
|
||||
// with container_ctx.child_specific_layout_infos will also moved to the corresponding `Fragment`s
|
||||
let fragments: Vec<Fragment> = self
|
||||
.children
|
||||
.iter()
|
||||
|
@ -541,8 +541,8 @@ impl TaffyContainer {
|
|||
.map(Au::from_f32_px),
|
||||
);
|
||||
|
||||
let child_detailed_layout_info: Option<SpecificLayoutInfo> =
|
||||
std::mem::take(&mut container_ctx.child_detailed_layout_infos[child_id]);
|
||||
let child_specific_layout_info: Option<SpecificLayoutInfo> =
|
||||
std::mem::take(&mut container_ctx.child_specific_layout_infos[child_id]);
|
||||
|
||||
match &mut child.taffy_level_box {
|
||||
TaffyItemBoxInner::InFlowBox(independent_box) => {
|
||||
|
@ -562,7 +562,7 @@ impl TaffyContainer {
|
|||
first: output.first_baselines.y.map(Au::from_f32_px),
|
||||
last: None,
|
||||
})
|
||||
.with_detailed_layout_info(child_detailed_layout_info),
|
||||
.with_specific_layout_info(child_specific_layout_info),
|
||||
));
|
||||
|
||||
child
|
||||
|
@ -628,7 +628,7 @@ impl TaffyContainer {
|
|||
// on the assumption that the node's size does not depend on block constraints.
|
||||
depends_on_block_constraints: true,
|
||||
|
||||
detailed_layout_info: container_ctx.detailed_layout_info,
|
||||
specific_layout_info: container_ctx.specific_layout_info,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue