Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 7456610

Browse files
License
1 parent 0564682 commit 7456610

11 files changed

+87
-44
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3197,6 +3197,7 @@ FILE: ../../../flutter/shell/platform/windows/windows_proc_table.cc
31973197
FILE: ../../../flutter/shell/platform/windows/windows_proc_table.h
31983198
FILE: ../../../flutter/shell/platform/windows/windows_registry.cc
31993199
FILE: ../../../flutter/shell/platform/windows/windows_registry.h
3200+
FILE: ../../../flutter/shell/platform/windows/windowsx_shim.h
32003201
FILE: ../../../flutter/shell/profiling/sampling_profiler.cc
32013202
FILE: ../../../flutter/shell/profiling/sampling_profiler.h
32023203
FILE: ../../../flutter/shell/profiling/sampling_profiler_unittest.cc

shell/platform/common/flutter_platform_node_delegate.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ class FlutterPlatformNodeDelegate : public ui::AXPlatformNodeDelegateBase {
143143
/// platform node delegate. This pointer is only safe in the
144144
/// platform thread.
145145
std::weak_ptr<OwnerBridge> GetOwnerBridge() const;
146+
146147
private:
147148
ui::AXNode* ax_node_;
148149
std::weak_ptr<OwnerBridge> bridge_;

shell/platform/windows/accessibility_bridge_windows.cc

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,16 @@ void AccessibilityBridgeWindows::OnAccessibilityEvent(
3434
DispatchWinAccessibilityEvent(win_delegate, ax::mojom::Event::kAlert);
3535
break;
3636
case ui::AXEventGenerator::Event::CHECKED_STATE_CHANGED:
37-
DispatchWinAccessibilityEvent(win_delegate, ax::mojom::Event::kValueChanged);
37+
DispatchWinAccessibilityEvent(win_delegate,
38+
ax::mojom::Event::kValueChanged);
3839
break;
3940
case ui::AXEventGenerator::Event::CHILDREN_CHANGED:
40-
DispatchWinAccessibilityEvent(win_delegate, ax::mojom::Event::kChildrenChanged);
41+
DispatchWinAccessibilityEvent(win_delegate,
42+
ax::mojom::Event::kChildrenChanged);
4143
break;
4244
case ui::AXEventGenerator::Event::DOCUMENT_SELECTION_CHANGED:
43-
DispatchWinAccessibilityEvent(win_delegate, ax::mojom::Event::kDocumentSelectionChanged);
45+
DispatchWinAccessibilityEvent(
46+
win_delegate, ax::mojom::Event::kDocumentSelectionChanged);
4447
break;
4548
case ui::AXEventGenerator::Event::FOCUS_CHANGED:
4649
DispatchWinAccessibilityEvent(win_delegate, ax::mojom::Event::kFocus);
@@ -52,35 +55,43 @@ void AccessibilityBridgeWindows::OnAccessibilityEvent(
5255
}
5356
break;
5457
case ui::AXEventGenerator::Event::IMAGE_ANNOTATION_CHANGED:
55-
DispatchWinAccessibilityEvent(win_delegate, ax::mojom::Event::kTextChanged);
58+
DispatchWinAccessibilityEvent(win_delegate,
59+
ax::mojom::Event::kTextChanged);
5660
break;
5761
case ui::AXEventGenerator::Event::LIVE_REGION_CHANGED:
5862
DispatchWinAccessibilityEvent(win_delegate,
5963
ax::mojom::Event::kLiveRegionChanged);
6064
break;
6165
case ui::AXEventGenerator::Event::NAME_CHANGED:
62-
DispatchWinAccessibilityEvent(win_delegate, ax::mojom::Event::kTextChanged);
66+
DispatchWinAccessibilityEvent(win_delegate,
67+
ax::mojom::Event::kTextChanged);
6368
break;
6469
case ui::AXEventGenerator::Event::SCROLL_HORIZONTAL_POSITION_CHANGED:
65-
DispatchWinAccessibilityEvent(win_delegate, ax::mojom::Event::kScrollPositionChanged);
70+
DispatchWinAccessibilityEvent(win_delegate,
71+
ax::mojom::Event::kScrollPositionChanged);
6672
break;
6773
case ui::AXEventGenerator::Event::SCROLL_VERTICAL_POSITION_CHANGED:
68-
DispatchWinAccessibilityEvent(win_delegate, ax::mojom::Event::kScrollPositionChanged);
74+
DispatchWinAccessibilityEvent(win_delegate,
75+
ax::mojom::Event::kScrollPositionChanged);
6976
break;
7077
case ui::AXEventGenerator::Event::SELECTED_CHANGED:
71-
DispatchWinAccessibilityEvent(win_delegate, ax::mojom::Event::kValueChanged);
78+
DispatchWinAccessibilityEvent(win_delegate,
79+
ax::mojom::Event::kValueChanged);
7280
break;
7381
case ui::AXEventGenerator::Event::SELECTED_CHILDREN_CHANGED:
74-
DispatchWinAccessibilityEvent(win_delegate, ax::mojom::Event::kSelectedChildrenChanged);
82+
DispatchWinAccessibilityEvent(win_delegate,
83+
ax::mojom::Event::kSelectedChildrenChanged);
7584
break;
7685
case ui::AXEventGenerator::Event::SUBTREE_CREATED:
7786
DispatchWinAccessibilityEvent(win_delegate, ax::mojom::Event::kShow);
7887
break;
7988
case ui::AXEventGenerator::Event::VALUE_CHANGED:
80-
DispatchWinAccessibilityEvent(win_delegate, ax::mojom::Event::kValueChanged);
89+
DispatchWinAccessibilityEvent(win_delegate,
90+
ax::mojom::Event::kValueChanged);
8191
break;
8292
case ui::AXEventGenerator::Event::WIN_IACCESSIBLE_STATE_CHANGED:
83-
DispatchWinAccessibilityEvent(win_delegate, ax::mojom::Event::kStateChanged);
93+
DispatchWinAccessibilityEvent(win_delegate,
94+
ax::mojom::Event::kStateChanged);
8495
break;
8596
case ui::AXEventGenerator::Event::ACCESS_KEY_CHANGED:
8697
case ui::AXEventGenerator::Event::ACTIVE_DESCENDANT_CHANGED:

shell/platform/windows/accessibility_bridge_windows_unittests.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@ TEST(AccessibilityBridgeWindows, OnAccessibilityEventFocusChanged) {
270270
ax::mojom::EventFrom::kNone,
271271
{}}});
272272
ASSERT_EQ(bridge->dispatched_events().size(), 1);
273-
EXPECT_EQ(bridge->dispatched_events()[0].event_type, ax::mojom::Event::kFocus);
273+
EXPECT_EQ(bridge->dispatched_events()[0].event_type,
274+
ax::mojom::Event::kFocus);
274275

