From a661e86e3f630ed0ef79c99d98c081bc332b0fdd Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Mon, 25 Nov 2024 15:38:59 -0800 Subject: [PATCH] iOS: Eliminate logging of non-zero origin platformviews (flutter/engine#56796) In flutter/engine#35501, handling was added to log a debug message to the console in the case where a platform view with a non-zero origin was identified. Unfortunately: * In unopt builds, the first thing we do in that block is to call FML_DCHECK asserting that the origin is zero, so we never actually emit the log statement. * In opt builds, FML_DCHECK is a no-op, so users are unlikely to actually ever notice the crash. The proper fix is to eliminate this restriction, but in the meantime, this eliminates this block entirely and leaves the TODO. We've had only two comments on that bug in the 2.5 years since it was added. Issue: https://github.com/flutter/flutter/issues/109700 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style --- .../Source/platform_views_controller.h | 7 ------- .../Source/platform_views_controller.mm | 19 +------------------ 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/platform_views_controller.h b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/platform_views_controller.h index 056586d429..06fd638244 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/platform_views_controller.h +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/platform_views_controller.h @@ -295,13 +295,6 @@ class PlatformViewsController { /// This state is only modified on the raster thread. std::unordered_set views_to_recomposite_; -#if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG - /// A set to keep track of embedded views that do not have (0, 0) origin. - /// An insertion triggers a warning message about non-zero origin logged on the debug console. - /// See https://github.com/flutter/flutter/issues/109700 for details. - std::unordered_set non_zero_origin_views_; -#endif - /// @brief The composition order from the previous thread. /// /// Only accessed from the platform thread. diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/platform_views_controller.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/platform_views_controller.mm index 819a6b8c12..6893c3d0f8 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/platform_views_controller.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/platform_views_controller.mm @@ -537,26 +537,9 @@ void PlatformViewsController::ApplyMutators(const MutatorsStack& mutators_stack, // included in the `views_to_recomposite_`. void PlatformViewsController::CompositeWithParams(int64_t view_id, const EmbeddedViewParams& params) { + /// TODO(https://github.com/flutter/flutter/issues/109700) CGRect frame = CGRectMake(0, 0, params.sizePoints().width(), params.sizePoints().height()); FlutterTouchInterceptingView* touchInterceptor = platform_views_[view_id].touch_interceptor; -#if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG - FML_DCHECK(CGPointEqualToPoint([touchInterceptor embeddedView].frame.origin, CGPointZero)); - if (non_zero_origin_views_.find(view_id) == non_zero_origin_views_.end() && - !CGPointEqualToPoint([touchInterceptor embeddedView].frame.origin, CGPointZero)) { - non_zero_origin_views_.insert(view_id); - NSLog( - @"A Embedded PlatformView's origin is not CGPointZero.\n" - " View id: %@\n" - " View info: \n %@ \n" - "A non-zero origin might cause undefined behavior.\n" - "See https://github.com/flutter/flutter/issues/109700 for more details.\n" - "If you are the author of the PlatformView, please update the implementation of the " - "PlatformView to have a (0, 0) origin.\n" - "If you have a valid case of using a non-zero origin, " - "please leave a comment at https://github.com/flutter/flutter/issues/109700 with details.", - @(view_id), [touchInterceptor embeddedView]); - } -#endif touchInterceptor.layer.transform = CATransform3DIdentity; touchInterceptor.frame = frame; touchInterceptor.alpha = 1;