Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Support :user-invalid / :user-valid pseudo-classes
https://bugs.webkit.org/show_bug.cgi?id=222267 rdar://74866546 Reviewed by Aditya Keerthi. https://w3c.github.io/csswg-drafts/selectors/#user-pseudos > The :user-invalid and the :user-valid pseudo-classes represent an element with incorrect or correct input, respectively, but only after the user has significantly interacted with it. "significant user interaction" here is implemented as the first time the change event is emitted for a control, which is in practice represents when the user has finished entering a value then moves focus away from the element. This matches Firefox's behavior. User-initiated form submissions reset the state as the CSSWG spec says. Based on patch by Devin Rousso. * LayoutTests/imported/w3c/web-platform-tests/css/selectors/user-invalid-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/selectors/user-valid-expected.txt: * Source/WebCore/css/CSSSelector.cpp: (WebCore::CSSSelector::selectorText const): * Source/WebCore/css/CSSSelector.h: * Source/WebCore/css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne const): * Source/WebCore/css/SelectorCheckerTestFunctions.h: (WebCore::matchesUserInvalidPseudoClass): (WebCore::matchesUserValidPseudoClass): * Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in: * Source/WebCore/cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::JSC_DEFINE_JIT_OPERATION): (WebCore::SelectorCompiler::addPseudoClassType): * Source/WebCore/html/FileInputType.cpp: (WebCore::FileInputType::setFiles): * Source/WebCore/html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::HTMLFormControlElement): (WebCore::HTMLFormControlElement::setInteractedWithSinceLastFormSubmitEvent): (WebCore::HTMLFormControlElement::dispatchFormControlChangeEvent): (WebCore::HTMLFormControlElement::updateValidity): (WebCore::HTMLFormControlElement::matchesUserInvalidPseudoClass const): (WebCore::HTMLFormControlElement::matchesUserValidPseudoClass const): * Source/WebCore/html/HTMLFormControlElement.h: (WebCore::HTMLFormControlElement::wasInteractedWithSinceLastFormSubmitEvent const): * Source/WebCore/html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::submitIfPossible): * Source/WebCore/html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::dispatchFormControlChangeEvent): Canonical link: https://commits.webkit.org/257997@main
- Loading branch information
Showing
13 changed files
with
102 additions
and
3 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
LayoutTests/imported/w3c/web-platform-tests/css/selectors/user-invalid-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
|
||
FAIL :user-invalid selector should be supported The string did not match the expected pattern. | ||
PASS :user-invalid selector should be supported | ||
PASS :user-error selector should not be supported | ||
|
2 changes: 1 addition & 1 deletion
2
LayoutTests/imported/w3c/web-platform-tests/css/selectors/user-valid-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
|
||
FAIL :user-valid selector should be supported The string did not match the expected pattern. | ||
PASS :user-valid selector should be supported | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,8 @@ scope | |
single-button | ||
start | ||
target | ||
user-invalid | ||
user-valid | ||
valid | ||
vertical | ||
visited | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters