@@ -311,43 +311,43 @@ void AccessibilityBridge::ConvertFlutterUpdate(const SemanticsNode& node,
311311
312312void AccessibilityBridge::SetRoleFromFlutterUpdate (ui::AXNodeData& node_data,
313313 const SemanticsNode& node) {
314- FlutterSemanticsFlag flags = node.flags ;
315- if (flags & FlutterSemanticsFlag::kFlutterSemanticsFlagIsButton ) {
314+ const FlutterSemanticsFlags* flags = node.flags ;
315+ FML_DCHECK (flags) << " SemanticsNode::flags must not be null" ;
316+ if (flags->is_button ) {
316317 node_data.role = ax::mojom::Role::kButton ;
317318 return ;
318319 }
319- if (flags & FlutterSemanticsFlag::kFlutterSemanticsFlagIsTextField &&
320- !(flags & FlutterSemanticsFlag::kFlutterSemanticsFlagIsReadOnly )) {
320+ if (flags->is_text_field && !flags->is_read_only ) {
321321 node_data.role = ax::mojom::Role::kTextField ;
322322 return ;
323323 }
324- if (flags & FlutterSemanticsFlag:: kFlutterSemanticsFlagIsHeader ) {
324+ if (flags-> is_header ) {
325325 node_data.role = ax::mojom::Role::kHeader ;
326326 return ;
327327 }
328- if (flags & FlutterSemanticsFlag:: kFlutterSemanticsFlagIsImage ) {
328+ if (flags-> is_image ) {
329329 node_data.role = ax::mojom::Role::kImage ;
330330 return ;
331331 }
332- if (flags & FlutterSemanticsFlag:: kFlutterSemanticsFlagIsLink ) {
332+ if (flags-> is_link ) {
333333 node_data.role = ax::mojom::Role::kLink ;
334334 return ;
335335 }
336336
337- if (flags & kFlutterSemanticsFlagIsInMutuallyExclusiveGroup &&
338- flags & kFlutterSemanticsFlagHasCheckedState ) {
337+ if (flags-> is_in_mutually_exclusive_group &&
338+ flags-> is_checked != FlutterCheckState:: kFlutterCheckStateNone ) {
339339 node_data.role = ax::mojom::Role::kRadioButton ;
340340 return ;
341341 }
342- if (flags & kFlutterSemanticsFlagHasCheckedState ) {
342+ if (flags-> is_checked != FlutterCheckState:: kFlutterCheckStateNone ) {
343343 node_data.role = ax::mojom::Role::kCheckBox ;
344344 return ;
345345 }
346- if (flags & kFlutterSemanticsFlagHasToggledState ) {
346+ if (flags-> is_toggled != FlutterTristate:: kFlutterTristateNone ) {
347347 node_data.role = ax::mojom::Role::kSwitch ;
348348 return ;
349349 }
350- if (flags & kFlutterSemanticsFlagIsSlider ) {
350+ if (flags-> is_slider ) {
351351 node_data.role = ax::mojom::Role::kSlider ;
352352 return ;
353353 }
@@ -362,17 +362,14 @@ void AccessibilityBridge::SetRoleFromFlutterUpdate(ui::AXNodeData& node_data,
362362
363363void AccessibilityBridge::SetStateFromFlutterUpdate (ui::AXNodeData& node_data,
364364 const SemanticsNode& node) {
365- FlutterSemanticsFlag flags = node.flags ;
365+ const FlutterSemanticsFlags* flags = node.flags ;
366366 FlutterSemanticsAction actions = node.actions ;
367- if (flags & FlutterSemanticsFlag::kFlutterSemanticsFlagHasExpandedState &&
368- flags & FlutterSemanticsFlag::kFlutterSemanticsFlagIsExpanded ) {
367+ if (flags->is_expanded == FlutterTristate::kFlutterTristateTrue ) {
369368 node_data.AddState (ax::mojom::State::kExpanded );
370- } else if (flags &
371- FlutterSemanticsFlag::kFlutterSemanticsFlagHasExpandedState ) {
369+ } else if (flags->is_expanded == FlutterTristate::kFlutterTristateFalse ) {
372370 node_data.AddState (ax::mojom::State::kCollapsed );
373371 }
374- if (flags & FlutterSemanticsFlag::kFlutterSemanticsFlagIsTextField &&
375- (flags & FlutterSemanticsFlag::kFlutterSemanticsFlagIsReadOnly ) == 0 ) {
372+ if (flags->is_text_field && !flags->is_read_only ) {
376373 node_data.AddState (ax::mojom::State::kEditable );
377374 }
378375 if (node_data.role == ax::mojom::Role::kStaticText &&
@@ -435,7 +432,7 @@ void AccessibilityBridge::SetBooleanAttributesFromFlutterUpdate(
435432 ui::AXNodeData& node_data,
436433 const SemanticsNode& node) {
437434 FlutterSemanticsAction actions = node.actions ;
438- FlutterSemanticsFlag flags = node.flags ;
435+ const FlutterSemanticsFlags* flags = node.flags ;
439436 node_data.AddBoolAttribute (ax::mojom::BoolAttribute::kScrollable ,
440437 actions & kHasScrollingAction );
441438 node_data.AddBoolAttribute (
@@ -444,13 +441,10 @@ void AccessibilityBridge::SetBooleanAttributesFromFlutterUpdate(
444441 // TODO(chunhtai): figure out if there is a node that does not clip overflow.
445442 node_data.AddBoolAttribute (ax::mojom::BoolAttribute::kClipsChildren ,
446443 !node.children_in_traversal_order .empty ());
447- node_data.AddBoolAttribute (
448- ax::mojom::BoolAttribute::kSelected ,
449- flags & FlutterSemanticsFlag::kFlutterSemanticsFlagIsSelected );
450- node_data.AddBoolAttribute (
451- ax::mojom::BoolAttribute::kEditableRoot ,
452- flags & FlutterSemanticsFlag::kFlutterSemanticsFlagIsTextField &&
453- (flags & FlutterSemanticsFlag::kFlutterSemanticsFlagIsReadOnly ) == 0 );
444+ node_data.AddBoolAttribute (ax::mojom::BoolAttribute::kSelected ,
445+ flags->is_selected );
446+ node_data.AddBoolAttribute (ax::mojom::BoolAttribute::kEditableRoot ,
447+ flags->is_text_field && !flags->is_read_only );
454448 // Mark nodes as line breaking so that screen readers don't
455449 // merge all consecutive objects into one.
456450 // TODO(schectman): When should a node have this attribute set?
@@ -462,15 +456,13 @@ void AccessibilityBridge::SetBooleanAttributesFromFlutterUpdate(
462456void AccessibilityBridge::SetIntAttributesFromFlutterUpdate (
463457 ui::AXNodeData& node_data,
464458 const SemanticsNode& node) {
465- FlutterSemanticsFlag flags = node.flags ;
459+ const FlutterSemanticsFlags* flags = node.flags ;
466460 node_data.AddIntAttribute (ax::mojom::IntAttribute::kTextDirection ,
467461 node.text_direction );
468462
469463 int sel_start = node.text_selection_base ;
470464 int sel_end = node.text_selection_extent ;
471- if (flags & FlutterSemanticsFlag::kFlutterSemanticsFlagIsTextField &&
472- (flags & FlutterSemanticsFlag::kFlutterSemanticsFlagIsReadOnly ) == 0 &&
473- !node.value .empty ()) {
465+ if (flags->is_text_field && !flags->is_read_only && !node.value .empty ()) {
474466 // By default the text field selection should be at the end.
475467 sel_start = sel_start == -1 ? node.value .length () : sel_start;
476468 sel_end = sel_end == -1 ? node.value .length () : sel_end;
@@ -483,16 +475,16 @@ void AccessibilityBridge::SetIntAttributesFromFlutterUpdate(
483475 node_data.AddIntAttribute (
484476 ax::mojom::IntAttribute::kCheckedState ,
485477 static_cast <int32_t >(
486- flags & FlutterSemanticsFlag:: kFlutterSemanticsFlagIsCheckStateMixed
478+ ( flags-> is_checked == FlutterCheckState:: kFlutterCheckStateMixed )
487479 ? ax::mojom::CheckedState::kMixed
488- : flags & FlutterSemanticsFlag:: kFlutterSemanticsFlagIsChecked
480+ : ( flags-> is_checked == FlutterCheckState:: kFlutterCheckStateTrue )
489481 ? ax::mojom::CheckedState::kTrue
490482 : ax::mojom::CheckedState::kFalse ));
491483 } else if (node_data.role == ax::mojom::Role::kSwitch ) {
492484 node_data.AddIntAttribute (
493485 ax::mojom::IntAttribute::kCheckedState ,
494486 static_cast <int32_t >(
495- flags & FlutterSemanticsFlag:: kFlutterSemanticsFlagIsToggled
487+ ( flags-> is_toggled == FlutterTristate:: kFlutterTristateTrue )
496488 ? ax::mojom::CheckedState::kTrue
497489 : ax::mojom::CheckedState::kFalse ));
498490 }
@@ -548,13 +540,13 @@ void AccessibilityBridge::SetTooltipFromFlutterUpdate(
548540
549541void AccessibilityBridge::SetTreeData (const SemanticsNode& node,
550542 ui::AXTreeUpdate& tree_update) {
551- FlutterSemanticsFlag flags = node.flags ;
543+ const FlutterSemanticsFlags* flags = node.flags ;
552544 // Set selection of the focused node if:
553545 // 1. this text field has a valid selection
554546 // 2. this text field doesn't have a valid selection but had selection stored
555547 // in the tree.
556- if (flags & FlutterSemanticsFlag:: kFlutterSemanticsFlagIsTextField &&
557- flags & FlutterSemanticsFlag:: kFlutterSemanticsFlagIsFocused ) {
548+ if (flags-> is_text_field &&
549+ flags-> is_focused == FlutterTristate:: kFlutterTristateTrue ) {
558550 if (node.text_selection_base != -1 ) {
559551 tree_update.tree_data .sel_anchor_object_id = node.id ;
560552 tree_update.tree_data .sel_anchor_offset = node.text_selection_base ;
@@ -570,12 +562,11 @@ void AccessibilityBridge::SetTreeData(const SemanticsNode& node,
570562 }
571563 }
572564
573- if (flags & FlutterSemanticsFlag:: kFlutterSemanticsFlagIsFocused &&
565+ if (flags-> is_focused == FlutterTristate:: kFlutterTristateTrue &&
574566 tree_update.tree_data .focus_id != node.id ) {
575567 tree_update.tree_data .focus_id = node.id ;
576568 tree_update.has_tree_data = true ;
577- } else if ((flags & FlutterSemanticsFlag::kFlutterSemanticsFlagIsFocused ) ==
578- 0 &&
569+ } else if (flags->is_focused != FlutterTristate::kFlutterTristateTrue &&
579570 tree_update.tree_data .focus_id == node.id ) {
580571 tree_update.tree_data .focus_id = ui::AXNode::kInvalidAXID ;
581572 tree_update.has_tree_data = true ;
@@ -587,7 +578,10 @@ AccessibilityBridge::FromFlutterSemanticsNode(
587578 const FlutterSemanticsNode2& flutter_node) {
588579 SemanticsNode result;
589580 result.id = flutter_node.id ;
590- result.flags = flutter_node.flags ;
581+ FML_DCHECK (flutter_node.flags2 )
582+ << " FlutterSemanticsNode2::flags2 must not be null" ;
583+
584+ result.flags = flutter_node.flags2 ;
591585 result.actions = flutter_node.actions ;
592586 result.text_selection_base = flutter_node.text_selection_base ;
593587 result.text_selection_extent = flutter_node.text_selection_extent ;
@@ -596,8 +590,6 @@ AccessibilityBridge::FromFlutterSemanticsNode(
596590 result.scroll_position = flutter_node.scroll_position ;
597591 result.scroll_extent_max = flutter_node.scroll_extent_max ;
598592 result.scroll_extent_min = flutter_node.scroll_extent_min ;
599- result.elevation = flutter_node.elevation ;
600- result.thickness = flutter_node.thickness ;
601593 if (flutter_node.label ) {
602594 result.label = std::string (flutter_node.label );
603595 }
0 commit comments