From 061f54e89086af1c80e5b0460ec715533f99bdb7 Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Thu, 27 Feb 2020 21:44:31 -0800 Subject: [PATCH] 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 --- .../fabric/attributedstring/AttributedString.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ReactCommon/fabric/attributedstring/AttributedString.cpp b/ReactCommon/fabric/attributedstring/AttributedString.cpp index 6bf2912e490873..40efe29963d35e 100644 --- a/ReactCommon/fabric/attributedstring/AttributedString.cpp +++ b/ReactCommon/fabric/attributedstring/AttributedString.cpp @@ -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 {