Commit 8c2f2d8
do truncation inline with main layout
Summary:
Reviewing a new batch of screenshots after D54698703 showed some more flaws in how we're truncating.
The initial height of the text layout is derived from the layout object
https://www.internalfb.com/code/fbsource/[05747540c982b8816899085a43b5ec9160d12f08]/fbandroid/libraries/rendercore/rendercore-text/src/main/java/com/facebook/rendercore/text/TextMeasurementUtils.java?lines=295
But the layout logic can add and remove some spacing from the initial height in the following scenarios:
https://www.internalfb.com/code/fbsource/[05747540c982b8816899085a43b5ec9160d12f08]/fbandroid/libraries/rendercore/rendercore-text/src/main/java/com/facebook/rendercore/text/TextMeasurementUtils.java?lines=297-298%2C300-302
https://www.internalfb.com/code/fbsource/[05747540c982b8816899085a43b5ec9160d12f08]/fbandroid/libraries/rendercore/rendercore-text/src/main/java/com/facebook/rendercore/text/TextMeasurementUtils.java?lines=319-325
This eventually results in the final reported height being different from the actual layout's height.
In our current approach to truncation, we compare the reported (modified) height against the initial text layout's height and then go ahead to truncate which is not really correct.
What we should do is truncate the initial layout against the height constraints in the measure spec and then go on to modify the spacing as needed. This should be more correct.
----
I expect most (if not all) of the failing tests to start passing after this lands. This is the last change to the logic (hopefully)
Reviewed By: rooju
Differential Revision: D54874150
fbshipit-source-id: 1b6028e8836cc20faf5b059718654d5985eccc911 parent 4380d0a commit 8c2f2d8
File tree
1 file changed
+31
-48
lines changed- litho-rendercore-text/src/main/java/com/facebook/rendercore/text
1 file changed
+31
-48
lines changedLines changed: 31 additions & 48 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | 95 | | |
111 | 96 | | |
112 | 97 | | |
| |||
117 | 102 | | |
118 | 103 | | |
119 | 104 | | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | 105 | | |
154 | 106 | | |
155 | 107 | | |
| |||
259 | 211 | | |
260 | 212 | | |
261 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
262 | 245 | | |
263 | 246 | | |
264 | 247 | | |
| |||
0 commit comments