Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(932)

Unified Diff: Source/core/html/HTMLFormControlElement.cpp

Issue 620333002: Use invalidation sets for :invalid/:valid/:required/:optional. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/html/HTMLFormControlElement.cpp
diff --git a/Source/core/html/HTMLFormControlElement.cpp b/Source/core/html/HTMLFormControlElement.cpp
index 3526e51947edbc61ba26f5b8826b2fe9d2bd844c..2f06b0a87405b6efcea2b9d8ceacab58fef17c10 100644
--- a/Source/core/html/HTMLFormControlElement.cpp
+++ b/Source/core/html/HTMLFormControlElement.cpp
@@ -185,9 +185,8 @@ void HTMLFormControlElement::disabledAttributeChanged()
void HTMLFormControlElement::requiredAttributeChanged()
{
setNeedsValidityCheck();
- // Style recalculation is needed because style selectors may include
- // :required and :optional pseudo-classes.
- setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::fromAttribute(requiredAttr));
+ pseudoStateChanged(CSSSelector::PseudoRequired);
+ pseudoStateChanged(CSSSelector::PseudoOptional);
}
bool HTMLFormControlElement::supportsAutofocus() const
@@ -518,7 +517,8 @@ void HTMLFormControlElement::setNeedsValidityCheck()
if (willValidate() && newIsValid != m_isValid) {
formOwnerSetNeedsValidityCheck();
// Update style for pseudo classes such as :valid :invalid.
- setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Invalid));
+ pseudoStateChanged(CSSSelector::PseudoValid);
+ pseudoStateChanged(CSSSelector::PseudoInvalid);
}
m_isValid = newIsValid;

Powered by Google App Engine
This is Rietveld 408576698