Flutter Engine
The Flutter Engine
Instance Methods | Properties | List of all members
SemanticsObject Class Reference

#import <SemanticsObject.h>

Inheritance diagram for SemanticsObject:
FlutterPlatformViewSemanticsContainer FlutterScrollableSemanticsObject FlutterSemanticsObject FlutterSwitchSemanticsObject TextInputSemanticsObject

Instance Methods

(BOOL- isAccessibilityBridgeAlive
 
(void) - setSemanticsNode:
 
(void) - replaceChildAtIndex:withChild:
 
(BOOL- nodeWillCauseLayoutChange:
 
(BOOL- nodeWillCauseScroll:
 
(BOOL- nodeShouldTriggerAnnouncement:
 
(void) - collectRoutes:
 
(NSString *) - routeName
 
(BOOL- onCustomAccessibilityAction:
 
(void) - accessibilityBridgeDidFinishUpdate
 
((unavailable("Use initWithBridge instead") - __attribute__
 
(instancetype) - initWithBridge:uid:
 
(void) - dealloc [implementation]
 
(void) - setChildren: [implementation]
 
(void) - setChildrenInHitTestOrder: [implementation]
 
(NSAttributedString *) - createAttributedStringFromString:withAttributes: [implementation]
 
(void) - showOnScreen [implementation]
 
(BOOL- isAccessibilityElement [implementation]
 
(bool) - isFocusable [implementation]
 
(NSString *) - accessibilityIdentifier [implementation]
 
(NSString *) - accessibilityLabel [implementation]
 
(bool) - containsPoint: [implementation]
 
(id- search: [implementation]
 
(id- _accessibilityHitTest:withEvent: [implementation]
 
(BOOL- accessibilityScrollToVisible [implementation]
 
(BOOL- accessibilityScrollToVisibleWithChild: [implementation]
 
(NSAttributedString *) - accessibilityAttributedLabel [implementation]
 
(NSString *) - accessibilityHint [implementation]
 
(NSAttributedString *) - accessibilityAttributedHint [implementation]
 
(NSString *) - accessibilityValue [implementation]
 
(NSAttributedString *) - accessibilityAttributedValue [implementation]
 
(CGRect) - accessibilityFrame [implementation]
 
(CGRect) - globalRect [implementation]
 
(void) - setAccessibilityContainer: [implementation]
 
(id- accessibilityContainer [implementation]
 
(BOOL- accessibilityActivate [implementation]
 
(void) - accessibilityIncrement [implementation]
 
(void) - accessibilityDecrement [implementation]
 
(BOOL- accessibilityScroll: [implementation]
 
(BOOL- accessibilityPerformEscape [implementation]
 
(void) - accessibilityElementDidBecomeFocused [implementation]
 
(void) - accessibilityElementDidLoseFocus [implementation]
 

Properties

int32_t uid
 
SemanticsObjectparent
 
fml::WeakPtr< flutter::AccessibilityBridgeIosbridge
 
flutter::SemanticsNode node
 
BOOL hasChildren
 
NSArray< SemanticsObject * > * children
 
NSArray< SemanticsObject * > * childrenInHitTestOrder
 
id nativeAccessibility
 
SemanticsObjectContainercontainer [implementation]
 

Detailed Description

A node in the iOS semantics tree. This object is a wrapper over a native accessibiliy object, which is stored in the property nativeAccessibility. In the most case, the nativeAccessibility directly returns this object. Some subclasses such as the FlutterScrollableSemanticsObject creates a native UIScrollView as its nativeAccessibility so that it can interact with iOS.

Definition at line 30 of file SemanticsObject.h.

Method Documentation

◆ __attribute__

- ((unavailable("Use initWithBridge instead") __attribute__

◆ _accessibilityHitTest:withEvent:

- (id) _accessibilityHitTest: (CGPoint)  point
withEvent: (UIEvent*)  event 
implementation

Provided by category SemanticsObject(Tests).

Definition at line 255 of file SemanticsObject.mm.

553 :(CGPoint)point withEvent:(UIEvent*)event {
554 return [self search:point];
555}

◆ accessibilityActivate

- (BOOL) accessibilityActivate
implementation

Reimplemented in TextInputSemanticsObject.

Definition at line 255 of file SemanticsObject.mm.

690 {
691 if (![self isAccessibilityBridgeAlive]) {
692 return NO;
693 }
695 return NO;
696 }
697 self.bridge->DispatchSemanticsAction(self.uid, flutter::SemanticsAction::kTap);
698 return YES;
699}
BOOL isAccessibilityBridgeAlive()
flutter::SemanticsNode node
bool HasAction(SemanticsAction action) const

◆ accessibilityAttributedHint

- (NSAttributedString *) accessibilityAttributedHint
implementation

Definition at line 255 of file SemanticsObject.mm.

591 {
592 NSString* hint = [self accessibilityHint];
593 if (hint.length == 0) {
594 return nil;
595 }
596 return [self createAttributedStringFromString:hint withAttributes:self.node.hintAttributes];
597}

◆ accessibilityAttributedLabel

- (NSAttributedString *) accessibilityAttributedLabel
implementation

Definition at line 255 of file SemanticsObject.mm.

572 {
573 NSString* label = self.accessibilityLabel;
574 if (label.length == 0) {
575 return nil;
576 }
577 return [self createAttributedStringFromString:label withAttributes:self.node.labelAttributes];
578}

◆ accessibilityAttributedValue

- (NSAttributedString *) accessibilityAttributedValue
implementation

Definition at line 255 of file SemanticsObject.mm.

627 {
628 NSString* value = [self accessibilityValue];
629 if (value.length == 0) {
630 return nil;
631 }
632 return [self createAttributedStringFromString:value withAttributes:self.node.valueAttributes];
633}
uint8_t value

◆ accessibilityBridgeDidFinishUpdate

- (void) accessibilityBridgeDidFinishUpdate

Called after accessibility bridge finishes a semantics update.

Subclasses can override this method if they contain states that can only be updated once every node in the accessibility tree has finished updating.

Reimplemented in FlutterScrollableSemanticsObject.

Definition at line 255 of file SemanticsObject.mm.

332 { /* Do nothing by default */
333}

◆ accessibilityContainer

- (id) accessibilityContainer
implementation

Definition at line 255 of file SemanticsObject.mm.

659 {
660 if (_inDealloc) {
661 // In iOS9, `accessibilityContainer` will be called by `[UIAccessibilityElementSuperCategory
662 // dealloc]` during `[super dealloc]`. And will crash when accessing `_children` which has
663 // called `[_children release]` in `[SemanticsObject dealloc]`.
664 // https://github.com/flutter/flutter/issues/87247
665 return nil;
666 }
667
668 if (![self isAccessibilityBridgeAlive]) {
669 return nil;
670 }
671
672 if ([self hasChildren] || self.uid == kRootNodeId) {
673 if (self.container == nil) {
674 self.container = [[SemanticsObjectContainer alloc] initWithSemanticsObject:self
675 bridge:self.bridge];
676 }
677 return self.container;
678 }
679 if (self.parent == nil) {
680 // This can happen when we have released the accessibility tree but iOS is
681 // still holding onto our objects. iOS can take some time before it
682 // realizes that the tree has changed.
683 return nil;
684 }
685 return self.parent.accessibilityContainer;
686}
constexpr int32_t kRootNodeId
BOOL _inDealloc
SemanticsObject * parent
SemanticsObjectContainer * container

◆ accessibilityDecrement

- (void) accessibilityDecrement
implementation

Definition at line 255 of file SemanticsObject.mm.

711 {
712 if (![self isAccessibilityBridgeAlive]) {
713 return;
714 }
716 self.node.value = self.node.decreasedValue;
717 self.bridge->DispatchSemanticsAction(self.uid, flutter::SemanticsAction::kDecrease);
718 }
719}

◆ accessibilityElementDidBecomeFocused

- (void) accessibilityElementDidBecomeFocused
implementation

Reimplemented in TextInputSemanticsObject.

Definition at line 255 of file SemanticsObject.mm.

746 {
747 if (![self isAccessibilityBridgeAlive]) {
748 return;
749 }
750 self.bridge->AccessibilityObjectDidBecomeFocused(self.uid);
752 self.node.HasFlag(flutter::SemanticsFlags::kIsHeader)) {
753 [self showOnScreen];
754 }
756 self.bridge->DispatchSemanticsAction(self.uid,
758 }
759}
bool HasFlag(SemanticsFlags flag) const

◆ accessibilityElementDidLoseFocus

- (void) accessibilityElementDidLoseFocus
implementation

Reimplemented in TextInputSemanticsObject.

Definition at line 255 of file SemanticsObject.mm.

761 {
762 if (![self isAccessibilityBridgeAlive]) {
763 return;
764 }
765 self.bridge->AccessibilityObjectDidLoseFocus(self.uid);
767 self.bridge->DispatchSemanticsAction(self.uid,
769 }
770}

◆ accessibilityFrame

- (CGRect) accessibilityFrame
implementation

Definition at line 255 of file SemanticsObject.mm.

635 {
636 if (![self isAccessibilityBridgeAlive]) {
637 return CGRectMake(0, 0, 0, 0);
638 }
639
641 return [super accessibilityFrame];
642 }
643 return [self globalRect];
644}

◆ accessibilityHint

- (NSString *) accessibilityHint
implementation

Reimplemented in TextInputSemanticsObject.

Definition at line 255 of file SemanticsObject.mm.

580 {
581 if (![self isAccessibilityBridgeAlive]) {
582 return nil;
583 }
584
585 if (self.node.hint.empty()) {
586 return nil;
587 }
588 return @(self.node.hint.data());
589}

◆ accessibilityIdentifier

- (NSString *) accessibilityIdentifier
implementation

Definition at line 255 of file SemanticsObject.mm.

497 {
498 if (![self isAccessibilityBridgeAlive]) {
499 return nil;
500 }
501
502 if (self.node.identifier.empty()) {
503 return nil;
504 }
505 return @(self.node.identifier.data());
506}

◆ accessibilityIncrement

- (void) accessibilityIncrement
implementation

Definition at line 255 of file SemanticsObject.mm.

701 {
702 if (![self isAccessibilityBridgeAlive]) {
703 return;
704 }
706 self.node.value = self.node.increasedValue;
707 self.bridge->DispatchSemanticsAction(self.uid, flutter::SemanticsAction::kIncrease);
708 }
709}

◆ accessibilityLabel

- (NSString *) accessibilityLabel
implementation

Reimplemented in TextInputSemanticsObject.

Definition at line 255 of file SemanticsObject.mm.

508 {
509 if (![self isAccessibilityBridgeAlive]) {
510 return nil;
511 }
512 NSString* label = nil;
513 if (!self.node.label.empty()) {
514 label = @(self.node.label.data());
515 }
516 if (!self.node.tooltip.empty()) {
517 label = label ? [NSString stringWithFormat:@"%@\n%@", label, @(self.node.tooltip.data())]
518 : @(self.node.tooltip.data());
519 }
520 return label;
521}

◆ accessibilityPerformEscape

- (BOOL) accessibilityPerformEscape
implementation

Definition at line 255 of file SemanticsObject.mm.

733 {
734 if (![self isAccessibilityBridgeAlive]) {
735 return NO;
736 }
738 return NO;
739 }
740 self.bridge->DispatchSemanticsAction(self.uid, flutter::SemanticsAction::kDismiss);
741 return YES;
742}

◆ accessibilityScroll:

- (BOOL) accessibilityScroll: (UIAccessibilityScrollDirection)  direction
implementation

Definition at line 255 of file SemanticsObject.mm.

721 :(UIAccessibilityScrollDirection)direction {
722 if (![self isAccessibilityBridgeAlive]) {
723 return NO;
724 }
726 if (!self.node.HasAction(action)) {
727 return NO;
728 }
729 self.bridge->DispatchSemanticsAction(self.uid, action);
730 return YES;
731}
flutter::SemanticsAction GetSemanticsActionForScrollDirection(UIAccessibilityScrollDirection direction)

◆ accessibilityScrollToVisible

- (BOOL) accessibilityScrollToVisible
implementation

Provided by category SemanticsObject(Tests).

Definition at line 255 of file SemanticsObject.mm.

558 {
559 [self showOnScreen];
560 return YES;
561}

◆ accessibilityScrollToVisibleWithChild:

- (BOOL) accessibilityScrollToVisibleWithChild: (id child
implementation

Provided by category SemanticsObject(Tests).

Definition at line 255 of file SemanticsObject.mm.

564 :(id)child {
565 if ([child isKindOfClass:[SemanticsObject class]]) {
566 [child showOnScreen];
567 return YES;
568 }
569 return NO;
570}
const uintptr_t id

◆ accessibilityValue

- (NSString *) accessibilityValue
implementation

Reimplemented in FlutterSwitchSemanticsObject, and TextInputSemanticsObject.

Definition at line 255 of file SemanticsObject.mm.

599 {
600 if (![self isAccessibilityBridgeAlive]) {
601 return nil;
602 }
603
604 if (!self.node.value.empty()) {
605 return @(self.node.value.data());
606 }
607
608 // iOS does not announce values of native radio buttons.
610 return nil;
611 }
612
613 // FlutterSwitchSemanticsObject should supercede these conditionals.
617 self.node.HasFlag(flutter::SemanticsFlags::kIsChecked)) {
618 return @"1";
619 } else {
620 return @"0";
621 }
622 }
623
624 return nil;
625}

◆ collectRoutes:

- (void) collectRoutes: (NSMutableArray<SemanticsObject*>*)  edges

Definition at line 255 of file SemanticsObject.mm.

469 :(NSMutableArray<SemanticsObject*>*)edges {
471 [edges addObject:self];
472 }
473 if ([self hasChildren]) {
474 for (SemanticsObject* child in self.children) {
475 [child collectRoutes:edges];
476 }
477 }
478}
NSArray< SemanticsObject * > * children

◆ containsPoint:

- (bool) containsPoint: (CGPoint)  point
implementation

Definition at line 255 of file SemanticsObject.mm.

523 :(CGPoint)point {
524 // The point is in global coordinates, so use the global rect here.
525 return CGRectContainsPoint([self globalRect], point);
526}

◆ createAttributedStringFromString:withAttributes:

- (NSAttributedString *) createAttributedStringFromString: (NSString*)  string
withAttributes: (const flutter::StringAttributes&)  attributes 
implementation

Definition at line 255 of file SemanticsObject.mm.

400 :(NSString*)string
401 withAttributes:
402 (const flutter::StringAttributes&)attributes {
403 NSMutableAttributedString* attributedString =
404 [[NSMutableAttributedString alloc] initWithString:string];
405 for (const auto& attribute : attributes) {
406 NSRange range = NSMakeRange(attribute->start, attribute->end - attribute->start);
407 switch (attribute->type) {
409 std::shared_ptr<flutter::LocaleStringAttribute> locale_attribute =
410 std::static_pointer_cast<flutter::LocaleStringAttribute>(attribute);
411 NSDictionary* attributeDict = @{
412 UIAccessibilitySpeechAttributeLanguage : @(locale_attribute->locale.data()),
413 };
414 [attributedString setAttributes:attributeDict range:range];
415 break;
416 }
418 if (@available(iOS 13.0, *)) {
419 NSDictionary* attributeDict = @{
420 UIAccessibilitySpeechAttributeSpellOut : @YES,
421 };
422 [attributedString setAttributes:attributeDict range:range];
423 }
424 break;
425 }
426 }
427 }
428 return attributedString;
429}
std::vector< StringAttributePtr > StringAttributes

◆ dealloc

- (void) dealloc
implementation

Reimplemented in FlutterScrollableSemanticsObject.

Definition at line 255 of file SemanticsObject.mm.

280 {
281 // Set parent and children parents to nil explicitly in dealloc.
282 // -[UIAccessibilityElement dealloc] has in the past called into -accessibilityContainer
283 // and self.children. There have also been crashes related to iOS
284 // accessing methods during dealloc, and there's a lag before the tree changes.
285 // See https://github.com/flutter/engine/pull/4602 and
286 // https://github.com/flutter/engine/pull/27786.
287 for (SemanticsObject* child in _children) {
288 child.parent = nil;
289 }
290 [_children removeAllObjects];
291
292 _parent = nil;
293 _inDealloc = YES;
294}

◆ globalRect

- (CGRect) globalRect
implementation

Definition at line 255 of file SemanticsObject.mm.

646 {
647 const SkRect& rect = self.node.rect;
648 CGRect localRect = CGRectMake(rect.x(), rect.y(), rect.width(), rect.height());
649 return ConvertRectToGlobal(self, localRect);
650}
CGRect ConvertRectToGlobal(SemanticsObject *reference, CGRect local_rect)
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350

◆ initWithBridge:uid:

- (instancetype) initWithBridge: (fml::WeakPtr<flutter::AccessibilityBridgeIos>)  bridge
uid: (int32_t)  NS_DESIGNATED_INITIALIZER 

Reimplemented in FlutterSwitchSemanticsObject, FlutterScrollableSemanticsObject, FlutterSemanticsObject, TextInputSemanticsObject, and FlutterPlatformViewSemanticsContainer.

Definition at line 255 of file SemanticsObject.mm.

261 uid:(int32_t)uid {
262 FML_DCHECK(bridge) << "bridge must be set";
264 // Initialize with the UIView as the container.
265 // The UIView will not necessarily be accessibility parent for this object.
266 // The bridge informs the OS of the actual structure via
267 // `accessibilityContainer` and `accessibilityElementAtIndex`.
268 self = [super initWithAccessibilityContainer:bridge->view()];
269
270 if (self) {
271 _bridge = bridge;
272 _uid = uid;
273 _children = [[NSMutableArray alloc] init];
274 _childrenInHitTestOrder = [[NSArray alloc] init];
275 }
276
277 return self;
278}
#define FML_DCHECK(condition)
Definition: logging.h:103
fml::WeakPtr< flutter::AccessibilityBridgeIos > bridge
std::shared_ptr< flutter::AccessibilityBridgeMac > _bridge

◆ isAccessibilityBridgeAlive

- (BOOL) isAccessibilityBridgeAlive

Due to the fact that VoiceOver may hold onto SemanticObjects even after it shuts down, there can be situations where the AccessibilityBridge is shutdown, but the SemanticObject will still be alive. If VoiceOver is turned on again, it may try to access this orphaned SemanticObject. Methods that are called from the accessiblity framework should use this to guard against this case by just returning early if its bridge has been shutdown.

See https://github.com/flutter/flutter/issues/43795 for more information.

Definition at line 255 of file SemanticsObject.mm.

324 {
325 return self.bridge.get() != nil;
326}

◆ isAccessibilityElement

- (BOOL) isAccessibilityElement
implementation

Definition at line 255 of file SemanticsObject.mm.

437 {
438 if (![self isAccessibilityBridgeAlive]) {
439 return false;
440 }
441
442 // Note: hit detection will only apply to elements that report
443 // -isAccessibilityElement of YES. The framework will continue scanning the
444 // entire element tree looking for such a hit.
445
446 // We enforce in the framework that no other useful semantics are merged with these nodes.
448 return false;
449 }
450
451 return [self isFocusable];
452}

◆ isFocusable

- (bool) isFocusable
implementation

Definition at line 255 of file SemanticsObject.mm.

454 {
455 // If the node is scrollable AND hidden OR
456 // The node has a label, value, or hint OR
457 // The node has non-scrolling related actions.
458 //
459 // The kIsHidden flag set with the scrollable flag means this node is now
460 // hidden but still is a valid target for a11y focus in the tree, e.g. a list
461 // item that is currently off screen but the a11y navigation needs to know
462 // about.
463 return ((self.node.flags & flutter::kScrollableSemanticsFlags) != 0 &&
464 (self.node.flags & static_cast<int32_t>(flutter::SemanticsFlags::kIsHidden)) != 0) ||
465 !self.node.label.empty() || !self.node.value.empty() || !self.node.hint.empty() ||
466 (self.node.actions & ~flutter::kScrollableSemanticsActions) != 0;
467}
const int kScrollableSemanticsFlags
const int kScrollableSemanticsActions

◆ nodeShouldTriggerAnnouncement:

- (BOOL) nodeShouldTriggerAnnouncement: (const flutter::SemanticsNode*)  node

Whether calling setSemanticsNode: with node should trigger an announcement.

Definition at line 255 of file SemanticsObject.mm.

355 // The node dropped the live region flag, if it ever had one.
357 return NO;
358 }
359
360 // The node has gained a new live region flag, always announce.
362 return YES;
363 }
364
365 // The label has updated, and the new node has a live region flag.
366 return self.node.label != node->label;
367}

◆ nodeWillCauseLayoutChange:

- (BOOL) nodeWillCauseLayoutChange: (const flutter::SemanticsNode*)  node

Whether calling setSemanticsNode: with node would cause a layout change.

Definition at line 255 of file SemanticsObject.mm.

339 return self.node.rect != node->rect || self.node.transform != node->transform;
340}

◆ nodeWillCauseScroll:

- (BOOL) nodeWillCauseScroll: (const flutter::SemanticsNode*)  node

Whether calling setSemanticsNode: with node would cause a scroll event.

Definition at line 255 of file SemanticsObject.mm.

346 return !isnan(self.node.scrollPosition) && !isnan(node->scrollPosition) &&
347 self.node.scrollPosition != node->scrollPosition;
348}

◆ onCustomAccessibilityAction:

- (BOOL) onCustomAccessibilityAction: (FlutterCustomAccessibilityAction*)  action

Definition at line 255 of file SemanticsObject.mm.

482 return NO;
483 }
484 int32_t action_id = action.uid;
485 std::vector<uint8_t> args;
486 args.push_back(3); // type=int32.
487 args.push_back(action_id);
488 args.push_back(action_id >> 8);
489 args.push_back(action_id >> 16);
490 args.push_back(action_id >> 24);
491 self.bridge->DispatchSemanticsAction(
493 fml::MallocMapping::Copy(args.data(), args.size() * sizeof(uint8_t)));
494 return YES;
495}
static MallocMapping Copy(const T *begin, const T *end)
Definition: mapping.h:162
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args

