mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fabric: Removing AttributedString::Fragment::shadowNode
Summary: Before this change `AttributedString::Fragment` had two ShadowView objects (`shadowView` and `parentShadowView`). This diff unifies those two things into one. That allows us to save some CPU and memory and makes things a bit simpler. Besides that, now the length of NSAttributedString and AttributedString is now always the same (it's one Unicode character for an attachment for both). Changelog: [Internal] Fabric-specific internal change. Reviewed By: JoshuaGross Differential Revision: D18607658 fbshipit-source-id: 502ae244e98a52694adc0d646650f8ea0d7922ae
This commit is contained in:
committed by
Facebook Github Bot
parent
890968cc2c
commit
ed909b619c
@@ -17,13 +17,17 @@ using Fragments = AttributedString::Fragments;
|
||||
|
||||
#pragma mark - Fragment
|
||||
|
||||
std::string Fragment::AttachmentCharacter() {
|
||||
return "\uFFFC"; // Unicode `OBJECT REPLACEMENT CHARACTER`
|
||||
}
|
||||
|
||||
bool Fragment::isAttachment() const {
|
||||
return string == AttachmentCharacter();
|
||||
}
|
||||
|
||||
bool Fragment::operator==(const Fragment &rhs) const {
|
||||
return std::tie(string, textAttributes, shadowView, parentShadowView) ==
|
||||
std::tie(
|
||||
rhs.string,
|
||||
rhs.textAttributes,
|
||||
rhs.shadowView,
|
||||
rhs.parentShadowView);
|
||||
return std::tie(string, textAttributes, parentShadowView) ==
|
||||
std::tie(rhs.string, rhs.textAttributes, rhs.parentShadowView);
|
||||
}
|
||||
|
||||
bool Fragment::operator!=(const Fragment &rhs) const {
|
||||
|
||||
Reference in New Issue
Block a user