mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ebb2b9c3fc
commit
cbd818dad7
+5
-4
@@ -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<facebook::react::TextMeasureCacheKey> {
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user