◆ replaceChildAtIndex:withChild:

- (void) replaceChildAtIndex: (NSInteger)  index
withChild: (SemanticsObject*)  child 

Definition at line 255 of file SemanticsObject.mm.

369 :(NSInteger)index withChild:(SemanticsObject*)child {
370 SemanticsObject* oldChild = _children[index];
371 oldChild.parent = nil;
372 child.parent = self;
373 [_children replaceObjectAtIndex:index withObject:child];
374}

◆ routeName

- (NSString *) routeName

Definition at line 255 of file SemanticsObject.mm.

376 {
377 // Returns the first non-null and non-empty semantic label of a child
378 // with an NamesRoute flag. Otherwise returns nil.
380 NSString* newName = self.accessibilityLabel;
381 if (newName != nil && [newName length] > 0) {
382 return newName;
383 }
384 }
385 if ([self hasChildren]) {
386 for (SemanticsObject* child in self.children) {
387 NSString* newName = [child routeName];
388 if (newName != nil && [newName length] > 0) {
389 return newName;
390 }
391 }
392 }
393 return nil;
394}
size_t length

◆ search:

- (id) search: (CGPoint)  point
implementation

Definition at line 255 of file SemanticsObject.mm.

529 :(CGPoint)point {
530 // Search children in hit test order.
531 for (SemanticsObject* child in [self childrenInHitTestOrder]) {
532 if ([child containsPoint:point]) {
533 id childSearchResult = [child search:point];
534 if (childSearchResult != nil) {
535 return childSearchResult;
536 }
537 }
538 }
539 // Check if the current semantic object should be returned.
540 if ([self containsPoint:point] && [self isFocusable]) {
541 return self.nativeAccessibility;
542 }
543 return nil;
544}
NSArray< SemanticsObject * > * childrenInHitTestOrder

