| 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/common/framework/Headers/FlutterMacros.h"
8 #import "flutter/shell/platform/darwin/ios/framework/Source/SemanticsObject.h"
9
10 FLUTTER_ASSERT_ARC
11
12 @implementation FlutterSemanticsScrollView
13
14 - (instancetype)initWithSemanticsObject:(SemanticsObject*)semanticsObject {
15 self = [super initWithFrame:CGRectZero];
16 if (self) {
17 _semanticsObject = semanticsObject;
18 _isDoingSystemScrolling = NO;
19 self.delegate = self;
20 }
21 return self;
22 }
23
24 - (UIView*)hitTest:(CGPoint)point withEvent:(UIEvent*)event {
25 return nil;
26 }
27
28 // The following methods are explicitly forwarded to the wrapped SemanticsObject because the
29 // forwarding logic above doesn't apply to them since they are also implemented in the
30 // UIScrollView class, the base class.
31
32 - (BOOL)isAccessibilityElement {
33 if (![self.semanticsObject isAccessibilityBridgeAlive]) {
34 return NO;
35 }
36
37 if (self.semanticsObject.isAccessibilityElement) {
38 return YES;
39 }
40 if (self.contentSize.width > self.frame.size.width ||
41 self.contentSize.height > self.frame.size.height) {
42 // In SwitchControl or VoiceControl, the isAccessibilityElement must return YES
43 // in order to use scroll actions.
44 return ![self.semanticsObject bridge]->isVoiceOverRunning();
45 } else {
46 return NO;
47 }
48 }
49
50 - (NSString*)accessibilityLabel {
51 return self.semanticsObject.accessibilityLabel;
52 }
53
54 - (NSAttributedString*)accessibilityAttributedLabel {
55 return self.semanticsObject.accessibilityAttributedLabel;
56 }
57
58 - (NSString*)accessibilityValue {
59 return self.semanticsObject.accessibilityValue;
60 }
61
62 - (NSAttributedString*)accessibilityAttributedValue {
63 return self.semanticsObject.accessibilityAttributedValue;
64 }
65
66 - (NSString*)accessibilityHint {
67 return self.semanticsObject.accessibilityHint;
68 }
69
70 - (NSAttributedString*)accessibilityAttributedHint {
71 return self.semanticsObject.accessibilityAttributedHint;
72 }
73
74 - (BOOL)accessibilityActivate {
75 return [self.semanticsObject accessibilityActivate];
76 }
77
78 - (void)accessibilityIncrement {
79 [self.semanticsObject accessibilityIncrement];
80 }
81
82 - (void)accessibilityDecrement {
83 [self.semanticsObject accessibilityDecrement];
84 }
85
86 - (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction {
87 return [self.semanticsObject accessibilityScroll:direction];
88 }
89
90 - (BOOL)accessibilityPerformEscape {
91 return [self.semanticsObject accessibilityPerformEscape];
92 }
93
94 - (void)accessibilityElementDidBecomeFocused {
95 [self.semanticsObject accessibilityElementDidBecomeFocused];
96 }
97
98 - (void)accessibilityElementDidLoseFocus {
99 [self.semanticsObject accessibilityElementDidLoseFocus];
100 }
101
102 - (id)accessibilityContainer {
103 return self.semanticsObject.accessibilityContainer;
104 }
105
106 - (NSInteger)accessibilityElementCount {
107 return self.semanticsObject.children.count;
108 }
109
110 - (void)scrollViewWillEndDragging:(UIScrollView*)scrollView
111 withVelocity:(CGPoint)velocity
112 targetContentOffset:(inout CGPoint*)targetContentOffset {
113 _isDoingSystemScrolling = YES;
114 }
115
116 - (void)scrollViewDidEndDecelerating:(UIScrollView*)scrollView {
117 _isDoingSystemScrolling = NO;
118 }
119
120 @end
FlutterMacros.h
FlutterSemanticsScrollView.h
SemanticsObject.h
FlutterSemanticsScrollView
Definition: FlutterSemanticsScrollView.h:21
FlutterSemanticsScrollView::semanticsObject
SemanticsObject * semanticsObject
Definition: FlutterSemanticsScrollView.h:23
SemanticsObject
Definition: SemanticsObject.h:32
SemanticsObject::children
NSArray< SemanticsObject * > * children
Definition: SemanticsObject.h:68
FLUTTER_ASSERT_ARC
Definition: FlutterChannelKeyResponder.mm:13