| Flutter iOS Embedder |

FlutterSemanticsScrollView.mm
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterSemanticsScrollView.h"
6
7 #import "flutter/shell/platform/darwin/ios/framework/Source/SemanticsObject.h"
8
9 @implementation FlutterSemanticsScrollView
10
11 - (instancetype)initWithSemanticsObject:(SemanticsObject*)semanticsObject {
12 self = [super initWithFrame:CGRectZero];
13 if (self) {
14 _semanticsObject = semanticsObject;
15 }
16 return self;
17 }
18
19 - (UIView*)hitTest:(CGPoint)point withEvent:(UIEvent*)event {
20 return nil;
21 }
22
23 // The following methods are explicitly forwarded to the wrapped SemanticsObject because the
24 // forwarding logic above doesn't apply to them since they are also implemented in the
25 // UIScrollView class, the base class.
26
27 - (BOOL)isAccessibilityElement {
28 if (![_semanticsObject isAccessibilityBridgeAlive]) {
29 return NO;
30 }
31
32 if ([_semanticsObject isAccessibilityElement]) {
33 return YES;
34 }
35 if (self.contentSize.width > self.frame.size.width ||
36 self.contentSize.height > self.frame.size.height) {
37 // In SwitchControl or VoiceControl, the isAccessibilityElement must return YES
38 // in order to use scroll actions.
39 return ![_semanticsObject bridge]->isVoiceOverRunning();
40 } else {
41 return NO;
42 }
43 }
44
45 - (NSString*)accessibilityLabel {
46 return [_semanticsObject accessibilityLabel];
47 }
48
49 - (NSAttributedString*)accessibilityAttributedLabel {
50 return [_semanticsObject accessibilityAttributedLabel];
51 }
52
53 - (NSString*)accessibilityValue {
54 return [_semanticsObject accessibilityValue];
55 }
56
57 - (NSAttributedString*)accessibilityAttributedValue {
58 return [_semanticsObject accessibilityAttributedValue];
59 }
60
61 - (NSString*)accessibilityHint {
62 return [_semanticsObject accessibilityHint];
63 }
64
65 - (NSAttributedString*)accessibilityAttributedHint {
66 return [_semanticsObject accessibilityAttributedHint];
67 }
68
69 - (BOOL)accessibilityActivate {
70 return [_semanticsObject accessibilityActivate];
71 }
72
73 - (void)accessibilityIncrement {
74 [_semanticsObject accessibilityIncrement];
75 }
76
77 - (void)accessibilityDecrement {
78 [_semanticsObject accessibilityDecrement];
79 }
80
81 - (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction {
82 return [_semanticsObject accessibilityScroll:direction];
83 }
84
85 - (BOOL)accessibilityPerformEscape {
86 return [_semanticsObject accessibilityPerformEscape];
87 }
88
89 - (void)accessibilityElementDidBecomeFocused {
90 [_semanticsObject accessibilityElementDidBecomeFocused];
91 }
92
93 - (void)accessibilityElementDidLoseFocus {
94 [_semanticsObject accessibilityElementDidLoseFocus];
95 }
96
97 - (id)accessibilityContainer {
98 return [_semanticsObject accessibilityContainer];
99 }
100
101 - (NSInteger)accessibilityElementCount {
102 return [[_semanticsObject children] count];
103 }
104
105 @end
FlutterSemanticsScrollView::semanticsObject
SemanticsObject * semanticsObject
Definition: FlutterSemanticsScrollView.h:23
FlutterSemanticsScrollView.h
FlutterSemanticsScrollView
Definition: FlutterSemanticsScrollView.h:21
SemanticsObject.h
SemanticsObject
Definition: SemanticsObject.h:30