From af2d5bc5ca4f10aed3c2ba8a4b6e534ce2805c2a Mon Sep 17 00:00:00 2001 From: Callum Moffat Date: Thu, 6 Oct 2022 19:08:06 -0400 Subject: [PATCH] Send text selection rects to engine on iPhone (#113048) --- packages/flutter/lib/src/widgets/editable_text.dart | 8 -------- packages/flutter/test/widgets/editable_text_test.dart | 4 ++++ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/flutter/lib/src/widgets/editable_text.dart b/packages/flutter/lib/src/widgets/editable_text.dart index babed8a186a..745bf8e8a6b 100644 --- a/packages/flutter/lib/src/widgets/editable_text.dart +++ b/packages/flutter/lib/src/widgets/editable_text.dart @@ -63,10 +63,6 @@ const Duration _kCursorBlinkHalfPeriod = Duration(milliseconds: 500); // is shown in an obscured text field. const int _kObscureShowLatestCharCursorTicks = 3; -// The minimum width of an iPad screen. The smallest iPad is currently the -// iPad Mini 6th Gen according to ios-resolution.com. -const double _kIPadWidth = 1488.0; - /// A controller for an editable text field. /// /// Whenever the user modifies a text field with an associated @@ -3144,10 +3140,6 @@ class EditableTextState extends State with AutomaticKeepAliveClien if (defaultTargetPlatform != TargetPlatform.iOS) { return; } - // This is to avoid sending selection rects on non-iPad devices. - if (WidgetsBinding.instance.window.physicalSize.shortestSide < _kIPadWidth) { - return; - } final String text = renderEditable.text?.toPlainText(includeSemanticsLabels: false) ?? ''; final List firstSelectionBoxes = renderEditable.getBoxesForSelection(const TextSelection(baseOffset: 0, extentOffset: 1)); diff --git a/packages/flutter/test/widgets/editable_text_test.dart b/packages/flutter/test/widgets/editable_text_test.dart index ff0f2375f5c..f96d9a7ff39 100644 --- a/packages/flutter/test/widgets/editable_text_test.dart +++ b/packages/flutter/test/widgets/editable_text_test.dart @@ -4624,6 +4624,10 @@ void main() { }); testWidgets('selection rects are sent when they change', (WidgetTester tester) async { + addTearDown(tester.binding.window.clearPhysicalSizeTestValue); + // Ensure selection rects are sent on iPhone (using SE 3rd gen size) + tester.binding.window.physicalSizeTestValue = const Size(750.0, 1334.0); + final List log = []; SystemChannels.textInput.setMockMethodCallHandler((MethodCall methodCall) async { log.add(methodCall);