275276
ASSERT_EQ(bridge->focused_nodes().size(), 1);
276277
EXPECT_EQ(bridge->focused_nodes()[0], 1);

shell/platform/windows/flutter_platform_node_delegate_windows.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ void FlutterPlatformNodeDelegateWindows::SetFocus() {
102102
GetNativeViewAccessible()->accSelect(SELFLAG_TAKEFOCUS, varchild);
103103
}
104104

105-
gfx::AcceleratedWidget FlutterPlatformNodeDelegateWindows::GetTargetForNativeAccessibilityEvent() {
105+
gfx::AcceleratedWidget
106+
FlutterPlatformNodeDelegateWindows::GetTargetForNativeAccessibilityEvent() {
106107
return view_->GetPlatformWindow();
107108
}
108109

shell/platform/windows/flutter_windows_view_unittests.cc

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
#include "flutter/shell/platform/windows/flutter_windows_view.h"
66

7+
#include <UIAutomation.h>
78
#include <comdef.h>
89
#include <comutil.h>
910
#include <oleacc.h>
10-
#include <UIAutomation.h>
1111

1212
#include <future>
1313
#include <iostream>
@@ -247,14 +247,16 @@ TEST(FlutterWindowsView, AddSemanticsNodeUpdate) {
247247

248248
// Verify value property matches our label.
249249
VARIANT varvalue{};
250-
ASSERT_EQ(uia_view->GetPropertyValue(UIA_ValueValuePropertyId, &varvalue), S_OK);
250+
ASSERT_EQ(uia_view->GetPropertyValue(UIA_ValueValuePropertyId, &varvalue),
251+
S_OK);
251252
EXPECT_EQ(varvalue.vt, VT_BSTR);
252253
value = _com_util::ConvertBSTRToString(varvalue.bstrVal);
253254
EXPECT_EQ(value, "value");
254255

255256
// Verify node control type is text.
256257
varrole = {};
257-
ASSERT_EQ(uia_view->GetPropertyValue(UIA_ControlTypePropertyId, &varrole), S_OK);
258+
ASSERT_EQ(uia_view->GetPropertyValue(UIA_ControlTypePropertyId, &varrole),
259+
S_OK);
258260
EXPECT_EQ(varrole.vt, VT_I4);
259261
EXPECT_EQ(varrole.lVal, UIA_TextControlTypeId);
260262
}
@@ -690,10 +692,12 @@ TEST(FlutterWindowsViewTest, CheckboxNativeState) {
690692
// Perform similar tests for UIA value;
691693
IRawElementProviderSimple* uia_node;
692694
native_view->QueryInterface(IID_PPV_ARGS(&uia_node));
693-
ASSERT_TRUE(SUCCEEDED(uia_node->GetPropertyValue(UIA_ToggleToggleStatePropertyId, &native_state)));
695+
ASSERT_TRUE(SUCCEEDED(uia_node->GetPropertyValue(
696+
UIA_ToggleToggleStatePropertyId, &native_state)));
694697
EXPECT_EQ(native_state.lVal, ToggleState_On);
695698

696-
ASSERT_TRUE(SUCCEEDED(uia_node->GetPropertyValue(UIA_AriaPropertiesPropertyId, &native_state)));
699+
ASSERT_TRUE(SUCCEEDED(uia_node->GetPropertyValue(
700+
UIA_AriaPropertiesPropertyId, &native_state)));
697701
EXPECT_NE(std::wcsstr(native_state.bstrVal, L"checked=true"), nullptr);
698702
}
699703

@@ -729,10 +733,12 @@ TEST(FlutterWindowsViewTest, CheckboxNativeState) {
729733
// Perform similar tests for UIA value;
730734
IRawElementProviderSimple* uia_node;
731735
native_view->QueryInterface(IID_PPV_ARGS(&uia_node));
732-
ASSERT_TRUE(SUCCEEDED(uia_node->GetPropertyValue(UIA_ToggleToggleStatePropertyId, &native_state)));
736+
ASSERT_TRUE(SUCCEEDED(uia_node->GetPropertyValue(
737+
UIA_ToggleToggleStatePropertyId, &native_state)));
733738
EXPECT_EQ(native_state.lVal, ToggleState_Off);
734739

735-
ASSERT_TRUE(SUCCEEDED(uia_node->GetPropertyValue(UIA_AriaPropertiesPropertyId, &native_state)));
740+
ASSERT_TRUE(SUCCEEDED(uia_node->GetPropertyValue(
741+
UIA_AriaPropertiesPropertyId, &native_state)));
736742
EXPECT_NE(std::wcsstr(native_state.bstrVal, L"checked=false"), nullptr);
737743
}
738744

@@ -769,10 +775,12 @@ TEST(FlutterWindowsViewTest, CheckboxNativeState) {
769775
// Perform similar tests for UIA value;
770776
IRawElementProviderSimple* uia_node;
771777
native_view->QueryInterface(IID_PPV_ARGS(&uia_node));
772-
ASSERT_TRUE(SUCCEEDED(uia_node->GetPropertyValue(UIA_ToggleToggleStatePropertyId, &native_state)));
778+
ASSERT_TRUE(SUCCEEDED(uia_node->GetPropertyValue(
779+
UIA_ToggleToggleStatePropertyId, &native_state)));
773780
EXPECT_EQ(native_state.lVal, ToggleState_Indeterminate);
774781

775-
ASSERT_TRUE(SUCCEEDED(uia_node->GetPropertyValue(UIA_AriaPropertiesPropertyId, &native_state)));
782+
ASSERT_TRUE(SUCCEEDED(uia_node->GetPropertyValue(
783+
UIA_AriaPropertiesPropertyId, &native_state)));
776784
EXPECT_NE(std::wcsstr(native_state.bstrVal, L"checked=mixed"), nullptr);
777785
}
778786
}
@@ -845,11 +853,16 @@ TEST(FlutterWindowsViewTest, SwitchNativeState) {
845853
// Test similarly on UIA node.
846854
IRawElementProviderSimple* uia_node;
847855
native_view->QueryInterface(IID_PPV_ARGS(&uia_node));
848-
ASSERT_EQ(uia_node->GetPropertyValue(UIA_ControlTypePropertyId, &varrole), S_OK);
856+
ASSERT_EQ(uia_node->GetPropertyValue(UIA_ControlTypePropertyId, &varrole),
857+
S_OK);
849858
EXPECT_EQ(varrole.lVal, UIA_ButtonControlTypeId);
850-
ASSERT_EQ(uia_node->GetPropertyValue(UIA_ToggleToggleStatePropertyId, &native_state), S_OK);
859+
ASSERT_EQ(uia_node->GetPropertyValue(UIA_ToggleToggleStatePropertyId,
860+
&native_state),
861+
S_OK);
851862
EXPECT_EQ(native_state.lVal, ToggleState_On);
852-
ASSERT_EQ(uia_node->GetPropertyValue(UIA_AriaPropertiesPropertyId, &native_state), S_OK);
863+
ASSERT_EQ(
864+
uia_node->GetPropertyValue(UIA_AriaPropertiesPropertyId, &native_state),
865+
S_OK);
853866
EXPECT_NE(std::wcsstr(native_state.bstrVal, L"pressed=true"), nullptr);
854867
}
855868

