Commit Graph

2 Commits

Author SHA1 Message Date
Valentin Shergin 90ada5abb1 Fabric: Calculating positions of attachments as part of text measurement
Summary:
This diff changes API we use to measure text. Previously, a platform-specific measure infra returned just the size of the text, now it returns the size and an array of frames that describe where attachments are placed.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D20268041

fbshipit-source-id: 7c065607b6af18a36318db0aab24dad0f171d33a
2020-03-09 16:36:46 -07:00
Valentin Shergin e08412d9a1 Fabric: Text Measuring: TextMeasureCache the new, improved text measure cache
Summary:
Special thanks for Joshua Gross for flagging this problem!

This diff implements a custom evicting hash map designed specially to hold text measurement information. The key feature of this is custom equality checks and hashing functions.

They are designed around the following principals:
* Decorative text attributes (such as color, shadows, etc) has no effect on layout, therefore they should not be taking into account;
* `minimum height`, `minimum width`, and `maximum height` don't affect the measurement;
* the value of `layout metrics` are important only for `attachment` fragments.

After I redo all tests, I will enable this for Android-specific TextLayoutManager in separate diff.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18848583

fbshipit-source-id: 46c2fc445fbd1823afc5e7498e37de75381258b1
2019-12-06 10:54:13 -08:00