Skip to content

Let the compiler generate more comparison operators in WebCore#17326

Merged
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
cdumez:261012_WebCore_operator==2
Sep 2, 2023
Merged

Let the compiler generate more comparison operators in WebCore#17326
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
cdumez:261012_WebCore_operator==2

Conversation

@cdumez
Copy link
Contributor

@cdumez cdumez commented Sep 1, 2023

f61c511

Let the compiler generate more comparison operators in WebCore
https://bugs.webkit.org/show_bug.cgi?id=261012

Reviewed by Darin Adler.

Let the compiler generate more comparison operators in WebCore now that we
support C++20.

* Source/WebCore/css/CSSProperty.h:
(WebCore::StylePropertyMetadata::operator== const): Deleted.
* Source/WebCore/css/StyleColor.h:
* Source/WebCore/css/color/CSSUnresolvedColorMix.cpp:
(WebCore::operator==):
* Source/WebCore/css/color/CSSUnresolvedColorMix.h:
* Source/WebCore/css/parser/CSSParserContext.cpp:
(WebCore::operator==): Deleted.
* Source/WebCore/css/parser/CSSParserContext.h:
* Source/WebCore/css/parser/CSSSelectorParser.h:
* Source/WebCore/css/typedom/numeric/CSSNumericType.cpp:
(WebCore::CSSNumericType::operator== const): Deleted.
* Source/WebCore/css/typedom/numeric/CSSNumericType.h:
* Source/WebCore/dom/ComposedTreeAncestorIterator.h:
(WebCore::ComposedTreeAncestorIterator::operator== const): Deleted.
* Source/WebCore/dom/MessagePortIdentifier.h:
(WebCore::operator==): Deleted.
* Source/WebCore/dom/QualifiedName.h:
(WebCore::QualifiedName::operator== const): Deleted.
* Source/WebCore/dom/SimpleRange.cpp:
(WebCore::operator==): Deleted.
* Source/WebCore/dom/SimpleRange.h:
* Source/WebCore/dom/SpaceSplitString.h:
(WebCore::SpaceSplitString::operator== const): Deleted.
* Source/WebCore/editing/cocoa/EditorCocoa.mm:
(WebCore::Editor::replaceNodeFromPasteboard):
* Source/WebCore/html/HTMLElement.cpp:
(WebCore::checkPopoverValidity):
* Source/WebCore/html/LinkRelAttribute.h:
(WebCore::operator==): Deleted.
* Source/WebCore/html/canvas/WebGLFramebuffer.cpp:
(WebCore::WebGLFramebuffer::TextureAttachment::operator== const): Deleted.
(WebCore::WebGLFramebuffer::TextureLayerAttachment::operator== const): Deleted.
* Source/WebCore/html/canvas/WebGLFramebuffer.h:
* Source/WebCore/inspector/agents/InspectorNetworkAgent.h:
(WebCore::InspectorNetworkAgent::Intercept::operator== const): Deleted.
* Source/WebCore/layout/LayoutUnits.h:
(WebCore::Layout::operator==): Deleted.
* Source/WebCore/layout/formattingContexts/inline/InlineLevelBox.h:
(WebCore::Layout::InlineLevelBox::AscentAndDescent::operator== const): Deleted.
* Source/WebCore/layout/formattingContexts/inline/InlineLineTypes.h:
(WebCore::Layout::InlineItemPosition::operator== const): Deleted.
* Source/WebCore/layout/integration/inline/InlineIteratorBoxLegacyPath.h:
(WebCore::InlineIterator::BoxLegacyPath::operator== const): Deleted.
* Source/WebCore/layout/integration/inline/InlineIteratorBoxModernPath.h:
(WebCore::InlineIterator::BoxModernPath::operator== const): Deleted.
* Source/WebCore/layout/integration/inline/InlineIteratorLineBoxLegacyPath.h:
(WebCore::InlineIterator::LineBoxIteratorLegacyPath::operator== const): Deleted.
* Source/WebCore/layout/integration/inline/InlineIteratorLineBoxModernPath.h:
(WebCore::InlineIterator::LineBoxIteratorModernPath::operator== const): Deleted.
* Source/WebCore/layout/layouttree/LayoutContainingBlockChainIterator.h:
(WebCore::Layout::LayoutContainingBlockChainIterator::operator== const): Deleted.
* Source/WebCore/loader/CrossOriginEmbedderPolicy.h:
(WebCore::operator==): Deleted.
* Source/WebCore/loader/CrossOriginOpenerPolicy.h:
(WebCore::operator==): Deleted.
* Source/WebCore/loader/PCMSites.h:
(WebCore::PCM::SourceSite::operator== const): Deleted.
(WebCore::PCM::AttributionDestinationSite::operator== const): Deleted.
* Source/WebCore/loader/PolicyContainer.h:
(WebCore::operator==): Deleted.
* Source/WebCore/loader/ResourceCryptographicDigest.h:
(WebCore::ResourceCryptographicDigest::operator== const): Deleted.
* Source/WebCore/page/ClientOrigin.h:
(WebCore::ClientOrigin::operator== const): Deleted.
* Source/WebCore/page/GlobalWindowIdentifier.h:
(WebCore::operator==): Deleted.
* Source/WebCore/page/InteractionRegion.h:
(WebCore::operator==): Deleted.
* Source/WebCore/page/LocalFrameView.h:
* Source/WebCore/page/SecurityOriginData.h:
(WebCore::SecurityOriginData::Tuple::operator== const): Deleted.
* Source/WebCore/page/ViewportConfiguration.h:
(WebCore::ViewportConfiguration::Parameters::operator== const): Deleted.
* Source/WebCore/page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::reportViolation const):
* Source/WebCore/page/scrolling/ScrollingConstraints.h:
(WebCore::AbsolutePositionConstraints::operator== const): Deleted.
(WebCore::FixedPositionViewportConstraints::operator== const): Deleted.
(WebCore::StickyPositionViewportConstraints::operator== const): Deleted.
* Source/WebCore/page/scrolling/ScrollingCoordinatorTypes.h:
(WebCore::ScrollableAreaParameters::operator== const): Deleted.
(WebCore::RequestedKeyboardScrollData::operator== const): Deleted.
* Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h:
(WebCore::ScrollbarHoverState::operator== const): Deleted.
* Source/WebCore/platform/Decimal.h:
* Source/WebCore/platform/EventTrackingRegions.cpp:
(WebCore::operator==): Deleted.
* Source/WebCore/platform/EventTrackingRegions.h:
* Source/WebCore/platform/KeyboardScroll.h:
(WebCore::KeyboardScroll::operator== const): Deleted.
* Source/WebCore/platform/LayoutUnit.h:
* Source/WebCore/platform/LengthPoint.h:
(WebCore::LengthPoint::operator== const): Deleted.
* Source/WebCore/platform/LengthSize.h:
(WebCore::operator==): Deleted.
* Source/WebCore/platform/ProcessQualified.h:
(WebCore::ProcessQualified::operator== const): Deleted.
* Source/WebCore/platform/RectEdges.h:
(WebCore::RectEdges::operator== const): Deleted.
* Source/WebCore/platform/RegistrableDomain.h:
* Source/WebCore/platform/ScriptExecutionContextIdentifier.h:
(WebCore::ProcessQualified<WTF::UUID>::operator== const): Deleted.
* Source/WebCore/platform/Timer.cpp:
(WebCore::operator==): Deleted.
* Source/WebCore/platform/audio/NowPlayingInfo.h:
(WebCore::NowPlayingInfo::operator== const): Deleted.

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

