Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

jonahwilliams
Copy link
Contributor

@jonahwilliams jonahwilliams commented Aug 3, 2024

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

#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"
Copy link
Member

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?

Copy link
Contributor Author

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;
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

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?

Copy link
Contributor Author

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>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use underscore case?

Copy link
Member

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.

Copy link
Member

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 {
Copy link
Member

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?

Copy link
Contributor Author

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>
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

jonahwilliams added 2 commits August 6, 2024 10:46
@jonahwilliams jonahwilliams marked this pull request as ready for review August 6, 2024 18:26

BOOL BlurRadiusEqualToBlurRadius(CGFloat radius1, CGFloat radius2) {
const CGFloat epsilon = 0.01;
return radius1 - radius2 < epsilon;
Copy link
Member

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?

@jonahwilliams
Copy link
Contributor Author

Oops, fixed missing update to blur radius check

@jonahwilliams jonahwilliams added autosubmit Merge PR when tree becomes green via auto submit App and removed autosubmit Merge PR when tree becomes green via auto submit App labels Aug 6, 2024
@jonahwilliams jonahwilliams requested a review from cbracken August 6, 2024 19:18
Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM stamp from a Japanese personal seal

There are a ton of nits and doc comment rewriting we should do, but that make sense to do in a followup, and keep this as just a restructuring of the code plus the top-level class rename.

lgtm -- this looks great. Thanks for cleaning up.


namespace flutter {
class FlutterPlatformViewsController;
class PlatformViewsController;
Copy link
Member

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>();
Copy link
Member

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.

@end

@implementation UIView (FirstResponder)
- (BOOL)flt_hasFirstResponderInViewHierarchySubtree {
Copy link
Member

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.

Copy link
Contributor Author

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..."?

Copy link
Member

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.

Copy link
Member

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
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Member

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.

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 6, 2024
@auto-submit auto-submit bot merged commit 483ff70 into flutter:main Aug 6, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 6, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 6, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 7, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 7, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 7, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Aug 7, 2024
…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
TytaniumDev pushed a commit to TytaniumDev/flutter that referenced this pull request Aug 7, 2024
…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
DBowen33 pushed a commit to DBowen33/flutter that referenced this pull request Aug 16, 2024
…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
Buchimi pushed a commit to Buchimi/flutter that referenced this pull request Sep 2, 2024
…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
jmagman added a commit to jmagman/engine that referenced this pull request Sep 6, 2024
auto-submit bot pushed a commit that referenced this pull request Sep 11, 2024
#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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App platform-ios

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants