Flutter Engine
The Flutter Engine
Instance Methods | Properties | List of all members
FlutterScrollableSemanticsObject Class Reference

#import <SemanticsObject.h>

Inheritance diagram for FlutterScrollableSemanticsObject:
SemanticsObject

Instance Methods

(instancetype) - initWithBridge:uid: [implementation]
 
(void) - dealloc [implementation]
 
(void) - accessibilityBridgeDidFinishUpdate [implementation]
 
(id- nativeAccessibility [implementation]
 
(float) - scrollExtentMax [implementation]
 
(float) - scrollPosition [implementation]
 
(CGSize) - contentSizeInternal [implementation]
 
(CGPoint) - contentOffsetInternal [implementation]
 
- Instance Methods inherited from SemanticsObject
(BOOL- isAccessibilityBridgeAlive
 
(void) - setSemanticsNode:
 
(void) - replaceChildAtIndex:withChild:
 
(BOOL- nodeWillCauseLayoutChange:
 
(BOOL- nodeWillCauseScroll:
 
(BOOL- nodeShouldTriggerAnnouncement:
 
(void) - collectRoutes:
 
(NSString *) - routeName
 
(BOOL- onCustomAccessibilityAction:
 
(void) - accessibilityBridgeDidFinishUpdate
 
((unavailable("Use initWithBridge instead") - __attribute__
 
(instancetype) - initWithBridge:uid:
 
(void) - dealloc [implementation]
 
(void) - setChildren: [implementation]
 
(void) - setChildrenInHitTestOrder: [implementation]
 
(NSAttributedString *) - createAttributedStringFromString:withAttributes: [implementation]
 
(void) - showOnScreen [implementation]
 
(BOOL- isAccessibilityElement [implementation]
 
(bool) - isFocusable [implementation]
 
(NSString *) - accessibilityIdentifier [implementation]
 
(NSString *) - accessibilityLabel [implementation]
 
(bool) - containsPoint: [implementation]
 
(id- search: [implementation]
 
(id- _accessibilityHitTest:withEvent: [implementation]
 
(BOOL- accessibilityScrollToVisible [implementation]
 
(BOOL- accessibilityScrollToVisibleWithChild: [implementation]
 
(NSAttributedString *) - accessibilityAttributedLabel [implementation]
 
(NSString *) - accessibilityHint [implementation]
 
(NSAttributedString *) - accessibilityAttributedHint [implementation]
 
(NSString *) - accessibilityValue [implementation]
 
(NSAttributedString *) - accessibilityAttributedValue [implementation]
 
(CGRect) - accessibilityFrame [implementation]
 
(CGRect) - globalRect [implementation]
 
(void) - setAccessibilityContainer: [implementation]
 
(id- accessibilityContainer [implementation]
 
(BOOL- accessibilityActivate [implementation]
 
(void) - accessibilityIncrement [implementation]
 
(void) - accessibilityDecrement [implementation]
 
(BOOL- accessibilityScroll: [implementation]
 
(BOOL- accessibilityPerformEscape [implementation]
 
(void) - accessibilityElementDidBecomeFocused [implementation]
 
(void) - accessibilityElementDidLoseFocus [implementation]
 

Properties

FlutterSemanticsScrollViewscrollView [implementation]
 
- 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
 
SemanticsObjectContainercontainer [implementation]
 

Detailed Description

The semantics object for scrollable. This class creates an UIScrollView to interact with the iOS.

Definition at line 188 of file SemanticsObject.h.

Method Documentation

◆ accessibilityBridgeDidFinishUpdate

- (void) accessibilityBridgeDidFinishUpdate
implementation

Called after accessibility bridge finishes a semantics update.

Subclasses can override this method if they contain states that can only be updated once every node in the accessibility tree has finished updating.

Reimplemented from SemanticsObject.

Definition at line 145 of file SemanticsObject.mm.

166 {
167 // In order to make iOS think this UIScrollView is scrollable, the following
168 // requirements must be true.
169 // 1. contentSize must be bigger than the frame size.
170 // 2. The scrollable isAccessibilityElement must return YES
171 //
172 // Once the requirements are met, the iOS uses contentOffset to determine
173 // what scroll actions are available. e.g. If the view scrolls vertically and
174 // contentOffset is 0.0, only the scroll down action is available.
175 self.scrollView.frame = self.accessibilityFrame;
176 self.scrollView.contentSize = [self contentSizeInternal];
177 [self.scrollView setContentOffset:[self contentOffsetInternal] animated:NO];
178}

◆ contentOffsetInternal

- (CGPoint) contentOffsetInternal
implementation

Definition at line 145 of file SemanticsObject.mm.

225 {
226 CGPoint result;
227 CGPoint origin = self.scrollView.frame.origin;
228 const SkRect& rect = self.node.rect;
230 result = ConvertPointToGlobal(self, CGPointMake(rect.x(), rect.y() + [self scrollPosition]));
232 result = ConvertPointToGlobal(self, CGPointMake(rect.x() + [self scrollPosition], rect.y()));
233 } else {
234 result = origin;
235 }
236 return CGPointMake(result.x - origin.x, result.y - origin.y);
237}
GAsyncResult * result
flutter::SemanticsNode node
CGPoint ConvertPointToGlobal(SemanticsObject *reference, CGPoint local_point)
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
const int kHorizontalScrollSemanticsActions
const int kVerticalScrollSemanticsActions

◆ contentSizeInternal

- (CGSize) contentSizeInternal
implementation

Definition at line 145 of file SemanticsObject.mm.

211 {
212 CGRect result;
213 const SkRect& rect = self.node.rect;
214
216 result = CGRectMake(rect.x(), rect.y(), rect.width(), rect.height() + [self scrollExtentMax]);
218 result = CGRectMake(rect.x(), rect.y(), rect.width() + [self scrollExtentMax], rect.height());
219 } else {
220 result = CGRectMake(rect.x(), rect.y(), rect.width(), rect.height());
221 }
222 return ConvertRectToGlobal(self, result).size;
223}
CGRect ConvertRectToGlobal(SemanticsObject *reference, CGRect local_rect)

◆ dealloc

- (void) dealloc
implementation

Reimplemented from SemanticsObject.

Definition at line 145 of file SemanticsObject.mm.

162 {
163 [_scrollView removeFromSuperview];
164}

◆ initWithBridge:uid:

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

Reimplemented from SemanticsObject.

Definition at line 145 of file SemanticsObject.mm.

151 uid:(int32_t)uid {
152 self = [super initWithBridge:bridge uid:uid];
153 if (self) {
154 _scrollView = [[FlutterSemanticsScrollView alloc] initWithSemanticsObject:self];
155 [_scrollView setShowsHorizontalScrollIndicator:NO];
156 [_scrollView setShowsVerticalScrollIndicator:NO];
157 [self.bridge->view() addSubview:_scrollView];
158 }
159 return self;
160}
fml::WeakPtr< flutter::AccessibilityBridgeIos > bridge
fml::scoped_nsobject< UIScrollView > _scrollView

◆ nativeAccessibility

- (id) nativeAccessibility
implementation

Definition at line 145 of file SemanticsObject.mm.

180 {
181 return self.scrollView;
182}

◆ scrollExtentMax

- (float) scrollExtentMax
implementation

Definition at line 145 of file SemanticsObject.mm.

186 {
187 if (![self isAccessibilityBridgeAlive]) {
188 return 0.0f;
189 }
190 float scrollExtentMax = self.node.scrollExtentMax;
191 if (isnan(scrollExtentMax)) {
192 scrollExtentMax = 0.0f;
193 } else if (!isfinite(scrollExtentMax)) {
195 }
196 return scrollExtentMax;
197}
constexpr float kScrollExtentMaxForInf
BOOL isAccessibilityBridgeAlive()
SINT bool isfinite(const Vec< N, T > &v)
Definition: SkVx.h:1003

◆ scrollPosition

- (float) scrollPosition
implementation

Definition at line 145 of file SemanticsObject.mm.

199 {
200 if (![self isAccessibilityBridgeAlive]) {
201 return 0.0f;
202 }
203 float scrollPosition = self.node.scrollPosition;
204 if (isnan(scrollPosition)) {
205 scrollPosition = 0.0f;
206 }
207 NSCAssert(isfinite(scrollPosition), @"The scrollPosition must not be infinity");
208 return scrollPosition;
209}

Property Documentation

◆ scrollView

- (FlutterSemanticsScrollView*) scrollView
readwritenonatomicassignimplementation

Definition at line 145 of file SemanticsObject.mm.


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