Diff
Modified: trunk/Source/WebCore/ChangeLog (272179 => 272180)
--- trunk/Source/WebCore/ChangeLog 2021-02-02 00:09:40 UTC (rev 272179)
+++ trunk/Source/WebCore/ChangeLog 2021-02-02 00:14:23 UTC (rev 272180)
@@ -1,3 +1,30 @@
+2021-02-01 Simon Fraser <[email protected]>
+
+ Devirtualize InputType::supportsValidation()
+ https://bugs.webkit.org/show_bug.cgi?id=221216
+
+ Reviewed by Yusuke Suzuki.
+
+ InputType::supportsValidation() can just check the type. Use an OptionSet<> of exclusions
+ for clarity.
+
+ * html/ButtonInputType.cpp:
+ (WebCore::ButtonInputType::supportsValidation const): Deleted.
+ * html/ButtonInputType.h:
+ * html/HiddenInputType.cpp:
+ (WebCore::HiddenInputType::supportsValidation const): Deleted.
+ * html/HiddenInputType.h:
+ * html/ImageInputType.cpp:
+ (WebCore::ImageInputType::supportsValidation const): Deleted.
+ * html/ImageInputType.h:
+ * html/InputType.cpp:
+ (WebCore::InputType::supportsValidation const): Deleted.
+ * html/InputType.h:
+ (WebCore::InputType::supportsValidation const):
+ * html/ResetInputType.cpp:
+ (WebCore::ResetInputType::supportsValidation const): Deleted.
+ * html/ResetInputType.h:
+
2021-02-01 Antoine Quint <[email protected]>
Allow support for CAAnimationGroup
Modified: trunk/Source/WebCore/html/ButtonInputType.cpp (272179 => 272180)
--- trunk/Source/WebCore/html/ButtonInputType.cpp 2021-02-02 00:09:40 UTC (rev 272179)
+++ trunk/Source/WebCore/html/ButtonInputType.cpp 2021-02-02 00:14:23 UTC (rev 272180)
@@ -40,9 +40,4 @@
return InputTypeNames::button();
}
-bool ButtonInputType::supportsValidation() const
-{
- return false;
-}
-
} // namespace WebCore
Modified: trunk/Source/WebCore/html/ButtonInputType.h (272179 => 272180)
--- trunk/Source/WebCore/html/ButtonInputType.h 2021-02-02 00:09:40 UTC (rev 272179)
+++ trunk/Source/WebCore/html/ButtonInputType.h 2021-02-02 00:14:23 UTC (rev 272180)
@@ -41,7 +41,6 @@
private:
const AtomString& formControlType() const override;
- bool supportsValidation() const override;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/html/HiddenInputType.cpp (272179 => 272180)
--- trunk/Source/WebCore/html/HiddenInputType.cpp 2021-02-02 00:09:40 UTC (rev 272179)
+++ trunk/Source/WebCore/html/HiddenInputType.cpp 2021-02-02 00:14:23 UTC (rev 272180)
@@ -62,11 +62,6 @@
element()->setAttributeWithoutSynchronization(valueAttr, state[0]);
}
-bool HiddenInputType::supportsValidation() const
-{
- return false;
-}
-
RenderPtr<RenderElement> HiddenInputType::createInputRenderer(RenderStyle&&)
{
ASSERT_NOT_REACHED();
Modified: trunk/Source/WebCore/html/HiddenInputType.h (272179 => 272180)
--- trunk/Source/WebCore/html/HiddenInputType.h 2021-02-02 00:09:40 UTC (rev 272179)
+++ trunk/Source/WebCore/html/HiddenInputType.h 2021-02-02 00:14:23 UTC (rev 272180)
@@ -43,7 +43,6 @@
const AtomString& formControlType() const override;
FormControlState saveFormControlState() const override;
void restoreFormControlState(const FormControlState&) override;
- bool supportsValidation() const override;
RenderPtr<RenderElement> createInputRenderer(RenderStyle&&) override;
bool accessKeyAction(bool sendMouseEvents) override;
bool rendererIsNeeded() override;
Modified: trunk/Source/WebCore/html/ImageInputType.cpp (272179 => 272180)
--- trunk/Source/WebCore/html/ImageInputType.cpp 2021-02-02 00:09:40 UTC (rev 272179)
+++ trunk/Source/WebCore/html/ImageInputType.cpp 2021-02-02 00:14:23 UTC (rev 272180)
@@ -77,11 +77,6 @@
return true;
}
-bool ImageInputType::supportsValidation() const
-{
- return false;
-}
-
void ImageInputType::handleDOMActivateEvent(Event& event)
{
ASSERT(element());
Modified: trunk/Source/WebCore/html/ImageInputType.h (272179 => 272180)
--- trunk/Source/WebCore/html/ImageInputType.h 2021-02-02 00:09:40 UTC (rev 272179)
+++ trunk/Source/WebCore/html/ImageInputType.h 2021-02-02 00:14:23 UTC (rev 272180)
@@ -46,7 +46,6 @@
const AtomString& formControlType() const final;
bool isFormDataAppendable() const final;
bool appendFormData(DOMFormData&, bool) const final;
- bool supportsValidation() const final;
RenderPtr<RenderElement> createInputRenderer(RenderStyle&&) final;
void handleDOMActivateEvent(Event&) final;
void attributeChanged(const QualifiedName&) final;
Modified: trunk/Source/WebCore/html/InputType.cpp (272179 => 272180)
--- trunk/Source/WebCore/html/InputType.cpp 2021-02-02 00:09:40 UTC (rev 272179)
+++ trunk/Source/WebCore/html/InputType.cpp 2021-02-02 00:14:23 UTC (rev 272180)
@@ -226,11 +226,6 @@
return Exception { InvalidStateError };
}
-bool InputType::supportsValidation() const
-{
- return true;
-}
-
bool InputType::typeMismatchFor(const String&) const
{
return false;
Modified: trunk/Source/WebCore/html/InputType.h (272179 => 272180)
--- trunk/Source/WebCore/html/InputType.h 2021-02-02 00:09:40 UTC (rev 272179)
+++ trunk/Source/WebCore/html/InputType.h 2021-02-02 00:14:23 UTC (rev 272180)
@@ -137,6 +137,13 @@
Type::Range,
};
+ static constexpr OptionSet<Type> nonValidatingTypes = {
+ Type::Button,
+ Type::Hidden,
+ Type::Image,
+ Type::Reset,
+ };
+
static Ref<InputType> create(HTMLInputElement&, const AtomString&);
static Ref<InputType> createText(HTMLInputElement&);
virtual ~InputType();
@@ -182,6 +189,7 @@
bool isCheckable() const { return checkableTypes.contains(m_type); }
bool isSteppable() const { return steppableTypes.contains(m_type); }
+ bool supportsValidation() const { return !nonValidatingTypes.contains(m_type); }
bool isInteractiveContent() const;
bool supportLabels() const;
@@ -209,7 +217,6 @@
// Validation functions.
virtual String validationMessage() const;
- virtual bool supportsValidation() const;
virtual bool typeMismatchFor(const String&) const;
virtual bool supportsRequired() const;
virtual bool valueMissing(const String&) const;
Modified: trunk/Source/WebCore/html/ResetInputType.cpp (272179 => 272180)
--- trunk/Source/WebCore/html/ResetInputType.cpp 2021-02-02 00:09:40 UTC (rev 272179)
+++ trunk/Source/WebCore/html/ResetInputType.cpp 2021-02-02 00:14:23 UTC (rev 272180)
@@ -45,11 +45,6 @@
return InputTypeNames::reset();
}
-bool ResetInputType::supportsValidation() const
-{
- return false;
-}
-
void ResetInputType::handleDOMActivateEvent(Event& event)
{
ASSERT(element());
Modified: trunk/Source/WebCore/html/ResetInputType.h (272179 => 272180)
--- trunk/Source/WebCore/html/ResetInputType.h 2021-02-02 00:09:40 UTC (rev 272179)
+++ trunk/Source/WebCore/html/ResetInputType.h 2021-02-02 00:14:23 UTC (rev 272180)
@@ -41,7 +41,6 @@
private:
const AtomString& formControlType() const override;
- bool supportsValidation() const override;
void handleDOMActivateEvent(Event&) override;
String defaultValue() const override;
};