mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Extract AccessibilityBridge::kRootNodeId (flutter/engine#29856)
The ID of the root semantics node in Flutter's semantics tree is always 0. Since we'll be adding support for Windows, extract this constant to a common location.
This commit is contained in:
parent
10e485ee00
commit
29fd771d30
@ -100,6 +100,7 @@ class AccessibilityBridge
|
||||
virtual std::shared_ptr<FlutterPlatformNodeDelegate>
|
||||
CreateFlutterPlatformNodeDelegate() = 0;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/// @brief Creates a new instance of a accessibility bridge.
|
||||
///
|
||||
@ -110,6 +111,11 @@ class AccessibilityBridge
|
||||
std::unique_ptr<AccessibilityBridgeDelegate> delegate);
|
||||
~AccessibilityBridge();
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/// @brief The ID of the root node in the accessibility tree. In Flutter,
|
||||
// this is always 0.
|
||||
static constexpr int32_t kRootNodeId = 0;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// @brief Adds a semantics node update to the pending semantics update.
|
||||
/// Calling this method alone will NOT update the semantics tree.
|
||||
|
||||
@ -12,8 +12,6 @@
|
||||
|
||||
namespace flutter {
|
||||
|
||||
inline constexpr int32_t kRootNode = 0;
|
||||
|
||||
// Native mac notifications fired. These notifications are not publicly documented.
|
||||
static NSString* const AccessibilityLoadCompleteNotification = @"AXLoadComplete";
|
||||
static NSString* const AccessibilityInvalidStatusChangedNotification = @"AXInvalidStatusChanged";
|
||||
@ -187,9 +185,10 @@ AccessibilityBridgeMacDelegate::MacOSEventsFromAXEvent(ui::AXEventGenerator::Eve
|
||||
if (ax_node.data().HasState(ax::mojom::State::kEditable)) {
|
||||
events.push_back({
|
||||
.name = NSAccessibilityValueChangedNotification,
|
||||
.target = bridge->GetFlutterPlatformNodeDelegateFromID(kRootNode)
|
||||
.lock()
|
||||
->GetNativeViewAccessible(),
|
||||
.target =
|
||||
bridge->GetFlutterPlatformNodeDelegateFromID(AccessibilityBridge::kRootNodeId)
|
||||
.lock()
|
||||
->GetNativeViewAccessible(),
|
||||
.user_info = nil,
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user