Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Instance Methods | List of all members
AXPlatformNodeCocoa(Private) Category Reference

Instance Methods

(NSString *) - getStringAttribute:
 
(NSString *) - getAXValueAsString
 
(std::unique_ptr< AnnouncementSpec >) - announcementForEvent:
 
(void) - scheduleLiveRegionAnnouncement:
 

Detailed Description

Definition at line 341 of file ax_platform_node_mac.mm.

Method Documentation

◆ announcementForEvent:

- (unique_ptr< AnnouncementSpec > AXPlatformNodeCocoa(Private)): (ax::mojom::Event eventType

Extends class AXPlatformNodeCocoa.

Definition at line 359 of file ax_platform_node_mac.mm.

419 :(ax::mojom::Event)eventType {
420 // Only alerts and live region changes should be announced.
421 BASE_DCHECK(eventType == ax::mojom::Event::kAlert ||
422 eventType == ax::mojom::Event::kLiveRegionChanged);
423 std::string liveStatus = _node->GetStringAttribute(ax::mojom::StringAttribute::kLiveStatus);
424 // If live status is explicitly set to off, don't announce.
425 if (liveStatus == "off")
426 return nullptr;
427
428 NSString* name = [self getName];
429 NSString* announcementText = name;
430 if ([announcementText length] <= 0) {
431 announcementText = @(base::UTF16ToUTF8(_node->GetInnerText()).data());
432 }
433 if ([announcementText length] == 0)
434 return nullptr;
435
436 auto announcement = std::make_unique<AnnouncementSpec>();
437 announcement->announcement = base::scoped_nsobject<NSString>([announcementText retain]);
438 announcement->window = base::scoped_nsobject<NSWindow>([[self AXWindowInternal] retain]);
439 announcement->is_polite = liveStatus != "assertive";
440 return announcement;
441}
const char * name
Definition fuchsia.cc:50
size_t length
std::string UTF16ToUTF8(std::u16string src)
#define BASE_DCHECK(condition)
Definition logging.h:63

◆ getAXValueAsString

- (NSString *) getAXValueAsString

Extends class AXPlatformNodeCocoa.

Definition at line 359 of file ax_platform_node_mac.mm.

410 {
411 id value = [self AXValueInternal];
412 return [value isKindOfClass:[NSString class]] ? value : nil;
413}
uint8_t value

◆ getStringAttribute:

- (NSString *) getStringAttribute: (ax::mojom::StringAttribute attribute

Extends class AXPlatformNodeCocoa.

Definition at line 359 of file ax_platform_node_mac.mm.

403 :(ax::mojom::StringAttribute)attribute {
404 std::string attributeValue;
405 if (_node->GetStringAttribute(attribute, &attributeValue))
406 return @(attributeValue.data());
407 return nil;
408}

◆ scheduleLiveRegionAnnouncement:

- (void) scheduleLiveRegionAnnouncement: (std::unique_ptr< AnnouncementSpec >)  announcement

Extends class AXPlatformNodeCocoa.

Definition at line 359 of file ax_platform_node_mac.mm.

443 :(std::unique_ptr<AnnouncementSpec>)announcement {
445 // An announcement is already in flight, so just reset the contents. This is
446 // threadsafe because the dispatch is on the main queue.
447 _pendingAnnouncement = std::move(announcement);
448 return;
449 }
450
451 _pendingAnnouncement = std::move(announcement);
452 dispatch_after(kLiveRegionDebounceMillis * NSEC_PER_MSEC, dispatch_get_main_queue(), ^{
454 return;
455 }
456 PostAnnouncementNotification(_pendingAnnouncement->announcement, _pendingAnnouncement->window,
457 _pendingAnnouncement->is_polite);
458 _pendingAnnouncement.reset();
459 });
460}
std::unique_ptr< AnnouncementSpec > _pendingAnnouncement

The documentation for this category was generated from the following file: