From 43eb18b1ae68d62166bddddccd63e767246bed30 Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Fri, 22 Sep 2023 05:53:13 -0700 Subject: [PATCH] remove use of folly::hash from attributedstring module (#39512) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/39512 changelog: [internal] Reviewed By: cipolleschi Differential Revision: D49349658 fbshipit-source-id: 2b1e3ce2051e995fe5a29a8021c221c69df28ce2 --- .../react/renderer/attributedstring/AttributedString.h | 8 +++----- .../react/renderer/attributedstring/ParagraphAttributes.h | 5 ++--- .../renderer/components/text/ParagraphLayoutManager.cpp | 4 ++-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/packages/react-native/ReactCommon/react/renderer/attributedstring/AttributedString.h b/packages/react-native/ReactCommon/react/renderer/attributedstring/AttributedString.h index 798ad5940a3..45f351ce18a 100644 --- a/packages/react-native/ReactCommon/react/renderer/attributedstring/AttributedString.h +++ b/packages/react-native/ReactCommon/react/renderer/attributedstring/AttributedString.h @@ -7,15 +7,14 @@ #pragma once -#include #include -#include #include #include #include #include #include +#include namespace facebook::react { @@ -123,8 +122,7 @@ template <> struct hash { size_t operator()( const facebook::react::AttributedString::Fragment& fragment) const { - return folly::hash::hash_combine( - 0, + return facebook::react::hash_combine( fragment.string, fragment.textAttributes, fragment.parentShadowView, @@ -139,7 +137,7 @@ struct hash { auto seed = size_t{0}; for (const auto& fragment : attributedString.getFragments()) { - seed = folly::hash::hash_combine(seed, fragment); + facebook::react::hash_combine(seed, fragment); } return seed; diff --git a/packages/react-native/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.h b/packages/react-native/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.h index 591e15b3787..d73f8632b84 100644 --- a/packages/react-native/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.h +++ b/packages/react-native/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.h @@ -9,10 +9,10 @@ #include -#include #include #include #include +#include namespace facebook::react { @@ -88,8 +88,7 @@ template <> struct hash { size_t operator()( const facebook::react::ParagraphAttributes& attributes) const { - return folly::hash::hash_combine( - 0, + return facebook::react::hash_combine( attributes.maximumNumberOfLines, attributes.ellipsizeMode, attributes.textBreakStrategy, diff --git a/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphLayoutManager.cpp b/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphLayoutManager.cpp index 0ba10c69e46..715a1d2798b 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphLayoutManager.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphLayoutManager.cpp @@ -6,8 +6,8 @@ */ #include "ParagraphLayoutManager.h" -#include #include +#include namespace facebook::react { @@ -43,7 +43,7 @@ bool ParagraphLayoutManager::shoudMeasureString( const ParagraphAttributes& paragraphAttributes, LayoutConstraints layoutConstraints) const { size_t newParagraphInputHash = - folly::hash::hash_combine(0, attributedString, paragraphAttributes); + hash_combine(attributedString, paragraphAttributes); if (newParagraphInputHash != paragraphInputHash_) { // AttributedString or ParagraphAttributes have changed.