Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Instance Methods | Properties | List of all members
SemanticsObject Class Reference

#include <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:
 
(instancetype) - init [implementation]
 
(void) - dealloc [implementation]
 
(void) - setChildren: [implementation]
 
(void) - setChildrenInHitTestOrder: [implementation]
 
(void) - privateSetParent: [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
 

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 269 of file SemanticsObject.mm.

583 :(CGPoint)point withEvent:(UIEvent*)event {
584 return [self search:point];
585}
FlKeyEvent * event

◆ accessibilityActivate

- (BOOL) accessibilityActivate
implementation

Reimplemented in TextInputSemanticsObject.

Definition at line 269 of file SemanticsObject.mm.

720 {
721 if (![self isAccessibilityBridgeAlive]) {
722 return NO;
723 }
724 if (![self node].HasAction(flutter::SemanticsAction::kTap)) {
725 return NO;
726 }
727 [self bridge]->DispatchSemanticsAction([self uid], flutter::SemanticsAction::kTap);
728 return YES;
729}
flutter::SemanticsNode node

◆ accessibilityAttributedHint

- (NSAttributedString *) accessibilityAttributedHint
implementation

Definition at line 269 of file SemanticsObject.mm.

621 {
622 NSString* hint = [self accessibilityHint];
623 if (hint.length == 0) {
624 return nil;
625 }
626 return [self createAttributedStringFromString:hint withAttributes:[self node].hintAttributes];
627}

◆ accessibilityAttributedLabel

- (NSAttributedString *) accessibilityAttributedLabel
implementation

Definition at line 269 of file SemanticsObject.mm.

602 {
603 NSString* label = [self accessibilityLabel];
604 if (label.length == 0) {
605 return nil;
606 }
607 return [self createAttributedStringFromString:label withAttributes:[self node].labelAttributes];
608}

◆ accessibilityAttributedValue

- (NSAttributedString *) accessibilityAttributedValue
implementation

Definition at line 269 of file SemanticsObject.mm.

657 {
658 NSString* value = [self accessibilityValue];
659 if (value.length == 0) {
660 return nil;
661 }
662 return [self createAttributedStringFromString:value withAttributes:[self node].valueAttributes];
663}
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 269 of file SemanticsObject.mm.

356 { /* Do nothing by default */
357}

◆ accessibilityContainer

- (id) accessibilityContainer
implementation

Definition at line 269 of file SemanticsObject.mm.

689 {
690 if (_inDealloc) {
691 // In iOS9, `accessibilityContainer` will be called by `[UIAccessibilityElementSuperCategory
692 // dealloc]` during `[super dealloc]`. And will crash when accessing `_children` which has
693 // called `[_children release]` in `[SemanticsObject dealloc]`.
694 // https://github.com/flutter/flutter/issues/87247
695 return nil;
696 }
697
698 if (![self isAccessibilityBridgeAlive]) {
699 return nil;
700 }
701
702 if ([self hasChildren] || [self uid] == kRootNodeId) {
703 if (_container == nil) {
704 _container.reset([[SemanticsObjectContainer alloc] initWithSemanticsObject:self
705 bridge:[self bridge]]);
706 }
707 return _container.get();
708 }
709 if ([self parent] == nil) {
710 // This can happen when we have released the accessibility tree but iOS is
711 // still holding onto our objects. iOS can take some time before it
712 // realizes that the tree has changed.
713 return nil;
714 }
715 return [[self parent] accessibilityContainer];
716}
constexpr int32_t kRootNodeId
BOOL _inDealloc
SemanticsObject * parent
fml::WeakPtr< flutter::AccessibilityBridgeIos > bridge

◆ accessibilityDecrement

- (void) accessibilityDecrement
implementation

Definition at line 269 of file SemanticsObject.mm.

741 {
742 if (![self isAccessibilityBridgeAlive]) {
743 return;
744 }
745 if ([self node].HasAction(flutter::SemanticsAction::kDecrease)) {
746 [self node].value = [self node].decreasedValue;
747 [self bridge]->DispatchSemanticsAction([self uid], flutter::SemanticsAction::kDecrease);
748 }
749}

◆ accessibilityElementDidBecomeFocused

- (void) accessibilityElementDidBecomeFocused
implementation

Reimplemented in TextInputSemanticsObject.

Definition at line 269 of file SemanticsObject.mm.

776 {
777 if (![self isAccessibilityBridgeAlive]) {
778 return;
779 }
780 [self bridge]->AccessibilityObjectDidBecomeFocused([self uid]);
781 if ([self node].HasFlag(flutter::SemanticsFlags::kIsHidden) ||
783 [self showOnScreen];
784 }
786 [self bridge]->DispatchSemanticsAction([self uid],
788 }
789}

◆ accessibilityElementDidLoseFocus

- (void) accessibilityElementDidLoseFocus
implementation

Reimplemented in TextInputSemanticsObject.

Definition at line 269 of file SemanticsObject.mm.

791 {
792 if (![self isAccessibilityBridgeAlive]) {
793 return;
794 }
795 [self bridge]->AccessibilityObjectDidLoseFocus([self uid]);
797 [self bridge]->DispatchSemanticsAction([self uid],
799 }
800}

◆ accessibilityFrame

- (CGRect) accessibilityFrame
implementation

Definition at line 269 of file SemanticsObject.mm.

665 {
666 if (![self isAccessibilityBridgeAlive]) {
667 return CGRectMake(0, 0, 0, 0);
668 }
669
670 if ([self node].HasFlag(flutter::SemanticsFlags::kIsHidden)) {
671 return [super accessibilityFrame];
672 }
673 return [self globalRect];
674}

◆ accessibilityHint

- (NSString *) accessibilityHint
implementation

Reimplemented in TextInputSemanticsObject.

Definition at line 269 of file SemanticsObject.mm.

610 {
611 if (![self isAccessibilityBridgeAlive]) {
612 return nil;
613 }
614
615 if ([self node].hint.empty()) {
616 return nil;
617 }
618 return @([self node].hint.data());
619}

◆ accessibilityIdentifier

- (NSString *) accessibilityIdentifier
implementation

Definition at line 269 of file SemanticsObject.mm.

527 {
528 if (![self isAccessibilityBridgeAlive]) {
529 return nil;
530 }
531
532 if ([self node].identifier.empty()) {
533 return nil;
534 }
535 return @([self node].identifier.data());
536}
static SkString identifier(const FontFamilyDesc &family, const FontDesc &font)

◆ accessibilityIncrement

- (void) accessibilityIncrement
implementation

Definition at line 269 of file SemanticsObject.mm.

731 {
732 if (![self isAccessibilityBridgeAlive]) {
733 return;
734 }
735 if ([self node].HasAction(flutter::SemanticsAction::kIncrease)) {
736 [self node].value = [self node].increasedValue;
737 [self bridge]->DispatchSemanticsAction([self uid], flutter::SemanticsAction::kIncrease);
738 }
739}

◆ accessibilityLabel

- (NSString *) accessibilityLabel
implementation

Reimplemented in TextInputSemanticsObject.

Definition at line 269 of file SemanticsObject.mm.

538 {
539 if (![self isAccessibilityBridgeAlive]) {
540 return nil;
541 }
542 NSString* label = nil;
543 if (![self node].label.empty()) {
544 label = @([self node].label.data());
545 }
546 if (![self node].tooltip.empty()) {
547 label = label ? [NSString stringWithFormat:@"%@\n%@", label, @([self node].tooltip.data())]
548 : @([self node].tooltip.data());
549 }
550 return label;
551}

◆ accessibilityPerformEscape

- (BOOL) accessibilityPerformEscape
implementation

Definition at line 269 of file SemanticsObject.mm.

763 {
764 if (![self isAccessibilityBridgeAlive]) {
765 return NO;
766 }
767 if (![self node].HasAction(flutter::SemanticsAction::kDismiss)) {
768 return NO;
769 }
770 [self bridge]->DispatchSemanticsAction([self uid], flutter::SemanticsAction::kDismiss);
771 return YES;
772}

◆ accessibilityScroll:

- (BOOL) accessibilityScroll: (UIAccessibilityScrollDirection)  direction
implementation

Definition at line 269 of file SemanticsObject.mm.

751 :(UIAccessibilityScrollDirection)direction {
752 if (![self isAccessibilityBridgeAlive]) {
753 return NO;
754 }
755 flutter::SemanticsAction action = GetSemanticsActionForScrollDirection(direction);
756 if (![self node].HasAction(action)) {
757 return NO;
758 }
759 [self bridge]->DispatchSemanticsAction([self uid], action);
760 return YES;
761}

◆ accessibilityScrollToVisible

- (BOOL) accessibilityScrollToVisible
implementation

Provided by category SemanticsObject(Tests).

Definition at line 269 of file SemanticsObject.mm.

588 {
589 [self showOnScreen];
590 return YES;
591}

◆ accessibilityScrollToVisibleWithChild:

- (BOOL) accessibilityScrollToVisibleWithChild: (id child
implementation

Provided by category SemanticsObject(Tests).

Definition at line 269 of file SemanticsObject.mm.

594 :(id)child {
595 if ([child isKindOfClass:[SemanticsObject class]]) {
596 [child showOnScreen];
597 return YES;
598 }
599 return NO;
600}
const uintptr_t id

◆ accessibilityValue

- (NSString *) accessibilityValue
implementation

Reimplemented in TextInputSemanticsObject, and FlutterSwitchSemanticsObject.

Definition at line 269 of file SemanticsObject.mm.

629 {
630 if (![self isAccessibilityBridgeAlive]) {
631 return nil;
632 }
633
634 if (![self node].value.empty()) {
635 return @([self node].value.data());
636 }
637
638 // iOS does not announce values of native radio buttons.
640 return nil;
641 }
642
643 // FlutterSwitchSemanticsObject should supercede these conditionals.
645 [self node].HasFlag(flutter::SemanticsFlags::kHasCheckedState)) {
646 if ([self node].HasFlag(flutter::SemanticsFlags::kIsToggled) ||
647 [self node].HasFlag(flutter::SemanticsFlags::kIsChecked)) {
648 return @"1";
649 } else {
650 return @"0";
651 }
652 }
653
654 return nil;
655}

◆ collectRoutes:

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

Definition at line 269 of file SemanticsObject.mm.

499 :(NSMutableArray<SemanticsObject*>*)edges {
500 if ([self node].HasFlag(flutter::SemanticsFlags::kScopesRoute)) {
501 [edges addObject:self];
502 }
503 if ([self hasChildren]) {
504 for (SemanticsObject* child in self.children) {
505 [child collectRoutes:edges];
506 }
507 }
508}
NSArray< SemanticsObject * > * children

◆ containsPoint:

- (bool) containsPoint: (CGPoint)  point
implementation

Definition at line 269 of file SemanticsObject.mm.

553 :(CGPoint)point {
554 // The point is in global coordinates, so use the global rect here.
555 return CGRectContainsPoint([self globalRect], point);
556}

◆ createAttributedStringFromString:withAttributes:

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

Definition at line 269 of file SemanticsObject.mm.

430 :(NSString*)string
431 withAttributes:
432 (const flutter::StringAttributes&)attributes {
433 NSMutableAttributedString* attributedString =
434 [[[NSMutableAttributedString alloc] initWithString:string] autorelease];
435 for (const auto& attribute : attributes) {
436 NSRange range = NSMakeRange(attribute->start, attribute->end - attribute->start);
437 switch (attribute->type) {
439 std::shared_ptr<flutter::LocaleStringAttribute> locale_attribute =
440 std::static_pointer_cast<flutter::LocaleStringAttribute>(attribute);
441 NSDictionary* attributeDict = @{
442 UIAccessibilitySpeechAttributeLanguage : @(locale_attribute->locale.data()),
443 };
444 [attributedString setAttributes:attributeDict range:range];
445 break;
446 }
448 if (@available(iOS 13.0, *)) {
449 NSDictionary* attributeDict = @{
450 UIAccessibilitySpeechAttributeSpellOut : @YES,
451 };
452 [attributedString setAttributes:attributeDict range:range];
453 }
454 break;
455 }
456 }
457 }
458 return attributedString;
459}
std::vector< StringAttributePtr > StringAttributes

