2012-09-21 21:06:05 +00:00
|
|
|
/*
|
2013-11-05 21:17:07 +00:00
|
|
|
* Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
|
2012-09-21 21:06:05 +00:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
|
|
* THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "GeolocationProviderMock.h"
|
|
|
|
|
2014-05-16 08:53:19 +00:00
|
|
|
#include <WebKit/WKGeolocationManager.h>
|
2013-11-05 21:17:07 +00:00
|
|
|
#include <string.h>
|
2012-09-21 21:06:05 +00:00
|
|
|
#include <wtf/Assertions.h>
|
2018-02-23 04:18:17 +00:00
|
|
|
#include <wtf/WallTime.h>
|
2012-09-21 21:06:05 +00:00
|
|
|
|
|
|
|
namespace WTR {
|
|
|
|
|
|
|
|
static void startUpdatingCallback(WKGeolocationManagerRef geolocationManager, const void* clientInfo)
|
|
|
|
{
|
|
|
|
GeolocationProviderMock* geolocationProvider = static_cast<GeolocationProviderMock*>(const_cast<void*>(clientInfo));
|
|
|
|
geolocationProvider->startUpdating(geolocationManager);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void stopUpdatingCallback(WKGeolocationManagerRef geolocationManager, const void* clientInfo)
|
|
|
|
{
|
|
|
|
GeolocationProviderMock* geolocationProvider = static_cast<GeolocationProviderMock*>(const_cast<void*>(clientInfo));
|
|
|
|
geolocationProvider->stopUpdating(geolocationManager);
|
|
|
|
}
|
|
|
|
|
|
|
|
GeolocationProviderMock::GeolocationProviderMock(WKContextRef context)
|
2017-06-13 17:48:50 +00:00
|
|
|
: m_context(context)
|
|
|
|
, m_geolocationManager(WKContextGetGeolocationManager(context))
|
2012-09-21 21:06:05 +00:00
|
|
|
{
|
2013-12-04 18:49:49 +00:00
|
|
|
WKGeolocationProviderV1 providerCallback;
|
2015-06-12 10:34:14 +00:00
|
|
|
memset(&providerCallback, 0, sizeof(WKGeolocationProviderV1));
|
2013-12-04 18:49:49 +00:00
|
|
|
providerCallback.base.version = 1;
|
|
|
|
providerCallback.base.clientInfo = this;
|
2013-11-05 21:17:07 +00:00
|
|
|
providerCallback.startUpdating = startUpdatingCallback;
|
|
|
|
providerCallback.stopUpdating = stopUpdatingCallback;
|
2013-12-04 18:49:49 +00:00
|
|
|
WKGeolocationManagerSetProvider(m_geolocationManager, &providerCallback.base);
|
2012-09-21 21:06:05 +00:00
|
|
|
}
|
|
|
|
|
2013-05-21 20:38:04 +00:00
|
|
|
GeolocationProviderMock::~GeolocationProviderMock()
|
|
|
|
{
|
|
|
|
WKGeolocationManagerSetProvider(m_geolocationManager, 0);
|
|
|
|
}
|
|
|
|
|
Clients of optional should use has_value instead of relying on hasValue macro
https://bugs.webkit.org/show_bug.cgi?id=226395
Reviewed by Chris Dumez.
Source/JavaScriptCore:
* bytecompiler/NodesCodegen.cpp:
(JSC::RegExpNode::emitBytecode): Don't use hasValue.
Source/WebCore:
In some files we are touching, moved from Optional to std::optional, but doing
that consistently in files we are not otherwise modifying is out of scope here.
In some places, use has_value instead of hasValue. In others, improved further
by not using has_value explicitly when it's clearer to do so. Wasn't 100%
consistent about that, but did aim to cover 100% of the hasValue call sites.
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::create): Don't use hasValue.
* Modules/webxr/WebXRFrame.cpp:
(WebCore::WebXRFrame::getViewerPose): Ditto.
(WebCore::WebXRFrame::getPose): Ditto.
* Modules/webxr/WebXRGamepad.cpp:
(WebCore::WebXRGamepad::WebXRGamepad): Ditto.
* Modules/webxr/WebXRInputSource.cpp:
(WebCore::WebXRInputSource::requiresInputSourceChange): Use has_value.
* bindings/js/DOMPromiseProxy.h:
(WebCore::DOMPromiseProxy<IDLType>::isFulfilled const): Ditto.
(WebCore::DOMPromiseProxy<IDLUndefined>::isFulfilled const): Ditto.
(WebCore::DOMPromiseProxyWithResolveCallback<IDLType>::isFulfilled const): Ditto.
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneDeserializer::readTerminal): Ditto.
* css/CSSFontFaceSet.cpp:
(WebCore::CSSFontFaceSet::addToFacesLookupTable): Removed unneeded double check
of optional value. !x and !x.has_value() check the same thing.
(WebCore::CSSFontFaceSet::remove): Ditto.
(WebCore::CSSFontFaceSet::fontFace): Simplified code with extra local variables
to use an idiom that does not use hasValue. Since using *, ->, or value() on an
optional already asserts, there is no need to explicitly assert in the caller.
* css/CSSGradientValue.cpp:
(WebCore::GradientStop::isSpecified const): Use has_value.
* css/CSSSegmentedFontFace.cpp:
(WebCore::CSSSegmentedFontFace::fontRanges): Removed unneeded calls to hasValue.
* css/FontFace.cpp:
(WebCore::FontFace::family const): Use has_value.
(WebCore::FontFace::style const): Ditto.
(WebCore::FontFace::weight const): Ditto.
(WebCore::FontFace::stretch const): Ditto.
(WebCore::FontFace::unicodeRange const): Ditto.
(WebCore::FontFace::featureSettings const): Ditto.
(WebCore::FontFace::display const): Ditto.
* css/parser/CSSSelectorParser.cpp:
(WebCore::consumeANPlusB): Ditto.
* display/css/DisplayStyle.h: Ditto.
* dom/DataTransferItemList.h: Ditto.
* dom/Document.cpp:
(WebCore::Document::updateHighlightPositions): Ditto.
* dom/EventTarget.cpp:
(WebCore::EventTarget::addEventListener): Ditto.
* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::hasPendingCorrection const): Ditto.
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyInlineStyle): Don't call hasValue.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::captionDisplayMode): Ditto.
* html/ImageBitmap.h: Ditto.
* inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::setScreenSizeOverride): Use has_value.
* layout/LayoutPhase.cpp:
(WebCore::Layout::PhaseScope::PhaseScope): Ditto.
* layout/formattingContexts/inline/InlineContentBreaker.cpp:
(WebCore::Layout::InlineContentBreaker::tryBreakingTextRun const): Ditto.
* layout/formattingContexts/inline/InlineLine.h: Ditto.
* loader/CrossOriginPreflightResultCache.cpp:
(WebCore::parseAccessControlMaxAge): Ditto.
* page/EventHandler.cpp:
(WebCore::EventHandler::defaultWheelEventHandler): Ditto.
* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope): Ditto.
* page/scrolling/ScrollSnapOffsetsInfo.cpp:
(WebCore::closestSnapOffsetWithInfoAndAxis): Ditto.
* platform/ScrollController.cpp:
(WebCore::ScrollController::adjustScrollDestination): Don't use hasValue.
* platform/cocoa/SystemBattery.mm:
(WebCore::systemHasBattery): Use has_value.
(WebCore::systemHasAC): Use has_value.
* platform/graphics/Gradient.h: Ditto.
* platform/graphics/ImageSource.h: Ditto.
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::wouldTaintOrigin const): Changed idiom to not use hasValue.
* platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
(setGLContext): Do not use hasValue.
* platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
(WebCore::GStreamerRegistryScanner::ElementFactories::hasElementForMediaType const): Ditto.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::playbackPosition const): Ditto.
(WebCore::MediaPlayerPrivateGStreamer::performTaskAtMediaTime): Ditto.
(WebCore::MediaPlayerPrivateGStreamer::triggerRepaint): Ditto.
* platform/graphics/gstreamer/eme/CDMProxyThunder.cpp:
(WebCore::CDMProxyThunder::getDecryptionSession const): Use has_value.
* platform/graphics/gstreamer/eme/CDMThunder.cpp:
(WebCore::ParsedResponseMessage::hasType const): Use has_value.
(WebCore::CDMInstanceSessionThunder::cdmInstanceThunder const): Use
a pointer for the erturn value instead of Optional<&>. This hasn't
compiled since we switched to std::optional so I suspect this code is
not compiled by EWS or the buildbot.
* platform/graphics/gstreamer/eme/CDMThunder.h: Updated to match above.
* platform/graphics/gstreamer/mse/AppendPipeline.cpp:
(WebCore::AppendPipeline::parseDemuxerSrcPadCaps): Use value_or.
(WebCore::AppendPipeline::appsinkCapsChanged): Do not use has_value.
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::trackDetected): Ditto.
* platform/graphics/transforms/TransformState.h: Use has_value.
* platform/ios/VideoFullscreenInterfaceAVKit.mm:
(WebCore::supportsPictureInPicture): Ditto.
* platform/mac/NSScrollerImpDetails.mm:
(WebCore::ScrollerStyle::recommendedScrollerStyle): Ditto.
* platform/network/ResourceRequestBase.cpp:
(WebCore::ResourceRequestBase::isSystemPreview const): Ditto.
* platform/xr/openxr/OpenXRInputSource.cpp:
(PlatformXR::OpenXRInputSource::getInputSource const): Ditto.
* rendering/EventRegion.h: Ditto.
* rendering/GridTrackSizingAlgorithm.h: Remove unnecessary assertion, since
the * operator already does the assertion.
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::canComputePercentageFlexBasis): Use has_value.
* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::setExplicitValue): Ditto.
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::systemFocusRingColor): Ditto.
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::removeAnonymousWrappersForInlineChildrenIfNeeded): Ditto.
* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::createSVGTransformFromMatrix): Changed idiom to not
call hasValue.
* svg/SVGTransform.h: Ditto.
* testing/WebFakeXRDevice.cpp:
(WebCore::WebFakeXRDevice::setViews): Ditto.
Source/WebDriver:
* socket/SessionHostSocket.cpp:
(WebDriver::SessionHost::isConnected const): Use has_value.
Source/WebKit:
* Platform/IPC/ArgumentCoders.h: Use std::optional; there was no hasValue
in here and I edited it by mistake, but we want to do this eventually.
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: Removed using namespace WebCore.
(IPC::ArgumentCoder<Ref<WebCore::Font>>::decodePlatformData): Use has_value.
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
(WebKit::XPCServiceInitializerDelegate::getClientSDKVersion): Ditto.
* Shared/WebCoreArgumentCoders.cpp:
(IPC::decodeImage): Changed idiom to not call hasValue.
(IPC::ArgumentCoder<Ref<Font>>::decode): Ditto.
* Shared/mac/MediaFormatReader/MediaFormatReader.cpp:
(WebKit::MediaFormatReader::finishParsing): Use has_value.
(WebKit::MediaFormatReader::copyProperty): Ditto.
(WebKit::MediaFormatReader::copyTrackArray): Ditto.
* Shared/win/WebCoreArgumentCodersWin.cpp:
(IPC::ArgumentCoder<Ref<Font>>::decodePlatformData): Do not call hasValue.
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration encodeWithCoder:]): Changed idiom to not use hasValue.
* UIProcess/API/glib/InputMethodFilter.cpp:
(WebKit::InputMethodFilter::setState): Use has_value.
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::AutomationCommandError::toProtocolString): Changed idiom to not use hasValue.
* UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
(WebKit::WebPasteboardProxy::determineDataOwner const): Use has_value.
* UIProcess/Inspector/socket/RemoteInspectorClient.cpp:
(WebKit::RemoteInspectorClient::sendWebInspectorEvent): Changed idiom to not use hasValue.
* UIProcess/glib/UserMediaPermissionRequestManagerProxyGLib.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::platformValidateUserMediaRequestConstraints): Ditto.
* WebProcess/GPU/media/MediaSourcePrivateRemote.cpp:
(WebKit::MediaSourcePrivateRemote::addSourceBuffer): Use has_value.
* WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::platformDidReceiveLoadParameters): Ditto.
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::notifyPreferencesChanged): Changed idiom to not
call hasValue.
Source/WTF:
* wtf/Hasher.h: Use has_value.
* wtf/Optional.h: Remove hasValue macro. Not needed any more, but also a bit
dangerous because of how widespread the use of hasValue is for things other
than WTF::Optional.
Tools:
* TestWebKitAPI/Tests/WebCore/CBORReaderTest.cpp: Use has_value.
* TestWebKitAPI/Tests/WebCore/CBORWriterTest.cpp: Ditto.
* TestWebKitAPI/Tests/WebKitGLib/TestWebKitPolicyClient.cpp: Ditto.
* TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebView.cpp:
(AudioRenderingWebViewTest::handleStart): Ditto.
* WebKitTestRunner/GeolocationProviderMock.cpp:
(WTR::GeolocationProviderMock::setPosition): Ditto.
* WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
(-[TestRunnerWKWebView canPerformAction:withSender:]): Ditto.
Canonical link: https://commits.webkit.org/238281@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278244 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-29 22:08:56 +00:00
|
|
|
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)
|
2012-09-21 21:06:05 +00:00
|
|
|
{
|
Clients of optional should use has_value instead of relying on hasValue macro
https://bugs.webkit.org/show_bug.cgi?id=226395
Reviewed by Chris Dumez.
Source/JavaScriptCore:
* bytecompiler/NodesCodegen.cpp:
(JSC::RegExpNode::emitBytecode): Don't use hasValue.
Source/WebCore:
In some files we are touching, moved from Optional to std::optional, but doing
that consistently in files we are not otherwise modifying is out of scope here.
In some places, use has_value instead of hasValue. In others, improved further
by not using has_value explicitly when it's clearer to do so. Wasn't 100%
consistent about that, but did aim to cover 100% of the hasValue call sites.
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::create): Don't use hasValue.
* Modules/webxr/WebXRFrame.cpp:
(WebCore::WebXRFrame::getViewerPose): Ditto.
(WebCore::WebXRFrame::getPose): Ditto.
* Modules/webxr/WebXRGamepad.cpp:
(WebCore::WebXRGamepad::WebXRGamepad): Ditto.
* Modules/webxr/WebXRInputSource.cpp:
(WebCore::WebXRInputSource::requiresInputSourceChange): Use has_value.
* bindings/js/DOMPromiseProxy.h:
(WebCore::DOMPromiseProxy<IDLType>::isFulfilled const): Ditto.
(WebCore::DOMPromiseProxy<IDLUndefined>::isFulfilled const): Ditto.
(WebCore::DOMPromiseProxyWithResolveCallback<IDLType>::isFulfilled const): Ditto.
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneDeserializer::readTerminal): Ditto.
* css/CSSFontFaceSet.cpp:
(WebCore::CSSFontFaceSet::addToFacesLookupTable): Removed unneeded double check
of optional value. !x and !x.has_value() check the same thing.
(WebCore::CSSFontFaceSet::remove): Ditto.
(WebCore::CSSFontFaceSet::fontFace): Simplified code with extra local variables
to use an idiom that does not use hasValue. Since using *, ->, or value() on an
optional already asserts, there is no need to explicitly assert in the caller.
* css/CSSGradientValue.cpp:
(WebCore::GradientStop::isSpecified const): Use has_value.
* css/CSSSegmentedFontFace.cpp:
(WebCore::CSSSegmentedFontFace::fontRanges): Removed unneeded calls to hasValue.
* css/FontFace.cpp:
(WebCore::FontFace::family const): Use has_value.
(WebCore::FontFace::style const): Ditto.
(WebCore::FontFace::weight const): Ditto.
(WebCore::FontFace::stretch const): Ditto.
(WebCore::FontFace::unicodeRange const): Ditto.
(WebCore::FontFace::featureSettings const): Ditto.
(WebCore::FontFace::display const): Ditto.
* css/parser/CSSSelectorParser.cpp:
(WebCore::consumeANPlusB): Ditto.
* display/css/DisplayStyle.h: Ditto.
* dom/DataTransferItemList.h: Ditto.
* dom/Document.cpp:
(WebCore::Document::updateHighlightPositions): Ditto.
* dom/EventTarget.cpp:
(WebCore::EventTarget::addEventListener): Ditto.
* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::hasPendingCorrection const): Ditto.
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyInlineStyle): Don't call hasValue.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::captionDisplayMode): Ditto.
* html/ImageBitmap.h: Ditto.
* inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::setScreenSizeOverride): Use has_value.
* layout/LayoutPhase.cpp:
(WebCore::Layout::PhaseScope::PhaseScope): Ditto.
* layout/formattingContexts/inline/InlineContentBreaker.cpp:
(WebCore::Layout::InlineContentBreaker::tryBreakingTextRun const): Ditto.
* layout/formattingContexts/inline/InlineLine.h: Ditto.
* loader/CrossOriginPreflightResultCache.cpp:
(WebCore::parseAccessControlMaxAge): Ditto.
* page/EventHandler.cpp:
(WebCore::EventHandler::defaultWheelEventHandler): Ditto.
* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope): Ditto.
* page/scrolling/ScrollSnapOffsetsInfo.cpp:
(WebCore::closestSnapOffsetWithInfoAndAxis): Ditto.
* platform/ScrollController.cpp:
(WebCore::ScrollController::adjustScrollDestination): Don't use hasValue.
* platform/cocoa/SystemBattery.mm:
(WebCore::systemHasBattery): Use has_value.
(WebCore::systemHasAC): Use has_value.
* platform/graphics/Gradient.h: Ditto.
* platform/graphics/ImageSource.h: Ditto.
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::wouldTaintOrigin const): Changed idiom to not use hasValue.
* platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
(setGLContext): Do not use hasValue.
* platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
(WebCore::GStreamerRegistryScanner::ElementFactories::hasElementForMediaType const): Ditto.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::playbackPosition const): Ditto.
(WebCore::MediaPlayerPrivateGStreamer::performTaskAtMediaTime): Ditto.
(WebCore::MediaPlayerPrivateGStreamer::triggerRepaint): Ditto.
* platform/graphics/gstreamer/eme/CDMProxyThunder.cpp:
(WebCore::CDMProxyThunder::getDecryptionSession const): Use has_value.
* platform/graphics/gstreamer/eme/CDMThunder.cpp:
(WebCore::ParsedResponseMessage::hasType const): Use has_value.
(WebCore::CDMInstanceSessionThunder::cdmInstanceThunder const): Use
a pointer for the erturn value instead of Optional<&>. This hasn't
compiled since we switched to std::optional so I suspect this code is
not compiled by EWS or the buildbot.
* platform/graphics/gstreamer/eme/CDMThunder.h: Updated to match above.
* platform/graphics/gstreamer/mse/AppendPipeline.cpp:
(WebCore::AppendPipeline::parseDemuxerSrcPadCaps): Use value_or.
(WebCore::AppendPipeline::appsinkCapsChanged): Do not use has_value.
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::trackDetected): Ditto.
* platform/graphics/transforms/TransformState.h: Use has_value.
* platform/ios/VideoFullscreenInterfaceAVKit.mm:
(WebCore::supportsPictureInPicture): Ditto.
* platform/mac/NSScrollerImpDetails.mm:
(WebCore::ScrollerStyle::recommendedScrollerStyle): Ditto.
* platform/network/ResourceRequestBase.cpp:
(WebCore::ResourceRequestBase::isSystemPreview const): Ditto.
* platform/xr/openxr/OpenXRInputSource.cpp:
(PlatformXR::OpenXRInputSource::getInputSource const): Ditto.
* rendering/EventRegion.h: Ditto.
* rendering/GridTrackSizingAlgorithm.h: Remove unnecessary assertion, since
the * operator already does the assertion.
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::canComputePercentageFlexBasis): Use has_value.
* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::setExplicitValue): Ditto.
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::systemFocusRingColor): Ditto.
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::removeAnonymousWrappersForInlineChildrenIfNeeded): Ditto.
* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::createSVGTransformFromMatrix): Changed idiom to not
call hasValue.
* svg/SVGTransform.h: Ditto.
* testing/WebFakeXRDevice.cpp:
(WebCore::WebFakeXRDevice::setViews): Ditto.
Source/WebDriver:
* socket/SessionHostSocket.cpp:
(WebDriver::SessionHost::isConnected const): Use has_value.
Source/WebKit:
* Platform/IPC/ArgumentCoders.h: Use std::optional; there was no hasValue
in here and I edited it by mistake, but we want to do this eventually.
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: Removed using namespace WebCore.
(IPC::ArgumentCoder<Ref<WebCore::Font>>::decodePlatformData): Use has_value.
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
(WebKit::XPCServiceInitializerDelegate::getClientSDKVersion): Ditto.
* Shared/WebCoreArgumentCoders.cpp:
(IPC::decodeImage): Changed idiom to not call hasValue.
(IPC::ArgumentCoder<Ref<Font>>::decode): Ditto.
* Shared/mac/MediaFormatReader/MediaFormatReader.cpp:
(WebKit::MediaFormatReader::finishParsing): Use has_value.
(WebKit::MediaFormatReader::copyProperty): Ditto.
(WebKit::MediaFormatReader::copyTrackArray): Ditto.
* Shared/win/WebCoreArgumentCodersWin.cpp:
(IPC::ArgumentCoder<Ref<Font>>::decodePlatformData): Do not call hasValue.
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration encodeWithCoder:]): Changed idiom to not use hasValue.
* UIProcess/API/glib/InputMethodFilter.cpp:
(WebKit::InputMethodFilter::setState): Use has_value.
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::AutomationCommandError::toProtocolString): Changed idiom to not use hasValue.
* UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
(WebKit::WebPasteboardProxy::determineDataOwner const): Use has_value.
* UIProcess/Inspector/socket/RemoteInspectorClient.cpp:
(WebKit::RemoteInspectorClient::sendWebInspectorEvent): Changed idiom to not use hasValue.
* UIProcess/glib/UserMediaPermissionRequestManagerProxyGLib.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::platformValidateUserMediaRequestConstraints): Ditto.
* WebProcess/GPU/media/MediaSourcePrivateRemote.cpp:
(WebKit::MediaSourcePrivateRemote::addSourceBuffer): Use has_value.
* WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::platformDidReceiveLoadParameters): Ditto.
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::notifyPreferencesChanged): Changed idiom to not
call hasValue.
Source/WTF:
* wtf/Hasher.h: Use has_value.
* wtf/Optional.h: Remove hasValue macro. Not needed any more, but also a bit
dangerous because of how widespread the use of hasValue is for things other
than WTF::Optional.
Tools:
* TestWebKitAPI/Tests/WebCore/CBORReaderTest.cpp: Use has_value.
* TestWebKitAPI/Tests/WebCore/CBORWriterTest.cpp: Ditto.
* TestWebKitAPI/Tests/WebKitGLib/TestWebKitPolicyClient.cpp: Ditto.
* TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebView.cpp:
(AudioRenderingWebViewTest::handleStart): Ditto.
* WebKitTestRunner/GeolocationProviderMock.cpp:
(WTR::GeolocationProviderMock::setPosition): Ditto.
* WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
(-[TestRunnerWKWebView canPerformAction:withSender:]): Ditto.
Canonical link: https://commits.webkit.org/238281@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278244 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-29 22:08:56 +00:00
|
|
|
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)));
|
2012-10-03 21:45:50 +00:00
|
|
|
|
|
|
|
m_hasError = false;
|
|
|
|
m_errorMessage.clear();
|
|
|
|
|
2012-09-25 19:06:41 +00:00
|
|
|
sendPositionIfNeeded();
|
|
|
|
}
|
|
|
|
|
|
|
|
void GeolocationProviderMock::setPositionUnavailableError(WKStringRef errorMessage)
|
|
|
|
{
|
|
|
|
m_errorMessage = errorMessage;
|
|
|
|
m_hasError = true;
|
2012-10-03 21:45:50 +00:00
|
|
|
|
|
|
|
m_position.clear();
|
|
|
|
|
2012-09-25 19:06:41 +00:00
|
|
|
sendErrorIfNeeded();
|
2012-09-21 21:06:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GeolocationProviderMock::startUpdating(WKGeolocationManagerRef geolocationManager)
|
|
|
|
{
|
|
|
|
ASSERT_UNUSED(geolocationManager, geolocationManager == m_geolocationManager);
|
|
|
|
|
|
|
|
m_isActive = true;
|
2012-09-25 19:06:41 +00:00
|
|
|
sendPositionIfNeeded();
|
|
|
|
sendErrorIfNeeded();
|
2012-09-21 21:06:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GeolocationProviderMock::stopUpdating(WKGeolocationManagerRef geolocationManager)
|
|
|
|
{
|
|
|
|
ASSERT_UNUSED(geolocationManager, geolocationManager == m_geolocationManager);
|
|
|
|
|
|
|
|
m_isActive = false;
|
|
|
|
}
|
|
|
|
|
2012-09-25 19:06:41 +00:00
|
|
|
void GeolocationProviderMock::sendPositionIfNeeded()
|
|
|
|
{
|
2012-10-03 21:45:50 +00:00
|
|
|
if (m_isActive && m_position)
|
2012-09-25 19:06:41 +00:00
|
|
|
WKGeolocationManagerProviderDidChangePosition(m_geolocationManager, m_position.get());
|
|
|
|
}
|
|
|
|
|
|
|
|
void GeolocationProviderMock::sendErrorIfNeeded()
|
|
|
|
{
|
2012-10-03 21:45:50 +00:00
|
|
|
if (m_isActive && m_hasError)
|
2012-09-25 19:06:41 +00:00
|
|
|
WKGeolocationManagerProviderDidFailToDeterminePositionWithErrorMessage(m_geolocationManager, m_errorMessage.get());
|
|
|
|
}
|
|
|
|
|
2012-09-21 21:06:05 +00:00
|
|
|
} // namespace WTR
|