From 408aadcdb02e9df079612e640869832c931fd70f Mon Sep 17 00:00:00 2001 From: schectman Date: Mon, 9 Jan 2023 12:06:58 -0500 Subject: [PATCH 1/6] Line breaks --- shell/platform/common/accessibility_bridge.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shell/platform/common/accessibility_bridge.cc b/shell/platform/common/accessibility_bridge.cc index 8a98f3d724b4c..62c62952534c9 100644 --- a/shell/platform/common/accessibility_bridge.cc +++ b/shell/platform/common/accessibility_bridge.cc @@ -435,6 +435,9 @@ void AccessibilityBridge::SetBooleanAttributesFromFlutterUpdate( ax::mojom::BoolAttribute::kEditableRoot, flags & FlutterSemanticsFlag::kFlutterSemanticsFlagIsTextField && (flags & FlutterSemanticsFlag::kFlutterSemanticsFlagIsReadOnly) == 0); + // TODO(schectman): When should a node have this attribute set? + // https://github.com/flutter/flutter/issues/118184 + node_data.AddBoolAttribute(ax::mojom::BoolAttribute::kIsLineBreakingObject, true); } void AccessibilityBridge::SetIntAttributesFromFlutterUpdate( From a41011dbc5d496960bb0f8a2bfedb12be7a3718f Mon Sep 17 00:00:00 2001 From: schectman Date: Mon, 9 Jan 2023 12:45:36 -0500 Subject: [PATCH 2/6] Formatting --- shell/platform/common/accessibility_bridge.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/platform/common/accessibility_bridge.cc b/shell/platform/common/accessibility_bridge.cc index 62c62952534c9..b39b5020cf204 100644 --- a/shell/platform/common/accessibility_bridge.cc +++ b/shell/platform/common/accessibility_bridge.cc @@ -437,7 +437,8 @@ void AccessibilityBridge::SetBooleanAttributesFromFlutterUpdate( (flags & FlutterSemanticsFlag::kFlutterSemanticsFlagIsReadOnly) == 0); // TODO(schectman): When should a node have this attribute set? // https://github.com/flutter/flutter/issues/118184 - node_data.AddBoolAttribute(ax::mojom::BoolAttribute::kIsLineBreakingObject, true); + node_data.AddBoolAttribute(ax::mojom::BoolAttribute::kIsLineBreakingObject, + true); } void AccessibilityBridge::SetIntAttributesFromFlutterUpdate( From 6249c0420ebd0220b4d8f0462d93727037b80eca Mon Sep 17 00:00:00 2001 From: yaakovschectman <109111084+yaakovschectman@users.noreply.github.com> Date: Mon, 9 Jan 2023 13:11:22 -0500 Subject: [PATCH 3/6] Update shell/platform/common/accessibility_bridge.cc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Loïc Sharma <737941+loic-sharma@users.noreply.github.com> --- shell/platform/common/accessibility_bridge.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shell/platform/common/accessibility_bridge.cc b/shell/platform/common/accessibility_bridge.cc index b39b5020cf204..e6b47d4ae6f86 100644 --- a/shell/platform/common/accessibility_bridge.cc +++ b/shell/platform/common/accessibility_bridge.cc @@ -435,6 +435,8 @@ void AccessibilityBridge::SetBooleanAttributesFromFlutterUpdate( ax::mojom::BoolAttribute::kEditableRoot, flags & FlutterSemanticsFlag::kFlutterSemanticsFlagIsTextField && (flags & FlutterSemanticsFlag::kFlutterSemanticsFlagIsReadOnly) == 0); + // Mark nodes as line breaking so that screen readers don't + // merge all consecutive objects into one. // TODO(schectman): When should a node have this attribute set? // https://github.com/flutter/flutter/issues/118184 node_data.AddBoolAttribute(ax::mojom::BoolAttribute::kIsLineBreakingObject, From 3f1415f8534600a7865d4d2d5520429353e215dd Mon Sep 17 00:00:00 2001 From: schectman Date: Mon, 9 Jan 2023 13:16:03 -0500 Subject: [PATCH 4/6] Test line breaking object --- .../common/accessibility_bridge_unittests.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/shell/platform/common/accessibility_bridge_unittests.cc b/shell/platform/common/accessibility_bridge_unittests.cc index 0aa078f925f5d..e49bd5925514e 100644 --- a/shell/platform/common/accessibility_bridge_unittests.cc +++ b/shell/platform/common/accessibility_bridge_unittests.cc @@ -496,5 +496,24 @@ TEST(AccessibilityBridgeTest, AXTreeManagerTest) { ASSERT_EQ(manager, static_cast(bridge.get())); } +TEST(AccessibilityBridgeTest, LineBreakingObjectTest) { + std::shared_ptr bridge = + std::make_shared(); + + const int32_t root_id = 0; + + FlutterSemanticsNode root = + CreateSemanticsNode(root_id, "root", {}); + + bridge->AddFlutterSemanticsNodeUpdate(&root); + bridge->CommitUpdates(); + + auto root_node = bridge->GetFlutterPlatformNodeDelegateFromID(root_id).lock(); + auto root_data = root_node->GetData(); + EXPECT_TRUE(root_data.HasBoolAttribute(ax::mojom::BoolAttribute::kIsLineBreakingObject)); + EXPECT_TRUE(root_data.GetBoolAttribute(ax::mojom::BoolAttribute::kIsLineBreakingObject)); + +} + } // namespace testing } // namespace flutter From 95f3e6dbb9be9137bce2d13f9342521811e9aa54 Mon Sep 17 00:00:00 2001 From: schectman Date: Mon, 9 Jan 2023 14:01:29 -0500 Subject: [PATCH 5/6] Formatting --- shell/platform/common/accessibility_bridge_unittests.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/shell/platform/common/accessibility_bridge_unittests.cc b/shell/platform/common/accessibility_bridge_unittests.cc index e49bd5925514e..5144784293324 100644 --- a/shell/platform/common/accessibility_bridge_unittests.cc +++ b/shell/platform/common/accessibility_bridge_unittests.cc @@ -502,16 +502,17 @@ TEST(AccessibilityBridgeTest, LineBreakingObjectTest) { const int32_t root_id = 0; - FlutterSemanticsNode root = - CreateSemanticsNode(root_id, "root", {}); + FlutterSemanticsNode root = CreateSemanticsNode(root_id, "root", {}); bridge->AddFlutterSemanticsNodeUpdate(&root); bridge->CommitUpdates(); auto root_node = bridge->GetFlutterPlatformNodeDelegateFromID(root_id).lock(); auto root_data = root_node->GetData(); - EXPECT_TRUE(root_data.HasBoolAttribute(ax::mojom::BoolAttribute::kIsLineBreakingObject)); - EXPECT_TRUE(root_data.GetBoolAttribute(ax::mojom::BoolAttribute::kIsLineBreakingObject)); + EXPECT_TRUE(root_data.HasBoolAttribute( + ax::mojom::BoolAttribute::kIsLineBreakingObject)); + EXPECT_TRUE(root_data.GetBoolAttribute( + ax::mojom::BoolAttribute::kIsLineBreakingObject)); } From 982d0e88b42297e8038fa6cd2be6c25db9e4d71c Mon Sep 17 00:00:00 2001 From: schectman Date: Mon, 9 Jan 2023 14:09:58 -0500 Subject: [PATCH 6/6] Format --- shell/platform/common/accessibility_bridge_unittests.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/shell/platform/common/accessibility_bridge_unittests.cc b/shell/platform/common/accessibility_bridge_unittests.cc index 5144784293324..7b5a4924e01c3 100644 --- a/shell/platform/common/accessibility_bridge_unittests.cc +++ b/shell/platform/common/accessibility_bridge_unittests.cc @@ -513,7 +513,6 @@ TEST(AccessibilityBridgeTest, LineBreakingObjectTest) { ax::mojom::BoolAttribute::kIsLineBreakingObject)); EXPECT_TRUE(root_data.GetBoolAttribute( ax::mojom::BoolAttribute::kIsLineBreakingObject)); - } } // namespace testing