PASS :valid invalidation
FAIL :default invalidation with input[type=radio] assert_equals: ancestor should be lightblue expected "rgb(173, 216, 230)" but got "rgb(0, 0, 0)"
PASS :required invalidation
-FAIL :out-of-range invalidation assert_equals: ancestor should be darkgreen expected "rgb(0, 100, 0)" but got "rgb(0, 0, 0)"
+PASS :out-of-range invalidation
PASS :placeholder-shown invalidation
#include "NumberInputType.h"
#include "Page.h"
#include "PasswordInputType.h"
+#include "PseudoClassChangeInvalidation.h"
#include "RadioInputType.h"
#include "RangeInputType.h"
#include "RenderElement.h"
void InputType::setValue(const String& sanitizedValue, bool valueChanged, TextFieldEventBehavior eventBehavior, TextControlSetValueSelection)
{
ASSERT(element());
- element()->setValueInternal(sanitizedValue, eventBehavior);
- if (!valueChanged)
+ if (!valueChanged) {
+ element()->setValueInternal(sanitizedValue, eventBehavior);
return;
- element()->invalidateStyleForSubtree();
+ }
+
+ bool wasInRange = isInRange(element()->value());
+ bool inRange = isInRange(sanitizedValue);
+
+ bool dummy;
+ auto oldDirection = element()->directionalityIfhasDirAutoAttribute(dummy);
+
+ std::optional<Style::PseudoClassChangeInvalidation> styleInvalidation;
+ if (wasInRange != inRange)
+ emplace(styleInvalidation, *element(), { { CSSSelector::PseudoClassInRange, inRange }, { CSSSelector::PseudoClassOutOfRange, !inRange } });
+
+ element()->setValueInternal(sanitizedValue, eventBehavior);
+
+ if (oldDirection != element()->directionalityIfhasDirAutoAttribute(dummy))
+ element()->invalidateStyleInternal();
switch (eventBehavior) {
case DispatchChangeEvent:
return width;
}
+void SearchInputType::setValue(const String& sanitizedValue, bool valueChanged, TextFieldEventBehavior eventBehavior, TextControlSetValueSelection selection)
+{
+ bool emptinessChanged = valueChanged && sanitizedValue.isEmpty() != element()->value().isEmpty();
+
+ BaseTextInputType::setValue(sanitizedValue, valueChanged, eventBehavior, selection);
+
+ if (m_cancelButton && emptinessChanged)
+ m_cancelButton->invalidateStyleInternal();
+}
+
} // namespace WebCore
void didSetValueByUserEdit() final;
bool sizeShouldIncludeDecoration(int defaultSize, int& preferredSize) const final;
float decorationWidth() const final;
+ void setValue(const String&, bool valueChanged, TextFieldEventBehavior, TextControlSetValueSelection) final;
void searchEventTimerFired();
bool searchEventsShouldBeDispatched() const;