Skip to content

Commit

Permalink
Insert a (non-collapsed) newline for <br> tags
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoburns committed Jun 21, 2024
1 parent def4c90 commit 986e25b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/dom/src/layout/construct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ pub(crate) fn build_inline_layout(
}
}
(DisplayOutside::Inline, DisplayInside::Flow) => {
let tag_name = &node.raw_dom_data.downcast_element().unwrap().name.local;
let tag_name = &element_data.name.local;

if *tag_name == local_name!("img") || *tag_name == local_name!("input") {
builder.push_inline_box(InlineBox {
Expand All @@ -348,6 +348,12 @@ pub(crate) fn build_inline_layout(
width: 0.0,
height: 0.0,
});
} else if *tag_name == local_name!("br") {
builder.push_style_modification_span(&[]);
builder.set_white_space_mode(WhiteSpaceCollapse::Preserve);
builder.push_text("\n");
builder.pop_style_span();
builder.set_white_space_mode(collapse_mode);
} else {
let mut style = node
.primary_styles()
Expand Down

0 comments on commit 986e25b

Please sign in to comment.