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