From 4ca5e79164bedfc43314aeca6111811d6c4d1730 Mon Sep 17 00:00:00 2001 From: James Ide Date: Wed, 2 Dec 2026 02:20:38 -0800 Subject: [PATCH] Use exact float equality in text measurement cache keys Text measurement keys can compare equal and hash differently when their float values are close. On libc++, neighboring font sizes occupy separate entries even though the keys compare equal. An infinite font limit also prevents the LRU from erasing the corresponding map entry because the key does not compare equal to itself. Compare key floats exactly and canonicalize NaN hashes, including the coordinates of a present shadow offset. Keep the existing attribute comparisons for renderer updates. Compare lineBreakMode in the prepared key because its display hash includes that field. The Fantom text layout and attributed string suites cover adjacent floats, unset values, an infinite font limit, prepared shadow offsets and line break modes. The Android text unit tests pass. --- .../attributedstring/ParagraphAttributes.cpp | 21 ++- .../attributedstring/ParagraphAttributes.h | 10 +- .../attributedstring/TextAttributes.cpp | 41 ++++-- .../attributedstring/TextAttributes.h | 27 ++-- .../textlayoutmanager/TextMeasureCache.h | 33 ++--- .../tests/TextLayoutManagerTest.cpp | 130 ++++++++++++++++++ .../ReactCommon/react/utils/FloatComparison.h | 14 ++ .../ReactAndroidFrameworksCxx.api | 6 + .../api-snapshots/ReactAppleFrameworksCxx.api | 6 + .../ReactCommonFrameworksCxx.api | 6 + 10 files changed, 257 insertions(+), 37 deletions(-) diff --git a/packages/react-native/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.cpp b/packages/react-native/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.cpp index c6bbbf364ce4..3551b6615674 100644 --- a/packages/react-native/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.cpp +++ b/packages/react-native/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.cpp @@ -15,6 +15,23 @@ namespace facebook::react { bool ParagraphAttributes::operator==(const ParagraphAttributes& rhs) const { + return equals(rhs); +} + +bool ParagraphAttributes::equalsForTextCache( + const ParagraphAttributes& rhs) const { + return equals(rhs); +} + +template +bool ParagraphAttributes::equals(const ParagraphAttributes& rhs) const { + const auto equal = [](Float lhs, Float rhs) { + if constexpr (Exact) { + return exactFloatEquality(lhs, rhs); + } + return floatEquality(lhs, rhs); + }; + return std::tie( maximumNumberOfLines, ellipsizeMode, @@ -37,8 +54,8 @@ bool ParagraphAttributes::operator==(const ParagraphAttributes& rhs) const { rhs.lineBreak, rhs.wordBreak, rhs.textAlignVertical) && - floatEquality(minimumFontSize, rhs.minimumFontSize) && - floatEquality(minimumFontScale, rhs.minimumFontScale); + equal(minimumFontSize, rhs.minimumFontSize) && + equal(minimumFontScale, rhs.minimumFontScale); } #pragma mark - DebugStringConvertible diff --git a/packages/react-native/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.h b/packages/react-native/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.h index 7a8d8dba13a1..1f5c2e1499d4 100644 --- a/packages/react-native/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.h +++ b/packages/react-native/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.h @@ -16,6 +16,7 @@ #include #include #include +#include namespace facebook::react { @@ -99,12 +100,17 @@ class ParagraphAttributes : public DebugStringConvertible { std::optional textAlignVertical{}; bool operator==(const ParagraphAttributes &rhs) const; + bool equalsForTextCache(const ParagraphAttributes &rhs) const; #pragma mark - DebugStringConvertible #if RN_DEBUG_STRING_CONVERTIBLE SharedDebugStringConvertibleList getDebugProps() const override; #endif + + private: + template + bool equals(const ParagraphAttributes &rhs) const; }; } // namespace facebook::react @@ -121,12 +127,12 @@ struct hash { attributes.textBreakStrategy, attributes.textWidthMode, attributes.adjustsFontSizeToFit, - attributes.minimumFontSize, + facebook::react::canonicalizeNaN(attributes.minimumFontSize), attributes.includeFontPadding, attributes.android_hyphenationFrequency, attributes.lineBreak, attributes.wordBreak, - attributes.minimumFontScale, + facebook::react::canonicalizeNaN(attributes.minimumFontScale), attributes.textAlignVertical); } }; diff --git a/packages/react-native/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp b/packages/react-native/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp index ce756b823d01..bf9ebcaad86c 100644 --- a/packages/react-native/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp +++ b/packages/react-native/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp @@ -133,6 +133,32 @@ void TextAttributes::apply(TextAttributes textAttributes) { #pragma mark - Operators bool TextAttributes::operator==(const TextAttributes& rhs) const { + return textShadowOffset == rhs.textShadowOffset && equals(rhs); +} + +bool TextAttributes::equalsForTextCache(const TextAttributes& rhs) const { + if (textShadowOffset.has_value() != rhs.textShadowOffset.has_value()) { + return false; + } + if (textShadowOffset && + (!exactFloatEquality( + textShadowOffset->width, rhs.textShadowOffset->width) || + !exactFloatEquality( + textShadowOffset->height, rhs.textShadowOffset->height))) { + return false; + } + return lineBreakMode == rhs.lineBreakMode && equals(rhs); +} + +template +bool TextAttributes::equals(const TextAttributes& rhs) const { + const auto equal = [](Float lhs, Float rhs) { + if constexpr (Exact) { + return exactFloatEquality(lhs, rhs); + } + return floatEquality(lhs, rhs); + }; + return std::tie( foregroundColor, backgroundColor, @@ -149,7 +175,6 @@ bool TextAttributes::operator==(const TextAttributes& rhs) const { textDecorationColor, textDecorationLineType, textDecorationStyle, - textShadowOffset, textShadowColor, isHighlighted, isPressable, @@ -174,7 +199,6 @@ bool TextAttributes::operator==(const TextAttributes& rhs) const { rhs.textDecorationColor, rhs.textDecorationLineType, rhs.textDecorationStyle, - rhs.textShadowOffset, rhs.textShadowColor, rhs.isHighlighted, rhs.isPressable, @@ -183,13 +207,12 @@ bool TextAttributes::operator==(const TextAttributes& rhs) const { rhs.role, rhs.textTransform, rhs.textEffects) && - floatEquality(maxFontSizeMultiplier, rhs.maxFontSizeMultiplier) && - floatEquality(opacity, rhs.opacity) && - floatEquality(fontSize, rhs.fontSize) && - floatEquality(fontSizeMultiplier, rhs.fontSizeMultiplier) && - floatEquality(letterSpacing, rhs.letterSpacing) && - floatEquality(lineHeight, rhs.lineHeight) && - floatEquality(textShadowRadius, rhs.textShadowRadius); + equal(maxFontSizeMultiplier, rhs.maxFontSizeMultiplier) && + equal(opacity, rhs.opacity) && equal(fontSize, rhs.fontSize) && + equal(fontSizeMultiplier, rhs.fontSizeMultiplier) && + equal(letterSpacing, rhs.letterSpacing) && + equal(lineHeight, rhs.lineHeight) && + equal(textShadowRadius, rhs.textShadowRadius); } TextAttributes TextAttributes::defaultTextAttributes() { diff --git a/packages/react-native/ReactCommon/react/renderer/attributedstring/TextAttributes.h b/packages/react-native/ReactCommon/react/renderer/attributedstring/TextAttributes.h index 49e3d5deaa56..31ecabf88f64 100644 --- a/packages/react-native/ReactCommon/react/renderer/attributedstring/TextAttributes.h +++ b/packages/react-native/ReactCommon/react/renderer/attributedstring/TextAttributes.h @@ -21,6 +21,7 @@ #include #include #include +#include namespace facebook::react { @@ -107,12 +108,17 @@ class TextAttributes : public DebugStringConvertible { #pragma mark - Operators bool operator==(const TextAttributes &rhs) const; + bool equalsForTextCache(const TextAttributes &rhs) const; #pragma mark - DebugStringConvertible #if RN_DEBUG_STRING_CONVERTIBLE SharedDebugStringConvertibleList getDebugProps() const override; #endif + + private: + template + bool equals(const TextAttributes &rhs) const; }; } // namespace facebook::react @@ -142,17 +148,22 @@ struct hash { seed, textAttributes.foregroundColor, textAttributes.backgroundColor, - textAttributes.opacity, + facebook::react::canonicalizeNaN(textAttributes.opacity), textAttributes.fontFamily, - textAttributes.fontSize, - textAttributes.maxFontSizeMultiplier, - textAttributes.fontSizeMultiplier, - textAttributes.letterSpacing, - textAttributes.lineHeight, - textAttributes.textShadowRadius, + facebook::react::canonicalizeNaN(textAttributes.fontSize), + facebook::react::canonicalizeNaN(textAttributes.maxFontSizeMultiplier), + facebook::react::canonicalizeNaN(textAttributes.fontSizeMultiplier), + facebook::react::canonicalizeNaN(textAttributes.letterSpacing), + facebook::react::canonicalizeNaN(textAttributes.lineHeight), + facebook::react::canonicalizeNaN(textAttributes.textShadowRadius), textAttributes.textDecorationColor, textAttributes.textShadowColor, textEffectsHash); + auto shadowOffset = textAttributes.textShadowOffset; + if (shadowOffset) { + shadowOffset->width = facebook::react::canonicalizeNaN(shadowOffset->width); + shadowOffset->height = facebook::react::canonicalizeNaN(shadowOffset->height); + } facebook::react::hash_combine_optionals( seed, textAttributes.fontWeight, @@ -167,7 +178,7 @@ struct hash { textAttributes.lineBreakMode, textAttributes.textDecorationLineType, textAttributes.textDecorationStyle, - textAttributes.textShadowOffset, + shadowOffset, textAttributes.isHighlighted, textAttributes.isPressable, textAttributes.layoutDirection, diff --git a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.h b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.h index c1eb566133d2..e4e9ff8ea65b 100644 --- a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.h +++ b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.h @@ -150,9 +150,10 @@ inline bool areTextAttributesEquivalentLayoutWise(const TextAttributes &lhs, con rhs.lineBreakMode, rhs.layoutDirection, rhs.alignment) && - floatEquality(lhs.fontSize, rhs.fontSize) && floatEquality(lhs.fontSizeMultiplier, rhs.fontSizeMultiplier) && - floatEquality(lhs.letterSpacing, rhs.letterSpacing) && floatEquality(lhs.lineHeight, rhs.lineHeight) && - floatEquality(lhs.maxFontSizeMultiplier, rhs.maxFontSizeMultiplier) && lhs.textEffects == rhs.textEffects; + exactFloatEquality(lhs.fontSize, rhs.fontSize) && + exactFloatEquality(lhs.fontSizeMultiplier, rhs.fontSizeMultiplier) && + exactFloatEquality(lhs.letterSpacing, rhs.letterSpacing) && exactFloatEquality(lhs.lineHeight, rhs.lineHeight) && + exactFloatEquality(lhs.maxFontSizeMultiplier, rhs.maxFontSizeMultiplier) && lhs.textEffects == rhs.textEffects; } inline size_t textAttributesHashLayoutWise(const TextAttributes &textAttributes) @@ -165,11 +166,11 @@ inline size_t textAttributesHashLayoutWise(const TextAttributes &textAttributes) facebook::react::hash_combine( seed, textAttributes.fontFamily, - textAttributes.fontSize, - textAttributes.fontSizeMultiplier, - textAttributes.maxFontSizeMultiplier, - textAttributes.letterSpacing, - textAttributes.lineHeight); + canonicalizeNaN(textAttributes.fontSize), + canonicalizeNaN(textAttributes.fontSizeMultiplier), + canonicalizeNaN(textAttributes.maxFontSizeMultiplier), + canonicalizeNaN(textAttributes.letterSpacing), + canonicalizeNaN(textAttributes.lineHeight)); facebook::react::hash_combine_optionals( seed, textAttributes.fontWeight, @@ -196,7 +197,7 @@ inline bool areAttributedStringFragmentsEquivalentDisplayWise( const AttributedString::Fragment &lhs, const AttributedString::Fragment &rhs) { - return lhs.isContentEqual(rhs) && + return lhs.string == rhs.string && lhs.textAttributes.equalsForTextCache(rhs.textAttributes) && // LayoutMetrics of an attachment fragment affects the size of a measured // attributed string. (!lhs.isAttachment() || (lhs.parentShadowView.layoutMetrics == rhs.parentShadowView.layoutMetrics)); @@ -281,21 +282,21 @@ inline size_t attributedStringHashDisplayWise(const AttributedString &attributed inline bool operator==(const TextMeasureCacheKey &lhs, const TextMeasureCacheKey &rhs) { return areAttributedStringsEquivalentLayoutWise(lhs.attributedString, rhs.attributedString) && - lhs.paragraphAttributes == rhs.paragraphAttributes && lhs.layoutConstraints == rhs.layoutConstraints && - floatEquality(lhs.pointScaleFactor, rhs.pointScaleFactor); + lhs.paragraphAttributes.equalsForTextCache(rhs.paragraphAttributes) && + lhs.layoutConstraints == rhs.layoutConstraints && exactFloatEquality(lhs.pointScaleFactor, rhs.pointScaleFactor); } inline bool operator==(const LineMeasureCacheKey &lhs, const LineMeasureCacheKey &rhs) { return areAttributedStringsEquivalentLayoutWise(lhs.attributedString, rhs.attributedString) && - lhs.paragraphAttributes == rhs.paragraphAttributes && lhs.size == rhs.size; + lhs.paragraphAttributes.equalsForTextCache(rhs.paragraphAttributes) && lhs.size == rhs.size; } inline bool operator==(const PreparedTextCacheKey &lhs, const PreparedTextCacheKey &rhs) { return areAttributedStringsEquivalentDisplayWise(lhs.attributedString, rhs.attributedString) && - lhs.paragraphAttributes == rhs.paragraphAttributes && lhs.layoutConstraints == rhs.layoutConstraints && - floatEquality(lhs.pointScaleFactor, rhs.pointScaleFactor); + lhs.paragraphAttributes.equalsForTextCache(rhs.paragraphAttributes) && + lhs.layoutConstraints == rhs.layoutConstraints && exactFloatEquality(lhs.pointScaleFactor, rhs.pointScaleFactor); } } // namespace facebook::react @@ -310,7 +311,7 @@ struct hash { attributedStringHashLayoutWise(key.attributedString), key.paragraphAttributes, key.layoutConstraints, - key.pointScaleFactor); + facebook::react::canonicalizeNaN(key.pointScaleFactor)); } }; @@ -331,7 +332,7 @@ struct hash { attributedStringHashDisplayWise(key.attributedString), key.paragraphAttributes, key.layoutConstraints, - key.pointScaleFactor); + facebook::react::canonicalizeNaN(key.pointScaleFactor)); } }; diff --git a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/tests/TextLayoutManagerTest.cpp b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/tests/TextLayoutManagerTest.cpp index 512a91e9ff69..8cae2e52e08d 100644 --- a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/tests/TextLayoutManagerTest.cpp +++ b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/tests/TextLayoutManagerTest.cpp @@ -9,6 +9,8 @@ #include #include +#include +#include #include #include @@ -351,3 +353,131 @@ TEST(TextMeasurementRoundingTest, doesNotInflateHeightWithSubpixelHeadroom) { TEST(TextMeasurementRoundingTest, doesNotInflateWidthWithSubpixelHeadroom) { EXPECT_EQ(widthInPixels(Size{20.1, 100.0}), 61); } + +TEST(TextLayoutManagerTest, cacheKeysDistinguishAdjacentFloatValues) { + AttributedString first; + TextAttributes attributes; + attributes.fontSize = 16; + first.appendFragment({.string = "Text", .textAttributes = attributes}); + auto second = first; + second.getFragments().front().textAttributes.fontSize = + std::nextafter(attributes.fontSize, Float{17}); + + EXPECT_NE( + (TextMeasureCacheKey{.attributedString = first}), + (TextMeasureCacheKey{.attributedString = second})); + EXPECT_NE( + (LineMeasureCacheKey{.attributedString = first}), + (LineMeasureCacheKey{.attributedString = second})); + EXPECT_NE( + (PreparedTextCacheKey{.attributedString = first}), + (PreparedTextCacheKey{.attributedString = second})); + + ParagraphAttributes paragraph; + paragraph.minimumFontSize = 8; + paragraph.minimumFontScale = 0.5; + auto changed = paragraph; + changed.minimumFontSize = std::nextafter(paragraph.minimumFontSize, Float{9}); + EXPECT_NE( + (LineMeasureCacheKey{.paragraphAttributes = paragraph}), + (LineMeasureCacheKey{.paragraphAttributes = changed})); + changed = paragraph; + changed.minimumFontScale = + std::nextafter(paragraph.minimumFontScale, Float{1}); + EXPECT_NE( + (LineMeasureCacheKey{.paragraphAttributes = paragraph}), + (LineMeasureCacheKey{.paragraphAttributes = changed})); + + const auto scale = Float{2}; + const auto nextScale = std::nextafter(scale, Float{3}); + EXPECT_NE( + (TextMeasureCacheKey{.pointScaleFactor = scale}), + (TextMeasureCacheKey{.pointScaleFactor = nextScale})); + EXPECT_NE( + (PreparedTextCacheKey{.pointScaleFactor = scale}), + (PreparedTextCacheKey{.pointScaleFactor = nextScale})); +} + +TEST(TextLayoutManagerTest, cacheKeysHashUnsetFloatRepresentationsEqually) { + AttributedString first; + first.appendFragment({.string = "Text"}); + auto second = first; + second.getFragments().front().textAttributes.fontSize = + -std::numeric_limits::quiet_NaN(); + ParagraphAttributes paragraph; + paragraph.minimumFontScale = -std::numeric_limits::quiet_NaN(); + + const auto expectSameKey = [](const auto& lhs, const auto& rhs) { + using Key = std::decay_t; + EXPECT_EQ(lhs, rhs); + EXPECT_EQ(std::hash{}(lhs), std::hash{}(rhs)); + }; + expectSameKey( + TextMeasureCacheKey{.attributedString = first}, + TextMeasureCacheKey{ + .attributedString = second, .paragraphAttributes = paragraph}); + expectSameKey( + LineMeasureCacheKey{.attributedString = first}, + LineMeasureCacheKey{ + .attributedString = second, .paragraphAttributes = paragraph}); + expectSameKey( + PreparedTextCacheKey{.attributedString = first}, + PreparedTextCacheKey{ + .attributedString = second, .paragraphAttributes = paragraph}); +} + +TEST(TextLayoutManagerTest, identicalInfiniteFontLimitsAreReusableCacheKeys) { + ParagraphAttributes paragraph; + paragraph.minimumFontSize = std::numeric_limits::infinity(); + const LineMeasureCacheKey key{.paragraphAttributes = paragraph}; + LineMeasureCache cache{1}; + int measurements = 0; + const auto measure = [&] { + ++measurements; + return LinesMeasurements{}; + }; + + cache.get(key, measure); + cache.get(key, measure); + + EXPECT_EQ(measurements, 1); +} + +TEST(TextLayoutManagerTest, preparedCacheDistinguishesHashedLineBreakModes) { + AttributedString first; + first.appendFragment({.string = "Text"}); + auto second = first; + second.getFragments().front().textAttributes.lineBreakMode = + LineBreakMode::Char; + + EXPECT_FALSE( + (PreparedTextCacheKey{.attributedString = first} == + PreparedTextCacheKey{.attributedString = second})); +} + +TEST(TextLayoutManagerTest, preparedCacheReusesNaNShadowOffsets) { + TextAttributes attributes; + attributes.textShadowOffset = + Size{.width = std::numeric_limits::quiet_NaN(), .height = 1}; + AttributedString text; + text.appendFragment({.string = "Text", .textAttributes = attributes}); + const PreparedTextCacheKey first{.attributedString = text}; + auto second = first; + second.attributedString.getFragments() + .front() + .textAttributes.textShadowOffset->width = + -attributes.textShadowOffset->width; + + EXPECT_EQ(first, second); + EXPECT_EQ( + std::hash{}(first), + std::hash{}(second)); + + SimpleThreadSafeCache cache; + int preparations = 0; + const auto prepare = [&] { return ++preparations; }; + EXPECT_EQ(cache.get(first, prepare), 1); + EXPECT_EQ(cache.get(second, prepare), 1); + EXPECT_EQ(cache.get(PreparedTextCacheKey{}, prepare), 2); + EXPECT_EQ(cache.get(first, prepare), 3); +} diff --git a/packages/react-native/ReactCommon/react/utils/FloatComparison.h b/packages/react-native/ReactCommon/react/utils/FloatComparison.h index 5fc898d1bf8a..bdb3849ec946 100644 --- a/packages/react-native/ReactCommon/react/utils/FloatComparison.h +++ b/packages/react-native/ReactCommon/react/utils/FloatComparison.h @@ -10,6 +10,7 @@ #include #include +#include namespace facebook::react { @@ -21,4 +22,17 @@ inline bool floatEquality(T a, T b, T epsilon = static_cast(kDefaultEpsilon)) return (std::isnan(a) && std::isnan(b)) || (!std::isnan(a) && !std::isnan(b) && std::abs(a - b) < epsilon); } +// Compare cache keys exactly, treating NaN as an unset value. +template +inline bool exactFloatEquality(T a, T b) +{ + return a == b || (std::isnan(a) && std::isnan(b)); +} + +template +inline T canonicalizeNaN(T value) +{ + return std::isnan(value) ? std::numeric_limits::quiet_NaN() : value; +} + } // namespace facebook::react diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidFrameworksCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidFrameworksCxx.api index 96f1de574a16..1b4c47c3d3e3 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidFrameworksCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidFrameworksCxx.api @@ -852,10 +852,14 @@ DestinationTimePointT facebook::react::clockCast(SourceTimePointT timePoint); template T facebook::react::convertRawProp(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const char* name, const T& sourceValue, const U& defaultValue); template +T facebook::react::canonicalizeNaN(T value); +template T facebook::react::get(const facebook::react::AnimatedPropBase& animatedProp); template T facebook::react::get(const std::unique_ptr& animatedProp); template +bool facebook::react::exactFloatEquality(T a, T b); +template bool facebook::react::floatEquality(T a, T b, T epsilon = static_cast(facebook::react::kDefaultEpsilon)); template folly::dynamic facebook::react::toDynamic(const std::vector& arrayValue); @@ -3145,6 +3149,7 @@ class facebook::react::NativeWebSocketModuleSpecJSI : public facebook::react::Ja class facebook::react::ParagraphAttributes : public facebook::react::DebugStringConvertible { public bool adjustsFontSizeToFit; + public bool equalsForTextCache(const facebook::react::ParagraphAttributes& rhs) const; public bool includeFontPadding; public bool operator==(const facebook::react::ParagraphAttributes& rhs) const; public facebook::react::EllipsizeMode ellipsizeMode; @@ -3942,6 +3947,7 @@ class facebook::react::TelemetryController { } class facebook::react::TextAttributes : public facebook::react::DebugStringConvertible { + public bool equalsForTextCache(const facebook::react::TextAttributes& rhs) const; public bool operator==(const facebook::react::TextAttributes& rhs) const; public facebook::react::Float fontSize; public facebook::react::Float fontSizeMultiplier; diff --git a/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api index fc711f07ba9a..0b05821514b8 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api @@ -3606,10 +3606,14 @@ RCTManagedPointer* facebook::react::managedPointer(P initializer); template T facebook::react::convertRawProp(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const char* name, const T& sourceValue, const U& defaultValue); template +T facebook::react::canonicalizeNaN(T value); +template T facebook::react::get(const facebook::react::AnimatedPropBase& animatedProp); template T facebook::react::get(const std::unique_ptr& animatedProp); template +bool facebook::react::exactFloatEquality(T a, T b); +template bool facebook::react::floatEquality(T a, T b, T epsilon = static_cast(facebook::react::kDefaultEpsilon)); template facebook::react::ModuleConstants facebook::react::typedConstants(typename T::Builder::Input&& value); @@ -5331,6 +5335,7 @@ struct facebook::react::ObjCTurboModule::InitParams { class facebook::react::ParagraphAttributes : public facebook::react::DebugStringConvertible { public bool adjustsFontSizeToFit; + public bool equalsForTextCache(const facebook::react::ParagraphAttributes& rhs) const; public bool includeFontPadding; public bool operator==(const facebook::react::ParagraphAttributes& rhs) const; public facebook::react::EllipsizeMode ellipsizeMode; @@ -6086,6 +6091,7 @@ class facebook::react::TelemetryController { } class facebook::react::TextAttributes : public facebook::react::DebugStringConvertible { + public bool equalsForTextCache(const facebook::react::TextAttributes& rhs) const; public bool operator==(const facebook::react::TextAttributes& rhs) const; public facebook::react::Float fontSize; public facebook::react::Float fontSizeMultiplier; diff --git a/scripts/cxx-api/api-snapshots/ReactCommonFrameworksCxx.api b/scripts/cxx-api/api-snapshots/ReactCommonFrameworksCxx.api index 66dccbe50765..8796a04e16d8 100644 --- a/scripts/cxx-api/api-snapshots/ReactCommonFrameworksCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactCommonFrameworksCxx.api @@ -422,10 +422,14 @@ DestinationTimePointT facebook::react::clockCast(SourceTimePointT timePoint); template T facebook::react::convertRawProp(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const char* name, const T& sourceValue, const U& defaultValue); template +T facebook::react::canonicalizeNaN(T value); +template T facebook::react::get(const facebook::react::AnimatedPropBase& animatedProp); template T facebook::react::get(const std::unique_ptr& animatedProp); template +bool facebook::react::exactFloatEquality(T a, T b); +template bool facebook::react::floatEquality(T a, T b, T epsilon = static_cast(facebook::react::kDefaultEpsilon)); template void facebook::react::fromRawValue(const facebook::react::PropsParserContext& context, const facebook::react::RawValue& rawValue, T& result, T defaultValue); @@ -1805,6 +1809,7 @@ class facebook::react::ParagraphAttributes : public facebook::react::DebugString public Float minimumFontScale; public Float minimumFontSize; public bool adjustsFontSizeToFit; + public bool equalsForTextCache(const facebook::react::ParagraphAttributes& rhs) const; public bool includeFontPadding; public bool operator==(const facebook::react::ParagraphAttributes& rhs) const; public facebook::react::EllipsizeMode ellipsizeMode; @@ -2470,6 +2475,7 @@ class facebook::react::TextAttributes : public facebook::react::DebugStringConve public Float maxFontSizeMultiplier; public Float opacity; public Float textShadowRadius; + public bool equalsForTextCache(const facebook::react::TextAttributes& rhs) const; public bool operator==(const facebook::react::TextAttributes& rhs) const; public facebook::react::SharedColor backgroundColor; public facebook::react::SharedColor foregroundColor;