20186b3

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
✅ 🛠 🧪 merge ✅ 🛠 watch
✅ 🛠 watch-sim

@cdumez cdumez self-assigned this Sep 1, 2023
@cdumez cdumez added the WebCore Misc. For miscellaneous bugs in the WebCore framework (and not JavaScriptCore or WebKit). label Sep 1, 2023
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Sep 1, 2023
@cdumez cdumez removed the merging-blocked Applied to prevent a change from being merged label Sep 1, 2023
@cdumez cdumez marked this pull request as ready for review September 1, 2023 14:15
Copy link
Member

Choose a reason for hiding this comment

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

Does this fix a bug? What did the code end up doing before?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yes, I was a bit surprised the previous code was building. I am not sure what it ended up doing. The CSSParserContext constructor that takes in a Document& is not marked as explicit and I modified CSSParserContext's operator==() in this patch so maybe it was using that?

I can double check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I was right. I was using CSSParserContext's operator==() :/
I will write a patch to make CSSParserContext's constructors explicit.

Copy link
Member

Choose a reason for hiding this comment

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

Amazing! That is so nuts. That may even have been costly enough that we get a tiny performance boost.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will land #17356 first to avoid behavior changes in this large refactoring patch.

Copy link
Member

Choose a reason for hiding this comment

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

Does this fix a bug? What did the code end up doing before?

Copy link
Member

Choose a reason for hiding this comment

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

I can’t figure out what rule you are using to decide when to use const& and when to just pass the structure. I would have expected just Position here, but I’m not sure it matters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll switch to Position, I didn't realize the type was so small.

Copy link
Member

Choose a reason for hiding this comment

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

There are others like this even in this patch, such as LayoutUnit itself. I didn’t try to thoroughly search for such things.

Copy link
Member

Choose a reason for hiding this comment

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

Does this fix a bug? What did the code end up doing before?

Copy link
Member

Choose a reason for hiding this comment

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

I think we might, in the future, want to generate <=> instead of == here.

@cdumez cdumez added merging-blocked Applied to prevent a change from being merged and removed merging-blocked Applied to prevent a change from being merged labels Sep 1, 2023
@cdumez cdumez force-pushed the 261012_WebCore_operator==2 branch from 0df9f83 to ab77a53 Compare September 1, 2023 19:38
@cdumez cdumez force-pushed the 261012_WebCore_operator==2 branch from ab77a53 to 5f19a93 Compare September 1, 2023 19:47
@cdumez cdumez force-pushed the 261012_WebCore_operator==2 branch from 5f19a93 to 20186b3 Compare September 2, 2023 05:25
@cdumez cdumez added the merge-queue Applied to send a pull request to merge-queue label Sep 2, 2023
https://bugs.webkit.org/show_bug.cgi?id=261012

Reviewed by Darin Adler.

Let the compiler generate more comparison operators in WebCore now that we
support C++20.