@@ -885,9 +898,13 @@ TEST(FlutterWindowsViewTest, SwitchNativeState) {
885898
// Test similarly on UIA node.
886899
IRawElementProviderSimple* uia_node;
887900
native_view->QueryInterface(IID_PPV_ARGS(&uia_node));
888-
ASSERT_EQ(uia_node->GetPropertyValue(UIA_ToggleToggleStatePropertyId, &native_state), S_OK);
901+
ASSERT_EQ(uia_node->GetPropertyValue(UIA_ToggleToggleStatePropertyId,
902+
&native_state),
903+
S_OK);
889904
EXPECT_EQ(native_state.lVal, ToggleState_Off);
890-
ASSERT_EQ(uia_node->GetPropertyValue(UIA_AriaPropertiesPropertyId, &native_state), S_OK);
905+
ASSERT_EQ(
906+
uia_node->GetPropertyValue(UIA_AriaPropertiesPropertyId, &native_state),
907+
S_OK);
891908
EXPECT_NE(std::wcsstr(native_state.bstrVal, L"pressed=false"), nullptr);
892909
}
893910
}
@@ -935,8 +952,12 @@ TEST(FlutterWindowsViewTest, TooltipNodeData) {
935952
EXPECT_EQ(tooltip, "tooltip");
936953

937954
// Check that MSAA name contains the tooltip.
938-
IAccessible* native_view = bridge->GetFlutterPlatformNodeDelegateFromID(AccessibilityBridge::kRootNodeId).lock()->GetNativeViewAccessible();
939-
VARIANT varchild = {.vt=VT_I4, .lVal=CHILDID_SELF};
955+
IAccessible* native_view = bridge
956+
->GetFlutterPlatformNodeDelegateFromID(
957+
AccessibilityBridge::kRootNodeId)
958+
.lock()
959+
->GetNativeViewAccessible();
960+
VARIANT varchild = {.vt = VT_I4, .lVal = CHILDID_SELF};
940961
BSTR bname;
941962
ASSERT_EQ(native_view->get_accName(varchild, &bname), S_OK);
942963
EXPECT_NE(std::wcsstr(bname, L"tooltip"), nullptr);

shell/platform/windows/testing/test_keyboard.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
// found in the LICENSE file.
44

55
#include "flutter/shell/platform/windows/testing/test_keyboard.h"
6-
#include "flutter/shell/platform/windows/windowsx_shim.h"
76
#include "flutter/shell/platform/common/json_message_codec.h"
87
#include "flutter/shell/platform/embedder/test_utils/proc_table_replacement.h"
8+
#include "flutter/shell/platform/windows/windowsx_shim.h"
99

1010
#include <rapidjson/document.h>
1111

shell/platform/windows/window.cc

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -207,21 +207,23 @@ LRESULT Window::OnGetObject(UINT const message,
207207
if (is_uia_request && root_view) {
208208
if (!ax_fragment_root_) {
209209
if (!ax_fragment_delegate_) {
210-
ax_fragment_delegate_ = std::make_unique<WindowAXFragmentRootDelegate>(*this);
210+
ax_fragment_delegate_ =
211+
std::make_unique<WindowAXFragmentRootDelegate>(*this);
211212
}
212-
ax_fragment_root_ = std::make_unique<ui::AXFragmentRootWin>(window_handle_, ax_fragment_delegate_.get());
213+
ax_fragment_root_ = std::make_unique<ui::AXFragmentRootWin>(
214+
window_handle_, ax_fragment_delegate_.get());
213215
}
214216

215217
// TODO(cbracken): https://github.com/flutter/flutter/issues/94782
216218
// Implement when we adopt UIA support.
217219
// Retrieve UIA object for the root view.
218220
Microsoft::WRL::ComPtr<IRawElementProviderSimple> root;
219221
if (SUCCEEDED(ax_fragment_root_->GetNativeViewAccessible()->QueryInterface(
220-
IID_PPV_ARGS(&root)))) {
222+
IID_PPV_ARGS(&root)))) {
221223
// Return the UIA object via UiaReturnRawElementProvider(). See:
222224
// https://docs.microsoft.com/en-us/windows/win32/winauto/wm-getobject
223-
reference_result =
224-
UiaReturnRawElementProvider(window_handle_, wparam, lparam, root.Get());
225+
reference_result = UiaReturnRawElementProvider(window_handle_, wparam,
226+
lparam, root.Get());
225227
} else {
226228
FML_LOG(ERROR) << "Failed to query AX fragment root.";
227229
}
@@ -682,18 +684,21 @@ void Window::CreateAccessibilityRootNode() {
682684
accessibility_root_ = AccessibilityRootNode::Create();
683685
}
684686

685-
gfx::NativeViewAccessible WindowAXFragmentRootDelegate::GetChildOfAXFragmentRoot() {
687+
gfx::NativeViewAccessible
688+
WindowAXFragmentRootDelegate::GetChildOfAXFragmentRoot() {
686689
return window_.GetNativeViewAccessible();
687690
}
688691

689-
gfx::NativeViewAccessible WindowAXFragmentRootDelegate::GetParentOfAXFragmentRoot() {
692+
gfx::NativeViewAccessible
693+
WindowAXFragmentRootDelegate::GetParentOfAXFragmentRoot() {
690694
return nullptr;
691695
}
692696

693697
bool WindowAXFragmentRootDelegate::IsAXFragmentRootAControlElement() {
694698
return true;
695699
}
696700

697-
WindowAXFragmentRootDelegate::WindowAXFragmentRootDelegate(Window& window) : window_(window) {}
701+
WindowAXFragmentRootDelegate::WindowAXFragmentRootDelegate(Window& window)
702+
: window_(window) {}
698703

699704
} // namespace flutter

shell/platform/windows/window.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
#include "flutter/shell/platform/windows/text_input_manager.h"
2121
#include "flutter/shell/platform/windows/windows_proc_table.h"
2222
#include "flutter/shell/platform/windows/windowsx_shim.h"
23-
#include "flutter/third_party/accessibility/gfx/native_widget_types.h"
2423
#include "flutter/third_party/accessibility/ax/platform/ax_fragment_root_delegate_win.h"
2524
#include "flutter/third_party/accessibility/ax/platform/ax_fragment_root_win.h"
25+
#include "flutter/third_party/accessibility/gfx/native_widget_types.h"
2626

2727
namespace flutter {
2828

third_party/accessibility/ax/platform/ax_platform_node_win.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2465,7 +2465,7 @@ HRESULT AXPlatformNodeWin::GetPropertyValueImpl(PROPERTYID property_id,
24652465
result->intVal = static_cast<int>(ComputeExpandCollapseState());
24662466
break;
24672467

2468-
case UIA_ToggleToggleStatePropertyId:{
2468+
case UIA_ToggleToggleStatePropertyId: {
24692469
ToggleState state;
24702470
get_ToggleState(&state);
24712471
result->vt = VT_I4;
@@ -5601,9 +5601,10 @@ AXPlatformNodeWin::GetPatternProviderFactoryMethod(PATTERNID pattern_id) {
56015601
}
56025602
break;
56035603

5604-
// TODO(schectman): add implementations for ITextProvider and ITextRangeProvider interfaces.
5605-
// https://github.com/flutter/flutter/issues/114547 and
5606-
// https://github.com/flutter/flutter/issues/109804
5604+
// TODO(schectman): add implementations for ITextProvider and
5605+
// ITextRangeProvider interfaces.
5606+
// https://github.com/flutter/flutter/issues/114547 and
5607+
// https://github.com/flutter/flutter/issues/109804
56075608

56085609
case UIA_TogglePatternId:
56095610
if (SupportsToggle(data.role)) {

third_party/accessibility/ax/platform/test_ax_node_wrapper.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ class TestAXTreeObserver : public AXTreeObserver {
5858
if (iter != g_node_id_to_wrapper_map.end()) {
5959
TestAXNodeWrapper* wrapper = iter->second;
6060
const auto& focus_iter = g_focused_node_in_tree.find(tree);
61-
if (focus_iter != g_focused_node_in_tree.end() && focus_iter->second->id() == node_id) {
61+
if (focus_iter != g_focused_node_in_tree.end() &&
62+
focus_iter->second->id() == node_id) {
6263
g_focused_node_in_tree.erase(tree);
6364
}
6465
delete wrapper;

0 commit comments

Comments
 (0)