◆ dealloc

- (void) dealloc
implementation

Reimplemented in TextInputSemanticsObject, FlutterSwitchSemanticsObject, FlutterScrollableSemanticsObject, and FlutterPlatformViewSemanticsContainer.

Definition at line 269 of file SemanticsObject.mm.

303 {
304 for (SemanticsObject* child in _children) {
305 [child privateSetParent:nil];
306 }
307 [_children removeAllObjects];
308 [_childrenInHitTestOrder removeAllObjects];
309 [_children release];
310 [_childrenInHitTestOrder release];
311
312 _parent = nil;
313 _container.get().semanticsObject = nil;
314 _inDealloc = YES;
315 [super dealloc];
316}
NSMutableArray< SemanticsObject * > * _children

◆ globalRect

- (CGRect) globalRect
implementation

Definition at line 269 of file SemanticsObject.mm.

676 {
677 const SkRect& rect = [self node].rect;
678 CGRect localRect = CGRectMake(rect.x(), rect.y(), rect.width(), rect.height());
679 return ConvertRectToGlobal(self, localRect);
680}
sk_sp< SkBlender > blender SkRect rect
Definition SkRecords.h:350

◆ init

- (instancetype) init
implementation

Definition at line 269 of file SemanticsObject.mm.

275 {
276 [self release];
277 [super doesNotRecognizeSelector:_cmd];
278 return nil;
279}

◆ initWithBridge:uid:

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

Reimplemented in TextInputSemanticsObject, FlutterSwitchSemanticsObject, FlutterScrollableSemanticsObject, and FlutterPlatformViewSemanticsContainer.

Definition at line 269 of file SemanticsObject.mm.

284 uid:(int32_t)uid {
285 FML_DCHECK(bridge) << "bridge must be set";
287 // Initialize with the UIView as the container.
288 // The UIView will not necessarily be accessibility parent for this object.
289 // The bridge informs the OS of the actual structure via
290 // `accessibilityContainer` and `accessibilityElementAtIndex`.
291 self = [super initWithAccessibilityContainer:bridge->view()];
292
293 if (self) {
294 _bridge = bridge;
295 _uid = uid;
296 _children = [[NSMutableArray alloc] init];
297 _childrenInHitTestOrder = [[NSMutableArray alloc] init];
298 }
299
300 return self;
301}
NSMutableArray< SemanticsObject * > * _childrenInHitTestOrder
fml::WeakPtr< flutter::AccessibilityBridgeIos > _bridge
#define FML_DCHECK(condition)
Definition logging.h:103

◆ 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 269 of file SemanticsObject.mm.

348 {
349 return [self bridge].get() != nil;
350}

◆ isAccessibilityElement

- (BOOL) isAccessibilityElement
implementation

Definition at line 269 of file SemanticsObject.mm.

467 {
468 if (![self isAccessibilityBridgeAlive]) {
469 return false;
470 }
471
472 // Note: hit detection will only apply to elements that report
473 // -isAccessibilityElement of YES. The framework will continue scanning the
474 // entire element tree looking for such a hit.
475
476 // We enforce in the framework that no other useful semantics are merged with these nodes.
477 if ([self node].HasFlag(flutter::SemanticsFlags::kScopesRoute)) {
478 return false;
479 }
480
481 return [self isFocusable];
482}

◆ isFocusable

- (bool) isFocusable
implementation

Definition at line 269 of file SemanticsObject.mm.

484 {
485 // If the node is scrollable AND hidden OR
486 // The node has a label, value, or hint OR
487 // The node has non-scrolling related actions.
488 //
489 // The kIsHidden flag set with the scrollable flag means this node is now
490 // hidden but still is a valid target for a11y focus in the tree, e.g. a list
491 // item that is currently off screen but the a11y navigation needs to know
492 // about.
493 return (([self node].flags & flutter::kScrollableSemanticsFlags) != 0 &&
494 ([self node].flags & static_cast<int32_t>(flutter::SemanticsFlags::kIsHidden)) != 0) ||
495 ![self node].label.empty() || ![self node].value.empty() || ![self node].hint.empty() ||
496 ([self node].actions & ~flutter::kScrollableSemanticsActions) != 0;
497}
FlutterSemanticsFlag flags
const int kScrollableSemanticsFlags

◆ nodeShouldTriggerAnnouncement:

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

Whether calling setSemanticsNode: with node should trigger an announcement.

Definition at line 269 of file SemanticsObject.mm.

379 // The node dropped the live region flag, if it ever had one.
381 return NO;
382 }
383
384 // The node has gained a new live region flag, always announce.
385 if (![self node].HasFlag(flutter::SemanticsFlags::kIsLiveRegion)) {
386 return YES;
387 }
388
389 // The label has updated, and the new node has a live region flag.
390 return [self node].label != node->label;
391}
bool HasFlag(SemanticsFlags flag) const

◆ nodeWillCauseLayoutChange:

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

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

Definition at line 269 of file SemanticsObject.mm.

363 return [self node].rect != node->rect || [self node].transform != node->transform;
364}

◆ nodeWillCauseScroll:

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

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

Definition at line 269 of file SemanticsObject.mm.

370 return !isnan([self node].scrollPosition) && !isnan(node->scrollPosition) &&
371 [self node].scrollPosition != node->scrollPosition;
372}

◆ onCustomAccessibilityAction:

- (BOOL) onCustomAccessibilityAction: (FlutterCustomAccessibilityAction*)  action

Definition at line 269 of file SemanticsObject.mm.

