react-native-windows 0.77.3 → 0.77.4
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 +3 -0
- package/Libraries/Components/Pressable/Pressable.windows.js +3 -0
- package/Libraries/Components/TextInput/TextInput.windows.js +3 -0
- package/Libraries/Components/Touchable/TouchableBounce.windows.js +2 -0
- package/Libraries/Components/Touchable/TouchableNativeFeedback.windows.js +2 -0
- package/Libraries/Components/Touchable/TouchableOpacity.windows.js +2 -0
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +2 -0
- package/Libraries/Components/View/View.windows.js +3 -0
- package/Libraries/Components/View/ViewAccessibility.d.ts +7 -2
- package/Libraries/Components/View/ViewAccessibility.windows.js +1 -0
- package/Libraries/Components/View/ViewPropTypes.windows.js +1 -0
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Core/setUpDeveloperTools.js +2 -3
- package/Libraries/Image/Image.windows.js +2 -0
- package/Libraries/Text/Text.windows.js +4 -0
- package/Libraries/Text/TextProps.windows.js +1 -0
- package/Libraries/Utilities/HMRClient.js +0 -28
- package/Libraries/Utilities/HMRClientProdShim.js +0 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +215 -21
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +10 -0
- 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 +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +14 -10
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +3 -2
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +1 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/accessibilityPropsConversions.h +4 -0
- package/Shared/Networking/WinRTWebSocketResource.cpp +369 -7
- package/Shared/Networking/WinRTWebSocketResource.h +118 -0
- package/Shared/Shared.vcxitems +6 -0
- package/Shared/Shared.vcxitems.filters +8 -0
- package/package.json +9 -9
|
@@ -16,6 +16,7 @@ class CompositionDynamicAutomationProvider : public winrt::implements<
|
|
|
16
16
|
IInvokeProvider,
|
|
17
17
|
IScrollItemProvider,
|
|
18
18
|
IValueProvider,
|
|
19
|
+
IRangeValueProvider,
|
|
19
20
|
IToggleProvider,
|
|
20
21
|
IExpandCollapseProvider,
|
|
21
22
|
ISelectionProvider,
|
|
@@ -50,6 +51,14 @@ class CompositionDynamicAutomationProvider : public winrt::implements<
|
|
|
50
51
|
virtual HRESULT __stdcall get_Value(BSTR *pRetVal) override;
|
|
51
52
|
virtual HRESULT __stdcall get_IsReadOnly(BOOL *pRetVal) override;
|
|
52
53
|
|
|
54
|
+
// inherited via IRangeValueProvider
|
|
55
|
+
virtual HRESULT __stdcall get_LargeChange(double *pRetVal) override;
|
|
56
|
+
virtual HRESULT __stdcall get_Maximum(double *pRetVal) override;
|
|
57
|
+
virtual HRESULT __stdcall get_Minimum(double *pRetVal) override;
|
|
58
|
+
virtual HRESULT __stdcall get_SmallChange(double *pRetVal) override;
|
|
59
|
+
virtual HRESULT __stdcall get_Value(double *pRetVal) override;
|
|
60
|
+
virtual HRESULT __stdcall SetValue(double val) override;
|
|
61
|
+
|
|
53
62
|
// inherited via IToggleProvider
|
|
54
63
|
virtual HRESULT __stdcall get_ToggleState(ToggleState *pRetVal) override;
|
|
55
64
|
virtual HRESULT __stdcall Toggle() override;
|
|
@@ -76,6 +85,7 @@ class CompositionDynamicAutomationProvider : public winrt::implements<
|
|
|
76
85
|
|
|
77
86
|
private:
|
|
78
87
|
::Microsoft::ReactNative::ReactTaggedView m_view;
|
|
88
|
+
winrt::com_ptr<ITextProvider2> m_textProvider;
|
|
79
89
|
std::vector<winrt::com_ptr<IRawElementProviderSimple>> m_selectionItems;
|
|
80
90
|
};
|
|
81
91
|
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
#include "pch.h"
|
|
2
|
+
#include <Fabric/ComponentView.h>
|
|
3
|
+
#include <Fabric/Composition/ParagraphComponentView.h>
|
|
4
|
+
#include <Fabric/Composition/TextInput/WindowsTextInputComponentView.h>
|
|
5
|
+
#include <Unicode.h>
|
|
6
|
+
#include "CompositionTextRangeProvider.h"
|
|
7
|
+
#include "RootComponentView.h"
|
|
8
|
+
#include "UiaHelpers.h"
|
|
9
|
+
|
|
10
|
+
namespace winrt::Microsoft::ReactNative::implementation {
|
|
11
|
+
|
|
12
|
+
CompositionTextProvider::CompositionTextProvider(
|
|
13
|
+
const winrt::Microsoft::ReactNative::Composition::ComponentView &componentView,
|
|
14
|
+
CompositionDynamicAutomationProvider *parentProvider) noexcept
|
|
15
|
+
: m_view{componentView} {
|
|
16
|
+
m_parentProvider.copy_from(parentProvider);
|
|
17
|
+
EnsureTextRangeProvider();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
void CompositionTextProvider::EnsureTextRangeProvider() {
|
|
21
|
+
auto strongView = m_view.view();
|
|
22
|
+
|
|
23
|
+
if (!strongView)
|
|
24
|
+
return;
|
|
25
|
+
|
|
26
|
+
if (!m_textRangeProvider) {
|
|
27
|
+
m_textRangeProvider =
|
|
28
|
+
winrt::make<CompositionTextRangeProvider>(
|
|
29
|
+
strongView.as<winrt::Microsoft::ReactNative::Composition::ComponentView>(), m_parentProvider.get())
|
|
30
|
+
.try_as<ITextRangeProvider>();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
HRESULT __stdcall CompositionTextProvider::get_DocumentRange(ITextRangeProvider **pRetVal) {
|
|
35
|
+
if (pRetVal == nullptr)
|
|
36
|
+
return E_POINTER;
|
|
37
|
+
auto strongView = m_view.view();
|
|
38
|
+
|
|
39
|
+
if (!strongView)
|
|
40
|
+
return UIA_E_ELEMENTNOTAVAILABLE;
|
|
41
|
+
|
|
42
|
+
if (m_textRangeProvider == nullptr)
|
|
43
|
+
return UIA_E_ELEMENTNOTAVAILABLE;
|
|
44
|
+
|
|
45
|
+
m_textRangeProvider.copy_to(pRetVal);
|
|
46
|
+
return S_OK;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
HRESULT __stdcall CompositionTextProvider::get_SupportedTextSelection(SupportedTextSelection *pRetVal) {
|
|
50
|
+
if (pRetVal == nullptr)
|
|
51
|
+
return E_POINTER;
|
|
52
|
+
auto strongView = m_view.view();
|
|
53
|
+
|
|
54
|
+
if (!strongView)
|
|
55
|
+
return UIA_E_ELEMENTNOTAVAILABLE;
|
|
56
|
+
|
|
57
|
+
if (strongView.try_as<winrt::Microsoft::ReactNative::Composition::implementation::WindowsTextInputComponentView>()) {
|
|
58
|
+
*pRetVal = SupportedTextSelection_Single;
|
|
59
|
+
} else if (
|
|
60
|
+
auto textView =
|
|
61
|
+
strongView.try_as<winrt::Microsoft::ReactNative::Composition::implementation::ParagraphComponentView>()) {
|
|
62
|
+
auto props = std::static_pointer_cast<const facebook::react::ParagraphProps>(textView->props());
|
|
63
|
+
if (props == nullptr)
|
|
64
|
+
return UIA_E_ELEMENTNOTAVAILABLE;
|
|
65
|
+
*pRetVal = props->isSelectable ? SupportedTextSelection_Single : SupportedTextSelection_None;
|
|
66
|
+
} else {
|
|
67
|
+
*pRetVal = SupportedTextSelection_None;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return S_OK;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
HRESULT __stdcall CompositionTextProvider::GetSelection(SAFEARRAY **pRetVal) {
|
|
74
|
+
// no-op
|
|
75
|
+
*pRetVal = SafeArrayCreateVector(VT_UNKNOWN, 0, 0);
|
|
76
|
+
return S_OK;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
HRESULT __stdcall CompositionTextProvider::GetVisibleRanges(SAFEARRAY **pRetVal) {
|
|
80
|
+
*pRetVal = SafeArrayCreateVector(VT_UNKNOWN, 0, 1);
|
|
81
|
+
if (m_textRangeProvider == nullptr)
|
|
82
|
+
return UIA_E_ELEMENTNOTAVAILABLE;
|
|
83
|
+
LONG pos = 0;
|
|
84
|
+
return SafeArrayPutElement(*pRetVal, &pos, m_textRangeProvider.get());
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
HRESULT __stdcall CompositionTextProvider::RangeFromChild(
|
|
88
|
+
IRawElementProviderSimple *childElement,
|
|
89
|
+
ITextRangeProvider **pRetVal) {
|
|
90
|
+
// no-op
|
|
91
|
+
*pRetVal = nullptr;
|
|
92
|
+
return S_OK;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
HRESULT __stdcall CompositionTextProvider::RangeFromPoint(UiaPoint point, ITextRangeProvider **pRetVal) {
|
|
96
|
+
// no-op
|
|
97
|
+
if (m_textRangeProvider == nullptr)
|
|
98
|
+
return UIA_E_ELEMENTNOTAVAILABLE;
|
|
99
|
+
m_textRangeProvider.copy_to(pRetVal);
|
|
100
|
+
return S_OK;
|
|
101
|
+
}
|
|
102
|
+
HRESULT __stdcall CompositionTextProvider::GetCaretRange(BOOL *isActive, ITextRangeProvider **pRetVal) {
|
|
103
|
+
// no-op
|
|
104
|
+
*pRetVal = nullptr;
|
|
105
|
+
return S_OK;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
HRESULT __stdcall CompositionTextProvider::RangeFromAnnotation(
|
|
109
|
+
IRawElementProviderSimple *annotationElement,
|
|
110
|
+
ITextRangeProvider **pRetVal) {
|
|
111
|
+
// no-op
|
|
112
|
+
*pRetVal = nullptr;
|
|
113
|
+
return S_OK;
|
|
114
|
+
}
|
|
115
|
+
} // namespace winrt::Microsoft::ReactNative::implementation
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <Fabric/Composition/CompositionDynamicAutomationProvider.h>
|
|
4
|
+
#include <Fabric/Composition/CompositionViewComponentView.h>
|
|
5
|
+
#include <Fabric/ReactTaggedView.h>
|
|
6
|
+
#include <UIAutomation.h>
|
|
7
|
+
#include <inspectable.h>
|
|
8
|
+
#include <uiautomationcore.h>
|
|
9
|
+
|
|
10
|
+
namespace winrt::Microsoft::ReactNative::implementation {
|
|
11
|
+
|
|
12
|
+
class CompositionTextProvider : public winrt::implements<CompositionTextProvider, ITextProvider, ITextProvider2> {
|
|
13
|
+
public:
|
|
14
|
+
CompositionTextProvider(
|
|
15
|
+
const winrt::Microsoft::ReactNative::Composition::ComponentView &componentView,
|
|
16
|
+
CompositionDynamicAutomationProvider *parentProvider) noexcept;
|
|
17
|
+
|
|
18
|
+
// inherited via ITextProvider
|
|
19
|
+
virtual HRESULT __stdcall get_DocumentRange(ITextRangeProvider **pRetVal) override;
|
|
20
|
+
virtual HRESULT __stdcall get_SupportedTextSelection(SupportedTextSelection *pRetVal) override;
|
|
21
|
+
virtual HRESULT __stdcall GetSelection(SAFEARRAY **pRetVal) override;
|
|
22
|
+
virtual HRESULT __stdcall GetVisibleRanges(SAFEARRAY **pRetVal) override;
|
|
23
|
+
virtual HRESULT __stdcall RangeFromChild(IRawElementProviderSimple *childElement, ITextRangeProvider **pRetVal)
|
|
24
|
+
override;
|
|
25
|
+
virtual HRESULT __stdcall RangeFromPoint(UiaPoint point, ITextRangeProvider **pRetVal) override;
|
|
26
|
+
|
|
27
|
+
// inherited via ITextProvider2
|
|
28
|
+
virtual HRESULT __stdcall GetCaretRange(BOOL *isActive, ITextRangeProvider **pRetVal) override;
|
|
29
|
+
virtual HRESULT __stdcall RangeFromAnnotation(
|
|
30
|
+
IRawElementProviderSimple *annotationElement,
|
|
31
|
+
ITextRangeProvider **pRetVal) override;
|
|
32
|
+
|
|
33
|
+
void EnsureTextRangeProvider();
|
|
34
|
+
|
|
35
|
+
private:
|
|
36
|
+
::Microsoft::ReactNative::ReactTaggedView m_view;
|
|
37
|
+
winrt::com_ptr<ITextRangeProvider> m_textRangeProvider;
|
|
38
|
+
winrt::com_ptr<CompositionDynamicAutomationProvider> m_parentProvider;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
} // namespace winrt::Microsoft::ReactNative::implementation
|
|
@@ -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
|
|
@@ -777,8 +777,7 @@ void ComponentView::updateAccessibilityProps(
|
|
|
777
777
|
}
|
|
778
778
|
|
|
779
779
|
std::optional<std::string> ComponentView::getAccessiblityValue() noexcept {
|
|
780
|
-
return
|
|
781
|
-
std::static_pointer_cast<const facebook::react::ViewProps>(props())->accessibilityValue);
|
|
780
|
+
return std::static_pointer_cast<const facebook::react::ViewProps>(props())->accessibilityValue.text.value();
|
|
782
781
|
}
|
|
783
782
|
|
|
784
783
|
void ComponentView::setAcccessiblityValue(std::string &&value) noexcept {
|
|
@@ -174,16 +174,6 @@ long GetLiveSetting(const std::string &liveRegion) noexcept {
|
|
|
174
174
|
return LiveSetting::Off;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
std::string extractAccessibilityValue(const facebook::react::AccessibilityValue &value) noexcept {
|
|
178
|
-
if (value.now.has_value()) {
|
|
179
|
-
return std::to_string(value.now.value());
|
|
180
|
-
} else if (value.text.has_value()) {
|
|
181
|
-
return value.text.value();
|
|
182
|
-
} else {
|
|
183
|
-
return "";
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
177
|
void DispatchAccessibilityAction(::Microsoft::ReactNative::ReactTaggedView &view, const std::string &action) noexcept {
|
|
188
178
|
auto strongView = view.view();
|
|
189
179
|
|
|
@@ -249,4 +239,18 @@ ToggleState GetToggleState(const std::optional<facebook::react::AccessibilitySta
|
|
|
249
239
|
return ToggleState::ToggleState_Off;
|
|
250
240
|
}
|
|
251
241
|
|
|
242
|
+
TextDecorationLineStyle GetTextDecorationLineStyle(facebook::react::TextDecorationStyle style) noexcept {
|
|
243
|
+
if (style == facebook::react::TextDecorationStyle::Dashed) {
|
|
244
|
+
return TextDecorationLineStyle_Dash;
|
|
245
|
+
} else if (style == facebook::react::TextDecorationStyle::Dotted) {
|
|
246
|
+
return TextDecorationLineStyle_Dot;
|
|
247
|
+
} else if (style == facebook::react::TextDecorationStyle::Double) {
|
|
248
|
+
return TextDecorationLineStyle_Double;
|
|
249
|
+
} else if (style == facebook::react::TextDecorationStyle::Solid) {
|
|
250
|
+
return TextDecorationLineStyle_Single;
|
|
251
|
+
} else {
|
|
252
|
+
return TextDecorationLineStyle_Single;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
252
256
|
} // namespace winrt::Microsoft::ReactNative::implementation
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
#include <Fabric/ComponentView.h>
|
|
4
4
|
#include <Fabric/Composition/CompositionDynamicAutomationProvider.h>
|
|
5
|
+
#include <Fabric/Composition/ParagraphComponentView.h>
|
|
5
6
|
#include <Fabric/ReactTaggedView.h>
|
|
6
7
|
#include <UIAutomation.h>
|
|
7
8
|
|
|
@@ -32,8 +33,6 @@ void UpdateUiaProperty(
|
|
|
32
33
|
|
|
33
34
|
long GetLiveSetting(const std::string &liveRegion) noexcept;
|
|
34
35
|
|
|
35
|
-
std::string extractAccessibilityValue(const facebook::react::AccessibilityValue &value) noexcept;
|
|
36
|
-
|
|
37
36
|
void DispatchAccessibilityAction(::Microsoft::ReactNative::ReactTaggedView &view, const std::string &action) noexcept;
|
|
38
37
|
|
|
39
38
|
ExpandCollapseState GetExpandCollapseState(const bool &expanded) noexcept;
|
|
@@ -43,4 +42,6 @@ void AddSelectionItemsToContainer(CompositionDynamicAutomationProvider *provider
|
|
|
43
42
|
void RemoveSelectionItemsFromContainer(CompositionDynamicAutomationProvider *provider) noexcept;
|
|
44
43
|
|
|
45
44
|
ToggleState GetToggleState(const std::optional<facebook::react::AccessibilityState> &state) noexcept;
|
|
45
|
+
|
|
46
|
+
TextDecorationLineStyle GetTextDecorationLineStyle(facebook::react::TextDecorationStyle style) noexcept;
|
|
46
47
|
} // namespace winrt::Microsoft::ReactNative::implementation
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.77.
|
|
13
|
+
<ReactNativeWindowsVersion>0.77.4</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>77</ReactNativeWindowsMinor>
|
|
16
|
-
<ReactNativeWindowsPatch>
|
|
16
|
+
<ReactNativeWindowsPatch>4</ReactNativeWindowsPatch>
|
|
17
17
|
<ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
|
|
18
|
-
<ReactNativeWindowsCommitId>
|
|
18
|
+
<ReactNativeWindowsCommitId>657f0d9a8915223e83f1ef043045b0da2f049af3</ReactNativeWindowsCommitId>
|
|
19
19
|
</PropertyGroup>
|
|
20
20
|
</Project>
|
|
@@ -70,6 +70,7 @@ struct AccessibilityState {
|
|
|
70
70
|
std::optional<bool> selected{std::nullopt}; // [Windows] - Do not remove; required for Windows ISelectionItemProvider Implementation
|
|
71
71
|
bool busy{false};
|
|
72
72
|
std::optional<bool> expanded{std::nullopt};
|
|
73
|
+
std::optional<bool> readOnly{std::nullopt}; // [Windows] - Do not remove; required for Windows IRangeValueProvider and IValueProvider Implementation
|
|
73
74
|
std::optional<bool> multiselectable{std::nullopt}; // [Windows] - Do not remove; required for Windows ISelectionProvider Implementation
|
|
74
75
|
std::optional<bool> required{std::nullopt}; // [Windows] - Do not remove; required for Windows ISelectionProvider Implementation
|
|
75
76
|
enum { Unchecked, Checked, Mixed, None } checked{None};
|
|
@@ -171,6 +171,10 @@ inline void fromRawValue(
|
|
|
171
171
|
fromRawValue(context, expanded->second, result.expanded);
|
|
172
172
|
}
|
|
173
173
|
// [Windows] - DO NOT REMOVE - required for Windows ISelectionProvider Implementation
|
|
174
|
+
auto readOnly = map.find("readOnly");
|
|
175
|
+
if (readOnly != map.end()) {
|
|
176
|
+
fromRawValue(context, readOnly->second, result.readOnly);
|
|
177
|
+
}
|
|
174
178
|
auto multiselectable = map.find("multiselectable");
|
|
175
179
|
if (multiselectable != map.end()) {
|
|
176
180
|
fromRawValue(context, multiselectable->second, result.multiselectable);
|