fix(layout-engine): remove remaining pm-adapter boundary leaks#2618
Merged
harbournick merged 2 commits intomainfrom Mar 28, 2026
Merged
Conversation
Contributor
|
🎉 This PR is included in vscode-ext v1.1.0-next.32 |
Contributor
|
🎉 This PR is included in superdoc v1.24.0-next.31 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in superdoc-cli v0.5.0-next.31 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in superdoc-sdk v1.3.0-next.31 |
caio-pizzol
added a commit
that referenced
this pull request
Mar 28, 2026
layout-engine cannot import from pm-adapter (boundary removed in #2618). Define PX_PER_PT locally, same as border-layer.ts does.
caio-pizzol
added a commit
that referenced
this pull request
Mar 28, 2026
* fix: correct spacing for paragraphs with borders/shades * fix(layout): overlap border expansion with paragraph spacing (SD-2106) Per ECMA-376 §17.3.1.42, paragraph border space is measured from the text edge "ignoring any spacing above/below". This means border expansion should overlap with spacingBefore/After, not stack on top. - Reduce top border expansion by the amount spacingBefore already covers - Reduce effective spacingAfter by the bottom border expansion - Subtract border expansion from sliceLines available height to prevent page-bottom overflow - Include border expansion in keepLines height calculation * fix(layout): correct cursorY mismatch and continuation fragment overlap Three fixes from self-review: - fragment.y now uses extraTop (overlap-adjusted) instead of full borderExpansion.top, so cursorY reaches the visual bottom exactly - Track spacingAppliedThisFragment to avoid under-counting border expansion on continuation fragments after page breaks - keepLines fitsOnBlankPage uses overlap model (max instead of add) to avoid unnecessary page breaks for bordered paragraphs * fix(layout): hoist borderExpansion to function scope borderExpansion was declared inside the while loop but referenced in the spacingAfter block outside it, causing a ReferenceError. Move it before the loop so it's accessible in both places. * fix(layout,renderer): between-border group detection and spacing Layout engine: - Detect between-border groups by comparing adjacent paragraph border hashes. When borders match, suppress top expansion and reclaim previous paragraph's bottom expansion. - Border expansion is additive with spacing for non-grouped paragraphs (matches Word behavior). - Add lastParagraphBorderHash to PageState for group tracking. Renderer (group-analysis.ts): - Remove requirement for `between` border element to be present for grouping. Per ECMA-376 §17.3.1.5, grouping occurs when all border properties are identical — a between border is optional. - When no between border is defined, suppress bottom/top borders and render as a single continuous box. * test(painter-dom): update between-border test for grouping without between element The test expected no grouping when `between` border is absent. Updated to expect grouping with suppressBottomBorder per ECMA-376 §17.3.1.5: identical borders form a group regardless of whether a between border is defined. * fix(layout): use local PX_PER_PT constant instead of pm-adapter import layout-engine cannot import from pm-adapter (boundary removed in #2618). Define PX_PER_PT locally, same as border-layer.ts does. --------- Co-authored-by: Johannes Wilm <mail@johanneswilm.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.