react-native-windows 0.76.8 → 0.76.10
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/Libraries/Components/Button.windows.js +9 -0
- package/Libraries/Components/Pressable/Pressable.windows.js +9 -0
- package/Libraries/Components/TextInput/TextInput.windows.js +11 -1
- package/Libraries/Components/Touchable/TouchableBounce.windows.js +229 -0
- package/Libraries/Components/Touchable/TouchableNativeFeedback.windows.js +373 -0
- package/Libraries/Components/Touchable/TouchableOpacity.windows.js +7 -0
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +8 -0
- package/Libraries/Components/View/View.windows.js +11 -1
- package/Libraries/Components/View/ViewAccessibility.d.ts +15 -0
- package/Libraries/Components/View/ViewAccessibility.windows.js +3 -0
- package/Libraries/Components/View/ViewPropTypes.windows.js +3 -0
- package/Libraries/Image/Image.windows.js +7 -0
- package/Libraries/Modal/Modal.windows.js +4 -1
- package/Libraries/Text/Text.windows.js +14 -1
- package/Libraries/Text/TextProps.windows.js +3 -0
- package/Microsoft.ReactNative/CompositionComponentView.idl +13 -1
- package/Microsoft.ReactNative/Fabric/AbiPortalShadowNode.cpp +97 -0
- package/Microsoft.ReactNative/Fabric/AbiPortalShadowNode.h +53 -0
- package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.h +160 -17
- package/Microsoft.ReactNative/Fabric/AbiViewProps.cpp +8 -10
- package/Microsoft.ReactNative/Fabric/ComponentView.cpp +4 -2
- package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +0 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +428 -39
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +39 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +55 -33
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +5 -3
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +43 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.h +2 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionTextProvider.cpp +115 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionTextProvider.h +41 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionTextRangeProvider.cpp +298 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionTextRangeProvider.h +59 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +106 -56
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +2 -0
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +163 -10
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +17 -1
- package/Microsoft.ReactNative/Fabric/Composition/FocusManager.cpp +4 -2
- package/Microsoft.ReactNative/Fabric/Composition/FocusManager.h +9 -1
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +348 -316
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +3 -61
- package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.cpp +78 -0
- package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.h +52 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +22 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +7 -5
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +99 -37
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +12 -6
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +81 -22
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +21 -2
- package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +6 -1
- package/Microsoft.ReactNative/Fabric/Composition/TooltipService.cpp +41 -37
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +76 -33
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +8 -2
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +1 -6
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +0 -3
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +0 -2
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/HostPlatformColor.h +5 -8
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorParser.h +1 -2
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.cpp +1 -1
- package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +15 -1
- package/Microsoft.ReactNative/IReactContext.cpp +2 -2
- package/Microsoft.ReactNative/IReactContext.h +1 -1
- package/Microsoft.ReactNative/IReactContext.idl +2 -2
- package/Microsoft.ReactNative/IReactPackageBuilder.idl +3 -3
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +97 -87
- package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.cpp +4 -0
- package/Microsoft.ReactNative/Modules/AlertModule.cpp +9 -4
- package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedNodeManager.cpp +1 -1
- package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.cpp +32 -35
- package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.h +7 -4
- package/Microsoft.ReactNative/Modules/AppStateModule.cpp +1 -1
- package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.cpp +2 -2
- package/Microsoft.ReactNative/Modules/AppearanceModule.cpp +2 -2
- package/Microsoft.ReactNative/Modules/ClipboardModule.cpp +1 -1
- package/Microsoft.ReactNative/Modules/ClipboardModule.h +1 -1
- package/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp +3 -3
- package/Microsoft.ReactNative/Modules/I18nManagerModule.cpp +1 -1
- package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +7 -5
- package/Microsoft.ReactNative/Modules/LogBoxModule.h +2 -1
- package/Microsoft.ReactNative/Modules/Timing.cpp +2 -2
- package/Microsoft.ReactNative/ReactHost/IReactInstance.h +5 -0
- package/Microsoft.ReactNative/ReactHost/React.h +0 -3
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +36 -12
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +1 -1
- package/Microsoft.ReactNative/ReactNativeHost.cpp +9 -4
- package/Microsoft.ReactNative/ReactNativeIsland.idl +5 -1
- package/Microsoft.ReactNative/ReactPackageBuilder.cpp +3 -3
- package/Microsoft.ReactNative/ReactPackageBuilder.h +4 -4
- package/Microsoft.ReactNative/Utils/Helpers.cpp +0 -2
- package/Microsoft.ReactNative/Views/DevMenu.cpp +6 -6
- package/Microsoft.ReactNative/Views/DevMenu.h +1 -1
- package/Microsoft.ReactNative/XamlUIService.cpp +13 -7
- package/Microsoft.ReactNative/XamlUIService.h +4 -1
- package/Microsoft.ReactNative/XamlUIService.idl +2 -0
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +6 -2
- package/Microsoft.ReactNative.Cxx/NativeModules.h +29 -0
- package/Microsoft.ReactNative.Cxx/ReactContext.h +1 -1
- package/Microsoft.ReactNative.Cxx/XamlUtils.h +12 -0
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/React.Cpp.props +3 -0
- package/PropertySheets/WebView2.props +1 -1
- package/PropertySheets/WinUI.props +5 -4
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +253 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/accessibilityPropsConversions.h +799 -0
- package/Shared/InspectorPackagerConnection.cpp +2 -5
- package/Shared/InspectorPackagerConnection.h +2 -2
- package/Shared/Networking/WinRTWebSocketResource.cpp +369 -7
- package/Shared/Networking/WinRTWebSocketResource.h +118 -0
- package/Shared/Shared.vcxitems +12 -5
- package/Shared/Shared.vcxitems.filters +11 -4
- package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +212 -0
- package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +295 -0
- package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +200 -0
- package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +224 -0
- package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +250 -0
- package/codegen/react/components/rnwcore/AndroidSwitch.g.h +267 -0
- package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +234 -0
- package/codegen/react/components/rnwcore/InputAccessory.g.h +200 -0
- package/codegen/react/components/rnwcore/ModalHostView.g.h +279 -0
- package/codegen/react/components/rnwcore/PullToRefreshView.g.h +246 -0
- package/codegen/react/components/rnwcore/SafeAreaView.g.h +197 -0
- package/codegen/react/components/rnwcore/Switch.g.h +263 -0
- package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +200 -0
- package/just-task.js +1 -1
- package/package.json +6 -6
- package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.cpp +0 -191
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentDescriptor.h +0 -39
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.cpp +0 -18
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.h +0 -39
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
#include "pch.h"
|
|
2
|
+
#include "CompositionTextRangeProvider.h"
|
|
3
|
+
#include <Fabric/ComponentView.h>
|
|
4
|
+
#include <Fabric/Composition/ParagraphComponentView.h>
|
|
5
|
+
#include <Fabric/Composition/TextInput/WindowsTextInputComponentView.h>
|
|
6
|
+
#include <Fabric/platform/react/renderer/graphics/HostPlatformColor.h>
|
|
7
|
+
#include <Unicode.h>
|
|
8
|
+
#include "RootComponentView.h"
|
|
9
|
+
#include "UiaHelpers.h"
|
|
10
|
+
|
|
11
|
+
namespace winrt::Microsoft::ReactNative::implementation {
|
|
12
|
+
|
|
13
|
+
CompositionTextRangeProvider::CompositionTextRangeProvider(
|
|
14
|
+
const winrt::Microsoft::ReactNative::Composition::ComponentView &componentView,
|
|
15
|
+
CompositionDynamicAutomationProvider *parentProvider) noexcept
|
|
16
|
+
: m_view{componentView} {
|
|
17
|
+
m_parentProvider.copy_from(parentProvider);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
HRESULT __stdcall CompositionTextRangeProvider::Clone(ITextRangeProvider **pRetVal) {
|
|
21
|
+
// no-op
|
|
22
|
+
*pRetVal = nullptr;
|
|
23
|
+
return S_OK;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
HRESULT __stdcall CompositionTextRangeProvider::Compare(ITextRangeProvider *range, BOOL *pRetVal) {
|
|
27
|
+
// no-op
|
|
28
|
+
*pRetVal = false;
|
|
29
|
+
return S_OK;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
HRESULT __stdcall CompositionTextRangeProvider::CompareEndpoints(
|
|
33
|
+
TextPatternRangeEndpoint endpoint,
|
|
34
|
+
ITextRangeProvider *targetRange,
|
|
35
|
+
TextPatternRangeEndpoint targetEndpoint,
|
|
36
|
+
int *pRetVal) {
|
|
37
|
+
// no-op
|
|
38
|
+
*pRetVal = 0;
|
|
39
|
+
return S_OK;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
HRESULT __stdcall CompositionTextRangeProvider::ExpandToEnclosingUnit(TextUnit unit) {
|
|
43
|
+
// no-op
|
|
44
|
+
return S_OK;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
HRESULT __stdcall CompositionTextRangeProvider::FindAttribute(
|
|
48
|
+
TEXTATTRIBUTEID attributeId,
|
|
49
|
+
VARIANT val,
|
|
50
|
+
BOOL backward,
|
|
51
|
+
ITextRangeProvider **pRetVal) {
|
|
52
|
+
// no-op
|
|
53
|
+
*pRetVal = nullptr;
|
|
54
|
+
return S_OK;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
HRESULT __stdcall CompositionTextRangeProvider::FindText(
|
|
58
|
+
BSTR text,
|
|
59
|
+
BOOL backward,
|
|
60
|
+
BOOL ignoreCase,
|
|
61
|
+
ITextRangeProvider **pRetVal) {
|
|
62
|
+
// no-op
|
|
63
|
+
*pRetVal = nullptr;
|
|
64
|
+
return S_OK;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
HRESULT __stdcall CompositionTextRangeProvider::GetAttributeValue(TEXTATTRIBUTEID attributeId, VARIANT *pRetVal) {
|
|
68
|
+
if (pRetVal == nullptr)
|
|
69
|
+
return E_POINTER;
|
|
70
|
+
auto strongView = m_view.view();
|
|
71
|
+
|
|
72
|
+
if (!strongView)
|
|
73
|
+
return UIA_E_ELEMENTNOTAVAILABLE;
|
|
74
|
+
|
|
75
|
+
auto props = std::static_pointer_cast<const facebook::react::ParagraphProps>(
|
|
76
|
+
winrt::get_self<ComponentView>(strongView)->props());
|
|
77
|
+
|
|
78
|
+
auto textinputProps = std::static_pointer_cast<const facebook::react::WindowsTextInputProps>(
|
|
79
|
+
winrt::get_self<ComponentView>(strongView)->props());
|
|
80
|
+
|
|
81
|
+
auto isTextInput =
|
|
82
|
+
strongView.try_as<winrt::Microsoft::ReactNative::Composition::implementation::WindowsTextInputComponentView>();
|
|
83
|
+
|
|
84
|
+
if (props == nullptr)
|
|
85
|
+
return UIA_E_ELEMENTNOTAVAILABLE;
|
|
86
|
+
|
|
87
|
+
if (attributeId == UIA_BackgroundColorAttributeId) {
|
|
88
|
+
pRetVal->vt = VT_I4;
|
|
89
|
+
pRetVal->lVal = (*props->backgroundColor).AsColorRefWithAlpha();
|
|
90
|
+
} else if (attributeId == UIA_CapStyleAttributeId) {
|
|
91
|
+
pRetVal->vt = VT_I4;
|
|
92
|
+
auto fontVariant = facebook::react::FontVariant::Default;
|
|
93
|
+
auto textTransform = facebook::react::TextTransform::None;
|
|
94
|
+
if (props->textAttributes.fontVariant.has_value()) {
|
|
95
|
+
fontVariant = props->textAttributes.fontVariant.value();
|
|
96
|
+
}
|
|
97
|
+
if (props->textAttributes.textTransform.has_value()) {
|
|
98
|
+
textTransform = props->textAttributes.textTransform.value();
|
|
99
|
+
}
|
|
100
|
+
if (fontVariant == facebook::react::FontVariant::SmallCaps) {
|
|
101
|
+
return CapStyle_SmallCap;
|
|
102
|
+
} else if (textTransform == facebook::react::TextTransform::Capitalize) {
|
|
103
|
+
return CapStyle_Titling;
|
|
104
|
+
} else if (textTransform == facebook::react::TextTransform::Lowercase) {
|
|
105
|
+
return CapStyle_None;
|
|
106
|
+
} else if (textTransform == facebook::react::TextTransform::Uppercase) {
|
|
107
|
+
return CapStyle_AllCap;
|
|
108
|
+
}
|
|
109
|
+
} else if (attributeId == UIA_FontNameAttributeId) {
|
|
110
|
+
pRetVal->vt = VT_BSTR;
|
|
111
|
+
auto fontName = props->textAttributes.fontFamily;
|
|
112
|
+
if (fontName.empty()) {
|
|
113
|
+
fontName = "Segoe UI";
|
|
114
|
+
}
|
|
115
|
+
std::wstring wfontName(fontName.begin(), fontName.end());
|
|
116
|
+
pRetVal->bstrVal = SysAllocString(wfontName.c_str());
|
|
117
|
+
} else if (attributeId == UIA_FontSizeAttributeId) {
|
|
118
|
+
pRetVal->vt = VT_R8;
|
|
119
|
+
pRetVal->dblVal = props->textAttributes.fontSize;
|
|
120
|
+
} else if (attributeId == UIA_FontWeightAttributeId) {
|
|
121
|
+
if (props->textAttributes.fontWeight.has_value()) {
|
|
122
|
+
pRetVal->vt = VT_I4;
|
|
123
|
+
pRetVal->lVal = static_cast<long>(props->textAttributes.fontWeight.value());
|
|
124
|
+
}
|
|
125
|
+
} else if (attributeId == UIA_ForegroundColorAttributeId) {
|
|
126
|
+
pRetVal->vt = VT_I4;
|
|
127
|
+
pRetVal->lVal = (*props->textAttributes.foregroundColor).AsColorRefWithAlpha();
|
|
128
|
+
} else if (attributeId == UIA_IsItalicAttributeId) {
|
|
129
|
+
pRetVal->vt = VT_BOOL;
|
|
130
|
+
pRetVal->boolVal = (props->textAttributes.fontStyle.has_value() &&
|
|
131
|
+
props->textAttributes.fontStyle.value() == facebook::react::FontStyle::Italic)
|
|
132
|
+
? VARIANT_TRUE
|
|
133
|
+
: VARIANT_FALSE;
|
|
134
|
+
} else if (attributeId == UIA_IsReadOnlyAttributeId) {
|
|
135
|
+
pRetVal->vt = VT_BOOL;
|
|
136
|
+
pRetVal->boolVal = isTextInput ? textinputProps->editable ? VARIANT_FALSE : VARIANT_TRUE : VARIANT_TRUE;
|
|
137
|
+
} else if (attributeId == UIA_HorizontalTextAlignmentAttributeId) {
|
|
138
|
+
pRetVal->vt = VT_I4;
|
|
139
|
+
auto textAlign = facebook::react::TextAlignment::Center;
|
|
140
|
+
if (props->textAttributes.alignment.has_value()) {
|
|
141
|
+
textAlign = props->textAttributes.alignment.value();
|
|
142
|
+
}
|
|
143
|
+
if (textAlign == facebook::react::TextAlignment::Left) {
|
|
144
|
+
pRetVal->lVal = HorizontalTextAlignment_Left;
|
|
145
|
+
} else if (textAlign == facebook::react::TextAlignment::Right) {
|
|
146
|
+
pRetVal->lVal = HorizontalTextAlignment_Right;
|
|
147
|
+
} else if (textAlign == facebook::react::TextAlignment::Center) {
|
|
148
|
+
pRetVal->lVal = HorizontalTextAlignment_Centered;
|
|
149
|
+
} else if (textAlign == facebook::react::TextAlignment::Justified) {
|
|
150
|
+
pRetVal->lVal = HorizontalTextAlignment_Justified;
|
|
151
|
+
} else if (textAlign == facebook::react::TextAlignment::Natural) {
|
|
152
|
+
pRetVal->lVal = HorizontalTextAlignment_Left;
|
|
153
|
+
}
|
|
154
|
+
} else if (attributeId == UIA_StrikethroughColorAttributeId) {
|
|
155
|
+
if (props->textAttributes.textDecorationLineType.has_value() &&
|
|
156
|
+
(props->textAttributes.textDecorationLineType.value() ==
|
|
157
|
+
facebook::react::TextDecorationLineType::Strikethrough ||
|
|
158
|
+
props->textAttributes.textDecorationLineType.value() ==
|
|
159
|
+
facebook::react::TextDecorationLineType::UnderlineStrikethrough)) {
|
|
160
|
+
pRetVal->vt = VT_I4;
|
|
161
|
+
pRetVal->lVal = (*props->textAttributes.textDecorationColor).AsColorRefWithAlpha();
|
|
162
|
+
}
|
|
163
|
+
} else if (attributeId == UIA_StrikethroughStyleAttributeId) {
|
|
164
|
+
if (props->textAttributes.textDecorationLineType.has_value() &&
|
|
165
|
+
(props->textAttributes.textDecorationLineType.value() ==
|
|
166
|
+
facebook::react::TextDecorationLineType::Strikethrough ||
|
|
167
|
+
props->textAttributes.textDecorationLineType.value() ==
|
|
168
|
+
facebook::react::TextDecorationLineType::UnderlineStrikethrough)) {
|
|
169
|
+
pRetVal->vt = VT_I4;
|
|
170
|
+
auto style = props->textAttributes.textDecorationStyle.value();
|
|
171
|
+
pRetVal->lVal = GetTextDecorationLineStyle(style);
|
|
172
|
+
}
|
|
173
|
+
} else if (attributeId == UIA_UnderlineColorAttributeId) {
|
|
174
|
+
if (props->textAttributes.textDecorationLineType.has_value() &&
|
|
175
|
+
(props->textAttributes.textDecorationLineType.value() == facebook::react::TextDecorationLineType::Underline ||
|
|
176
|
+
props->textAttributes.textDecorationLineType.value() ==
|
|
177
|
+
facebook::react::TextDecorationLineType::UnderlineStrikethrough)) {
|
|
178
|
+
pRetVal->vt = VT_I4;
|
|
179
|
+
pRetVal->lVal = (*props->textAttributes.textDecorationColor).AsColorRefWithAlpha();
|
|
180
|
+
}
|
|
181
|
+
} else if (attributeId == UIA_UnderlineStyleAttributeId) {
|
|
182
|
+
if (props->textAttributes.textDecorationLineType.has_value() &&
|
|
183
|
+
(props->textAttributes.textDecorationLineType.value() == facebook::react::TextDecorationLineType::Underline ||
|
|
184
|
+
props->textAttributes.textDecorationLineType.value() ==
|
|
185
|
+
facebook::react::TextDecorationLineType::UnderlineStrikethrough)) {
|
|
186
|
+
pRetVal->vt = VT_I4;
|
|
187
|
+
auto style = props->textAttributes.textDecorationStyle.value();
|
|
188
|
+
pRetVal->lVal = GetTextDecorationLineStyle(style);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return S_OK;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
HRESULT __stdcall CompositionTextRangeProvider::GetBoundingRectangles(SAFEARRAY **pRetVal) {
|
|
195
|
+
if (pRetVal == nullptr)
|
|
196
|
+
return E_POINTER;
|
|
197
|
+
UiaRect rect;
|
|
198
|
+
auto hr = m_parentProvider->get_BoundingRectangle(&rect);
|
|
199
|
+
if (FAILED(hr))
|
|
200
|
+
return hr;
|
|
201
|
+
*pRetVal = SafeArrayCreateVector(VT_R8, 0, 4);
|
|
202
|
+
double *pData = nullptr;
|
|
203
|
+
hr = SafeArrayAccessData(*pRetVal, reinterpret_cast<void **>(&pData));
|
|
204
|
+
if (FAILED(hr))
|
|
205
|
+
return hr;
|
|
206
|
+
pData[0] = rect.left;
|
|
207
|
+
pData[1] = rect.top;
|
|
208
|
+
pData[2] = rect.width;
|
|
209
|
+
pData[3] = rect.height;
|
|
210
|
+
hr = SafeArrayUnaccessData(*pRetVal);
|
|
211
|
+
if (FAILED(hr))
|
|
212
|
+
return hr;
|
|
213
|
+
return S_OK;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
HRESULT __stdcall CompositionTextRangeProvider::GetChildren(SAFEARRAY **pRetVal) {
|
|
217
|
+
// no-op
|
|
218
|
+
*pRetVal = SafeArrayCreateVector(VT_UNKNOWN, 0, 0);
|
|
219
|
+
return S_OK;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
HRESULT __stdcall CompositionTextRangeProvider::GetEnclosingElement(IRawElementProviderSimple **pRetVal) {
|
|
223
|
+
// no-op
|
|
224
|
+
*pRetVal = nullptr;
|
|
225
|
+
return S_OK;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
HRESULT __stdcall CompositionTextRangeProvider::GetText(int maxLength, BSTR *pRetVal) {
|
|
229
|
+
if (pRetVal == nullptr)
|
|
230
|
+
return E_POINTER;
|
|
231
|
+
auto strongView = m_view.view();
|
|
232
|
+
|
|
233
|
+
if (!strongView)
|
|
234
|
+
return UIA_E_ELEMENTNOTAVAILABLE;
|
|
235
|
+
auto paragraphView =
|
|
236
|
+
strongView.try_as<winrt::Microsoft::ReactNative::Composition::implementation::ParagraphComponentView>();
|
|
237
|
+
std::string text = "";
|
|
238
|
+
if (paragraphView) {
|
|
239
|
+
text = paragraphView->DefaultAccessibleName();
|
|
240
|
+
} else {
|
|
241
|
+
auto textInputView =
|
|
242
|
+
strongView.try_as<winrt::Microsoft::ReactNative::Composition::implementation::WindowsTextInputComponentView>();
|
|
243
|
+
if (textInputView) {
|
|
244
|
+
text = textInputView->getAccessiblityValue().value().empty() ? textInputView->DefaultAccessibleName()
|
|
245
|
+
: textInputView->getAccessiblityValue().value();
|
|
246
|
+
} else {
|
|
247
|
+
return UIA_E_NOTSUPPORTED;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
std::wstring wtext(text.begin(), text.end());
|
|
252
|
+
*pRetVal = SysAllocString(wtext.c_str());
|
|
253
|
+
return S_OK;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
HRESULT __stdcall CompositionTextRangeProvider::Move(TextUnit unit, int count, int *pRetVal) {
|
|
257
|
+
// no-op
|
|
258
|
+
*pRetVal = 0;
|
|
259
|
+
return S_OK;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
HRESULT __stdcall CompositionTextRangeProvider::MoveEndpointByRange(
|
|
263
|
+
TextPatternRangeEndpoint endpoint,
|
|
264
|
+
ITextRangeProvider *targetRange,
|
|
265
|
+
TextPatternRangeEndpoint targetEndpoint) {
|
|
266
|
+
// no-op
|
|
267
|
+
return S_OK;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
HRESULT __stdcall CompositionTextRangeProvider::MoveEndpointByUnit(
|
|
271
|
+
TextPatternRangeEndpoint endpoint,
|
|
272
|
+
TextUnit unit,
|
|
273
|
+
int count,
|
|
274
|
+
int *pRetVal) {
|
|
275
|
+
// no-op
|
|
276
|
+
*pRetVal = 0;
|
|
277
|
+
return S_OK;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
HRESULT __stdcall CompositionTextRangeProvider::ScrollIntoView(BOOL alignToTop) {
|
|
281
|
+
// no-op
|
|
282
|
+
return S_OK;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
HRESULT __stdcall CompositionTextRangeProvider::AddToSelection() {
|
|
286
|
+
// no-op
|
|
287
|
+
return S_OK;
|
|
288
|
+
}
|
|
289
|
+
HRESULT __stdcall CompositionTextRangeProvider::RemoveFromSelection() {
|
|
290
|
+
// no-op
|
|
291
|
+
return S_OK;
|
|
292
|
+
}
|
|
293
|
+
HRESULT __stdcall CompositionTextRangeProvider::Select() {
|
|
294
|
+
// no-op
|
|
295
|
+
return S_OK;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
} // namespace winrt::Microsoft::ReactNative::implementation
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <Fabric/Composition/CompositionDynamicAutomationProvider.h>
|
|
4
|
+
#include <Fabric/Composition/CompositionTextProvider.h>
|
|
5
|
+
#include <Fabric/Composition/CompositionViewComponentView.h>
|
|
6
|
+
#include <Fabric/ReactTaggedView.h>
|
|
7
|
+
#include <UIAutomation.h>
|
|
8
|
+
#include <inspectable.h>
|
|
9
|
+
#include <uiautomationcore.h>
|
|
10
|
+
|
|
11
|
+
namespace winrt::Microsoft::ReactNative::implementation {
|
|
12
|
+
|
|
13
|
+
class CompositionTextRangeProvider : public winrt::implements<CompositionTextRangeProvider, ITextRangeProvider> {
|
|
14
|
+
public:
|
|
15
|
+
CompositionTextRangeProvider(
|
|
16
|
+
const winrt::Microsoft::ReactNative::Composition::ComponentView &componentView,
|
|
17
|
+
CompositionDynamicAutomationProvider *parentProvider) noexcept;
|
|
18
|
+
|
|
19
|
+
// inherited via ITextRangeProvider
|
|
20
|
+
virtual HRESULT __stdcall Clone(ITextRangeProvider **pRetVal) override;
|
|
21
|
+
virtual HRESULT __stdcall Compare(ITextRangeProvider *range, BOOL *pRetVal) override;
|
|
22
|
+
virtual HRESULT __stdcall CompareEndpoints(
|
|
23
|
+
TextPatternRangeEndpoint endpoint,
|
|
24
|
+
ITextRangeProvider *targetRange,
|
|
25
|
+
TextPatternRangeEndpoint targetEndpoint,
|
|
26
|
+
int *pRetVal) override;
|
|
27
|
+
virtual HRESULT __stdcall ExpandToEnclosingUnit(TextUnit unit) override;
|
|
28
|
+
virtual HRESULT __stdcall FindAttribute(
|
|
29
|
+
TEXTATTRIBUTEID attributeId,
|
|
30
|
+
VARIANT val,
|
|
31
|
+
BOOL backward,
|
|
32
|
+
ITextRangeProvider **pRetVal) override;
|
|
33
|
+
virtual HRESULT __stdcall FindText(BSTR text, BOOL backward, BOOL ignoreCase, ITextRangeProvider **pRetVal) override;
|
|
34
|
+
virtual HRESULT __stdcall GetAttributeValue(TEXTATTRIBUTEID attributeId, VARIANT *pRetVal) override;
|
|
35
|
+
virtual HRESULT __stdcall GetBoundingRectangles(SAFEARRAY **pRetVal) override;
|
|
36
|
+
virtual HRESULT __stdcall GetChildren(SAFEARRAY **pRetVal) override;
|
|
37
|
+
virtual HRESULT __stdcall GetEnclosingElement(IRawElementProviderSimple **pRetVal) override;
|
|
38
|
+
virtual HRESULT __stdcall GetText(int maxLength, BSTR *pRetVal) override;
|
|
39
|
+
virtual HRESULT __stdcall Move(TextUnit unit, int count, int *pRetVal) override;
|
|
40
|
+
virtual HRESULT __stdcall MoveEndpointByRange(
|
|
41
|
+
TextPatternRangeEndpoint endpoint,
|
|
42
|
+
ITextRangeProvider *targetRange,
|
|
43
|
+
TextPatternRangeEndpoint targetEndpoint) override;
|
|
44
|
+
virtual HRESULT __stdcall MoveEndpointByUnit(
|
|
45
|
+
TextPatternRangeEndpoint endpoint,
|
|
46
|
+
TextUnit unit,
|
|
47
|
+
int count,
|
|
48
|
+
int *pRetVal) override;
|
|
49
|
+
virtual HRESULT __stdcall ScrollIntoView(BOOL alignToTop) override;
|
|
50
|
+
virtual HRESULT __stdcall AddToSelection() override;
|
|
51
|
+
virtual HRESULT __stdcall RemoveFromSelection() override;
|
|
52
|
+
virtual HRESULT __stdcall Select() override;
|
|
53
|
+
|
|
54
|
+
private:
|
|
55
|
+
::Microsoft::ReactNative::ReactTaggedView m_view;
|
|
56
|
+
winrt::com_ptr<CompositionDynamicAutomationProvider> m_parentProvider;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
} // namespace winrt::Microsoft::ReactNative::implementation
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
namespace winrt::Microsoft::ReactNative::Composition::implementation {
|
|
34
34
|
|
|
35
35
|
constexpr float FOCUS_VISUAL_WIDTH = 2.0f;
|
|
36
|
+
constexpr float FOCUS_VISUAL_RADIUS = 3.0f;
|
|
36
37
|
|
|
37
38
|
// m_outerVisual
|
|
38
39
|
// |
|
|
@@ -168,18 +169,21 @@ void ComponentView::updateProps(
|
|
|
168
169
|
m_componentHostingFocusVisual->hostFocusVisual(false, get_strong());
|
|
169
170
|
}
|
|
170
171
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
172
|
+
// We have to check m_componentHostingFocusVisual again, as it can be set to null by above hostFocusVisual call
|
|
173
|
+
if (m_componentHostingFocusVisual) {
|
|
174
|
+
if (m_componentHostingFocusVisual->m_focusPrimitive->m_focusInnerPrimitive) {
|
|
175
|
+
m_componentHostingFocusVisual->m_focusPrimitive->m_focusInnerPrimitive->updateProps(oldViewProps, newViewProps);
|
|
176
|
+
}
|
|
177
|
+
if (m_componentHostingFocusVisual->m_focusPrimitive->m_focusOuterPrimitive) {
|
|
178
|
+
m_componentHostingFocusVisual->m_focusPrimitive->m_focusOuterPrimitive->updateProps(oldViewProps, newViewProps);
|
|
179
|
+
}
|
|
176
180
|
}
|
|
177
181
|
}
|
|
178
182
|
if ((m_flags & ComponentViewFeatures::ShadowProps) == ComponentViewFeatures::ShadowProps) {
|
|
179
183
|
updateShadowProps(oldViewProps, newViewProps);
|
|
180
184
|
}
|
|
181
185
|
if (oldViewProps.tooltip != newViewProps.tooltip) {
|
|
182
|
-
if (!m_tooltipTracked && newViewProps.tooltip) {
|
|
186
|
+
if (!m_tooltipTracked && newViewProps.tooltip && !newViewProps.tooltip->empty()) {
|
|
183
187
|
TooltipService::GetCurrent(m_reactContext.Properties())->StartTracking(*this);
|
|
184
188
|
m_tooltipTracked = true;
|
|
185
189
|
} else if (m_tooltipTracked && !newViewProps.tooltip) {
|
|
@@ -225,29 +229,11 @@ void ComponentView::updateFocusLayoutMetrics() noexcept {
|
|
|
225
229
|
facebook::react::RectangleEdges<bool> nudgeEdges;
|
|
226
230
|
auto scaleFactor = m_focusPrimitive->m_focusVisualComponent->m_layoutMetrics.pointScaleFactor;
|
|
227
231
|
if (m_focusPrimitive) {
|
|
232
|
+
auto nudgeEdges = m_focusPrimitive->m_focusVisualComponent->focusNudges();
|
|
228
233
|
if (m_focusPrimitive->m_focusOuterPrimitive) {
|
|
229
234
|
auto outerFocusMetrics = m_focusPrimitive->m_focusVisualComponent->focusLayoutMetrics(false /*inner*/);
|
|
230
|
-
|
|
231
|
-
if (outerFocusMetrics.frame.origin.x < 0) {
|
|
232
|
-
nudgeEdges.left = true;
|
|
233
|
-
}
|
|
234
|
-
if (outerFocusMetrics.frame.origin.y < 0) {
|
|
235
|
-
nudgeEdges.top = true;
|
|
236
|
-
}
|
|
237
|
-
if (outerFocusMetrics.frame.getMaxX() > m_layoutMetrics.frame.getMaxX()) {
|
|
238
|
-
nudgeEdges.right = true;
|
|
239
|
-
}
|
|
240
|
-
if (outerFocusMetrics.frame.getMaxY() > m_layoutMetrics.frame.getMaxY()) {
|
|
241
|
-
nudgeEdges.bottom = true;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
235
|
m_focusPrimitive->m_focusOuterPrimitive->RootVisual().Size(
|
|
245
|
-
{outerFocusMetrics.frame.size.width * scaleFactor
|
|
246
|
-
(nudgeEdges.left ? (FOCUS_VISUAL_WIDTH * 2 * scaleFactor) : 0) -
|
|
247
|
-
(nudgeEdges.right ? (FOCUS_VISUAL_WIDTH * 2 * scaleFactor) : 0),
|
|
248
|
-
outerFocusMetrics.frame.size.height * scaleFactor -
|
|
249
|
-
(nudgeEdges.top ? (FOCUS_VISUAL_WIDTH * 2 * scaleFactor) : 0) -
|
|
250
|
-
(nudgeEdges.bottom ? (FOCUS_VISUAL_WIDTH * 2 * scaleFactor) : 0)});
|
|
236
|
+
{outerFocusMetrics.frame.size.width * scaleFactor, outerFocusMetrics.frame.size.height * scaleFactor});
|
|
251
237
|
m_focusPrimitive->m_focusOuterPrimitive->RootVisual().Offset(
|
|
252
238
|
{nudgeEdges.left ? 0 : -(FOCUS_VISUAL_WIDTH * 2 * scaleFactor),
|
|
253
239
|
nudgeEdges.top ? 0 : -(FOCUS_VISUAL_WIDTH * 2 * scaleFactor),
|
|
@@ -258,15 +244,10 @@ void ComponentView::updateFocusLayoutMetrics() noexcept {
|
|
|
258
244
|
if (m_focusPrimitive->m_focusInnerPrimitive) {
|
|
259
245
|
auto innerFocusMetrics = m_focusPrimitive->m_focusVisualComponent->focusLayoutMetrics(true /*inner*/);
|
|
260
246
|
m_focusPrimitive->m_focusInnerPrimitive->RootVisual().Size(
|
|
261
|
-
{innerFocusMetrics.frame.size.width * scaleFactor
|
|
262
|
-
(nudgeEdges.left ? (FOCUS_VISUAL_WIDTH * scaleFactor) : 0) -
|
|
263
|
-
(nudgeEdges.right ? (FOCUS_VISUAL_WIDTH * scaleFactor) : 0),
|
|
264
|
-
innerFocusMetrics.frame.size.height * scaleFactor -
|
|
265
|
-
(nudgeEdges.top ? (FOCUS_VISUAL_WIDTH * scaleFactor) : 0) -
|
|
266
|
-
(nudgeEdges.bottom ? (FOCUS_VISUAL_WIDTH * scaleFactor) : 0)});
|
|
247
|
+
{innerFocusMetrics.frame.size.width * scaleFactor, innerFocusMetrics.frame.size.height * scaleFactor});
|
|
267
248
|
m_focusPrimitive->m_focusInnerPrimitive->RootVisual().Offset(
|
|
268
|
-
{nudgeEdges.left ?
|
|
269
|
-
nudgeEdges.top ?
|
|
249
|
+
{nudgeEdges.left ? (FOCUS_VISUAL_WIDTH * scaleFactor) : (-FOCUS_VISUAL_WIDTH * scaleFactor),
|
|
250
|
+
nudgeEdges.top ? (FOCUS_VISUAL_WIDTH * scaleFactor) : (-FOCUS_VISUAL_WIDTH * scaleFactor),
|
|
270
251
|
0.0f});
|
|
271
252
|
m_focusPrimitive->m_focusInnerPrimitive->markNeedsUpdate();
|
|
272
253
|
}
|
|
@@ -468,7 +449,7 @@ bool ComponentView::CapturePointer(const winrt::Microsoft::ReactNative::Composit
|
|
|
468
449
|
if (!root)
|
|
469
450
|
return false;
|
|
470
451
|
|
|
471
|
-
auto rootView{
|
|
452
|
+
auto rootView{root->ReactNativeIsland()};
|
|
472
453
|
if (!rootView) {
|
|
473
454
|
return false;
|
|
474
455
|
}
|
|
@@ -487,7 +468,7 @@ void ComponentView::ReleasePointerCapture(
|
|
|
487
468
|
if (!root)
|
|
488
469
|
return;
|
|
489
470
|
|
|
490
|
-
auto rootView{
|
|
471
|
+
auto rootView{root->ReactNativeIsland()};
|
|
491
472
|
if (!rootView) {
|
|
492
473
|
return;
|
|
493
474
|
}
|
|
@@ -535,7 +516,33 @@ winrt::Microsoft::ReactNative::Composition::Experimental::IVisual ComponentView:
|
|
|
535
516
|
return m_outerVisual ? m_outerVisual : Visual();
|
|
536
517
|
}
|
|
537
518
|
|
|
538
|
-
|
|
519
|
+
// If the focus visual would extend past the bounds of the hosting visual,
|
|
520
|
+
// then we will nudge the focus visual back inside the hosting visuals bounds.
|
|
521
|
+
facebook::react::RectangleEdges<bool> ComponentView::focusNudges() const noexcept {
|
|
522
|
+
facebook::react::RectangleEdges<bool> nudgeEdges;
|
|
523
|
+
|
|
524
|
+
// Always use outer focus metrics to determine if we need to nudge the focus rect over to fit
|
|
525
|
+
facebook::react::LayoutMetrics layoutMetrics = focusLayoutMetricsNoNudge(false /*inner*/);
|
|
526
|
+
|
|
527
|
+
Assert(m_componentHostingFocusVisual);
|
|
528
|
+
|
|
529
|
+
if (layoutMetrics.frame.origin.x < 0) {
|
|
530
|
+
nudgeEdges.left = true;
|
|
531
|
+
}
|
|
532
|
+
if (layoutMetrics.frame.origin.y < 0) {
|
|
533
|
+
nudgeEdges.top = true;
|
|
534
|
+
}
|
|
535
|
+
if (layoutMetrics.frame.getMaxX() > m_componentHostingFocusVisual->m_layoutMetrics.frame.getMaxX()) {
|
|
536
|
+
nudgeEdges.right = true;
|
|
537
|
+
}
|
|
538
|
+
if (layoutMetrics.frame.getMaxY() > m_componentHostingFocusVisual->m_layoutMetrics.frame.getMaxY()) {
|
|
539
|
+
nudgeEdges.bottom = true;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
return nudgeEdges;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
facebook::react::LayoutMetrics ComponentView::focusLayoutMetricsNoNudge(bool inner) const noexcept {
|
|
539
546
|
facebook::react::LayoutMetrics layoutMetrics = m_layoutMetrics;
|
|
540
547
|
layoutMetrics.frame.origin.x -= FOCUS_VISUAL_WIDTH * (inner ? 1 : 2);
|
|
541
548
|
layoutMetrics.frame.origin.y -= FOCUS_VISUAL_WIDTH * (inner ? 1 : 2);
|
|
@@ -544,6 +551,28 @@ facebook::react::LayoutMetrics ComponentView::focusLayoutMetrics(bool inner) con
|
|
|
544
551
|
return layoutMetrics;
|
|
545
552
|
}
|
|
546
553
|
|
|
554
|
+
facebook::react::LayoutMetrics ComponentView::focusLayoutMetrics(bool inner) const noexcept {
|
|
555
|
+
auto nudgeEdges = focusNudges();
|
|
556
|
+
auto layoutMetrics = focusLayoutMetricsNoNudge(inner);
|
|
557
|
+
|
|
558
|
+
if (nudgeEdges.left) {
|
|
559
|
+
layoutMetrics.frame.origin.x += FOCUS_VISUAL_WIDTH * 2;
|
|
560
|
+
layoutMetrics.frame.size.width -= FOCUS_VISUAL_WIDTH * 2;
|
|
561
|
+
}
|
|
562
|
+
if (nudgeEdges.top) {
|
|
563
|
+
layoutMetrics.frame.origin.y += FOCUS_VISUAL_WIDTH * 2;
|
|
564
|
+
layoutMetrics.frame.size.height -= FOCUS_VISUAL_WIDTH * 2;
|
|
565
|
+
}
|
|
566
|
+
if (nudgeEdges.right) {
|
|
567
|
+
layoutMetrics.frame.size.width -= FOCUS_VISUAL_WIDTH * 2;
|
|
568
|
+
}
|
|
569
|
+
if (nudgeEdges.bottom) {
|
|
570
|
+
layoutMetrics.frame.size.height -= FOCUS_VISUAL_WIDTH * 2;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
return layoutMetrics;
|
|
574
|
+
}
|
|
575
|
+
|
|
547
576
|
facebook::react::BorderMetrics ComponentView::focusBorderMetrics(
|
|
548
577
|
bool inner,
|
|
549
578
|
const facebook::react::LayoutMetrics &layoutMetrics) const noexcept {
|
|
@@ -553,22 +582,31 @@ facebook::react::BorderMetrics ComponentView::focusBorderMetrics(
|
|
|
553
582
|
innerColor.m_platformColor.push_back(inner ? "FocusVisualSecondary" : "FocusVisualPrimary");
|
|
554
583
|
metrics.borderColors.bottom = metrics.borderColors.left = metrics.borderColors.right = metrics.borderColors.top =
|
|
555
584
|
innerColor;
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
585
|
+
|
|
586
|
+
metrics.borderRadii.bottomLeft.horizontal =
|
|
587
|
+
(metrics.borderRadii.bottomLeft.horizontal ? metrics.borderRadii.bottomLeft.horizontal : FOCUS_VISUAL_RADIUS) +
|
|
588
|
+
FOCUS_VISUAL_WIDTH * (inner ? 1 : 2);
|
|
589
|
+
metrics.borderRadii.bottomLeft.vertical =
|
|
590
|
+
(metrics.borderRadii.bottomLeft.vertical ? metrics.borderRadii.bottomLeft.vertical : FOCUS_VISUAL_RADIUS) +
|
|
591
|
+
FOCUS_VISUAL_WIDTH * (inner ? 1 : 2);
|
|
592
|
+
metrics.borderRadii.bottomRight.horizontal =
|
|
593
|
+
(metrics.borderRadii.bottomRight.horizontal ? metrics.borderRadii.bottomRight.horizontal : FOCUS_VISUAL_RADIUS) +
|
|
594
|
+
FOCUS_VISUAL_WIDTH * (inner ? 1 : 2);
|
|
595
|
+
metrics.borderRadii.bottomRight.vertical =
|
|
596
|
+
(metrics.borderRadii.bottomRight.vertical ? metrics.borderRadii.bottomRight.vertical : FOCUS_VISUAL_RADIUS) +
|
|
597
|
+
FOCUS_VISUAL_WIDTH * (inner ? 1 : 2);
|
|
598
|
+
metrics.borderRadii.topLeft.horizontal =
|
|
599
|
+
(metrics.borderRadii.topLeft.horizontal ? metrics.borderRadii.topLeft.horizontal : FOCUS_VISUAL_RADIUS) +
|
|
600
|
+
FOCUS_VISUAL_WIDTH * (inner ? 1 : 2);
|
|
601
|
+
metrics.borderRadii.topLeft.vertical =
|
|
602
|
+
(metrics.borderRadii.topLeft.vertical ? metrics.borderRadii.topLeft.vertical : FOCUS_VISUAL_RADIUS) +
|
|
603
|
+
FOCUS_VISUAL_WIDTH * (inner ? 1 : 2);
|
|
604
|
+
metrics.borderRadii.topRight.horizontal =
|
|
605
|
+
(metrics.borderRadii.topRight.horizontal ? metrics.borderRadii.topRight.horizontal : FOCUS_VISUAL_RADIUS) +
|
|
606
|
+
FOCUS_VISUAL_WIDTH * (inner ? 1 : 2);
|
|
607
|
+
metrics.borderRadii.topRight.vertical =
|
|
608
|
+
(metrics.borderRadii.topRight.vertical ? metrics.borderRadii.topRight.vertical : FOCUS_VISUAL_RADIUS) +
|
|
609
|
+
FOCUS_VISUAL_WIDTH * (inner ? 1 : 2);
|
|
572
610
|
|
|
573
611
|
metrics.borderStyles.bottom = metrics.borderStyles.left = metrics.borderStyles.right = metrics.borderStyles.top =
|
|
574
612
|
facebook::react::BorderStyle::Solid;
|
|
@@ -761,11 +799,23 @@ void ComponentView::updateAccessibilityProps(
|
|
|
761
799
|
UIA_LiveSettingPropertyId,
|
|
762
800
|
oldViewProps.accessibilityLiveRegion,
|
|
763
801
|
newViewProps.accessibilityLiveRegion);
|
|
802
|
+
|
|
803
|
+
if ((oldViewProps.accessibilityState.has_value() && oldViewProps.accessibilityState->selected.has_value()) !=
|
|
804
|
+
((newViewProps.accessibilityState.has_value() && newViewProps.accessibilityState->selected.has_value()))) {
|
|
805
|
+
auto compProvider =
|
|
806
|
+
m_uiaProvider.try_as<winrt::Microsoft::ReactNative::implementation::CompositionDynamicAutomationProvider>();
|
|
807
|
+
if (compProvider) {
|
|
808
|
+
if ((newViewProps.accessibilityState.has_value() && newViewProps.accessibilityState->selected.has_value())) {
|
|
809
|
+
winrt::Microsoft::ReactNative::implementation::AddSelectionItemsToContainer(compProvider.get());
|
|
810
|
+
} else {
|
|
811
|
+
winrt::Microsoft::ReactNative::implementation::RemoveSelectionItemsFromContainer(compProvider.get());
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
}
|
|
764
815
|
}
|
|
765
816
|
|
|
766
817
|
std::optional<std::string> ComponentView::getAccessiblityValue() noexcept {
|
|
767
|
-
return
|
|
768
|
-
std::static_pointer_cast<const facebook::react::ViewProps>(props())->accessibilityValue);
|
|
818
|
+
return std::static_pointer_cast<const facebook::react::ViewProps>(props())->accessibilityValue.text.value();
|
|
769
819
|
}
|
|
770
820
|
|
|
771
821
|
void ComponentView::setAcccessiblityValue(std::string &&value) noexcept {
|
|
@@ -1318,7 +1368,7 @@ winrt::Microsoft::ReactNative::ComponentView lastDeepChild(
|
|
|
1318
1368
|
}
|
|
1319
1369
|
|
|
1320
1370
|
// Walks the tree calling the function fn on each node.
|
|
1321
|
-
// If fn returns true, then walkTree stops
|
|
1371
|
+
// If fn returns true, then walkTree stops iterating over the tree, and returns true.
|
|
1322
1372
|
// If the tree walk completes without fn returning true, then walkTree returns false.
|
|
1323
1373
|
bool walkTree(
|
|
1324
1374
|
const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
@@ -143,6 +143,8 @@ struct ComponentView : public ComponentViewT<
|
|
|
143
143
|
void FinalizeTransform(
|
|
144
144
|
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
145
145
|
const facebook::react::ViewProps &viewProps) noexcept;
|
|
146
|
+
facebook::react::RectangleEdges<bool> focusNudges() const noexcept;
|
|
147
|
+
facebook::react::LayoutMetrics focusLayoutMetricsNoNudge(bool inner) const noexcept;
|
|
146
148
|
facebook::react::LayoutMetrics focusLayoutMetrics(bool inner) const noexcept;
|
|
147
149
|
facebook::react::BorderMetrics focusBorderMetrics(bool inner, const facebook::react::LayoutMetrics &layoutMetrics)
|
|
148
150
|
const noexcept;
|