[macOS] A11y Zoom Crash (flutter/engine#35453)
This commit is contained in:
committed by
GitHub
parent
984dfe82eb
commit
e1d1c2d669
@@ -1016,7 +1016,9 @@ bool AlsoUseShowMenuActionForDefaultAction(const ui::AXNodeData& data) {
|
||||
}
|
||||
|
||||
- (NSRange)accessibilityRangeForPosition:(NSPoint)point {
|
||||
BASE_UNREACHABLE();
|
||||
// TODO(a-wallen): Framework needs to send Text Metrics
|
||||
// to the AXTree in order for a NSPoint (x, y) to be
|
||||
// translated to the appropriate range of UTF-16 chars.
|
||||
return NSMakeRange(0, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,4 +46,25 @@ TEST_F(AXPlatformNodeMacTest, CanGetCocoaPlatformNodeFromTree) {
|
||||
EXPECT_TRUE(native_root != nullptr);
|
||||
}
|
||||
|
||||
// Test that [AXPlatformNodeCocoa accessbilityRangeForPosition:] doesn't crash.
|
||||
// https://github.com/flutter/flutter/issues/102416
|
||||
TEST_F(AXPlatformNodeMacTest, AccessibilityRangeForPositionDoesntCrash) {
|
||||
AXNodeData root;
|
||||
root.id = 1;
|
||||
root.relative_bounds.bounds = gfx::RectF(0, 0, 40, 40);
|
||||
|
||||
Init(root);
|
||||
AXNode* root_node = GetRootAsAXNode();
|
||||
ASSERT_TRUE(root_node != nullptr);
|
||||
|
||||
AXPlatformNode* platform_node = AXPlatformNodeFromNode(root_node);
|
||||
ASSERT_TRUE(platform_node != nullptr);
|
||||
|
||||
NSPoint point = NSMakePoint(0, 0);
|
||||
AXPlatformNodeCocoa* native_root = platform_node->GetNativeViewAccessible();
|
||||
ASSERT_TRUE(native_root != nullptr);
|
||||
|
||||
[native_root accessibilityRangeForPosition:(NSPoint)point];
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
||||
Reference in New Issue
Block a user