mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
layout: Implement node geometry queries against BoxTree
's Fragment
(#36663)
This is a followup to #36629, continuing to implement script-based layout queries using the `Fragment`s attached to the `BoxTree`. In this change, geometry queris (apart from parent offset) are calculated using `Fragment`s hanging of the `BoxTree`. In order to make this work, all `Fragment`s for inlines split by blocks, need to be accessible in the `BoxTree`. This required some changes to the way that box tree items were stored in DOM `BoxSlot`s. Now every inline level item can have more than a single `BoxTree` item. These are carefully collected by the `InlineFormattingContextBuilder` -- currently a bit fragile, but with more documentation. Testing: There are tests for these changes. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
cc91395397
commit
b63a1818c4
13 changed files with 197 additions and 170 deletions
|
@ -744,7 +744,7 @@ impl InlineFormattingContextLayout<'_> {
|
|||
self.containing_block,
|
||||
self.layout_context,
|
||||
self.current_inline_container_state(),
|
||||
inline_box.is_last_fragment,
|
||||
inline_box.is_last_split,
|
||||
inline_box
|
||||
.default_font_index
|
||||
.map(|index| &self.ifc.font_metrics[index].metrics),
|
||||
|
@ -773,7 +773,7 @@ impl InlineFormattingContextLayout<'_> {
|
|||
);
|
||||
}
|
||||
|
||||
if inline_box.is_first_fragment {
|
||||
if inline_box.is_first_split {
|
||||
self.current_line_segment.inline_size += inline_box_state.pbm.padding.inline_start +
|
||||
inline_box_state.pbm.border.inline_start +
|
||||
inline_box_state.pbm.margin.inline_start.auto_is(Au::zero);
|
||||
|
@ -2349,10 +2349,10 @@ impl<'layout_data> ContentSizesComputation<'layout_data> {
|
|||
.auto_is(Au::zero);
|
||||
|
||||
let pbm = margin + padding + border;
|
||||
if inline_box.is_first_fragment {
|
||||
if inline_box.is_first_split {
|
||||
self.add_inline_size(pbm.inline_start);
|
||||
}
|
||||
if inline_box.is_last_fragment {
|
||||
if inline_box.is_last_split {
|
||||
self.ending_inline_pbm_stack.push(pbm.inline_end);
|
||||
} else {
|
||||
self.ending_inline_pbm_stack.push(Au::zero());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue