react-native-windows 0.0.0-canary.960 → 0.0.0-canary.962
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Common/Common.vcxproj +1 -1
- package/Microsoft.ReactNative/Fabric/AbiShadowNode.cpp +4 -4
- package/Microsoft.ReactNative/Fabric/AbiShadowNode.h +5 -5
- package/Microsoft.ReactNative/Fabric/ComponentView.h +6 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +1 -0
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +3 -1
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +3 -2
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentDescriptor.h +2 -1
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +2 -1
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +0 -8
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +2 -2
- package/Microsoft.ReactNative/Fabric/Composition/TooltipService.cpp +3 -2
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +7 -3
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +10 -1
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.h +2 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/HostPlatformColor.h +0 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.h +1 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/{TextLayoutManager.cpp → WindowsTextLayoutManager.cpp} +21 -36
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/WindowsTextLayoutManager.h +68 -0
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +0 -2
- package/Microsoft.ReactNative.Cxx/JSValue.cpp +19 -3
- package/Microsoft.ReactNative.Cxx/JSValue.h +15 -7
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Bridging.h +3 -3
- package/Microsoft.ReactNative.Cxx/stubs/glog/logging.h +1 -1
- package/PropertySheets/Generated/PackageVersion.g.props +2 -2
- package/PropertySheets/React.Cpp.props +6 -2
- package/ReactCommon/ReactCommon.vcxproj +1 -9
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/Bridging.h +3 -3
- package/Shared/Shared.vcxitems +4 -4
- package/Shared/Shared.vcxitems.filters +3 -3
- package/package.json +1 -2
- package/stubs/glog/logging.h +1 -1
- package/templates/cpp-lib/windows/MyLib/MyLib.cpp +1 -1
- package/templates/cpp-lib/windows/MyLib/MyLib.h +2 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformTouch.h +0 -10
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/Float.h +0 -20
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.h +0 -117
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/textinput/TextInputState.h +0 -73
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/HostPlatformTouch.h +0 -14
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/HostPlatformViewEventEmitter.h +0 -14
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/HostPlatformViewProps.h +0 -14
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/graphics/Float.h +0 -433
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/graphics/HostPlatformColor.h +0 -62
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/imagemanager/ImageRequestParams.h +0 -30
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/runtimescheduler/SchedulerPriorityUtils.h +0 -60
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.h +0 -87
package/Common/Common.vcxproj
CHANGED
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
string literals. It prevents code like
|
|
73
73
|
wchar_t* str = L"hello";
|
|
74
74
|
from compiling. -->
|
|
75
|
-
<AdditionalOptions>%(AdditionalOptions) /Zc:strictStrings
|
|
75
|
+
<AdditionalOptions>%(AdditionalOptions) /Zc:strictStrings</AdditionalOptions>
|
|
76
76
|
</ClCompile>
|
|
77
77
|
<Link>
|
|
78
78
|
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
|
@@ -35,15 +35,15 @@ void ShadowNode::EnsureUnsealed() noexcept {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
winrt::IInspectable ShadowNode::Tag() const noexcept {
|
|
38
|
+
winrt::Windows::Foundation::IInspectable ShadowNode::Tag() const noexcept {
|
|
39
39
|
return m_tag;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
void ShadowNode::Tag(winrt::IInspectable tag) noexcept {
|
|
42
|
+
void ShadowNode::Tag(winrt::Windows::Foundation::IInspectable tag) noexcept {
|
|
43
43
|
m_tag = tag;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
winrt::IInspectable ShadowNode::StateData() const noexcept {
|
|
46
|
+
winrt::Windows::Foundation::IInspectable ShadowNode::StateData() const noexcept {
|
|
47
47
|
if (auto shadowNode = m_shadowNode.lock()) {
|
|
48
48
|
auto state = shadowNode->getState();
|
|
49
49
|
react_native_assert(state && "State must not be `nullptr`.");
|
|
@@ -55,7 +55,7 @@ winrt::IInspectable ShadowNode::StateData() const noexcept {
|
|
|
55
55
|
return nullptr;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
void ShadowNode::StateData(winrt::IInspectable tag) noexcept {
|
|
58
|
+
void ShadowNode::StateData(winrt::Windows::Foundation::IInspectable tag) noexcept {
|
|
59
59
|
if (auto shadowNode = m_shadowNode.lock()) {
|
|
60
60
|
shadowNode->ensureUnsealed();
|
|
61
61
|
|
|
@@ -37,17 +37,17 @@ struct ShadowNode : ShadowNodeT<ShadowNode> {
|
|
|
37
37
|
ShadowNode(facebook::react::ShadowNode::Shared shadowNode) noexcept;
|
|
38
38
|
|
|
39
39
|
void EnsureUnsealed() noexcept;
|
|
40
|
-
winrt::IInspectable Tag() const noexcept;
|
|
41
|
-
void Tag(winrt::IInspectable tag) noexcept;
|
|
40
|
+
winrt::Windows::Foundation::IInspectable Tag() const noexcept;
|
|
41
|
+
void Tag(winrt::Windows::Foundation::IInspectable tag) noexcept;
|
|
42
42
|
|
|
43
|
-
winrt::IInspectable StateData() const noexcept;
|
|
44
|
-
void StateData(winrt::IInspectable tag) noexcept;
|
|
43
|
+
winrt::Windows::Foundation::IInspectable StateData() const noexcept;
|
|
44
|
+
void StateData(winrt::Windows::Foundation::IInspectable tag) noexcept;
|
|
45
45
|
|
|
46
46
|
winrt::Microsoft::ReactNative::EventEmitter EventEmitter() const noexcept;
|
|
47
47
|
|
|
48
48
|
protected:
|
|
49
49
|
facebook::react::ShadowNode::Weak m_shadowNode;
|
|
50
|
-
winrt::IInspectable m_tag;
|
|
50
|
+
winrt::Windows::Foundation::IInspectable m_tag;
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
} // namespace winrt::Microsoft::ReactNative::implementation
|
|
@@ -103,7 +103,8 @@ struct ComponentView
|
|
|
103
103
|
const noexcept;
|
|
104
104
|
virtual void parent(const winrt::Microsoft::ReactNative::ComponentView &parent) noexcept;
|
|
105
105
|
virtual winrt::Microsoft::ReactNative::ComponentView Parent() const noexcept;
|
|
106
|
-
virtual winrt::IVectorView<winrt::Microsoft::ReactNative::ComponentView> Children()
|
|
106
|
+
virtual winrt::Windows::Foundation::Collections::IVectorView<winrt::Microsoft::ReactNative::ComponentView> Children()
|
|
107
|
+
const noexcept;
|
|
107
108
|
virtual void theme(winrt::Microsoft::ReactNative::Composition::implementation::Theme *theme) noexcept;
|
|
108
109
|
virtual winrt::Microsoft::ReactNative::Composition::implementation::Theme *theme() const noexcept;
|
|
109
110
|
virtual void onThemeChanged() noexcept;
|
|
@@ -206,7 +207,7 @@ struct ComponentView
|
|
|
206
207
|
// If ignorePointerEvents = true, all Components are treated as valid targets
|
|
207
208
|
virtual facebook::react::Tag
|
|
208
209
|
hitTest(facebook::react::Point pt, facebook::react::Point &localPt, bool ignorePointerEvents = false) const noexcept;
|
|
209
|
-
virtual winrt::IInspectable EnsureUiaProvider() noexcept;
|
|
210
|
+
virtual winrt::Windows::Foundation::IInspectable EnsureUiaProvider() noexcept;
|
|
210
211
|
virtual std::optional<std::string> getAccessiblityValue() noexcept;
|
|
211
212
|
virtual void setAcccessiblityValue(std::string &&value) noexcept;
|
|
212
213
|
virtual bool getAcccessiblityIsReadOnly() noexcept;
|
|
@@ -223,8 +224,8 @@ struct ComponentView
|
|
|
223
224
|
virtual const winrt::Microsoft::ReactNative::IComponentProps userProps(
|
|
224
225
|
facebook::react::Props::Shared const &props) noexcept;
|
|
225
226
|
|
|
226
|
-
void UserData(const winrt::IInspectable &userData) noexcept;
|
|
227
|
-
winrt::IInspectable UserData() const noexcept;
|
|
227
|
+
void UserData(const winrt::Windows::Foundation::IInspectable &userData) noexcept;
|
|
228
|
+
winrt::Windows::Foundation::IInspectable UserData() const noexcept;
|
|
228
229
|
|
|
229
230
|
virtual void MountChildComponentView(
|
|
230
231
|
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
|
@@ -256,7 +257,7 @@ struct ComponentView
|
|
|
256
257
|
winrt::com_ptr<winrt::Microsoft::ReactNative::Composition::ReactCompositionViewComponentBuilder> m_builder;
|
|
257
258
|
bool m_mounted : 1 {false};
|
|
258
259
|
const facebook::react::Tag m_tag;
|
|
259
|
-
winrt::IInspectable m_userData;
|
|
260
|
+
winrt::Windows::Foundation::IInspectable m_userData;
|
|
260
261
|
mutable winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView *m_rootView{nullptr};
|
|
261
262
|
mutable winrt::Microsoft::ReactNative::Composition::implementation::Theme *m_theme{nullptr};
|
|
262
263
|
const winrt::Microsoft::ReactNative::ReactContext m_reactContext;
|
|
@@ -40,7 +40,7 @@ struct ContentIslandComponentView : ContentIslandComponentViewT<ContentIslandCom
|
|
|
40
40
|
|
|
41
41
|
bool focusable() const noexcept override;
|
|
42
42
|
|
|
43
|
-
winrt::IInspectable EnsureUiaProvider() noexcept override;
|
|
43
|
+
winrt::Windows::Foundation::IInspectable EnsureUiaProvider() noexcept override;
|
|
44
44
|
|
|
45
45
|
void onGotFocus(const winrt::Microsoft::ReactNative::Composition::Input::RoutedEventArgs &args) noexcept override;
|
|
46
46
|
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
#include "ParagraphComponentView.h"
|
|
7
7
|
|
|
8
|
+
#include <react/renderer/textlayoutmanager/WindowsTextLayoutManager.h>
|
|
9
|
+
|
|
8
10
|
#include <AutoDraw.h>
|
|
9
11
|
#include <Utils/ValueUtils.h>
|
|
10
12
|
#include <react/renderer/components/text/ParagraphShadowNode.h>
|
|
@@ -169,7 +171,7 @@ void ParagraphComponentView::updateVisualBrush() noexcept {
|
|
|
169
171
|
constraints.maximumSize.height =
|
|
170
172
|
m_layoutMetrics.frame.size.height - m_layoutMetrics.contentInsets.top - m_layoutMetrics.contentInsets.bottom;
|
|
171
173
|
|
|
172
|
-
facebook::react::
|
|
174
|
+
facebook::react::WindowsTextLayoutManager::GetTextLayout(
|
|
173
175
|
m_attributedStringBox, m_paragraphAttributes, constraints, m_textLayout);
|
|
174
176
|
|
|
175
177
|
requireNewBrush = true;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
#include "FocusNavigationRequest.g.cpp"
|
|
6
6
|
#include "ReactNativeIsland.g.cpp"
|
|
7
7
|
#include <RootViewSizeChangedEventArgs.g.h>
|
|
8
|
+
#include <react/renderer/textlayoutmanager/WindowsTextLayoutManager.h>
|
|
8
9
|
|
|
9
10
|
#include <AutoDraw.h>
|
|
10
11
|
#include <DynamicWriter.h>
|
|
@@ -609,7 +610,7 @@ facebook::react::Size ReactNativeIsland::MeasureLoading(
|
|
|
609
610
|
|
|
610
611
|
auto attributedStringBox = CreateLoadingAttributedString();
|
|
611
612
|
winrt::com_ptr<::IDWriteTextLayout> textLayout;
|
|
612
|
-
facebook::react::
|
|
613
|
+
facebook::react::WindowsTextLayoutManager::GetTextLayout(
|
|
613
614
|
attributedStringBox, CreateLoadingParagraphAttributes(), fbLayoutConstraints, textLayout);
|
|
614
615
|
|
|
615
616
|
DWRITE_TEXT_METRICS tm;
|
|
@@ -691,7 +692,7 @@ Composition::Experimental::IDrawingSurfaceBrush ReactNativeIsland::CreateLoading
|
|
|
691
692
|
textAttributes.foregroundColor = facebook::react::whiteColor();
|
|
692
693
|
|
|
693
694
|
winrt::com_ptr<::IDWriteTextLayout> textLayout;
|
|
694
|
-
facebook::react::
|
|
695
|
+
facebook::react::WindowsTextLayoutManager::GetTextLayout(
|
|
695
696
|
attributedStringBox, CreateLoadingParagraphAttributes(), constraints, textLayout);
|
|
696
697
|
|
|
697
698
|
DWRITE_TEXT_METRICS tm;
|
|
@@ -64,7 +64,7 @@ struct RootComponentView : RootComponentViewT<RootComponentView, ViewComponentVi
|
|
|
64
64
|
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
65
65
|
facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept override;
|
|
66
66
|
|
|
67
|
-
winrt::IInspectable UiaProviderFromPoint(const POINT &ptPixels) noexcept;
|
|
67
|
+
winrt::Windows::Foundation::IInspectable UiaProviderFromPoint(const POINT &ptPixels) noexcept;
|
|
68
68
|
|
|
69
69
|
RootComponentView(
|
|
70
70
|
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentDescriptor.h
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
#include <unordered_map>
|
|
12
12
|
|
|
13
|
+
#include <react/renderer/components/text/ParagraphComponentDescriptor.h>
|
|
13
14
|
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
14
15
|
|
|
15
16
|
namespace facebook::react {
|
|
@@ -21,7 +22,7 @@ class WindowsTextInputComponentDescriptor final : public ConcreteComponentDescri
|
|
|
21
22
|
public:
|
|
22
23
|
WindowsTextInputComponentDescriptor(const ComponentDescriptorParameters ¶meters)
|
|
23
24
|
: ConcreteComponentDescriptor<WindowsTextInputShadowNode>(parameters),
|
|
24
|
-
textLayoutManager_(
|
|
25
|
+
textLayoutManager_(getManagerByName<TextLayoutManager>(contextContainer_, TextLayoutManagerKey)) {}
|
|
25
26
|
|
|
26
27
|
/*
|
|
27
28
|
virtual State::Shared createInitialState(
|
package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
#include <Fabric/Composition/UiaHelpers.h>
|
|
11
11
|
#include <Utils/ValueUtils.h>
|
|
12
12
|
#include <react/renderer/components/textinput/TextInputState.h>
|
|
13
|
+
#include <react/renderer/textlayoutmanager/WindowsTextLayoutManager.h>
|
|
13
14
|
#include <tom.h>
|
|
14
15
|
#include <unicode.h>
|
|
15
16
|
#include <winrt/Microsoft.UI.Input.h>
|
|
@@ -1482,7 +1483,7 @@ winrt::com_ptr<::IDWriteTextLayout> WindowsTextInputComponentView::CreatePlaceho
|
|
|
1482
1483
|
constraints.maximumSize.width = static_cast<FLOAT>(m_imgWidth);
|
|
1483
1484
|
constraints.maximumSize.height = static_cast<FLOAT>(m_imgHeight);
|
|
1484
1485
|
|
|
1485
|
-
facebook::react::
|
|
1486
|
+
facebook::react::WindowsTextLayoutManager::GetTextLayout(
|
|
1486
1487
|
facebook::react::AttributedStringBox(attributedString), {} /*TODO*/, constraints, textLayout);
|
|
1487
1488
|
|
|
1488
1489
|
return textLayout;
|
|
@@ -24,14 +24,6 @@ void WindowsTextInputShadowNode::setTextLayoutManager(std::shared_ptr<const Text
|
|
|
24
24
|
Size WindowsTextInputShadowNode::measureContent(
|
|
25
25
|
const LayoutContext &layoutContext,
|
|
26
26
|
const LayoutConstraints &layoutConstraints) const {
|
|
27
|
-
if (getStateData().cachedAttributedStringId != 0) {
|
|
28
|
-
facebook::react::ParagraphAttributes paragraphAttributes{};
|
|
29
|
-
paragraphAttributes.maximumNumberOfLines = getConcreteProps().multiline ? 0 : 1;
|
|
30
|
-
return textLayoutManager_
|
|
31
|
-
->measureCachedSpannableById(getStateData().cachedAttributedStringId, paragraphAttributes, layoutConstraints)
|
|
32
|
-
.size;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
27
|
// Layout is called right after measure.
|
|
36
28
|
// Measure is marked as `const`, and `layout` is not; so State can be updated
|
|
37
29
|
// during layout, but not during `measure`. If State is out-of-date in layout,
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
#pragma once
|
|
5
5
|
|
|
6
|
+
#include <react/renderer/textlayoutmanager/WindowsTextLayoutManager.h>
|
|
7
|
+
|
|
6
8
|
#include <react/components/rnwcore/EventEmitters.h>
|
|
7
9
|
#include <unordered_map>
|
|
8
10
|
#include "WindowsTextInputEventEmitter.h"
|
|
@@ -13,8 +15,6 @@
|
|
|
13
15
|
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
14
16
|
#include <react/utils/ContextContainer.h>
|
|
15
17
|
|
|
16
|
-
#include <react/renderer/textlayoutmanager/TextLayoutManager.h>
|
|
17
|
-
|
|
18
18
|
namespace facebook::react {
|
|
19
19
|
|
|
20
20
|
extern const char WindowsTextInputComponentName[];
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
#include "TooltipService.h"
|
|
6
6
|
|
|
7
|
+
#include <react/renderer/textlayoutmanager/WindowsTextLayoutManager.h>
|
|
8
|
+
|
|
7
9
|
#include <CompositionSwitcher.Experimental.interop.h>
|
|
8
10
|
#include <Fabric/Composition/CompositionViewComponentView.h>
|
|
9
11
|
#include <react/renderer/attributedstring/AttributedStringBox.h>
|
|
10
12
|
#include <react/renderer/core/LayoutConstraints.h>
|
|
11
|
-
#include <react/renderer/textlayoutmanager/TextLayoutManager.h>
|
|
12
13
|
#include <winrt/Microsoft.ReactNative.Composition.h>
|
|
13
14
|
#include <winrt/Windows.UI.ViewManagement.h>
|
|
14
15
|
#include "TextDrawing.h"
|
|
@@ -255,7 +256,7 @@ void TooltipTracker::ShowTooltip(const winrt::Microsoft::ReactNative::ComponentV
|
|
|
255
256
|
layoutConstraints.minimumSize.height = 0;
|
|
256
257
|
layoutConstraints.minimumSize.width = 0;
|
|
257
258
|
|
|
258
|
-
facebook::react::
|
|
259
|
+
facebook::react::WindowsTextLayoutManager::GetTextLayout(
|
|
259
260
|
tooltipData->attributedString, {} /*paragraphAttributes*/, layoutConstraints, tooltipData->textLayout);
|
|
260
261
|
|
|
261
262
|
if (tooltipData->textLayout) {
|
|
@@ -23,16 +23,20 @@ HRESULT UiaGetBoundingRectangleHelper(::Microsoft::ReactNative::ReactTaggedView
|
|
|
23
23
|
|
|
24
24
|
HRESULT UiaSetFocusHelper(::Microsoft::ReactNative::ReactTaggedView &view) noexcept;
|
|
25
25
|
|
|
26
|
-
void UpdateUiaProperty(
|
|
26
|
+
void UpdateUiaProperty(
|
|
27
|
+
winrt::Windows::Foundation::IInspectable provider,
|
|
28
|
+
PROPERTYID propId,
|
|
29
|
+
bool oldValue,
|
|
30
|
+
bool newValue) noexcept;
|
|
27
31
|
|
|
28
32
|
void UpdateUiaProperty(
|
|
29
|
-
winrt::IInspectable provider,
|
|
33
|
+
winrt::Windows::Foundation::IInspectable provider,
|
|
30
34
|
PROPERTYID propId,
|
|
31
35
|
const std::string &oldValue,
|
|
32
36
|
const std::string &newValue) noexcept;
|
|
33
37
|
|
|
34
38
|
void UpdateUiaProperty(
|
|
35
|
-
winrt::IInspectable provider,
|
|
39
|
+
winrt::Windows::Foundation::IInspectable provider,
|
|
36
40
|
PROPERTYID propId,
|
|
37
41
|
const std::optional<std::string> &oldValue,
|
|
38
42
|
const std::optional<std::string> &newValue) noexcept;
|
|
@@ -22,11 +22,13 @@
|
|
|
22
22
|
#include <UI.Xaml.Controls.h>
|
|
23
23
|
#include <react/components/rnwcore/ComponentDescriptors.h>
|
|
24
24
|
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
25
|
+
#include <react/renderer/components/text/ParagraphComponentDescriptor.h>
|
|
25
26
|
#include <react/renderer/core/DynamicPropsUtilities.h>
|
|
26
27
|
#include <react/renderer/core/EventBeat.h>
|
|
27
28
|
#include <react/renderer/runtimescheduler/RuntimeScheduler.h>
|
|
28
29
|
#include <react/renderer/scheduler/Scheduler.h>
|
|
29
30
|
#include <react/renderer/scheduler/SchedulerToolbox.h>
|
|
31
|
+
#include <react/renderer/textlayoutmanager/WindowsTextLayoutManager.h>
|
|
30
32
|
#include <react/utils/ContextContainer.h>
|
|
31
33
|
#include <winrt/Windows.Graphics.Display.h>
|
|
32
34
|
#include <winrt/Windows.UI.Composition.Desktop.h>
|
|
@@ -74,7 +76,7 @@ void FabricUIManager::installFabricUIManager() noexcept {
|
|
|
74
76
|
auto runtimeScheduler = SchedulerSettings::RuntimeSchedulerFromProperties(m_context.Properties());
|
|
75
77
|
|
|
76
78
|
if (runtimeScheduler) {
|
|
77
|
-
contextContainer->insert(
|
|
79
|
+
contextContainer->insert(facebook::react::RuntimeSchedulerKey, runtimeScheduler);
|
|
78
80
|
runtimeExecutor = [runtimeScheduler](std::function<void(facebook::jsi::Runtime & runtime)> &&callback) {
|
|
79
81
|
runtimeScheduler->scheduleWork(std::move(callback));
|
|
80
82
|
};
|
|
@@ -82,6 +84,13 @@ void FabricUIManager::installFabricUIManager() noexcept {
|
|
|
82
84
|
runtimeExecutor = SchedulerSettings::GetRuntimeExecutor(m_context.Properties());
|
|
83
85
|
}
|
|
84
86
|
|
|
87
|
+
// Use an empty ContextContainer here, since using contextContainer would cause a ref cycle. We are not currently
|
|
88
|
+
// using the ContextContainer within WindowsTextLayoutManager/TextLayoutManager anyway
|
|
89
|
+
contextContainer->insert(
|
|
90
|
+
facebook::react::TextLayoutManagerKey,
|
|
91
|
+
std::make_shared<facebook::react::WindowsTextLayoutManager>(
|
|
92
|
+
std::make_shared<facebook::react::ContextContainer>()));
|
|
93
|
+
|
|
85
94
|
facebook::react::EventBeat::Factory asynchronousBeatFactory =
|
|
86
95
|
[runtimeScheduler, context = m_context](std::shared_ptr<facebook::react::EventBeat::OwnerBox> const &ownerBox) {
|
|
87
96
|
return std::make_unique<AsynchronousEventBeat>(ownerBox, context, runtimeScheduler);
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
#pragma once
|
|
6
6
|
|
|
7
|
+
#include <react/renderer/textlayoutmanager/WindowsTextLayoutManager.h>
|
|
8
|
+
|
|
7
9
|
#include <Fabric/Composition/ReactCompositionViewComponentBuilder.h>
|
|
8
10
|
#include <ReactPropertyBag.h>
|
|
9
11
|
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
#include <dwrite.h>
|
|
11
11
|
#include <dwrite_1.h>
|
|
12
12
|
#include <react/renderer/telemetry/TransactionTelemetry.h>
|
|
13
|
-
#include "
|
|
13
|
+
#include "WindowsTextLayoutManager.h"
|
|
14
14
|
|
|
15
15
|
#include <unicode.h>
|
|
16
16
|
|
|
@@ -66,7 +66,15 @@ class AttachmentInlineObject : public winrt::implements<AttachmentInlineObject,
|
|
|
66
66
|
float m_height;
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
TextLayoutManager::TextLayoutManager(const ContextContainer::Shared &contextContainer)
|
|
70
|
+
: contextContainer_(contextContainer),
|
|
71
|
+
textMeasureCache_(kSimpleThreadSafeCacheSizeCap),
|
|
72
|
+
lineMeasureCache_(kSimpleThreadSafeCacheSizeCap) {}
|
|
73
|
+
|
|
74
|
+
WindowsTextLayoutManager::WindowsTextLayoutManager(const ContextContainer::Shared &contextContainer)
|
|
75
|
+
: TextLayoutManager(contextContainer) {}
|
|
76
|
+
|
|
77
|
+
void WindowsTextLayoutManager::GetTextLayout(
|
|
70
78
|
const AttributedStringBox &attributedStringBox,
|
|
71
79
|
const ParagraphAttributes ¶graphAttributes,
|
|
72
80
|
Size size,
|
|
@@ -241,7 +249,7 @@ void TextLayoutManager::GetTextLayout(
|
|
|
241
249
|
}
|
|
242
250
|
}
|
|
243
251
|
|
|
244
|
-
void
|
|
252
|
+
void WindowsTextLayoutManager::GetTextLayout(
|
|
245
253
|
const AttributedStringBox &attributedStringBox,
|
|
246
254
|
const ParagraphAttributes ¶graphAttributes,
|
|
247
255
|
LayoutConstraints layoutConstraints,
|
|
@@ -264,7 +272,7 @@ void TextLayoutManager::GetTextLayout(
|
|
|
264
272
|
}
|
|
265
273
|
}
|
|
266
274
|
|
|
267
|
-
void
|
|
275
|
+
void WindowsTextLayoutManager::GetTextLayoutByAdjustingFontSizeToFit(
|
|
268
276
|
AttributedStringBox attributedStringBox,
|
|
269
277
|
const ParagraphAttributes ¶graphAttributes,
|
|
270
278
|
LayoutConstraints layoutConstraints,
|
|
@@ -333,11 +341,11 @@ TextMeasurement TextLayoutManager::measure(
|
|
|
333
341
|
const AttributedStringBox &attributedStringBox,
|
|
334
342
|
const ParagraphAttributes ¶graphAttributes,
|
|
335
343
|
const TextLayoutContext &layoutContext,
|
|
336
|
-
LayoutConstraints layoutConstraints) const {
|
|
344
|
+
const LayoutConstraints &layoutConstraints) const {
|
|
337
345
|
TextMeasurement measurement{};
|
|
338
346
|
auto &attributedString = attributedStringBox.getValue();
|
|
339
347
|
|
|
340
|
-
measurement =
|
|
348
|
+
measurement = textMeasureCache_.get(
|
|
341
349
|
{attributedString, paragraphAttributes, layoutConstraints}, [&](TextMeasureCacheKey const &key) {
|
|
342
350
|
auto telemetry = TransactionTelemetry::threadLocalTelemetry();
|
|
343
351
|
if (telemetry) {
|
|
@@ -347,7 +355,7 @@ TextMeasurement TextLayoutManager::measure(
|
|
|
347
355
|
winrt::com_ptr<IDWriteTextLayout> spTextLayout;
|
|
348
356
|
|
|
349
357
|
TextMeasurement::Attachments attachments;
|
|
350
|
-
GetTextLayout(
|
|
358
|
+
WindowsTextLayoutManager::GetTextLayout(
|
|
351
359
|
attributedStringBox, paragraphAttributes, layoutConstraints.maximumSize, spTextLayout, attachments);
|
|
352
360
|
|
|
353
361
|
if (spTextLayout) {
|
|
@@ -381,18 +389,6 @@ TextMeasurement TextLayoutManager::measure(
|
|
|
381
389
|
return measurement;
|
|
382
390
|
}
|
|
383
391
|
|
|
384
|
-
/**
|
|
385
|
-
* Measures an AttributedString on the platform, as identified by some
|
|
386
|
-
* opaque cache ID.
|
|
387
|
-
*/
|
|
388
|
-
TextMeasurement TextLayoutManager::measureCachedSpannableById(
|
|
389
|
-
int64_t cacheId,
|
|
390
|
-
const ParagraphAttributes ¶graphAttributes,
|
|
391
|
-
LayoutConstraints layoutConstraints) const {
|
|
392
|
-
assert(false);
|
|
393
|
-
return {};
|
|
394
|
-
}
|
|
395
|
-
|
|
396
392
|
Microsoft::ReactNative::TextTransform ConvertTextTransform(std::optional<TextTransform> const &transform) {
|
|
397
393
|
if (transform) {
|
|
398
394
|
switch (transform.value()) {
|
|
@@ -415,12 +411,12 @@ Microsoft::ReactNative::TextTransform ConvertTextTransform(std::optional<TextTra
|
|
|
415
411
|
LinesMeasurements TextLayoutManager::measureLines(
|
|
416
412
|
const AttributedStringBox &attributedStringBox,
|
|
417
413
|
const ParagraphAttributes ¶graphAttributes,
|
|
418
|
-
Size size) const {
|
|
414
|
+
const Size &size) const {
|
|
419
415
|
LinesMeasurements lineMeasurements{};
|
|
420
416
|
|
|
421
417
|
winrt::com_ptr<IDWriteTextLayout> spTextLayout;
|
|
422
418
|
TextMeasurement::Attachments attachments;
|
|
423
|
-
GetTextLayout(attributedStringBox, paragraphAttributes, size, spTextLayout, attachments);
|
|
419
|
+
WindowsTextLayoutManager::GetTextLayout(attributedStringBox, paragraphAttributes, size, spTextLayout, attachments);
|
|
424
420
|
|
|
425
421
|
if (spTextLayout) {
|
|
426
422
|
std::vector<DWRITE_LINE_METRICS> lineMetrics;
|
|
@@ -485,24 +481,13 @@ LinesMeasurements TextLayoutManager::measureLines(
|
|
|
485
481
|
return lineMeasurements;
|
|
486
482
|
}
|
|
487
483
|
|
|
488
|
-
|
|
484
|
+
Float TextLayoutManager::baseline(
|
|
489
485
|
const AttributedStringBox &attributedStringBox,
|
|
490
486
|
const ParagraphAttributes ¶graphAttributes,
|
|
491
|
-
|
|
492
|
-
return nullptr;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
void *TextLayoutManager::getNativeTextLayoutManager() const {
|
|
496
|
-
return (void *)this;
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
Float TextLayoutManager::baseline(
|
|
500
|
-
AttributedStringBox attributedStringBox,
|
|
501
|
-
ParagraphAttributes paragraphAttributes,
|
|
502
|
-
Size size) const {
|
|
487
|
+
const Size &size) const {
|
|
503
488
|
winrt::com_ptr<IDWriteTextLayout> spTextLayout;
|
|
504
489
|
TextMeasurement::Attachments attachments;
|
|
505
|
-
GetTextLayout(attributedStringBox, paragraphAttributes, size, spTextLayout, attachments);
|
|
490
|
+
WindowsTextLayoutManager::GetTextLayout(attributedStringBox, paragraphAttributes, size, spTextLayout, attachments);
|
|
506
491
|
if (!spTextLayout) {
|
|
507
492
|
return 0;
|
|
508
493
|
}
|
|
@@ -513,7 +498,7 @@ Float TextLayoutManager::baseline(
|
|
|
513
498
|
0.8f; // https://learn.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritetextformat-getlinespacing
|
|
514
499
|
}
|
|
515
500
|
|
|
516
|
-
winrt::hstring
|
|
501
|
+
winrt::hstring WindowsTextLayoutManager::GetTransformedText(const AttributedStringBox &attributedStringBox) {
|
|
517
502
|
winrt::hstring result{};
|
|
518
503
|
const auto &attributedString = attributedStringBox.getValue();
|
|
519
504
|
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#pragma once
|
|
5
|
+
|
|
6
|
+
#pragma warning(push)
|
|
7
|
+
#pragma warning(disable : 5028) // 'Node': Alignment specified in prior declaration (1) not specified in definition
|
|
8
|
+
#include <react/renderer/textlayoutmanager/TextLayoutManager.h>
|
|
9
|
+
#pragma warning(pop)
|
|
10
|
+
|
|
11
|
+
#include <react/renderer/attributedstring/AttributedStringBox.h>
|
|
12
|
+
#include <react/renderer/attributedstring/ParagraphAttributes.h>
|
|
13
|
+
#include <react/renderer/core/LayoutConstraints.h>
|
|
14
|
+
#include <react/renderer/textlayoutmanager/TextLayoutContext.h>
|
|
15
|
+
#include <react/renderer/textlayoutmanager/TextMeasureCache.h>
|
|
16
|
+
#include <react/utils/ContextContainer.h>
|
|
17
|
+
#include <memory>
|
|
18
|
+
|
|
19
|
+
namespace facebook::react {
|
|
20
|
+
|
|
21
|
+
class WindowsTextLayoutManager : public TextLayoutManager {
|
|
22
|
+
public:
|
|
23
|
+
WindowsTextLayoutManager(const ContextContainer::Shared &contextContainer);
|
|
24
|
+
virtual ~WindowsTextLayoutManager() = default;
|
|
25
|
+
|
|
26
|
+
/*
|
|
27
|
+
* Not copyable.
|
|
28
|
+
*/
|
|
29
|
+
WindowsTextLayoutManager(const WindowsTextLayoutManager &) = delete;
|
|
30
|
+
WindowsTextLayoutManager &operator=(const WindowsTextLayoutManager &) = delete;
|
|
31
|
+
|
|
32
|
+
/*
|
|
33
|
+
* Not movable.
|
|
34
|
+
*/
|
|
35
|
+
WindowsTextLayoutManager(WindowsTextLayoutManager &&) = delete;
|
|
36
|
+
WindowsTextLayoutManager &operator=(WindowsTextLayoutManager &&) = delete;
|
|
37
|
+
|
|
38
|
+
static void GetTextLayout(
|
|
39
|
+
const AttributedStringBox &attributedStringBox,
|
|
40
|
+
const ParagraphAttributes ¶graphAttributes,
|
|
41
|
+
Size size,
|
|
42
|
+
winrt::com_ptr<IDWriteTextLayout> &spTextLayout,
|
|
43
|
+
TextMeasurement::Attachments &attachments) noexcept;
|
|
44
|
+
|
|
45
|
+
static void GetTextLayout(
|
|
46
|
+
const AttributedStringBox &attributedStringBox,
|
|
47
|
+
const ParagraphAttributes ¶graphAttributes,
|
|
48
|
+
LayoutConstraints layoutConstraints,
|
|
49
|
+
winrt::com_ptr<IDWriteTextLayout> &spTextLayout) noexcept;
|
|
50
|
+
|
|
51
|
+
static void GetTextLayoutByAdjustingFontSizeToFit(
|
|
52
|
+
AttributedStringBox attributedStringBox,
|
|
53
|
+
const ParagraphAttributes ¶graphAttributes,
|
|
54
|
+
LayoutConstraints layoutConstraints,
|
|
55
|
+
winrt::com_ptr<IDWriteTextLayout> &spTextLayout,
|
|
56
|
+
TextMeasurement::Attachments &attachments,
|
|
57
|
+
float minimumFontScale) noexcept;
|
|
58
|
+
|
|
59
|
+
private:
|
|
60
|
+
static winrt::hstring GetTransformedText(const AttributedStringBox &attributedStringBox);
|
|
61
|
+
static void GetTextLayout(
|
|
62
|
+
const AttributedStringBox &attributedStringBox,
|
|
63
|
+
const ParagraphAttributes ¶graphAttributes,
|
|
64
|
+
Size size,
|
|
65
|
+
winrt::com_ptr<IDWriteTextLayout> &spTextLayout) noexcept;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
} // namespace facebook::react
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
<CppWinRTNamespaceMergeDepth>
|
|
18
18
|
</CppWinRTNamespaceMergeDepth>
|
|
19
19
|
<CppWinRTLibs>true</CppWinRTLibs>
|
|
20
|
-
<BuildMSRNCxxModule>false</BuildMSRNCxxModule>
|
|
21
20
|
<BuildMSRNCxxReactCommon>false</BuildMSRNCxxReactCommon>
|
|
22
21
|
</PropertyGroup>
|
|
23
22
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
@@ -101,7 +100,6 @@
|
|
|
101
100
|
<AdditionalIncludeDirectories>
|
|
102
101
|
$(FmtDir)\include;
|
|
103
102
|
$(ReactNativeWindowsDir)Microsoft.ReactNative;
|
|
104
|
-
$(ReactNativeWindowsDir)Microsoft.ReactNative\Fabric\platform;
|
|
105
103
|
$(ReactNativeWindowsDir)Microsoft.ReactNative\Pch;
|
|
106
104
|
$(ReactNativeWindowsDir)Microsoft.ReactNative\ReactHost;
|
|
107
105
|
$(ReactNativeWindowsDir)Microsoft.ReactNative\Views;
|
|
@@ -278,7 +278,7 @@ JSValue const &JSValueObject::operator[](std::string_view propertyName) const no
|
|
|
278
278
|
return it->second;
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
return JSValue::
|
|
281
|
+
return JSValue::NullRef();
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
bool JSValueObject::Equals(JSValueObject const &other) const noexcept {
|
|
@@ -434,6 +434,22 @@ void JSValueArray::WriteTo(IJSValueWriter const &writer) const noexcept {
|
|
|
434
434
|
/*static*/ JSValue const JSValue::EmptyArray{JSValueArray{}};
|
|
435
435
|
/*static*/ JSValue const JSValue::EmptyString{std::string{}};
|
|
436
436
|
|
|
437
|
+
const JSValue &JSValue::NullRef() noexcept {
|
|
438
|
+
return JSValue::Null;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
const JSValue &JSValue::EmptyObjectRef() noexcept {
|
|
442
|
+
return JSValue::EmptyObject;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
const JSValue &JSValue::EmptyArrayRef() noexcept {
|
|
446
|
+
return JSValue::EmptyArray;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
const JSValue &JSValue::EmptyStringRef() noexcept {
|
|
450
|
+
return JSValue::EmptyString;
|
|
451
|
+
}
|
|
452
|
+
|
|
437
453
|
#pragma warning(push)
|
|
438
454
|
#pragma warning(disable : 26495) // False positive for union member not initialized
|
|
439
455
|
JSValue::JSValue(JSValue &&other) noexcept : m_type{other.m_type} {
|
|
@@ -739,7 +755,7 @@ JSValue const *JSValue::TryGetObjectProperty(std::string_view propertyName) cons
|
|
|
739
755
|
|
|
740
756
|
JSValue const &JSValue::GetObjectProperty(std::string_view propertyName) const noexcept {
|
|
741
757
|
auto result = TryGetObjectProperty(propertyName);
|
|
742
|
-
return result ? *result :
|
|
758
|
+
return result ? *result : NullRef();
|
|
743
759
|
}
|
|
744
760
|
|
|
745
761
|
size_t JSValue::ItemCount() const noexcept {
|
|
@@ -752,7 +768,7 @@ JSValue const *JSValue::TryGetArrayItem(JSValueArray::size_type index) const noe
|
|
|
752
768
|
|
|
753
769
|
JSValue const &JSValue::GetArrayItem(JSValueArray::size_type index) const noexcept {
|
|
754
770
|
auto result = TryGetArrayItem(index);
|
|
755
|
-
return result ? *result :
|
|
771
|
+
return result ? *result : NullRef();
|
|
756
772
|
}
|
|
757
773
|
|
|
758
774
|
bool JSValue::Equals(JSValue const &other) const noexcept {
|