Repository navigation
fix(html): give mixed-direction bordered paragraphs their own boxes when indents differ (#1155) - #1163
Merged
Conversation
…hen indents differ (#1155) A right-to-left paragraph mirrors its border box, so with unequal start and end indents it cannot share a box with a left-to-right paragraph. BorderGroupKey now adds the direction to the key in exactly that case; paragraphs whose boxes coincide still join, as LibreOffice joins them.
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.
Closes #1155
Third of a three-PR stack: #1161 (#1153), then #1154's PR, then this one. It is based on #1154's branch and will be retargeted to
mainas the stack merges.Why
The converter groups consecutive bordered paragraphs into one box (with
w:betweenborders) when their borders and indents match. A right-to-left paragraph mirrors its box: its start indent is on the right. So when start and end differ (sayw:start="720" w:end="1440"), a left-to-right and a right-to-left paragraph need mirror-image boxes. One shared box put one of them's indents on the wrong sides.What Word and LibreOffice do
LibreOffice 25.8.7.3, given three cases:
start=1440 hanging=720 end=720: one box, because the box's leading edge (start less hanging) matches its trailing edge.Word has not been measured for this case.
How it works
BorderGroupKeydecides grouping. It now appends the paragraph's direction to the key only when the paragraph is right-to-left and its box is not mirror-symmetric. Mirror-symmetric means the leading edge (leading indent less any hanging indent, exactly asCreateBorderDivslays the box out) equals the trailing edge. So:DocxSession's render plan uses the same key, so it picks up the change.Validation
RightToLeftParagraphBorderTests:Adversarial review
One round of hostile review ran before opening. It probed the unequal, equal and hanging cases against LibreOffice, a group whose first paragraph is right-to-left,
w:bidi w:val="0", and both indent spellings, and found them correct.w:ind, while the renderer includes it. That gap predates this change, but direction can now split a group too, so it shows up more. In the common case (an asymmetric indent that comes only from numbering) the plan joins what the renderer splits, which is harmless. The reverse needs a style's asymmetric indent overridden by a symmetric numbering indent. That is contrived, and it is left for a follow-up.