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
This commit is contained in:
Valentin Shergin authored and Facebook Github Bot committed 2020-03-09 16:36:46 -07:00
1 parent d1ad29b7db
commit 90ada5abb1
10 files changed
+94 -40

No files matched your search

@@ -22,7 +22,7 @@ void *TextLayoutManager::getNativeTextLayoutManager() const {
return self_;
}
Size TextLayoutManager::measure(
TextMeasurement TextLayoutManager::measure(
AttributedStringBox attributedStringBox,
ParagraphAttributes paragraphAttributes,
LayoutConstraints layoutConstraints) const {
@@ -36,7 +36,7 @@ Size TextLayoutManager::measure(
});
}
Size TextLayoutManager::doMeasure(
TextMeasurement TextLayoutManager::doMeasure(
AttributedString attributedString,
ParagraphAttributes paragraphAttributes,
LayoutConstraints layoutConstraints) const {
@@ -69,7 +69,7 @@ Size TextLayoutManager::doMeasure(
reinterpret_cast<ReadableMap::javaobject>(attributedStringRNM.get()));
local_ref<ReadableMap::javaobject> paragraphAttributesRM = make_local(
reinterpret_cast<ReadableMap::javaobject>(paragraphAttributesRNM.get()));
return yogaMeassureToSize(measure(
auto size = yogaMeassureToSize(measure(
fabricUIManager,
-1,
componentName.get(),
@@ -80,6 +80,8 @@ Size TextLayoutManager::doMeasure(
maximumSize.width,
minimumSize.height,
maximumSize.height));
return TextMeasurement{size, {}};
}
} // namespace react