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

#include <accessibility_text_entry.h>

Inheritance diagram for TextInputSemanticsObject:
SemanticsObject

Instance Methods

(instancetype) - initWithBridge:uid: [implementation]
 
(void) - dealloc [implementation]
 
(void) - setSemanticsNode: [implementation]
 
(UIView< UITextInput > *) - textInputSurrogate [implementation]
 
(UIView *) - textInputView [implementation]
 
(void) - accessibilityElementDidBecomeFocused [implementation]
 
(void) - accessibilityElementDidLoseFocus [implementation]
 
(BOOL- accessibilityElementIsFocused [implementation]
 
(BOOL- accessibilityActivate [implementation]
 
(NSString *) - accessibilityLabel [implementation]
 
(NSString *) - accessibilityHint [implementation]
 
(NSString *) - accessibilityValue [implementation]
 
(UIAccessibilityTraits) - accessibilityTraits [implementation]
 
(NSString *) - textInRange: [implementation]
 
(void) - replaceRange:withText: [implementation]
 
(BOOL- shouldChangeTextInRange:replacementText: [implementation]
 
(UITextRange *) - selectedTextRange [implementation]
 
(void) - setSelectedTextRange: [implementation]
 
(UITextRange *) - markedTextRange [implementation]
 
(NSDictionary *) - markedTextStyle [implementation]
 
(void) - setMarkedTextStyle: [implementation]
 
(void) - setMarkedText:selectedRange: [implementation]
 
(void) - unmarkText [implementation]
 
(UITextStorageDirection) - selectionAffinity [implementation]
 
(UITextPosition *) - beginningOfDocument [implementation]
 
(UITextPosition *) - endOfDocument [implementation]
 
(id< UITextInputDelegate >) - inputDelegate [implementation]
 
(void) - setInputDelegate: [implementation]
 
(id< UITextInputTokenizer >) - tokenizer [implementation]
 
(UITextRange *) - textRangeFromPosition:toPosition: [implementation]
 
(UITextPosition *) - positionFromPosition:offset: [implementation]
 
(UITextPosition *) - positionFromPosition:inDirection:offset: [implementation]
 
(NSComparisonResult) - comparePosition:toPosition: [implementation]
 
(NSInteger) - offsetFromPosition:toPosition: [implementation]
 
(UITextPosition *) - positionWithinRange:farthestInDirection: [implementation]
 
(UITextRange *) - characterRangeByExtendingPosition:inDirection: [implementation]
 
(UITextWritingDirection) - baseWritingDirectionForPosition:inDirection: [implementation]
 
(void) - setBaseWritingDirection:forRange: [implementation]
 
(CGRect) - firstRectForRange: [implementation]
 
(CGRect) - caretRectForPosition: [implementation]
 
(UITextPosition *) - closestPositionToPoint: [implementation]
 
(UITextPosition *) - closestPositionToPoint:withinRange: [implementation]
 
(NSArray *) - selectionRectsForRange: [implementation]
 
(UITextRange *) - characterRangeAtPoint: [implementation]
 
(void) - insertText: [implementation]
 
(void) - deleteBackward [implementation]
 
(BOOL- hasText [implementation]
 
- Instance Methods inherited from SemanticsObject
(BOOL- isAccessibilityBridgeAlive
 
(void) - replaceChildAtIndex:withChild:
 
(BOOL- nodeWillCauseLayoutChange:
 
(BOOL- nodeWillCauseScroll:
 
(BOOL- nodeShouldTriggerAnnouncement:
 
(void) - collectRoutes:
 
(NSString *) - routeName
 
(BOOL- onCustomAccessibilityAction:
 
(void) - accessibilityBridgeDidFinishUpdate
 
((unavailable("Use initWithBridge instead") - __attribute__
 
(instancetype) - init [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]
 
(bool) - containsPoint: [implementation]
 
(id- search: [implementation]
 
(id- _accessibilityHitTest:withEvent: [implementation]
 
(BOOL- accessibilityScrollToVisible [implementation]
 
(BOOL- accessibilityScrollToVisibleWithChild: [implementation]
 
(NSAttributedString *) - accessibilityAttributedLabel [implementation]
 
(NSAttributedString *) - accessibilityAttributedHint [implementation]
 
(NSAttributedString *) - accessibilityAttributedValue [implementation]
 
(CGRect) - accessibilityFrame [implementation]
 
(CGRect) - globalRect [implementation]
 
(void) - setAccessibilityContainer: [implementation]
 
(id- accessibilityContainer [implementation]
 
(void) - accessibilityIncrement [implementation]
 
(void) - accessibilityDecrement [implementation]
 
(BOOL- accessibilityScroll: [implementation]
 
(BOOL- accessibilityPerformEscape [implementation]
 

Additional Inherited Members

- Properties inherited from SemanticsObject
int32_t uid
 
SemanticsObjectparent
 
fml::WeakPtr< flutter::AccessibilityBridgeIosbridge
 
flutter::SemanticsNode node
 
BOOL hasChildren
 
NSArray< SemanticsObject * > * children
 
NSArray< SemanticsObject * > * childrenInHitTestOrder
 
id nativeAccessibility
 

Detailed Description

An implementation of SemanticsObject specialized for expressing text fields.

Delegates to FlutterTextInputView when the object corresponds to a text field that currently owns input focus. Delegates to FlutterInactiveTextInput otherwise.

Definition at line 33 of file accessibility_text_entry.h.

Method Documentation

◆ accessibilityActivate

- (BOOL) accessibilityActivate
implementation

Reimplemented from SemanticsObject.

Definition at line 10 of file accessibility_text_entry.mm.

262 {
263 if (![self isAccessibilityBridgeAlive]) {
264 return false;
265 }
266 return [[self textInputSurrogate] accessibilityActivate];
267}

◆ accessibilityElementDidBecomeFocused

- (void) accessibilityElementDidBecomeFocused
implementation

Reimplemented from SemanticsObject.

Definition at line 10 of file accessibility_text_entry.mm.

239 {
240 if (![self isAccessibilityBridgeAlive]) {
241 return;
242 }
243 [[self textInputSurrogate] accessibilityElementDidBecomeFocused];
244 [super accessibilityElementDidBecomeFocused];
245}

◆ accessibilityElementDidLoseFocus

- (void) accessibilityElementDidLoseFocus
implementation

Reimplemented from SemanticsObject.

Definition at line 10 of file accessibility_text_entry.mm.

247 {
248 if (![self isAccessibilityBridgeAlive]) {
249 return;
250 }
251 [[self textInputSurrogate] accessibilityElementDidLoseFocus];
252 [super accessibilityElementDidLoseFocus];
253}

◆ accessibilityElementIsFocused

- (BOOL) accessibilityElementIsFocused
implementation

Definition at line 10 of file accessibility_text_entry.mm.

255 {
256 if (![self isAccessibilityBridgeAlive]) {
257 return false;
258 }
259 return [self node].HasFlag(flutter::SemanticsFlags::kIsFocused);
260}

◆ accessibilityHint

- (NSString *) accessibilityHint
implementation

Reimplemented from SemanticsObject.

Definition at line 10 of file accessibility_text_entry.mm.

281 {
282 if (![self isAccessibilityBridgeAlive]) {
283 return nil;
284 }
285 NSString* hint = [super accessibilityHint];
286 if (hint != nil) {
287 return hint;
288 }
289 return [self textInputSurrogate].accessibilityHint;
290}

◆ accessibilityLabel

- (NSString *) accessibilityLabel
implementation

Reimplemented from SemanticsObject.

Definition at line 10 of file accessibility_text_entry.mm.

269 {
270 if (![self isAccessibilityBridgeAlive]) {
271 return nil;
272 }
273
274 NSString* label = [super accessibilityLabel];
275 if (label != nil) {
276 return label;
277 }
278 return [self textInputSurrogate].accessibilityLabel;
279}

◆ accessibilityTraits

- (UIAccessibilityTraits) accessibilityTraits
implementation

Definition at line 10 of file accessibility_text_entry.mm.

303 {
304 if (![self isAccessibilityBridgeAlive]) {
305 return 0;
306 }
307 UIAccessibilityTraits results =
308 [super accessibilityTraits] | [self textInputSurrogate].accessibilityTraits;
309 // We remove an undocumented flag to get rid of a bug where single-tapping
310 // a text input field incorrectly says "empty line".
311 // See also: https://github.com/flutter/flutter/issues/52487
312 return results & (~kUIAccessibilityTraitUndocumentedEmptyLine);
313}

◆ accessibilityValue

- (NSString *) accessibilityValue
implementation

Reimplemented from SemanticsObject.

Definition at line 10 of file accessibility_text_entry.mm.

292 {
293 if (![self isAccessibilityBridgeAlive]) {
294 return nil;
295 }
296 NSString* value = [super accessibilityValue];
297 if (value != nil) {
298 return value;
299 }
300 return [self textInputSurrogate].accessibilityValue;
301}
uint8_t value

◆ baseWritingDirectionForPosition:inDirection:

- (UITextWritingDirection) baseWritingDirectionForPosition: (UITextPosition*)  position
inDirection: (UITextStorageDirection)  direction 
implementation

Definition at line 10 of file accessibility_text_entry.mm.

417 :(UITextPosition*)position
418 inDirection:(UITextStorageDirection)direction {
419 return [[self textInputSurrogate] baseWritingDirectionForPosition:position inDirection:direction];
420}
UIView< UITextInput > * textInputSurrogate()

◆ beginningOfDocument

- (UITextPosition *) beginningOfDocument
implementation

Definition at line 10 of file accessibility_text_entry.mm.

361 {
362 return [[self textInputSurrogate] beginningOfDocument];
363}

◆ caretRectForPosition:

- (CGRect) caretRectForPosition: (UITextPosition*)  position
implementation

Definition at line 10 of file accessibility_text_entry.mm.

431 :(UITextPosition*)position {
432 return [[self textInputSurrogate] caretRectForPosition:position];
433}

◆ characterRangeAtPoint:

- (UITextRange *) characterRangeAtPoint: (CGPoint)  point
implementation

Definition at line 10 of file accessibility_text_entry.mm.

447 :(CGPoint)point {
448 return [[self textInputSurrogate] characterRangeAtPoint:point];
449}

◆ characterRangeByExtendingPosition:inDirection:

- (UITextRange *) characterRangeByExtendingPosition: (UITextPosition*)  position
inDirection: (UITextLayoutDirection)  direction 
implementation

Definition at line 10 of file accessibility_text_entry.mm.

411 :(UITextPosition*)position
412 inDirection:(UITextLayoutDirection)direction {
413 return [[self textInputSurrogate] characterRangeByExtendingPosition:position
414 inDirection:direction];
415}

◆ closestPositionToPoint:

- (UITextPosition *) closestPositionToPoint: (CGPoint)  point
implementation

Definition at line 10 of file accessibility_text_entry.mm.

435 :(CGPoint)point {
436 return [[self textInputSurrogate] closestPositionToPoint:point];
437}

◆ closestPositionToPoint:withinRange:

- (UITextPosition *) closestPositionToPoint: (CGPoint)  point
withinRange: (UITextRange*)  range 
implementation

Definition at line 10 of file accessibility_text_entry.mm.

439 :(CGPoint)point withinRange:(UITextRange*)range {
440 return [[self textInputSurrogate] closestPositionToPoint:point withinRange:range];
441}

◆ comparePosition:toPosition:

- (NSComparisonResult) comparePosition: (UITextPosition*)  position
toPosition: (UITextPosition*)  other 
implementation

Definition at line 10 of file accessibility_text_entry.mm.

398 :(UITextPosition*)position toPosition:(UITextPosition*)other {
399 return [[self textInputSurrogate] comparePosition:position toPosition:other];
400}

◆ dealloc

- (void) dealloc
implementation

Reimplemented from SemanticsObject.

Definition at line 10 of file accessibility_text_entry.mm.

196 {
197 [_inactive_text_input release];
198 [super dealloc];
199}

◆ deleteBackward

- (void) deleteBackward
implementation

Definition at line 10 of file accessibility_text_entry.mm.

455 {
456 [[self textInputSurrogate] deleteBackward];
457}

◆ endOfDocument

- (UITextPosition *) endOfDocument
implementation

Definition at line 10 of file accessibility_text_entry.mm.

365 {
366 return [[self textInputSurrogate] endOfDocument];
367}

◆ firstRectForRange:

- (CGRect) firstRectForRange: (UITextRange*)  range
implementation

Definition at line 10 of file accessibility_text_entry.mm.

427 :(UITextRange*)range {
428 return [[self textInputSurrogate] firstRectForRange:range];
429}

◆ hasText

- (BOOL) hasText
implementation

Definition at line 10 of file accessibility_text_entry.mm.

461 {
462 return [[self textInputSurrogate] hasText];
463}

◆ initWithBridge:uid:

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

Reimplemented from SemanticsObject.

Definition at line 10 of file accessibility_text_entry.mm.

186 uid:(int32_t)uid {
187 self = [super initWithBridge:bridge uid:uid];
188
189 if (self) {
190 _inactive_text_input = [[FlutterInactiveTextInput alloc] init];
191 }
192
193 return self;
194}
fml::WeakPtr< flutter::AccessibilityBridgeIos > bridge

◆ inputDelegate

- (id< UITextInputDelegate >) inputDelegate
implementation

Definition at line 10 of file accessibility_text_entry.mm.

369 {
370 return [[self textInputSurrogate] inputDelegate];
371}

◆ insertText:

- (void) insertText: (NSString*)  text
implementation

Definition at line 10 of file accessibility_text_entry.mm.

451 :(NSString*)text {
452 [[self textInputSurrogate] insertText:text];
453}
std::u16string text

◆ markedTextRange

- (UITextRange *) markedTextRange
implementation

Definition at line 10 of file accessibility_text_entry.mm.

337 {
338 return [[self textInputSurrogate] markedTextRange];
339}

◆ markedTextStyle

- (NSDictionary *) markedTextStyle
implementation

Definition at line 10 of file accessibility_text_entry.mm.

341 {
342 return [[self textInputSurrogate] markedTextStyle];
343}

◆ offsetFromPosition:toPosition:

- (NSInteger) offsetFromPosition: (UITextPosition*)  from
toPosition: (UITextPosition*)  toPosition 
implementation

Definition at line 10 of file accessibility_text_entry.mm.

402 :(UITextPosition*)from toPosition:(UITextPosition*)toPosition {
403 return [[self textInputSurrogate] offsetFromPosition:from toPosition:toPosition];
404}

◆ positionFromPosition:inDirection:offset:

- (UITextPosition *) positionFromPosition: (UITextPosition*)  position
inDirection: (UITextLayoutDirection)  direction
offset: (NSInteger)  offset 
implementation

Definition at line 10 of file accessibility_text_entry.mm.

390 :(UITextPosition*)position
391 inDirection:(UITextLayoutDirection)direction
392 offset:(NSInteger)offset {
393 return [[self textInputSurrogate] positionFromPosition:position
394 inDirection:direction
395 offset:offset];
396}
Point offset

◆ positionFromPosition:offset:

- (UITextPosition *) positionFromPosition: (UITextPosition*)  position
offset: (NSInteger)  offset 
implementation

Definition at line 10 of file accessibility_text_entry.mm.

386 :(UITextPosition*)position offset:(NSInteger)offset {
387 return [[self textInputSurrogate] positionFromPosition:position offset:offset];
388}

◆ positionWithinRange:farthestInDirection:

- (UITextPosition *) positionWithinRange: (UITextRange*)  range
farthestInDirection: (UITextLayoutDirection)  direction 
implementation

Definition at line 10 of file accessibility_text_entry.mm.

406 :(UITextRange*)range
407 farthestInDirection:(UITextLayoutDirection)direction {
408 return [[self textInputSurrogate] positionWithinRange:range farthestInDirection:direction];
409}

◆ replaceRange:withText:

- (void) replaceRange: (UITextRange*)  range
withText: (NSString*)  text 
implementation

Definition at line 10 of file accessibility_text_entry.mm.

321 :(UITextRange*)range withText:(NSString*)text {
322 return [[self textInputSurrogate] replaceRange:range withText:text];
323}

◆ selectedTextRange

- (UITextRange *) selectedTextRange
implementation

Definition at line 10 of file accessibility_text_entry.mm.

329 {
330 return [[self textInputSurrogate] selectedTextRange];
331}

◆ selectionAffinity

- (UITextStorageDirection) selectionAffinity
implementation

Definition at line 10 of file accessibility_text_entry.mm.

357 {
358 return [[self textInputSurrogate] selectionAffinity];
359}

◆ selectionRectsForRange:

- (NSArray *) selectionRectsForRange: (UITextRange*)  range
implementation

Definition at line 10 of file accessibility_text_entry.mm.

443 :(UITextRange*)range {
444 return [[self textInputSurrogate] selectionRectsForRange:range];
445}

◆ setBaseWritingDirection:forRange:

- (void) setBaseWritingDirection: (UITextWritingDirection)  writingDirection
forRange: (UITextRange*)  range 
implementation

Definition at line 10 of file accessibility_text_entry.mm.

422 :(UITextWritingDirection)writingDirection
423 forRange:(UITextRange*)range {
424 [[self textInputSurrogate] setBaseWritingDirection:writingDirection forRange:range];
425}

◆ setInputDelegate:

- (void) setInputDelegate: (id<UITextInputDelegate>)  delegate
implementation

Definition at line 10 of file accessibility_text_entry.mm.

373 :(id<UITextInputDelegate>)delegate {
374 [[self textInputSurrogate] setInputDelegate:delegate];
375}

◆ setMarkedText:selectedRange:

- (void) setMarkedText: (NSString*)  markedText
selectedRange: (NSRange)  selectedRange 
implementation

Definition at line 10 of file accessibility_text_entry.mm.

349 :(NSString*)markedText selectedRange:(NSRange)selectedRange {
350 [[self textInputSurrogate] setMarkedText:markedText selectedRange:selectedRange];
351}

◆ setMarkedTextStyle:

- (void) setMarkedTextStyle: (NSDictionary*)  style
implementation

Definition at line 10 of file accessibility_text_entry.mm.

345 :(NSDictionary*)style {
346 [[self textInputSurrogate] setMarkedTextStyle:style];
347}

◆ setSelectedTextRange:

- (void) setSelectedTextRange: (UITextRange*)  range
implementation

Definition at line 10 of file accessibility_text_entry.mm.

333 :(UITextRange*)range {
334 [[self textInputSurrogate] setSelectedTextRange:range];
335}

◆ setSemanticsNode:

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

Updates this semantics object using data from the node argument.

Reimplemented from SemanticsObject.

Definition at line 10 of file accessibility_text_entry.mm.

204 [super setSemanticsNode:node];
205 _inactive_text_input.text = @(node->value.data());
207 if ([self node].HasFlag(flutter::SemanticsFlags::kIsFocused)) {
208 textInput.backingTextInputAccessibilityObject = self;
209 // The text input view must have a non-trivial size for the accessibility
210 // system to send text editing events.
211 textInput.frame = CGRectMake(0.0, 0.0, 1.0, 1.0);
212 } else if (textInput.backingTextInputAccessibilityObject == self) {
213 textInput.backingTextInputAccessibilityObject = nil;
214 }
215}
flutter::SemanticsNode node

◆ shouldChangeTextInRange:replacementText:

- (BOOL) shouldChangeTextInRange: (UITextRange*)  range
replacementText: (NSString*)  text 
implementation

Definition at line 10 of file accessibility_text_entry.mm.

325 :(UITextRange*)range replacementText:(NSString*)text {
326 return [[self textInputSurrogate] shouldChangeTextInRange:range replacementText:text];
327}

◆ textInputSurrogate

- (UIView< UITextInput > *) textInputSurrogate
implementation

The UITextInput whose accessibility properties we present to UIKit as substitutes for Flutter's text field properties.

When the field is currently focused (i.e. it is being edited), we use the FlutterTextInputView used by FlutterTextInputPlugin. Otherwise, we use an FlutterInactiveTextInput.

Definition at line 10 of file accessibility_text_entry.mm.

227 {
228 if ([self node].HasFlag(flutter::SemanticsFlags::kIsFocused)) {
229 return [self bridge]->textInputView();
230 } else {
231 return _inactive_text_input;
232 }
233}

◆ textInputView

- (UIView *) textInputView
implementation

Definition at line 10 of file accessibility_text_entry.mm.

235 {
236 return [self textInputSurrogate];
237}

◆ textInRange:

- (NSString *) textInRange: (UITextRange*)  range
implementation

Definition at line 10 of file accessibility_text_entry.mm.

317 :(UITextRange*)range {
318 return [[self textInputSurrogate] textInRange:range];
319}

◆ textRangeFromPosition:toPosition:

- (UITextRange *) textRangeFromPosition: (UITextPosition*)  fromPosition
toPosition: (UITextPosition*)  toPosition 
implementation

Definition at line 10 of file accessibility_text_entry.mm.

381 :(UITextPosition*)fromPosition
382 toPosition:(UITextPosition*)toPosition {
383 return [[self textInputSurrogate] textRangeFromPosition:fromPosition toPosition:toPosition];
384}

◆ tokenizer

- (id< UITextInputTokenizer >) tokenizer
implementation

Definition at line 10 of file accessibility_text_entry.mm.

377 {
378 return [[self textInputSurrogate] tokenizer];
379}

◆ unmarkText

- (void) unmarkText
implementation

Definition at line 10 of file accessibility_text_entry.mm.

353 {
354 [[self textInputSurrogate] unmarkText];
355}

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