Title: [272298] trunk/Source/WebCore
- Revision
- 272298
- Author
- [email protected]
- Date
- 2021-02-02 23:08:44 -0800 (Tue, 02 Feb 2021)
Log Message
Avoid a virtual function call in HTMLInputElement::value()
https://bugs.webkit.org/show_bug.cgi?id=221318
Reviewed by Wenson Hsieh.
Only file upload controls override getTypeSpecificValue(), so to avoid a virtual
function call, check the type first via canHaveTypeSpecificValue().
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::value const):
* html/InputType.h:
(WebCore::InputType::canHaveTypeSpecificValue const):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (272297 => 272298)
--- trunk/Source/WebCore/ChangeLog 2021-02-03 05:23:06 UTC (rev 272297)
+++ trunk/Source/WebCore/ChangeLog 2021-02-03 07:08:44 UTC (rev 272298)
@@ -1,3 +1,18 @@
+2021-02-02 Simon Fraser <[email protected]>
+
+ Avoid a virtual function call in HTMLInputElement::value()
+ https://bugs.webkit.org/show_bug.cgi?id=221318
+
+ Reviewed by Wenson Hsieh.
+
+ Only file upload controls override getTypeSpecificValue(), so to avoid a virtual
+ function call, check the type first via canHaveTypeSpecificValue().
+
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::value const):
+ * html/InputType.h:
+ (WebCore::InputType::canHaveTypeSpecificValue const):
+
2021-02-02 Darin Adler <[email protected]>
REGRESSION (r271439): null-dereference in useSmoothScrolling
Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (272297 => 272298)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2021-02-03 05:23:06 UTC (rev 272297)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2021-02-03 07:08:44 UTC (rev 272298)
@@ -1017,7 +1017,7 @@
String HTMLInputElement::value() const
{
String value;
- if (m_inputType->getTypeSpecificValue(value))
+ if (m_inputType->canHaveTypeSpecificValue() && m_inputType->getTypeSpecificValue(value))
return value;
value = m_valueIfDirty;
Modified: trunk/Source/WebCore/html/InputType.h (272297 => 272298)
--- trunk/Source/WebCore/html/InputType.h 2021-02-03 05:23:06 UTC (rev 272297)
+++ trunk/Source/WebCore/html/InputType.h 2021-02-03 07:08:44 UTC (rev 272298)
@@ -190,6 +190,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 canHaveTypeSpecificValue() const { return isFileUpload(); }
bool isInteractiveContent() const;
bool supportLabels() const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes