AX: AXIsolatedTree::updateChildren sometimes fails to update isolated subtrees when...
[WebKit-https.git] / Source / WebCore / html / SearchInputType.cpp
index 6e5b1e7fbe72bbd31bb98457e02ecd4c6a47de5f..d9cb7cf71c2ed546c369a8bda968d2cc1a1d4c3b 100644 (file)
@@ -140,7 +140,7 @@ auto SearchInputType::handleKeydownEvent(KeyboardEvent& event) -> ShouldCallBase
         return TextFieldInputType::handleKeydownEvent(event);
 
     const String& key = event.keyIdentifier();
-    if (key == "U+001B") {
+    if (key == "U+001B"_s) {
         Ref<HTMLInputElement> protectedInputElement(*element());
         protectedInputElement->setValueForUser(emptyString());
         protectedInputElement->onSearch();
@@ -219,4 +219,14 @@ float SearchInputType::decorationWidth() const
     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