Skip to content

Truly independent web browser

LibWeb: Propagate flex and grid baselines through inline-blocks

Andreas Klingabec55712171
diff --git a/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs
index dc225098a73..46f39b45e63 100644
--- a/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs
@@ -3396,14 +3396,22 @@ impl<'pass> BlockFormattingContext<'pass> {
};
let mut baselines = formatting_context::DerivedBaselines::default();
- let mut note_baselines = |first: Option<CssPixels>, last: Option<CssPixels>| {
- if let Some(first) = first {
- baselines.first = Some(baselines.first.map_or(first, |baseline| baseline.min(first)));
- }
- if let Some(last) = last {
- baselines.last = Some(baselines.last.map_or(last, |baseline| baseline.max(last)));
- }
- };
+ let mut note_baselines =
+ |first: Option<CssPixels>, last: Option<CssPixels>, inline_alignment: Option<CssPixels>| {
+ if let Some(first) = first {
+ baselines.first = Some(baselines.first.map_or(first, |baseline| baseline.min(first)));
+ }
+ if let Some(last) = last {
+ baselines.last = Some(baselines.last.map_or(last, |baseline| baseline.max(last)));
+ }
+ if let Some(inline_alignment) = inline_alignment {
+ baselines.inline_alignment = Some(
+ baselines
+ .inline_alignment
+ .map_or(inline_alignment, |baseline| baseline.max(inline_alignment)),
+ );
+ }
+ };
let mut root_line_count = 0;
let mut root_line_data_of_columns = Vec::new();
let mut rows = Vec::new();
@@ -3463,6 +3471,10 @@ impl<'pass> BlockFormattingContext<'pass> {
note_baselines(
column_baselines.first.map(|baseline| baseline + row_block_offset),
column_baselines.last.map(|baseline| baseline + row_block_offset),
+ column_baselines
+ .inline_alignment
+ .or(column_baselines.last)
+ .map(|baseline| baseline + row_block_offset),
);
let Some(outgoing) = outcome.outgoing else {
break;
@@ -3518,6 +3530,14 @@ impl<'pass> BlockFormattingContext<'pass> {
formatting_context::BaselineSet::Last,
formatting_context::ChildBaselineSource::Own,
),
+ formatting_context::baseline_of_child_for_purpose(
+ self.run.records,
+ &self.run.callbacks,
+ spanner,
+ formatting_context::BaselineSet::Last,
+ formatting_context::ChildBaselineSource::Own,
+ formatting_context::BaselinePurpose::InlineAlignment,
+ ),
);
row_block_offset = row_block_offset.max(bottom_of_spanner_margin_box);
let Some(next) = self.sibling_boxes_from(self.next_sibling(spanner)).next() else {
diff --git a/Libraries/LibWeb/Rust/src/layout/flex_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/flex_formatting_context.rs
index bdbe030613b..e0f8b55ec77 100644
--- a/Libraries/LibWeb/Rust/src/layout/flex_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/flex_formatting_context.rs
@@ -3640,6 +3640,13 @@ impl<'pass> FlexFormattingContext<'pass> {
formatting_context::place_child(&self.run, item.box_, offset, None);
}
self.derived_baselines_of_root_box = DerivedBaselines {
+ inline_alignment: self.flex_lines.len().checked_sub(1).and_then(|line_index| {
+ self.baseline_of_line_for_purpose(
+ line_index,
+ formatting_context::BaselineSet::Last,
+ formatting_context::BaselinePurpose::InlineAlignment,
+ )
+ }),
first: self.baseline_of_line(0, formatting_context::BaselineSet::First),
last: self
.flex_lines
@@ -3651,6 +3658,15 @@ impl<'pass> FlexFormattingContext<'pass> {
// https://drafts.csswg.org/css-flexbox-1/#flex-baselines
fn baseline_of_line(&self, line_index: usize, baseline_set: formatting_context::BaselineSet) -> Option<CssPixels> {
+ self.baseline_of_line_for_purpose(line_index, baseline_set, formatting_context::BaselinePurpose::Container)
+ }
+
+ fn baseline_of_line_for_purpose(
+ &self,
+ line_index: usize,
+ baseline_set: formatting_context::BaselineSet,
+ purpose: formatting_context::BaselinePurpose,
+ ) -> Option<CssPixels> {
let items = &self.flex_lines.get(line_index)?.items;
// 1. If any of the flex items on the flex container's first line participate in baseline alignment, the flex
// container's main-axis baseline is the baseline of those flex items.
@@ -3677,12 +3693,13 @@ impl<'pass> FlexFormattingContext<'pass> {
.max_by_key(|&index| self.flex_items[index].main_offset),
})?;
let source = self.baseline_source_for_item(item);
- formatting_context::baseline_of_child(
+ formatting_context::baseline_of_child_for_purpose(
self.run.records,
&self.run.callbacks,
self.flex_items[item].box_,
baseline_set,
source,
+ purpose,
)
}
diff --git a/Libraries/LibWeb/Rust/src/layout/formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/formatting_context.rs
index c3c785af2c8..cc063d57a1d 100644
--- a/Libraries/LibWeb/Rust/src/layout/formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/formatting_context.rs
@@ -655,7 +655,7 @@ pub(crate) fn box_baseline_with_content_baselines(
callbacks: &LayoutPass<'_>,
box_: Node,
used: &UsedValues,
- mut baseline_set: BaselineSet,
+ baseline_set: BaselineSet,
content_baselines: DerivedBaselines,
) -> CssPixels {
let facts = NodeFacts::new(callbacks, box_);
@@ -706,21 +706,8 @@ pub(crate) fn box_baseline_with_content_baselines(
return used.margin_box_top(collapsed) + used.content_block_size.get() + used.border_box_bottom(collapsed);
}
- // https://drafts.csswg.org/css-inline-3/#baseline-source
- // auto: Specifies last-baseline alignment for inline-block, first-baseline alignment for everything else.
- // NB: Callers ask an inline-level box for its last baseline set, since that is what CSS2's inline-block rule below
- // describes; inline-level flex and grid containers participate with their first baseline set instead.
let display = facts.display();
let is_flex_or_grid_container = display.is_flex_inside() || display.is_grid_inside();
- if display.is_inline_outside() && is_flex_or_grid_container {
- baseline_set = BaselineSet::First;
- }
- // https://www.w3.org/TR/CSS22/tables.html#height-layout
- // "The baseline of an 'inline-table' is the baseline of the first row of the table." The table wrapper box of an
- // inline-table is displayed like an inline-block, but is not one.
- if display.is_inline_outside() && facts.is_table_wrapper() {
- baseline_set = BaselineSet::First;
- }
// https://drafts.csswg.org/css2/#propdef-vertical-align
// The baseline of an 'inline-block' is the baseline of its last line box in the normal flow, unless it has either
@@ -762,6 +749,57 @@ pub(crate) fn box_baseline_with_content_baselines(
used.margin_box_block_size(collapsed)
}
+#[derive(Clone, Copy, PartialEq, Eq)]
+pub(crate) enum BaselinePurpose {
+ Container,
+ InlineAlignment,
+}
+
+pub(crate) fn inline_box_baseline(
+ callbacks: &LayoutPass<'_>,
+ box_: Node,
+ used: &UsedValues,
+ content_baselines: DerivedBaselines,
+) -> CssPixels {
+ box_baseline_for_purpose(
+ callbacks,
+ box_,
+ used,
+ BaselineSet::Last,
+ content_baselines,
+ BaselinePurpose::InlineAlignment,
+ )
+}
+
+fn box_baseline_for_purpose(
+ callbacks: &LayoutPass<'_>,
+ box_: Node,
+ used: &UsedValues,
+ mut baseline_set: BaselineSet,
+ mut content_baselines: DerivedBaselines,
+ purpose: BaselinePurpose,
+) -> CssPixels {
+ if purpose == BaselinePurpose::InlineAlignment {
+ let facts = NodeFacts::new(callbacks, box_);
+ let display = facts.display();
+ // https://drafts.csswg.org/css-inline-3/#baseline-source
+ // auto: Specifies last-baseline alignment for inline-block, first-baseline alignment for everything else.
+ // INTEROP: Flex and grid containers contribute their first baseline through inline-block ancestors too.
+ // NB: A button's anonymous content wrapper preserves the last baseline of multiline button content.
+ let flex_or_grid_baseline =
+ (display.is_flex_inside() || display.is_grid_inside()) && !facts.is_anonymous_button_content_wrapper();
+ // https://www.w3.org/TR/CSS22/tables.html#height-layout
+ // The baseline of an 'inline-table' is the baseline of the first row of the table.
+ let inline_table_baseline = display.is_inline_outside() && facts.is_table_wrapper();
+ if flex_or_grid_baseline || inline_table_baseline {
+ baseline_set = BaselineSet::First;
+ } else {
+ content_baselines.last = content_baselines.inline_alignment.or(content_baselines.last);
+ }
+ }
+ box_baseline_with_content_baselines(callbacks, box_, used, baseline_set, content_baselines)
+}
+
/// First and last baseline sets derived for one box, relative to its content
/// box. A formatting context derives its own root box's baselines during its
/// run and records them on the instance; run_formatting_context, the side
@@ -771,6 +809,9 @@ pub(crate) fn box_baseline_with_content_baselines(
pub(crate) struct DerivedBaselines {
pub(crate) first: Option<CssPixels>,
pub(crate) last: Option<CssPixels>,
+ // NB: Inline alignment can export a descendant flex/grid first baseline through block containers while
+ // ordinary container derivation must retain the distinct last baseline set.
+ pub(crate) inline_alignment: Option<CssPixels>,
}
// NOTE: A box can be baselined more than once (e.g. table cells are laid out
@@ -779,6 +820,7 @@ pub(crate) struct DerivedBaselines {
// resetting the presence bits does not perturb payloads observed by the
// existing derivation flow.
pub(crate) fn store_derived_baselines(used: &UsedValues, baselines: DerivedBaselines) {
+ used.inline_alignment_baseline.set(baselines.inline_alignment);
used.has_first_baseline.set(baselines.first.is_some());
if let Some(value) = baselines.first {
used.first_baseline.set(value);
@@ -799,22 +841,44 @@ pub(crate) fn derive_baselines(records: &RunRecords, callbacks: &LayoutPass<'_>,
.or_else(|| own_line_data.as_ref()?.lines().next());
if let Some(first) = first {
let last = lines.rfind(|line| !line.is_empty).unwrap_or(first);
- let baseline_for_line_box = |line: inline_content::LineRecord, baseline_set: BaselineSet| -> CssPixels {
- if !line.has_block_level_box {
- return line.physical_vertical_end() - line.block_length + line.baseline;
- }
- assert_eq!(line.layout_fragment_count, 1);
- let fragment_node = line
- .first_fragment_node
- .expect("block-level line must have one fragment");
- let block_child_state = records.used_values(fragment_node);
- let child_offset_from_margin_edge = block_child_state.content_offset.get().y
- - block_child_state.margin_box_top(block_child_state.uses_collapsing_borders_model.get());
- child_offset_from_margin_edge + box_baseline(callbacks, fragment_node, block_child_state, baseline_set)
- };
+ let baseline_for_line_box =
+ |line: inline_content::LineRecord, baseline_set: BaselineSet, purpose: BaselinePurpose| -> CssPixels {
+ if !line.has_block_level_box {
+ return line.physical_vertical_end() - line.block_length + line.baseline;
+ }
+ assert_eq!(line.layout_fragment_count, 1);
+ let fragment_node = line
+ .first_fragment_node
+ .expect("block-level line must have one fragment");
+ let block_child_state = records.used_values(fragment_node);
+ let child_offset_from_margin_edge = block_child_state.content_offset.get().y
+ - block_child_state.margin_box_top(block_child_state.uses_collapsing_borders_model.get());
+ child_offset_from_margin_edge
+ + box_baseline_for_purpose(
+ callbacks,
+ fragment_node,
+ block_child_state,
+ baseline_set,
+ block_child_state.content_baselines_from_cells(),
+ purpose,
+ )
+ };
return DerivedBaselines {
- first: Some(baseline_for_line_box(first, BaselineSet::First)),
- last: Some(baseline_for_line_box(last, BaselineSet::Last)),
+ first: Some(baseline_for_line_box(
+ first,
+ BaselineSet::First,
+ BaselinePurpose::Container,
+ )),
+ last: Some(baseline_for_line_box(
+ last,
+ BaselineSet::Last,
+ BaselinePurpose::Container,
+ )),
+ inline_alignment: Some(baseline_for_line_box(
+ last,
+ BaselineSet::Last,
+ BaselinePurpose::InlineAlignment,
+ )),
};
}
@@ -825,7 +889,7 @@ pub(crate) fn derive_baselines(records: &RunRecords, callbacks: &LayoutPass<'_>,
// Derive baselines from the first/last in-flow child that has a baseline set of its own.
// NB: Flex and grid containers derive their baselines from their items instead.
let container_display = facts.display();
- let baseline_from_children = |baseline_set: BaselineSet| -> Option<CssPixels> {
+ let baseline_from_children = |baseline_set: BaselineSet, purpose: BaselinePurpose| -> Option<CssPixels> {
let mut next_child = match baseline_set {
BaselineSet::First => callbacks.first_child(box_),
BaselineSet::Last => callbacks.last_child(box_),
@@ -852,16 +916,23 @@ pub(crate) fn derive_baselines(records: &RunRecords, callbacks: &LayoutPass<'_>,
if facts.is_table_wrapper() && !child_facts.display().is_table_inside() {
continue;
}
- if let Some(baseline) = baseline_of_child(records, callbacks, child, baseline_set, ChildBaselineSource::Own)
- {
+ if let Some(baseline) = baseline_of_child_for_purpose(
+ records,
+ callbacks,
+ child,
+ baseline_set,
+ ChildBaselineSource::Own,
+ purpose,
+ ) {
return Some(baseline);
}
}
None
};
DerivedBaselines {
- first: baseline_from_children(BaselineSet::First),
- last: baseline_from_children(BaselineSet::Last),
+ first: baseline_from_children(BaselineSet::First, BaselinePurpose::Container),
+ last: baseline_from_children(BaselineSet::Last, BaselinePurpose::Container),
+ inline_alignment: baseline_from_children(BaselineSet::Last, BaselinePurpose::InlineAlignment),
}
}
@@ -880,6 +951,24 @@ pub(crate) fn baseline_of_child(
child: Node,
baseline_set: BaselineSet,
source: ChildBaselineSource,
+) -> Option<CssPixels> {
+ baseline_of_child_for_purpose(
+ records,
+ callbacks,
+ child,
+ baseline_set,
+ source,
+ BaselinePurpose::Container,
+ )
+}
+
+pub(crate) fn baseline_of_child_for_purpose(
+ records: &RunRecords,
+ callbacks: &LayoutPass<'_>,
+ child: Node,
+ baseline_set: BaselineSet,
+ source: ChildBaselineSource,
+ purpose: BaselinePurpose,
) -> Option<CssPixels> {
let child_state = records.used_values_if_owned(child)?;
let has_baseline = match baseline_set {
@@ -900,7 +989,17 @@ pub(crate) fn baseline_of_child(
);
}
let child_offset_from_margin_edge = child_state.content_offset.get().y - child_state.margin_box_top(collapsed);
- Some(child_offset_from_margin_edge + box_baseline(callbacks, child, child_state, baseline_set))
+ Some(
+ child_offset_from_margin_edge
+ + box_baseline_for_purpose(
+ callbacks,
+ child,
+ child_state,
+ baseline_set,
+ child_state.content_baselines_from_cells(),
+ purpose,
+ ),
+ )
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
@@ -2411,6 +2510,7 @@ fn leave_own_frame(
})
};
let orthogonal_flow_baselines = DerivedBaselines {
+ inline_alignment: None,
first: along_parent_horizontal_axis(result.baselines.first),
last: along_parent_horizontal_axis(result.baselines.last),
};
@@ -3208,3 +3308,98 @@ fn layout_subtree_with_frozen_root_geometry(run: &FormattingContextRun<'_>) {
None,
);
}
+
+#[cfg(test)]
+mod baseline_tests {
+ use super::*;
+ use crate::css::computed_values::{BoxValues, GroupPayloadRef, clone_group_payload, release_group_payload};
+ use crate::css::css_enums::keyword;
+ use crate::css::display::FfiDisplay;
+ use crate::css::table_group_builder::group_index;
+ use crate::layout::layout_node_arena::LayoutNodeArena;
+ use crate::layout::node_data::{NodeConstructionFacts, NodeKind, StylePayloadsRef};
+ use crate::layout::run_records::LayoutScratch;
+
+ unsafe extern "C" fn unused_container_bases(
+ _: *mut c_void,
+ _: u32,
+ ) -> svg_formatting_context::FfiContainerLengthBases {
+ unreachable!("baseline derivation does not resolve container lengths")
+ }
+
+ #[test]
+ fn block_derivation_preserves_flex_last_baseline() {
+ check_block_derivation(keyword::FLEX);
+ }
+
+ #[test]
+ fn block_derivation_preserves_grid_last_baseline() {
+ check_block_derivation(keyword::GRID);
+ }
+
+ fn check_block_derivation(display: u16) {
+ let mut arena = LayoutNodeArena::new();
+ let scratch = LayoutScratch::default();
+ let mut child_style = FfiStylePayloads {
+ groups: std::array::from_fn(|index| GroupPayloadRef::default_payload(index).as_ptr()),
+ };
+ let mut parent_style = child_style;
+ // SAFETY: The source is the immortal default box payload. The clone is private until installed below.
+ let parent_box = unsafe { clone_group_payload(group_index::BOX, parent_style.groups[group_index::BOX]) };
+ // SAFETY: The clone has the BoxValues layout and no readers yet.
+ unsafe { (*parent_box.cast::<BoxValues>()).display = FfiDisplay::block() };
+ parent_style.groups[group_index::BOX] = parent_box;
+ // SAFETY: The source is the immortal default box payload. The clone is private until installed below.
+ let child_box = unsafe { clone_group_payload(group_index::BOX, child_style.groups[group_index::BOX]) };
+ // SAFETY: The clone has the BoxValues layout and no readers yet.
+ unsafe { (*child_box.cast::<BoxValues>()).display = FfiDisplay::from_single_keyword(display).unwrap() };
+ child_style.groups[group_index::BOX] = child_box;
+ let facts = NodeConstructionFacts {
+ kind: NodeKind::BlockContainer,
+ is_anonymous: false,
+ is_html_input_element: false,
+ is_html_html_element: false,
+ is_document_element: false,
+ is_in_user_agent_shadow_tree: false,
+ uses_button_layout: false,
+ is_editing_host: false,
+ is_body: false,
+ dom_paint_facts: 0,
+ style_node: 0,
+ };
+ let parent = arena.allocate(facts);
+ let child = arena.allocate(facts);
+ arena.set_node_style(parent, 0, StylePayloadsRef::new(&parent_style));
+ arena.set_node_style(child, 0, StylePayloadsRef::new(&child_style));
+ arena.insert_child(parent, child, Node::INVALID);
+ let callbacks = LayoutPass::new(
+ &arena,
+ &scratch,
+ layout_pass::ContainerLengthBasesQuery::new(std::ptr::null_mut(), unused_container_bases).sealed(),
+ CssPixels::from_integer(800),
+ CssPixels::from_integer(600),
+ false,
+ );
+ let parent_used = UsedValues::default();
+ RunRecords::with_root(&scratch, &arena, parent, Node::INVALID, &parent_used, |records| {
+ let child_used = records.register(child, UsedValues::default());
+ store_derived_baselines(
+ child_used,
+ DerivedBaselines {
+ first: Some(CssPixels::from_integer(10)),
+ last: Some(CssPixels::from_integer(30)),
+ inline_alignment: None,
+ },
+ );
+ let baselines = derive_baselines(records, &callbacks, parent);
+ assert_eq!(baselines.first, Some(CssPixels::from_integer(10)));
+ assert_eq!(baselines.last, Some(CssPixels::from_integer(30)));
+ assert_eq!(baselines.inline_alignment, Some(CssPixels::from_integer(10)));
+ });
+ arena
+ .free_subtree(parent)
+ .destroy_shells_and_invoke_callbacks(&crate::stage::MainThread::for_test());
+ release_group_payload(group_index::BOX, child_box);
+ release_group_payload(group_index::BOX, parent_box);
+ }
+}
diff --git a/Libraries/LibWeb/Rust/src/layout/grid_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/grid_formatting_context.rs
index 81e78aabba8..d481203613f 100644
--- a/Libraries/LibWeb/Rust/src/layout/grid_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/grid_formatting_context.rs
@@ -4145,6 +4145,7 @@ impl<'pass> GridFormattingContext<'pass> {
}
self.place_baseline_aligned_items(&baseline_aligned_items);
self.derived_baselines_of_root_box = DerivedBaselines {
+ inline_alignment: None,
first: self.baseline_of_items(formatting_context::BaselineSet::First),
last: self.baseline_of_items(formatting_context::BaselineSet::Last),
};
diff --git a/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs b/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs
index b1c1c7757d5..4c72259e1c5 100644
--- a/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs
+++ b/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs
@@ -261,6 +261,7 @@ pub(crate) struct IntrinsicInlineMeasurementLayout {
pub(crate) first_baseline: CssPixels,
pub(crate) has_last_baseline: bool,
pub(crate) last_baseline: CssPixels,
+ pub(crate) inline_alignment_baseline: Option<CssPixels>,
}
impl IntrinsicMeasurement for IntrinsicInlineSizeMeasurement {
@@ -7360,6 +7361,7 @@ mod tests {
first_baseline: CssPixels::from_raw(64),
has_last_baseline: true,
last_baseline: CssPixels::from_raw(128),
+ inline_alignment_baseline: None,
}),
depends_on_percentage_block_size: false,
depends_on_percentage_inline_basis: false,
@@ -7637,6 +7639,7 @@ mod tests {
let value = TableCellMeasurement {
automatic_content_block_size: CssPixels::from_raw(320),
baselines: crate::layout::layout_node_arena::DerivedBaselines {
+ inline_alignment: None,
first: Some(CssPixels::from_raw(64)),
last: None,
},
diff --git a/Libraries/LibWeb/Rust/src/layout/line_builder.rs b/Libraries/LibWeb/Rust/src/layout/line_builder.rs
index dbe7dfc893c..c3f3c500fb5 100644
--- a/Libraries/LibWeb/Rust/src/layout/line_builder.rs
+++ b/Libraries/LibWeb/Rust/src/layout/line_builder.rs
@@ -859,20 +859,12 @@ impl<'builder, 'context> LineBuilder<'builder, 'context> {
let style = self.style(style_source);
let fragment_baseline = if is_block_ellipsis || self.facts(node).is_text_node() {
Self::baseline_for_style(style, style.line_height())
- } else if let Some(content_baselines) = content_baselines {
- formatting_context::box_baseline_with_content_baselines(
- &self.context().callbacks,
- node,
- self.context().used(node),
- formatting_context::BaselineSet::Last,
- content_baselines,
- )
} else {
- formatting_context::box_baseline(
+ formatting_context::inline_box_baseline(
&self.context().callbacks,
node,
self.context().used(node),
- formatting_context::BaselineSet::Last,
+ content_baselines.unwrap_or_else(|| self.context().used(node).content_baselines_from_cells()),
)
};
self.line_mut(line_index).fragments[fragment_index].baseline = fragment_baseline;
diff --git a/Libraries/LibWeb/Rust/src/layout/math_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/math_formatting_context.rs
index bc2d14e8554..5167aebebe5 100644
--- a/Libraries/LibWeb/Rust/src/layout/math_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/math_formatting_context.rs
@@ -1425,6 +1425,7 @@ pub(super) fn layout_operator(run: &FormattingContextRun<'_>, input: &LayoutInpu
result.automatic_content_inline_size = inline_size;
result.automatic_content_block_size = ascent + descent;
result.baselines = DerivedBaselines {
+ inline_alignment: None,
first: Some(ascent),
last: Some(ascent),
};
@@ -2282,6 +2283,7 @@ impl<'pass> MathFormattingContext<'pass> {
}
self.derived_baselines_of_root_box = DerivedBaselines {
+ inline_alignment: None,
first: Some(content.ascent),
last: Some(content.ascent),
};
diff --git a/Libraries/LibWeb/Rust/src/layout/sizing_context.rs b/Libraries/LibWeb/Rust/src/layout/sizing_context.rs
index 2ed23caa315..bffd32ff2e5 100644
--- a/Libraries/LibWeb/Rust/src/layout/sizing_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/sizing_context.rs
@@ -2333,6 +2333,7 @@ impl<'pass> SizingContext<'pass> {
first_baseline: used.first_baseline.get(),
has_last_baseline: used.has_last_baseline.get(),
last_baseline: used.last_baseline.get(),
+ inline_alignment_baseline: used.inline_alignment_baseline.get(),
}),
depends_on_percentage_block_size: result.depends_on_percentage_block_size,
depends_on_percentage_inline_basis: self.measurement_root_observes_percentage_inline_basis(node),
@@ -2378,6 +2379,7 @@ impl<'pass> SizingContext<'pass> {
used.is_collapsed_borders_table_box
.set(measurement.is_collapsed_borders_table_box);
let baselines = DerivedBaselines {
+ inline_alignment: measurement.inline_alignment_baseline,
first: measurement.has_first_baseline.then_some(measurement.first_baseline),
last: measurement.has_last_baseline.then_some(measurement.last_baseline),
};
diff --git a/Libraries/LibWeb/Rust/src/layout/table_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/table_formatting_context.rs
index 4fc53c1d698..a5ca2b798d6 100644
--- a/Libraries/LibWeb/Rust/src/layout/table_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/table_formatting_context.rs
@@ -3367,6 +3367,7 @@ impl<'pass> TableFormattingContext<'pass> {
self.used_values(self.rows[row_index].box_).content_offset.get().y + self.row_baseline(row_index)
};
let baselines_of_rows = |rows: &[usize], content_block_offset: CssPixels| DerivedBaselines {
+ inline_alignment: None,
first: rows
.first()
.map(|&row_index| baseline_in_wrapper(row_index) - content_block_offset),
@@ -3379,6 +3380,7 @@ impl<'pass> TableFormattingContext<'pass> {
formatting_context::store_derived_baselines(
self.used_values(self.rows[row_index].box_),
DerivedBaselines {
+ inline_alignment: None,
first: baseline,
last: baseline,
},
diff --git a/Libraries/LibWeb/Rust/src/layout/used_values.rs b/Libraries/LibWeb/Rust/src/layout/used_values.rs
index c1a401e1dbb..3f0357005dd 100644
--- a/Libraries/LibWeb/Rust/src/layout/used_values.rs
+++ b/Libraries/LibWeb/Rust/src/layout/used_values.rs
@@ -391,6 +391,7 @@ pub(crate) struct UsedValues {
pub first_baseline: Cell<CssPixels>,
pub has_last_baseline: Cell<bool>,
pub last_baseline: Cell<CssPixels>,
+ pub inline_alignment_baseline: Cell<Option<CssPixels>>,
// Layout outputs, deliberately outside the cell state.
pub depends_on_percentage_block_size: Cell<bool>,
@@ -447,6 +448,7 @@ impl Default for UsedValues {
first_baseline: Cell::new(zero),
has_last_baseline: Cell::new(false),
last_baseline: Cell::new(zero),
+ inline_alignment_baseline: Cell::new(None),
depends_on_percentage_block_size: Cell::new(false),
has_descendant_that_depends_on_percentage_block_size: Cell::new(false),
line_data: RefCell::new(LineDataState::Empty),
@@ -537,6 +539,7 @@ impl UsedValues {
pub(crate) fn content_baselines_from_cells(&self) -> DerivedBaselines {
DerivedBaselines {
+ inline_alignment: self.inline_alignment_baseline.get(),
first: self.has_first_baseline.get().then(|| self.first_baseline.get()),
last: self.has_last_baseline.get().then(|| self.last_baseline.get()),
}
@@ -605,6 +608,7 @@ impl UsedValues {
self.block_size_constraint.set(state.block_size_constraint);
self.has_first_baseline.set(state.has_first_baseline);
self.has_last_baseline.set(state.has_last_baseline);
+ self.inline_alignment_baseline.set(state.inline_alignment_baseline);
}
pub(crate) fn own_metrics_are_sealed(&self) -> bool {
@@ -694,6 +698,7 @@ used_values_cell_state! {
first_baseline: CssPixels,
has_last_baseline: bool,
last_baseline: CssPixels,
+ inline_alignment_baseline: Option<CssPixels>,
}
impl UsedValuesCellState {
@@ -734,6 +739,7 @@ impl UsedValuesCellState {
std::mem::swap(&mut self.inline_size_constraint, &mut self.block_size_constraint);
self.has_first_baseline = false;
self.has_last_baseline = false;
+ self.inline_alignment_baseline = None;
}
self
}
diff --git a/Tests/LibWeb/Layout/expected/empty-editable-shows-cursor.txt b/Tests/LibWeb/Layout/expected/empty-editable-shows-cursor.txt
index 962dcb6b8d1..056713e117d 100644
--- a/Tests/LibWeb/Layout/expected/empty-editable-shows-cursor.txt
+++ b/Tests/LibWeb/Layout/expected/empty-editable-shows-cursor.txt
@@ -1,30 +1,30 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 67.203125 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 69 0+0+0] [BFC] children: not-inline
BlockContainer <(anonymous)> at [0,0] [0+0+0 800 0+0+0] [0+0+0 0 0+0+0] children: inline
TextNode <#text> (not painted)
- BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 51.203125 0+0+8] children: not-inline
+ BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 53 0+0+8] children: not-inline
BlockContainer <(anonymous)> at [8,8] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline
TextNode <#text> (not painted)
BlockContainer <div> at [8,8] [0+0+0 784 0+0+0] [0+0+0 16 0+0+0] children: not-inline
- BlockContainer <(anonymous)> at [8,24] [0+0+0 784 0+0+0] [0+0+0 35.203125 0+0+0] children: inline
- frag 0 from TextInputBox start: 0, length: 0, rect: [11,40 191.875x16] baseline: 18
+ BlockContainer <(anonymous)> at [8,24] [0+0+0 784 0+0+0] [0+0+0 37 0+0+0] children: inline
+ frag 0 from TextInputBox start: 0, length: 0, rect: [11,43 191.875x16] baseline: 14.796875
frag 1 from TextNode start: 0, length: 1, rect: [205.875,43 8x16] baseline: 12.796875
" "
frag 2 from TextAreaBox start: 0, length: 0, rect: [216.875,27 155.9375x26] baseline: 32
frag 3 from TextNode start: 0, length: 1, rect: [375.8125,43 8x16] baseline: 12.796875
" "
- frag 4 from TextInputBox start: 0, length: 0, rect: [386.8125,40 191.875x16] baseline: 18
+ frag 4 from TextInputBox start: 0, length: 0, rect: [386.8125,43 191.875x16] baseline: 14.796875
frag 5 from TextNode start: 0, length: 1, rect: [581.6875,43 8x16] baseline: 12.796875
" "
frag 6 from TextAreaBox start: 0, length: 0, rect: [592.6875,27 155.9375x26] baseline: 32
TextNode <#text> (not painted)
- TextInputBox <input> at [11,40] inline-block [0+1+2 191.875 2+1+0] [0+1+1 16 1+1+0] [BFC] children: not-inline
- Box <div> at [11,40] flex-container(row) [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
- BlockContainer <div> at [11,40] flex-item [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
- frag 0 from TextNode start: 0, length: 0, rect: [11,40 0x16] baseline: 12.796875
+ TextInputBox <input> at [11,43] inline-block [0+1+2 191.875 2+1+0] [0+1+1 16 1+1+0] [BFC] children: not-inline
+ Box <div> at [11,43] flex-container(row) [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
+ BlockContainer <div> at [11,43] flex-item [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 0, rect: [11,43 0x16] baseline: 12.796875
TextNode <#text> (not painted)
- BlockContainer <div> at [11,40] flex-item [-191.875+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
- frag 0 from TextNode start: 0, length: 5, rect: [11,40 36.84375x16] baseline: 12.796875
+ BlockContainer <div> at [11,43] flex-item [-191.875+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 5, rect: [11,43 36.84375x16] baseline: 12.796875
"hello"
TextNode <#text> (not painted)
TextNode <#text> (not painted)
@@ -38,10 +38,10 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
"hello"
TextNode <#text> (not painted)
TextNode <#text> (not painted)
- TextInputBox <input> at [386.8125,40] inline-block [0+1+2 191.875 2+1+0] [0+1+1 16 1+1+0] [BFC] children: not-inline
- Box <div> at [386.8125,40] flex-container(row) [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
- BlockContainer <div> at [386.8125,40] flex-item [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
- frag 0 from TextNode start: 0, length: 0, rect: [386.8125,40 0x16] baseline: 12.796875
+ TextInputBox <input> at [386.8125,43] inline-block [0+1+2 191.875 2+1+0] [0+1+1 16 1+1+0] [BFC] children: not-inline
+ Box <div> at [386.8125,43] flex-container(row) [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
+ BlockContainer <div> at [386.8125,43] flex-item [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 0, rect: [386.8125,43 0x16] baseline: 12.796875
TextNode <#text> (not painted)
TextNode <#text> (not painted)
TextAreaBox <textarea> at [592.6875,27] inline-block [0+1+2 155.9375 2+1+0] [0+1+2 26 2+1+0] [BFC] children: not-inline
@@ -52,4 +52,4 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x67.203125] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x69] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/field-sizing-content-text-input-centers-text-in-min-height.txt b/Tests/LibWeb/Layout/expected/field-sizing-content-text-input-centers-text-in-min-height.txt
index 3d9346431f7..d6eaa413880 100644
--- a/Tests/LibWeb/Layout/expected/field-sizing-content-text-input-centers-text-in-min-height.txt
+++ b/Tests/LibWeb/Layout/expected/field-sizing-content-text-input-centers-text-in-min-height.txt
@@ -1,8 +1,8 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 104 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 88 0+0+8] children: inline
- frag 0 from TextInputBox start: 0, length: 0, rect: [11,10 20.796875x40] baseline: 28
- frag 1 from BlockContainer start: 0, length: 0, rect: [11,54 20.796875x40] baseline: 28
+ frag 0 from TextInputBox start: 0, length: 0, rect: [11,10 20.796875x40] baseline: 25.59375
+ frag 1 from BlockContainer start: 0, length: 0, rect: [11,54 20.796875x40] baseline: 25.59375
TextInputBox <input> at [11,10] inline-block [0+1+2 20.796875 2+1+0] [0+1+1 40 1+1+0] [BFC] children: not-inline
Box <div> at [11,10] flex-container(row) [0+0+0 20.796875 0+0+0] [0+0+0 40 0+0+0] [FFC] children: not-inline
BlockContainer <div> at [11,24] flex-item [0+0+0 20.796875 0+0+0] [0+0+0 12 0+0+0] [BFC] children: inline
diff --git a/Tests/LibWeb/Layout/expected/form-control-baseline-alignment.txt b/Tests/LibWeb/Layout/expected/form-control-baseline-alignment.txt
index 4cd49efd929..ffd244c4601 100644
--- a/Tests/LibWeb/Layout/expected/form-control-baseline-alignment.txt
+++ b/Tests/LibWeb/Layout/expected/form-control-baseline-alignment.txt
@@ -1,16 +1,16 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 86.609375 0+0+0] [BFC] children: not-inline
- BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 70.609375 0+0+8] children: inline
- frag 0 from TextInputBox start: 0, length: 0, rect: [11,24 191.875x16] baseline: 18
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 88.203125 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 72.203125 0+0+8] children: inline
+ frag 0 from TextInputBox start: 0, length: 0, rect: [11,27 191.875x16] baseline: 14.796875
frag 1 from TextAreaBox start: 0, length: 0, rect: [239.0625,11 155.9375x26] baseline: 32
- frag 2 from TextInputBox start: 0, length: 0, rect: [431.1875,24 191.875x16] baseline: 18
+ frag 2 from TextInputBox start: 0, length: 0, rect: [431.1875,27 191.875x16] baseline: 14.796875
frag 3 from TextNode start: 0, length: 1, rect: [626.0625,27 8x16] baseline: 12.796875
" "
- frag 4 from TextAreaBox start: 0, length: 0, rect: [11,46 155.9375x26] baseline: 32
- TextInputBox <input> at [11,24] inline-block [0+1+2 191.875 2+1+0] [0+1+1 16 1+1+0] [BFC] children: not-inline
- Box <div> at [11,24] flex-container(row) [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
- BlockContainer <div> at [11,24] flex-item [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
- frag 0 from TextNode start: 0, length: 0, rect: [11,24 0x16] baseline: 12.796875
+ frag 4 from TextAreaBox start: 0, length: 0, rect: [11,48 155.9375x26] baseline: 32
+ TextInputBox <input> at [11,27] inline-block [0+1+2 191.875 2+1+0] [0+1+1 16 1+1+0] [BFC] children: not-inline
+ Box <div> at [11,27] flex-container(row) [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
+ BlockContainer <div> at [11,27] flex-item [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 0, rect: [11,27 0x16] baseline: 12.796875
TextNode <#text> (not painted)
InlineNode <span> at [205.875,27] [0+0+0 30.1875 0+0+0] [0+0+0 16 0+0+0]
frag 0 from TextNode start: 0, length: 3, rect: [205.875,27 30.1875x16] baseline: 12.796875
@@ -25,13 +25,13 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
frag 0 from TextNode start: 0, length: 3, rect: [398,27 30.1875x16] baseline: 12.796875
"boo"
TextNode <#text> (not painted)
- TextInputBox <input> at [431.1875,24] inline-block [0+1+2 191.875 2+1+0] [0+1+1 16 1+1+0] [BFC] children: not-inline
- Box <div> at [431.1875,24] flex-container(row) [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
- BlockContainer <div> at [431.1875,24] flex-item [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
- frag 0 from TextNode start: 0, length: 0, rect: [431.1875,24 0x16] baseline: 12.796875
+ TextInputBox <input> at [431.1875,27] inline-block [0+1+2 191.875 2+1+0] [0+1+1 16 1+1+0] [BFC] children: not-inline
+ Box <div> at [431.1875,27] flex-container(row) [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
+ BlockContainer <div> at [431.1875,27] flex-item [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 0, rect: [431.1875,27 0x16] baseline: 12.796875
TextNode <#text> (not painted)
- BlockContainer <div> at [431.1875,24] flex-item [-191.875+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
- frag 0 from TextNode start: 0, length: 5, rect: [431.1875,24 36.84375x16] baseline: 12.796875
+ BlockContainer <div> at [431.1875,27] flex-item [-191.875+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 5, rect: [431.1875,27 36.84375x16] baseline: 12.796875
"hello"
TextNode <#text> (not painted)
TextNode <#text> (not painted)
@@ -39,16 +39,16 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
frag 0 from TextNode start: 0, length: 3, rect: [634.0625,27 30.1875x16] baseline: 12.796875
"boo"
TextNode <#text> (not painted)
- TextAreaBox <textarea> at [11,46] inline-block [0+1+2 155.9375 2+1+0] [0+1+2 26 2+1+0] [BFC] children: not-inline
- Box <div> at [11,46] flex-container(row) [0+0+0 155.9375 0+0+0] [0+0+0 13 0+0+0] [FFC] children: not-inline
- BlockContainer <div> at [11,46] flex-item [0+0+0 155.9375 0+0+0] [0+0+0 13 0+0+0] [BFC] children: inline
- frag 0 from TextNode start: 0, length: 0, rect: [11,46 0x13] baseline: 10.390625
+ TextAreaBox <textarea> at [11,48] inline-block [0+1+2 155.9375 2+1+0] [0+1+2 26 2+1+0] [BFC] children: not-inline
+ Box <div> at [11,48] flex-container(row) [0+0+0 155.9375 0+0+0] [0+0+0 13 0+0+0] [FFC] children: not-inline
+ BlockContainer <div> at [11,48] flex-item [0+0+0 155.9375 0+0+0] [0+0+0 13 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 0, rect: [11,48 0x13] baseline: 10.390625
TextNode <#text> (not painted)
- BlockContainer <div> at [11,46] flex-item [-155.9375+0+0 155.9375 0+0+0] [0+0+0 13 0+0+0] [BFC] children: inline
- frag 0 from TextNode start: 0, length: 5, rect: [11,46 29.921875x13] baseline: 10.390625
+ BlockContainer <div> at [11,48] flex-item [-155.9375+0+0 155.9375 0+0+0] [0+0+0 13 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 5, rect: [11,48 29.921875x13] baseline: 10.390625
"hello"
TextNode <#text> (not painted)
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x86.609375] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x88.203125] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/form-controls-and-canvas-resized-after-first-layout.txt b/Tests/LibWeb/Layout/expected/form-controls-and-canvas-resized-after-first-layout.txt
index 8d91ece46c1..132bff5fdc9 100644
--- a/Tests/LibWeb/Layout/expected/form-controls-and-canvas-resized-after-first-layout.txt
+++ b/Tests/LibWeb/Layout/expected/form-controls-and-canvas-resized-after-first-layout.txt
@@ -1,27 +1,27 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 124.546875 0+0+0] [BFC] children: not-inline
- BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 108.546875 0+0+8] children: inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 125 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 109 0+0+8] children: inline
frag 0 from TextAreaBox start: 0, length: 0, rect: [11,36 233.90625x52] baseline: 58
frag 1 from TextNode start: 0, length: 1, rect: [247.90625,79 8x16] baseline: 12.796875
" "
- frag 2 from TextInputBox start: 0, length: 0, rect: [258.90625,75 239.84375x16] baseline: 18
+ frag 2 from TextInputBox start: 0, length: 0, rect: [258.90625,79 239.84375x16] baseline: 14.796875
frag 3 from TextNode start: 0, length: 1, rect: [501.75,79 8x16] baseline: 12.796875
" "
frag 4 from TextAreaBox start: 0, length: 0, rect: [512.75,11 65x77.96875] baseline: 83.96875
frag 5 from TextNode start: 0, length: 1, rect: [580.75,79 8x16] baseline: 12.796875
" "
frag 6 from CanvasBox start: 0, length: 0, rect: [588.75,71 120x20] baseline: 20
- frag 7 from BlockContainer start: 0, length: 0, rect: [11,97 143.90625x16] baseline: 18
+ frag 7 from BlockContainer start: 0, length: 0, rect: [11,99 143.90625x16] baseline: 14.796875
TextAreaBox <textarea#textarea> at [11,36] inline-block [0+1+2 233.90625 2+1+0] [0+1+2 52 2+1+0] [BFC] children: not-inline
Box <div> at [11,36] flex-container(row) [0+0+0 233.90625 0+0+0] [0+0+0 13 0+0+0] [FFC] children: not-inline
BlockContainer <div> at [11,36] flex-item [0+0+0 233.90625 0+0+0] [0+0+0 13 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 0, rect: [11,36 0x13] baseline: 10.390625
TextNode <#text> (not painted)
TextNode <#text> (not painted)
- TextInputBox <input#input> at [258.90625,75] inline-block [0+1+2 239.84375 2+1+0] [0+1+1 16 1+1+0] [BFC] children: not-inline
- Box <div> at [258.90625,75] flex-container(row) [0+0+0 239.84375 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
- BlockContainer <div> at [258.90625,75] flex-item [0+0+0 239.84375 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
- frag 0 from TextNode start: 0, length: 0, rect: [258.90625,75 0x16] baseline: 12.796875
+ TextInputBox <input#input> at [258.90625,79] inline-block [0+1+2 239.84375 2+1+0] [0+1+1 16 1+1+0] [BFC] children: not-inline
+ Box <div> at [258.90625,79] flex-container(row) [0+0+0 239.84375 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
+ BlockContainer <div> at [258.90625,79] flex-item [0+0+0 239.84375 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 0, rect: [258.90625,79 0x16] baseline: 12.796875
TextNode <#text> (not painted)
TextNode <#text> (not painted)
TextAreaBox <textarea#vertical-textarea> at [512.75,11] inline-block [0+1+2 65 2+1+0] [0+1+2 77.96875 2+1+0] [BFC] children: not-inline
@@ -32,13 +32,13 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
TextNode <#text> (not painted)
CanvasBox <canvas#canvas> at [588.75,71] [0+0+0 120 0+0+0] [0+0+0 20 0+0+0] children: not-inline
TextNode <#text> (not painted)
- BlockContainer <input#becomes-text> at [11,97] inline-block [0+1+2 143.90625 2+1+0] [0+1+1 16 1+1+0] [BFC] children: not-inline
- Box <div> at [11,97] flex-container(row) [0+0+0 143.90625 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
- BlockContainer <div> at [11,97] flex-item [0+0+0 143.90625 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
- frag 0 from TextNode start: 0, length: 0, rect: [11,97 0x16] baseline: 12.796875
+ BlockContainer <input#becomes-text> at [11,99] inline-block [0+1+2 143.90625 2+1+0] [0+1+1 16 1+1+0] [BFC] children: not-inline
+ Box <div> at [11,99] flex-container(row) [0+0+0 143.90625 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
+ BlockContainer <div> at [11,99] flex-item [0+0+0 143.90625 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 0, rect: [11,99 0x16] baseline: 12.796875
TextNode <#text> (not painted)
TextNode <#text> (not painted)
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x124.546875] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x125] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/input-element-placeholder-position.txt b/Tests/LibWeb/Layout/expected/input-element-placeholder-position.txt
index ac2b381e081..c23cbfa85f3 100644
--- a/Tests/LibWeb/Layout/expected/input-element-placeholder-position.txt
+++ b/Tests/LibWeb/Layout/expected/input-element-placeholder-position.txt
@@ -10,13 +10,13 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
"Input Field Placeholder Position Test"
TextNode <#text> (not painted)
BlockContainer <(anonymous)> at [8,74.875] [0+0+0 784 0+0+0] [0+0+0 38 0+0+0] children: inline
- frag 0 from TextInputBox start: 0, length: 0, rect: [19,85.875 191.875x16] baseline: 27
- frag 1 from TextNode start: 0, length: 1, rect: [221.875,88.875 8x16] baseline: 12.796875
+ frag 0 from TextInputBox start: 0, length: 0, rect: [19,85.875 191.875x16] baseline: 23.796875
+ frag 1 from TextNode start: 0, length: 1, rect: [221.875,85.875 8x16] baseline: 12.796875
" "
- frag 2 from TextInputBox start: 0, length: 0, rect: [240.875,85.875 191.875x16] baseline: 27
- frag 3 from TextNode start: 0, length: 1, rect: [443.75,88.875 8x16] baseline: 12.796875
+ frag 2 from TextInputBox start: 0, length: 0, rect: [240.875,85.875 191.875x16] baseline: 23.796875
+ frag 3 from TextNode start: 0, length: 1, rect: [443.75,85.875 8x16] baseline: 12.796875
" "
- frag 4 from TextInputBox start: 0, length: 0, rect: [462.75,85.875 191.875x16] baseline: 27
+ frag 4 from TextInputBox start: 0, length: 0, rect: [462.75,85.875 191.875x16] baseline: 23.796875
TextNode <#text> (not painted)
TextInputBox <input> at [19,85.875] inline-block [0+1+10 191.875 10+1+0] [0+1+10 16 10+1+0] [BFC] children: not-inline
Box <div> at [19,85.875] flex-container(row) [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
diff --git a/Tests/LibWeb/Layout/expected/input-element-with-display-inline.txt b/Tests/LibWeb/Layout/expected/input-element-with-display-inline.txt
index b5e2c21c56f..400b5e2f57b 100644
--- a/Tests/LibWeb/Layout/expected/input-element-with-display-inline.txt
+++ b/Tests/LibWeb/Layout/expected/input-element-with-display-inline.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [1,1] [0+1+0 798 0+1+0] [0+1+0 44 0+1+0] [BFC] children: not-inline
- BlockContainer <body> at [10,10] [8+1+0 780 0+1+8] [8+1+0 26 0+1+8] children: inline
- frag 0 from TextInputBox start: 0, length: 0, rect: [13,12 200x20] baseline: 22
+ BlockContainer <html> at [1,1] [0+1+0 798 0+1+0] [0+1+0 42 0+1+0] [BFC] children: not-inline
+ BlockContainer <body> at [10,10] [8+1+0 780 0+1+8] [8+1+0 24 0+1+8] children: inline
+ frag 0 from TextInputBox start: 0, length: 0, rect: [13,12 200x20] baseline: 18
TextInputBox <input> at [13,12] inline-block [0+1+2 200 2+1+0] [0+1+1 20 1+1+0] [BFC] children: not-inline
Box <div> at [13,12] flex-container(row) [0+0+0 200 0+0+0] [0+0+0 20 0+0+0] [FFC] children: not-inline
BlockContainer <div> at [13,12] flex-item [0+0+0 200 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
@@ -9,4 +9,4 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [1,1 798x44] (z-index: auto)
+ SC for BlockContainer<HTML> [1,1 798x42] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/input-image-to-text-after-style-update.txt b/Tests/LibWeb/Layout/expected/input-image-to-text-after-style-update.txt
index 27b0a561aab..43b775b9398 100644
--- a/Tests/LibWeb/Layout/expected/input-image-to-text-after-style-update.txt
+++ b/Tests/LibWeb/Layout/expected/input-image-to-text-after-style-update.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 37.203125 0+0+0] [BFC] children: not-inline
- BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 21.203125 0+0+8] children: inline
- frag 0 from TextInputBox start: 0, length: 0, rect: [11,10 191.875x16] baseline: 18
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 36 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 20 0+0+8] children: inline
+ frag 0 from TextInputBox start: 0, length: 0, rect: [11,10 191.875x16] baseline: 14.796875
TextInputBox <input> at [11,10] inline-block [0+1+2 191.875 2+1+0] [0+1+1 16 1+1+0] [BFC] children: not-inline
Box <div> at [11,10] flex-container(row) [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
BlockContainer <div> at [11,10] flex-item [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
@@ -12,4 +12,4 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x37.203125] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x36] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/input-image-to-text.txt b/Tests/LibWeb/Layout/expected/input-image-to-text.txt
index 27b0a561aab..43b775b9398 100644
--- a/Tests/LibWeb/Layout/expected/input-image-to-text.txt
+++ b/Tests/LibWeb/Layout/expected/input-image-to-text.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 37.203125 0+0+0] [BFC] children: not-inline
- BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 21.203125 0+0+8] children: inline
- frag 0 from TextInputBox start: 0, length: 0, rect: [11,10 191.875x16] baseline: 18
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 36 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 20 0+0+8] children: inline
+ frag 0 from TextInputBox start: 0, length: 0, rect: [11,10 191.875x16] baseline: 14.796875
TextInputBox <input> at [11,10] inline-block [0+1+2 191.875 2+1+0] [0+1+1 16 1+1+0] [BFC] children: not-inline
Box <div> at [11,10] flex-container(row) [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
BlockContainer <div> at [11,10] flex-item [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
@@ -12,4 +12,4 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x37.203125] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x36] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/input-max-height-border-box.txt b/Tests/LibWeb/Layout/expected/input-max-height-border-box.txt
index f6e1bd3dd4e..1e199f4cd14 100644
--- a/Tests/LibWeb/Layout/expected/input-max-height-border-box.txt
+++ b/Tests/LibWeb/Layout/expected/input-max-height-border-box.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 48 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 32 0+0+8] children: inline
- frag 0 from TextInputBox start: 0, length: 0, rect: [12,22 60x4] baseline: 18.5
+ frag 0 from TextInputBox start: 0, length: 0, rect: [12,22 60x4] baseline: 17.5
TextInputBox <input> at [12,22] inline-block [0+4+0 60 0+4+0] [0+4+10 4 10+4+0] [BFC] children: not-inline
Box <div> at [12,22] flex-container(row) [0+0+0 60 0+0+0] [0+0+0 4 0+0+0] [FFC] children: not-inline
BlockContainer <div> at [12,21.5] flex-item [0+0+0 60 0+0+0] [0+0+0 5 0+0+0] [BFC] children: inline
diff --git a/Tests/LibWeb/Layout/expected/input-max-width-border-box.txt b/Tests/LibWeb/Layout/expected/input-max-width-border-box.txt
index 434a8516e2a..aee2197ac46 100644
--- a/Tests/LibWeb/Layout/expected/input-max-width-border-box.txt
+++ b/Tests/LibWeb/Layout/expected/input-max-width-border-box.txt
@@ -1,13 +1,13 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 34 0+0+0] [BFC] children: not-inline
- BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 18 0+0+8] children: inline
- frag 0 from TextInputBox start: 0, length: 0, rect: [23,15 20x6] baseline: 10.5
- TextInputBox <input> at [23,15] inline-block [0+5+10 20 10+5+0] [0+5+0 6 0+5+0] [BFC] children: not-inline
- Box <div> at [23,15] flex-container(row) [0+0+0 20 0+0+0] [0+0+0 6 0+0+0] [FFC] children: not-inline
- BlockContainer <div> at [23,15.5] flex-item [0+0+0 20 0+0+0] [0+0+0 5 0+0+0] [BFC] children: inline
- frag 0 from TextNode start: 0, length: 0, rect: [23,15.5 0x5] baseline: 4
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 35 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 19 0+0+8] children: inline
+ frag 0 from TextInputBox start: 0, length: 0, rect: [23,16 20x6] baseline: 9.5
+ TextInputBox <input> at [23,16] inline-block [0+5+10 20 10+5+0] [0+5+0 6 0+5+0] [BFC] children: not-inline
+ Box <div> at [23,16] flex-container(row) [0+0+0 20 0+0+0] [0+0+0 6 0+0+0] [FFC] children: not-inline
+ BlockContainer <div> at [23,16.5] flex-item [0+0+0 20 0+0+0] [0+0+0 5 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 0, rect: [23,16.5 0x5] baseline: 4
TextNode <#text> (not painted)
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x34] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x35] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/input-min-height-border-box.txt b/Tests/LibWeb/Layout/expected/input-min-height-border-box.txt
index 550a9a4acf8..cab2c84e078 100644
--- a/Tests/LibWeb/Layout/expected/input-min-height-border-box.txt
+++ b/Tests/LibWeb/Layout/expected/input-min-height-border-box.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 66 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 50 0+0+8] children: inline
- frag 0 from TextInputBox start: 0, length: 0, rect: [11,19 60x28] baseline: 27.5
+ frag 0 from TextInputBox start: 0, length: 0, rect: [11,19 60x28] baseline: 26.5
TextInputBox <input> at [11,19] inline-block [0+3+0 60 0+3+0] [0+3+8 28 8+3+0] [BFC] children: not-inline
Box <div> at [11,19] flex-container(row) [0+0+0 60 0+0+0] [0+0+0 28 0+0+0] [FFC] children: not-inline
BlockContainer <div> at [11,30.5] flex-item [0+0+0 60 0+0+0] [0+0+0 5 0+0+0] [BFC] children: inline
diff --git a/Tests/LibWeb/Layout/expected/input-number-placeholder.txt b/Tests/LibWeb/Layout/expected/input-number-placeholder.txt
index b65ceb2c43c..21209f003ce 100644
--- a/Tests/LibWeb/Layout/expected/input-number-placeholder.txt
+++ b/Tests/LibWeb/Layout/expected/input-number-placeholder.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 38.203125 0+0+0] [BFC] children: not-inline
- BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 22.203125 0+0+8] children: inline
- frag 0 from TextInputBox start: 0, length: 0, rect: [11,10 191.875x16] baseline: 19
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 36 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 20 0+0+8] children: inline
+ frag 0 from TextInputBox start: 0, length: 0, rect: [11,10 191.875x16] baseline: 15.796875
TextInputBox <input> at [11,10] inline-block [0+1+2 191.875 2+1+0] [0+1+1 16 1+1+0] [BFC] children: not-inline
Box <div> at [11,10] flex-container(row) [0+0+0 191.875 0+0+0] [0+0+0 18 0+0+0] [FFC] children: not-inline
Box <div> at [11,11] flex-container(row) flex-item [0+0+0 155.875 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
@@ -27,4 +27,4 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x38.203125] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x36] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/input-password-to-text.txt b/Tests/LibWeb/Layout/expected/input-password-to-text.txt
index 66c426ab6bd..080b5d741ca 100644
--- a/Tests/LibWeb/Layout/expected/input-password-to-text.txt
+++ b/Tests/LibWeb/Layout/expected/input-password-to-text.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 37.203125 0+0+0] [BFC] children: not-inline
- BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 21.203125 0+0+8] children: inline
- frag 0 from TextInputBox start: 0, length: 0, rect: [11,10 191.875x16] baseline: 18
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 36 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 20 0+0+8] children: inline
+ frag 0 from TextInputBox start: 0, length: 0, rect: [11,10 191.875x16] baseline: 14.796875
TextInputBox <input> at [11,10] inline-block [0+1+2 191.875 2+1+0] [0+1+1 16 1+1+0] [BFC] children: not-inline
Box <div> at [11,10] flex-container(row) [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
BlockContainer <div> at [11,10] flex-item [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
@@ -12,4 +12,4 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x37.203125] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x36] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/input-placeholder-min-height-alignment.txt b/Tests/LibWeb/Layout/expected/input-placeholder-min-height-alignment.txt
index 873d8200c8a..618e369adee 100644
--- a/Tests/LibWeb/Layout/expected/input-placeholder-min-height-alignment.txt
+++ b/Tests/LibWeb/Layout/expected/input-placeholder-min-height-alignment.txt
@@ -1,10 +1,10 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 60 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 44 0+0+8] children: inline
- frag 0 from TextInputBox start: 0, length: 0, rect: [25,10 307x40] baseline: 32
- frag 1 from TextNode start: 0, length: 1, rect: [349,27 8x16] baseline: 12.796875
+ frag 0 from TextInputBox start: 0, length: 0, rect: [25,10 307x40] baseline: 26.796875
+ frag 1 from TextNode start: 0, length: 1, rect: [349,22 8x16] baseline: 12.796875
" "
- frag 2 from TextInputBox start: 0, length: 0, rect: [374,23 307x14] baseline: 19
+ frag 2 from TextInputBox start: 0, length: 0, rect: [374,23 307x14] baseline: 13.796875
TextInputBox <input.minimum> at [25,10] inline-block [0+1+16 307 16+1+0] [0+1+1 40 1+1+0] [BFC] children: not-inline
Box <div> at [25,10] flex-container(row) [0+0+0 307 0+0+0] [0+0+0 40 0+0+0] [FFC] children: not-inline
BlockContainer <div> at [25,20] flex-item [0+0+0 307 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
diff --git a/Tests/LibWeb/Layout/expected/input-placeholder-with-text-align.txt b/Tests/LibWeb/Layout/expected/input-placeholder-with-text-align.txt
index c834cdf7d52..40ff5e1ecca 100644
--- a/Tests/LibWeb/Layout/expected/input-placeholder-with-text-align.txt
+++ b/Tests/LibWeb/Layout/expected/input-placeholder-with-text-align.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 120 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 104 0+0+8] children: inline
- frag 0 from TextInputBox start: 0, length: 0, rect: [11,10 400x100] baseline: 60
+ frag 0 from TextInputBox start: 0, length: 0, rect: [11,10 400x100] baseline: 56.796875
TextInputBox <input> at [11,10] inline-block [0+1+2 400 2+1+0] [0+1+1 100 1+1+0] [BFC] children: not-inline
Box <div> at [11,10] flex-container(row) [0+0+0 400 0+0+0] [0+0+0 100 0+0+0] [FFC] children: not-inline
BlockContainer <div> at [11,52] flex-item [0+0+0 400 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
diff --git a/Tests/LibWeb/Layout/expected/input-placeholder.txt b/Tests/LibWeb/Layout/expected/input-placeholder.txt
index 91dc43fadff..dc02c011761 100644
--- a/Tests/LibWeb/Layout/expected/input-placeholder.txt
+++ b/Tests/LibWeb/Layout/expected/input-placeholder.txt
@@ -1,14 +1,14 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 68 0+0+0] [BFC] children: not-inline
- BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 52 0+0+8] children: inline
- frag 0 from TextInputBox start: 0, length: 0, rect: [11,10 200x20] baseline: 22
- frag 1 from TextNode start: 0, length: 1, rect: [214,14 10x20] baseline: 16
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 64 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 48 0+0+8] children: inline
+ frag 0 from TextInputBox start: 0, length: 0, rect: [11,10 200x20] baseline: 18
+ frag 1 from TextNode start: 0, length: 1, rect: [214,10 10x20] baseline: 16
" "
- frag 2 from TextInputBox start: 0, length: 0, rect: [227,10 200x20] baseline: 22
- frag 3 from TextNode start: 0, length: 1, rect: [430,14 10x20] baseline: 16
+ frag 2 from TextInputBox start: 0, length: 0, rect: [227,10 200x20] baseline: 18
+ frag 3 from TextNode start: 0, length: 1, rect: [430,10 10x20] baseline: 16
" "
- frag 4 from TextInputBox start: 0, length: 0, rect: [443,10 200x20] baseline: 22
- frag 5 from TextInputBox start: 0, length: 0, rect: [11,36 200x20] baseline: 22
+ frag 4 from TextInputBox start: 0, length: 0, rect: [443,10 200x20] baseline: 18
+ frag 5 from TextInputBox start: 0, length: 0, rect: [11,34 200x20] baseline: 18
TextInputBox <input> at [11,10] inline-block [0+1+2 200 2+1+0] [0+1+1 20 1+1+0] [BFC] children: not-inline
Box <div> at [11,10] flex-container(row) [0+0+0 200 0+0+0] [0+0+0 20 0+0+0] [FFC] children: not-inline
BlockContainer <div> at [11,10] flex-item [0+0+0 200 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
@@ -33,17 +33,17 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
"text"
TextNode <#text> (not painted)
TextNode <#text> (not painted)
- TextInputBox <input#placeholder> at [11,36] inline-block [0+1+2 200 2+1+0] [0+1+1 20 1+1+0] [BFC] children: not-inline
- Box <div> at [11,36] flex-container(row) [0+0+0 200 0+0+0] [0+0+0 20 0+0+0] [FFC] children: not-inline
- BlockContainer <div> at [11,36] flex-item [0+0+0 200 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
- frag 0 from TextNode start: 0, length: 0, rect: [11,36 0x20] baseline: 16
+ TextInputBox <input#placeholder> at [11,34] inline-block [0+1+2 200 2+1+0] [0+1+1 20 1+1+0] [BFC] children: not-inline
+ Box <div> at [11,34] flex-container(row) [0+0+0 200 0+0+0] [0+0+0 20 0+0+0] [FFC] children: not-inline
+ BlockContainer <div> at [11,34] flex-item [0+0+0 200 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 0, rect: [11,34 0x20] baseline: 16
TextNode <#text> (not painted)
- BlockContainer <div> at [11,36] flex-item [-200+0+0 200 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline overflow: [11,36 396.171875x20]
- frag 0 from TextNode start: 0, length: 39, rect: [11,36 396.171875x20] baseline: 16
+ BlockContainer <div> at [11,34] flex-item [-200+0+0 200 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline overflow: [11,34 396.171875x20]
+ frag 0 from TextNode start: 0, length: 39, rect: [11,34 396.171875x20] baseline: 16
"This placeholder should also be visible"
TextNode <#text> (not painted)
TextNode <#text> (not painted)
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x68] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x64] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/input-search-height-padding.txt b/Tests/LibWeb/Layout/expected/input-search-height-padding.txt
index ca9af1e7a7f..3deee25184c 100644
--- a/Tests/LibWeb/Layout/expected/input-search-height-padding.txt
+++ b/Tests/LibWeb/Layout/expected/input-search-height-padding.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 44 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 28 0+0+8] children: inline
- frag 0 from TextInputBox start: 0, length: 0, rect: [10,16 96x12] baseline: 16.5
+ frag 0 from TextInputBox start: 0, length: 0, rect: [10,16 96x12] baseline: 15.5
TextInputBox <input> at [10,16] inline-block [0+2+0 96 0+2+0] [0+2+6 12 6+2+0] [BFC] children: not-inline
Box <div> at [10,16] flex-container(row) [0+0+0 96 0+0+0] [0+0+0 12 0+0+0] [FFC] children: not-inline
BlockContainer <div> at [10,19.5] flex-item [0+0+0 96 0+0+0] [0+0+0 5 0+0+0] [BFC] children: inline
diff --git a/Tests/LibWeb/Layout/expected/input-text-node-invalidation-on-value-change.txt b/Tests/LibWeb/Layout/expected/input-text-node-invalidation-on-value-change.txt
index a11cb8b1d53..04b69561b16 100644
--- a/Tests/LibWeb/Layout/expected/input-text-node-invalidation-on-value-change.txt
+++ b/Tests/LibWeb/Layout/expected/input-text-node-invalidation-on-value-change.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 42 0+0+0] [BFC] children: not-inline
- BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 26 0+0+8] children: inline
- frag 0 from TextInputBox start: 0, length: 0, rect: [11,10 200x20] baseline: 22
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 40 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 24 0+0+8] children: inline
+ frag 0 from TextInputBox start: 0, length: 0, rect: [11,10 200x20] baseline: 18
TextInputBox <input#foo> at [11,10] inline-block [0+1+2 200 2+1+0] [0+1+1 20 1+1+0] [BFC] children: not-inline
Box <div> at [11,10] flex-container(row) [0+0+0 200 0+0+0] [0+0+0 20 0+0+0] [FFC] children: not-inline
BlockContainer <div> at [11,10] flex-item [0+0+0 200 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
@@ -12,4 +12,4 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x42] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x40] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/input-text-to-password.txt b/Tests/LibWeb/Layout/expected/input-text-to-password.txt
index 10dd27c4542..77ec44235d0 100644
--- a/Tests/LibWeb/Layout/expected/input-text-to-password.txt
+++ b/Tests/LibWeb/Layout/expected/input-text-to-password.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 37.203125 0+0+0] [BFC] children: not-inline
- BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 21.203125 0+0+8] children: inline
- frag 0 from TextInputBox start: 0, length: 0, rect: [11,10 191.875x16] baseline: 18
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 36 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 20 0+0+8] children: inline
+ frag 0 from TextInputBox start: 0, length: 0, rect: [11,10 191.875x16] baseline: 14.796875
TextInputBox <input> at [11,10] inline-block [0+1+2 191.875 2+1+0] [0+1+1 16 1+1+0] [BFC] children: not-inline
Box <div> at [11,10] flex-container(row) [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
BlockContainer <div> at [11,10] flex-item [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
@@ -12,4 +12,4 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x37.203125] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x36] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/input-time.txt b/Tests/LibWeb/Layout/expected/input-time.txt
index 0f42014dbcf..5b24982dc0d 100644
--- a/Tests/LibWeb/Layout/expected/input-time.txt
+++ b/Tests/LibWeb/Layout/expected/input-time.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 42 0+0+0] [BFC] children: not-inline
- BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 26 0+0+8] children: inline
- frag 0 from TextInputBox start: 0, length: 0, rect: [11,10 240x20] baseline: 22
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 40 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 24 0+0+8] children: inline
+ frag 0 from TextInputBox start: 0, length: 0, rect: [11,10 240x20] baseline: 18
TextInputBox <input> at [11,10] inline-block [0+1+2 240 2+1+0] [0+1+1 20 1+1+0] [BFC] children: not-inline
Box <div> at [11,10] flex-container(row) [0+0+0 240 0+0+0] [0+0+0 20 0+0+0] [FFC] children: not-inline
BlockContainer <div> at [11,10] flex-item [0+0+0 240 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
@@ -10,4 +10,4 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x42] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x40] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/layout-tree-update/maintain-single-backdrop-pseudo-element.txt b/Tests/LibWeb/Layout/expected/layout-tree-update/maintain-single-backdrop-pseudo-element.txt
index fe8da87e962..faa69928ee8 100644
--- a/Tests/LibWeb/Layout/expected/layout-tree-update/maintain-single-backdrop-pseudo-element.txt
+++ b/Tests/LibWeb/Layout/expected/layout-tree-update/maintain-single-backdrop-pseudo-element.txt
@@ -3,15 +3,15 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: inline
TextNode <#text> (not painted)
BlockContainer <(anonymous)> at [0,0] positioned [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <dialog#d> at [301.0625,289.390625] positioned [282.0625+3+16 197.875 16+3+282.0625] [270.390625+3+16 21.203125 16+3+270.390625] [BFC] children: inline
- frag 0 from TextInputBox start: 0, length: 0, rect: [304.0625,291.390625 191.875x16] baseline: 18
- TextInputBox <input> at [304.0625,291.390625] inline-block [0+1+2 191.875 2+1+0] [0+1+1 16 1+1+0] [BFC] children: not-inline
- Box <div> at [304.0625,291.390625] flex-container(row) [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
- BlockContainer <div> at [304.0625,291.390625] flex-item [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
- frag 0 from TextNode start: 0, length: 0, rect: [304.0625,291.390625 0x16] baseline: 12.796875
+ BlockContainer <dialog#d> at [301.0625,290] positioned [282.0625+3+16 197.875 16+3+282.0625] [271+3+16 20 16+3+271] [BFC] children: inline
+ frag 0 from TextInputBox start: 0, length: 0, rect: [304.0625,292 191.875x16] baseline: 14.796875
+ TextInputBox <input> at [304.0625,292] inline-block [0+1+2 191.875 2+1+0] [0+1+1 16 1+1+0] [BFC] children: not-inline
+ Box <div> at [304.0625,292] flex-container(row) [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
+ BlockContainer <div> at [304.0625,292] flex-item [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 0, rect: [304.0625,292 0x16] baseline: 12.796875
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
SC for BlockContainer(anonymous) [0,0 800x600] (z-index: auto)
- SC for BlockContainer<DIALOG>#d [301.0625,289.390625 197.875x21.203125] (z-index: auto)
+ SC for BlockContainer<DIALOG>#d [301.0625,290 197.875x20] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/number-input-appearance.txt b/Tests/LibWeb/Layout/expected/number-input-appearance.txt
index ecfcb01c02f..9e107081ff5 100644
--- a/Tests/LibWeb/Layout/expected/number-input-appearance.txt
+++ b/Tests/LibWeb/Layout/expected/number-input-appearance.txt
@@ -1,13 +1,13 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 38.203125 0+0+0] [BFC] children: not-inline
- BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 22.203125 0+0+8] children: inline
- frag 0 from TextInputBox start: 0, length: 0, rect: [11,10 191.875x16] baseline: 19
- frag 1 from TextNode start: 0, length: 1, rect: [205.875,14 8x16] baseline: 12.796875
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 37 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 21 0+0+8] children: inline
+ frag 0 from TextInputBox start: 0, length: 0, rect: [11,10 191.875x16] baseline: 15.796875
+ frag 1 from TextNode start: 0, length: 1, rect: [205.875,11 8x16] baseline: 12.796875
" "
- frag 2 from TextInputBox start: 0, length: 0, rect: [216.875,10 191.875x16] baseline: 19
- frag 3 from TextNode start: 0, length: 1, rect: [411.75,14 8x16] baseline: 12.796875
+ frag 2 from TextInputBox start: 0, length: 0, rect: [216.875,10 191.875x16] baseline: 15.796875
+ frag 3 from TextNode start: 0, length: 1, rect: [411.75,11 8x16] baseline: 12.796875
" "
- frag 4 from TextInputBox start: 0, length: 0, rect: [422.75,11 191.875x16] baseline: 18
+ frag 4 from TextInputBox start: 0, length: 0, rect: [422.75,11 191.875x16] baseline: 14.796875
TextInputBox <input> at [11,10] inline-block [0+1+2 191.875 2+1+0] [0+1+1 16 1+1+0] [BFC] children: not-inline
Box <div> at [11,10] flex-container(row) [0+0+0 191.875 0+0+0] [0+0+0 18 0+0+0] [FFC] children: not-inline
Box <div> at [11,11] flex-container(row) flex-item [0+0+0 155.875 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
@@ -58,4 +58,4 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x38.203125] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x37] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/quirks/input-in-pre-quirks-mode.txt b/Tests/LibWeb/Layout/expected/quirks/input-in-pre-quirks-mode.txt
index e23f208c745..5ec276217f2 100644
--- a/Tests/LibWeb/Layout/expected/quirks/input-in-pre-quirks-mode.txt
+++ b/Tests/LibWeb/Layout/expected/quirks/input-in-pre-quirks-mode.txt
@@ -3,14 +3,14 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
BlockContainer <body> at [8,13] [8+0+0 784 0+0+8] [8+0+0 584 0+0+8] children: not-inline
BlockContainer <(anonymous)> at [8,13] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline
TextNode <#text> (not painted)
- BlockContainer <pre> at [8,13] [0+0+0 784 0+0+0] [13+0+0 17.609375 0+0+13] children: inline
- frag 0 from TextInputBox start: 0, length: 0, rect: [11,15 155.9375x13] baseline: 15
+ BlockContainer <pre> at [8,13] [0+0+0 784 0+0+0] [13+0+0 17 0+0+13] children: inline
+ frag 0 from TextInputBox start: 0, length: 0, rect: [11,15 155.9375x13] baseline: 12.390625
TextInputBox <input> at [11,15] inline-block [0+1+2 155.9375 2+1+0] [0+1+1 13 1+1+0] [BFC] children: not-inline
Box <div> at [11,15] flex-container(row) [0+0+0 155.9375 0+0+0] [0+0+0 13 0+0+0] [FFC] children: not-inline
BlockContainer <div> at [11,15] flex-item [0+0+0 155.9375 0+0+0] [0+0+0 13 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 0, rect: [11,15 0x13] baseline: 10.390625
TextNode <#text> (not painted)
- BlockContainer <(anonymous)> at [8,43.609375] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline
+ BlockContainer <(anonymous)> at [8,43] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/unicode-password-input.txt b/Tests/LibWeb/Layout/expected/unicode-password-input.txt
index 576be1fe751..4faac7130a3 100644
--- a/Tests/LibWeb/Layout/expected/unicode-password-input.txt
+++ b/Tests/LibWeb/Layout/expected/unicode-password-input.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 37.203125 0+0+0] [BFC] children: not-inline
- BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 21.203125 0+0+8] children: inline
- frag 0 from TextInputBox start: 0, length: 0, rect: [11,10 191.875x16] baseline: 18
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 36 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 20 0+0+8] children: inline
+ frag 0 from TextInputBox start: 0, length: 0, rect: [11,10 191.875x16] baseline: 14.796875
TextInputBox <input> at [11,10] inline-block [0+1+2 191.875 2+1+0] [0+1+1 16 1+1+0] [BFC] children: not-inline
Box <div> at [11,10] flex-container(row) [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
BlockContainer <div> at [11,10] flex-item [0+0+0 191.875 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
@@ -11,4 +11,4 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x37.203125] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x36] (z-index: auto)
diff --git a/Tests/LibWeb/Screenshot/expected-macos/color-scheme.png b/Tests/LibWeb/Screenshot/expected-macos/color-scheme.png
index 6a7e545b7a5..72c9d57be63 100644
Binary files a/Tests/LibWeb/Screenshot/expected-macos/color-scheme.png and b/Tests/LibWeb/Screenshot/expected-macos/color-scheme.png differ
diff --git a/Tests/LibWeb/Screenshot/expected/color-scheme.png b/Tests/LibWeb/Screenshot/expected/color-scheme.png
index 576dea98996..cbb5647a4f1 100644
Binary files a/Tests/LibWeb/Screenshot/expected/color-scheme.png and b/Tests/LibWeb/Screenshot/expected/color-scheme.png differ
diff --git a/Tests/LibWeb/Text/expected/css/text-input-baseline-alignment.txt b/Tests/LibWeb/Text/expected/css/text-input-baseline-alignment.txt
new file mode 100644
index 00000000000..55854ad2f67
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/css/text-input-baseline-alignment.txt
@@ -0,0 +1,22 @@
+quirks row 0: true
+quirks row 1: true
+quirks row 2: true
+quirks row 3: true
+quirks row 4: true
+quirks row 5: true
+quirks row 6: true
+quirks row 7: true
+quirks block scroll fallback: true
+quirks multiline button baseline: true
+quirks inline-block fallback: true
+standards row 0: true
+standards row 1: true
+standards row 2: true
+standards row 3: true
+standards row 4: true
+standards row 5: true
+standards row 6: true
+standards row 7: true
+standards block scroll fallback: true
+standards multiline button baseline: true
+standards inline-block fallback: true
diff --git a/Tests/LibWeb/Text/expected/display_list/input-focus-switch-selection-and-caret.txt b/Tests/LibWeb/Text/expected/display_list/input-focus-switch-selection-and-caret.txt
index b3854f5a878..9cfca929ba1 100644
--- a/Tests/LibWeb/Text/expected/display_list/input-focus-switch-selection-and-caret.txt
+++ b/Tests/LibWeb/Text/expected/display_list/input-focus-switch-selection-and-caret.txt
@@ -14,7 +14,7 @@ DisplayList:
FillRect@s1/e0 rect=[8,8 198x20] color=rgb(255, 255, 255)
FillRoundedRectRing@s1/e0 rect=[8,8 198x20] widths=[1,1,1,1] color=rgb(118, 118, 118)
DrawGlyphRun@s1/c1/e0 rect=[11,10 28x16] translation=[11,22.796875] color=rgb(0, 0, 0)
-DrawGlyphRun@s1/e0 rect=[205,13 8x16] translation=[205.875,25.796875] color=rgb(0, 0, 0)
+DrawGlyphRun@s1/e0 rect=[205,10 8x16] translation=[205.875,22.796875] color=rgb(0, 0, 0)
FillRect@s1/e0 rect=[214,8 198x20] color=rgb(255, 255, 255)
FillRoundedRectRing@s1/e0 rect=[214,8 198x20] widths=[1,1,1,1] color=rgb(118, 118, 118)
DrawGlyphRun@s1/c3/e0 rect=[216,10 28x16] translation=[216.875,22.796875] color=rgb(0, 0, 0)
diff --git a/Tests/LibWeb/Text/input/css/text-input-baseline-alignment.html b/Tests/LibWeb/Text/input/css/text-input-baseline-alignment.html
new file mode 100644
index 00000000000..eeb173be563
--- /dev/null
+++ b/Tests/LibWeb/Text/input/css/text-input-baseline-alignment.html
@@ -0,0 +1,57 @@
+<!doctype html>
+<script src="../include.js"></script>
+<script>
+ asyncTest(async done => {
+ for (const mode of ["quirks", "standards"]) {
+ const frame = document.createElement("iframe");
+ frame.width = 800;
+ const loaded = new Promise(resolve => (frame.onload = resolve));
+ frame.srcdoc = `${mode === "standards" ? "<!doctype html>" : ""}
+ <style>
+ body { font: 20px/20px monospace; }
+ input, button { font: inherit; height: 40px; padding: 4px; border: 2px solid; box-sizing: content-box; }
+ .host { display: inline-block; height: 40px; padding: 4px; border: 2px solid; overflow: clip; }
+ .wrapper { display: flex; height: 100%; align-items: center; }
+ .editor { height: 1lh; overflow: auto; }
+ </style>
+ <div><input value="hello"><input type="submit"><button>Button</button></div>
+ <div><input><button>Button</button></div>
+ <div><input placeholder="hello"><button>Button</button></div>
+ <div><input type="number" value="42"><button>Button</button></div>
+ <div><input style="appearance: none" value="hello"><button>Button</button></div>
+ <div><span class="host"><div class="wrapper"><div class="editor">hello</div></div></span><button>Button</button></div>
+ <div><span class="host"><div class="wrapper"><div class="editor">hello<br>world</div></div></span><button>Button</button></div>
+ <div><span class="host"><div class="wrapper" style="display: grid"><div class="editor">hello<br>world</div></div></span><button>Button</button></div>`;
+ document.body.appendChild(frame);
+ await loaded;
+ const rows = frame.contentDocument.body.children;
+ for (let i = 0; i < rows.length; ++i) {
+ const tops = Array.from(rows[i].children, element => element.getBoundingClientRect().top);
+ println(`${mode} row ${i}: ${tops.every(top => top === tops[0])}`);
+ }
+ const blockScroll = frame.contentDocument.createElement("div");
+ blockScroll.innerHTML =
+ '<span class="host"><div class="wrapper" style="display: block"><div class="editor">hello<br>world</div></div></span><span style="display: inline-block; width: 0; height: 0"></span>';
+ frame.contentDocument.body.appendChild(blockScroll);
+ println(
+ `${mode} block scroll fallback: ${blockScroll.querySelector(".editor").getBoundingClientRect().bottom === blockScroll.lastChild.getBoundingClientRect().top}`
+ );
+ const multilineButton = frame.contentDocument.createElement("div");
+ multilineButton.innerHTML =
+ '<button><div>one</div><div>two<span style="display: inline-block; width: 0; height: 0"></span></div></button><span style="display: inline-block; width: 0; height: 0"></span>';
+ frame.contentDocument.body.appendChild(multilineButton);
+ println(
+ `${mode} multiline button baseline: ${multilineButton.querySelector("button span").getBoundingClientRect().top === multilineButton.lastChild.getBoundingClientRect().top}`
+ );
+ const fallback = frame.contentDocument.createElement("div");
+ fallback.innerHTML =
+ '<span style="display: inline-block; overflow: hidden; height: 40px">hello</span><span style="display: inline-block; width: 0; height: 0"></span>';
+ frame.contentDocument.body.appendChild(fallback);
+ println(
+ `${mode} inline-block fallback: ${fallback.firstChild.getBoundingClientRect().bottom === fallback.lastChild.getBoundingClientRect().top}`
+ );
+ frame.remove();
+ }
+ done();
+ });
+</script>