fix: render <br> between paragraphs as a visible section break (#2548)

Co-authored-by: Brooks Ilg <brooksmilg@gmail.com>
This commit is contained in:
Uri Tauber
2026-07-06 20:10:31 +03:00
committed by GitHub
co-authored by Brooks Ilg
parent ca1b833126
commit 44ff313740
4 changed files with 236 additions and 2 deletions
+8
View File
@@ -32,6 +32,11 @@ struct BlockStyle {
bool isRtl = false; // true if resolved direction is RTL
bool directionDefined = false; // true if direction was explicitly set in CSS/HTML
// Set when this block was created by a <br> element. Used by startNewTextBlock to inject
// a full line-height gap when the <br> block stays empty (section-break use case).
// NOT propagated through getCombinedBlockStyle so it can't leak into sibling blocks.
bool fromBrElement = false;
// Combined insets (margin + padding)
[[nodiscard]] int16_t leftInset() const { return marginLeft + paddingLeft; }
[[nodiscard]] int16_t rightInset() const { return marginRight + paddingRight; }
@@ -92,6 +97,9 @@ struct BlockStyle {
result.directionDefined = true;
}
// fromBrElement is consumed by startNewTextBlock when an empty <br> block
// is merged with the following paragraph; never propagate it further.
result.fromBrElement = false;
return result;
}