◆ setAccessibilityContainer:

- (void) setAccessibilityContainer: (id container
implementation

Definition at line 255 of file SemanticsObject.mm.

654 :(id)container {
655 // Explicit noop. The containers are calculated lazily in `accessibilityContainer`.
656 // See also: https://github.com/flutter/flutter/issues/54366
657}

◆ setChildren:

- (void) setChildren: (NSArray<SemanticsObject*>*)  children
implementation

Definition at line 255 of file SemanticsObject.mm.

298 :(NSArray<SemanticsObject*>*)children {
299 for (SemanticsObject* child in _children) {
300 child.parent = nil;
301 }
302 _children = [children mutableCopy];
303 for (SemanticsObject* child in _children) {
304 child.parent = self;
305 }
306}

◆ setChildrenInHitTestOrder:

- (void) setChildrenInHitTestOrder: (NSArray<SemanticsObject*>*)  childrenInHitTestOrder
implementation

Definition at line 255 of file SemanticsObject.mm.

308 :(NSArray<SemanticsObject*>*)childrenInHitTestOrder {
309 for (SemanticsObject* child in _childrenInHitTestOrder) {
310 child.parent = nil;
311 }
312 _childrenInHitTestOrder = [childrenInHitTestOrder copy];
313 for (SemanticsObject* child in _childrenInHitTestOrder) {
314 child.parent = self;
315 }
316}

◆ setSemanticsNode:

- (void) setSemanticsNode: (const flutter::SemanticsNode*)  NS_REQUIRES_SUPER

Updates this semantics object using data from the node argument.

Reimplemented in TextInputSemanticsObject.

Definition at line 255 of file SemanticsObject.mm.

329 _node = *node;
330}

