Add OptionSet::operator& and operator bool
https://bugs.webkit.org/show_bug.cgi?id=185306
Reviewed by Anders Carlsson.
Source/WebCore:
Use it in a few places.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::reload):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::logReasonsForCompositing):
(WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
Source/WTF:
This is primarily to allow writing
if (options & Option:A)
instead of
if (options.contains(Option:A))
This is consistent with other OptionSet operators.
* wtf/OptionSet.h:
(WTF::OptionSet::operator bool):
(WTF::OptionSet::operator&):
Also remove T versions of operator| and operator-, they are not needed due to
implicit conversion from T to OptionSet<T>.
Tools:
* TestWebKitAPI/Tests/WTF/OptionSet.cpp:
(TestWebKitAPI::TEST):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@231548 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp
index 0cf6bcb..000b9a4 100644
--- a/Source/WebCore/loader/FrameLoader.cpp
+++ b/Source/WebCore/loader/FrameLoader.cpp
@@ -1701,9 +1701,9 @@
loader->setOverrideEncoding(m_documentLoader->overrideEncoding());
auto frameLoadTypeForReloadOptions = [] (auto options) {
- if (options.contains(ReloadOption::FromOrigin))
+ if (options & ReloadOption::FromOrigin)
return FrameLoadType::ReloadFromOrigin;
- if (options.contains(ReloadOption::ExpiredOnly))
+ if (options & ReloadOption::ExpiredOnly)
return FrameLoadType::ReloadExpiredOnly;
return FrameLoadType::Reload;
};