refactor(layout): extract the inline token model out of TextFlowSupport#346
Merged
Conversation
Move the inline layout tokens — the sealed InlineLayoutToken and its InlineText / Image / Shape / Svg record variants (with the SVG-layer lowering) — out of the TextFlowSupport god-class into their own package-private file. The types were private nested; as top-level package-private types the wrapping loops reference them by simple name unchanged. Pure type move, no behaviour change; the paragraph wrapping loops that build and consume them follow next.
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
TextFlowSupportis the largest file indocument.layout(~1877 LOC). This is the first of two byte-identical steps that pull the inline paragraph wrapping subsystem out of it. Step 1 moves the leaf of that subsystem — the inline token model — so the follow-up wrapping-loop extraction has a clean dependency to build on.What
InlineLayoutToken.java: the sealedInlineLayoutTokenand itsInlineTextToken/InlineImageToken/InlineShapeToken/InlineSvgTokenrecord variants (includingInlineSvgToken.toResolvedSvgLayer, the SVG-layer → engine-span lowering).privatenested inTextFlowSupport; as top-level package-private types the wrapping loops reference them by simple name unchanged (same package) — the modified file only loses code (−200: the token block + 6 now-unused imports).document.layoutis@Internal).Tests
InlineHighlightRenderTest,InlineSvgRenderTest,InlineShapeRenderTest,UnicodeFallbackDemoTest,TableCellInlineCodeWrapTest,PdfVisualRegressionTest, all*VisualParityTest,LayoutSnapshotRegressionDemoTest) green: renders are byte-identical.ParagraphWrappingTestlands with the wrapping-loop extraction (step 2).Follow-up
Step 2 extracts the wrap loops + tokenize/trim/indent helpers +
ParagraphIndentSpecinto aParagraphWrappingcollaborator (rewiring theprepareParagraphLayoutcall sites).