5#import "flutter/shell/platform/darwin/ios/framework/Source/TextInputSemanticsObject.h"
7#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.h"
25@synthesize beginningOfDocument = _beginningOfDocument;
26@synthesize endOfDocument = _endOfDocument;
31@synthesize tokenizer = _tokenizer;
34 return self.text.length > 0;
37- (NSString*)textInRange:(UITextRange*)range {
42 @"Expected a FlutterTextRange for range (got %@).", [range
class]);
44 NSAssert(textRange.location != NSNotFound,
@"Expected a valid text range.");
45 return [
self.text substringWithRange:textRange];
48- (void)replaceRange:(UITextRange*)range withText:(NSString*)
text {
54- (void)setMarkedText:(NSString*)markedText selectedRange:(NSRange)markedSelectedRange {
66- (UITextRange*)textRangeFromPosition:(UITextPosition*)fromPosition
67 toPosition:(UITextPosition*)toPosition {
73- (UITextPosition*)positionFromPosition:(UITextPosition*)position
offset:(NSInteger)
offset {
80- (UITextPosition*)positionFromPosition:(UITextPosition*)position
81 inDirection:(UITextLayoutDirection)direction
89- (NSComparisonResult)comparePosition:(UITextPosition*)position toPosition:(UITextPosition*)other {
96- (NSInteger)offsetFromPosition:(UITextPosition*)from toPosition:(UITextPosition*)toPosition {
103- (UITextPosition*)positionWithinRange:(UITextRange*)range
104 farthestInDirection:(UITextLayoutDirection)direction {
111- (UITextRange*)characterRangeByExtendingPosition:(UITextPosition*)position
112 inDirection:(UITextLayoutDirection)direction {
119- (UITextWritingDirection)baseWritingDirectionForPosition:(UITextPosition*)position
120 inDirection:(UITextStorageDirection)direction {
122 return UITextWritingDirectionNatural;
125- (void)setBaseWritingDirection:(UITextWritingDirection)writingDirection
126 forRange:(UITextRange*)range {
130- (CGRect)firstRectForRange:(UITextRange*)range {
144- (UITextPosition*)closestPositionToPoint:(CGPoint)point {
151- (UITextPosition*)closestPositionToPoint:(CGPoint)point withinRange:(UITextRange*)range {
158- (NSArray*)selectionRectsForRange:(UITextRange*)range {
165- (UITextRange*)characterRangeAtPoint:(CGPoint)point {
172- (void)insertText:(NSString*)
text {
201#pragma mark - SemanticsObject overrides
205 _inactive_text_input.text = @(node->value.data());
208 textInput.backingTextInputAccessibilityObject =
self;
211 textInput.frame = CGRectMake(0.0, 0.0, 1.0, 1.0);
212 }
else if (textInput.backingTextInputAccessibilityObject ==
self) {
213 textInput.backingTextInputAccessibilityObject = nil;
217#pragma mark - UIAccessibility overrides
227- (UIView<UITextInput>*)textInputSurrogate {
229 return [
self bridge]->textInputView();
231 return _inactive_text_input;
235- (UIView*)textInputView {
239- (void)accessibilityElementDidBecomeFocused {
240 if (![
self isAccessibilityBridgeAlive]) {
247- (void)accessibilityElementDidLoseFocus {
248 if (![
self isAccessibilityBridgeAlive]) {
255- (
BOOL)accessibilityElementIsFocused {
256 if (![
self isAccessibilityBridgeAlive]) {
262- (
BOOL)accessibilityActivate {
263 if (![
self isAccessibilityBridgeAlive]) {
269- (NSString*)accessibilityLabel {
270 if (![
self isAccessibilityBridgeAlive]) {
281- (NSString*)accessibilityHint {
282 if (![
self isAccessibilityBridgeAlive]) {
292- (NSString*)accessibilityValue {
293 if (![
self isAccessibilityBridgeAlive]) {
303- (UIAccessibilityTraits)accessibilityTraits {
304 if (![
self isAccessibilityBridgeAlive]) {
307 UIAccessibilityTraits results =
312 return results & (~kUIAccessibilityTraitUndocumentedEmptyLine);
315#pragma mark - UITextInput overrides
317- (NSString*)textInRange:(UITextRange*)range {
321- (void)replaceRange:(UITextRange*)range withText:(NSString*)
text {
325- (
BOOL)shouldChangeTextInRange:(UITextRange*)range replacementText:(NSString*)
text {
326 return [[
self textInputSurrogate] shouldChangeTextInRange:range replacementText:text];
333- (void)setSelectedTextRange:(UITextRange*)range {
345- (void)setMarkedTextStyle:(NSDictionary*)style {
349- (void)setMarkedText:(NSString*)markedText selectedRange:(NSRange)selectedRange {
357- (UITextStorageDirection)selectionAffinity {
361- (UITextPosition*)beginningOfDocument {
365- (UITextPosition*)endOfDocument {
373- (void)setInputDelegate:(id<UITextInputDelegate>)delegate {
377- (id<UITextInputTokenizer>)tokenizer {
381- (UITextRange*)textRangeFromPosition:(UITextPosition*)fromPosition
382 toPosition:(UITextPosition*)toPosition {
383 return [[
self textInputSurrogate] textRangeFromPosition:fromPosition toPosition:toPosition];
386- (UITextPosition*)positionFromPosition:(UITextPosition*)position
offset:(NSInteger)
offset {
390- (UITextPosition*)positionFromPosition:(UITextPosition*)position
391 inDirection:(UITextLayoutDirection)direction
394 inDirection:direction
398- (NSComparisonResult)comparePosition:(UITextPosition*)position toPosition:(UITextPosition*)other {
402- (NSInteger)offsetFromPosition:(UITextPosition*)from toPosition:(UITextPosition*)toPosition {
406- (UITextPosition*)positionWithinRange:(UITextRange*)range
407 farthestInDirection:(UITextLayoutDirection)direction {
408 return [[
self textInputSurrogate] positionWithinRange:range farthestInDirection:direction];
411- (UITextRange*)characterRangeByExtendingPosition:(UITextPosition*)position
412 inDirection:(UITextLayoutDirection)direction {
414 inDirection:direction];
417- (UITextWritingDirection)baseWritingDirectionForPosition:(UITextPosition*)position
418 inDirection:(UITextStorageDirection)direction {
419 return [[
self textInputSurrogate] baseWritingDirectionForPosition:position inDirection:direction];
422- (void)setBaseWritingDirection:(UITextWritingDirection)writingDirection
423 forRange:(UITextRange*)range {
427- (CGRect)firstRectForRange:(UITextRange*)range {
435- (UITextPosition*)closestPositionToPoint:(CGPoint)point {
439- (UITextPosition*)closestPositionToPoint:(CGPoint)point withinRange:(UITextRange*)range {
443- (NSArray*)selectionRectsForRange:(UITextRange*)range {
447- (UITextRange*)characterRangeAtPoint:(CGPoint)point {
451- (void)insertText:(NSString*)
text {
459#pragma mark - UIKeyInput overrides
static void copy(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
static FLUTTER_ASSERT_ARC const UIAccessibilityTraits kUIAccessibilityTraitUndocumentedEmptyLine
NSString * accessibilityHint()
void accessibilityElementDidBecomeFocused()
NSString * accessibilityValue()
NSString * accessibilityLabel()
flutter::SemanticsNode node
instancetype initWithBridge:uid:(fml::WeakPtr< flutter::AccessibilityBridgeIos > bridge,[uid] int32_t NS_DESIGNATED_INITIALIZER)
void accessibilityElementDidLoseFocus()
fml::WeakPtr< flutter::AccessibilityBridgeIos > bridge
void setSemanticsNode:(const flutter::SemanticsNode *NS_REQUIRES_SUPER)
UIView< UITextInput > * textInputSurrogate()
NSDictionary * markedTextStyle
UITextRange * markedTextRange
id< UITextInputDelegate > inputDelegate
API_AVAILABLE(ios(13.0)) @interface FlutterTextPlaceholder UITextRange * selectedTextRange
CGRect caretRectForPosition
FlutterTextRange * _selectedTextRange