Unverified Commit af2d5bc5 authored by Callum Moffat's avatar Callum Moffat Committed by GitHub

Send text selection rects to engine on iPhone (#113048)

parent 00f36b64
......@@ -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<EditableText> 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<Rect> firstSelectionBoxes = renderEditable.getBoxesForSelection(const TextSelection(baseOffset: 0, extentOffset: 1));
......
......@@ -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<MethodCall> log = <MethodCall>[];
SystemChannels.textInput.setMockMethodCallHandler((MethodCall methodCall) async {
log.add(methodCall);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment