mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-01-12 22:50:10 +08:00
Summary: So, changes: * Correctness checks only in debug mode (codesize win?); * `registerInstance` marked as const (because it's thread safe); * ContextContainer::Shared also enforces constness; * Using faster better::map; * Using shared/RW mutex instead of regular one; * SharedContextContainer got removed. Reviewed By: sahrens Differential Revision: D14920284 fbshipit-source-id: f0f8d970e7fae79a1abe3bc32827db9fd2d17e13
52 lines
1.3 KiB
C++
52 lines
1.3 KiB
C++
/**
|
|
* Copyright (c) Facebook, Inc. and its 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 <memory>
|
|
|
|
#include <react/attributedstring/AttributedString.h>
|
|
#include <react/attributedstring/ParagraphAttributes.h>
|
|
#include <react/core/LayoutConstraints.h>
|
|
#include <react/utils/ContextContainer.h>
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
class TextLayoutManager;
|
|
|
|
using SharedTextLayoutManager = std::shared_ptr<const TextLayoutManager>;
|
|
|
|
/*
|
|
* Cross platform facade for iOS-specific RCTTTextLayoutManager.
|
|
*/
|
|
class TextLayoutManager {
|
|
public:
|
|
TextLayoutManager(ContextContainer::Shared const &contextContainer);
|
|
~TextLayoutManager();
|
|
|
|
/*
|
|
* Measures `attributedString` using native text rendering infrastructure.
|
|
*/
|
|
Size measure(
|
|
AttributedString attributedString,
|
|
ParagraphAttributes paragraphAttributes,
|
|
LayoutConstraints layoutConstraints) const;
|
|
|
|
/*
|
|
* Returns an opaque pointer to platform-specific TextLayoutManager.
|
|
* Is used on a native views layer to delegate text rendering to the manager.
|
|
*/
|
|
void *getNativeTextLayoutManager() const;
|
|
|
|
private:
|
|
void *self_;
|
|
};
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|