-
Notifications
You must be signed in to change notification settings - Fork 6k
[iOS] clean ups to platform view controller #54335
Conversation
#import <UIKit/UIKit.h> | ||
#import <XCTest/XCTest.h> | ||
#include "fml/synchronization/count_down_latch.h" | ||
#include "shell/platform/darwin/ios/framework/Source/platform_views_controller.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename this file to get rid of the redundant Flutter
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feeling lazy
|
||
BOOL BlurRadiusEqualToBlurRadius(CGFloat radius1, CGFloat radius2) { | ||
const CGFloat epsilon = 0.01; | ||
return radius1 - radius2 < epsilon; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem quite right. Going past negative epsilon won't be caught. (radius1 > (radius2 - epsilon)) && (radius1 < (radius2 + epsilon))
perhaps. Or if you are passing in a potentially zero epsion, check for direct equality too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitHub didn't update. Did you miss staging this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
|
||
auto flutterPlatformViewsController = | ||
std::make_shared<flutter::FlutterPlatformViewsController>(); | ||
auto flutterPlatformViewsController = std::make_shared<flutter::PlatformViewsController>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use underscore case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this is a ObjC++ TU. I guess this is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably document a standard for this in our style guide; we're super inconsistent. I generally go for underscore case for C++ objects like this and reserve lowerCamelCase for Obj-C objects and ivars, but I'd be fine with anything so long as it's consistent.
class IOSSurface; | ||
|
||
/// @brief State holder for a Flutter overlay layer. | ||
struct OverlayLayer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this and the pool to its own TU, OOL the cdtors, and add a headerdoc while you are at it too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
// We only fail this recognizer when asked to do so by the Flutter framework (which does so by | ||
// invoking an acceptGesture method on the platform_views channel). And this is how we allow the | ||
// Flutter framework to delay or prevent the embedded view from getting a touch sequence. | ||
@interface DelayingGestureRecognizer : UIGestureRecognizer <UIGestureRecognizerDelegate> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO this should be "namespaced". This looks like a common class name and we'll end up with collisions in some cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
BOOL BlurRadiusEqualToBlurRadius(CGFloat radius1, CGFloat radius2) { | ||
const CGFloat epsilon = 0.01; | ||
return radius1 - radius2 < epsilon; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitHub didn't update. Did you miss staging this?
Oops, fixed missing update to blur radius check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
namespace flutter { | ||
class FlutterPlatformViewsController; | ||
class PlatformViewsController; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. We should reserve the Flutter
name prefix for where we're forced to, in Obj-C code.
|
||
auto flutterPlatformViewsController = | ||
std::make_shared<flutter::FlutterPlatformViewsController>(); | ||
auto flutterPlatformViewsController = std::make_shared<flutter::PlatformViewsController>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably document a standard for this in our style guide; we're super inconsistent. I generally go for underscore case for C++ objects like this and reserve lowerCamelCase for Obj-C objects and ivars, but I'd be fine with anything so long as it's consistent.
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm
Outdated
Show resolved
Hide resolved
@end | ||
|
||
@implementation UIView (FirstResponder) | ||
- (BOOL)flt_hasFirstResponderInViewHierarchySubtree { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should remove the flt_
prefix here, but there are a bunch of these and it might make sense to land cleanups in a followup rather than along with the refactoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it just be "FLTHasFirstResponder..."?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just hasFirstResponderInViewHierarchySubtree
since it's a method. There shouldn't be any need for an flt
prefix at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the prefix is correct since it's a category on a UIKit class.
Methods in a category should be prefixed with a lowercase version of the prefix used for the category name followed by an underscore (e.g., gtm_myCategoryMethodOnAString:) in order to prevent collisions in Objective-C’s global namespace.
https://google.github.io/styleguide/objcguide.html#category-naming
|
||
FLUTTER_ASSERT_ARC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this file be renamed .cc
if there's no more Obj-C in it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're still doing objective C stuff in here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should leave this in, in that case, to blow up if we compile with ARC disabled.
…s_Internal.mm Co-authored-by: Chris Bracken <[email protected]>
…152985) flutter/engine@206e86e...5a0fd5f 2024-08-07 [email protected] [Impeller] Statically check stage interfaces for precision mismatches. (flutter/engine#54375) 2024-08-07 [email protected] Roll Skia from f04ba9cd0e4b to 968a00456bc5 (4 revisions) (flutter/engine#54378) 2024-08-06 [email protected] Roll Dart SDK from dedfa3393296 to f5d136899082 (5 revisions) (flutter/engine#54376) 2024-08-06 [email protected] [Impeller] Reorder pipeline construction in content context. (flutter/engine#54373) 2024-08-06 [email protected] [iOS] clean ups to platform view controller (flutter/engine#54335) 2024-08-06 [email protected] [Impeller] ensure precision matches for buggy vulkan drivers. (flutter/engine#54372) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…lutter#152985) flutter/engine@206e86e...5a0fd5f 2024-08-07 [email protected] [Impeller] Statically check stage interfaces for precision mismatches. (flutter/engine#54375) 2024-08-07 [email protected] Roll Skia from f04ba9cd0e4b to 968a00456bc5 (4 revisions) (flutter/engine#54378) 2024-08-06 [email protected] Roll Dart SDK from dedfa3393296 to f5d136899082 (5 revisions) (flutter/engine#54376) 2024-08-06 [email protected] [Impeller] Reorder pipeline construction in content context. (flutter/engine#54373) 2024-08-06 [email protected] [iOS] clean ups to platform view controller (flutter/engine#54335) 2024-08-06 [email protected] [Impeller] ensure precision matches for buggy vulkan drivers. (flutter/engine#54372) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…lutter#152985) flutter/engine@206e86e...5a0fd5f 2024-08-07 [email protected] [Impeller] Statically check stage interfaces for precision mismatches. (flutter/engine#54375) 2024-08-07 [email protected] Roll Skia from f04ba9cd0e4b to 968a00456bc5 (4 revisions) (flutter/engine#54378) 2024-08-06 [email protected] Roll Dart SDK from dedfa3393296 to f5d136899082 (5 revisions) (flutter/engine#54376) 2024-08-06 [email protected] [Impeller] Reorder pipeline construction in content context. (flutter/engine#54373) 2024-08-06 [email protected] [iOS] clean ups to platform view controller (flutter/engine#54335) 2024-08-06 [email protected] [Impeller] ensure precision matches for buggy vulkan drivers. (flutter/engine#54372) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…lutter#152985) flutter/engine@206e86e...5a0fd5f 2024-08-07 [email protected] [Impeller] Statically check stage interfaces for precision mismatches. (flutter/engine#54375) 2024-08-07 [email protected] Roll Skia from f04ba9cd0e4b to 968a00456bc5 (4 revisions) (flutter/engine#54378) 2024-08-06 [email protected] Roll Dart SDK from dedfa3393296 to f5d136899082 (5 revisions) (flutter/engine#54376) 2024-08-06 [email protected] [Impeller] Reorder pipeline construction in content context. (flutter/engine#54373) 2024-08-06 [email protected] [iOS] clean ups to platform view controller (flutter/engine#54335) 2024-08-06 [email protected] [Impeller] ensure precision matches for buggy vulkan drivers. (flutter/engine#54372) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
#54820 on stable branch. That PR was using some of the symbol changes in #54335, so I had so switch some back: e0a630d Cherry-pick request: flutter/flutter#154712 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Splits FlutterPlatformViews.mm into the primarily C++ class FlutterPlatformViewsController/Pool/Overlay and all of the touch interceptor / gesture stuff.
Renames FlutterPlatformViewsController to PlatformViewsController, because, you know.
Renames FlutterPlatformViewLayer and FlutterPlatformViewLayerPool to OverlayLayer and OverlayLayerPool