Commit 4b8f2fd
authored
refactor(direction): centralize last paragraph isRtl reads on helper (SD-2778) (#3289)
* refactor(direction): centralize last paragraph isRtl reads on helper (SD-2778)
Migrate the two remaining direct reads of attrs.direction/.dir on the
paragraph inline-direction axis onto getParagraphInlineDirection:
- layout-bridge/src/position-hit.ts: isRtlBlock
- layout-resolved/src/resolveParagraph.ts: isRtl
Behavior is unchanged on the typed directionContext path and strictly
broader on fallback (the helper also covers paragraphProperties.rightToLeft).
After this, no consumer outside the helper reads the legacy scalar fields;
a follow-up can stop pm-adapter from writing them and drop them from
ParagraphAttrs.
* test(direction): pin SD-2778 migration via typed-path + broader-fallback cases
Two coverage gaps caught in review:
- layout-resolved/src/resolveLayout.test.ts ("preserves increasing
first-line marker anchor for nested RTL list levels") used
attrs.direction: 'rtl'. The pre-migration code read attrs.direction
directly, so that fixture would have passed against the old
implementation. Switch to directionContext.inlineDirection so the test
only passes through the new helper-driven typed path.
- layout-bridge/test/position-hit.test.ts: switching isRtlBlock to
getParagraphInlineDirection is strictly broader on fallback (the helper
also picks up paragraphProperties.rightToLeft when no directionContext
is present). Pin that case so the broadening is intentional and not a
regression vector.1 parent ef9821e commit 4b8f2fd
4 files changed
Lines changed: 24 additions & 22 deletions
File tree
- packages/layout-engine
- layout-bridge
- src
- test
- layout-resolved/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
27 | 32 | | |
28 | 33 | | |
29 | 34 | | |
| |||
120 | 125 | | |
121 | 126 | | |
122 | 127 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | 128 | | |
130 | 129 | | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
| 130 | + | |
143 | 131 | | |
144 | 132 | | |
145 | 133 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
64 | 73 | | |
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1777 | 1777 | | |
1778 | 1778 | | |
1779 | 1779 | | |
1780 | | - | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
1781 | 1786 | | |
1782 | 1787 | | |
1783 | 1788 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| |||
0 commit comments