Skip to content

Commit

Permalink
Clean up the function naming in TextMeasureCache.h (facebook#42598)
Browse files Browse the repository at this point in the history
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 react-native-community/discussions-and-proposals#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: facebook#42598

Reviewed By: NickGerleman

Differential Revision: D52960435

Pulled By: sammy-SC

fbshipit-source-id: 01327610446933972e8dc87e1b6e2950b7c706d2
  • Loading branch information
cubuspl42 authored and facebook-github-bot committed Jan 23, 2024
1 parent ebb2b9c commit cbd818d
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit cbd818d

Please sign in to comment.