Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 9a503b34f22f8b58a6335bf7d7dea506e2515c2e https://github.com/WebKit/WebKit/commit/9a503b34f22f8b58a6335bf7d7dea506e2515c2e Author: Tim Nguyen <n...@apple.com> Date: 2022-12-16 (Fri, 16 Dec 2022)
Changed paths: M LayoutTests/imported/w3c/web-platform-tests/css/selectors/user-invalid-expected.txt M LayoutTests/imported/w3c/web-platform-tests/css/selectors/user-valid-expected.txt M Source/WebCore/css/CSSSelector.cpp M Source/WebCore/css/CSSSelector.h M Source/WebCore/css/SelectorChecker.cpp M Source/WebCore/css/SelectorCheckerTestFunctions.h M Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in M Source/WebCore/cssjit/SelectorCompiler.cpp M Source/WebCore/html/FileInputType.cpp M Source/WebCore/html/HTMLFormControlElement.cpp M Source/WebCore/html/HTMLFormControlElement.h M Source/WebCore/html/HTMLFormElement.cpp M Source/WebCore/html/HTMLTextFormControlElement.cpp Log Message: ----------- 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 _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes