Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop marking isInvalidInputType() as friend to InputType subclasses #12975

Merged

Conversation

cdumez
Copy link
Contributor

@cdumez cdumez commented Apr 20, 2023

5b1d7c2

Stop marking isInvalidInputType() as friend to InputType subclasses
https://bugs.webkit.org/show_bug.cgi?id=255731

Reviewed by Darin Adler.

Stop marking isInvalidInputType() as friend to InputType subclasses. We just
need to make a few validation function public (which they are already in the
base class). This allows us to move isInvalidInputType() to InputType.cpp,
since this is the only place it is used.

* Source/WebCore/html/BaseDateAndTimeInputType.h:
* Source/WebCore/html/ButtonInputType.h:
* Source/WebCore/html/CheckboxInputType.h:
* Source/WebCore/html/ColorInputType.h:
* Source/WebCore/html/DateInputType.h:
* Source/WebCore/html/DateTimeLocalInputType.h:
* Source/WebCore/html/EmailInputType.h:
* Source/WebCore/html/FileInputType.h:
* Source/WebCore/html/HiddenInputType.h:
* Source/WebCore/html/ImageInputType.h:
* Source/WebCore/html/InputType.cpp:
(WebCore::isInvalidInputType):
(WebCore::InputType::typeMismatchFor const): Deleted.
(WebCore::InputType::typeMismatch const): Deleted.
(WebCore::InputType::valueMissing const): Deleted.
(WebCore::InputType::hasBadInput const): Deleted.
(WebCore::InputType::patternMismatch const): Deleted.
* Source/WebCore/html/InputType.h:
(WebCore::InputType::typeMismatchFor const):
(WebCore::InputType::valueMissing const):
(WebCore::InputType::hasBadInput const):
(WebCore::InputType::patternMismatch const):
(WebCore::InputType::typeMismatch const):
(WebCore::isInvalidInputType): Deleted.
* Source/WebCore/html/MonthInputType.h:
* Source/WebCore/html/NumberInputType.h:
* Source/WebCore/html/PasswordInputType.h:
* Source/WebCore/html/RadioInputType.h:
* Source/WebCore/html/RangeInputType.h:
* Source/WebCore/html/ResetInputType.h:
* Source/WebCore/html/SearchInputType.h:
* Source/WebCore/html/SubmitInputType.h:
* Source/WebCore/html/TelephoneInputType.h:
* Source/WebCore/html/TextInputType.h:
* Source/WebCore/html/TimeInputType.h:
* Source/WebCore/html/URLInputType.h:
* Source/WebCore/html/WeekInputType.h:

Canonical link: https://commits.webkit.org/263179@main

6eaf9f9

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ wpe-wk2
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ›  gtk
βœ… πŸ§ͺ ios-wk2-wpt βœ… πŸ§ͺ mac-wk1   πŸ§ͺ gtk-wk2
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk2 βœ… πŸ§ͺ api-gtk
βœ… πŸ›  tv   πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  tv-sim βœ… πŸ§ͺ mac-wk2-stress
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch
βœ… πŸ›  watch-sim

@cdumez cdumez requested a review from rniwa as a code owner April 20, 2023 15:50
@cdumez cdumez self-assigned this Apr 20, 2023
@cdumez cdumez added the DOM For bugs specific to XML/HTML DOM elements (including parsing). label Apr 20, 2023
Copy link
Member

@darinadler darinadler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. If any of this is a hot code path we might want to make this not be so many separate virtual functions.

@cdumez
Copy link
Contributor Author

cdumez commented Apr 20, 2023

This looks great. If any of this is a hot code path we might want to make this not be so many separate virtual functions.

This is hot code and yes, many of them are virtual. However, the idea behind the isInvalidInputType() templated function is that it always calls those functions on derived classes of InputType. As a result, it should allow the compiler to skip the vtable and call the most derived implementation right away. That said, there are still separate function calls so there might still be some win here.

@cdumez cdumez added the merge-queue Applied to send a pull request to merge-queue label Apr 20, 2023
https://bugs.webkit.org/show_bug.cgi?id=255731

Reviewed by Darin Adler.

Stop marking isInvalidInputType() as friend to InputType subclasses. We just
need to make a few validation function public (which they are already in the
base class). This allows us to move isInvalidInputType() to InputType.cpp,
since this is the only place it is used.

* Source/WebCore/html/BaseDateAndTimeInputType.h:
* Source/WebCore/html/ButtonInputType.h:
* Source/WebCore/html/CheckboxInputType.h:
* Source/WebCore/html/ColorInputType.h:
* Source/WebCore/html/DateInputType.h:
* Source/WebCore/html/DateTimeLocalInputType.h:
* Source/WebCore/html/EmailInputType.h:
* Source/WebCore/html/FileInputType.h:
* Source/WebCore/html/HiddenInputType.h:
* Source/WebCore/html/ImageInputType.h:
* Source/WebCore/html/InputType.cpp:
(WebCore::isInvalidInputType):
(WebCore::InputType::typeMismatchFor const): Deleted.
(WebCore::InputType::typeMismatch const): Deleted.
(WebCore::InputType::valueMissing const): Deleted.
(WebCore::InputType::hasBadInput const): Deleted.
(WebCore::InputType::patternMismatch const): Deleted.
* Source/WebCore/html/InputType.h:
(WebCore::InputType::typeMismatchFor const):
(WebCore::InputType::valueMissing const):
(WebCore::InputType::hasBadInput const):
(WebCore::InputType::patternMismatch const):
(WebCore::InputType::typeMismatch const):
(WebCore::isInvalidInputType): Deleted.
* Source/WebCore/html/MonthInputType.h:
* Source/WebCore/html/NumberInputType.h:
* Source/WebCore/html/PasswordInputType.h:
* Source/WebCore/html/RadioInputType.h:
* Source/WebCore/html/RangeInputType.h:
* Source/WebCore/html/ResetInputType.h:
* Source/WebCore/html/SearchInputType.h:
* Source/WebCore/html/SubmitInputType.h:
* Source/WebCore/html/TelephoneInputType.h:
* Source/WebCore/html/TextInputType.h:
* Source/WebCore/html/TimeInputType.h:
* Source/WebCore/html/URLInputType.h:
* Source/WebCore/html/WeekInputType.h:

Canonical link: https://commits.webkit.org/263179@main
@webkit-commit-queue webkit-commit-queue force-pushed the 255731_isInvalidInputType_no_friend2 branch from 6eaf9f9 to 5b1d7c2 Compare April 20, 2023 17:19
@webkit-commit-queue
Copy link
Collaborator

Committed 263179@main (5b1d7c2): https://commits.webkit.org/263179@main

Reviewed commits have been landed. Closing PR #12975 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 5b1d7c2 into WebKit:main Apr 20, 2023
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DOM For bugs specific to XML/HTML DOM elements (including parsing).
Projects
None yet
4 participants