[webkit-changes] [WebKit/WebKit] c6afca: Cherry-pick 260838 at main (9743d10df7bc). https://bu...
Chris Dumez
noreply at github.com
Thu Mar 16 14:26:49 PDT 2023
Branch: refs/heads/webkitglib/2.38
Home: https://github.com/WebKit/WebKit
Commit: c6afca4fa8a93481a68a95b86d4fc00d7b34cfb1
https://github.com/WebKit/WebKit/commit/c6afca4fa8a93481a68a95b86d4fc00d7b34cfb1
Author: Chris Dumez <cdumez at apple.com>
Date: 2023-03-16 (Thu, 16 Mar 2023)
Changed paths:
M LayoutTests/fast/forms/input-maxlength-paste-clusters-in-middle-expected.txt
M LayoutTests/fast/forms/input-maxlength-paste-clusters-in-middle.html
A LayoutTests/fast/forms/input-text-max-length-emojis-expected.txt
A LayoutTests/fast/forms/input-text-max-length-emojis.html
M LayoutTests/fast/forms/input-text-paste-maxlength-expected.txt
M LayoutTests/fast/forms/input-text-paste-maxlength.html
A LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/input-maxlength-emoji-expected.txt
A LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/input-maxlength-emoji.html
M LayoutTests/platform/glib/TestExpectations
M Source/WebCore/html/HTMLInputElement.cpp
M Source/WebCore/html/HTMLTextAreaElement.cpp
M Source/WebCore/html/InputType.cpp
M Source/WebCore/html/TextFieldInputType.cpp
M Tools/WebKitTestRunner/gtk/UIScriptControllerGtk.cpp
M Tools/WebKitTestRunner/gtk/UIScriptControllerGtk.h
Log Message:
-----------
Cherry-pick 260838 at main (9743d10df7bc). https://bugs.webkit.org/show_bug.cgi?id=252900
HTML maxlength attribute treats emoji of string length 11 as length 1
https://bugs.webkit.org/show_bug.cgi?id=252900
Reviewed by Ryosuke Niwa and Aditya Keerthi.
Per the HTML specification[1], minlength/maxlength attributes on <input> should
restrict the length of the value, which is defined in code units [2].
Historically, WebKit has been counting grapheme clusters instead of code units
because we felt it made more sense. However, Blink and Gecko follow the
specification and only WebKit has the particular behavior. This is bad for
interoperability and makes Web developers' life more difficult than it needs to
be.
As a result, I am proposing we update WebKit to align with the HTML
specification and other major browser engines.
[1] https://html.spec.whatwg.org/multipage/input.html#the-maxlength-and-minlength-attributes
[2] https://infra.spec.whatwg.org/#string-length
* LayoutTests/fast/forms/input-maxlength-paste-clusters-in-middle-expected.txt:
* LayoutTests/fast/forms/input-maxlength-paste-clusters-in-middle.html:
* LayoutTests/fast/forms/input-text-max-length-emojis-expected.txt: Added.
* LayoutTests/fast/forms/input-text-max-length-emojis.html: Added.
* LayoutTests/fast/forms/input-text-paste-maxlength-expected.txt:
* LayoutTests/fast/forms/input-text-paste-maxlength.html:
* Source/WebCore/html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::tooShort const):
(WebCore::HTMLInputElement::tooLong const):
* Source/WebCore/html/HTMLTextAreaElement.cpp:
(WebCore::computeLengthForSubmission):
* Source/WebCore/html/InputType.cpp:
(WebCore::InputType::validationMessage const):
* Source/WebCore/html/TextFieldInputType.cpp:
(WebCore::limitLength):
(WebCore::TextFieldInputType::handleBeforeTextInsertedEvent):
Canonical link: https://commits.webkit.org/260838@main
More information about the webkit-changes
mailing list