mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
layout: Add a LayoutBoxBase
to inline boxes (#36513)
`LayoutBoxBase` will soon contain laid out `Fragment`s of a box tree node in order to facilitate incremental layout and also layout queries. This is currently missing for inline boxes, so this change adds a `LayoutBoxBase` to them. Testing: This should not change any observable behavior, so existing WPT suites should suffice for testing. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
440739090f
commit
d46a17a487
6 changed files with 29 additions and 24 deletions
|
@ -200,8 +200,10 @@ pub(crate) enum InlineItem {
|
|||
impl InlineItem {
|
||||
pub(crate) fn invalidate_cached_fragment(&self) {
|
||||
match self {
|
||||
InlineItem::StartInlineBox(..) | InlineItem::EndInlineBox | InlineItem::TextRun(..) => {
|
||||
InlineItem::StartInlineBox(inline_box) => {
|
||||
inline_box.borrow().base.invalidate_cached_fragment()
|
||||
},
|
||||
InlineItem::EndInlineBox | InlineItem::TextRun(..) => {},
|
||||
InlineItem::OutOfFlowAbsolutelyPositionedBox(positioned_box, ..) => {
|
||||
positioned_box
|
||||
.borrow()
|
||||
|
@ -732,6 +734,7 @@ impl InlineFormattingContextLayout<'_> {
|
|||
);
|
||||
|
||||
self.depends_on_block_constraints |= inline_box
|
||||
.base
|
||||
.style
|
||||
.depends_on_block_constraints_due_to_relative_positioning(
|
||||
self.containing_block.style.writing_mode,
|
||||
|
@ -1603,7 +1606,7 @@ impl InlineFormattingContext {
|
|||
InlineItem::StartInlineBox(inline_box) => {
|
||||
let inline_box = &mut *inline_box.borrow_mut();
|
||||
if let Some(font) = get_font_for_first_font_for_style(
|
||||
&inline_box.style,
|
||||
&inline_box.base.style,
|
||||
&layout_context.font_context,
|
||||
) {
|
||||
inline_box.default_font_index = Some(add_or_get_font(
|
||||
|
@ -2309,6 +2312,7 @@ impl<'layout_data> ContentSizesComputation<'layout_data> {
|
|||
.percentages_relative_to(zero);
|
||||
let border = layout_style.border_width(writing_mode);
|
||||
let margin = inline_box
|
||||
.base
|
||||
.style
|
||||
.margin(writing_mode)
|
||||
.percentages_relative_to(zero)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue