Skip to content

Commit 061f54e

Browse files
sherginfacebook-github-bot
authored andcommitted
Fabric: AttributedString::operator==() now checks layoutMetrics for being equal
Summary: The sizes of attachments are legit parts of `AttributedString`s identity, so we need to incorporate it into the equality test. We need that to make measurement cache work correctly with inline views. Changelog: [Internal] Fabric-specific internal change. Reviewed By: mdvacca Differential Revision: D20151505 fbshipit-source-id: ae47c24a753eab1e497fcfaa93de557ffb30d874
1 parent 6f4d362 commit 061f54e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

ReactCommon/fabric/attributedstring/AttributedString.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,16 @@ bool Fragment::isAttachment() const {
2626
}
2727

2828
bool Fragment::operator==(const Fragment &rhs) const {
29-
return std::tie(string, textAttributes, parentShadowView.tag) ==
30-
std::tie(rhs.string, rhs.textAttributes, rhs.parentShadowView.tag);
29+
return std::tie(
30+
string,
31+
textAttributes,
32+
parentShadowView.tag,
33+
parentShadowView.layoutMetrics) ==
34+
std::tie(
35+
rhs.string,
36+
rhs.textAttributes,
37+
rhs.parentShadowView.tag,
38+
rhs.parentShadowView.layoutMetrics);
3139
}
3240

3341
bool Fragment::operator!=(const Fragment &rhs) const {

0 commit comments

Comments
 (0)