Skip to content

Commit 82f547e

Browse files
author
zsun@igalia.com
committed
[selection] HTMLTextFormControlElement::subtreeHasChanged() shouldn't be called in setRangeText
https://bugs.webkit.org/show_bug.cgi?id=237720 Reviewed by Chris Dumez. LayoutTests/imported/w3c: Update test expectations as more sub-tests are now passing. * web-platform-tests/html/semantics/forms/textfieldselection/selection-value-interactions-expected.txt: * web-platform-tests/html/semantics/forms/textfieldselection/textfieldselection-setRangeText-expected.txt: Source/WebCore: We shouldn't call HTMLTextFormControlElement::subtreeHasChanged() in HTMLTextFormControlElement::setRangeText. It has been removed in patch for bug 237641. This patch is to further remove unnecessary code. This change refers and imports some of the changes in chromium CL at https://codereview.chromium.org/1577243002 * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::setRangeText): LayoutTests: Update test expectation as the test is now passing. * fast/forms/setrangetext-expected.txt: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@291555 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent b0f001c commit 82f547e

File tree

7 files changed

+52
-22
lines changed

7 files changed

+52
-22
lines changed

LayoutTests/ChangeLog

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
2022-03-21 Ziran Sun <zsun@igalia.com>
2+
3+
[selection] HTMLTextFormControlElement::subtreeHasChanged() shouldn't be called in setRangeText
4+
https://bugs.webkit.org/show_bug.cgi?id=237720
5+
6+
Reviewed by Chris Dumez.
7+
8+
Update test expectation as the test is now passing.
9+
* fast/forms/setrangetext-expected.txt:
10+
111
2022-03-21 Carlos Garcia Campos <cgarcia@igalia.com>
212

313
REGRESSION(r286955): Rendering Links during search: highlighting fails

LayoutTests/fast/forms/setrangetext-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ PASS element.setRangeText('A', 7, 3) threw exception IndexSizeError: The index i
597597
Check that setRangeText() on disconnected elements doesn't crash and has proper values.
598598
element.value = '0123456789'
599599
element.setRangeText('ABC', 0, 0, 'select')
600-
FAIL element.value should be ABC0123456789. Was 0123456789.
600+
PASS element.value is "ABC0123456789"
601601

602602
Running tests on input with attributes: {"type":"button"}
603603

LayoutTests/imported/w3c/ChangeLog

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
2022-03-21 Ziran Sun <zsun@igalia.com>
2+
3+
[selection] HTMLTextFormControlElement::subtreeHasChanged() shouldn't be called in setRangeText
4+
https://bugs.webkit.org/show_bug.cgi?id=237720
5+
6+
Reviewed by Chris Dumez.
7+
8+
Update test expectations as more sub-tests are now passing.
9+
* web-platform-tests/html/semantics/forms/textfieldselection/selection-value-interactions-expected.txt:
10+
* web-platform-tests/html/semantics/forms/textfieldselection/textfieldselection-setRangeText-expected.txt:
11+
112
2022-03-20 Oriol Brufau <obrufau@igalia.com>
213

314
Fix CSS cascade regarding logical properties

LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/textfieldselection/selection-value-interactions-expected.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

2-
FAIL value dirty flag behavior after setRangeText on textarea not in body assert_equals: Calling setRangeText should set the value dirty flag expected "somexyzing" but got "set range text"
3-
FAIL value dirty flag behavior after setRangeText on input not in body assert_equals: Calling setRangeText should set the value dirty flag expected "somexyzing" but got "set range text"
2+
PASS value dirty flag behavior after setRangeText on textarea not in body
3+
PASS value dirty flag behavior after setRangeText on input not in body
44
PASS value dirty flag behavior after setRangeText on textarea in body
55
PASS value dirty flag behavior after setRangeText on input in body
66
PASS value dirty flag behavior after setRangeText on textarea in body with parsed default value

LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/textfieldselection/textfieldselection-setRangeText-expected.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ PASS password setRangeText without argument throws a type error
5656
NOTRUN password setRangeText fires a select event
5757
NOTRUN password setRangeText fires a select event when fully selected
5858
NOTRUN password setRangeText fires a select event after select()
59-
FAIL display_none setRangeText with only one argument replaces the value between selectionStart and selectionEnd, otherwise replaces the value between 2nd and 3rd arguments assert_equals: expected "foobar2bar" but got "foobar"
60-
FAIL display_none selectionMode missing assert_equals: expected "foobar2bar" but got "foobar"
61-
FAIL display_none selectionMode 'select' assert_equals: expected "foofoo" but got "foobar"
62-
FAIL display_none selectionMode 'start' assert_equals: expected "foofoo" but got "foobar"
63-
FAIL display_none selectionMode 'end' assert_equals: expected "foofoobar" but got "foobar"
64-
FAIL display_none selectionMode 'preserve' assert_equals: expected "foo" but got "foobar"
59+
PASS display_none setRangeText with only one argument replaces the value between selectionStart and selectionEnd, otherwise replaces the value between 2nd and 3rd arguments
60+
PASS display_none selectionMode missing
61+
PASS display_none selectionMode 'select'
62+
PASS display_none selectionMode 'start'
63+
PASS display_none selectionMode 'end'
64+
PASS display_none selectionMode 'preserve'
6565
PASS display_none setRangeText with 3rd argument greater than 2nd argument throws an IndexSizeError exception
6666
PASS display_none setRangeText without argument throws a type error
6767
NOTRUN display_none setRangeText fires a select event
@@ -78,12 +78,12 @@ PASS textarea setRangeText without argument throws a type error
7878
NOTRUN textarea setRangeText fires a select event
7979
NOTRUN textarea setRangeText fires a select event when fully selected
8080
NOTRUN textarea setRangeText fires a select event after select()
81-
FAIL input_not_in_doc setRangeText with only one argument replaces the value between selectionStart and selectionEnd, otherwise replaces the value between 2nd and 3rd arguments assert_equals: expected "foobar2bar" but got "foobar"
82-
FAIL input_not_in_doc selectionMode missing assert_equals: expected "foobar2bar" but got "foobar"
83-
FAIL input_not_in_doc selectionMode 'select' assert_equals: expected "foofoo" but got "foobar"
84-
FAIL input_not_in_doc selectionMode 'start' assert_equals: expected "foofoo" but got "foobar"
85-
FAIL input_not_in_doc selectionMode 'end' assert_equals: expected "foofoobar" but got "foobar"
86-
FAIL input_not_in_doc selectionMode 'preserve' assert_equals: expected "foo" but got "foobar"
81+
PASS input_not_in_doc setRangeText with only one argument replaces the value between selectionStart and selectionEnd, otherwise replaces the value between 2nd and 3rd arguments
82+
PASS input_not_in_doc selectionMode missing
83+
PASS input_not_in_doc selectionMode 'select'
84+
PASS input_not_in_doc selectionMode 'start'
85+
PASS input_not_in_doc selectionMode 'end'
86+
PASS input_not_in_doc selectionMode 'preserve'
8787
PASS input_not_in_doc setRangeText with 3rd argument greater than 2nd argument throws an IndexSizeError exception
8888
PASS input_not_in_doc setRangeText without argument throws a type error
8989
NOTRUN input_not_in_doc setRangeText fires a select event

Source/WebCore/ChangeLog

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
2022-03-21 Ziran Sun <zsun@igalia.com>
2+
3+
[selection] HTMLTextFormControlElement::subtreeHasChanged() shouldn't be called in setRangeText
4+
https://bugs.webkit.org/show_bug.cgi?id=237720
5+
6+
Reviewed by Chris Dumez.
7+
8+
We shouldn't call HTMLTextFormControlElement::subtreeHasChanged() in HTMLTextFormControlElement::setRangeText.
9+
It has been removed in patch for bug 237641. This patch is to further remove unnecessary code.
10+
11+
This change refers and imports some of the changes in chromium CL at
12+
https://codereview.chromium.org/1577243002
13+
14+
* html/HTMLTextFormControlElement.cpp:
15+
(WebCore::HTMLTextFormControlElement::setRangeText):
16+
117
2022-03-21 Carlos Garcia Campos <cgarcia@igalia.com>
218

319
REGRESSION(r286955): Rendering Links during search: highlighting fails

Source/WebCore/html/HTMLTextFormControlElement.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,6 @@ ExceptionOr<void> HTMLTextFormControlElement::setRangeText(const String& replace
255255
else
256256
text.insert(replacement, start);
257257

258-
// FIXME: This shouldn't need synchronous style update, or renderer at all.
259-
if (!renderer())
260-
document().updateStyleIfNeeded();
261-
262-
if (!renderer())
263-
return { };
264-
265258
setValue(text, TextFieldEventBehavior::DispatchNoEvent, TextControlSetValueSelection::DoNotSet);
266259

267260
if (equalLettersIgnoringASCIICase(selectionMode, "select")) {

0 commit comments

Comments
 (0)