Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.72 New Architecture] added missing text measure cache text attributes #37946

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ inline bool areTextAttributesEquivalentLayoutWise(
// attributes that affect only a decorative aspect of displayed text (like
// colors).
return std::tie(
lhs.foregroundColor,
lhs.backgroundColor,
lhs.opacity,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does opacity, backgroundColor and foregroundColor change size/position of text? I'm not how it affects layout of text.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I know TextMeasureCache is for size, position of Text component.
So I'm not sure this is the right way to fix style caching issue.
But it works.

lhs.fontFamily,
lhs.fontWeight,
lhs.fontStyle,
Expand All @@ -97,6 +100,9 @@ inline bool areTextAttributesEquivalentLayoutWise(
lhs.dynamicTypeRamp,
lhs.alignment) ==
std::tie(
rhs.foregroundColor,
rhs.backgroundColor,
rhs.opacity,
rhs.fontFamily,
rhs.fontWeight,
rhs.fontStyle,
Expand All @@ -116,6 +122,9 @@ inline size_t textAttributesHashLayoutWise(
// `areTextAttributesEquivalentLayoutWise` mentions.
return folly::hash::hash_combine(
0,
textAttributes.foregroundColor,
textAttributes.backgroundColor,
textAttributes.opacity,
textAttributes.fontFamily,
textAttributes.fontSize,
textAttributes.fontSizeMultiplier,
Expand Down