◆ showOnScreen

- (void) showOnScreen
implementation

Definition at line 255 of file SemanticsObject.mm.

431 {
432 self.bridge->DispatchSemanticsAction(self.uid, flutter::SemanticsAction::kShowOnScreen);
433}

Property Documentation

◆ bridge

- (WeakPtr<)flutter:
readnonatomicassign

The accessibility bridge that this semantics object is attached to. This object may use the bridge to access contextual application information. A weak pointer is used because the platform view owns the accessibility bridge. If you are referencing this property from an iOS callback, be sure to use isAccessibilityBridgeActive to protect against the case where this node may be orphaned.

Definition at line 51 of file SemanticsObject.h.

◆ children

- (NSArray<SemanticsObject*>*) children
readwritenonatomiccopy

Direct children of this semantics object. Each child's parent property must be equal to this object.

Definition at line 67 of file SemanticsObject.h.

◆ childrenInHitTestOrder

- (NSArray<SemanticsObject*>*) childrenInHitTestOrder
readwritenonatomiccopy

Direct children of this semantics object in hit test order. Each child's parent property must be equal to this object.

Definition at line 73 of file SemanticsObject.h.

◆ container

- (SemanticsObjectContainer*) container
readwritenonatomicassignimplementation

Definition at line 246 of file SemanticsObject.mm.

◆ hasChildren

- (BOOL) hasChildren
readnonatomicassign

Whether this semantics object has child semantics objects.

Definition at line 61 of file SemanticsObject.h.

◆ nativeAccessibility

- (id) nativeAccessibility
readnonatomicassign

The UIAccessibility that represents this object.

By default, this return self. Subclasses can override to return different objects to represent them. For example, FlutterScrollableSemanticsObject[s] maintain UIScrollView[s] to represent their UIAccessibility[s].

Definition at line 82 of file SemanticsObject.h.

◆ node

- (SemanticsNode) SemanticsObject:
readnonatomicassign

The semantics node used to produce this semantics object.

Definition at line 56 of file SemanticsObject.h.

◆ parent

- (SemanticsObject*) parent
readnonatomicweak

The parent of this node in the node tree. Will be nil for the root node and during transient state changes.

Definition at line 41 of file SemanticsObject.h.

◆ uid

- (int32_t) uid
readnonatomicassign

The globally unique identifier for this node.

Definition at line 35 of file SemanticsObject.h.


The documentation for this class was generated from the following files: