Skip to content

Commit 778ed9e

Browse files
auto-submit[bot]auto-submit[bot]
andauthored
Reverts "[web] fix text selection offset in multi-line fields (flutter#166565)" (flutter#166644)
<!-- start_original_pr_link --> Reverts: flutter#166565 <!-- end_original_pr_link --> <!-- start_initiating_author --> Initiated by: jtmcdole <!-- end_initiating_author --> <!-- start_revert_reason --> Reason for reverting: Tree is broken https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20linux_web_engine_tests/1240/overview <!-- end_revert_reason --> <!-- start_original_pr_author --> Original PR Author: yjbanov <!-- end_original_pr_author --> <!-- start_reviewers --> Reviewed By: {justinmc} <!-- end_reviewers --> <!-- start_revert_body --> This change reverts the following previous change: Fixes flutter#162698 <!-- end_revert_body --> Co-authored-by: auto-submit[bot] <[email protected]>
1 parent 31dfefc commit 778ed9e

File tree

5 files changed

+5
-56
lines changed

5 files changed

+5
-56
lines changed

engine/src/flutter/lib/web_ui/lib/src/engine/dom.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,6 @@ extension type DomCSSStyleDeclaration._(JSObject _) implements JSObject {
543543
set textAlign(String value) => setProperty('text-align', value);
544544
set font(String value) => setProperty('font', value);
545545
set cursor(String value) => setProperty('cursor', value);
546-
set scrollbarWidth(String value) => setProperty('scrollbar-width', value);
547546
String get width => getPropertyValue('width');
548547
String get height => getPropertyValue('height');
549548
String get position => getPropertyValue('position');
@@ -605,7 +604,6 @@ extension type DomCSSStyleDeclaration._(JSObject _) implements JSObject {
605604
String get textAlign => getPropertyValue('text-align');
606605
String get font => getPropertyValue('font');
607606
String get cursor => getPropertyValue('cursor');
608-
String get scrollbarWidth => getPropertyValue('scrollbar-width');
609607

610608
external String getPropertyValue(String property);
611609

engine/src/flutter/lib/web_ui/lib/src/engine/semantics/text_field.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import 'package:ui/ui.dart' as ui;
66

77
import '../dom.dart';
88
import '../platform_dispatcher.dart';
9-
import '../text_editing/input_type.dart';
109
import '../text_editing/text_editing.dart';
1110
import 'semantics.dart';
1211

@@ -230,7 +229,7 @@ class SemanticTextField extends SemanticRole {
230229
}
231230

232231
DomHTMLTextAreaElement _createMultiLineField() {
233-
final textArea = createMultilineTextArea();
232+
final textArea = createDomHTMLTextAreaElement();
234233

235234
if (semanticsObject.hasFlag(ui.SemanticsFlag.isObscured)) {
236235
// -webkit-text-security is not standard, but it's the best we can do.

engine/src/flutter/lib/web_ui/lib/src/engine/text_editing/input_type.dart

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class MultilineNoTextInputType extends MultilineInputType {
120120
String? get inputmodeAttribute => 'none';
121121

122122
@override
123-
DomHTMLElement createDomElement() => createMultilineTextArea();
123+
DomHTMLElement createDomElement() => createDomHTMLTextAreaElement();
124124
}
125125

126126
/// Single-line text input type.
@@ -184,12 +184,5 @@ class MultilineInputType extends EngineInputType {
184184
String? get inputmodeAttribute => null;
185185

186186
@override
187-
DomHTMLElement createDomElement() => createMultilineTextArea();
188-
}
189-
190-
DomHTMLTextAreaElement createMultilineTextArea() {
191-
final element = createDomHTMLTextAreaElement();
192-
// Scrollbar width affects text layout. This zeroes out the scrollbar width.
193-
element.style.scrollbarWidth = 'none';
194-
return element;
187+
DomHTMLElement createDomElement() => createDomHTMLTextAreaElement();
195188
}

engine/src/flutter/lib/web_ui/lib/src/engine/text_editing/text_editing.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ void _setStaticStyleAttributes(DomHTMLElement domElement) {
6464
// For more details, see: https://developer.mozilla.org/en-US/docs/Web/CSS/forced-color-adjust
6565
..setProperty('forced-color-adjust', 'none')
6666
..whiteSpace = 'pre-wrap'
67+
..alignContent = 'center'
6768
..position = 'absolute'
6869
..top = '0'
6970
..left = '0'
@@ -107,6 +108,7 @@ void _styleAutofillElements(
107108
final DomCSSStyleDeclaration elementStyle = domElement.style;
108109
elementStyle
109110
..whiteSpace = 'pre-wrap'
111+
..alignContent = 'center'
110112
..padding = '0'
111113
..opacity = '1'
112114
..color = 'transparent'

engine/src/flutter/lib/web_ui/test/engine/text_editing_test.dart

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -840,45 +840,6 @@ Future<void> testMain() async {
840840
expect(spy.messages, isEmpty);
841841
});
842842

843-
test('Does not align content in autofill group elements', () {
844-
final setClient = MethodCall('TextInput.setClient', <dynamic>[
845-
123,
846-
createFlutterConfig('text'),
847-
]);
848-
sendFrameworkMessage(codec.encodeMethodCall(setClient));
849-
850-
const setEditingState = MethodCall('TextInput.setEditingState', <String, dynamic>{
851-
'text': 'abcd',
852-
'selectionBase': 2,
853-
'selectionExtent': 3,
854-
});
855-
sendFrameworkMessage(codec.encodeMethodCall(setEditingState));
856-
857-
const show = MethodCall('TextInput.show');
858-
sendFrameworkMessage(codec.encodeMethodCall(show));
859-
860-
// Form elements
861-
{
862-
final formElement = textEditing!.configuration!.autofillGroup!.formElement;
863-
expect(formElement.style.alignContent, isEmpty);
864-
865-
// Should contain one <input type="text"> and one <input type="submit">
866-
expect(formElement.children, hasLength(2));
867-
868-
final inputElement = formElement.children.first;
869-
expect(inputElement.style.alignContent, isEmpty);
870-
871-
final submitElement = formElement.children.last;
872-
expect(submitElement.style.alignContent, isEmpty);
873-
}
874-
875-
// Active element
876-
{
877-
final DomHTMLElement activeElement = textEditing!.strategy.activeDomElement;
878-
expect(activeElement.style.alignContent, isEmpty);
879-
}
880-
});
881-
882843
test('focus and connection with blur', () async {
883844
// In all the desktop browsers we are keeping the connection
884845
// open, keep the text editing element focused if it receives a blur
@@ -3624,10 +3585,6 @@ Future<void> testMain() async {
36243585
// though it supports forced-colors. Safari doesn't support forced-colors
36253586
// so this isn't a problem there.
36263587
}, skip: isFirefox || isSafari);
3627-
3628-
test('Multi-line text area scrollbars are zero-width', () {
3629-
expect(createMultilineTextArea().style.scrollbarWidth, 'none');
3630-
});
36313588
});
36323589
}
36333590

0 commit comments

Comments
 (0)