Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
FlutterPlatformViewsController.h
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#ifndef FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMVIEWSCONTROLLER_H_
6#define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMVIEWSCONTROLLER_H_
7
8#include <Metal/Metal.h>
9#include <memory>
10#include <unordered_map>
11#include <unordered_set>
12
17
25
27
30
31@interface FlutterPlatformViewsController : NSObject
32
33- (instancetype)init NS_DESIGNATED_INITIALIZER;
34
35/// The task runner used to post rendering tasks to the platform thread.
36@property(nonatomic, strong) FlutterFMLTaskRunner* taskRunner;
37
38/// The flutter view.
39@property(nonatomic, weak) UIView* _Nullable flutterView;
40
41/// @brief The flutter view controller.
42@property(nonatomic, weak) UIViewController<FlutterViewResponder>* _Nullable flutterViewController;
43
44/// @brief set the factory used to construct embedded UI Views.
45- (void)registerViewFactory:(NSObject<FlutterPlatformViewFactory>*)factory
46 withId:(NSString*)factoryId
47 gestureRecognizersBlockingPolicy:
48 (FlutterPlatformViewGestureRecognizersBlockingPolicy)gestureRecognizerBlockingPolicy;
49
50/// @brief Mark the beginning of a frame and record the size of the onscreen.
51- (void)beginFrameWithSize:(flutter::DlISize)frameSize;
52
53/// @brief Cancel the current frame, indicating that no platform views are composited.
54///
55/// Additionally, reverts the composition order to its original state at the beginning of the
56/// frame.
57- (void)cancelFrame;
58
59/// @brief Record a platform view in the layer tree to be rendered, along with the positioning and
60/// mutator parameters.
61///
62/// Called from the raster thread.
63- (void)prerollCompositeEmbeddedView:(int64_t)viewId
64 withParams:(std::unique_ptr<flutter::EmbeddedViewParams>)params;
65
66/// @brief Returns the`FlutterTouchInterceptingView` with the provided view_id.
67///
68/// Returns nil if there is no platform view with the provided id. Called
69/// from the platform thread.
70- (FlutterTouchInterceptingView*)flutterTouchInterceptingViewForId:(int64_t)viewId;
71
72/// @brief Returns the Canvas for the overlay slice for the given platform view.
73///
74/// Called from the raster thread.
75- (flutter::DlCanvas*)compositeEmbeddedViewWithId:(int64_t)viewId;
76
77/// @brief Discards all platform views instances and auxiliary resources.
78///
79/// Called from the raster thread.
80- (void)reset;
81
82/// @brief Encode rendering for the Flutter overlay views and queue up perform platform view
83/// mutations.
84///
85/// Called from the raster thread.
86- (BOOL)submitFrame:(std::unique_ptr<flutter::SurfaceFrame>)frame
87 withIosContext:(const std::shared_ptr<flutter::IOSContext>&)iosContext;
88
89/// @brief Handler for platform view message channels.
90- (void)onMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result;
91
92/// @brief Returns the platform view id if the platform view (or any of its descendant view) is
93/// the first responder.
94///
95/// Returns -1 if no such platform view is found.
97
98/// @brief Pushes backdrop filter mutation to the mutator stack of each visited platform view.
99- (void)pushFilterToVisitedPlatformViews:(const std::shared_ptr<flutter::DlImageFilter>&)filter
100 withRect:(const flutter::DlRect&)filterRect;
101
102/// @brief Pushes the view id of a visted platform view to the list of visied platform views.
103- (void)pushVisitedPlatformViewId:(int64_t)viewId;
104
105/// @brief Pushes the outstanding rectangular clips to the mutator stack of each visited platform
106/// view
107- (void)pushClipRectToVisitedPlatformViews:(const flutter::DlRect&)clipRect;
108
109/// @brief Pushes the outstanding rounded rectangular clips to the mutator stack of each visited
110/// platform view
111- (void)pushClipRRectToVisitedPlatformViews:(const flutter::DlRoundRect&)clipRRect;
112
113/// @brief Pushes the outstanding round super elliptical clips to the mutator stack of each visited
114/// platform view
115- (void)pushClipRSuperellipseToVisitedPlatformViews:(const flutter::DlRoundSuperellipse&)clipRse;
116
117/// @brief Pushes the outstanding path clips to the mutator stack of each visited platform
118/// view
119- (void)pushClipPathToVisitedPlatformViews:(const flutter::DlPath&)clipPath;
120
121@end
122
123@interface FlutterPlatformViewsController (Testing)
124
125- (size_t)embeddedViewCount;
126
127// Returns the `FlutterPlatformView`'s `view` object associated with the view_id.
128//
129// If the `PlatformViewsController` does not contain any `FlutterPlatformView` object or
130// a `FlutterPlatformView` object associated with the view_id cannot be found, the method
131// returns nil.
132- (UIView* _Nullable)platformViewForId:(int64_t)viewId;
133
134// Composite the PlatformView with `viewId`.
135//
136// Every frame, during the paint traversal of the layer tree, this method is called for all
137// the PlatformViews in `_viewsToRecomposite`.
138//
139// Note that `_viewsToRecomposite` does not represent all the views in the view hierarchy,
140// if a PlatformView does not change its composition parameter from last frame, it is not
141// included in the `views_to_recomposite_`.
142- (void)compositeView:(int64_t)viewId withParams:(const flutter::EmbeddedViewParams&)params;
143
144- (const flutter::EmbeddedViewParams&)compositionParamsForView:(int64_t)viewId;
145
146/// @brief The composition order from the previous frame.
147///
148/// Only accessed from the platform thread.
149- (NSArray<NSNumber*>*)previousCompositionOrder;
150
151@end
152
154
155#endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMVIEWSCONTROLLER_H_
void(^ FlutterResult)(id _Nullable result)
#define NS_ASSUME_NONNULL_BEGIN
#define NS_ASSUME_NONNULL_END
FlutterPlatformViewGestureRecognizersBlockingPolicy
NSArray< NSNumber * > * previousCompositionOrder()
The composition order from the previous frame.
HWND(* FlutterPlatformViewFactory)(const FlutterPlatformViewCreationParameters *)
void reset()
Discards all platform views instances and auxiliary resources.
long firstResponderPlatformViewId()
Returns the platform view id if the platform view (or any of its descendant view) is the first respon...
FlutterFMLTaskRunner * taskRunner
The task runner used to post rendering tasks to the platform thread.
instancetype NS_DESIGNATED_INITIALIZER()
UIViewController< FlutterViewResponder > *_Nullable flutterViewController
The flutter view controller.
void cancelFrame()
Cancel the current frame, indicating that no platform views are composited.
UIView *_Nullable flutterView
The flutter view.
Definition ref_ptr.h:261
int BOOL