Skip to content

Commit

Permalink
Fabric: AttributedString::operator==() now checks layoutMetrics f…
Browse files Browse the repository at this point in the history
…or 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
  • Loading branch information
shergin authored and facebook-github-bot committed Feb 28, 2020
1 parent 6f4d362 commit 061f54e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ReactCommon/fabric/attributedstring/AttributedString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,16 @@ bool Fragment::isAttachment() const {
}

bool Fragment::operator==(const Fragment &rhs) const {
return std::tie(string, textAttributes, parentShadowView.tag) ==
std::tie(rhs.string, rhs.textAttributes, rhs.parentShadowView.tag);
return std::tie(
string,
textAttributes,
parentShadowView.tag,
parentShadowView.layoutMetrics) ==
std::tie(
rhs.string,
rhs.textAttributes,
rhs.parentShadowView.tag,
rhs.parentShadowView.layoutMetrics);
}

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

0 comments on commit 061f54e

Please sign in to comment.