refactor(api): rename paragraph inline svg/emoji adders to inlineSvgIcon/inlineEmoji#221
Merged
Merged
Conversation
…nlineEmoji ParagraphBuilder's inline adders now follow the existing inlineText / inlineImage / inlineLink convention: svgIcon -> inlineSvgIcon and emoji -> inlineEmoji (all overloads). RichText keeps its bare svgIcon / emoji names, which are internally consistent there. The API is unreleased (@SInCE 1.9.0), so there is no deprecation bridge. Also adds two InlineSvgRenderTest cases for inline-SVG paths that only single-line paragraphs reached before: an icon that wraps onto a later line (asserting that line grows to the icon via lineHeight > textLineHeight) and an icon inside a paragraph that splits across a page break (it still paints on its head page).
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.
Why
ParagraphBuilder's inline adders are namedinlineText/inlineImage/inlineLink/inlineLinkTo, but the two newest —svgIcon(...)andemoji(...)— broke that convention, so one builder mixed two naming stylesfor inline runs. The methods are
@since 1.9.0and unreleased, so the namesare still free to change.
Separately,
InlineSvgRenderTestonly exercised single-line paragraphs,leaving the inline-SVG wrap and pagination paths untested:
wrapInlineParagraphruns an
InlineSvgTokenthrough the greedy width-fit andtoInlineParagraphLinedrives each line's height off that token, but nothing asserted an icon that
lands on a wrapped line or crosses a page break.
What changed
ParagraphBuilder.svgIcon(...)→inlineSvgIcon(...)andemoji(...)→inlineEmoji(...)(all overloads), restoring theinline*convention.
RichText.svgIcon/RichText.emojikeep their bare names —internally consistent there. No deprecation bridge: the methods are
unreleased. Callers in
examples/, the tests, the emojipackage-infoandthe in-progress CHANGELOG bullets are updated to match.
InlineSvgRenderTestcases:inlineSvgIconWrapsAcrossLinesAndDrivesLineHeight— a tall icon on anarrow column; asserts the paragraph wraps to ≥2 lines, the icon's line
carries a
ParagraphSvgSpan, and that line'slineHeight()exceeds itstextLineHeight()(the icon, not the text, drove the height), then thatthe icon actually paints.
inlineSvgIconSplitAcrossPagesRendersAndPaints— a paginating paragraph;asserts ≥2 pages and the icon still paints on its head page.
Verification
./mvnw test -pl .→ BUILD SUCCESS, 1466 tests (InlineSvgRenderTest9,EmojiRenderTest4)../mvnw -f examples/pom.xml compile→ BUILD SUCCESS(examples build against the renamed API).
Lane: canonical (document.dsl) + test — public-API rename of unreleased methods, plus inline-SVG wrap/pagination coverage.
Independent of the other open branches.