From cbd818dad7748fbe38c8bbf272f1cdfdf195d20f Mon Sep 17 00:00:00 2001 From: Jakub Trzebiatowski Date: Tue, 23 Jan 2024 08:59:56 -0800 Subject: [PATCH] Clean up the function naming in `TextMeasureCache.h` (#42598) Summary: Clean up the function naming in `TextMeasureCache.h`. One name was clearly a human mistake. Make the naming consistent. This is a minor improvement in the context of my multi-PR work on https://github.com/react-native-community/discussions-and-proposals/issues/695. ## Changelog: [INTERNAL] [CHANGE] - Clean up the function naming in `TextMeasureCache.h` Pull Request resolved: https://github.com/facebook/react-native/pull/42598 Reviewed By: NickGerleman Differential Revision: D52960435 Pulled By: sammy-SC fbshipit-source-id: 01327610446933972e8dc87e1b6e2950b7c706d2 --- .../react/renderer/textlayoutmanager/TextMeasureCache.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.h b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.h index c51f4ff51da..01a981ba0c3 100644 --- a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.h +++ b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.h @@ -141,7 +141,7 @@ inline bool areAttributedStringFragmentsEquivalentLayoutWise( rhs.parentShadowView.layoutMetrics)); } -inline size_t textAttributesHashLayoutWise( +inline size_t attributedStringFragmentHashLayoutWise( const AttributedString::Fragment& fragment) { // Here we are not taking `isAttachment` and `layoutMetrics` into account // because they are logically interdependent and this can break an invariant @@ -171,12 +171,13 @@ inline bool areAttributedStringsEquivalentLayoutWise( return true; } -inline size_t textAttributedStringHashLayoutWise( +inline size_t attributedStringHashLayoutWise( const AttributedString& attributedString) { auto seed = size_t{0}; for (const auto& fragment : attributedString.getFragments()) { - facebook::react::hash_combine(seed, textAttributesHashLayoutWise(fragment)); + facebook::react::hash_combine( + seed, attributedStringFragmentHashLayoutWise(fragment)); } return seed; @@ -206,7 +207,7 @@ template <> struct hash { size_t operator()(const facebook::react::TextMeasureCacheKey& key) const { return facebook::react::hash_combine( - textAttributedStringHashLayoutWise(key.attributedString), + attributedStringHashLayoutWise(key.attributedString), key.paragraphAttributes, key.layoutConstraints.maximumSize.width); }