Changeset 278244 in webkit
- Timestamp:
- May 29, 2021, 3:08:56 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 85 edited
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp (modified) (1 diff)
-
Source/WTF/ChangeLog (modified) (1 diff)
-
Source/WTF/wtf/Hasher.h (modified) (2 diffs)
-
Source/WTF/wtf/Optional.h (modified) (2 diffs)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/AudioContext.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webxr/WebXRFrame.cpp (modified) (3 diffs)
-
Source/WebCore/Modules/webxr/WebXRGamepad.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webxr/WebXRInputSource.cpp (modified) (1 diff)
-
Source/WebCore/bindings/js/DOMPromiseProxy.h (modified) (3 diffs)
-
Source/WebCore/bindings/js/SerializedScriptValue.cpp (modified) (1 diff)
-
Source/WebCore/css/CSSFontFaceSet.cpp (modified) (7 diffs)
-
Source/WebCore/css/CSSGradientValue.cpp (modified) (3 diffs)
-
Source/WebCore/css/CSSSegmentedFontFace.cpp (modified) (2 diffs)
-
Source/WebCore/css/FontFace.cpp (modified) (7 diffs)
-
Source/WebCore/css/parser/CSSSelectorParser.cpp (modified) (1 diff)
-
Source/WebCore/display/css/DisplayStyle.h (modified) (2 diffs)
-
Source/WebCore/dom/DataTransferItemList.h (modified) (1 diff)
-
Source/WebCore/dom/Document.cpp (modified) (1 diff)
-
Source/WebCore/dom/EventTarget.cpp (modified) (1 diff)
-
Source/WebCore/editing/AlternativeTextController.cpp (modified) (1 diff)
-
Source/WebCore/editing/ApplyStyleCommand.cpp (modified) (2 diffs)
-
Source/WebCore/html/HTMLMediaElement.cpp (modified) (1 diff)
-
Source/WebCore/html/ImageBitmap.h (modified) (1 diff)
-
Source/WebCore/inspector/agents/InspectorPageAgent.cpp (modified) (1 diff)
-
Source/WebCore/layout/LayoutPhase.cpp (modified) (1 diff)
-
Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp (modified) (1 diff)
-
Source/WebCore/layout/formattingContexts/inline/InlineLine.h (modified) (6 diffs)
-
Source/WebCore/loader/CrossOriginPreflightResultCache.cpp (modified) (1 diff)
-
Source/WebCore/page/EventHandler.cpp (modified) (1 diff)
-
Source/WebCore/page/ios/ContentChangeObserver.cpp (modified) (1 diff)
-
Source/WebCore/page/scrolling/ScrollSnapOffsetsInfo.cpp (modified) (4 diffs)
-
Source/WebCore/platform/ScrollController.cpp (modified) (2 diffs)
-
Source/WebCore/platform/cocoa/SystemBattery.mm (modified) (2 diffs)
-
Source/WebCore/platform/graphics/Gradient.h (modified) (11 diffs)
-
Source/WebCore/platform/graphics/ImageSource.h (modified) (6 diffs)
-
Source/WebCore/platform/graphics/MediaPlayer.cpp (modified) (1 diff)
-
Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp (modified) (1 diff)
-
Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp (modified) (1 diff)
-
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (modified) (3 diffs)
-
Source/WebCore/platform/graphics/gstreamer/eme/CDMProxyThunder.cpp (modified) (1 diff)
-
Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.cpp (modified) (5 diffs)
-
Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.h (modified) (2 diffs)
-
Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp (modified) (9 diffs)
-
Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp (modified) (1 diff)
-
Source/WebCore/platform/graphics/transforms/TransformState.h (modified) (5 diffs)
-
Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm (modified) (1 diff)
-
Source/WebCore/platform/mac/NSScrollerImpDetails.mm (modified) (1 diff)
-
Source/WebCore/platform/network/ResourceRequestBase.cpp (modified) (2 diffs)
-
Source/WebCore/platform/xr/openxr/OpenXRInputSource.cpp (modified) (1 diff)
-
Source/WebCore/rendering/EventRegion.h (modified) (1 diff)
-
Source/WebCore/rendering/GridTrackSizingAlgorithm.h (modified) (1 diff)
-
Source/WebCore/rendering/RenderFlexibleBox.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderListItem.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderThemeIOS.mm (modified) (1 diff)
-
Source/WebCore/rendering/updating/RenderTreeBuilder.cpp (modified) (1 diff)
-
Source/WebCore/svg/SVGSVGElement.cpp (modified) (1 diff)
-
Source/WebCore/svg/SVGTransform.h (modified) (1 diff)
-
Source/WebCore/testing/WebFakeXRDevice.cpp (modified) (1 diff)
-
Source/WebDriver/ChangeLog (modified) (1 diff)
-
Source/WebDriver/socket/SessionHostSocket.cpp (modified) (1 diff)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/Platform/IPC/ArgumentCoders.h (modified) (32 diffs)
-
Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm (modified) (35 diffs)
-
Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm (modified) (1 diff)
-
Source/WebKit/Shared/WebCoreArgumentCoders.cpp (modified) (2 diffs)
-
Source/WebKit/Shared/mac/MediaFormatReader/MediaFormatReader.cpp (modified) (3 diffs)
-
Source/WebKit/Shared/win/WebCoreArgumentCodersWin.cpp (modified) (5 diffs)
-
Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm (modified) (1 diff)
-
Source/WebKit/UIProcess/API/glib/InputMethodFilter.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm (modified) (36 diffs)
-
Source/WebKit/UIProcess/Inspector/socket/RemoteInspectorClient.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/glib/UserMediaPermissionRequestManagerProxyGLib.cpp (modified) (1 diff)
-
Source/WebKit/WebProcess/GPU/media/MediaSourcePrivateRemote.cpp (modified) (1 diff)
-
Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm (modified) (1 diff)
-
Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebCore/CBORReaderTest.cpp (modified) (27 diffs)
-
Tools/TestWebKitAPI/Tests/WebCore/CBORWriterTest.cpp (modified) (13 diffs)
-
Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitPolicyClient.cpp (modified) (2 diffs)
-
Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebView.cpp (modified) (2 diffs)
-
Tools/WebKitTestRunner/GeolocationProviderMock.cpp (modified) (1 diff)
-
Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r278243 r278244 1 2021-05-28 Darin Adler <darin@apple.com> 2 3 Clients of optional should use has_value instead of relying on hasValue macro 4 https://bugs.webkit.org/show_bug.cgi?id=226395 5 6 Reviewed by Chris Dumez. 7 8 * bytecompiler/NodesCodegen.cpp: 9 (JSC::RegExpNode::emitBytecode): Don't use hasValue. 10 1 11 2021-05-29 Chris Dumez <cdumez@apple.com> 2 12 -
trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
r278185 r278244 159 159 160 160 auto flags = Yarr::parseFlags(m_flags.string()); 161 ASSERT(flags .hasValue());161 ASSERT(flags); 162 162 RegExp* regExp = RegExp::create(generator.vm(), m_pattern.string(), flags.value()); 163 163 if (regExp->isValid()) -
trunk/Source/WTF/ChangeLog
r278236 r278244 1 2021-05-28 Darin Adler <darin@apple.com> 2 3 Clients of optional should use has_value instead of relying on hasValue macro 4 https://bugs.webkit.org/show_bug.cgi?id=226395 5 6 Reviewed by Chris Dumez. 7 8 * wtf/Hasher.h: Use has_value. 9 10 * wtf/Optional.h: Remove hasValue macro. Not needed any more, but also a bit 11 dangerous because of how widespread the use of hasValue is for things other 12 than WTF::Optional. 13 1 14 2021-05-28 Alex Christensen <achristensen@webkit.org> 2 15 -
trunk/Source/WTF/wtf/Hasher.h
r275650 r278244 21 21 #pragma once 22 22 23 #include < wtf/Optional.h>23 #include <optional> 24 24 #include <wtf/StdLibExtras.h> 25 25 #include <wtf/URL.h> … … 160 160 } 161 161 162 template<typename T> void add(Hasher& hasher, const Optional<T>& optional)162 template<typename T> void add(Hasher& hasher, const std::optional<T>& optional) 163 163 { 164 add(hasher, optional.has Value());165 if (optional.has Value())164 add(hasher, optional.has_value()); 165 if (optional.has_value()) 166 166 add(hasher, optional.value()); 167 167 } -
trunk/Source/WTF/wtf/Optional.h
r278185 r278244 27 27 template<typename T> using Optional = std::optional<T>; 28 28 29 // FIXME: We probably don't need this; it's only used in 5 places.30 29 template<typename OptionalType, class Callback> auto valueOrCompute(OptionalType optional, Callback callback) -> typename OptionalType::value_type 31 30 { … … 37 36 using WTF::Optional; 38 37 using WTF::valueOrCompute; 39 40 // FIXME: This macro is a workaround to allow us to use std::optional without a global replace; it can be removed after the global replace.41 #define hasValue has_value -
trunk/Source/WebCore/ChangeLog
r278239 r278244 1 2021-05-28 Darin Adler <darin@apple.com> 2 3 Clients of optional should use has_value instead of relying on hasValue macro 4 https://bugs.webkit.org/show_bug.cgi?id=226395 5 6 Reviewed by Chris Dumez. 7 8 In some files we are touching, moved from Optional to std::optional, but doing 9 that consistently in files we are not otherwise modifying is out of scope here. 10 11 In some places, use has_value instead of hasValue. In others, improved further 12 by not using has_value explicitly when it's clearer to do so. Wasn't 100% 13 consistent about that, but did aim to cover 100% of the hasValue call sites. 14 15 * Modules/webaudio/AudioContext.cpp: 16 (WebCore::AudioContext::create): Don't use hasValue. 17 * Modules/webxr/WebXRFrame.cpp: 18 (WebCore::WebXRFrame::getViewerPose): Ditto. 19 (WebCore::WebXRFrame::getPose): Ditto. 20 * Modules/webxr/WebXRGamepad.cpp: 21 (WebCore::WebXRGamepad::WebXRGamepad): Ditto. 22 23 * Modules/webxr/WebXRInputSource.cpp: 24 (WebCore::WebXRInputSource::requiresInputSourceChange): Use has_value. 25 * bindings/js/DOMPromiseProxy.h: 26 (WebCore::DOMPromiseProxy<IDLType>::isFulfilled const): Ditto. 27 (WebCore::DOMPromiseProxy<IDLUndefined>::isFulfilled const): Ditto. 28 (WebCore::DOMPromiseProxyWithResolveCallback<IDLType>::isFulfilled const): Ditto. 29 * bindings/js/SerializedScriptValue.cpp: 30 (WebCore::CloneDeserializer::readTerminal): Ditto. 31 32 * css/CSSFontFaceSet.cpp: 33 (WebCore::CSSFontFaceSet::addToFacesLookupTable): Removed unneeded double check 34 of optional value. !x and !x.has_value() check the same thing. 35 (WebCore::CSSFontFaceSet::remove): Ditto. 36 (WebCore::CSSFontFaceSet::fontFace): Simplified code with extra local variables 37 to use an idiom that does not use hasValue. Since using *, ->, or value() on an 38 optional already asserts, there is no need to explicitly assert in the caller. 39 40 * css/CSSGradientValue.cpp: 41 (WebCore::GradientStop::isSpecified const): Use has_value. 42 43 * css/CSSSegmentedFontFace.cpp: 44 (WebCore::CSSSegmentedFontFace::fontRanges): Removed unneeded calls to hasValue. 45 46 * css/FontFace.cpp: 47 (WebCore::FontFace::family const): Use has_value. 48 (WebCore::FontFace::style const): Ditto. 49 (WebCore::FontFace::weight const): Ditto. 50 (WebCore::FontFace::stretch const): Ditto. 51 (WebCore::FontFace::unicodeRange const): Ditto. 52 (WebCore::FontFace::featureSettings const): Ditto. 53 (WebCore::FontFace::display const): Ditto. 54 * css/parser/CSSSelectorParser.cpp: 55 (WebCore::consumeANPlusB): Ditto. 56 * display/css/DisplayStyle.h: Ditto. 57 * dom/DataTransferItemList.h: Ditto. 58 * dom/Document.cpp: 59 (WebCore::Document::updateHighlightPositions): Ditto. 60 * dom/EventTarget.cpp: 61 (WebCore::EventTarget::addEventListener): Ditto. 62 * editing/AlternativeTextController.cpp: 63 (WebCore::AlternativeTextController::hasPendingCorrection const): Ditto. 64 65 * editing/ApplyStyleCommand.cpp: 66 (WebCore::ApplyStyleCommand::applyInlineStyle): Don't call hasValue. 67 * html/HTMLMediaElement.cpp: 68 (WebCore::HTMLMediaElement::captionDisplayMode): Ditto. 69 * html/ImageBitmap.h: Ditto. 70 71 * inspector/agents/InspectorPageAgent.cpp: 72 (WebCore::InspectorPageAgent::setScreenSizeOverride): Use has_value. 73 * layout/LayoutPhase.cpp: 74 (WebCore::Layout::PhaseScope::PhaseScope): Ditto. 75 * layout/formattingContexts/inline/InlineContentBreaker.cpp: 76 (WebCore::Layout::InlineContentBreaker::tryBreakingTextRun const): Ditto. 77 * layout/formattingContexts/inline/InlineLine.h: Ditto. 78 * loader/CrossOriginPreflightResultCache.cpp: 79 (WebCore::parseAccessControlMaxAge): Ditto. 80 * page/EventHandler.cpp: 81 (WebCore::EventHandler::defaultWheelEventHandler): Ditto. 82 * page/ios/ContentChangeObserver.cpp: 83 (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope): Ditto. 84 * page/scrolling/ScrollSnapOffsetsInfo.cpp: 85 (WebCore::closestSnapOffsetWithInfoAndAxis): Ditto. 86 87 * platform/ScrollController.cpp: 88 (WebCore::ScrollController::adjustScrollDestination): Don't use hasValue. 89 90 * platform/cocoa/SystemBattery.mm: 91 (WebCore::systemHasBattery): Use has_value. 92 (WebCore::systemHasAC): Use has_value. 93 * platform/graphics/Gradient.h: Ditto. 94 * platform/graphics/ImageSource.h: Ditto. 95 96 * platform/graphics/MediaPlayer.cpp: 97 (WebCore::MediaPlayer::wouldTaintOrigin const): Changed idiom to not use hasValue. 98 99 * platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp: 100 (setGLContext): Do not use hasValue. 101 * platform/graphics/gstreamer/GStreamerRegistryScanner.cpp: 102 (WebCore::GStreamerRegistryScanner::ElementFactories::hasElementForMediaType const): Ditto. 103 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: 104 (WebCore::MediaPlayerPrivateGStreamer::playbackPosition const): Ditto. 105 (WebCore::MediaPlayerPrivateGStreamer::performTaskAtMediaTime): Ditto. 106 (WebCore::MediaPlayerPrivateGStreamer::triggerRepaint): Ditto. 107 108 * platform/graphics/gstreamer/eme/CDMProxyThunder.cpp: 109 (WebCore::CDMProxyThunder::getDecryptionSession const): Use has_value. 110 * platform/graphics/gstreamer/eme/CDMThunder.cpp: 111 (WebCore::ParsedResponseMessage::hasType const): Use has_value. 112 (WebCore::CDMInstanceSessionThunder::cdmInstanceThunder const): Use 113 a pointer for the erturn value instead of Optional<&>. This hasn't 114 compiled since we switched to std::optional so I suspect this code is 115 not compiled by EWS or the buildbot. 116 * platform/graphics/gstreamer/eme/CDMThunder.h: Updated to match above. 117 118 * platform/graphics/gstreamer/mse/AppendPipeline.cpp: 119 (WebCore::AppendPipeline::parseDemuxerSrcPadCaps): Use value_or. 120 (WebCore::AppendPipeline::appsinkCapsChanged): Do not use has_value. 121 * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: 122 (WebCore::MediaPlayerPrivateGStreamerMSE::trackDetected): Ditto. 123 124 * platform/graphics/transforms/TransformState.h: Use has_value. 125 * platform/ios/VideoFullscreenInterfaceAVKit.mm: 126 (WebCore::supportsPictureInPicture): Ditto. 127 * platform/mac/NSScrollerImpDetails.mm: 128 (WebCore::ScrollerStyle::recommendedScrollerStyle): Ditto. 129 * platform/network/ResourceRequestBase.cpp: 130 (WebCore::ResourceRequestBase::isSystemPreview const): Ditto. 131 * platform/xr/openxr/OpenXRInputSource.cpp: 132 (PlatformXR::OpenXRInputSource::getInputSource const): Ditto. 133 * rendering/EventRegion.h: Ditto. 134 135 * rendering/GridTrackSizingAlgorithm.h: Remove unnecessary assertion, since 136 the * operator already does the assertion. 137 138 * rendering/RenderFlexibleBox.cpp: 139 (WebCore::RenderFlexibleBox::canComputePercentageFlexBasis): Use has_value. 140 * rendering/RenderListItem.cpp: 141 (WebCore::RenderListItem::setExplicitValue): Ditto. 142 * rendering/RenderThemeIOS.mm: 143 (WebCore::RenderThemeIOS::systemFocusRingColor): Ditto. 144 * rendering/updating/RenderTreeBuilder.cpp: 145 (WebCore::RenderTreeBuilder::removeAnonymousWrappersForInlineChildrenIfNeeded): Ditto. 146 147 * svg/SVGSVGElement.cpp: 148 (WebCore::SVGSVGElement::createSVGTransformFromMatrix): Changed idiom to not 149 call hasValue. 150 * svg/SVGTransform.h: Ditto. 151 * testing/WebFakeXRDevice.cpp: 152 (WebCore::WebFakeXRDevice::setViews): Ditto. 153 1 154 2021-05-29 Alan Bujtas <zalan@apple.com> 2 155 -
trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp
r277586 r278244 103 103 contextOptions.sampleRate = *defaultSampleRateForTesting(); 104 104 105 if (contextOptions.sampleRate .hasValue() && !isSupportedSampleRate(contextOptions.sampleRate.value()))105 if (contextOptions.sampleRate && !isSupportedSampleRate(*contextOptions.sampleRate)) 106 106 return Exception { SyntaxError, "sampleRate is not in range"_s }; 107 107 -
trunk/Source/WebCore/Modules/webxr/WebXRFrame.cpp
r278185 r278244 97 97 98 98 // https://immersive-web.github.io/webxr/#populate-the-pose 99 ExceptionOr< Optional<WebXRFrame::PopulatedPose>> WebXRFrame::populatePose(const Document& document, const WebXRSpace& space, const WebXRSpace& baseSpace)99 ExceptionOr<std::optional<WebXRFrame::PopulatedPose>> WebXRFrame::populatePose(const Document& document, const WebXRSpace& space, const WebXRSpace& baseSpace) 100 100 { 101 101 // 1. If frame’s active boolean is false, throw an InvalidStateError and abort these steps. … … 160 160 // 6. If pose is null return null. 161 161 auto populateValue = populatePoseResult.releaseReturnValue(); 162 if (!populateValue .hasValue())162 if (!populateValue) 163 163 return nullptr; 164 164 … … 228 228 229 229 auto populateValue = populatePoseResult.releaseReturnValue(); 230 if (!populateValue .hasValue())230 if (!populateValue) 231 231 return nullptr; 232 232 -
trunk/Source/WebCore/Modules/webxr/WebXRGamepad.cpp
r276433 r278244 47 47 // In order to report a mapping of "xr-standard" the device MUST report a targetRayMode of "tracked-pointer" and MUST have a non-null gripSpace. 48 48 // It MUST have at least one primary trigger, separate from any touchpads or thumbsticks 49 if (source.targetRayMode == XRTargetRayMode::TrackedPointer && !source.buttons.isEmpty() && source.gripOrigin .hasValue())49 if (source.targetRayMode == XRTargetRayMode::TrackedPointer && !source.buttons.isEmpty() && source.gripOrigin) 50 50 m_mapping = xrStandardGamepadMappingString(); 51 51 m_axes = source.axes.map([](auto value) { -
trunk/Source/WebCore/Modules/webxr/WebXRInputSource.cpp
r277251 r278244 94 94 || m_source.targetRayMode != source.targetRayMode 95 95 || m_source.profiles != source.profiles 96 || static_cast<bool>(m_gripSpace) != source.gripOrigin.has Value();96 || static_cast<bool>(m_gripSpace) != source.gripOrigin.has_value(); 97 97 } 98 98 -
trunk/Source/WebCore/bindings/js/DOMPromiseProxy.h
r278185 r278244 150 150 inline bool DOMPromiseProxy<IDLType>::isFulfilled() const 151 151 { 152 return m_valueOrException.has Value();152 return m_valueOrException.has_value(); 153 153 } 154 154 … … 219 219 inline bool DOMPromiseProxy<IDLUndefined>::isFulfilled() const 220 220 { 221 return m_valueOrException.has Value();221 return m_valueOrException.has_value(); 222 222 } 223 223 … … 289 289 inline bool DOMPromiseProxyWithResolveCallback<IDLType>::isFulfilled() const 290 290 { 291 return m_valueOrException.has Value();291 return m_valueOrException.has_value(); 292 292 } 293 293 -
trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp
r278185 r278244 3483 3483 return JSValue(); 3484 3484 auto reFlags = Yarr::parseFlags(flags->string()); 3485 ASSERT(reFlags.has Value());3485 ASSERT(reFlags.has_value()); 3486 3486 VM& vm = m_lexicalGlobalObject->vm(); 3487 3487 RegExp* regExp = RegExp::create(vm, pattern->string(), reFlags.value()); -
trunk/Source/WebCore/css/CSSFontFaceSet.cpp
r278185 r278244 163 163 void CSSFontFaceSet::addToFacesLookupTable(CSSFontFace& face) 164 164 { 165 if (!face.families() || !face.families().hasValue())165 if (!face.families()) 166 166 return; 167 167 auto families = face.families().value(); … … 246 246 }); 247 247 248 if (face.families() && face.families().hasValue())248 if (face.families()) 249 249 removeFromFacesLookupTable(face, *face.families().value()); 250 250 … … 452 452 for (int i = familyFontFaces.size() - 1; i >= 0; --i) { 453 453 CSSFontFace& candidate = familyFontFaces[i]; 454 auto capabilitiesWrapped = candidate.fontSelectionCapabilities(); 455 if (!capabilitiesWrapped.hasValue()) 456 continue; 457 auto capabilities = capabilitiesWrapped.value(); 458 if (!isItalic(request.slope) && isItalic(capabilities.slope.minimum)) 459 continue; 460 candidateFontFaces.append(candidate); 454 if (auto capabilities = candidate.fontSelectionCapabilities()) { 455 if (!isItalic(request.slope) && isItalic(capabilities->slope.minimum)) 456 continue; 457 candidateFontFaces.append(candidate); 458 } 461 459 } 462 460 … … 464 462 if (localIterator != m_locallyInstalledFacesLookupTable.end()) { 465 463 for (auto& candidate : localIterator->value) { 466 auto capabilitiesWrapped = candidate->fontSelectionCapabilities(); 467 if (!capabilitiesWrapped.hasValue()) 468 continue; 469 auto capabilities = capabilitiesWrapped.value(); 470 if (!isItalic(request.slope) && isItalic(capabilities.slope.minimum)) 471 continue; 472 candidateFontFaces.append(candidate); 464 if (auto capabilities = candidate->fontSelectionCapabilities()) { 465 if (!isItalic(request.slope) && isItalic(capabilities->slope.minimum)) 466 continue; 467 candidateFontFaces.append(candidate); 468 } 473 469 } 474 470 } … … 478 474 capabilities.reserveInitialCapacity(candidateFontFaces.size()); 479 475 for (auto& face : candidateFontFaces) { 480 auto fontSelectionCapabilitiesWrapped = face.get().fontSelectionCapabilities(); 481 ASSERT(fontSelectionCapabilitiesWrapped.hasValue()); 482 auto fontSelectionCapabilities = fontSelectionCapabilitiesWrapped.value(); 483 capabilities.uncheckedAppend(fontSelectionCapabilities); 476 auto fontSelectionCapabilities = face.get().fontSelectionCapabilities(); 477 capabilities.uncheckedAppend(*fontSelectionCapabilities); 484 478 } 485 479 FontSelectionAlgorithm fontSelectionAlgorithm(request, capabilities); 486 480 std::stable_sort(candidateFontFaces.begin(), candidateFontFaces.end(), [&fontSelectionAlgorithm](const CSSFontFace& first, const CSSFontFace& second) { 487 auto firstCapabilitiesWrapped = first.fontSelectionCapabilities(); 488 auto secondCapabilitiesWrapped = second.fontSelectionCapabilities(); 489 ASSERT(firstCapabilitiesWrapped.hasValue() && secondCapabilitiesWrapped.hasValue()); 481 auto firstCapabilities = first.fontSelectionCapabilities(); 482 auto secondCapabilities = second.fontSelectionCapabilities(); 490 483 491 auto firstCapabilities = firstCapabilitiesWrapped.value(); 492 auto secondCapabilities = secondCapabilitiesWrapped.value(); 493 auto stretchDistanceFirst = fontSelectionAlgorithm.stretchDistance(firstCapabilities).distance; 494 auto stretchDistanceSecond = fontSelectionAlgorithm.stretchDistance(secondCapabilities).distance; 484 auto stretchDistanceFirst = fontSelectionAlgorithm.stretchDistance(*firstCapabilities).distance; 485 auto stretchDistanceSecond = fontSelectionAlgorithm.stretchDistance(*secondCapabilities).distance; 495 486 if (stretchDistanceFirst < stretchDistanceSecond) 496 487 return true; … … 498 489 return false; 499 490 500 auto styleDistanceFirst = fontSelectionAlgorithm.styleDistance( firstCapabilities).distance;501 auto styleDistanceSecond = fontSelectionAlgorithm.styleDistance( secondCapabilities).distance;491 auto styleDistanceFirst = fontSelectionAlgorithm.styleDistance(*firstCapabilities).distance; 492 auto styleDistanceSecond = fontSelectionAlgorithm.styleDistance(*secondCapabilities).distance; 502 493 if (styleDistanceFirst < styleDistanceSecond) 503 494 return true; … … 505 496 return false; 506 497 507 auto weightDistanceFirst = fontSelectionAlgorithm.weightDistance( firstCapabilities).distance;508 auto weightDistanceSecond = fontSelectionAlgorithm.weightDistance( secondCapabilities).distance;498 auto weightDistanceFirst = fontSelectionAlgorithm.weightDistance(*firstCapabilities).distance; 499 auto weightDistanceSecond = fontSelectionAlgorithm.weightDistance(*secondCapabilities).distance; 509 500 if (weightDistanceFirst < weightDistanceSecond) 510 501 return true; -
trunk/Source/WebCore/css/CSSGradientValue.cpp
r277967 r278244 70 70 struct GradientStop { 71 71 Color color; 72 Optional<float> offset;73 74 bool isSpecified() const { return offset.has Value(); }72 std::optional<float> offset; 73 74 bool isSpecified() const { return offset.has_value(); } 75 75 bool isMidpoint() const { return !color.isValid(); } 76 76 }; … … 242 242 size_t lastStopIndex = numStops - 1; 243 243 244 Optional<size_t> firstZeroOrGreaterIndex;244 std::optional<size_t> firstZeroOrGreaterIndex; 245 245 for (size_t i = 0; i < numStops; ++i) { 246 246 if (*stops[i].offset >= 0) { … … 272 272 } 273 273 274 Optional<size_t> lastOneOrLessIndex;274 std::optional<size_t> lastOneOrLessIndex; 275 275 for (int i = lastStopIndex; i >= 0; --i) { 276 276 if (*stops[i].offset <= 1) { -
trunk/Source/WebCore/css/CSSSegmentedFontFace.cpp
r275488 r278244 121 121 continue; 122 122 123 auto selectionCapabilitiesWrapped = face->fontSelectionCapabilities(); 124 ASSERT(selectionCapabilitiesWrapped.hasValue()); 125 auto selectionCapabilities = selectionCapabilitiesWrapped.value(); 123 auto selectionCapabilities = *face->fontSelectionCapabilities(); 126 124 127 125 bool syntheticBold = (fontDescription.fontSynthesis() & FontSynthesisWeight) && !isFontWeightBold(selectionCapabilities.weight.maximum) && isFontWeightBold(desiredRequest.weight); … … 133 131 continue; 134 132 135 auto faceRangesWrapped = face->ranges(); 136 ASSERT(faceRangesWrapped.hasValue()); 137 auto faceRanges = faceRangesWrapped.value(); 138 appendFont(ranges, WTFMove(fontAccessor), faceRanges); 133 appendFont(ranges, WTFMove(fontAccessor), *face->ranges()); 139 134 } 140 135 -
trunk/Source/WebCore/css/FontFace.cpp
r276450 r278244 271 271 272 272 const auto& families = m_backing->families(); 273 if (!families .hasValue())273 if (!families) 274 274 return "normal"_s; 275 275 auto familiesUnrwapped = families.value(); … … 296 296 const auto& styleWrapped = m_backing->italic(); 297 297 298 if (!styleWrapped .hasValue())298 if (!styleWrapped) 299 299 return "normal"_s; 300 300 auto style = styleWrapped.value(); … … 329 329 m_backing->updateStyleIfNeeded(); 330 330 const auto& weightWrapped = m_backing->weight(); 331 if (!weightWrapped .hasValue())331 if (!weightWrapped) 332 332 return "normal"_s; 333 333 auto weight = weightWrapped.value(); … … 352 352 m_backing->updateStyleIfNeeded(); 353 353 const auto& stretchWrapped = m_backing->stretch(); 354 if (!stretchWrapped .hasValue())354 if (!stretchWrapped) 355 355 return "normal"_s; 356 356 auto stretch = stretchWrapped.value(); … … 375 375 m_backing->updateStyleIfNeeded(); 376 376 const auto& rangesWrapped = m_backing->ranges(); 377 if (!rangesWrapped .hasValue())377 if (!rangesWrapped) 378 378 return "U+0-10FFFF"; 379 379 auto ranges = rangesWrapped.value(); … … 390 390 m_backing->updateStyleIfNeeded(); 391 391 const auto& featureSettingsWrapped = m_backing->featureSettings(); 392 if (!featureSettingsWrapped .hasValue())392 if (!featureSettingsWrapped) 393 393 return "normal"_s; 394 394 auto featureSettings = featureSettingsWrapped.value(); … … 405 405 m_backing->updateStyleIfNeeded(); 406 406 const auto& loadingBehaviorWrapped = m_backing->loadingBehavior(); 407 if (!loadingBehaviorWrapped .hasValue())407 if (!loadingBehaviorWrapped) 408 408 return "auto"_s; 409 409 return context.cssValuePool().createValue(loadingBehaviorWrapped.value())->cssText(); -
trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp
r278185 r278244 888 888 auto parsedNumber = parseInteger<int>(StringView { nString }.substring(1)); 889 889 result.second = parsedNumber.value_or(0); 890 return parsedNumber.has Value();890 return parsedNumber.has_value(); 891 891 } 892 892 -
trunk/Source/WebCore/display/css/DisplayStyle.h
r271921 r278244 77 77 const ShadowData* boxShadow() const { return m_boxShadow.get(); } 78 78 79 Optional<int> zIndex() const { return m_zIndex; }80 bool isStackingContext() const { return m_zIndex.has Value(); }79 std::optional<int> zIndex() const { return m_zIndex; } 80 bool isStackingContext() const { return m_zIndex.has_value(); } 81 81 82 82 bool isPositioned() const { return m_flags.contains(Flags::Positioned); } … … 126 126 float m_opacity; 127 127 128 Optional<int> m_zIndex;128 std::optional<int> m_zIndex; 129 129 OptionSet<Flags> m_flags; 130 130 }; -
trunk/Source/WebCore/dom/DataTransferItemList.h
r266168 r278244 68 68 void didClearStringData(const String& type); 69 69 void didSetStringData(const String& type); 70 bool hasItems() const { return m_items.has Value(); }70 bool hasItems() const { return m_items.has_value(); } 71 71 const Vector<Ref<DataTransferItem>>& items() const 72 72 { -
trunk/Source/WebCore/dom/Document.cpp
r278185 r278244 2864 2864 Position startPosition; 2865 2865 Position endPosition; 2866 if (!rangeData->startPosition.has Value())2866 if (!rangeData->startPosition.has_value()) 2867 2867 startPosition = visibleSelection.visibleStart().deepEquivalent(); 2868 if (!rangeData->endPosition.has Value())2868 if (!rangeData->endPosition.has_value()) 2869 2869 endPosition = visibleSelection.visibleEnd().deepEquivalent(); 2870 2870 if (!weakRangeData.get()) -
trunk/Source/WebCore/dom/EventTarget.cpp
r278185 r278244 90 90 auto passive = options.passive; 91 91 92 if (!passive.has Value() && Quirks::shouldMakeEventListenerPassive(*this, eventType, listener.get()))92 if (!passive.has_value() && Quirks::shouldMakeEventListenerPassive(*this, eventType, listener.get())) 93 93 passive = true; 94 94 -
trunk/Source/WebCore/editing/AlternativeTextController.cpp
r278185 r278244 147 147 bool AlternativeTextController::hasPendingCorrection() const 148 148 { 149 return m_rangeWithAlternative.has Value();149 return m_rangeWithAlternative.has_value(); 150 150 } 151 151 -
trunk/Source/WebCore/editing/ApplyStyleCommand.cpp
r277174 r278244 601 601 RefPtr<EditingStyle> styleWithoutEmbedding; 602 602 RefPtr<EditingStyle> embeddingStyle; 603 if (textDirection .hasValue()) {603 if (textDirection) { 604 604 // Leave alone an ancestor that provides the desired single level embedding, if there is one. 605 605 auto startUnsplitAncestor = splitAncestorsWithUnicodeBidi(start.deprecatedNode(), true, *textDirection); … … 652 652 653 653 RefPtr<EditingStyle> styleToApply = &style; 654 if (textDirection .hasValue()) {654 if (textDirection) { 655 655 // Avoid applying the unicode-bidi and direction properties beneath ancestors that already have them. 656 656 auto embeddingStartNode = highestEmbeddingAncestor(start.deprecatedNode(), enclosingBlock(start.deprecatedNode())); -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r278185 r278244 6584 6584 CaptionUserPreferences::CaptionDisplayMode HTMLMediaElement::captionDisplayMode() 6585 6585 { 6586 if (!m_captionDisplayMode .hasValue()) {6586 if (!m_captionDisplayMode) { 6587 6587 if (document().page()) 6588 6588 m_captionDisplayMode = document().page()->group().captionPreferences().captionDisplayMode(); -
trunk/Source/WebCore/html/ImageBitmap.h
r269381 r278244 104 104 105 105 Optional<ImageBitmapBacking> takeImageBitmapBacking(); 106 bool isDetached() const { return !m_backingStore .hasValue(); }106 bool isDetached() const { return !m_backingStore; } 107 107 void close() { takeImageBitmapBacking(); } 108 108 -
trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp
r278185 r278244 1110 1110 Protocol::ErrorStringOr<void> InspectorPageAgent::setScreenSizeOverride(Optional<int>&& width, Optional<int>&& height) 1111 1111 { 1112 if (width.has Value() != height.hasValue())1112 if (width.has_value() != height.has_value()) 1113 1113 return makeUnexpected("Screen width and height override should be both specified or omitted"_s); 1114 1114 -
trunk/Source/WebCore/layout/LayoutPhase.cpp
r254666 r278244 58 58 { 59 59 // Should never nest states like calling TreeBuilding from Layout. 60 ASSERT(!(*phase()).has Value());60 ASSERT(!(*phase()).has_value()); 61 61 phase().set(type); 62 62 } -
trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp
r278185 r278244 429 429 auto& inlineTextItem = downcast<InlineTextItem>(overflowingRun.inlineItem); 430 430 auto& style = inlineTextItem.style(); 431 auto availableSpaceIsInfinite = !availableWidth.has Value();431 auto availableSpaceIsInfinite = !availableWidth.has_value(); 432 432 433 433 auto breakRules = wordBreakBehavior(style, hasWrapOpportunityAtPreviousPosition); -
trunk/Source/WebCore/layout/formattingContexts/inline/InlineLine.h
r276886 r278244 54 54 bool isTrailingRunFullyTrimmable() const { return m_trimmableTrailingContent.isTrailingRunFullyTrimmable(); } 55 55 56 Optional<InlineLayoutUnit> trailingSoftHyphenWidth() const { return m_trailingSoftHyphenWidth; }56 std::optional<InlineLayoutUnit> trailingSoftHyphenWidth() const { return m_trailingSoftHyphenWidth; } 57 57 void addTrailingHyphen(InlineLayoutUnit hyphenLogicalWidth); 58 58 … … 72 72 const Box& layoutBox() const { return *m_layoutBox; } 73 73 const RenderStyle& style() const { return m_layoutBox->style(); } 74 const Optional<LineRun::Text>& textContent() const { return m_textContent; }74 const std::optional<LineRun::Text>& textContent() const { return m_textContent; } 75 75 76 76 InlineLayoutUnit logicalWidth() const { return m_logicalWidth; } … … 123 123 TrailingWhitespace m_trailingWhitespaceType { TrailingWhitespace::None }; 124 124 InlineLayoutUnit m_trailingWhitespaceWidth { 0 }; 125 Optional<LineRun::Text> m_textContent;125 std::optional<LineRun::Text> m_textContent; 126 126 LineRun::Expansion m_expansion; 127 127 unsigned m_expansionOpportunityCount { 0 }; … … 154 154 155 155 InlineLayoutUnit width() const { return m_fullyTrimmableWidth + m_partiallyTrimmableWidth; } 156 bool isEmpty() const { return !m_firstTrimmableRunIndex.has Value(); }156 bool isEmpty() const { return !m_firstTrimmableRunIndex.has_value(); } 157 157 bool isTrailingRunFullyTrimmable() const { return m_hasFullyTrimmableContent; } 158 158 bool isTrailingRunPartiallyTrimmable() const { return m_partiallyTrimmableWidth; } … … 162 162 private: 163 163 RunList& m_runs; 164 Optional<size_t> m_firstTrimmableRunIndex;164 std::optional<size_t> m_firstTrimmableRunIndex; 165 165 bool m_hasFullyTrimmableContent { false }; 166 166 InlineLayoutUnit m_fullyTrimmableWidth { 0 }; … … 173 173 InlineLayoutUnit m_contentLogicalWidth { 0 }; 174 174 size_t m_nonSpanningInlineLevelBoxCount { 0 }; 175 Optional<InlineLayoutUnit> m_trailingSoftHyphenWidth { 0 };175 std::optional<InlineLayoutUnit> m_trailingSoftHyphenWidth { 0 }; 176 176 }; 177 177 -
trunk/Source/WebCore/loader/CrossOriginPreflightResultCache.cpp
r278185 r278244 51 51 auto parsedInteger = parseInteger<uint64_t>(string); 52 52 expiryDelta = Seconds(static_cast<double>(parsedInteger.value_or(0))); 53 return parsedInteger.has Value();53 return parsedInteger.has_value(); 54 54 } 55 55 -
trunk/Source/WebCore/page/EventHandler.cpp
r278185 r278244 3097 3097 3098 3098 auto platformEvent = wheelEvent.underlyingPlatformEvent(); 3099 bool isUserEvent = platformEvent.has Value();3099 bool isUserEvent = platformEvent.has_value(); 3100 3100 3101 3101 if (isUserEvent && !m_currentWheelEventAllowsScrolling) -
trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp
r274864 r278244 660 660 { 661 661 // Do we track this element? 662 if (!m_wasHidden.has Value())662 if (!m_wasHidden.has_value()) 663 663 return; 664 664 -
trunk/Source/WebCore/page/scrolling/ScrollSnapOffsetsInfo.cpp
r278185 r278244 108 108 109 109 template <typename InfoType, typename SizeType, typename LayoutType> 110 static std::pair<LayoutType, unsigned> closestSnapOffsetWithInfoAndAxis(const InfoType& info, ScrollEventAxis axis, const SizeType& viewportSize, LayoutType scrollDestinationOffset, float velocity, Optional<LayoutType> originalOffsetForDirectionalSnapping)110 static std::pair<LayoutType, unsigned> closestSnapOffsetWithInfoAndAxis(const InfoType& info, ScrollEventAxis axis, const SizeType& viewportSize, LayoutType scrollDestinationOffset, float velocity, std::optional<LayoutType> originalOffsetForDirectionalSnapping) 111 111 { 112 112 const auto& snapOffsets = info.offsetsForAxis(axis); … … 114 114 return std::make_pair(scrollDestinationOffset, invalidSnapOffsetIndex); 115 115 116 if (originalOffsetForDirectionalSnapping.hasValue()) { 117 auto firstSnapStopOffsetIndex = findFirstSnapStopOffsetBetweenOriginAndDestination(snapOffsets, *originalOffsetForDirectionalSnapping, scrollDestinationOffset); 118 if (firstSnapStopOffsetIndex.hasValue()) 116 if (originalOffsetForDirectionalSnapping) { 117 if (auto firstSnapStopOffsetIndex = findFirstSnapStopOffsetBetweenOriginAndDestination(snapOffsets, *originalOffsetForDirectionalSnapping, scrollDestinationOffset)) 119 118 return std::make_pair(snapOffsets[*firstSnapStopOffsetIndex].offset, *firstSnapStopOffsetIndex); 120 119 } … … 357 356 358 357 template <> template <> 359 std::pair<LayoutUnit, unsigned> LayoutScrollSnapOffsetsInfo::closestSnapOffset(ScrollEventAxis axis, const LayoutSize& viewportSize, LayoutUnit scrollDestinationOffset, float velocity, Optional<LayoutUnit> originalPositionForDirectionalSnapping) const358 std::pair<LayoutUnit, unsigned> LayoutScrollSnapOffsetsInfo::closestSnapOffset(ScrollEventAxis axis, const LayoutSize& viewportSize, LayoutUnit scrollDestinationOffset, float velocity, std::optional<LayoutUnit> originalPositionForDirectionalSnapping) const 360 359 { 361 360 return closestSnapOffsetWithInfoAndAxis(*this, axis, viewportSize, scrollDestinationOffset, velocity, originalPositionForDirectionalSnapping); … … 363 362 364 363 template <> template<> 365 std::pair<float, unsigned> FloatScrollSnapOffsetsInfo::closestSnapOffset(ScrollEventAxis axis, const FloatSize& viewportSize, float scrollDestinationOffset, float velocity, Optional<float> originalPositionForDirectionalSnapping) const364 std::pair<float, unsigned> FloatScrollSnapOffsetsInfo::closestSnapOffset(ScrollEventAxis axis, const FloatSize& viewportSize, float scrollDestinationOffset, float velocity, std::optional<float> originalPositionForDirectionalSnapping) const 366 365 { 367 366 return closestSnapOffsetWithInfoAndAxis(*this, axis, viewportSize, scrollDestinationOffset, velocity, originalPositionForDirectionalSnapping); -
trunk/Source/WebCore/platform/ScrollController.cpp
r277350 r278244 169 169 } 170 170 171 float ScrollController::adjustScrollDestination(ScrollEventAxis axis, float destinationOffset, float velocity, Optional<float> originalOffset)171 float ScrollController::adjustScrollDestination(ScrollEventAxis axis, float destinationOffset, float velocity, std::optional<float> originalOffset) 172 172 { 173 173 if (!usesScrollSnap()) … … 179 179 return destinationOffset; 180 180 181 Optional<LayoutUnit> originalOffsetInLayoutUnits;182 if (originalOffset .hasValue())181 std::optional<LayoutUnit> originalOffsetInLayoutUnits; 182 if (originalOffset) 183 183 originalOffsetInLayoutUnits = LayoutUnit(*originalOffset / m_client.pageScaleFactor()); 184 184 LayoutSize viewportSize(m_client.viewportSize().width(), m_client.viewportSize().height()); -
trunk/Source/WebCore/platform/cocoa/SystemBattery.mm
r273504 r278244 45 45 return *overrideForTesting; 46 46 47 if (!hasBattery.has Value()) {47 if (!hasBattery.has_value()) { 48 48 hasBattery = [] { 49 49 #if PLATFORM(IOS) || PLATFORM(WATCHOS) … … 88 88 return *overrideForTesting; 89 89 90 if (!hasAC.has Value()) {90 if (!hasAC.has_value()) { 91 91 hasAC = [] { 92 92 #if PLATFORM(APPLETV) -
trunk/Source/WebCore/platform/graphics/Gradient.h
r278185 r278244 69 69 70 70 template<typename Encoder> void encode(Encoder&) const; 71 template<typename Decoder> static Optional<ColorStop> decode(Decoder&);71 template<typename Decoder> static std::optional<ColorStop> decode(Decoder&); 72 72 }; 73 73 … … 79 79 80 80 template<typename Encoder> void encode(Encoder&) const; 81 template<typename Decoder> static Optional<LinearData> decode(Decoder&);81 template<typename Decoder> static std::optional<LinearData> decode(Decoder&); 82 82 }; 83 83 … … 90 90 91 91 template<typename Encoder> void encode(Encoder&) const; 92 template<typename Decoder> static Optional<RadialData> decode(Decoder&);92 template<typename Decoder> static std::optional<RadialData> decode(Decoder&); 93 93 }; 94 94 … … 98 98 99 99 template<typename Encoder> void encode(Encoder&) const; 100 template<typename Decoder> static Optional<ConicData> decode(Decoder&);100 template<typename Decoder> static std::optional<ConicData> decode(Decoder&); 101 101 }; 102 102 … … 136 136 137 137 template<typename Encoder> void encode(Encoder&) const; 138 template<typename Decoder> static Optional<Ref<Gradient>> decode(Decoder&);138 template<typename Decoder> static std::optional<Ref<Gradient>> decode(Decoder&); 139 139 140 140 private: … … 169 169 } 170 170 171 template<typename Decoder> Optional<Gradient::ColorStop> Gradient::ColorStop::decode(Decoder& decoder)172 { 173 Optional<float> offset;171 template<typename Decoder> std::optional<Gradient::ColorStop> Gradient::ColorStop::decode(Decoder& decoder) 172 { 173 std::optional<float> offset; 174 174 decoder >> offset; 175 175 if (!offset) 176 176 return std::nullopt; 177 177 178 Optional<Color> color;178 std::optional<Color> color; 179 179 decoder >> color; 180 180 if (!color) … … 190 190 } 191 191 192 template<typename Decoder> Optional<Gradient::LinearData> Gradient::LinearData::decode(Decoder& decoder)193 { 194 Optional<FloatPoint> point0;192 template<typename Decoder> std::optional<Gradient::LinearData> Gradient::LinearData::decode(Decoder& decoder) 193 { 194 std::optional<FloatPoint> point0; 195 195 decoder >> point0; 196 196 if (!point0) 197 197 return std::nullopt; 198 198 199 Optional<FloatPoint> point1;199 std::optional<FloatPoint> point1; 200 200 decoder >> point1; 201 201 if (!point1) … … 214 214 } 215 215 216 template<typename Decoder> Optional<Gradient::RadialData> Gradient::RadialData::decode(Decoder& decoder)217 { 218 Optional<FloatPoint> point0;216 template<typename Decoder> std::optional<Gradient::RadialData> Gradient::RadialData::decode(Decoder& decoder) 217 { 218 std::optional<FloatPoint> point0; 219 219 decoder >> point0; 220 220 if (!point0) 221 221 return std::nullopt; 222 222 223 Optional<FloatPoint> point1;223 std::optional<FloatPoint> point1; 224 224 decoder >> point1; 225 225 if (!point1) 226 226 return std::nullopt; 227 227 228 Optional<float> startRadius;228 std::optional<float> startRadius; 229 229 decoder >> startRadius; 230 230 if (!startRadius) 231 231 return std::nullopt; 232 232 233 Optional<float> endRadius;233 std::optional<float> endRadius; 234 234 decoder >> endRadius; 235 235 if (!endRadius) 236 236 return std::nullopt; 237 237 238 Optional<float> aspectRatio;238 std::optional<float> aspectRatio; 239 239 decoder >> aspectRatio; 240 240 if (!aspectRatio) … … 250 250 } 251 251 252 template<typename Decoder> Optional<Gradient::ConicData> Gradient::ConicData::decode(Decoder& decoder)253 { 254 Optional<FloatPoint> point0;252 template<typename Decoder> std::optional<Gradient::ConicData> Gradient::ConicData::decode(Decoder& decoder) 253 { 254 std::optional<FloatPoint> point0; 255 255 decoder >> point0; 256 256 if (!point0) 257 257 return std::nullopt; 258 258 259 Optional<float> angleRadians;259 std::optional<float> angleRadians; 260 260 decoder >> angleRadians; 261 261 if (!angleRadians) … … 273 273 } 274 274 275 template<typename Decoder> Optional<Ref<Gradient>> Gradient::decode(Decoder& decoder)276 { 277 Optional<Data> data;275 template<typename Decoder> std::optional<Ref<Gradient>> Gradient::decode(Decoder& decoder) 276 { 277 std::optional<Data> data; 278 278 decoder >> data; 279 279 if (!data) … … 281 281 auto gradient = Gradient::create(WTFMove(*data)); 282 282 283 Optional<ColorStopVector> stops;283 std::optional<ColorStopVector> stops; 284 284 decoder >> stops; 285 285 if (!stops) 286 286 return std::nullopt; 287 Optional<bool> stopsSorted;287 std::optional<bool> stopsSorted; 288 288 decoder >> stopsSorted; 289 if (!stopsSorted.has Value())289 if (!stopsSorted.has_value()) 290 290 return std::nullopt; 291 291 if (*stopsSorted) -
trunk/Source/WebCore/platform/graphics/ImageSource.h
r275570 r278244 80 80 bool canUseAsyncDecoding(); 81 81 void startAsyncDecodingQueue(); 82 void requestFrameAsyncDecodingAtIndex(size_t, SubsamplingLevel, const Optional<IntSize>& = { });82 void requestFrameAsyncDecodingAtIndex(size_t, SubsamplingLevel, const std::optional<IntSize>& = { }); 83 83 void stopAsyncDecodingQueue(); 84 84 bool hasAsyncDecodingQueue() const { return m_decodingQueue; } … … 96 96 String filenameExtension(); 97 97 String accessibilityDescription(); 98 Optional<IntPoint> hotSpot();99 Optional<IntSize> densityCorrectedSize(ImageOrientation = ImageOrientation::FromImage);100 bool hasDensityCorrectedSize() { return densityCorrectedSize().has Value(); }98 std::optional<IntPoint> hotSpot(); 99 std::optional<IntSize> densityCorrectedSize(ImageOrientation = ImageOrientation::FromImage); 100 bool hasDensityCorrectedSize() { return densityCorrectedSize().has_value(); } 101 101 102 102 ImageOrientation orientation(); … … 114 114 bool frameHasAlphaAtIndex(size_t); 115 115 bool frameHasImageAtIndex(size_t); 116 bool frameHasFullSizeNativeImageAtIndex(size_t, const Optional<SubsamplingLevel>&);117 bool frameHasDecodedNativeImageCompatibleWithOptionsAtIndex(size_t, const Optional<SubsamplingLevel>&, const DecodingOptions&);116 bool frameHasFullSizeNativeImageAtIndex(size_t, const std::optional<SubsamplingLevel>&); 117 bool frameHasDecodedNativeImageCompatibleWithOptionsAtIndex(size_t, const std::optional<SubsamplingLevel>&, const DecodingOptions&); 118 118 SubsamplingLevel frameSubsamplingLevelAtIndex(size_t); 119 119 … … 154 154 155 155 template<typename T> 156 T firstFrameMetadataCacheIfNeeded(T& cachedValue, MetadataType, T (ImageFrame::*functor)() const, ImageFrame::Caching, const Optional<SubsamplingLevel>& = { });156 T firstFrameMetadataCacheIfNeeded(T& cachedValue, MetadataType, T (ImageFrame::*functor)() const, ImageFrame::Caching, const std::optional<SubsamplingLevel>& = { }); 157 157 158 158 bool ensureDecoderAvailable(SharedBuffer* data); … … 177 177 178 178 const ImageFrame& frameAtIndex(size_t index) { return index < m_frames.size() ? m_frames[index] : ImageFrame::defaultFrame(); } 179 const ImageFrame& frameAtIndexCacheIfNeeded(size_t, ImageFrame::Caching, const Optional<SubsamplingLevel>& = { });179 const ImageFrame& frameAtIndexCacheIfNeeded(size_t, ImageFrame::Caching, const std::optional<SubsamplingLevel>& = { }); 180 180 181 181 void dump(TextStream&); … … 215 215 String m_filenameExtension; 216 216 String m_accessibilityDescription; 217 Optional<IntPoint> m_hotSpot;217 std::optional<IntPoint> m_hotSpot; 218 218 219 219 // Image metadata which is calculated from the first ImageFrame. 220 220 IntSize m_size; 221 Optional<IntSize> m_densityCorrectedSize;221 std::optional<IntSize> m_densityCorrectedSize; 222 222 ImageOrientation m_orientation; 223 223 Color m_singlePixelSolidColor; -
trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp
r278185 r278244 1166 1166 bool MediaPlayer::wouldTaintOrigin(const SecurityOrigin& origin) const 1167 1167 { 1168 auto wouldTaint = m_private->wouldTaintOrigin(origin); 1169 if (wouldTaint.hasValue()) 1170 return wouldTaint.value(); 1168 if (auto wouldTaint = m_private->wouldTaintOrigin(origin)) 1169 return *wouldTaint; 1171 1170 1172 1171 if (m_url.protocolIsData()) -
trunk/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp
r278185 r278244 183 183 if (!oldContext) { 184 184 auto newContext = requestGLContext(contextType); 185 if (!newContext .hasValue())185 if (!newContext) 186 186 return false; 187 187 gst_element_set_context(elementSink, newContext->get()); -
trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp
r278185 r278244 148 148 bool isUsingHardware = false; 149 149 150 if (disallowedList .hasValue()&& !disallowedList->isEmpty()) {150 if (disallowedList && !disallowedList->isEmpty()) { 151 151 bool hasValidCandidate = false; 152 152 for (GList* factories = candidates; factories; factories = g_list_next(factories)) { -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
r278185 r278244 1344 1344 return m_playbackRate > 0 ? durationMediaTime() : MediaTime::zeroTime(); 1345 1345 1346 if (m_cachedPosition .hasValue()) {1346 if (m_cachedPosition) { 1347 1347 GST_TRACE_OBJECT(pipeline(), "Returning cached position: %s", m_cachedPosition.value().toString().utf8().data()); 1348 1348 return m_cachedPosition.value(); … … 2872 2872 // Dispatch the task if the time is already reached. Dispatching instead of directly running the 2873 2873 // task prevents infinite recursion in case the task calls performTaskAtMediaTime() internally. 2874 if (taskToSchedule .hasValue())2874 if (taskToSchedule) 2875 2875 RunLoop::main().dispatch(WTFMove(taskToSchedule.value())); 2876 2876 … … 3125 3125 // Heuristic to avoid asking for playbackPosition() from a non-main thread. 3126 3126 MediaTime currentTime = MediaTime(gst_segment_to_stream_time(gst_sample_get_segment(sample), GST_FORMAT_TIME, GST_BUFFER_PTS(buffer)), GST_SECOND); 3127 auto task = holdLock(m_TaskAtMediaTimeSchedulerDataMutex)->checkTaskForScheduling(currentTime); 3128 if (task.hasValue()) 3127 if (auto task = holdLock(m_TaskAtMediaTimeSchedulerDataMutex)->checkTaskForScheduling(currentTime)) 3129 3128 RunLoop::main().dispatch(WTFMove(task.value())); 3130 3129 } -
trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMProxyThunder.cpp
r275599 r278244 56 56 57 57 auto keyHandle = getOrWaitForKeyHandle(keyID, WTFMove(in.cdmProxyDecryptionClient)); 58 if (!keyHandle.has Value() || !keyHandle.value()->isStatusCurrentlyValid())58 if (!keyHandle.has_value() || !keyHandle.value()->isStatusCurrentlyValid()) 59 59 return nullptr; 60 60 -
trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.cpp
r278185 r278244 251 251 } 252 252 253 Optional<String> CDMPrivateThunder::sanitizeSessionId(const String& sessionId) const253 std::optional<String> CDMPrivateThunder::sanitizeSessionId(const String& sessionId) const 254 254 { 255 255 return sessionId; … … 365 365 const Ref<SharedBuffer>& payload() const& { ASSERT(m_payload); return m_payload.value(); } 366 366 Ref<SharedBuffer>& payload() & { ASSERT(m_payload); return m_payload.value(); } 367 bool hasType() const { return m_type.has Value(); }367 bool hasType() const { return m_type.has_value(); } 368 368 WebCore::MediaKeyMessageType type() const { ASSERT(m_type); return m_type.value(); } 369 369 WebCore::MediaKeyMessageType typeOr(WebCore::MediaKeyMessageType alternate) const { return m_type ? m_type.value() : alternate; } … … 373 373 private: 374 374 bool m_isValid { false }; 375 Optional<Ref<SharedBuffer>> m_payload;376 Optional<WebCore::MediaKeyMessageType> m_type;375 std::optional<Ref<SharedBuffer>> m_payload; 376 std::optional<WebCore::MediaKeyMessageType> m_type; 377 377 }; 378 378 … … 470 470 if (m_doesKeyStoreNeedMerging) { 471 471 m_doesKeyStoreNeedMerging = false; 472 auto instance = cdmInstanceThunder(); 473 if (instance) 472 if (auto instance = cdmInstanceThunder()) 474 473 instance->mergeKeysFrom(m_keyStore); 475 474 } … … 675 674 } 676 675 677 Optional<CDMInstanceThunder&> CDMInstanceSessionThunder::cdmInstanceThunder() const 678 { 679 auto instance = cdmInstanceProxy(); 680 if (!instance) 681 return std::nullopt; 682 return static_cast<CDMInstanceThunder&>(*instance); 676 CDMInstanceThunder* CDMInstanceSessionThunder::cdmInstanceThunder() const 677 { 678 return static_cast<CDMInstanceThunder*>(cdmInstanceProxy()); 683 679 } 684 680 -
trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.h
r274719 r278244 99 99 RefPtr<SharedBuffer> sanitizeInitData(const AtomString& initDataType, const SharedBuffer& initData) const final; 100 100 RefPtr<SharedBuffer> sanitizeResponse(const SharedBuffer&) const final; 101 Optional<String> sanitizeSessionId(const String&) const final;101 std::optional<String> sanitizeSessionId(const String&) const final; 102 102 103 103 private: … … 143 143 144 144 private: 145 Optional<CDMInstanceThunder&>cdmInstanceThunder() const;145 CDMInstanceThunder* cdmInstanceThunder() const; 146 146 147 147 using Notification = void (CDMInstanceSessionThunder::*)(RefPtr<WebCore::SharedBuffer>&&); -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp
r277947 r278244 395 395 auto& gstRegistryScanner = GStreamerRegistryScannerMSE::singleton(); 396 396 if (!gstRegistryScanner.isCodecSupported(GStreamerRegistryScanner::Configuration::Decoding, originalMediaType)) { 397 m_presentationSize = WebCore::FloatSize();398 m_streamType = MediaSourceStreamTypeGStreamer::Invalid;397 m_presentationSize = FloatSize(); 398 m_streamType = MediaSourceStreamTypeGStreamer::Invalid; 399 399 } else if (doCapsHaveType(m_demuxerSrcPadCaps.get(), GST_VIDEO_CAPS_TYPE_PREFIX)) { 400 Optional<FloatSize> size = getVideoResolutionFromCaps(m_demuxerSrcPadCaps.get()); 401 if (size.hasValue()) 402 m_presentationSize = size.value(); 403 else 404 m_presentationSize = WebCore::FloatSize(); 405 400 m_presentationSize = getVideoResolutionFromCaps(m_demuxerSrcPadCaps.get()).value_or(FloatSize()); 406 401 m_streamType = MediaSourceStreamTypeGStreamer::Video; 407 402 } else { 408 m_presentationSize = WebCore::FloatSize();403 m_presentationSize = FloatSize(); 409 404 if (doCapsHaveType(m_demuxerSrcPadCaps.get(), GST_AUDIO_CAPS_TYPE_PREFIX)) 410 405 m_streamType = MediaSourceStreamTypeGStreamer::Audio; … … 437 432 438 433 if (doCapsHaveType(caps.get(), GST_VIDEO_CAPS_TYPE_PREFIX)) { 439 Optional<FloatSize> size = getVideoResolutionFromCaps(caps.get()); 440 if (size.hasValue()) 441 m_presentationSize = size.value(); 434 if (auto size = getVideoResolutionFromCaps(caps.get())) 435 m_presentationSize = *size; 442 436 } 443 437 … … 471 465 } 472 466 473 auto mediaSample = WebCore::MediaSampleGStreamer::create(WTFMove(sample), m_presentationSize, trackId());467 auto mediaSample = MediaSampleGStreamer::create(WTFMove(sample), m_presentationSize, trackId()); 474 468 475 469 GST_TRACE("append: trackId=%s PTS=%s DTS=%s DUR=%s presentationSize=%.0fx%.0f", … … 506 500 ASSERT(isMainThread()); 507 501 508 WebCore::SourceBufferPrivateClient::InitializationSegment initializationSegment;502 SourceBufferPrivateClient::InitializationSegment initializationSegment; 509 503 510 504 GST_DEBUG("Notifying SourceBuffer for track %s", (m_track) ? m_track->id().string().utf8().data() : nullptr); … … 513 507 switch (m_streamType) { 514 508 case Audio: { 515 WebCore::SourceBufferPrivateClient::InitializationSegment::AudioTrackInformation info;509 SourceBufferPrivateClient::InitializationSegment::AudioTrackInformation info; 516 510 info.track = static_cast<AudioTrackPrivateGStreamer*>(m_track.get()); 517 info.description = WebCore::GStreamerMediaDescription::create(m_demuxerSrcPadCaps.get());511 info.description = GStreamerMediaDescription::create(m_demuxerSrcPadCaps.get()); 518 512 initializationSegment.audioTracks.append(info); 519 513 break; 520 514 } 521 515 case Video: { 522 WebCore::SourceBufferPrivateClient::InitializationSegment::VideoTrackInformation info;516 SourceBufferPrivateClient::InitializationSegment::VideoTrackInformation info; 523 517 info.track = static_cast<VideoTrackPrivateGStreamer*>(m_track.get()); 524 info.description = WebCore::GStreamerMediaDescription::create(m_demuxerSrcPadCaps.get());518 info.description = GStreamerMediaDescription::create(m_demuxerSrcPadCaps.get()); 525 519 initializationSegment.videoTracks.append(info); 526 520 break; … … 777 771 switch (m_streamType) { 778 772 case MediaSourceStreamTypeGStreamer::Audio: { 779 auto specificTrack = WebCore::AudioTrackPrivateGStreamer::create(makeWeakPtr(*m_playerPrivate), id(), sinkSinkPad.get());773 auto specificTrack = AudioTrackPrivateGStreamer::create(makeWeakPtr(*m_playerPrivate), id(), sinkSinkPad.get()); 780 774 gstreamerTrack = specificTrack.ptr(); 781 775 m_track = makeRefPtr(static_cast<TrackPrivateBase*>(specificTrack.ptr())); … … 783 777 } 784 778 case MediaSourceStreamTypeGStreamer::Video: { 785 auto specificTrack = WebCore::VideoTrackPrivateGStreamer::create(makeWeakPtr(*m_playerPrivate), id(), sinkSinkPad.get());779 auto specificTrack = VideoTrackPrivateGStreamer::create(makeWeakPtr(*m_playerPrivate), id(), sinkSinkPad.get()); 786 780 gstreamerTrack = specificTrack.ptr(); 787 781 m_track = makeRefPtr(static_cast<TrackPrivateBase*>(specificTrack.ptr())); … … 789 783 } 790 784 case MediaSourceStreamTypeGStreamer::Text: { 791 auto specificTrack = WebCore::InbandTextTrackPrivateGStreamer::create(id(), sinkSinkPad.get());785 auto specificTrack = InbandTextTrackPrivateGStreamer::create(id(), sinkSinkPad.get()); 792 786 gstreamerTrack = specificTrack.ptr(); 793 787 m_track = makeRefPtr(static_cast<TrackPrivateBase*>(specificTrack.ptr())); … … 907 901 GstEvent* event = gst_pad_probe_info_get_event(info); 908 902 GST_DEBUG("Handling event %s on append pipeline appsinkPad", GST_EVENT_TYPE_NAME(event)); 909 WebCore::AppendPipeline* appendPipeline = padProbeInformation->appendPipeline;903 AppendPipeline* appendPipeline = padProbeInformation->appendPipeline; 910 904 911 905 switch (GST_EVENT_TYPE(event)) { -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp
r277031 r278244 346 346 // want to report an initial size for HAVE_METADATA (first initialization segment). 347 347 if (m_videoSize.isEmpty() && doCapsHaveType(caps, GST_VIDEO_CAPS_TYPE_PREFIX)) { 348 Optional<FloatSize> size = getVideoResolutionFromCaps(caps); 349 if (size.hasValue()) { 350 m_videoSize = size.value(); 348 if (auto size = getVideoResolutionFromCaps(caps)) { 349 m_videoSize = *size; 351 350 GST_DEBUG("Setting initial video size: %gx%g", m_videoSize.width(), m_videoSize.height()); 352 351 } -
trunk/Source/WebCore/platform/graphics/transforms/TransformState.h
r260353 r278244 31 31 #include "LayoutSize.h" 32 32 #include "TransformationMatrix.h" 33 #include < wtf/Optional.h>33 #include <optional> 34 34 35 35 namespace WTF { … … 83 83 } 84 84 85 void setSecondaryQuad(const Optional<FloatQuad>& quad)85 void setSecondaryQuad(const std::optional<FloatQuad>& quad) 86 86 { 87 87 // We must be in a flattened state (no accumulated offset) when setting this secondary quad. … … 90 90 } 91 91 92 void setLastPlanarSecondaryQuad(const Optional<FloatQuad>&);92 void setLastPlanarSecondaryQuad(const std::optional<FloatQuad>&); 93 93 94 94 void move(LayoutUnit x, LayoutUnit y, TransformAccumulation accumulate = FlattenTransform) … … 105 105 FloatPoint lastPlanarPoint() const { return m_lastPlanarPoint; } 106 106 FloatQuad lastPlanarQuad() const { return m_lastPlanarQuad; } 107 Optional<FloatQuad> lastPlanarSecondaryQuad() const { return m_lastPlanarSecondaryQuad; }108 bool isMappingSecondaryQuad() const { return m_lastPlanarSecondaryQuad.has Value(); }107 std::optional<FloatQuad> lastPlanarSecondaryQuad() const { return m_lastPlanarSecondaryQuad; } 108 bool isMappingSecondaryQuad() const { return m_lastPlanarSecondaryQuad.has_value(); } 109 109 110 110 // Return the point or quad mapped through the current transform 111 111 FloatPoint mappedPoint(bool* wasClamped = nullptr) const; 112 112 FloatQuad mappedQuad(bool* wasClamped = nullptr) const; 113 Optional<FloatQuad> mappedSecondaryQuad(bool* wasClamped = nullptr) const;113 std::optional<FloatQuad> mappedSecondaryQuad(bool* wasClamped = nullptr) const; 114 114 115 115 TransformationMatrix* accumulatedTransform() const { return m_accumulatedTransform.get(); } … … 128 128 FloatPoint m_lastPlanarPoint; 129 129 FloatQuad m_lastPlanarQuad; 130 Optional<FloatQuad> m_lastPlanarSecondaryQuad;130 std::optional<FloatQuad> m_lastPlanarSecondaryQuad; 131 131 132 132 // We only allocate the transform if we need to -
trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm
r277242 r278244 1645 1645 { 1646 1646 #if ENABLE(VIDEO_PRESENTATION_MODE) && !PLATFORM(WATCHOS) 1647 if (isPictureInPictureSupported.has Value())1647 if (isPictureInPictureSupported.has_value()) 1648 1648 return *isPictureInPictureSupported; 1649 1649 return [getAVPictureInPictureControllerClass() isPictureInPictureSupported]; -
trunk/Source/WebCore/platform/mac/NSScrollerImpDetails.mm
r239477 r278244 39 39 NSScrollerStyle ScrollerStyle::recommendedScrollerStyle() 40 40 { 41 if (m_useOverlayScrollbars.has Value())41 if (m_useOverlayScrollbars.has_value()) 42 42 return *m_useOverlayScrollbars ? NSScrollerStyleOverlay : NSScrollerStyleLegacy; 43 44 43 if (DeprecatedGlobalSettings::usesOverlayScrollbars()) 45 44 return NSScrollerStyleOverlay; -
trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp
r278185 r278244 603 603 604 604 #if USE(SYSTEM_PREVIEW) 605 605 606 bool ResourceRequestBase::isSystemPreview() const 606 607 { 607 return m_systemPreviewInfo.has Value();608 return m_systemPreviewInfo.has_value(); 608 609 } 609 610 … … 617 618 m_systemPreviewInfo = info; 618 619 } 620 619 621 #endif 620 622 -
trunk/Source/WebCore/platform/xr/openxr/OpenXRInputSource.cpp
r278185 r278244 163 163 164 164 // Trigger is mandatory in xr-standard mapping. 165 if (buttons.isEmpty() || !buttons.first().has Value())165 if (buttons.isEmpty() || !buttons.first().has_value()) 166 166 return std::nullopt; 167 167 -
trunk/Source/WebCore/rendering/EventRegion.h
r278185 r278244 89 89 #if ENABLE(EDITABLE_REGION) 90 90 void ensureEditableRegion(); 91 bool hasEditableRegion() const { return m_editableRegion.has Value(); }91 bool hasEditableRegion() const { return m_editableRegion.has_value(); } 92 92 WEBCORE_EXPORT bool containsEditableElementsInRect(const IntRect&) const; 93 93 Vector<IntRect, 1> rectsForEditableElements() const { return m_editableRegion ? m_editableRegion->rects() : Vector<IntRect, 1> { }; } -
trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.h
r278185 r278244 74 74 Optional<LayoutUnit> growthLimitCap() const { return m_growthLimitCap; } 75 75 76 const GridTrackSize& cachedTrackSize() const 77 { 78 ASSERT(m_cachedTrackSize.hasValue()); 79 return m_cachedTrackSize.value(); 80 } 76 const GridTrackSize& cachedTrackSize() const { return *m_cachedTrackSize; } 81 77 void setCachedTrackSize(const GridTrackSize&); 82 78 -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r278185 r278244 863 863 if (m_hasDefiniteHeight == SizeDefiniteness::Indefinite) 864 864 return false; 865 bool definite = child.computePercentageLogicalHeight(flexBasis, updateDescendants).has Value();865 bool definite = child.computePercentageLogicalHeight(flexBasis, updateDescendants).has_value(); 866 866 if (m_inLayout && (isHorizontalWritingMode() == child.isHorizontalWritingMode())) { 867 867 // We can reach this code even while we're not laying ourselves out, such -
trunk/Source/WebCore/rendering/RenderListItem.cpp
r278185 r278244 320 320 return; 321 321 } 322 m_valueWasSetExplicitly = value.has Value();322 m_valueWasSetExplicitly = value.has_value(); 323 323 m_value = value; 324 324 explicitValueChanged(); -
trunk/Source/WebCore/rendering/RenderThemeIOS.mm
r278185 r278244 1238 1238 Color RenderThemeIOS::systemFocusRingColor() 1239 1239 { 1240 if (!cachedFocusRingColor().has Value()) {1240 if (!cachedFocusRingColor().has_value()) { 1241 1241 // FIXME: Should be using -keyboardFocusIndicatorColor. For now, work around <rdar://problem/50838886>. 1242 1242 cachedFocusRingColor() = colorFromUIColor([PAL::getUIColorClass() systemBlueColor]); -
trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp
r278219 r278244 792 792 continue; 793 793 auto isInlineLevelBox = firstChild->isInline(); 794 if (!shouldAllChildrenBeInline.has Value()) {794 if (!shouldAllChildrenBeInline.has_value()) { 795 795 shouldAllChildrenBeInline = isInlineLevelBox; 796 796 continue; -
trunk/Source/WebCore/svg/SVGSVGElement.cpp
r272805 r278244 314 314 { 315 315 AffineTransform transform; 316 if (matrixInit.a .hasValue())317 transform.setA( matrixInit.a.value());318 if (matrixInit.b .hasValue())319 transform.setB( matrixInit.b.value());320 if (matrixInit.c .hasValue())321 transform.setC( matrixInit.c.value());322 if (matrixInit.d .hasValue())323 transform.setD( matrixInit.d.value());324 if (matrixInit.e .hasValue())325 transform.setE( matrixInit.e.value());326 if (matrixInit.f .hasValue())327 transform.setF( matrixInit.f.value());316 if (matrixInit.a) 317 transform.setA(*matrixInit.a); 318 if (matrixInit.b) 319 transform.setB(*matrixInit.b); 320 if (matrixInit.c) 321 transform.setC(*matrixInit.c); 322 if (matrixInit.d) 323 transform.setD(*matrixInit.d); 324 if (matrixInit.e) 325 transform.setE(*matrixInit.e); 326 if (matrixInit.f) 327 transform.setF(*matrixInit.f); 328 328 return SVGTransform::create(transform); 329 329 } -
trunk/Source/WebCore/svg/SVGTransform.h
r258459 r278244 78 78 79 79 AffineTransform transform; 80 if (matrixInit.a .hasValue())80 if (matrixInit.a) 81 81 transform.setA(matrixInit.a.value()); 82 if (matrixInit.b .hasValue())82 if (matrixInit.b) 83 83 transform.setB(matrixInit.b.value()); 84 if (matrixInit.c .hasValue())84 if (matrixInit.c) 85 85 transform.setC(matrixInit.c.value()); 86 if (matrixInit.d .hasValue())86 if (matrixInit.d) 87 87 transform.setD(matrixInit.d.value()); 88 if (matrixInit.e .hasValue())88 if (matrixInit.e) 89 89 transform.setE(matrixInit.e.value()); 90 if (matrixInit.f .hasValue())90 if (matrixInit.f) 91 91 transform.setF(matrixInit.f.value()); 92 92 m_value.setMatrix(transform); -
trunk/Source/WebCore/testing/WebFakeXRDevice.cpp
r278185 r278244 214 214 PlatformXR::Device::FrameData::View view; 215 215 view.offset = fakeView->offset(); 216 if (fakeView->fieldOfView() .hasValue())216 if (fakeView->fieldOfView()) 217 217 view.projection = { *fakeView->fieldOfView() }; 218 218 else -
trunk/Source/WebDriver/ChangeLog
r278185 r278244 1 2021-05-28 Darin Adler <darin@apple.com> 2 3 Clients of optional should use has_value instead of relying on hasValue macro 4 https://bugs.webkit.org/show_bug.cgi?id=226395 5 6 Reviewed by Chris Dumez. 7 8 * socket/SessionHostSocket.cpp: 9 (WebDriver::SessionHost::isConnected const): Use has_value. 10 1 11 2021-05-27 Darin Adler <darin@apple.com> 2 12 -
trunk/Source/WebDriver/socket/SessionHostSocket.cpp
r278185 r278244 81 81 bool SessionHost::isConnected() const 82 82 { 83 return m_clientID.has Value();83 return m_clientID.has_value(); 84 84 } 85 85 -
trunk/Source/WebKit/ChangeLog
r278235 r278244 1 2021-05-28 Darin Adler <darin@apple.com> 2 3 Clients of optional should use has_value instead of relying on hasValue macro 4 https://bugs.webkit.org/show_bug.cgi?id=226395 5 6 Reviewed by Chris Dumez. 7 8 * Platform/IPC/ArgumentCoders.h: Use std::optional; there was no hasValue 9 in here and I edited it by mistake, but we want to do this eventually. 10 11 * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: Removed using namespace WebCore. 12 (IPC::ArgumentCoder<Ref<WebCore::Font>>::decodePlatformData): Use has_value. 13 * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm: 14 (WebKit::XPCServiceInitializerDelegate::getClientSDKVersion): Ditto. 15 16 * Shared/WebCoreArgumentCoders.cpp: 17 (IPC::decodeImage): Changed idiom to not call hasValue. 18 (IPC::ArgumentCoder<Ref<Font>>::decode): Ditto. 19 20 * Shared/mac/MediaFormatReader/MediaFormatReader.cpp: 21 (WebKit::MediaFormatReader::finishParsing): Use has_value. 22 (WebKit::MediaFormatReader::copyProperty): Ditto. 23 (WebKit::MediaFormatReader::copyTrackArray): Ditto. 24 25 * Shared/win/WebCoreArgumentCodersWin.cpp: 26 (IPC::ArgumentCoder<Ref<Font>>::decodePlatformData): Do not call hasValue. 27 28 * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: 29 (-[WKWebViewConfiguration encodeWithCoder:]): Changed idiom to not use hasValue. 30 31 * UIProcess/API/glib/InputMethodFilter.cpp: 32 (WebKit::InputMethodFilter::setState): Use has_value. 33 34 * UIProcess/Automation/WebAutomationSession.cpp: 35 (WebKit::AutomationCommandError::toProtocolString): Changed idiom to not use hasValue. 36 37 * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: 38 (WebKit::WebPasteboardProxy::determineDataOwner const): Use has_value. 39 40 * UIProcess/Inspector/socket/RemoteInspectorClient.cpp: 41 (WebKit::RemoteInspectorClient::sendWebInspectorEvent): Changed idiom to not use hasValue. 42 * UIProcess/glib/UserMediaPermissionRequestManagerProxyGLib.cpp: 43 (WebKit::UserMediaPermissionRequestManagerProxy::platformValidateUserMediaRequestConstraints): Ditto. 44 45 * WebProcess/GPU/media/MediaSourcePrivateRemote.cpp: 46 (WebKit::MediaSourcePrivateRemote::addSourceBuffer): Use has_value. 47 * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: 48 (WebKit::WebPage::platformDidReceiveLoadParameters): Ditto. 49 50 * WebProcess/cocoa/WebProcessCocoa.mm: 51 (WebKit::WebProcess::notifyPreferencesChanged): Changed idiom to not 52 call hasValue. 53 1 54 2021-05-28 Wenson Hsieh <wenson_hsieh@apple.com> 2 55 -
trunk/Source/WebKit/Platform/IPC/ArgumentCoders.h
r278185 r278244 64 64 encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(arrayReference.data()), arrayReference.size() * sizeof(T), alignof(T)); 65 65 } 66 static Optional<ArrayReferenceType> decode(Decoder& decoder)66 static std::optional<ArrayReferenceType> decode(Decoder& decoder) 67 67 { 68 68 if (!Extent) … … 85 85 encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(arrayReference.data()), arrayReference.size() * sizeof(T), alignof(T)); 86 86 } 87 static Optional<ArrayReferenceType> decode(Decoder& decoder)87 static std::optional<ArrayReferenceType> decode(Decoder& decoder) 88 88 { 89 89 uint64_t size; … … 122 122 } 123 123 124 static Optional<OptionSet<T>> decode(Decoder& decoder)125 { 126 Optional<typename OptionSet<T>::StorageType> value;124 static std::optional<OptionSet<T>> decode(Decoder& decoder) 125 { 126 std::optional<typename OptionSet<T>::StorageType> value; 127 127 decoder >> value; 128 128 if (!value) … … 135 135 }; 136 136 137 template<typename T> struct ArgumentCoder< Optional<T>> {138 139 template<typename Encoder> static void encode(Encoder& encoder, const Optional<T>& optional)137 template<typename T> struct ArgumentCoder<std::optional<T>> { 138 139 template<typename Encoder> static void encode(Encoder& encoder, const std::optional<T>& optional) 140 140 { 141 141 if (!optional) { … … 148 148 } 149 149 150 template<typename Decoder> static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Optional<T>& optional)150 template<typename Decoder> static WARN_UNUSED_RETURN bool decode(Decoder& decoder, std::optional<T>& optional) 151 151 { 152 152 bool isEngaged; … … 167 167 } 168 168 169 template<typename Decoder> static Optional<Optional<T>> decode(Decoder& decoder)170 { 171 Optional<bool> isEngaged;169 template<typename Decoder> static std::optional<std::optional<T>> decode(Decoder& decoder) 170 { 171 std::optional<bool> isEngaged; 172 172 decoder >> isEngaged; 173 173 if (!isEngaged) 174 174 return std::nullopt; 175 175 if (*isEngaged) { 176 Optional<T> value;176 std::optional<T> value; 177 177 decoder >> value; 178 178 if (!value) 179 179 return std::nullopt; 180 return Optional<Optional<T>>(WTFMove(*value));181 } 182 return Optional<Optional<T>>(Optional<T>(std::nullopt));180 return std::optional<std::optional<T>>(WTFMove(*value)); 181 } 182 return std::optional<std::optional<T>>(std::optional<T>(std::nullopt)); 183 183 } 184 184 }; … … 215 215 } 216 216 217 static Optional<Box<T>> decode(Decoder& decoder)218 { 219 Optional<bool> isEngaged;217 static std::optional<Box<T>> decode(Decoder& decoder) 218 { 219 std::optional<bool> isEngaged; 220 220 decoder >> isEngaged; 221 221 if (!isEngaged) 222 222 return std::nullopt; 223 223 if (*isEngaged) { 224 Optional<T> value;224 std::optional<T> value; 225 225 decoder >> value; 226 226 if (!value) 227 227 return std::nullopt; 228 return Optional<Box<T>>(Box<T>::create(WTFMove(*value)));229 } 230 return Optional<Box<T>>(Box<T>(nullptr));228 return std::optional<Box<T>>(Box<T>::create(WTFMove(*value))); 229 } 230 return std::optional<Box<T>>(Box<T>(nullptr)); 231 231 } 232 232 }; … … 253 253 } 254 254 255 static Optional<std::pair<T, U>> decode(Decoder& decoder)256 { 257 Optional<T> first;255 static std::optional<std::pair<T, U>> decode(Decoder& decoder) 256 { 257 std::optional<T> first; 258 258 decoder >> first; 259 259 if (!first) 260 260 return std::nullopt; 261 261 262 Optional<U> second;262 std::optional<U> second; 263 263 decoder >> second; 264 264 if (!second) … … 301 301 template<typename Type, typename... Types> 302 302 struct TupleDecoderImpl { 303 static Optional<std::tuple<Type, Types...>> decode(Decoder& decoder)304 { 305 Optional<Type> optional;303 static std::optional<std::tuple<Type, Types...>> decode(Decoder& decoder) 304 { 305 std::optional<Type> optional; 306 306 decoder >> optional; 307 307 if (!optional) 308 308 return std::nullopt; 309 309 310 Optional<std::tuple<Types...>> subTuple = TupleDecoderImpl<Types...>::decode(decoder);310 std::optional<std::tuple<Types...>> subTuple = TupleDecoderImpl<Types...>::decode(decoder); 311 311 if (!subTuple) 312 312 return std::nullopt; … … 318 318 template<typename Type> 319 319 struct TupleDecoderImpl<Type> { 320 static Optional<std::tuple<Type>> decode(Decoder& decoder)321 { 322 Optional<Type> optional;320 static std::optional<std::tuple<Type>> decode(Decoder& decoder) 321 { 322 std::optional<Type> optional; 323 323 decoder >> optional; 324 324 if (!optional) … … 330 330 template<size_t size, typename... Elements> 331 331 struct TupleDecoder { 332 static Optional<std::tuple<Elements...>> decode(Decoder& decoder)332 static std::optional<std::tuple<Elements...>> decode(Decoder& decoder) 333 333 { 334 334 return TupleDecoderImpl<Elements...>::decode(decoder); … … 338 338 template<> 339 339 struct TupleDecoder<0> { 340 static Optional<std::tuple<>> decode(Decoder&)340 static std::optional<std::tuple<>> decode(Decoder&) 341 341 { 342 342 return std::make_tuple(); … … 351 351 } 352 352 353 static Optional<std::tuple<Elements...>> decode(Decoder& decoder)353 static std::optional<std::tuple<Elements...>> decode(Decoder& decoder) 354 354 { 355 355 return TupleDecoder<sizeof...(Elements), Elements...>::decode(decoder); … … 392 392 static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Vector<T, inlineCapacity, OverflowHandler, minCapacity>& vector) 393 393 { 394 Optional<Vector<T, inlineCapacity, OverflowHandler, minCapacity>> optional;394 std::optional<Vector<T, inlineCapacity, OverflowHandler, minCapacity>> optional; 395 395 decoder >> optional; 396 396 if (!optional) … … 400 400 } 401 401 402 static Optional<Vector<T, inlineCapacity, OverflowHandler, minCapacity>> decode(Decoder& decoder)402 static std::optional<Vector<T, inlineCapacity, OverflowHandler, minCapacity>> decode(Decoder& decoder) 403 403 { 404 404 uint64_t size; … … 408 408 Vector<T, inlineCapacity, OverflowHandler, minCapacity> vector; 409 409 for (size_t i = 0; i < size; ++i) { 410 Optional<T> element;410 std::optional<T> element; 411 411 decoder >> element; 412 412 if (!element) … … 454 454 } 455 455 456 static Optional<Vector<T, inlineCapacity, OverflowHandler, minCapacity>> decode(Decoder& decoder)456 static std::optional<Vector<T, inlineCapacity, OverflowHandler, minCapacity>> decode(Decoder& decoder) 457 457 { 458 458 uint64_t decodedSize; … … 493 493 } 494 494 495 static Optional<HashMapType> decode(Decoder& decoder)495 static std::optional<HashMapType> decode(Decoder& decoder) 496 496 { 497 497 uint32_t hashMapSize; … … 501 501 HashMapType hashMap; 502 502 for (uint32_t i = 0; i < hashMapSize; ++i) { 503 Optional<KeyArg> key;503 std::optional<KeyArg> key; 504 504 decoder >> key; 505 505 if (UNLIKELY(!key)) 506 506 return std::nullopt; 507 507 508 Optional<MappedArg> value;508 std::optional<MappedArg> value; 509 509 decoder >> value; 510 510 if (UNLIKELY(!value)) … … 525 525 static WARN_UNUSED_RETURN bool decode(Decoder& decoder, HashMapType& hashMap) 526 526 { 527 Optional<HashMapType> tempHashMap;527 std::optional<HashMapType> tempHashMap; 528 528 decoder >> tempHashMap; 529 529 if (!tempHashMap) … … 546 546 static WARN_UNUSED_RETURN bool decode(Decoder& decoder, HashSetType& hashSet) 547 547 { 548 Optional<HashSetType> tempHashSet;548 std::optional<HashSetType> tempHashSet; 549 549 decoder >> tempHashSet; 550 550 if (!tempHashSet) … … 555 555 } 556 556 557 static Optional<HashSetType> decode(Decoder& decoder)557 static std::optional<HashSetType> decode(Decoder& decoder) 558 558 { 559 559 uint64_t hashSetSize; … … 563 563 HashSetType hashSet; 564 564 for (uint64_t i = 0; i < hashSetSize; ++i) { 565 Optional<KeyArg> key;565 std::optional<KeyArg> key; 566 566 decoder >> key; 567 567 if (!key) … … 636 636 } 637 637 638 static Optional<Expected<ValueType, ErrorType>> decode(Decoder& decoder)639 { 640 Optional<bool> hasValue;638 static std::optional<Expected<ValueType, ErrorType>> decode(Decoder& decoder) 639 { 640 std::optional<bool> hasValue; 641 641 decoder >> hasValue; 642 642 if (!hasValue) … … 644 644 645 645 if (*hasValue) { 646 Optional<ValueType> value;646 std::optional<ValueType> value; 647 647 decoder >> value; 648 648 if (!value) … … 652 652 return expected; 653 653 } 654 Optional<ErrorType> error;654 std::optional<ErrorType> error; 655 655 decoder >> error; 656 656 if (!error) … … 671 671 } 672 672 673 static Optional<WTF::Variant<Types...>> decode(Decoder& decoder, unsigned i)673 static std::optional<WTF::Variant<Types...>> decode(Decoder& decoder, unsigned i) 674 674 { 675 675 if (i == index) { 676 Optional<typename WTF::variant_alternative<index, WTF::Variant<Types...>>::type> optional;676 std::optional<typename WTF::variant_alternative<index, WTF::Variant<Types...>>::type> optional; 677 677 decoder >> optional; 678 678 if (!optional) … … 692 692 } 693 693 694 static Optional<WTF::Variant<Types...>> decode(Decoder& decoder, unsigned i)694 static std::optional<WTF::Variant<Types...>> decode(Decoder& decoder, unsigned i) 695 695 { 696 696 ASSERT_UNUSED(i, !i); 697 Optional<typename WTF::variant_alternative<0, WTF::Variant<Types...>>::type> optional;697 std::optional<typename WTF::variant_alternative<0, WTF::Variant<Types...>>::type> optional; 698 698 decoder >> optional; 699 699 if (!optional) … … 711 711 } 712 712 713 static Optional<WTF::Variant<Types...>> decode(Decoder& decoder)714 { 715 Optional<unsigned> i;713 static std::optional<WTF::Variant<Types...>> decode(Decoder& decoder) 714 { 715 std::optional<unsigned> i; 716 716 decoder >> i; 717 717 if (!i) … … 724 724 static void encode(Encoder&, const WallTime&); 725 725 static WARN_UNUSED_RETURN bool decode(Decoder&, WallTime&); 726 static Optional<WallTime> decode(Decoder&);726 static std::optional<WallTime> decode(Decoder&); 727 727 }; 728 728 … … 741 741 static void encode(Encoder&, const String&); 742 742 static WARN_UNUSED_RETURN bool decode(Decoder&, String&); 743 static Optional<String> decode(Decoder&);743 static std::optional<String> decode(Decoder&); 744 744 }; 745 745 … … 758 758 template<> struct ArgumentCoder<Monostate> { 759 759 static void encode(Encoder&, const Monostate&); 760 static Optional<Monostate> decode(Decoder&);760 static std::optional<Monostate> decode(Decoder&); 761 761 }; 762 762 -
trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm
r278190 r278244 71 71 72 72 namespace IPC { 73 using namespace WebCore;74 73 75 74 void ArgumentCoder<WebCore::AttributedString>::encode(Encoder& encoder, const WebCore::AttributedString& attributedString) … … 78 77 } 79 78 80 Optional<WebCore::AttributedString> ArgumentCoder<WebCore::AttributedString>::decode(Decoder& decoder)79 std::optional<WebCore::AttributedString> ArgumentCoder<WebCore::AttributedString>::decode(Decoder& decoder) 81 80 { 82 81 RetainPtr<NSAttributedString> attributedString; … … 98 97 } 99 98 100 Optional<WebCore::PaymentInstallmentConfiguration> ArgumentCoder<WebCore::PaymentInstallmentConfiguration>::decode(Decoder& decoder)99 std::optional<WebCore::PaymentInstallmentConfiguration> ArgumentCoder<WebCore::PaymentInstallmentConfiguration>::decode(Decoder& decoder) 101 100 { 102 101 auto configuration = IPC::decode<PKPaymentInstallmentConfiguration>(decoder, PAL::getPKPaymentInstallmentConfigurationClass()); … … 114 113 } 115 114 116 Optional<WebCore::Payment> ArgumentCoder<WebCore::Payment>::decode(Decoder& decoder)115 std::optional<WebCore::Payment> ArgumentCoder<WebCore::Payment>::decode(Decoder& decoder) 117 116 { 118 117 auto payment = IPC::decode<PKPayment>(decoder, PAL::getPKPaymentClass()); … … 120 119 return std::nullopt; 121 120 122 return Payment { WTFMove(*payment) };121 return WebCore::Payment { WTFMove(*payment) }; 123 122 } 124 123 … … 129 128 } 130 129 131 Optional<WebCore::PaymentAuthorizationResult> ArgumentCoder<WebCore::PaymentAuthorizationResult>::decode(Decoder& decoder)132 { 133 Optional<PaymentAuthorizationStatus> status;130 std::optional<WebCore::PaymentAuthorizationResult> ArgumentCoder<WebCore::PaymentAuthorizationResult>::decode(Decoder& decoder) 131 { 132 std::optional<WebCore::PaymentAuthorizationStatus> status; 134 133 decoder >> status; 135 134 if (!status) 136 135 return std::nullopt; 137 136 138 Optional<Vector<RefPtr<ApplePayError>>> errors;137 std::optional<Vector<RefPtr<WebCore::ApplePayError>>> errors; 139 138 decoder >> errors; 140 139 if (!errors) … … 149 148 } 150 149 151 Optional<WebCore::PaymentContact> ArgumentCoder<WebCore::PaymentContact>::decode(Decoder& decoder)150 std::optional<WebCore::PaymentContact> ArgumentCoder<WebCore::PaymentContact>::decode(Decoder& decoder) 152 151 { 153 152 auto contact = IPC::decode<PKContact>(decoder, PAL::getPKContactClass()); … … 163 162 } 164 163 165 Optional<WebCore::PaymentMerchantSession> ArgumentCoder<WebCore::PaymentMerchantSession>::decode(Decoder& decoder)164 std::optional<WebCore::PaymentMerchantSession> ArgumentCoder<WebCore::PaymentMerchantSession>::decode(Decoder& decoder) 166 165 { 167 166 auto paymentMerchantSession = IPC::decode<PKPaymentMerchantSession>(decoder, PAL::getPKPaymentMerchantSessionClass()); … … 177 176 } 178 177 179 Optional<WebCore::PaymentMethod> ArgumentCoder<WebCore::PaymentMethod>::decode(Decoder& decoder)178 std::optional<WebCore::PaymentMethod> ArgumentCoder<WebCore::PaymentMethod>::decode(Decoder& decoder) 180 179 { 181 180 auto paymentMethod = IPC::decode<PKPaymentMethod>(decoder, PAL::getPKPaymentMethodClass()); … … 183 182 return std::nullopt; 184 183 185 return PaymentMethod { WTFMove(*paymentMethod) };186 } 187 188 void ArgumentCoder< ApplePaySessionPaymentRequest>::encode(Encoder& encoder, constApplePaySessionPaymentRequest& request)184 return WebCore::PaymentMethod { WTFMove(*paymentMethod) }; 185 } 186 187 void ArgumentCoder<WebCore::ApplePaySessionPaymentRequest>::encode(Encoder& encoder, const WebCore::ApplePaySessionPaymentRequest& request) 189 188 { 190 189 encoder << request.countryCode(); … … 211 210 } 212 211 213 bool ArgumentCoder< ApplePaySessionPaymentRequest>::decode(Decoder& decoder,ApplePaySessionPaymentRequest& request)212 bool ArgumentCoder<WebCore::ApplePaySessionPaymentRequest>::decode(Decoder& decoder, WebCore::ApplePaySessionPaymentRequest& request) 214 213 { 215 214 String countryCode; … … 223 222 request.setCurrencyCode(currencyCode); 224 223 225 ApplePaySessionPaymentRequest::ContactFields requiredBillingContactFields;224 WebCore::ApplePaySessionPaymentRequest::ContactFields requiredBillingContactFields; 226 225 if (!decoder.decode((requiredBillingContactFields))) 227 226 return false; 228 227 request.setRequiredBillingContactFields(requiredBillingContactFields); 229 228 230 Optional<PaymentContact> billingContact;229 std::optional<WebCore::PaymentContact> billingContact; 231 230 decoder >> billingContact; 232 231 if (!billingContact) … … 234 233 request.setBillingContact(*billingContact); 235 234 236 ApplePaySessionPaymentRequest::ContactFields requiredShippingContactFields;235 WebCore::ApplePaySessionPaymentRequest::ContactFields requiredShippingContactFields; 237 236 if (!decoder.decode((requiredShippingContactFields))) 238 237 return false; 239 238 request.setRequiredShippingContactFields(requiredShippingContactFields); 240 239 241 Optional<PaymentContact> shippingContact;240 std::optional<WebCore::PaymentContact> shippingContact; 242 241 decoder >> shippingContact; 243 242 if (!shippingContact) … … 245 244 request.setShippingContact(*shippingContact); 246 245 247 ApplePaySessionPaymentRequest::MerchantCapabilities merchantCapabilities;246 WebCore::ApplePaySessionPaymentRequest::MerchantCapabilities merchantCapabilities; 248 247 if (!decoder.decode(merchantCapabilities)) 249 248 return false; … … 255 254 request.setSupportedNetworks(supportedNetworks); 256 255 257 ApplePaySessionPaymentRequest::ShippingType shippingType;256 WebCore::ApplePaySessionPaymentRequest::ShippingType shippingType; 258 257 if (!decoder.decode(shippingType)) 259 258 return false; 260 259 request.setShippingType(shippingType); 261 260 262 Vector< ApplePayShippingMethod> shippingMethods;261 Vector<WebCore::ApplePayShippingMethod> shippingMethods; 263 262 if (!decoder.decode(shippingMethods)) 264 263 return false; 265 264 request.setShippingMethods(shippingMethods); 266 265 267 Vector< ApplePayLineItem> lineItems;266 Vector<WebCore::ApplePayLineItem> lineItems; 268 267 if (!decoder.decode(lineItems)) 269 268 return false; 270 269 request.setLineItems(lineItems); 271 270 272 Optional<ApplePayLineItem> total;271 std::optional<WebCore::ApplePayLineItem> total; 273 272 decoder >> total; 274 273 if (!total) … … 286 285 request.setSupportedCountries(WTFMove(supportedCountries)); 287 286 288 ApplePaySessionPaymentRequest::Requester requester;287 WebCore::ApplePaySessionPaymentRequest::Requester requester; 289 288 if (!decoder.decode(requester)) 290 289 return false; … … 292 291 293 292 #if ENABLE(APPLE_PAY_INSTALLMENTS) 294 Optional<WebCore::PaymentInstallmentConfiguration> installmentConfiguration;293 std::optional<WebCore::PaymentInstallmentConfiguration> installmentConfiguration; 295 294 decoder >> installmentConfiguration; 296 295 if (!installmentConfiguration) … … 307 306 } 308 307 309 void ArgumentCoder< ApplePaySessionPaymentRequest::ContactFields>::encode(Encoder& encoder, constApplePaySessionPaymentRequest::ContactFields& contactFields)308 void ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::ContactFields>::encode(Encoder& encoder, const WebCore::ApplePaySessionPaymentRequest::ContactFields& contactFields) 310 309 { 311 310 encoder << contactFields.postalAddress; … … 316 315 } 317 316 318 bool ArgumentCoder< ApplePaySessionPaymentRequest::ContactFields>::decode(Decoder& decoder,ApplePaySessionPaymentRequest::ContactFields& contactFields)317 bool ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::ContactFields>::decode(Decoder& decoder, WebCore::ApplePaySessionPaymentRequest::ContactFields& contactFields) 319 318 { 320 319 if (!decoder.decode(contactFields.postalAddress)) … … 332 331 } 333 332 334 void ArgumentCoder< ApplePaySessionPaymentRequest::MerchantCapabilities>::encode(Encoder& encoder, constApplePaySessionPaymentRequest::MerchantCapabilities& merchantCapabilities)333 void ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::MerchantCapabilities>::encode(Encoder& encoder, const WebCore::ApplePaySessionPaymentRequest::MerchantCapabilities& merchantCapabilities) 335 334 { 336 335 encoder << merchantCapabilities.supports3DS; … … 340 339 } 341 340 342 bool ArgumentCoder< ApplePaySessionPaymentRequest::MerchantCapabilities>::decode(Decoder& decoder,ApplePaySessionPaymentRequest::MerchantCapabilities& merchantCapabilities)341 bool ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::MerchantCapabilities>::decode(Decoder& decoder, WebCore::ApplePaySessionPaymentRequest::MerchantCapabilities& merchantCapabilities) 343 342 { 344 343 if (!decoder.decode(merchantCapabilities.supports3DS)) … … 354 353 } 355 354 356 void ArgumentCoder<RefPtr< ApplePayError>>::encode(Encoder& encoder, const RefPtr<ApplePayError>& error)355 void ArgumentCoder<RefPtr<WebCore::ApplePayError>>::encode(Encoder& encoder, const RefPtr<WebCore::ApplePayError>& error) 357 356 { 358 357 encoder << !!error; … … 361 360 } 362 361 363 Optional<RefPtr<ApplePayError>> ArgumentCoder<RefPtr<ApplePayError>>::decode(Decoder& decoder)364 { 365 Optional<bool> isValid;362 std::optional<RefPtr<WebCore::ApplePayError>> ArgumentCoder<RefPtr<WebCore::ApplePayError>>::decode(Decoder& decoder) 363 { 364 std::optional<bool> isValid; 366 365 decoder >> isValid; 367 366 if (!isValid) 368 367 return std::nullopt; 369 368 370 RefPtr< ApplePayError> error;369 RefPtr<WebCore::ApplePayError> error; 371 370 if (!*isValid) 372 371 return { nullptr }; 373 372 374 error = ApplePayError::decode(decoder);373 error = WebCore::ApplePayError::decode(decoder); 375 374 if (!error) 376 375 return std::nullopt; … … 383 382 } 384 383 385 Optional<WebCore::PaymentSessionError> ArgumentCoder<WebCore::PaymentSessionError>::decode(Decoder& decoder)384 std::optional<WebCore::PaymentSessionError> ArgumentCoder<WebCore::PaymentSessionError>::decode(Decoder& decoder) 386 385 { 387 386 auto platformError = IPC::decode<NSError>(decoder); … … 413 412 } 414 413 415 Optional<FontAttributes> ArgumentCoder<WebCore::FontAttributes>::decodePlatformData(Decoder& decoder, WebCore::FontAttributes& attributes)414 std::optional<WebCore::FontAttributes> ArgumentCoder<WebCore::FontAttributes>::decodePlatformData(Decoder& decoder, WebCore::FontAttributes& attributes) 416 415 { 417 416 if (!IPC::decode(decoder, attributes.font)) … … 420 419 } 421 420 422 void ArgumentCoder<Ref< Font>>::encodePlatformData(Encoder& encoder, const Ref<WebCore::Font>& font)421 void ArgumentCoder<Ref<WebCore::Font>>::encodePlatformData(Encoder& encoder, const Ref<WebCore::Font>& font) 423 422 { 424 423 const auto& platformData = font->platformData(); … … 469 468 } 470 469 471 Optional<FontPlatformData> ArgumentCoder<Ref<Font>>::decodePlatformData(Decoder& decoder)472 { 473 Optional<FontOrientation> orientation;470 std::optional<WebCore::FontPlatformData> ArgumentCoder<Ref<WebCore::Font>>::decodePlatformData(Decoder& decoder) 471 { 472 std::optional<WebCore::FontOrientation> orientation; 474 473 decoder >> orientation; 475 if (!orientation .hasValue())476 return std::nullopt; 477 478 Optional<FontWidthVariant> widthVariant;474 if (!orientation) 475 return std::nullopt; 476 477 std::optional<WebCore::FontWidthVariant> widthVariant; 479 478 decoder >> widthVariant; 480 if (!widthVariant .hasValue())481 return std::nullopt; 482 483 Optional<TextRenderingMode> textRenderingMode;479 if (!widthVariant) 480 return std::nullopt; 481 482 std::optional<WebCore::TextRenderingMode> textRenderingMode; 484 483 decoder >> textRenderingMode; 485 if (!textRenderingMode .hasValue())486 return std::nullopt; 487 488 Optional<float> size;484 if (!textRenderingMode) 485 return std::nullopt; 486 487 std::optional<float> size; 489 488 decoder >> size; 490 if (!size .hasValue())491 return std::nullopt; 492 493 Optional<bool> syntheticBold;489 if (!size) 490 return std::nullopt; 491 492 std::optional<bool> syntheticBold; 494 493 decoder >> syntheticBold; 495 if (!syntheticBold .hasValue())496 return std::nullopt; 497 498 Optional<bool> syntheticOblique;494 if (!syntheticBold) 495 return std::nullopt; 496 497 std::optional<bool> syntheticOblique; 499 498 decoder >> syntheticOblique; 500 if (!syntheticOblique .hasValue())501 return std::nullopt; 502 503 Optional<RetainPtr<CFDictionaryRef>> attributes;499 if (!syntheticOblique) 500 return std::nullopt; 501 502 std::optional<RetainPtr<CFDictionaryRef>> attributes; 504 503 decoder >> attributes; 505 504 if (!attributes) 506 505 return std::nullopt; 507 506 508 Optional<bool> includesCreationData;507 std::optional<bool> includesCreationData; 509 508 decoder >> includesCreationData; 510 if (!includesCreationData .hasValue())511 return std::nullopt; 512 513 if ( includesCreationData.value()) {514 Optional<Ref<SharedBuffer>> fontFaceData;509 if (!includesCreationData) 510 return std::nullopt; 511 512 if (*includesCreationData) { 513 std::optional<Ref<WebCore::SharedBuffer>> fontFaceData; 515 514 decoder >> fontFaceData; 516 if (!fontFaceData .hasValue())515 if (!fontFaceData) 517 516 return std::nullopt; 518 517 519 Optional<String> itemInCollection;518 std::optional<String> itemInCollection; 520 519 decoder >> itemInCollection; 521 if (!itemInCollection .hasValue())520 if (!itemInCollection) 522 521 return std::nullopt; 523 522 524 auto fontCustomPlatformData = createFontCustomPlatformData( fontFaceData.value(), itemInCollection.value());523 auto fontCustomPlatformData = createFontCustomPlatformData(*fontFaceData, *itemInCollection); 525 524 if (!fontCustomPlatformData) 526 525 return std::nullopt; … … 529 528 return std::nullopt; 530 529 auto fontDescriptor = adoptCF(CTFontDescriptorCreateCopyWithAttributes(baseFontDescriptor, attributes->get())); 531 auto ctFont = adoptCF(CTFontCreateWithFontDescriptor(fontDescriptor.get(), size.value(), nullptr));532 533 auto creationData = FontPlatformData::CreationData { fontFaceData.value(), itemInCollection.value()};534 return FontPlatformData(ctFont.get(), size.value(), syntheticBold.value(), syntheticOblique.value(), orientation.value(), widthVariant.value(), textRenderingMode.value(), &creationData);530 auto ctFont = adoptCF(CTFontCreateWithFontDescriptor(fontDescriptor.get(), *size, nullptr)); 531 532 auto creationData = WebCore::FontPlatformData::CreationData { *fontFaceData, *itemInCollection }; 533 return WebCore::FontPlatformData(ctFont.get(), *size, *syntheticBold, *syntheticOblique, *orientation, *widthVariant, *textRenderingMode, &creationData); 535 534 } 536 535 537 Optional<String> referenceURL;536 std::optional<String> referenceURL; 538 537 decoder >> referenceURL; 539 if (!referenceURL .hasValue())540 return std::nullopt; 541 542 Optional<String> postScriptName;538 if (!referenceURL) 539 return std::nullopt; 540 541 std::optional<String> postScriptName; 543 542 decoder >> postScriptName; 544 if (!postScriptName .hasValue())545 return std::nullopt; 546 547 RetainPtr<CTFontDescriptorRef> fontDescriptor = findFontDescriptor(referenceURL.value(), postScriptName.value());543 if (!postScriptName) 544 return std::nullopt; 545 546 auto fontDescriptor = findFontDescriptor(*referenceURL, *postScriptName); 548 547 if (!fontDescriptor) 549 548 return std::nullopt; 550 549 fontDescriptor = adoptCF(CTFontDescriptorCreateCopyWithAttributes(fontDescriptor.get(), attributes->get())); 551 auto ctFont = adoptCF(CTFontCreateWithFontDescriptor(fontDescriptor.get(), size.value(), nullptr));552 553 return FontPlatformData(ctFont.get(), size.value(), syntheticBold.value(), syntheticOblique.value(), orientation.value(), widthVariant.value(), textRenderingMode.value());550 auto ctFont = adoptCF(CTFontCreateWithFontDescriptor(fontDescriptor.get(), *size, nullptr)); 551 552 return WebCore::FontPlatformData(ctFont.get(), *size, *syntheticBold, *syntheticOblique, *orientation, *widthVariant, *textRenderingMode); 554 553 } 555 554 … … 618 617 #if ENABLE(DATA_DETECTION) 619 618 620 void ArgumentCoder< DataDetectorElementInfo>::encode(Encoder& encoder, constDataDetectorElementInfo& info)619 void ArgumentCoder<WebCore::DataDetectorElementInfo>::encode(Encoder& encoder, const WebCore::DataDetectorElementInfo& info) 621 620 { 622 621 encoder << info.result.get(); … … 624 623 } 625 624 626 Optional<DataDetectorElementInfo> ArgumentCoder<DataDetectorElementInfo>::decode(Decoder& decoder)625 std::optional<WebCore::DataDetectorElementInfo> ArgumentCoder<WebCore::DataDetectorElementInfo>::decode(Decoder& decoder) 627 626 { 628 627 auto result = IPC::decode<DDScannerResult>(decoder, PAL::getDDScannerResultClass()); … … 630 629 return std::nullopt; 631 630 632 Optional<IntRect> elementBounds;631 std::optional<WebCore::IntRect> elementBounds; 633 632 decoder >> elementBounds; 634 633 if (!elementBounds) 635 634 return std::nullopt; 636 635 637 return std::make_optional< DataDetectorElementInfo>({ WTFMove(*result), WTFMove(*elementBounds) });636 return std::make_optional<WebCore::DataDetectorElementInfo>({ WTFMove(*result), WTFMove(*elementBounds) }); 638 637 } 639 638 … … 641 640 642 641 #if ENABLE(WIRELESS_PLAYBACK_TARGET) 643 void ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData(Encoder& encoder, const MediaPlaybackTargetContext& target)644 { 645 if (target.type() == MediaPlaybackTargetContext::Type::AVOutputContext) {642 void ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData(Encoder& encoder, const WebCore::MediaPlaybackTargetContext& target) 643 { 644 if (target.type() == WebCore::MediaPlaybackTargetContext::Type::AVOutputContext) { 646 645 if ([PAL::getAVOutputContextClass() conformsToProtocol:@protocol(NSSecureCoding)]) 647 646 encoder << target.outputContext(); 648 } else if (target.type() == MediaPlaybackTargetContext::Type::SerializedAVOutputContext) {647 } else if (target.type() == WebCore::MediaPlaybackTargetContext::Type::SerializedAVOutputContext) { 649 648 encoder << target.serializedOutputContext(); 650 649 encoder << target.hasActiveRoute(); … … 653 652 } 654 653 655 bool ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData(Decoder& decoder, MediaPlaybackTargetContext::Type contextType,MediaPlaybackTargetContext& target)656 { 657 ASSERT(contextType != MediaPlaybackTargetContext::Type::Mock);658 659 if (contextType == MediaPlaybackTargetContext::Type::AVOutputContext) {654 bool ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData(Decoder& decoder, WebCore::MediaPlaybackTargetContext::Type contextType, WebCore::MediaPlaybackTargetContext& target) 655 { 656 ASSERT(contextType != WebCore::MediaPlaybackTargetContext::Type::Mock); 657 658 if (contextType == WebCore::MediaPlaybackTargetContext::Type::AVOutputContext) { 660 659 if (![PAL::getAVOutputContextClass() conformsToProtocol:@protocol(NSSecureCoding)]) 661 660 return false; … … 669 668 } 670 669 671 if (contextType == MediaPlaybackTargetContext::Type::SerializedAVOutputContext) {670 if (contextType == WebCore::MediaPlaybackTargetContext::Type::SerializedAVOutputContext) { 672 671 RetainPtr<NSData> serializedOutputContext; 673 672 if (!IPC::decode(decoder, serializedOutputContext) || !serializedOutputContext) … … 688 687 #if ENABLE(IMAGE_EXTRACTION) && ENABLE(DATA_DETECTION) 689 688 690 void ArgumentCoder< ImageExtractionDataDetectorInfo>::encodePlatformData(Encoder& encoder, constImageExtractionDataDetectorInfo& info)689 void ArgumentCoder<WebCore::ImageExtractionDataDetectorInfo>::encodePlatformData(Encoder& encoder, const WebCore::ImageExtractionDataDetectorInfo& info) 691 690 { 692 691 encoder << info.result.get(); 693 692 } 694 693 695 bool ArgumentCoder< ImageExtractionDataDetectorInfo>::decodePlatformData(Decoder& decoder,ImageExtractionDataDetectorInfo& result)694 bool ArgumentCoder<WebCore::ImageExtractionDataDetectorInfo>::decodePlatformData(Decoder& decoder, WebCore::ImageExtractionDataDetectorInfo& result) 696 695 { 697 696 auto scannerResult = IPC::decode<DDScannerResult>(decoder, @[ PAL::getDDScannerResultClass() ]); -
trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm
r278185 r278244 86 86 auto version = parseInteger<uint32_t>(xpc_dictionary_get_string(m_initializerMessage, "client-sdk-version")); 87 87 clientSDKVersion = version.value_or(0); 88 return version.has Value();88 return version.has_value(); 89 89 } 90 90 -
trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp
r278185 r278244 1067 1067 Optional<bool> didCreateGraphicsContext; 1068 1068 decoder >> didCreateGraphicsContext; 1069 if (!didCreateGraphicsContext .hasValue() || !didCreateGraphicsContext.value())1069 if (!didCreateGraphicsContext || !*didCreateGraphicsContext) 1070 1070 return false; 1071 1071 … … 1122 1122 Optional<Font::Origin> origin; 1123 1123 decoder >> origin; 1124 if (!origin .hasValue())1124 if (!origin) 1125 1125 return std::nullopt; 1126 1126 1127 1127 Optional<Font::Interstitial> isInterstitial; 1128 1128 decoder >> isInterstitial; 1129 if (!isInterstitial .hasValue())1129 if (!isInterstitial) 1130 1130 return std::nullopt; 1131 1131 1132 1132 Optional<Font::Visibility> visibility; 1133 1133 decoder >> visibility; 1134 if (!visibility .hasValue())1134 if (!visibility) 1135 1135 return std::nullopt; 1136 1136 1137 1137 Optional<Font::OrientationFallback> isTextOrientationFallback; 1138 1138 decoder >> isTextOrientationFallback; 1139 if (!isTextOrientationFallback .hasValue())1139 if (!isTextOrientationFallback) 1140 1140 return std::nullopt; 1141 1141 1142 1142 Optional<RenderingResourceIdentifier> renderingRersouceIdentifier; 1143 1143 decoder >> renderingRersouceIdentifier; 1144 if (!renderingRersouceIdentifier .hasValue())1144 if (!renderingRersouceIdentifier) 1145 1145 return std::nullopt; 1146 1146 1147 1147 auto platformData = decodePlatformData(decoder); 1148 if (!platformData .hasValue())1148 if (!platformData) 1149 1149 return std::nullopt; 1150 1150 -
trunk/Source/WebKit/Shared/mac/MediaFormatReader/MediaFormatReader.cpp
r278223 r278244 209 209 210 210 Locker locker { m_parseTracksLock }; 211 ASSERT(m_parseTracksStatus.has Value());211 ASSERT(m_parseTracksStatus.has_value()); 212 212 213 213 for (auto& trackReader : m_trackReaders) … … 240 240 m_parseTracksCondition.wait(m_parseTracksLock, [&] { 241 241 assertIsHeld(m_parseTracksLock); 242 return m_parseTracksStatus.has Value();242 return m_parseTracksStatus.has_value(); 243 243 }); 244 244 … … 260 260 m_parseTracksCondition.wait(m_parseTracksLock, [&] { 261 261 assertIsHeld(m_parseTracksLock); 262 return m_parseTracksStatus.has Value();262 return m_parseTracksStatus.has_value(); 263 263 }); 264 264 -
trunk/Source/WebKit/Shared/win/WebCoreArgumentCodersWin.cpp
r278185 r278244 43 43 } 44 44 45 Optional<FontAttributes> ArgumentCoder<FontAttributes>::decodePlatformData(Decoder&, FontAttributes&)45 std::optional<FontAttributes> ArgumentCoder<FontAttributes>::decodePlatformData(Decoder&, FontAttributes&) 46 46 { 47 47 ASSERT_NOT_REACHED(); … … 54 54 encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(&logFont), sizeof logFont, 1); 55 55 } 56 static Optional<LOGFONT> decode(Decoder& decoder)56 static std::optional<LOGFONT> decode(Decoder& decoder) 57 57 { 58 58 LOGFONT logFont; … … 82 82 } 83 83 84 Optional<FontPlatformData> ArgumentCoder<Ref<Font>>::decodePlatformData(Decoder& decoder)84 std::optional<FontPlatformData> ArgumentCoder<Ref<Font>>::decodePlatformData(Decoder& decoder) 85 85 { 86 Optional<float> size;86 std::optional<float> size; 87 87 decoder >> size; 88 if (!size .hasValue())88 if (!size) 89 89 return std::nullopt; 90 90 91 Optional<bool> syntheticBold;91 std::optional<bool> syntheticBold; 92 92 decoder >> syntheticBold; 93 if (!syntheticBold .hasValue())93 if (!syntheticBold) 94 94 return std::nullopt; 95 95 96 Optional<bool> syntheticOblique;96 std::optional<bool> syntheticOblique; 97 97 decoder >> syntheticOblique; 98 if (!syntheticOblique .hasValue())98 if (!syntheticOblique) 99 99 return std::nullopt; 100 100 101 Optional<bool> includesCreationData;101 std::optional<bool> includesCreationData; 102 102 decoder >> includesCreationData; 103 if (!includesCreationData .hasValue())103 if (!includesCreationData) 104 104 return std::nullopt; 105 105 … … 108 108 109 109 if (includesCreationData.value()) { 110 Optional<Ref<SharedBuffer>> fontFaceData;110 std::optional<Ref<SharedBuffer>> fontFaceData; 111 111 decoder >> fontFaceData; 112 if (!fontFaceData .hasValue())112 if (!fontFaceData) 113 113 return std::nullopt; 114 114 115 Optional<String> itemInCollection;115 std::optional<String> itemInCollection; 116 116 decoder >> itemInCollection; 117 if (!itemInCollection .hasValue())117 if (!itemInCollection) 118 118 return std::nullopt; 119 119 … … 124 124 } 125 125 126 Optional<LOGFONT> logFont;126 std::optional<LOGFONT> logFont; 127 127 decoder >> logFont; 128 if (!logFont .hasValue())128 if (!logFont) 129 129 return std::nullopt; 130 130 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm
r278185 r278244 303 303 [coder encodeBool:self.suppressesIncrementalRendering forKey:@"suppressesIncrementalRendering"]; 304 304 305 if (_applicationNameForUserAgent .hasValue())305 if (_applicationNameForUserAgent) 306 306 [coder encodeObject:self.applicationNameForUserAgent forKey:@"applicationNameForUserAgent"]; 307 307 -
trunk/Source/WebKit/UIProcess/API/glib/InputMethodFilter.cpp
r260752 r278244 84 84 } 85 85 86 void InputMethodFilter::setState( Optional<InputMethodState>&& state)87 { 88 bool focusChanged = state.has Value() != m_state.hasValue();86 void InputMethodFilter::setState(std::optional<InputMethodState>&& state) 87 { 88 bool focusChanged = state.has_value() != m_state.has_value(); 89 89 if (focusChanged && !state) 90 90 notifyFocusedOut(); -
trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
r278185 r278244 63 63 { 64 64 String protocolErrorName = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(type); 65 if (!message .hasValue())65 if (!message) 66 66 return protocolErrorName; 67 68 return makeString(protocolErrorName, errorNameAndDetailsSeparator, message.value()); 67 return makeString(protocolErrorName, errorNameAndDetailsSeparator, *message); 69 68 } 70 69 -
trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm
r278185 r278244 96 96 } 97 97 98 Optional<WebPasteboardProxy::PasteboardAccessType> WebPasteboardProxy::accessType(IPC::Connection& connection, const String& pasteboardName) const98 std::optional<WebPasteboardProxy::PasteboardAccessType> WebPasteboardProxy::accessType(IPC::Connection& connection, const String& pasteboardName) const 99 99 { 100 100 MESSAGE_CHECK_WITH_RETURN_VALUE(!pasteboardName.isEmpty(), std::nullopt); … … 140 140 } 141 141 142 void WebPasteboardProxy::getPasteboardTypes(IPC::Connection& connection, const String& pasteboardName, Optional<PageIdentifier> pageID, CompletionHandler<void(Vector<String>&&)>&& completionHandler)142 void WebPasteboardProxy::getPasteboardTypes(IPC::Connection& connection, const String& pasteboardName, std::optional<PageIdentifier> pageID, CompletionHandler<void(Vector<String>&&)>&& completionHandler) 143 143 { 144 144 if (!canAccessPasteboardTypes(connection, pasteboardName)) … … 155 155 } 156 156 157 void WebPasteboardProxy::getPasteboardPathnamesForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, Optional<PageIdentifier> pageID,157 void WebPasteboardProxy::getPasteboardPathnamesForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, std::optional<PageIdentifier> pageID, 158 158 CompletionHandler<void(Vector<String>&& pathnames, SandboxExtension::HandleArray&& sandboxExtensions)>&& completionHandler) 159 159 { … … 187 187 } 188 188 189 void WebPasteboardProxy::getPasteboardStringForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, Optional<PageIdentifier> pageID, CompletionHandler<void(String&&)>&& completionHandler)189 void WebPasteboardProxy::getPasteboardStringForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, std::optional<PageIdentifier> pageID, CompletionHandler<void(String&&)>&& completionHandler) 190 190 { 191 191 MESSAGE_CHECK_COMPLETION(!pasteboardType.isEmpty(), completionHandler({ })); … … 202 202 } 203 203 204 void WebPasteboardProxy::getPasteboardStringsForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, Optional<PageIdentifier> pageID, CompletionHandler<void(Vector<String>&&)>&& completionHandler)204 void WebPasteboardProxy::getPasteboardStringsForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, std::optional<PageIdentifier> pageID, CompletionHandler<void(Vector<String>&&)>&& completionHandler) 205 205 { 206 206 MESSAGE_CHECK_COMPLETION(!pasteboardType.isEmpty(), completionHandler({ })); … … 217 217 } 218 218 219 void WebPasteboardProxy::getPasteboardBufferForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, Optional<PageIdentifier> pageID, CompletionHandler<void(SharedMemory::IPCHandle&&)>&& completionHandler)219 void WebPasteboardProxy::getPasteboardBufferForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, std::optional<PageIdentifier> pageID, CompletionHandler<void(SharedMemory::IPCHandle&&)>&& completionHandler) 220 220 { 221 221 MESSAGE_CHECK_COMPLETION(!pasteboardType.isEmpty(), completionHandler({ })); … … 245 245 } 246 246 247 void WebPasteboardProxy::getPasteboardChangeCount(IPC::Connection& connection, const String& pasteboardName, Optional<PageIdentifier> pageID, CompletionHandler<void(int64_t)>&& completionHandler)247 void WebPasteboardProxy::getPasteboardChangeCount(IPC::Connection& connection, const String& pasteboardName, std::optional<PageIdentifier> pageID, CompletionHandler<void(int64_t)>&& completionHandler) 248 248 { 249 249 MESSAGE_CHECK_COMPLETION(!pasteboardName.isEmpty(), completionHandler(0)); … … 257 257 } 258 258 259 void WebPasteboardProxy::getPasteboardColor(IPC::Connection& connection, const String& pasteboardName, Optional<PageIdentifier> pageID, CompletionHandler<void(WebCore::Color&&)>&& completionHandler)259 void WebPasteboardProxy::getPasteboardColor(IPC::Connection& connection, const String& pasteboardName, std::optional<PageIdentifier> pageID, CompletionHandler<void(WebCore::Color&&)>&& completionHandler) 260 260 { 261 261 if (!canAccessPasteboardData(connection, pasteboardName)) … … 270 270 } 271 271 272 void WebPasteboardProxy::getPasteboardURL(IPC::Connection& connection, const String& pasteboardName, Optional<PageIdentifier> pageID, CompletionHandler<void(const String&)>&& completionHandler)272 void WebPasteboardProxy::getPasteboardURL(IPC::Connection& connection, const String& pasteboardName, std::optional<PageIdentifier> pageID, CompletionHandler<void(const String&)>&& completionHandler) 273 273 { 274 274 if (!canAccessPasteboardData(connection, pasteboardName)) … … 283 283 } 284 284 285 void WebPasteboardProxy::addPasteboardTypes(IPC::Connection& connection, const String& pasteboardName, const Vector<String>& pasteboardTypes, Optional<PageIdentifier> pageID, CompletionHandler<void(int64_t)>&& completionHandler)285 void WebPasteboardProxy::addPasteboardTypes(IPC::Connection& connection, const String& pasteboardName, const Vector<String>& pasteboardTypes, std::optional<PageIdentifier> pageID, CompletionHandler<void(int64_t)>&& completionHandler) 286 286 { 287 287 MESSAGE_CHECK_COMPLETION(!pasteboardName.isEmpty(), completionHandler(0)); … … 301 301 } 302 302 303 void WebPasteboardProxy::setPasteboardTypes(IPC::Connection& connection, const String& pasteboardName, const Vector<String>& pasteboardTypes, Optional<PageIdentifier> pageID, CompletionHandler<void(int64_t)>&& completionHandler)303 void WebPasteboardProxy::setPasteboardTypes(IPC::Connection& connection, const String& pasteboardName, const Vector<String>& pasteboardTypes, std::optional<PageIdentifier> pageID, CompletionHandler<void(int64_t)>&& completionHandler) 304 304 { 305 305 MESSAGE_CHECK_COMPLETION(!pasteboardName.isEmpty(), completionHandler(0)); … … 319 319 } 320 320 321 void WebPasteboardProxy::setPasteboardURL(IPC::Connection& connection, const PasteboardURL& pasteboardURL, const String& pasteboardName, Optional<PageIdentifier> pageID, CompletionHandler<void(int64_t)>&& completionHandler)321 void WebPasteboardProxy::setPasteboardURL(IPC::Connection& connection, const PasteboardURL& pasteboardURL, const String& pasteboardName, std::optional<PageIdentifier> pageID, CompletionHandler<void(int64_t)>&& completionHandler) 322 322 { 323 323 MESSAGE_CHECK_COMPLETION(!pasteboardName.isEmpty(), completionHandler(0)); … … 343 343 } 344 344 345 void WebPasteboardProxy::setPasteboardColor(IPC::Connection& connection, const String& pasteboardName, const WebCore::Color& color, Optional<PageIdentifier> pageID, CompletionHandler<void(int64_t)>&& completionHandler)345 void WebPasteboardProxy::setPasteboardColor(IPC::Connection& connection, const String& pasteboardName, const WebCore::Color& color, std::optional<PageIdentifier> pageID, CompletionHandler<void(int64_t)>&& completionHandler) 346 346 { 347 347 MESSAGE_CHECK_COMPLETION(!pasteboardName.isEmpty(), completionHandler(0)); … … 358 358 } 359 359 360 void WebPasteboardProxy::setPasteboardStringForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, const String& string, Optional<PageIdentifier> pageID, CompletionHandler<void(int64_t)>&& completionHandler)360 void WebPasteboardProxy::setPasteboardStringForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, const String& string, std::optional<PageIdentifier> pageID, CompletionHandler<void(int64_t)>&& completionHandler) 361 361 { 362 362 MESSAGE_CHECK_COMPLETION(!pasteboardName.isEmpty(), completionHandler(0)); … … 374 374 } 375 375 376 void WebPasteboardProxy::containsURLStringSuitableForLoading(IPC::Connection& connection, const String& pasteboardName, Optional<PageIdentifier> pageID, CompletionHandler<void(bool)>&& completionHandler)376 void WebPasteboardProxy::containsURLStringSuitableForLoading(IPC::Connection& connection, const String& pasteboardName, std::optional<PageIdentifier> pageID, CompletionHandler<void(bool)>&& completionHandler) 377 377 { 378 378 if (!canAccessPasteboardTypes(connection, pasteboardName)) … … 387 387 } 388 388 389 void WebPasteboardProxy::urlStringSuitableForLoading(IPC::Connection& connection, const String& pasteboardName, Optional<PageIdentifier> pageID, CompletionHandler<void(String&& url, String&& title)>&& completionHandler)389 void WebPasteboardProxy::urlStringSuitableForLoading(IPC::Connection& connection, const String& pasteboardName, std::optional<PageIdentifier> pageID, CompletionHandler<void(String&& url, String&& title)>&& completionHandler) 390 390 { 391 391 if (!canAccessPasteboardData(connection, pasteboardName)) … … 402 402 } 403 403 404 void WebPasteboardProxy::setPasteboardBufferForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, const SharedMemory::IPCHandle& ipcHandle, Optional<PageIdentifier> pageID, CompletionHandler<void(int64_t)>&& completionHandler)404 void WebPasteboardProxy::setPasteboardBufferForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, const SharedMemory::IPCHandle& ipcHandle, std::optional<PageIdentifier> pageID, CompletionHandler<void(int64_t)>&& completionHandler) 405 405 { 406 406 MESSAGE_CHECK_COMPLETION(!pasteboardName.isEmpty(), completionHandler(0)); … … 428 428 } 429 429 430 void WebPasteboardProxy::getNumberOfFiles(IPC::Connection& connection, const String& pasteboardName, Optional<PageIdentifier> pageID, CompletionHandler<void(uint64_t)>&& completionHandler)430 void WebPasteboardProxy::getNumberOfFiles(IPC::Connection& connection, const String& pasteboardName, std::optional<PageIdentifier> pageID, CompletionHandler<void(uint64_t)>&& completionHandler) 431 431 { 432 432 if (!canAccessPasteboardTypes(connection, pasteboardName)) … … 441 441 } 442 442 443 void WebPasteboardProxy::typesSafeForDOMToReadAndWrite(IPC::Connection& connection, const String& pasteboardName, const String& origin, Optional<PageIdentifier> pageID, CompletionHandler<void(Vector<String>&&)>&& completionHandler)443 void WebPasteboardProxy::typesSafeForDOMToReadAndWrite(IPC::Connection& connection, const String& pasteboardName, const String& origin, std::optional<PageIdentifier> pageID, CompletionHandler<void(Vector<String>&&)>&& completionHandler) 444 444 { 445 445 MESSAGE_CHECK_COMPLETION(!origin.isNull(), completionHandler({ })); … … 456 456 } 457 457 458 void WebPasteboardProxy::writeCustomData(IPC::Connection& connection, const Vector<PasteboardCustomData>& data, const String& pasteboardName, Optional<PageIdentifier> pageID, CompletionHandler<void(int64_t)>&& completionHandler)458 void WebPasteboardProxy::writeCustomData(IPC::Connection& connection, const Vector<PasteboardCustomData>& data, const String& pasteboardName, std::optional<PageIdentifier> pageID, CompletionHandler<void(int64_t)>&& completionHandler) 459 459 { 460 460 MESSAGE_CHECK_COMPLETION(!pasteboardName.isEmpty(), completionHandler(0)); … … 471 471 } 472 472 473 void WebPasteboardProxy::allPasteboardItemInfo(IPC::Connection& connection, const String& pasteboardName, int64_t changeCount, Optional<PageIdentifier> pageID, CompletionHandler<void(Optional<Vector<PasteboardItemInfo>>&&)>&& completionHandler)473 void WebPasteboardProxy::allPasteboardItemInfo(IPC::Connection& connection, const String& pasteboardName, int64_t changeCount, std::optional<PageIdentifier> pageID, CompletionHandler<void(std::optional<Vector<PasteboardItemInfo>>&&)>&& completionHandler) 474 474 { 475 475 if (!canAccessPasteboardTypes(connection, pasteboardName)) … … 484 484 } 485 485 486 void WebPasteboardProxy::informationForItemAtIndex(IPC::Connection& connection, size_t index, const String& pasteboardName, int64_t changeCount, Optional<PageIdentifier> pageID, CompletionHandler<void(Optional<PasteboardItemInfo>&&)>&& completionHandler)486 void WebPasteboardProxy::informationForItemAtIndex(IPC::Connection& connection, size_t index, const String& pasteboardName, int64_t changeCount, std::optional<PageIdentifier> pageID, CompletionHandler<void(std::optional<PasteboardItemInfo>&&)>&& completionHandler) 487 487 { 488 488 if (!canAccessPasteboardTypes(connection, pasteboardName)) … … 497 497 } 498 498 499 void WebPasteboardProxy::getPasteboardItemsCount(IPC::Connection& connection, const String& pasteboardName, Optional<PageIdentifier> pageID, CompletionHandler<void(uint64_t)>&& completionHandler)499 void WebPasteboardProxy::getPasteboardItemsCount(IPC::Connection& connection, const String& pasteboardName, std::optional<PageIdentifier> pageID, CompletionHandler<void(uint64_t)>&& completionHandler) 500 500 { 501 501 if (!canAccessPasteboardTypes(connection, pasteboardName)) … … 510 510 } 511 511 512 void WebPasteboardProxy::readStringFromPasteboard(IPC::Connection& connection, size_t index, const String& pasteboardType, const String& pasteboardName, Optional<PageIdentifier> pageID, CompletionHandler<void(String&&)>&& completionHandler)512 void WebPasteboardProxy::readStringFromPasteboard(IPC::Connection& connection, size_t index, const String& pasteboardType, const String& pasteboardName, std::optional<PageIdentifier> pageID, CompletionHandler<void(String&&)>&& completionHandler) 513 513 { 514 514 MESSAGE_CHECK_COMPLETION(!pasteboardType.isEmpty(), completionHandler({ })); … … 525 525 } 526 526 527 void WebPasteboardProxy::readURLFromPasteboard(IPC::Connection& connection, size_t index, const String& pasteboardName, Optional<PageIdentifier> pageID, CompletionHandler<void(String&& url, String&& title)>&& completionHandler)527 void WebPasteboardProxy::readURLFromPasteboard(IPC::Connection& connection, size_t index, const String& pasteboardName, std::optional<PageIdentifier> pageID, CompletionHandler<void(String&& url, String&& title)>&& completionHandler) 528 528 { 529 529 if (!canAccessPasteboardData(connection, pasteboardName)) … … 540 540 } 541 541 542 void WebPasteboardProxy::readBufferFromPasteboard(IPC::Connection& connection, size_t index, const String& pasteboardType, const String& pasteboardName, Optional<PageIdentifier> pageID, CompletionHandler<void(SharedMemory::IPCHandle&&)>&& completionHandler)542 void WebPasteboardProxy::readBufferFromPasteboard(IPC::Connection& connection, size_t index, const String& pasteboardType, const String& pasteboardName, std::optional<PageIdentifier> pageID, CompletionHandler<void(SharedMemory::IPCHandle&&)>&& completionHandler) 543 543 { 544 544 MESSAGE_CHECK_COMPLETION(!pasteboardType.isEmpty(), completionHandler({ })); … … 568 568 } 569 569 570 void WebPasteboardProxy::containsStringSafeForDOMToReadForType(IPC::Connection& connection, const String& type, const String& pasteboardName, Optional<PageIdentifier> pageID, CompletionHandler<void(bool)>&& completionHandler)570 void WebPasteboardProxy::containsStringSafeForDOMToReadForType(IPC::Connection& connection, const String& type, const String& pasteboardName, std::optional<PageIdentifier> pageID, CompletionHandler<void(bool)>&& completionHandler) 571 571 { 572 572 if (!canAccessPasteboardTypes(connection, pasteboardName)) … … 583 583 #if PLATFORM(IOS_FAMILY) 584 584 585 void WebPasteboardProxy::writeURLToPasteboard(IPC::Connection& connection, const PasteboardURL& url, const String& pasteboardName, Optional<PageIdentifier> pageID)585 void WebPasteboardProxy::writeURLToPasteboard(IPC::Connection& connection, const PasteboardURL& url, const String& pasteboardName, std::optional<PageIdentifier> pageID) 586 586 { 587 587 MESSAGE_CHECK(!pasteboardName.isEmpty()); … … 599 599 } 600 600 601 void WebPasteboardProxy::writeWebContentToPasteboard(IPC::Connection& connection, const WebCore::PasteboardWebContent& content, const String& pasteboardName, Optional<PageIdentifier> pageID)601 void WebPasteboardProxy::writeWebContentToPasteboard(IPC::Connection& connection, const WebCore::PasteboardWebContent& content, const String& pasteboardName, std::optional<PageIdentifier> pageID) 602 602 { 603 603 MESSAGE_CHECK(!pasteboardName.isEmpty()); … … 615 615 } 616 616 617 void WebPasteboardProxy::writeImageToPasteboard(IPC::Connection& connection, const WebCore::PasteboardImage& pasteboardImage, const String& pasteboardName, Optional<PageIdentifier> pageID)617 void WebPasteboardProxy::writeImageToPasteboard(IPC::Connection& connection, const WebCore::PasteboardImage& pasteboardImage, const String& pasteboardName, std::optional<PageIdentifier> pageID) 618 618 { 619 619 MESSAGE_CHECK(!pasteboardName.isEmpty()); … … 631 631 } 632 632 633 void WebPasteboardProxy::writeStringToPasteboard(IPC::Connection& connection, const String& pasteboardType, const String& text, const String& pasteboardName, Optional<PageIdentifier> pageID)633 void WebPasteboardProxy::writeStringToPasteboard(IPC::Connection& connection, const String& pasteboardType, const String& text, const String& pasteboardName, std::optional<PageIdentifier> pageID) 634 634 { 635 635 MESSAGE_CHECK(!pasteboardName.isEmpty()); … … 648 648 } 649 649 650 void WebPasteboardProxy::updateSupportedTypeIdentifiers(const Vector<String>& identifiers, const String& pasteboardName, Optional<PageIdentifier>)650 void WebPasteboardProxy::updateSupportedTypeIdentifiers(const Vector<String>& identifiers, const String& pasteboardName, std::optional<PageIdentifier>) 651 651 { 652 652 PlatformPasteboard(pasteboardName).updateSupportedTypeIdentifiers(identifiers); … … 655 655 #endif // PLATFORM(IOS_FAMILY) 656 656 657 Optional<DataOwnerType> WebPasteboardProxy::determineDataOwner(IPC::Connection& connection, const String& pasteboardName, Optional<PageIdentifier> pageID, PasteboardAccessIntent intent) const657 std::optional<DataOwnerType> WebPasteboardProxy::determineDataOwner(IPC::Connection& connection, const String& pasteboardName, std::optional<PageIdentifier> pageID, PasteboardAccessIntent intent) const 658 658 { 659 659 MESSAGE_CHECK_WITH_RETURN_VALUE(!pasteboardName.isEmpty(), std::nullopt); … … 666 666 667 667 #if HAVE(PASTEBOARD_DATA_OWNER) 668 Optional<DataOwnerType> result;668 std::optional<DataOwnerType> result; 669 669 for (auto* page : process->pages()) { 670 670 if (page->webPageID() == *pageID) { … … 675 675 // If this message check is hit, then the incoming web page ID doesn't correspond to any page 676 676 // currently known to the UI process. 677 MESSAGE_CHECK_WITH_RETURN_VALUE(result.has Value(), std::nullopt);677 MESSAGE_CHECK_WITH_RETURN_VALUE(result.has_value(), std::nullopt); 678 678 return result; 679 679 #else … … 709 709 } 710 710 711 Optional<WebPasteboardProxy::PasteboardAccessType> WebPasteboardProxy::PasteboardAccessInformation::accessType(WebProcessProxy& process) const711 std::optional<WebPasteboardProxy::PasteboardAccessType> WebPasteboardProxy::PasteboardAccessInformation::accessType(WebProcessProxy& process) const 712 712 { 713 713 auto matchIndex = processes.findMatching([&](auto& processAndType) { -
trunk/Source/WebKit/UIProcess/Inspector/socket/RemoteInspectorClient.cpp
r277740 r278244 123 123 { 124 124 ASSERT(isMainRunLoop()); 125 ASSERT(m_connectionID .hasValue());125 ASSERT(m_connectionID); 126 126 auto message = event.utf8(); 127 127 send(m_connectionID.value(), reinterpret_cast<const uint8_t*>(message.data()), message.length()); -
trunk/Source/WebKit/UIProcess/glib/UserMediaPermissionRequestManagerProxyGLib.cpp
r271513 r278244 30 30 void UserMediaPermissionRequestManagerProxy::platformValidateUserMediaRequestConstraints(RealtimeMediaSourceCenter::ValidConstraintsHandler&& validHandler, RealtimeMediaSourceCenter::InvalidConstraintsHandler&& invalidHandler, String&& deviceIDHashSalt) 31 31 { 32 m_page.process().connection()->sendWithAsyncReply(Messages::UserMediaCaptureManager::ValidateUserMediaRequestConstraints(m_currentUserMediaRequest->userRequest(), deviceIDHashSalt), [validHandler = WTFMove(validHandler), invalidHandler = WTFMove(invalidHandler)]( Optional<String> invalidConstraint, Vector<WebCore::CaptureDevice> audioDevices, Vector<WebCore::CaptureDevice> videoDevices, Optional<String> deviceIdentifierHashSalt) mutable {33 if (invalidConstraint .hasValue())32 m_page.process().connection()->sendWithAsyncReply(Messages::UserMediaCaptureManager::ValidateUserMediaRequestConstraints(m_currentUserMediaRequest->userRequest(), deviceIDHashSalt), [validHandler = WTFMove(validHandler), invalidHandler = WTFMove(invalidHandler)](std::optional<String> invalidConstraint, Vector<WebCore::CaptureDevice> audioDevices, Vector<WebCore::CaptureDevice> videoDevices, Optional<String> deviceIdentifierHashSalt) mutable { 33 if (invalidConstraint) 34 34 invalidHandler(*invalidConstraint); 35 35 else -
trunk/Source/WebKit/WebProcess/GPU/media/MediaSourcePrivateRemote.cpp
r276367 r278244 99 99 return status; 100 100 101 Optional<RemoteSourceBufferIdentifier> remoteSourceBufferIdentifier;101 std::optional<RemoteSourceBufferIdentifier> remoteSourceBufferIdentifier; 102 102 m_gpuProcessConnection->connection().sendSync(Messages::RemoteMediaSourceProxy::AddSourceBuffer(contentType), Messages::RemoteMediaSourceProxy::AddSourceBuffer::Reply(status, remoteSourceBufferIdentifier), m_identifier); 103 103 104 104 if (status == AddStatus::Ok) { 105 ASSERT(remoteSourceBufferIdentifier.has Value());105 ASSERT(remoteSourceBufferIdentifier.has_value()); 106 106 auto newSourceBuffer = SourceBufferPrivateRemote::create(*m_gpuProcessConnection, *remoteSourceBufferIdentifier, *this, *m_mediaPlayerPrivate); 107 107 outPrivate = newSourceBuffer.copyRef(); -
trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm
r278190 r278244 88 88 if (parameters.contentFilterExtensionHandle) 89 89 SandboxExtension::consumePermanently(*parameters.contentFilterExtensionHandle); 90 ParentalControlsContentFilter::setHasConsumedSandboxExtension(parameters.contentFilterExtensionHandle.has Value());90 ParentalControlsContentFilter::setHasConsumedSandboxExtension(parameters.contentFilterExtensionHandle.has_value()); 91 91 92 92 if (parameters.frontboardServiceExtensionHandle) -
trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
r278185 r278244 1143 1143 void WebProcess::notifyPreferencesChanged(const String& domain, const String& key, const Optional<String>& encodedValue) 1144 1144 { 1145 if (!encodedValue .hasValue()) {1145 if (!encodedValue) { 1146 1146 setPreferenceValue(domain, key, nil); 1147 1147 dispatchSimulatedNotificationsForPreferenceChange(key); -
trunk/Tools/ChangeLog
r278236 r278244 1 2021-05-28 Darin Adler <darin@apple.com> 2 3 Clients of optional should use has_value instead of relying on hasValue macro 4 https://bugs.webkit.org/show_bug.cgi?id=226395 5 6 Reviewed by Chris Dumez. 7 8 * TestWebKitAPI/Tests/WebCore/CBORReaderTest.cpp: Use has_value. 9 * TestWebKitAPI/Tests/WebCore/CBORWriterTest.cpp: Ditto. 10 * TestWebKitAPI/Tests/WebKitGLib/TestWebKitPolicyClient.cpp: Ditto. 11 * TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebView.cpp: 12 (AudioRenderingWebViewTest::handleStart): Ditto. 13 * WebKitTestRunner/GeolocationProviderMock.cpp: 14 (WTR::GeolocationProviderMock::setPosition): Ditto. 15 * WebKitTestRunner/cocoa/TestRunnerWKWebView.mm: 16 (-[TestRunnerWKWebView canPerformAction:withSender:]): Ditto. 17 1 18 2021-05-28 Alex Christensen <achristensen@webkit.org> 2 19 -
trunk/Tools/TestWebKitAPI/Tests/WebCore/CBORReaderTest.cpp
r239477 r278244 64 64 65 65 for (const UintTestCase& testCase : kUintTestCases) { 66 Optional<CBORValue> cbor = CBORReader::read(testCase.cborData);67 ASSERT_TRUE(cbor.has Value());66 std::optional<CBORValue> cbor = CBORReader::read(testCase.cborData); 67 ASSERT_TRUE(cbor.has_value()); 68 68 ASSERT_TRUE(cbor.value().type() == CBORValue::Type::Unsigned); 69 69 EXPECT_EQ(cbor.value().getInteger(), testCase.value); … … 109 109 CBORReader::DecoderError errorCode; 110 110 for (const auto& nonMinimalUint : nonMinimalUintEncodings) { 111 Optional<CBORValue> cbor = CBORReader::read(nonMinimalUint, &errorCode);112 EXPECT_FALSE(cbor.has Value());111 std::optional<CBORValue> cbor = CBORReader::read(nonMinimalUint, &errorCode); 112 EXPECT_FALSE(cbor.has_value()); 113 113 EXPECT_TRUE(errorCode == CBORReader::DecoderError::NonMinimalCBOREncoding); 114 114 } … … 135 135 136 136 for (const NegativeIntTestCase& testCase : kNegativeIntTestCases) { 137 Optional<CBORValue> cbor = CBORReader::read(testCase.cborData);138 ASSERT_TRUE(cbor.has Value());137 std::optional<CBORValue> cbor = CBORReader::read(testCase.cborData); 138 ASSERT_TRUE(cbor.has_value()); 139 139 ASSERT_TRUE(cbor.value().type() == CBORValue::Type::Negative); 140 140 EXPECT_EQ(cbor.value().getInteger(), testCase.negativeInt); … … 155 155 156 156 for (const ByteTestCase& testCase : kByteStringTestCases) { 157 Optional<CBORValue> cbor = CBORReader::read(testCase.cborData);158 ASSERT_TRUE(cbor.has Value());157 std::optional<CBORValue> cbor = CBORReader::read(testCase.cborData); 158 ASSERT_TRUE(cbor.has_value()); 159 159 ASSERT_TRUE(cbor.value().type() == CBORValue::Type::ByteString); 160 160 EXPECT_TRUE(cbor.value().getByteString() == testCase.value); … … 180 180 181 181 for (const StringTestCase& testCase : kStringTestCases) { 182 Optional<CBORValue> cbor = CBORReader::read(testCase.cborData);183 ASSERT_TRUE(cbor.has Value());182 std::optional<CBORValue> cbor = CBORReader::read(testCase.cborData); 183 ASSERT_TRUE(cbor.has_value()); 184 184 ASSERT_TRUE(cbor.value().type() == CBORValue::Type::String); 185 185 EXPECT_TRUE(cbor.value().getString() == testCase.value); … … 208 208 209 209 for (const auto& testCase : kStringTestCases) { 210 Optional<CBORValue> cbor = CBORReader::read(testCase.cborData);211 ASSERT_TRUE(cbor.has Value());210 std::optional<CBORValue> cbor = CBORReader::read(testCase.cborData); 211 ASSERT_TRUE(cbor.has_value()); 212 212 ASSERT_TRUE(cbor.value().type() == CBORValue::Type::String); 213 213 EXPECT_TRUE(cbor.value().getString() == testCase.value); … … 225 225 }; 226 226 CBORReader::DecoderError errorCode; 227 Optional<CBORValue> cbor = CBORReader::read(stringWithInvalidContinuationByte, &errorCode);228 EXPECT_FALSE(cbor.has Value());227 std::optional<CBORValue> cbor = CBORReader::read(stringWithInvalidContinuationByte, &errorCode); 228 EXPECT_FALSE(cbor.has_value()); 229 229 EXPECT_TRUE(errorCode == CBORReader::DecoderError::InvalidUTF8); 230 230 } … … 239 239 }; 240 240 241 Optional<CBORValue> cbor = CBORReader::read(kArrayTestCaseCBOR);242 ASSERT_TRUE(cbor.has Value());241 std::optional<CBORValue> cbor = CBORReader::read(kArrayTestCaseCBOR); 242 ASSERT_TRUE(cbor.has_value()); 243 243 const CBORValue cborArray = WTFMove(cbor.value()); 244 244 ASSERT_TRUE(cborArray.type() == CBORValue::Type::Array); … … 269 269 }; 270 270 271 Optional<CBORValue> cbor = CBORReader::read(kMapTestCaseCBOR);272 ASSERT_TRUE(cbor.has Value());271 std::optional<CBORValue> cbor = CBORReader::read(kMapTestCaseCBOR); 272 ASSERT_TRUE(cbor.has_value()); 273 273 const CBORValue cborVal = WTFMove(cbor.value()); 274 274 ASSERT_TRUE(cborVal.type() == CBORValue::Type::Map); … … 313 313 }; 314 314 315 Optional<CBORValue> cbor = CBORReader::read(kMapWithIntegerKeyCBOR);316 ASSERT_TRUE(cbor.has Value());315 std::optional<CBORValue> cbor = CBORReader::read(kMapWithIntegerKeyCBOR); 316 ASSERT_TRUE(cbor.has_value()); 317 317 const CBORValue cborVal = WTFMove(cbor.value()); 318 318 ASSERT_TRUE(cborVal.type() == CBORValue::Type::Map); … … 353 353 }; 354 354 355 Optional<CBORValue> cbor = CBORReader::read(kMapArrayTestCaseCBOR);356 ASSERT_TRUE(cbor.has Value());355 std::optional<CBORValue> cbor = CBORReader::read(kMapArrayTestCaseCBOR); 356 ASSERT_TRUE(cbor.has_value()); 357 357 const CBORValue cborVal = WTFMove(cbor.value()); 358 358 ASSERT_TRUE(cborVal.type() == CBORValue::Type::Map); … … 392 392 }; 393 393 394 Optional<CBORValue> cbor = CBORReader::read(kNestedMapTestCase);395 ASSERT_TRUE(cbor.has Value());394 std::optional<CBORValue> cbor = CBORReader::read(kNestedMapTestCase); 395 ASSERT_TRUE(cbor.has_value()); 396 396 const CBORValue cborVal = WTFMove(cbor.value()); 397 397 ASSERT_TRUE(cborVal.type() == CBORValue::Type::Map); … … 429 429 }; 430 430 431 Optional<CBORValue> maxPositiveInt = CBORReader::read(kMaxPositiveInt);432 ASSERT_TRUE(maxPositiveInt.has Value());431 std::optional<CBORValue> maxPositiveInt = CBORReader::read(kMaxPositiveInt); 432 ASSERT_TRUE(maxPositiveInt.has_value()); 433 433 EXPECT_EQ(maxPositiveInt.value().getInteger(), INT64_MAX); 434 434 435 Optional<CBORValue> minNegativeInt = CBORReader::read(kMinNegativeInt);436 ASSERT_TRUE(minNegativeInt.has Value());435 std::optional<CBORValue> minNegativeInt = CBORReader::read(kMinNegativeInt); 436 ASSERT_TRUE(minNegativeInt.has_value()); 437 437 EXPECT_EQ(minNegativeInt.value().getInteger(), INT64_MIN); 438 438 } … … 449 449 450 450 CBORReader::DecoderError errorCode; 451 Optional<CBORValue> positiveIntOutOfRangeCBOR = CBORReader::read(kOutOfRangePositiveInt, &errorCode);451 std::optional<CBORValue> positiveIntOutOfRangeCBOR = CBORReader::read(kOutOfRangePositiveInt, &errorCode); 452 452 EXPECT_FALSE(positiveIntOutOfRangeCBOR); 453 453 EXPECT_TRUE(errorCode == CBORReader::DecoderError::OutOfRangeIntegerValue); 454 454 455 Optional<CBORValue> negativeIntOutOfRangeCBOR = CBORReader::read(kOutOfRangeNegativeInt, &errorCode);455 std::optional<CBORValue> negativeIntOutOfRangeCBOR = CBORReader::read(kOutOfRangeNegativeInt, &errorCode); 456 456 EXPECT_FALSE(negativeIntOutOfRangeCBOR); 457 457 EXPECT_TRUE(errorCode == CBORReader::DecoderError::OutOfRangeIntegerValue); … … 471 471 472 472 for (const auto& testCase : kSimpleValueTestCases) { 473 Optional<CBORValue> cbor = CBORReader::read(testCase.cborData);474 ASSERT_TRUE(cbor.has Value());473 std::optional<CBORValue> cbor = CBORReader::read(testCase.cborData); 474 ASSERT_TRUE(cbor.has_value()); 475 475 ASSERT_TRUE(cbor.value().type() == CBORValue::Type::SimpleValue); 476 476 ASSERT_TRUE(cbor.value().getSimpleValue() == testCase.value); … … 491 491 for (const auto& unsupported_floating_point : floatingPointCbors) { 492 492 CBORReader::DecoderError errorCode; 493 Optional<CBORValue> cbor = CBORReader::read(unsupported_floating_point, &errorCode);494 EXPECT_FALSE(cbor.has Value());493 std::optional<CBORValue> cbor = CBORReader::read(unsupported_floating_point, &errorCode); 494 EXPECT_FALSE(cbor.has_value()); 495 495 EXPECT_TRUE(errorCode == CBORReader::DecoderError::UnsupportedFloatingPointValue); 496 496 } … … 517 517 for (const auto& incomplete_data : incompleteCborList) { 518 518 CBORReader::DecoderError errorCode; 519 Optional<CBORValue> cbor = CBORReader::read(incomplete_data, &errorCode);520 EXPECT_FALSE(cbor.has Value());519 std::optional<CBORValue> cbor = CBORReader::read(incomplete_data, &errorCode); 520 EXPECT_FALSE(cbor.has_value()); 521 521 EXPECT_TRUE(errorCode == CBORReader::DecoderError::IncompleteCBORData); 522 522 } … … 538 538 539 539 CBORReader::DecoderError errorCode; 540 Optional<CBORValue> cbor = CBORReader::read(kMapWithUintKey, &errorCode);541 EXPECT_FALSE(cbor.has Value());540 std::optional<CBORValue> cbor = CBORReader::read(kMapWithUintKey, &errorCode); 541 EXPECT_FALSE(cbor.has_value()); 542 542 EXPECT_TRUE(errorCode == CBORReader::DecoderError::IncorrectMapKeyType); 543 543 } … … 567 567 for (const auto& incorrect_cbor : kUnknownAdditionalInfoList) { 568 568 CBORReader::DecoderError errorCode; 569 Optional<CBORValue> cbor = CBORReader::read(incorrect_cbor, &errorCode);570 EXPECT_FALSE(cbor.has Value());569 std::optional<CBORValue> cbor = CBORReader::read(incorrect_cbor, &errorCode); 570 EXPECT_FALSE(cbor.has_value()); 571 571 EXPECT_TRUE(errorCode == CBORReader::DecoderError::UnknownAdditionalInfo); 572 572 } … … 590 590 for (const auto& zeroDepthData : kZeroDepthCBORList) { 591 591 CBORReader::DecoderError errorCode; 592 Optional<CBORValue> cbor = CBORReader::read(zeroDepthData, &errorCode, 0);593 EXPECT_TRUE(cbor.has Value());592 std::optional<CBORValue> cbor = CBORReader::read(zeroDepthData, &errorCode, 0); 593 EXPECT_TRUE(cbor.has_value()); 594 594 EXPECT_TRUE(errorCode == CBORReader::DecoderError::CBORNoError); 595 595 } … … 610 610 611 611 CBORReader::DecoderError errorCode; 612 Optional<CBORValue> cborSingleLayerMax = CBORReader::read(kNestedCBORData, &errorCode, 1);613 EXPECT_FALSE(cborSingleLayerMax.has Value());612 std::optional<CBORValue> cborSingleLayerMax = CBORReader::read(kNestedCBORData, &errorCode, 1); 613 EXPECT_FALSE(cborSingleLayerMax.has_value()); 614 614 EXPECT_TRUE(errorCode == CBORReader::DecoderError::TooMuchNesting); 615 615 616 Optional<CBORValue> cborDoubleLayerMax = CBORReader::read(kNestedCBORData, &errorCode, 2);617 EXPECT_TRUE(cborDoubleLayerMax.has Value());616 std::optional<CBORValue> cborDoubleLayerMax = CBORReader::read(kNestedCBORData, &errorCode, 2); 617 EXPECT_TRUE(cborDoubleLayerMax.has_value()); 618 618 EXPECT_TRUE(errorCode == CBORReader::DecoderError::CBORNoError); 619 619 } … … 647 647 CBORReader::DecoderError errorCode; 648 648 for (const auto& unsortedMap : kMapsWithUnsortedKeys) { 649 Optional<CBORValue> cbor =649 std::optional<CBORValue> cbor = 650 650 CBORReader::read(unsortedMap, &errorCode); 651 EXPECT_FALSE(cbor.has Value());651 EXPECT_FALSE(cbor.has_value()); 652 652 EXPECT_TRUE(errorCode == CBORReader::DecoderError::OutOfOrderKey); 653 653 } … … 679 679 CBORReader::DecoderError errorCode; 680 680 681 Optional<CBORValue> cbor = CBORReader::read(kMapWithDuplicateKey, &errorCode);682 EXPECT_FALSE(cbor.has Value());681 std::optional<CBORValue> cbor = CBORReader::read(kMapWithDuplicateKey, &errorCode); 682 EXPECT_FALSE(cbor.has_value()); 683 683 EXPECT_TRUE(errorCode == CBORReader::DecoderError::DuplicateKey); 684 684 } … … 699 699 CBORReader::DecoderError errorCode; 700 700 for (const auto& cbor_byte : utf8CharacterEncodings) { 701 Optional<CBORValue> correctlyEncodedCbor = CBORReader::read(cbor_byte, &errorCode);702 EXPECT_TRUE(correctlyEncodedCbor.has Value());701 std::optional<CBORValue> correctlyEncodedCbor = CBORReader::read(cbor_byte, &errorCode); 702 EXPECT_TRUE(correctlyEncodedCbor.has_value()); 703 703 EXPECT_TRUE(errorCode == CBORReader::DecoderError::CBORNoError); 704 704 } … … 706 706 // Incorrect UTF8 encoding referenced by section 3.5.3 of the stress test. 707 707 Vector<uint8_t> impossible_utf_byte { 0x64, 0xfe, 0xfe, 0xff, 0xff }; 708 Optional<CBORValue> incorrectlyEncodedCbor = CBORReader::read(impossible_utf_byte, &errorCode);708 std::optional<CBORValue> incorrectlyEncodedCbor = CBORReader::read(impossible_utf_byte, &errorCode); 709 709 EXPECT_FALSE(incorrectlyEncodedCbor); 710 710 EXPECT_TRUE(errorCode == CBORReader::DecoderError::InvalidUTF8); … … 728 728 for (const auto& extraneous_cborData : zeroPaddedCborList) { 729 729 CBORReader::DecoderError errorCode; 730 Optional<CBORValue> cbor = CBORReader::read(extraneous_cborData, &errorCode);731 EXPECT_FALSE(cbor.has Value());730 std::optional<CBORValue> cbor = CBORReader::read(extraneous_cborData, &errorCode); 731 EXPECT_FALSE(cbor.has_value()); 732 732 EXPECT_TRUE(errorCode == CBORReader::DecoderError::ExtraneousData); 733 733 } … … 759 759 for (const auto& unsupportedSimpleVal : unsupportedSimpleValues) { 760 760 CBORReader::DecoderError errorCode; 761 Optional<CBORValue> cbor = CBORReader::read(unsupportedSimpleVal, &errorCode);762 EXPECT_FALSE(cbor.has Value());761 std::optional<CBORValue> cbor = CBORReader::read(unsupportedSimpleVal, &errorCode); 762 EXPECT_FALSE(cbor.has_value()); 763 763 EXPECT_TRUE(errorCode == CBORReader::DecoderError::UnsupportedSimpleValue); 764 764 } -
trunk/Tools/TestWebKitAPI/Tests/WebCore/CBORWriterTest.cpp
r239477 r278244 82 82 for (const UintTestCase& testCase : kUintTestCases) { 83 83 auto cbor = CBORWriter::write(CBORValue(testCase.value)); 84 ASSERT_TRUE(cbor.has Value());84 ASSERT_TRUE(cbor.has_value()); 85 85 EXPECT_TRUE(eq(cbor.value(), testCase.cbor)); 86 86 } … … 109 109 for (const auto& testCase : kNegativeIntTestCases) { 110 110 auto cbor = CBORWriter::write(CBORValue(testCase.negativeInt)); 111 ASSERT_TRUE(cbor.has Value());111 ASSERT_TRUE(cbor.has_value()); 112 112 EXPECT_TRUE(eq(cbor.value(), testCase.cbor)); 113 113 } … … 128 128 for (const BytesTestCase& testCase : kBytesTestCases) { 129 129 auto cbor = CBORWriter::write(CBORValue(testCase.bytes)); 130 ASSERT_TRUE(cbor.has Value());130 ASSERT_TRUE(cbor.has_value()); 131 131 EXPECT_TRUE(eq(cbor.value(), testCase.cbor)); 132 132 } … … 152 152 for (const StringTestCase& testCase : kStringTestCases) { 153 153 auto cbor = CBORWriter::write(CBORValue(testCase.string)); 154 ASSERT_TRUE(cbor.has Value());154 ASSERT_TRUE(cbor.has_value()); 155 155 EXPECT_TRUE(eq(cbor.value(), testCase.cbor)); 156 156 } … … 169 169 array.append(CBORValue(i)); 170 170 auto cbor = CBORWriter::write(CBORValue(array)); 171 ASSERT_TRUE(cbor.has Value());171 ASSERT_TRUE(cbor.has_value()); 172 172 EXPECT_TRUE(eq(cbor.value(), kArrayTestCaseCbor, sizeof(kArrayTestCaseCbor))); 173 173 } … … 279 279 map[CBORValue(std::numeric_limits<int64_t>::max())] = CBORValue("j"); 280 280 auto cbor = CBORWriter::write(CBORValue(map)); 281 ASSERT_TRUE(cbor.has Value());281 ASSERT_TRUE(cbor.has_value()); 282 282 EXPECT_TRUE(eq(cbor.value(), kMapTestCaseCbor, sizeof(kMapTestCaseCbor))); 283 283 } … … 302 302 map[CBORValue("b")] = CBORValue(array); 303 303 auto cbor = CBORWriter::write(CBORValue(map)); 304 ASSERT_TRUE(cbor.has Value());304 ASSERT_TRUE(cbor.has_value()); 305 305 EXPECT_TRUE(eq(cbor.value(), kMapArrayTestCaseCbor, sizeof(kMapArrayTestCaseCbor))); 306 306 } … … 328 328 map[CBORValue("b")] = CBORValue(nestedMap); 329 329 auto cbor = CBORWriter::write(CBORValue(map)); 330 ASSERT_TRUE(cbor.has Value());330 ASSERT_TRUE(cbor.has_value()); 331 331 EXPECT_TRUE(eq(cbor.value(), kNestedMapTestCase, sizeof(kNestedMapTestCase))); 332 332 } … … 346 346 for (const auto& testCase : kSimpleTestCase) { 347 347 auto cbor = CBORWriter::write(CBORValue(testCase.simpleValue)); 348 ASSERT_TRUE(cbor.has Value());348 ASSERT_TRUE(cbor.has_value()); 349 349 EXPECT_TRUE(eq(cbor.value(), testCase.cbor)); 350 350 } … … 371 371 const CBORValue singleLayerCborArray = CBORValue(simpleArray); 372 372 373 EXPECT_TRUE(CBORWriter::write(simpleUint, 0).has Value());374 EXPECT_TRUE(CBORWriter::write(simpleString, 0).has Value());375 EXPECT_TRUE(CBORWriter::write(simpleBytestring, 0).has Value());376 377 EXPECT_TRUE(CBORWriter::write(emptyArrayValue, 0).has Value());378 EXPECT_TRUE(CBORWriter::write(emptyMapValue, 0).has Value());379 380 EXPECT_FALSE(CBORWriter::write(singleLayerCborArray, 0).has Value());381 EXPECT_TRUE(CBORWriter::write(singleLayerCborArray, 1).has Value());382 383 EXPECT_FALSE(CBORWriter::write(singleLayerCborMap, 0).has Value());384 EXPECT_TRUE(CBORWriter::write(singleLayerCborMap, 1).has Value());373 EXPECT_TRUE(CBORWriter::write(simpleUint, 0).has_value()); 374 EXPECT_TRUE(CBORWriter::write(simpleString, 0).has_value()); 375 EXPECT_TRUE(CBORWriter::write(simpleBytestring, 0).has_value()); 376 377 EXPECT_TRUE(CBORWriter::write(emptyArrayValue, 0).has_value()); 378 EXPECT_TRUE(CBORWriter::write(emptyMapValue, 0).has_value()); 379 380 EXPECT_FALSE(CBORWriter::write(singleLayerCborArray, 0).has_value()); 381 EXPECT_TRUE(CBORWriter::write(singleLayerCborArray, 1).has_value()); 382 383 EXPECT_FALSE(CBORWriter::write(singleLayerCborMap, 0).has_value()); 384 EXPECT_TRUE(CBORWriter::write(singleLayerCborMap, 1).has_value()); 385 385 } 386 386 … … 397 397 nestedMap[CBORValue("d")] = CBORValue(3); 398 398 cborMap[CBORValue("b")] = CBORValue(nestedMap); 399 EXPECT_TRUE(CBORWriter::write(CBORValue(cborMap), 2).has Value());400 EXPECT_FALSE(CBORWriter::write(CBORValue(cborMap), 1).has Value());399 EXPECT_TRUE(CBORWriter::write(CBORValue(cborMap), 2).has_value()); 400 EXPECT_FALSE(CBORWriter::write(CBORValue(cborMap), 1).has_value()); 401 401 } 402 402 … … 423 423 cborArray.append(CBORValue(cborMap)); 424 424 425 EXPECT_TRUE(CBORWriter::write(CBORValue(cborArray), 3).has Value());426 EXPECT_FALSE(CBORWriter::write(CBORValue(cborArray), 2).has Value());425 EXPECT_TRUE(CBORWriter::write(CBORValue(cborArray), 3).has_value()); 426 EXPECT_FALSE(CBORWriter::write(CBORValue(cborArray), 2).has_value()); 427 427 } 428 428 … … 457 457 map[CBORValue("b")] = CBORValue(nestedMap); 458 458 459 EXPECT_TRUE(CBORWriter::write(CBORValue(map), 5).has Value());460 EXPECT_FALSE(CBORWriter::write(CBORValue(map), 4).has Value());459 EXPECT_TRUE(CBORWriter::write(CBORValue(map), 5).has_value()); 460 EXPECT_FALSE(CBORWriter::write(CBORValue(map), 4).has_value()); 461 461 } 462 462 -
trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitPolicyClient.cpp
r278185 r278244 132 132 // Spin until autoplay status is reported, the run JS API can 133 133 // complete its main loop before the promises in autoplay-check fire. 134 while (!m_autoplayed.has Value())134 while (!m_autoplayed.has_value()) 135 135 g_main_loop_run(m_mainLoop); 136 136 … … 142 142 bool m_respondToPolicyDecisionAsynchronously { false }; 143 143 bool m_haltMainLoopAfterMakingDecision { false }; 144 Optional<bool> m_autoplayed;144 std::optional<bool> m_autoplayed; 145 145 GRefPtr<WebKitPolicyDecision> m_previousPolicyDecision; 146 146 GRefPtr<WebKitWebsitePolicies> m_websitePolicies; -
trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebView.cpp
r276848 r278244 1438 1438 { 1439 1439 g_assert(m_state == RenderingState::Unknown); 1440 g_assert_false(m_streamId.has Value());1440 g_assert_false(m_streamId.has_value()); 1441 1441 g_assert_cmpuint(id, ==, 0); 1442 1442 m_streamId = id; … … 1514 1514 static const struct wpe_audio_receiver m_audioReceiver; 1515 1515 RenderingState m_state { RenderingState::Unknown }; 1516 Optional<uint32_t> m_streamId;1516 std::optional<uint32_t> m_streamId; 1517 1517 }; 1518 1518 -
trunk/Tools/WebKitTestRunner/GeolocationProviderMock.cpp
r278185 r278244 64 64 } 65 65 66 void GeolocationProviderMock::setPosition(double latitude, double longitude, double accuracy, Optional<double> altitude, Optional<double> altitudeAccuracy, Optional<double> heading, Optional<double> speed, Optional<double> floorLevel)66 void GeolocationProviderMock::setPosition(double latitude, double longitude, double accuracy, std::optional<double> altitude, std::optional<double> altitudeAccuracy, std::optional<double> heading, std::optional<double> speed, std::optional<double> floorLevel) 67 67 { 68 m_position.adopt(WKGeolocationPositionCreate_c(WallTime::now().secondsSinceEpoch().seconds(), latitude, longitude, accuracy, altitude.has Value(), altitude.value_or(0), altitudeAccuracy.hasValue(), altitudeAccuracy.value_or(0), heading.hasValue(), heading.value_or(0), speed.hasValue(), speed.value_or(0), floorLevel.hasValue(), floorLevel.value_or(0)));68 m_position.adopt(WKGeolocationPositionCreate_c(WallTime::now().secondsSinceEpoch().seconds(), latitude, longitude, accuracy, altitude.has_value(), altitude.value_or(0), altitudeAccuracy.has_value(), altitudeAccuracy.value_or(0), heading.has_value(), heading.value_or(0), speed.has_value(), speed.value_or(0), floorLevel.has_value(), floorLevel.value_or(0))); 69 69 70 70 m_hasError = false; -
trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm
r277301 r278244 69 69 BOOL _isInteractingWithFormControl; 70 70 BOOL _scrollingUpdatesDisabled; 71 Optional<CustomMenuActionInfo> _customMenuActionInfo;71 std::optional<CustomMenuActionInfo> _customMenuActionInfo; 72 72 RetainPtr<NSArray<NSString *>> _allowedMenuActions; 73 73 #if PLATFORM(IOS_FAMILY) … … 316 316 BOOL canPerformActionByDefault = [super canPerformAction:action withSender:sender]; 317 317 if (isCustomAction) 318 canPerformActionByDefault = _customMenuActionInfo.has Value();318 canPerformActionByDefault = _customMenuActionInfo.has_value(); 319 319 320 320 if (canPerformActionByDefault && _allowedMenuActions && sender == UIMenuController.sharedMenuController) {
Note:
See TracChangeset
for help on using the changeset viewer.