Updating defaultValue in a non-dirty TEXTAREA should not move the caret to the end
According to the HTML standard, updating defaultValue should keep selectionStart/End, and clamp them if the new value is shorter than them. defaultValue setter doesn't have any explicit selection behavior [1], and we should apply default selection adjustment algorithm in such case [2]. The new behavior matches to Edge, Firefox, and Safari. Some test cases in selection-start-end-extra.html were not correct. This CL fixes them. Remove some test cases in textarea-selection-preservation.html because they are covered by WPT. [1] https://html.spec.whatwg.org/multipage/form-elements.html#the-textarea-element:dom-textarea-defaultvalue-2 [2] https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#textFieldSelection:concept-textarea/input-relevant-value Bug: 822639 Change-Id: I77db0934bb10774561e947f64b4cb3f88c293679 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1575317 Commit-Queue: Kent Tamura <tkent@chromium.org> Reviewed-by:Yoshifumi Inoue <yosin@chromium.org> Cr-Commit-Position: refs/heads/master@{#653487}
Showing
Please register or sign in to comment