From ad8d7fafc89d1db580a3990f9308063d7bc641f2 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Mon, 25 Nov 2024 14:03:05 -0800 Subject: [PATCH] iOS: Eliminate non-handling of non-zero origin platformviews 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 --- .../Source/platform_views_controller.h | 7 ------- .../Source/platform_views_controller.mm | 19 +------------------ 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/platform_views_controller.h b/shell/platform/darwin/ios/framework/Source/platform_views_controller.h index 056586d429456..06fd638244eed 100644 --- a/shell/platform/darwin/ios/framework/Source/platform_views_controller.h +++ b/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/shell/platform/darwin/ios/framework/Source/platform_views_controller.mm b/shell/platform/darwin/ios/framework/Source/platform_views_controller.mm index 819a6b8c12124..6893c3d0f8caa 100644 --- a/shell/platform/darwin/ios/framework/Source/platform_views_controller.mm +++ b/shell/platform/darwin/ios/framework/Source/platform_views_controller.mm @@ -537,26 +537,9 @@ bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect, // 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;