Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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: 1b6028e8836cc20faf5b059718654d5985eccc91
- Loading branch information