511 if (![self node].HasAction(flutter::SemanticsAction::kCustomAction)) {
512 return NO;
513 }
514 int32_t action_id = action.uid;
515 std::vector<uint8_t> args;
516 args.push_back(3); // type=int32.
517 args.push_back(action_id);
518 args.push_back(action_id >> 8);
519 args.push_back(action_id >> 16);
520 args.push_back(action_id >> 24);
521 [self bridge]->DispatchSemanticsAction(
523 fml::MallocMapping::Copy(args.data(), args.size() * sizeof(uint8_t)));
524 return YES;
525}
static MallocMapping Copy(const T *begin, const T *end)
Definition mapping.h:162
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args

◆ privateSetParent:

- (void) privateSetParent: (SemanticsObject *)  parent
implementation

Should only be called in conjunction with setting child/parent relationship.

Definition at line 269 of file SemanticsObject.mm.

427 _parent = parent;
428}

◆ replaceChildAtIndex:withChild:

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

Definition at line 269 of file SemanticsObject.mm.

393 :(NSInteger)index withChild:(SemanticsObject*)child {
394 SemanticsObject* oldChild = _children[index];
395 [oldChild privateSetParent:nil];
396 [child privateSetParent:self];
397 [_children replaceObjectAtIndex:index withObject:child];
398}
void privateSetParent:(SemanticsObject *parent)

◆ routeName

- (NSString *) routeName

Definition at line 269 of file SemanticsObject.mm.

400 {
401 // Returns the first non-null and non-empty semantic label of a child
402 // with an NamesRoute flag. Otherwise returns nil.
403 if ([self node].HasFlag(flutter::SemanticsFlags::kNamesRoute)) {
404 NSString* newName = [self accessibilityLabel];
405 if (newName != nil && [newName length] > 0) {
406 return newName;
407 }
408 }
409 if ([self hasChildren]) {
410 for (SemanticsObject* child in self.children) {
411 NSString* newName = [child routeName];
412 if (newName != nil && [newName length] > 0) {
413 return newName;
414 }
415 }
416 }
417 return nil;
418}
size_t length

◆ search:

- (id) search: (CGPoint)  point
implementation

Definition at line 269 of file SemanticsObject.mm.

559 :(CGPoint)point {
560 // Search children in hit test order.
561 for (SemanticsObject* child in [self childrenInHitTestOrder]) {
562 if ([child containsPoint:point]) {
563 id childSearchResult = [child search:point];
564 if (childSearchResult != nil) {
565 return childSearchResult;
566 }
567 }
568 }
569 // Check if the current semantic object should be returned.
570 if ([self containsPoint:point] && [self isFocusable]) {
571 return self.nativeAccessibility;
572 }
573 return nil;
574}
NSArray< SemanticsObject * > * childrenInHitTestOrder

◆ setAccessibilityContainer:

- (void) setAccessibilityContainer: (id container
implementation

Definition at line 269 of file SemanticsObject.mm.

684 :(id)container {
685 // Explicit noop. The containers are calculated lazily in `accessibilityContainer`.
686 // See also: https://github.com/flutter/flutter/issues/54366
687}

◆ setChildren:

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

Definition at line 269 of file SemanticsObject.mm.

320 :(NSArray<SemanticsObject*>*)children {
321 for (SemanticsObject* child in _children) {
322 [child privateSetParent:nil];
323 }
324 [_children release];
325 _children = [[NSMutableArray alloc] initWithArray:children];
326 for (SemanticsObject* child in _children) {
327 [child privateSetParent:self];
328 }
329}

◆ setChildrenInHitTestOrder:

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

Definition at line 269 of file SemanticsObject.mm.

331 :(NSArray<SemanticsObject*>*)childrenInHitTestOrder {
333 [child privateSetParent:nil];
334 }
335 [_childrenInHitTestOrder release];
336 _childrenInHitTestOrder = [[NSMutableArray alloc] initWithArray:childrenInHitTestOrder];
338 [child privateSetParent:self];
339 }
340}

◆ 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 269 of file SemanticsObject.mm.

353 _node = *node;
354}

◆ showOnScreen

- (void) showOnScreen
implementation

Definition at line 269 of file SemanticsObject.mm.

461 {
462 [self bridge]->DispatchSemanticsAction([self uid], flutter::SemanticsAction::kShowOnScreen);
463}

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
readwritenonatomicstrong

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
readwritenonatomicstrong

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.

◆ 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
readwritenonatomicassign

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: