guardia-messenger/node_modules/react-native/ReactCommon/react/renderer/components/text/ParagraphLayoutManager.h
DESKTOP-TKLFCPRython f29f525c77 refactor: 101.79.17.164 → zioinfo.co.kr 전체 도메인 변환 + Manager UI 배포
- 37개 파일 IP → zioinfo.co.kr 치환 (소스/매뉴얼/설정/하네스)
- Manager DrConsole/NetworkConsole/CsapConsole 빌드 + /var/www/manager/ 배포
- 테스트: Manager HTTP 200, ITSM 신규 API 7개 전체 200

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 10:09:17 +09:00

95 lines
3.4 KiB
C++

/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <react/renderer/attributedstring/AttributedString.h>
#include <react/renderer/attributedstring/ParagraphAttributes.h>
#include <react/renderer/core/LayoutConstraints.h>
#include <react/renderer/textlayoutmanager/TextLayoutContext.h>
#include <react/renderer/textlayoutmanager/TextLayoutManager.h>
namespace facebook::react {
/*
* Serves as a middle man between `ParagraphShadowNode` and `TextLayoutManager`.
* On iOS, caches `NSTextStorage` for individual `ParagraphShadowNode` to make
* sure only one `NSTextStorage` is created for every string. `NSTextStorage`
* can be re created on native views layer but it is expensive. On Android, this
* class does not cache anything.
*/
class ParagraphLayoutManager {
public:
TextMeasurement measure(
const AttributedString& attributedString,
const ParagraphAttributes& paragraphAttributes,
const TextLayoutContext& layoutContext,
LayoutConstraints layoutConstraints) const;
LinesMeasurements measureLines(
const AttributedString& attributedString,
const ParagraphAttributes& paragraphAttributes,
Size size) const;
void setTextLayoutManager(
std::shared_ptr<const TextLayoutManager> textLayoutManager) const;
/*
* Returns an opaque pointer to platform-specific `TextLayoutManager`.
* Is used on a native views layer to delegate text rendering to the manager.
*/
std::shared_ptr<const TextLayoutManager> getTextLayoutManager() const;
/*
* Returns opaque shared_ptr holding `NSTextStorage`.
* May be nullptr.
* Is used on a native views layer to prevent `NSTextStorage` from being
* created twice.
*/
std::shared_ptr<void> getHostTextStorage() const;
private:
std::shared_ptr<const TextLayoutManager> mutable textLayoutManager_{};
/*
* Stores opaque pointer to `NSTextStorage` on iOS. nullptr on Android.
* TODO: In the future, we may want to cache Android's text storage.
*/
std::shared_ptr<void> mutable hostTextStorage_{};
/*
* Hash of AttributedString and ParagraphAttributes last used to
* measure. Result of that measure is stored in cachedTextMeasurement_.
* The available width defined for the measurement is stored in
* lastAvailableWidth_.
*/
size_t mutable paragraphInputHash_{};
/* The width Yoga set as maximum width.
* Yoga calls measure twice with two
* different maximum width. One of available space.
* The other one is exact space needed for the string.
* This happens when node is dirtied but its size is not affected.
* To deal with this inefficiency, we cache `TextMeasurement` for each
* `ParagraphShadowNode`. If Yoga tries to re-measure with available width
* or exact width, we provide it with the cached value.
*/
Float mutable lastAvailableWidth_{};
TextMeasurement mutable cachedTextMeasurement_{};
/*
* Checks whether the inputs into text measurement meaningfully affect
* text measurement result. Returns true if inputs have changed and measure is
* needed.
*/
bool shouldMeasureString(
const AttributedString& attributedString,
const ParagraphAttributes& paragraphAttributes,
LayoutConstraints layoutConstraints) const;
};
} // namespace facebook::react