mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fabric: Moving MeasureCache into TextLayoutManager
Summary: We will have several consumers for the measure infra soon (TextInput will use the same TextLayoutManager). It makes sense to move the cache there. In the future, iOS and Android implementations will probably use a bit different (platform-specific) cache implementations because we will implement the ability to measure "opaque"/platform-specific text containers alongside with normal AttributeStrings. Changelog: [Internal] Fabric-specific internal change. Reviewed By: mdvacca Differential Revision: D18445855 fbshipit-source-id: 7b7a65152ac13c74525da695612ae034904e82bf
This commit is contained in:
committed by
Facebook Github Bot
parent
5f0435fb85
commit
f32aa2a516
@@ -26,6 +26,18 @@ Size TextLayoutManager::measure(
|
||||
AttributedString attributedString,
|
||||
ParagraphAttributes paragraphAttributes,
|
||||
LayoutConstraints layoutConstraints) const {
|
||||
return measureCache_.get(
|
||||
MeasureCacheKey{attributedString, paragraphAttributes, layoutConstraints},
|
||||
[&](MeasureCacheKey const &key) {
|
||||
return doMeasure(
|
||||
attributedString, paragraphAttributes, layoutConstraints);
|
||||
});
|
||||
}
|
||||
|
||||
Size TextLayoutManager::doMeasure(
|
||||
AttributedString attributedString,
|
||||
ParagraphAttributes paragraphAttributes,
|
||||
LayoutConstraints layoutConstraints) const {
|
||||
const jni::global_ref<jobject> &fabricUIManager =
|
||||
contextContainer_->at<jni::global_ref<jobject>>("FabricUIManager");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user