Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0953c69
fix: Skip updating selection range during composition
koji-1009 Jan 13, 2025
3e19c27
Apply suggestions from code review
koji-1009 Mar 21, 2025
347faf1
test: Add test case
koji-1009 Mar 21, 2025
043a852
Update engine/src/flutter/lib/web_ui/test/engine/text_editing_test.dart
koji-1009 Mar 21, 2025
984d3f5
test: Fix test case
koji-1009 Mar 21, 2025
bbd217b
Update engine/src/flutter/lib/web_ui/lib/src/engine/text_editing/text…
koji-1009 Apr 7, 2025
3886c3b
Apply suggestions from code review
koji-1009 Apr 14, 2025
3387efa
remove: sync main
koji-1009 Apr 15, 2025
cae5264
fix: Disable shift + arrow key on web platform
koji-1009 Apr 15, 2025
53d4f90
test: Add test cases
koji-1009 Apr 15, 2025
4a70b0a
refactor: sort
koji-1009 Apr 15, 2025
96041b1
test: Remove unsupported shortcuts test
koji-1009 Apr 15, 2025
0f1b383
Revert "test: Remove unsupported shortcuts test"
koji-1009 Apr 16, 2025
256b691
Revert "refactor: sort"
koji-1009 Apr 16, 2025
b4c0c91
Revert "test: Add test cases"
koji-1009 Apr 16, 2025
b8b83f6
Revert "fix: Disable shift + arrow key on web platform"
koji-1009 Apr 16, 2025
56576be
fix: Reflecting the composing process to Japanese text input
koji-1009 Apr 17, 2025
26a2640
test: Fix test case
koji-1009 Apr 18, 2025
85715ed
test: Add unit test
koji-1009 Apr 18, 2025
a5a8d7d
Revert "test: Add unit test"
koji-1009 Apr 22, 2025
317d1cf
test: Add unit test
koji-1009 Apr 23, 2025
abc3526
fix: Support partically selected style
koji-1009 Apr 28, 2025
1d37d47
test: Update unit test
koji-1009 Apr 28, 2025
1b23ee0
feat: Hold composingBase
koji-1009 May 16, 2025
ece4d52
test: Add unit test
koji-1009 May 16, 2025
fe51d20
fix: unit test
koji-1009 May 17, 2025
6d52b03
fix: Support home and end key
koji-1009 May 24, 2025
f060af9
refactor: Fix type and rename
koji-1009 May 30, 2025
d70db66
refactor: Remove line
koji-1009 May 31, 2025
d8b1720
Merge branch 'master' into fix/web_composing_range
koji-1009 May 31, 2025
1eb4915
chore: run test
koji-1009 May 31, 2025
cb6c360
Merge branch 'master' into fix/web_composing_range
koji-1009 Jun 1, 2025
8a48530
Merge branch 'master' into fix/web_composing_range
koji-1009 Jun 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove: sync main
  • Loading branch information
koji-1009 committed May 31, 2025
commit 3387efa4e3bb9f4d90580b68a2027d762a441f6d
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ mixin CompositionAwareMixin {
/// so it is safe to reference it to get the current composingText.
String? composingText;

/// Whether the `domElement` is currently composing text.
bool get isComposing => composingText != null;

void addCompositionEventHandlers(DomHTMLElement domElement) {
domElement.addEventListener(_kCompositionStart, _compositionStartListener);
domElement.addEventListener(_kCompositionUpdate, _compositionUpdateListener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -967,25 +967,18 @@ class EditingState {
/// elements can have their text selection range set. Attempting to set
/// selection range on a non-focused element will cause it to request focus.
///
/// If text is in the composing state, the composing range is not updated by
/// [updateSelection] being `true`.
///
/// See also:
///
/// * [applyTextToDomElement], which is used for non-focused elements.
void applyToDomElement(DomHTMLElement? domElement, {bool updateSelection = true}) {
void applyToDomElement(DomHTMLElement? domElement) {
if (domElement != null && domElement.isA<DomHTMLInputElement>()) {
final DomHTMLInputElement element = domElement as DomHTMLInputElement;
element.value = text;
if (updateSelection) {
element.setSelectionRange(minOffset, maxOffset);
}
element.setSelectionRange(minOffset, maxOffset);
} else if (domElement != null && domElement.isA<DomHTMLTextAreaElement>()) {
final DomHTMLTextAreaElement element = domElement as DomHTMLTextAreaElement;
element.value = text;
if (updateSelection) {
element.setSelectionRange(minOffset, maxOffset);
}
element.setSelectionRange(minOffset, maxOffset);
} else {
throw UnsupportedError(
'Unsupported DOM element type: <${domElement?.tagName}> (${domElement.runtimeType})',
Expand Down Expand Up @@ -1162,7 +1155,7 @@ class GloballyPositionedTextEditingStrategy extends DefaultTextEditingStrategy {
// Set the last editing state if it exists, this is critical for a
// users ongoing work to continue uninterrupted when there is an update to
// the transform.
lastEditingState?.applyToDomElement(domElement, updateSelection: !isComposing);
lastEditingState?.applyToDomElement(domElement);
// On Chrome, when a form is focused, it opens an autofill menu
// immediately.
// Flutter framework sends `setEditableSizeAndTransform` for informing
Expand Down Expand Up @@ -1213,7 +1206,7 @@ class SafariDesktopTextEditingStrategy extends DefaultTextEditingStrategy {
// the transform.
// If domElement is not focused cursor location will not be correct.
moveFocusToActiveDomElement();
lastEditingState?.applyToDomElement(activeDomElement, updateSelection: !isComposing);
lastEditingState?.applyToDomElement(activeDomElement);
}
}

Expand Down Expand Up @@ -1471,7 +1464,7 @@ abstract class DefaultTextEditingStrategy
if (!isEnabled || !editingState!.isValid) {
return;
}
lastEditingState!.applyToDomElement(domElement, updateSelection: !isComposing);
lastEditingState!.applyToDomElement(domElement);
}

void placeElement() {
Expand Down Expand Up @@ -1992,7 +1985,7 @@ class FirefoxTextEditingStrategy extends GloballyPositionedTextEditingStrategy {
// Set the last editing state if it exists, this is critical for a
// users ongoing work to continue uninterrupted when there is an update to
// the transform.
lastEditingState?.applyToDomElement(activeDomElement, updateSelection: !isComposing);
lastEditingState?.applyToDomElement(activeDomElement);
}
}

Expand Down
21 changes: 0 additions & 21 deletions engine/src/flutter/lib/web_ui/test/engine/text_editing_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2194,27 +2194,6 @@ Future<void> testMain() async {
hideKeyboard();
});

test('Do not update composingBase and composingExtent while composing Text', () {
showKeyboard(inputType: 'text');
// 'text' is input as a composing target.
editingStrategy!.composingText = 'test';
sendFrameworkMessage(
codec.encodeMethodCall(
const MethodCall('TextInput.setEditingState', <String, dynamic>{
'text': 'test',
'selectionBase': 4,
'selectionExtent': 0,
}),
),
);

// 'text' is composed as Japanese, and baseOffset and extentOffset are updated.
final EditingState editingState = EditingState(text: 'test', baseOffset: 0, extentOffset: 1);
editingStrategy!.setEditingState(editingState);

checkInputEditingState(textEditing!.strategy.domElement, 'test', 0, 4);
});

test('Supports deletion at inverted selection', () async {
final MethodCall setClient = MethodCall('TextInput.setClient', <dynamic>[
123,
Expand Down