forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge MSAA alert functionality with UIA (flutter#38745)
* Use AXFragmentRootWin for MSAA functionality. Some unused code remains to be removed. Merge MSAA to AXFragmentRootWin * Removing unused code * Remove unused files * Flip macro * Formatting * Licenses * Make reference * Disable copy constructor/assignment * Unused import * Formatting * Relocate alert logic * Remove comment and unused mock * Fix unit test * Idempotency * Formatting * PR feedback * Doc comments * Undo string change for now * Couple fragment root and alert node * Formatting * Add comments * Pointer to reference * Typo fix
- Loading branch information
1 parent
29a0582
commit a0e3c14
Showing
23 changed files
with
286 additions
and
858 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "alert_platform_node_delegate.h" | ||
|
||
namespace flutter { | ||
|
||
AlertPlatformNodeDelegate::AlertPlatformNodeDelegate( | ||
ui::AXPlatformNodeDelegate& parent_delegate) | ||
: parent_delegate_(parent_delegate) { | ||
data_.role = ax::mojom::Role::kAlert; | ||
data_.id = id_.Get(); | ||
} | ||
|
||
AlertPlatformNodeDelegate::~AlertPlatformNodeDelegate() {} | ||
|
||
gfx::AcceleratedWidget | ||
AlertPlatformNodeDelegate::GetTargetForNativeAccessibilityEvent() { | ||
return parent_delegate_.GetTargetForNativeAccessibilityEvent(); | ||
} | ||
|
||
gfx::NativeViewAccessible AlertPlatformNodeDelegate::GetParent() { | ||
return parent_delegate_.GetNativeViewAccessible(); | ||
} | ||
|
||
const ui::AXUniqueId& AlertPlatformNodeDelegate::GetUniqueId() const { | ||
return id_; | ||
} | ||
|
||
const ui::AXNodeData& AlertPlatformNodeDelegate::GetData() const { | ||
return data_; | ||
} | ||
|
||
void AlertPlatformNodeDelegate::SetText(const std::u16string& text) { | ||
data_.SetName(text); | ||
data_.SetDescription(text); | ||
data_.SetValue(text); | ||
} | ||
|
||
} // namespace flutter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef FLUTTER_SHELL_PLATFORM_COMMON_ALERT_PLATFORM_NODE_DELEGATE_H_ | ||
#define FLUTTER_SHELL_PLATFORM_COMMON_ALERT_PLATFORM_NODE_DELEGATE_H_ | ||
|
||
#include "flutter/third_party/accessibility/ax/ax_node_data.h" | ||
#include "flutter/third_party/accessibility/ax/platform/ax_platform_node_delegate_base.h" | ||
|
||
namespace flutter { | ||
|
||
// A delegate for a node that holds the text of an a11y alert that a | ||
// screen-reader should announce. The delegate is used to construct an | ||
// AXPlatformNode, and in order to serve as an alert, only needs to be able to | ||
// hold a text announcement and make that text available to the platform node. | ||
class AlertPlatformNodeDelegate : public ui::AXPlatformNodeDelegateBase { | ||
public: | ||
explicit AlertPlatformNodeDelegate( | ||
ui::AXPlatformNodeDelegate& parent_delegate); | ||
~AlertPlatformNodeDelegate(); | ||
|
||
AlertPlatformNodeDelegate(const AlertPlatformNodeDelegate& other) = delete; | ||
AlertPlatformNodeDelegate operator=(const AlertPlatformNodeDelegate& other) = | ||
delete; | ||
|
||
// Set the alert text of the node for which this is the delegate. | ||
void SetText(const std::u16string& text); | ||
|
||
// |AXPlatformNodeDelegate| | ||
gfx::NativeViewAccessible GetParent() override; | ||
|
||
private: | ||
// AXPlatformNodeDelegate overrides. | ||
gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() override; | ||
const ui::AXUniqueId& GetUniqueId() const override; | ||
const ui::AXNodeData& GetData() const override; | ||
|
||
// Delegate of the parent of this node. Returned by GetParent. | ||
ui::AXPlatformNodeDelegate& parent_delegate_; | ||
|
||
// Node Data that contains the alert text. Returned by GetData. | ||
ui::AXNodeData data_; | ||
|
||
// A unique ID used to identify this node. Returned by GetUniqueId. | ||
ui::AXUniqueId id_; | ||
}; | ||
|
||
} // namespace flutter | ||
|
||
#endif // FLUTTER_SHELL_PLATFORM_COMMON_ALERT_PLATFORM_NODE_DELEGATE_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.