* Source/WebCore/css/CSSProperty.h:
(WebCore::StylePropertyMetadata::operator== const): Deleted.
* Source/WebCore/css/StyleColor.h:
* Source/WebCore/css/color/CSSUnresolvedColorMix.cpp:
(WebCore::operator==):
* Source/WebCore/css/color/CSSUnresolvedColorMix.h:
* Source/WebCore/css/parser/CSSParserContext.cpp:
(WebCore::operator==): Deleted.
* Source/WebCore/css/parser/CSSParserContext.h:
* Source/WebCore/css/parser/CSSSelectorParser.h:
* Source/WebCore/css/typedom/numeric/CSSNumericType.cpp:
(WebCore::CSSNumericType::operator== const): Deleted.
* Source/WebCore/css/typedom/numeric/CSSNumericType.h:
* Source/WebCore/dom/ComposedTreeAncestorIterator.h:
(WebCore::ComposedTreeAncestorIterator::operator== const): Deleted.
* Source/WebCore/dom/MessagePortIdentifier.h:
(WebCore::operator==): Deleted.
* Source/WebCore/dom/QualifiedName.h:
(WebCore::QualifiedName::operator== const): Deleted.
* Source/WebCore/dom/SimpleRange.cpp:
(WebCore::operator==): Deleted.
* Source/WebCore/dom/SimpleRange.h:
* Source/WebCore/dom/SpaceSplitString.h:
(WebCore::SpaceSplitString::operator== const): Deleted.
* Source/WebCore/editing/cocoa/EditorCocoa.mm:
(WebCore::Editor::replaceNodeFromPasteboard):
* Source/WebCore/html/HTMLElement.cpp:
(WebCore::checkPopoverValidity):
* Source/WebCore/html/LinkRelAttribute.h:
(WebCore::operator==): Deleted.
* Source/WebCore/html/canvas/WebGLFramebuffer.cpp:
(WebCore::WebGLFramebuffer::TextureAttachment::operator== const): Deleted.
(WebCore::WebGLFramebuffer::TextureLayerAttachment::operator== const): Deleted.
* Source/WebCore/html/canvas/WebGLFramebuffer.h:
* Source/WebCore/inspector/agents/InspectorNetworkAgent.h:
(WebCore::InspectorNetworkAgent::Intercept::operator== const): Deleted.
* Source/WebCore/layout/LayoutUnits.h:
(WebCore::Layout::operator==): Deleted.
* Source/WebCore/layout/formattingContexts/inline/InlineLevelBox.h:
(WebCore::Layout::InlineLevelBox::AscentAndDescent::operator== const): Deleted.
* Source/WebCore/layout/formattingContexts/inline/InlineLineTypes.h:
(WebCore::Layout::InlineItemPosition::operator== const): Deleted.
* Source/WebCore/layout/integration/inline/InlineIteratorBoxLegacyPath.h:
(WebCore::InlineIterator::BoxLegacyPath::operator== const): Deleted.
* Source/WebCore/layout/integration/inline/InlineIteratorBoxModernPath.h:
(WebCore::InlineIterator::BoxModernPath::operator== const): Deleted.
* Source/WebCore/layout/integration/inline/InlineIteratorLineBoxLegacyPath.h:
(WebCore::InlineIterator::LineBoxIteratorLegacyPath::operator== const): Deleted.
* Source/WebCore/layout/integration/inline/InlineIteratorLineBoxModernPath.h:
(WebCore::InlineIterator::LineBoxIteratorModernPath::operator== const): Deleted.
* Source/WebCore/layout/layouttree/LayoutContainingBlockChainIterator.h:
(WebCore::Layout::LayoutContainingBlockChainIterator::operator== const): Deleted.
* Source/WebCore/loader/CrossOriginEmbedderPolicy.h:
(WebCore::operator==): Deleted.
* Source/WebCore/loader/CrossOriginOpenerPolicy.h:
(WebCore::operator==): Deleted.
* Source/WebCore/loader/PCMSites.h:
(WebCore::PCM::SourceSite::operator== const): Deleted.
(WebCore::PCM::AttributionDestinationSite::operator== const): Deleted.
* Source/WebCore/loader/PolicyContainer.h:
(WebCore::operator==): Deleted.
* Source/WebCore/loader/ResourceCryptographicDigest.h:
(WebCore::ResourceCryptographicDigest::operator== const): Deleted.
* Source/WebCore/page/ClientOrigin.h:
(WebCore::ClientOrigin::operator== const): Deleted.
* Source/WebCore/page/GlobalWindowIdentifier.h:
(WebCore::operator==): Deleted.
* Source/WebCore/page/InteractionRegion.h:
(WebCore::operator==): Deleted.
* Source/WebCore/page/LocalFrameView.h:
* Source/WebCore/page/SecurityOriginData.h:
(WebCore::SecurityOriginData::Tuple::operator== const): Deleted.
* Source/WebCore/page/ViewportConfiguration.h:
(WebCore::ViewportConfiguration::Parameters::operator== const): Deleted.
* Source/WebCore/page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::reportViolation const):
* Source/WebCore/page/scrolling/ScrollingConstraints.h:
(WebCore::AbsolutePositionConstraints::operator== const): Deleted.
(WebCore::FixedPositionViewportConstraints::operator== const): Deleted.
(WebCore::StickyPositionViewportConstraints::operator== const): Deleted.
* Source/WebCore/page/scrolling/ScrollingCoordinatorTypes.h:
(WebCore::ScrollableAreaParameters::operator== const): Deleted.
(WebCore::RequestedKeyboardScrollData::operator== const): Deleted.
* Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h:
(WebCore::ScrollbarHoverState::operator== const): Deleted.
* Source/WebCore/platform/Decimal.h:
* Source/WebCore/platform/EventTrackingRegions.cpp:
(WebCore::operator==): Deleted.
* Source/WebCore/platform/EventTrackingRegions.h:
* Source/WebCore/platform/KeyboardScroll.h:
(WebCore::KeyboardScroll::operator== const): Deleted.
* Source/WebCore/platform/LayoutUnit.h:
* Source/WebCore/platform/LengthPoint.h:
(WebCore::LengthPoint::operator== const): Deleted.
* Source/WebCore/platform/LengthSize.h:
(WebCore::operator==): Deleted.
* Source/WebCore/platform/ProcessQualified.h:
(WebCore::ProcessQualified::operator== const): Deleted.
* Source/WebCore/platform/RectEdges.h:
(WebCore::RectEdges::operator== const): Deleted.
* Source/WebCore/platform/RegistrableDomain.h:
* Source/WebCore/platform/ScriptExecutionContextIdentifier.h:
(WebCore::ProcessQualified<WTF::UUID>::operator== const): Deleted.
* Source/WebCore/platform/Timer.cpp:
(WebCore::operator==): Deleted.
* Source/WebCore/platform/audio/NowPlayingInfo.h:
(WebCore::NowPlayingInfo::operator== const): Deleted.

Canonical link: https://commits.webkit.org/267580@main
@webkit-commit-queue
Copy link
Collaborator

Committed 267580@main (f61c511): https://commits.webkit.org/267580@main

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

@webkit-commit-queue webkit-commit-queue merged commit f61c511 into WebKit:main Sep 2, 2023
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Sep 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WebCore Misc. For miscellaneous bugs in the WebCore framework (and not JavaScriptCore or WebKit).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants