Change IDL enumerations to be nested in their C++ class instead of at WebCore namespa...
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 May 2016 05:47:34 +0000 (05:47 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 May 2016 05:47:34 +0000 (05:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=157257

Reviewed by Chris Dumez.

Source/WebCore:

Chris and Alex requested this alternate style, where the enum class for each enumeration
goes inside the class for the interface the enumeration is used in. Also made a rule that
keeps the names short and not redundant with the class name they are nested in.

* Modules/fetch/FetchOptions.h: Moved all the enum class types into the struct.

* Modules/fetch/FetchRequest.cpp:
(WebCore::setReferrerPolicy): Updated.
(WebCore::setMode): Ditto.
(WebCore::setCredentials): Ditto.
(WebCore::setCache): Ditto.
(WebCore::setRedirect): Ditto.
(WebCore::buildOptions): Ditto.
(WebCore::buildHeaders): Ditto.
(WebCore::FetchRequest::create): Ditto.
* Modules/fetch/FetchRequest.h: Used "using" to repeat the types from FetchOptions
here in FetchRequest. That way the generated bindings can find the types, and we don't
need to do any trick like [ImplementedAs] in thd IDL to make it work.

* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::error): Updated.
(WebCore::FetchResponse::redirect): Ditto.
(WebCore::FetchResponse::FetchResponse): Ditto.
(WebCore::FetchResponse::startFetching): Ditto.
* Modules/fetch/FetchResponse.h: Moved enum class into the class.

* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::externalDeviceType): Updated.
* Modules/mediacontrols/MediaControlsHost.h: Moved enum classs into the class.

* Modules/mediasession/MediaSession.cpp:
(WebCore::MediaSession::MediaSession): Updated.
* Modules/mediasession/MediaSession.h: Moved enum classs into the class.

* Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::addSourceBuffer): Updated.
(WebCore::MediaSource::removeSourceBuffer): Ditto.

* Modules/mediasource/MediaSource.h: Moved enum class into the class.

* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::sourceBufferPrivateDidReceiveRenderingError): Updated.
(WebCore::SourceBuffer::appendError): Ditto.
(WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample): Ditto.
(WebCore::SourceBuffer::textTrackModeChanged): Ditto.

* Modules/mediasource/SourceBuffer.h: Removed incorrect forward declaration
of EndOfStreamError that also now seems to be unneeded. Moved enum class into
the class.

* Modules/mediastream/MediaDeviceInfo.cpp:
(WebCore::MediaDeviceInfo::MediaDeviceInfo): Updated.
(WebCore::MediaDeviceInfo::create): Ditto.
* Modules/mediastream/MediaDeviceInfo.h: Moved enum class into the class.

* Modules/mediastream/MediaDevicesRequest.cpp:
(WebCore::MediaDevicesRequest::didCompleteTrackSourceInfoRequest): Updated.
* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::readyState): Updated.

* Modules/mediastream/MediaStreamTrack.h: Moved enum class into the class.

* Modules/mediastream/RTCConfiguration.h: Moved enum classes into the class.

* Modules/webaudio/AudioContext.h: Moved enum class into the class.

* Modules/webaudio/WaveShaperNode.cpp:
(WebCore::processorType): Updated.
(WebCore::WaveShaperNode::oversample): Ditto.
* Modules/webaudio/WaveShaperNode.h: Moved enum class into the class.

* bindings/js/JSXMLHttpRequestCustom.cpp:
(WebCore::JSXMLHttpRequest::response): Updated.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateGetOwnPropertySlotBody): Removed unneeded $interfaceName argument.
(GetAttributeGetterName): Ditto.
(GetAttributeSetterName): Ditto.
(GetFunctionName): Tweaked style.
(AttributeShouldBeOnInstanceForCompatibility): Deleted. Was a function that
always returned 0.
(AttributeShouldBeOnInstance): Removed the call to the function above.
(IsClassNameWordBoundary): Added. Helper for function below.
(IsPrefixRemovable): Ditto.
(GetEnumerationClassName): Added an $interface argument and changed this
so it creates a nested name inside the class rather than a top level name
for use at the WebCore namespace level.
(GetEnumerationClassIdentifier): Added. Calls GetEnumerationClassName and
makes a flattened name without "::" that can be used in an identifier.
(GenerateEnumerationImplementationContent): Renamed from GetXXX. Added an
$interface argument, so it can pass that along to the functions above.
(GenerateHeader): Updated to not pass $interfaceName.
(GeneratePropertiesHashTable): Ditto.
(GenerateOverloadedFunction): Removed unneeded $interfaceName argument.
(GenerateImplementation): Updated for changes above. Tweaked formatting.
(GenerateFunctionCastedThis): Removed unneeded $interfaceName argument.
(GenerateParametersCheck): Ditto. Also streamlined implementation a bit
and made the IsEnumType section call the new functions.
(GenerateCallbackImplementation): Ditto.
(JSValueToNative): Added an $interface argument and pass it along when
dealing with enumerations.
(GeneratePrototypeDeclaration): Removed unneeded $interfaceName argument.
(GenerateConstructorDeclaration): Ditto.
(GenerateConstructorDefinitions): Ditto.
(GenerateConstructorDefinition): Ditto.
(GenerateConstructorHelperMethods): Ditto.

* bindings/scripts/test/JS/JSTestObj.cpp: Regenerated.

* bindings/scripts/test/TestObj.idl: Added some new enums that test some
of the logic above.

* crypto/CryptoKey.cpp:
(WebCore::CryptoKey::CryptoKey): Updated.
(WebCore::CryptoKey::usages): Ditto.
* crypto/CryptoKey.h: Moved enum class types inside the CryptoKey class.
Added comments about the two similar but distinct types named
CryptoKeyUsage and CryptoKey::Usage.

* css/FontFace.cpp:
(WebCore::FontFace::status): Updated.
* css/FontFace.h: Moved enum class into the class.

* css/FontFaceSet.cpp:
(WebCore::FontFaceSet::status): Updated.
* css/FontFaceSet.h: Moved enum class into the class.

* dom/Document.cpp:
(WebCore::Document::Document): Updated for the name change back from
ReferrerHeaderPolicy to ReferrerPolicy.
(WebCore::Document::processReferrerPolicy): Ditto.
(WebCore::Document::applyContentDispositionAttachmentSandbox): Ditto.
* dom/Document.h: More of the same.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::loadInternal): Updated.
(WebCore::HTMLMediaElement::textTrackModeChanged): Ditto.
(WebCore::HTMLMediaElement::textTrackKindChanged): Ditto.
(WebCore::HTMLMediaElement::textTrackAddCues): Ditto.
(WebCore::HTMLMediaElement::textTrackAddCue): Ditto.
(WebCore::HTMLMediaElement::addTextTrack): Ditto.
(WebCore::HTMLMediaElement::configureTextTrackGroup): Ditto.
(WebCore::HTMLMediaElement::setSelectedTextTrack): Ditto.
(WebCore::HTMLMediaElement::configureTextTracks): Ditto.
(WebCore::HTMLMediaElement::hasClosedCaptions): Ditto.
(WebCore::HTMLMediaElement::configureTextTrackDisplay): Ditto.
(WebCore::HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured): Ditto.
(WebCore::toPlatform): Ditto.
(WebCore::HTMLMediaElement::outOfBandTrackSources): Ditto.
* html/HTMLTrackElement.cpp:
(WebCore::HTMLTrackElement::scheduleLoad): Ditto.

* html/HTMLVideoElement.h: Moved enum class into class.

* html/HTMLVideoElement.idl: Added the missing conditional on
VideoPresentationMode, and also moved it to the bottom of the file
to work around what is apparently a bug in the IDL parser.

* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::toWindRule): Updated.
(WebCore::CanvasRenderingContext2D::fill): Ditto.
(WebCore::CanvasRenderingContext2D::clip): Ditto.
(WebCore::CanvasRenderingContext2D::fillInternal): Ditto.
(WebCore::CanvasRenderingContext2D::clipInternal): Ditto.
(WebCore::CanvasRenderingContext2D::isPointInPath): Ditto.
(WebCore::CanvasRenderingContext2D::isPointInPathInternal): Ditto.
(WebCore::smoothingToInterpolationQuality): Ditto.

* html/canvas/CanvasRenderingContext2D.h: Moved enum class types into the class.

* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlClosedCaptionsTrackListElement::updateDisplay): Updated.
(WebCore::MediaControlTextTrackContainerElement::updateDisplay): Ditto.

* html/track/InbandTextTrack.cpp:
(WebCore::InbandTextTrack::setMode): Updated.
(WebCore::toPrivate): Ditto.
(WebCore::InbandTextTrack::setModeInternal): Ditto.
(WebCore::InbandTextTrack::updateKindFromPrivate): Ditto.
* html/track/InbandTextTrack.h: Ditto.
* html/track/TextTrack.cpp:
(WebCore::TextTrack::TextTrack): Ditto.
(WebCore::TextTrack::enabled): Ditto.
(WebCore::TextTrack::kindKeyword): Ditto.
(WebCore::TextTrack::setKind): Ditto.
(WebCore::TextTrack::setKindKeywordIgnoringASCIICase): Ditto.
(WebCore::TextTrack::setMode): Ditto.
(WebCore::TextTrack::cues): Ditto.
(WebCore::TextTrack::activeCues): Ditto.
(WebCore::TextTrack::addCue): Ditto.
(WebCore::TextTrack::regions): Ditto.
(WebCore::TextTrack::isRendered): Ditto.
(WebCore::TextTrack::isMainProgramContent): Ditto.
(WebCore::TextTrack::containsOnlyForcedSubtitles): Ditto.

* html/track/TextTrack.h: Moved enum class types into the class.

* html/track/TextTrackCue.cpp:
(WebCore::TextTrackCue::dispatchEvent): Updated.
(WebCore::TextTrackCue::isActive): Ditto.
* loader/FrameNetworkingContext.h: Ditto.
* page/CaptionUserPreferences.cpp:
(WebCore::CaptionUserPreferences::sortedTrackListForMenu): Ditto.
(WebCore::CaptionUserPreferences::textTrackSelectionScore): Ditto.
* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::CaptionUserPreferencesMediaAF::textTrackSelectionScore): Ditto.
(WebCore::CaptionUserPreferencesMediaAF::sortedTrackListForMenu): Ditto.

* page/SecurityPolicy.cpp:
(WebCore::SecurityPolicy::generateReferrerHeader): Updated since we
changed ReferrerHeaderPolicy back to ReferrerPolicy.
* page/SecurityPolicy.h: Ditto.

* platform/ReferrerPolicy.h: Changed ReferrerHeaderPolicy name back
to ReferrerPolicy now that nesting inside a class eliminated the conflict;
still should merge them and that FIXME remains.

* platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
(WebPlaybackSessionModelMediaElement::updateForEventName): Updated.
(WebPlaybackSessionModelMediaElement::updateLegibleOptions): Ditto.

* testing/Internals.cpp:
(WebCore::toResourceRequestCachePolicy): Updated.
(WebCore::Internals::setOverrideCachePolicy): Ditto.
(WebCore::toResourceLoadPriority): Ditto.
(WebCore::Internals::setOverrideResourceLoadPriority): Ditto.
(WebCore::toAutoFillButtonType): Ditto.
(WebCore::Internals::setShowAutoFillButton): Ditto.

* testing/Internals.h: Moved enum class types into class.

* testing/Internals.idl: Removed the "Internals" prefixes we added
to resolve ambiguity before. Nesting these in the class now takes care
of the ambiguity instead.

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::responseText): Updated.
(WebCore::XMLHttpRequest::didCacheResponseJSON): Ditto.
(WebCore::XMLHttpRequest::responseXML): Ditto.
(WebCore::XMLHttpRequest::responseBlob): Ditto.
(WebCore::XMLHttpRequest::responseArrayBuffer): Ditto.
(WebCore::XMLHttpRequest::setResponseType): Ditto.
(WebCore::XMLHttpRequest::open): Ditto.
(WebCore::shouldDecodeResponse): Ditto.

* xml/XMLHttpRequest.h: Moved the enum class into the class.

Source/WebKit2:

* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::loadResource): Updated since we changed
ReferrerHeaderPolicy back to ReferrerPolicy.
(WebKit::WebLoaderStrategy::schedulePluginStreamLoad): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200361 268f45cc-cd09-0410-ab3c-d52691b4dbfc

63 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/fetch/FetchOptions.h
Source/WebCore/Modules/fetch/FetchRequest.cpp
Source/WebCore/Modules/fetch/FetchRequest.h
Source/WebCore/Modules/fetch/FetchResponse.cpp
Source/WebCore/Modules/fetch/FetchResponse.h
Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp
Source/WebCore/Modules/mediacontrols/MediaControlsHost.h
Source/WebCore/Modules/mediasession/MediaSession.cpp
Source/WebCore/Modules/mediasession/MediaSession.h
Source/WebCore/Modules/mediasource/MediaSource.cpp
Source/WebCore/Modules/mediasource/MediaSource.h
Source/WebCore/Modules/mediasource/SourceBuffer.cpp
Source/WebCore/Modules/mediasource/SourceBuffer.h
Source/WebCore/Modules/mediastream/MediaDeviceInfo.cpp
Source/WebCore/Modules/mediastream/MediaDeviceInfo.h
Source/WebCore/Modules/mediastream/MediaDevicesRequest.cpp
Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp
Source/WebCore/Modules/mediastream/MediaStreamTrack.h
Source/WebCore/Modules/mediastream/RTCConfiguration.cpp
Source/WebCore/Modules/mediastream/RTCConfiguration.h
Source/WebCore/Modules/webaudio/AudioContext.h
Source/WebCore/Modules/webaudio/WaveShaperNode.cpp
Source/WebCore/Modules/webaudio/WaveShaperNode.h
Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/bindings/scripts/test/TestObj.idl
Source/WebCore/crypto/CryptoKey.cpp
Source/WebCore/crypto/CryptoKey.h
Source/WebCore/css/FontFace.cpp
Source/WebCore/css/FontFace.h
Source/WebCore/css/FontFaceSet.cpp
Source/WebCore/css/FontFaceSet.h
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLTrackElement.cpp
Source/WebCore/html/HTMLVideoElement.cpp
Source/WebCore/html/HTMLVideoElement.h
Source/WebCore/html/HTMLVideoElement.idl
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
Source/WebCore/html/canvas/CanvasRenderingContext2D.h
Source/WebCore/html/shadow/MediaControlElements.cpp
Source/WebCore/html/track/InbandTextTrack.cpp
Source/WebCore/html/track/InbandTextTrack.h
Source/WebCore/html/track/TextTrack.cpp
Source/WebCore/html/track/TextTrack.h
Source/WebCore/html/track/TextTrackCue.cpp
Source/WebCore/loader/FrameNetworkingContext.h
Source/WebCore/page/CaptionUserPreferences.cpp
Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp
Source/WebCore/page/SecurityPolicy.cpp
Source/WebCore/page/SecurityPolicy.h
Source/WebCore/platform/ReferrerPolicy.h
Source/WebCore/platform/cocoa/WebPlaybackSessionModelMediaElement.mm
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebCore/xml/XMLHttpRequest.cpp
Source/WebCore/xml/XMLHttpRequest.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp

index cc948ba..6b60e08 100644 (file)
@@ -1,3 +1,257 @@
+2016-05-02  Darin Adler  <darin@apple.com>
+
+        Change IDL enumerations to be nested in their C++ class instead of at WebCore namespace level
+        https://bugs.webkit.org/show_bug.cgi?id=157257
+
+        Reviewed by Chris Dumez.
+
+        Chris and Alex requested this alternate style, where the enum class for each enumeration
+        goes inside the class for the interface the enumeration is used in. Also made a rule that
+        keeps the names short and not redundant with the class name they are nested in.
+
+        * Modules/fetch/FetchOptions.h: Moved all the enum class types into the struct.
+
+        * Modules/fetch/FetchRequest.cpp:
+        (WebCore::setReferrerPolicy): Updated.
+        (WebCore::setMode): Ditto.
+        (WebCore::setCredentials): Ditto.
+        (WebCore::setCache): Ditto.
+        (WebCore::setRedirect): Ditto.
+        (WebCore::buildOptions): Ditto.
+        (WebCore::buildHeaders): Ditto.
+        (WebCore::FetchRequest::create): Ditto.
+        * Modules/fetch/FetchRequest.h: Used "using" to repeat the types from FetchOptions
+        here in FetchRequest. That way the generated bindings can find the types, and we don't
+        need to do any trick like [ImplementedAs] in thd IDL to make it work.
+
+        * Modules/fetch/FetchResponse.cpp:
+        (WebCore::FetchResponse::error): Updated.
+        (WebCore::FetchResponse::redirect): Ditto.
+        (WebCore::FetchResponse::FetchResponse): Ditto.
+        (WebCore::FetchResponse::startFetching): Ditto.
+        * Modules/fetch/FetchResponse.h: Moved enum class into the class.
+
+        * Modules/mediacontrols/MediaControlsHost.cpp:
+        (WebCore::MediaControlsHost::externalDeviceType): Updated.
+        * Modules/mediacontrols/MediaControlsHost.h: Moved enum classs into the class.
+
+        * Modules/mediasession/MediaSession.cpp:
+        (WebCore::MediaSession::MediaSession): Updated.
+        * Modules/mediasession/MediaSession.h: Moved enum classs into the class.
+
+        * Modules/mediasource/MediaSource.cpp:
+        (WebCore::MediaSource::addSourceBuffer): Updated.
+        (WebCore::MediaSource::removeSourceBuffer): Ditto.
+
+        * Modules/mediasource/MediaSource.h: Moved enum class into the class.
+
+        * Modules/mediasource/SourceBuffer.cpp:
+        (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveRenderingError): Updated.
+        (WebCore::SourceBuffer::appendError): Ditto.
+        (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample): Ditto.
+        (WebCore::SourceBuffer::textTrackModeChanged): Ditto.
+
+        * Modules/mediasource/SourceBuffer.h: Removed incorrect forward declaration
+        of EndOfStreamError that also now seems to be unneeded. Moved enum class into
+        the class.
+
+        * Modules/mediastream/MediaDeviceInfo.cpp:
+        (WebCore::MediaDeviceInfo::MediaDeviceInfo): Updated.
+        (WebCore::MediaDeviceInfo::create): Ditto.
+        * Modules/mediastream/MediaDeviceInfo.h: Moved enum class into the class.
+
+        * Modules/mediastream/MediaDevicesRequest.cpp:
+        (WebCore::MediaDevicesRequest::didCompleteTrackSourceInfoRequest): Updated.
+        * Modules/mediastream/MediaStreamTrack.cpp:
+        (WebCore::MediaStreamTrack::readyState): Updated.
+
+        * Modules/mediastream/MediaStreamTrack.h: Moved enum class into the class.
+
+        * Modules/mediastream/RTCConfiguration.h: Moved enum classes into the class.
+
+        * Modules/webaudio/AudioContext.h: Moved enum class into the class.
+
+        * Modules/webaudio/WaveShaperNode.cpp:
+        (WebCore::processorType): Updated.
+        (WebCore::WaveShaperNode::oversample): Ditto.
+        * Modules/webaudio/WaveShaperNode.h: Moved enum class into the class.
+
+        * bindings/js/JSXMLHttpRequestCustom.cpp:
+        (WebCore::JSXMLHttpRequest::response): Updated.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateGetOwnPropertySlotBody): Removed unneeded $interfaceName argument.
+        (GetAttributeGetterName): Ditto.
+        (GetAttributeSetterName): Ditto.
+        (GetFunctionName): Tweaked style.
+        (AttributeShouldBeOnInstanceForCompatibility): Deleted. Was a function that
+        always returned 0.
+        (AttributeShouldBeOnInstance): Removed the call to the function above.
+        (IsClassNameWordBoundary): Added. Helper for function below.
+        (IsPrefixRemovable): Ditto.
+        (GetEnumerationClassName): Added an $interface argument and changed this
+        so it creates a nested name inside the class rather than a top level name
+        for use at the WebCore namespace level.
+        (GetEnumerationClassIdentifier): Added. Calls GetEnumerationClassName and
+        makes a flattened name without "::" that can be used in an identifier.
+        (GenerateEnumerationImplementationContent): Renamed from GetXXX. Added an
+        $interface argument, so it can pass that along to the functions above.
+        (GenerateHeader): Updated to not pass $interfaceName.
+        (GeneratePropertiesHashTable): Ditto.
+        (GenerateOverloadedFunction): Removed unneeded $interfaceName argument.
+        (GenerateImplementation): Updated for changes above. Tweaked formatting.
+        (GenerateFunctionCastedThis): Removed unneeded $interfaceName argument.
+        (GenerateParametersCheck): Ditto. Also streamlined implementation a bit
+        and made the IsEnumType section call the new functions.
+        (GenerateCallbackImplementation): Ditto.
+        (JSValueToNative): Added an $interface argument and pass it along when
+        dealing with enumerations.
+        (GeneratePrototypeDeclaration): Removed unneeded $interfaceName argument.
+        (GenerateConstructorDeclaration): Ditto.
+        (GenerateConstructorDefinitions): Ditto.
+        (GenerateConstructorDefinition): Ditto.
+        (GenerateConstructorHelperMethods): Ditto.
+
+        * bindings/scripts/test/JS/JSTestObj.cpp: Regenerated.
+
+        * bindings/scripts/test/TestObj.idl: Added some new enums that test some
+        of the logic above.
+
+        * crypto/CryptoKey.cpp:
+        (WebCore::CryptoKey::CryptoKey): Updated.
+        (WebCore::CryptoKey::usages): Ditto.
+        * crypto/CryptoKey.h: Moved enum class types inside the CryptoKey class.
+        Added comments about the two similar but distinct types named
+        CryptoKeyUsage and CryptoKey::Usage.
+
+        * css/FontFace.cpp:
+        (WebCore::FontFace::status): Updated.
+        * css/FontFace.h: Moved enum class into the class.
+
+        * css/FontFaceSet.cpp:
+        (WebCore::FontFaceSet::status): Updated.
+        * css/FontFaceSet.h: Moved enum class into the class.
+
+        * dom/Document.cpp:
+        (WebCore::Document::Document): Updated for the name change back from
+        ReferrerHeaderPolicy to ReferrerPolicy.
+        (WebCore::Document::processReferrerPolicy): Ditto.
+        (WebCore::Document::applyContentDispositionAttachmentSandbox): Ditto.
+        * dom/Document.h: More of the same.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::loadInternal): Updated.
+        (WebCore::HTMLMediaElement::textTrackModeChanged): Ditto.
+        (WebCore::HTMLMediaElement::textTrackKindChanged): Ditto.
+        (WebCore::HTMLMediaElement::textTrackAddCues): Ditto.
+        (WebCore::HTMLMediaElement::textTrackAddCue): Ditto.
+        (WebCore::HTMLMediaElement::addTextTrack): Ditto.
+        (WebCore::HTMLMediaElement::configureTextTrackGroup): Ditto.
+        (WebCore::HTMLMediaElement::setSelectedTextTrack): Ditto.
+        (WebCore::HTMLMediaElement::configureTextTracks): Ditto.
+        (WebCore::HTMLMediaElement::hasClosedCaptions): Ditto.
+        (WebCore::HTMLMediaElement::configureTextTrackDisplay): Ditto.
+        (WebCore::HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured): Ditto.
+        (WebCore::toPlatform): Ditto.
+        (WebCore::HTMLMediaElement::outOfBandTrackSources): Ditto.
+        * html/HTMLTrackElement.cpp:
+        (WebCore::HTMLTrackElement::scheduleLoad): Ditto.
+
+        * html/HTMLVideoElement.h: Moved enum class into class.
+
+        * html/HTMLVideoElement.idl: Added the missing conditional on
+        VideoPresentationMode, and also moved it to the bottom of the file
+        to work around what is apparently a bug in the IDL parser.
+
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::toWindRule): Updated.
+        (WebCore::CanvasRenderingContext2D::fill): Ditto.
+        (WebCore::CanvasRenderingContext2D::clip): Ditto.
+        (WebCore::CanvasRenderingContext2D::fillInternal): Ditto.
+        (WebCore::CanvasRenderingContext2D::clipInternal): Ditto.
+        (WebCore::CanvasRenderingContext2D::isPointInPath): Ditto.
+        (WebCore::CanvasRenderingContext2D::isPointInPathInternal): Ditto.
+        (WebCore::smoothingToInterpolationQuality): Ditto.
+
+        * html/canvas/CanvasRenderingContext2D.h: Moved enum class types into the class.
+
+        * html/shadow/MediaControlElements.cpp:
+        (WebCore::MediaControlClosedCaptionsTrackListElement::updateDisplay): Updated.
+        (WebCore::MediaControlTextTrackContainerElement::updateDisplay): Ditto.
+
+        * html/track/InbandTextTrack.cpp:
+        (WebCore::InbandTextTrack::setMode): Updated.
+        (WebCore::toPrivate): Ditto.
+        (WebCore::InbandTextTrack::setModeInternal): Ditto.
+        (WebCore::InbandTextTrack::updateKindFromPrivate): Ditto.
+        * html/track/InbandTextTrack.h: Ditto.
+        * html/track/TextTrack.cpp:
+        (WebCore::TextTrack::TextTrack): Ditto.
+        (WebCore::TextTrack::enabled): Ditto.
+        (WebCore::TextTrack::kindKeyword): Ditto.
+        (WebCore::TextTrack::setKind): Ditto.
+        (WebCore::TextTrack::setKindKeywordIgnoringASCIICase): Ditto.
+        (WebCore::TextTrack::setMode): Ditto.
+        (WebCore::TextTrack::cues): Ditto.
+        (WebCore::TextTrack::activeCues): Ditto.
+        (WebCore::TextTrack::addCue): Ditto.
+        (WebCore::TextTrack::regions): Ditto.
+        (WebCore::TextTrack::isRendered): Ditto.
+        (WebCore::TextTrack::isMainProgramContent): Ditto.
+        (WebCore::TextTrack::containsOnlyForcedSubtitles): Ditto.
+
+        * html/track/TextTrack.h: Moved enum class types into the class.
+
+        * html/track/TextTrackCue.cpp:
+        (WebCore::TextTrackCue::dispatchEvent): Updated.
+        (WebCore::TextTrackCue::isActive): Ditto.
+        * loader/FrameNetworkingContext.h: Ditto.
+        * page/CaptionUserPreferences.cpp:
+        (WebCore::CaptionUserPreferences::sortedTrackListForMenu): Ditto.
+        (WebCore::CaptionUserPreferences::textTrackSelectionScore): Ditto.
+        * page/CaptionUserPreferencesMediaAF.cpp:
+        (WebCore::CaptionUserPreferencesMediaAF::textTrackSelectionScore): Ditto.
+        (WebCore::CaptionUserPreferencesMediaAF::sortedTrackListForMenu): Ditto.
+
+        * page/SecurityPolicy.cpp:
+        (WebCore::SecurityPolicy::generateReferrerHeader): Updated since we
+        changed ReferrerHeaderPolicy back to ReferrerPolicy.
+        * page/SecurityPolicy.h: Ditto.
+
+        * platform/ReferrerPolicy.h: Changed ReferrerHeaderPolicy name back
+        to ReferrerPolicy now that nesting inside a class eliminated the conflict;
+        still should merge them and that FIXME remains.
+
+        * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
+        (WebPlaybackSessionModelMediaElement::updateForEventName): Updated.
+        (WebPlaybackSessionModelMediaElement::updateLegibleOptions): Ditto.
+
+        * testing/Internals.cpp:
+        (WebCore::toResourceRequestCachePolicy): Updated.
+        (WebCore::Internals::setOverrideCachePolicy): Ditto.
+        (WebCore::toResourceLoadPriority): Ditto.
+        (WebCore::Internals::setOverrideResourceLoadPriority): Ditto.
+        (WebCore::toAutoFillButtonType): Ditto.
+        (WebCore::Internals::setShowAutoFillButton): Ditto.
+
+        * testing/Internals.h: Moved enum class types into class.
+
+        * testing/Internals.idl: Removed the "Internals" prefixes we added
+        to resolve ambiguity before. Nesting these in the class now takes care
+        of the ambiguity instead.
+
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::responseText): Updated.
+        (WebCore::XMLHttpRequest::didCacheResponseJSON): Ditto.
+        (WebCore::XMLHttpRequest::responseXML): Ditto.
+        (WebCore::XMLHttpRequest::responseBlob): Ditto.
+        (WebCore::XMLHttpRequest::responseArrayBuffer): Ditto.
+        (WebCore::XMLHttpRequest::setResponseType): Ditto.
+        (WebCore::XMLHttpRequest::open): Ditto.
+        (WebCore::shouldDecodeResponse): Ditto.
+
+        * xml/XMLHttpRequest.h: Moved the enum class into the class.
+
 2016-05-02  Simon Fraser  <simon.fraser@apple.com>
 
         Don't run transitions to/from 'auto' values
index 81f07d1..993d708 100644 (file)
 
 namespace WebCore {
 
-enum class ReferrerPolicy { EmptyString, NoReferrer, NoReferrerWhenDowngrade, OriginOnly, OriginWhenCrossOrigin, UnsafeUrl };
-enum class RequestCache { Default, NoStore, Reload, NoCache, ForceCache };
-enum class RequestCredentials { Omit, SameOrigin, Include };
-enum class RequestDestination { EmptyString, Document, Sharedworker, Subresource, Unknown, Worker };
-enum class RequestMode { Navigate, SameOrigin, NoCors, Cors };
-enum class RequestRedirect { Follow, Error, Manual };
-enum class RequestType { EmptyString, Audio, Font, Image, Script, Style, Track, Video };
-
 struct FetchOptions {
-    RequestType type { RequestType::EmptyString };
-    RequestDestination destination { RequestDestination::EmptyString };
-    RequestMode mode { RequestMode::NoCors };
-    RequestCredentials credentials { RequestCredentials::Omit };
-    RequestCache cache { RequestCache::Default };
-    RequestRedirect redirect { RequestRedirect::Follow };
+    enum class Type { EmptyString, Audio, Font, Image, Script, Style, Track, Video };
+    Type type { Type::EmptyString };
+
+    enum class Destination { EmptyString, Document, Sharedworker, Subresource, Unknown, Worker };
+    Destination destination { Destination::EmptyString };
+
+    enum class Mode { Navigate, SameOrigin, NoCors, Cors };
+    Mode mode { Mode::NoCors };
+
+    enum class Credentials { Omit, SameOrigin, Include };
+    Credentials credentials { Credentials::Omit };
+
+    enum class Cache { Default, NoStore, Reload, NoCache, ForceCache };
+    Cache cache { Cache::Default };
+
+    enum class Redirect { Follow, Error, Manual };
+    Redirect redirect { Redirect::Follow };
+
+    enum class ReferrerPolicy { EmptyString, NoReferrer, NoReferrerWhenDowngrade, OriginOnly, OriginWhenCrossOrigin, UnsafeUrl };
     ReferrerPolicy referrerPolicy { ReferrerPolicy::EmptyString };
 };
 
index 10f7c5c..303a811 100644 (file)
@@ -42,17 +42,17 @@ namespace WebCore {
 static bool setReferrerPolicy(FetchOptions& options, const String& referrerPolicy)
 {
     if (referrerPolicy.isEmpty())
-        options.referrerPolicy = ReferrerPolicy::EmptyString;
+        options.referrerPolicy = FetchOptions::ReferrerPolicy::EmptyString;
     else if (referrerPolicy == "no-referrer")
-        options.referrerPolicy = ReferrerPolicy::NoReferrer;
+        options.referrerPolicy = FetchOptions::ReferrerPolicy::NoReferrer;
     else if (referrerPolicy == "no-referrer-when-downgrade")
-        options.referrerPolicy = ReferrerPolicy::NoReferrerWhenDowngrade;
+        options.referrerPolicy = FetchOptions::ReferrerPolicy::NoReferrerWhenDowngrade;
     else if (referrerPolicy == "origin-only")
-        options.referrerPolicy = ReferrerPolicy::OriginOnly;
+        options.referrerPolicy = FetchOptions::ReferrerPolicy::OriginOnly;
     else if (referrerPolicy == "origin-when-cross-origin")
-        options.referrerPolicy = ReferrerPolicy::OriginWhenCrossOrigin;
+        options.referrerPolicy = FetchOptions::ReferrerPolicy::OriginWhenCrossOrigin;
     else if (referrerPolicy == "unsafe-url")
-        options.referrerPolicy = ReferrerPolicy::UnsafeUrl;
+        options.referrerPolicy = FetchOptions::ReferrerPolicy::UnsafeUrl;
     else
         return false;
     return true;
@@ -61,13 +61,13 @@ static bool setReferrerPolicy(FetchOptions& options, const String& referrerPolic
 static bool setMode(FetchOptions& options, const String& mode)
 {
     if (mode == "navigate")
-        options.mode = RequestMode::Navigate;
+        options.mode = FetchOptions::Mode::Navigate;
     else if (mode == "same-origin")
-        options.mode = RequestMode::SameOrigin;
+        options.mode = FetchOptions::Mode::SameOrigin;
     else if (mode == "no-cors")
-        options.mode = RequestMode::NoCors;
+        options.mode = FetchOptions::Mode::NoCors;
     else if (mode == "cors")
-        options.mode = RequestMode::Cors;
+        options.mode = FetchOptions::Mode::Cors;
     else
         return false;
     return true;
@@ -76,11 +76,11 @@ static bool setMode(FetchOptions& options, const String& mode)
 static bool setCredentials(FetchOptions& options, const String& credentials)
 {
     if (credentials == "omit")
-        options.credentials = RequestCredentials::Omit;
+        options.credentials = FetchOptions::Credentials::Omit;
     else if (credentials == "same-origin")
-        options.credentials = RequestCredentials::SameOrigin;
+        options.credentials = FetchOptions::Credentials::SameOrigin;
     else if (credentials == "include")
-        options.credentials = RequestCredentials::Include;
+        options.credentials = FetchOptions::Credentials::Include;
     else
         return false;
     return true;
@@ -89,15 +89,15 @@ static bool setCredentials(FetchOptions& options, const String& credentials)
 static bool setCache(FetchOptions& options, const String& cache)
 {
     if (cache == "default")
-        options.cache = RequestCache::Default;
+        options.cache = FetchOptions::Cache::Default;
     else if (cache == "no-store")
-        options.cache = RequestCache::NoStore;
+        options.cache = FetchOptions::Cache::NoStore;
     else if (cache == "reload")
-        options.cache = RequestCache::Reload;
+        options.cache = FetchOptions::Cache::Reload;
     else if (cache == "no-cache")
-        options.cache = RequestCache::NoCache;
+        options.cache = FetchOptions::Cache::NoCache;
     else if (cache == "force-cache")
-        options.cache = RequestCache::ForceCache;
+        options.cache = FetchOptions::Cache::ForceCache;
     else
         return false;
     return true;
@@ -106,11 +106,11 @@ static bool setCache(FetchOptions& options, const String& cache)
 static bool setRedirect(FetchOptions& options, const String& redirect)
 {
     if (redirect == "follow")
-        options.redirect = RequestRedirect::Follow;
+        options.redirect = FetchOptions::Redirect::Follow;
     else if (redirect == "error")
-        options.redirect = RequestRedirect::Error;
+        options.redirect = FetchOptions::Redirect::Error;
     else if (redirect == "manual")
-        options.redirect = RequestRedirect::Manual;
+        options.redirect = FetchOptions::Redirect::Manual;
     else
         return false;
     return true;
@@ -173,7 +173,7 @@ static bool buildOptions(FetchRequest::InternalRequest& request, ScriptExecution
 
     if (init.get("mode", value) && !setMode(request.options, value))
         return false;
-    if (request.options.mode == RequestMode::Navigate)
+    if (request.options.mode == FetchOptions::Mode::Navigate)
         return false;
 
     if (init.get("credentials", value) && !setCredentials(request.options, value))
@@ -196,7 +196,7 @@ static bool buildOptions(FetchRequest::InternalRequest& request, ScriptExecution
 static RefPtr<FetchHeaders> buildHeaders(const Dictionary& init, const FetchRequest::InternalRequest& request, const FetchHeaders* inputHeaders = nullptr)
 {
     FetchHeaders::Guard guard = FetchHeaders::Guard::Request;
-    if (request.options.mode == RequestMode::NoCors) {
+    if (request.options.mode == FetchOptions::Mode::NoCors) {
         const String& method = request.request.httpMethod();
         if (method != "GET" && method != "POST" && method != "HEAD")
             return nullptr;
@@ -244,8 +244,8 @@ RefPtr<FetchRequest> FetchRequest::create(ScriptExecutionContext& context, const
     }
 
     FetchRequest::InternalRequest internalRequest;
-    internalRequest.options.mode = RequestMode::Cors;
-    internalRequest.options.credentials = RequestCredentials::Omit;
+    internalRequest.options.mode = Mode::Cors;
+    internalRequest.options.credentials = Credentials::Omit;
     internalRequest.referrer = ASCIILiteral("client");
     internalRequest.request.setURL(requestURL);
 
index 5f54806..db4d220 100644 (file)
@@ -52,14 +52,29 @@ public:
     const String& url() const { return m_internalRequest.request.url().string(); }
     FetchHeaders& headers() { return m_headers.get(); }
 
-    RequestType type() const;
-    RequestDestination destination() const;
+    using Type = FetchOptions::Type;
+    Type type() const;
+
+    using Destination = FetchOptions::Destination;
+    Destination destination() const;
+
     String referrer() const;
+
+    using ReferrerPolicy = FetchOptions::ReferrerPolicy;
     ReferrerPolicy referrerPolicy() const;
-    RequestMode mode() const;
-    RequestCredentials credentials() const;
-    RequestCache cache() const;
-    RequestRedirect redirect() const;
+
+    using Mode = FetchOptions::Mode;
+    Mode mode() const;
+
+    using Credentials = FetchOptions::Credentials;
+    Credentials credentials() const;
+
+    using Cache = FetchOptions::Cache;
+    Cache cache() const;
+
+    using Redirect = FetchOptions::Redirect;
+    Redirect redirect() const;
+
     const String& integrity() const { return m_internalRequest.integrity; }
 
     RefPtr<FetchRequest> clone(ScriptExecutionContext&, ExceptionCode&);
@@ -92,37 +107,37 @@ inline FetchRequest::FetchRequest(ScriptExecutionContext& context, FetchBody&& b
 {
 }
 
-inline RequestCache FetchRequest::cache() const
+inline auto FetchRequest::cache() const -> Cache
 {
     return m_internalRequest.options.cache;
 }
 
-inline RequestCredentials FetchRequest::credentials() const
+inline auto FetchRequest::credentials() const -> Credentials
 {
     return m_internalRequest.options.credentials;
 }
 
-inline RequestDestination FetchRequest::destination() const
+inline auto FetchRequest::destination() const -> Destination
 {
     return m_internalRequest.options.destination;
 }
 
-inline RequestMode FetchRequest::mode() const
+inline auto FetchRequest::mode() const -> Mode
 {
     return m_internalRequest.options.mode;
 }
 
-inline RequestRedirect FetchRequest::redirect() const
+inline auto FetchRequest::redirect() const -> Redirect
 {
     return m_internalRequest.options.redirect;
 }
 
-inline ReferrerPolicy FetchRequest::referrerPolicy() const
+inline auto FetchRequest::referrerPolicy() const -> ReferrerPolicy
 {
     return m_internalRequest.options.referrerPolicy;
 }
 
-inline RequestType FetchRequest::type() const
+inline auto FetchRequest::type() const -> Type
 {
     return m_internalRequest.options.type;
 }
index 21a841f..35be243 100644 (file)
@@ -51,7 +51,7 @@ static inline bool isNullBodyStatus(int status)
 
 Ref<FetchResponse> FetchResponse::error(ScriptExecutionContext& context)
 {
-    return adoptRef(*new FetchResponse(context, ResponseType::Error, { }, FetchHeaders::create(FetchHeaders::Guard::Immutable), { }));
+    return adoptRef(*new FetchResponse(context, Type::Error, { }, FetchHeaders::create(FetchHeaders::Guard::Immutable), { }));
 }
 
 RefPtr<FetchResponse> FetchResponse::redirect(ScriptExecutionContext& context, const String& url, int status, ExceptionCode& ec)
@@ -66,7 +66,7 @@ RefPtr<FetchResponse> FetchResponse::redirect(ScriptExecutionContext& context, c
         ec = TypeError;
         return nullptr;
     }
-    auto redirectResponse = adoptRef(*new FetchResponse(context, ResponseType::Default, { }, FetchHeaders::create(FetchHeaders::Guard::Immutable), { }));
+    auto redirectResponse = adoptRef(*new FetchResponse(context, Type::Default, { }, FetchHeaders::create(FetchHeaders::Guard::Immutable), { }));
     redirectResponse->m_response.setHTTPStatusCode(status);
     redirectResponse->m_headers->fastSet(HTTPHeaderName::Location, requestURL.string());
     return WTFMove(redirectResponse);
@@ -109,7 +109,7 @@ void FetchResponse::initializeWith(const Dictionary& init, ExceptionCode& ec)
     }
 }
 
-FetchResponse::FetchResponse(ScriptExecutionContext& context, ResponseType type, FetchBody&& body, Ref<FetchHeaders>&& headers, ResourceResponse&& response)
+FetchResponse::FetchResponse(ScriptExecutionContext& context, Type type, FetchBody&& body, Ref<FetchHeaders>&& headers, ResourceResponse&& response)
     : FetchBodyOwner(context, WTFMove(body))
     , m_type(type)
     , m_response(WTFMove(response))
@@ -130,7 +130,7 @@ RefPtr<FetchResponse> FetchResponse::clone(ScriptExecutionContext& context, Exce
 
 void FetchResponse::startFetching(ScriptExecutionContext& context, const FetchRequest& request, FetchPromise&& promise)
 {
-    auto response = adoptRef(*new FetchResponse(context, ResponseType::Basic, FetchBody::loadingBody(), FetchHeaders::create(FetchHeaders::Guard::Immutable), ResourceResponse()));
+    auto response = adoptRef(*new FetchResponse(context, Type::Basic, FetchBody::loadingBody(), FetchHeaders::create(FetchHeaders::Guard::Immutable), ResourceResponse()));
 
     // Setting pending activity until BodyLoader didFail or didSucceed callback is called.
     response->setPendingActivity(response.ptr());
index d9ef38d..7e48b03 100644 (file)
@@ -46,11 +46,11 @@ class ReadableStreamSource;
 
 typedef int ExceptionCode;
 
-enum class ResponseType { Basic, Cors, Default, Error, Opaque, Opaqueredirect };
-
 class FetchResponse final : public FetchBodyOwner {
 public:
-    static Ref<FetchResponse> create(ScriptExecutionContext& context) { return adoptRef(*new FetchResponse(context, ResponseType::Default, { }, FetchHeaders::create(FetchHeaders::Guard::Response), ResourceResponse())); }
+    enum class Type { Basic, Cors, Default, Error, Opaque, Opaqueredirect };
+
+    static Ref<FetchResponse> create(ScriptExecutionContext& context) { return adoptRef(*new FetchResponse(context, Type::Default, { }, FetchHeaders::create(FetchHeaders::Guard::Response), ResourceResponse())); }
     static Ref<FetchResponse> error(ScriptExecutionContext&);
     static RefPtr<FetchResponse> redirect(ScriptExecutionContext&, const String&, int, ExceptionCode&);
 
@@ -60,7 +60,7 @@ public:
 
     void initializeWith(const Dictionary&, ExceptionCode&);
 
-    ResponseType type() const;
+    Type type() const;
     const String& url() const { return m_response.url().string(); }
     bool redirected() const { return m_isRedirected; }
     int status() const { return m_response.httpStatusCode(); }
@@ -76,7 +76,7 @@ public:
 #endif
 
 private:
-    FetchResponse(ScriptExecutionContext&, ResponseType, FetchBody&&, Ref<FetchHeaders>&&, ResourceResponse&&);
+    FetchResponse(ScriptExecutionContext&, Type, FetchBody&&, Ref<FetchHeaders>&&, ResourceResponse&&);
 
     static void startFetching(ScriptExecutionContext&, const FetchRequest&, FetchPromise&&);
 
@@ -109,14 +109,14 @@ private:
         std::unique_ptr<FetchLoader> m_loader;
     };
 
-    ResponseType m_type;
+    Type m_type;
     ResourceResponse m_response;
     Ref<FetchHeaders> m_headers;
     bool m_isRedirected = false;
     Optional<BodyLoader> m_bodyLoader;
 };
 
-inline ResponseType FetchResponse::type() const
+inline auto FetchResponse::type() const -> Type
 {
     return m_type;
 }
index 66c5f19..9112230 100644 (file)
@@ -233,7 +233,7 @@ String MediaControlsHost::externalDeviceDisplayName() const
 #endif
 }
 
-DeviceType MediaControlsHost::externalDeviceType() const
+auto MediaControlsHost::externalDeviceType() const -> DeviceType
 {
 #if !ENABLE(WIRELESS_PLAYBACK_TARGET)
     return DeviceType::None;
index c0a7829..4ba3ca3 100644 (file)
@@ -42,8 +42,6 @@ class MediaControlTextTrackContainerElement;
 class TextTrack;
 class TextTrackList;
 
-enum class DeviceType { None, Airplay, Tvout };
-
 class MediaControlsHost : public RefCounted<MediaControlsHost> {
 public:
     static Ref<MediaControlsHost> create(HTMLMediaElement*);
@@ -73,6 +71,8 @@ public:
     void exitedFullscreen();
 
     String externalDeviceDisplayName() const;
+
+    enum class DeviceType { None, Airplay, Tvout };
     DeviceType externalDeviceType() const;
 
     bool controlsDependOnPageScaleFactor() const;
index 780bd09..3a82166 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace WebCore {
 
-MediaSession::MediaSession(ScriptExecutionContext& context, MediaSessionKind kind)
+MediaSession::MediaSession(ScriptExecutionContext& context, Kind kind)
     : m_document(downcast<Document>(context))
     , m_kind(kind)
 {
index 67dd393..5110191 100644 (file)
@@ -36,20 +36,19 @@ class Dictionary;
 class Document;
 class HTMLMediaElement;
 
-enum class MediaSessionKind { Content, Transient, TransientSolo, Ambient };
-
 class MediaSession final : public RefCounted<MediaSession> {
 public:
+    enum class Kind { Content, Transient, TransientSolo, Ambient };
     enum class State { Idle, Active, Interrupted };
 
-    static Ref<MediaSession> create(ScriptExecutionContext& context, MediaSessionKind kind)
+    static Ref<MediaSession> create(ScriptExecutionContext& context, Kind kind)
     {
         return adoptRef(*new MediaSession(context, kind));
     }
 
     ~MediaSession();
 
-    MediaSessionKind kind() const { return m_kind; }
+    Kind kind() const { return m_kind; }
     MediaRemoteControls* controls();
 
     WEBCORE_EXPORT State currentState() const { return m_currentState; }
@@ -95,7 +94,7 @@ private:
     HashSet<HTMLMediaElement*>* m_iteratedActiveParticipatingElements { nullptr };
 
     Document& m_document;
-    const MediaSessionKind m_kind;
+    const Kind m_kind;
     RefPtr<MediaRemoteControls> m_controls;
     MediaSessionMetadata m_metadata;
 };
index 1a09c3e..4142879 100644 (file)
@@ -545,7 +545,7 @@ SourceBuffer* MediaSource::addSourceBuffer(const String& type, ExceptionCode& ec
     // ↳ Set the mode attribute on the new object to "sequence".
     // Otherwise:
     // ↳ Set the mode attribute on the new object to "segments".
-    buffer->setMode(shouldGenerateTimestamps ? AppendMode::Sequence : AppendMode::Segments, IGNORE_EXCEPTION);
+    buffer->setMode(shouldGenerateTimestamps ? SourceBuffer::AppendMode::Sequence : SourceBuffer::AppendMode::Segments, IGNORE_EXCEPTION);
 
     SourceBuffer* result = buffer.ptr();
 
@@ -671,7 +671,7 @@ void MediaSource::removeSourceBuffer(SourceBuffer& buffer, ExceptionCode& ec)
 
             // 9.3.2 If the mode attribute on the TextTrack object is set to "showing" or "hidden", then
             // set the removed enabled text track flag to true.
-            if (track->mode() == TextTrackMode::Showing || track->mode() == TextTrackMode::Hidden)
+            if (track->mode() == TextTrack::Mode::Showing || track->mode() == TextTrack::Mode::Hidden)
                 removedEnabledTextTrack = true;
 
             // 9.3.3 Remove the TextTrack object from the HTMLMediaElement textTracks list.
index 5971c86..19ba1a4 100644 (file)
@@ -48,8 +48,6 @@ namespace WebCore {
 
 class GenericEventQueue;
 
-enum class EndOfStreamError { Network, Decode };
-
 class MediaSource : public MediaSourcePrivateClient, public ActiveDOMObject, public EventTargetWithInlineData, public URLRegistrable {
 public:
     static void setRegistry(URLRegistry*);
@@ -69,6 +67,8 @@ public:
     bool isClosed() const;
     bool isEnded() const;
     void sourceBufferDidChangeActiveState(SourceBuffer&, bool);
+
+    enum class EndOfStreamError { Network, Decode };
     void streamEndedWithError(Optional<EndOfStreamError>);
 
     // MediaSourcePrivateClient
index bc4922b..cc2d3b8 100644 (file)
@@ -643,7 +643,7 @@ void SourceBuffer::sourceBufferPrivateDidReceiveRenderingError(SourceBufferPriva
     LOG(MediaSource, "SourceBuffer::sourceBufferPrivateDidReceiveRenderingError(%p) - result = %i", this, error);
 
     if (!isRemoved())
-        m_source->streamEndedWithError(EndOfStreamError::Decode);
+        m_source->streamEndedWithError(MediaSource::EndOfStreamError::Decode);
 }
 
 static bool decodeTimeComparator(const PresentationOrderSampleMap::MapType::value_type& a, const PresentationOrderSampleMap::MapType::value_type& b)
@@ -1270,7 +1270,7 @@ void SourceBuffer::appendError(bool decodeErrorParam)
 
     // 5. If decode error is true, then run the end of stream algorithm with the error parameter set to "decode".
     if (decodeErrorParam)
-        m_source->streamEndedWithError(EndOfStreamError::Decode);
+        m_source->streamEndedWithError(MediaSource::EndOfStreamError::Decode);
 }
 
 void SourceBuffer::sourceBufferPrivateDidReceiveSample(SourceBufferPrivate*, PassRefPtr<MediaSample> prpSample)
@@ -1421,7 +1421,7 @@ void SourceBuffer::sourceBufferPrivateDidReceiveSample(SourceBufferPrivate*, Pas
         MediaTime presentationStartTime = MediaTime::zeroTime();
         if (presentationTimestamp < presentationStartTime) {
             LOG(MediaSource, "SourceBuffer::sourceBufferPrivateDidReceiveSample(%p) - failing because presentationTimestamp < presentationStartTime", this);
-            m_source->streamEndedWithError(EndOfStreamError::Decode);
+            m_source->streamEndedWithError(MediaSource::EndOfStreamError::Decode);
             return;
         }
 
@@ -1674,7 +1674,7 @@ void SourceBuffer::textTrackModeChanged(TextTrack* track)
     // 2.4.5 Changes to selected/enabled track state
     // If a text track mode becomes "disabled" and the SourceBuffer associated with this track is not
     // associated with any other enabled or selected track, then run the following steps:
-    if (track->mode() == TextTrackMode::Disabled
+    if (track->mode() == TextTrack::Mode::Disabled
         && (!m_videoTracks || !m_videoTracks->isAnyTrackEnabled())
         && (!m_audioTracks || !m_audioTracks->isAnyTrackEnabled())
         && (!m_textTracks || !m_textTracks->isAnyTrackEnabled())) {
index 487dfc8..cb0dc8f 100644 (file)
@@ -58,10 +58,6 @@ class TextTrackList;
 class TimeRanges;
 class VideoTrackList;
 
-enum class EndOfStreamError;
-
-enum class AppendMode { Segments, Sequence };
-
 class SourceBuffer final : public RefCounted<SourceBuffer>, public ActiveDOMObject, public EventTargetWithInlineData, public SourceBufferPrivateClient, public AudioTrackClient, public VideoTrackClient, public TextTrackClient {
 public:
     static Ref<SourceBuffer> create(Ref<SourceBufferPrivate>&&, MediaSource*);
@@ -117,6 +113,7 @@ public:
 
     Document& document() const;
 
+    enum class AppendMode { Segments, Sequence };
     AppendMode mode() const { return m_mode; }
     void setMode(AppendMode, ExceptionCode&);
 
index 4b8278e..fe760d9 100644 (file)
@@ -30,7 +30,7 @@
 
 namespace WebCore {
 
-inline MediaDeviceInfo::MediaDeviceInfo(ScriptExecutionContext* context, const String& label, const String& deviceId, const String& groupId, MediaDeviceKind kind)
+inline MediaDeviceInfo::MediaDeviceInfo(ScriptExecutionContext* context, const String& label, const String& deviceId, const String& groupId, Kind kind)
     : ContextDestructionObserver(context)
     , m_label(label)
     , m_deviceId(deviceId)
@@ -39,7 +39,7 @@ inline MediaDeviceInfo::MediaDeviceInfo(ScriptExecutionContext* context, const S
 {
 }
 
-Ref<MediaDeviceInfo> MediaDeviceInfo::create(ScriptExecutionContext* context, const String& label, const String& deviceId, const String& groupId, MediaDeviceKind kind)
+Ref<MediaDeviceInfo> MediaDeviceInfo::create(ScriptExecutionContext* context, const String& label, const String& deviceId, const String& groupId, Kind kind)
 {
     return adoptRef(*new MediaDeviceInfo(context, label, deviceId, groupId, kind));
 }
index c659f52..fc68904 100644 (file)
 
 namespace WebCore {
 
-enum class MediaDeviceKind { Audioinput, Audiooutput, Videoinput };
-
 class MediaDeviceInfo : public RefCounted<MediaDeviceInfo>, public ScriptWrappable, private ContextDestructionObserver {
 public:
-    static Ref<MediaDeviceInfo> create(ScriptExecutionContext*, const String&, const String&, const String&, MediaDeviceKind);
+    enum class Kind { Audioinput, Audiooutput, Videoinput };
+
+    static Ref<MediaDeviceInfo> create(ScriptExecutionContext*, const String&, const String&, const String&, Kind);
 
     const String& label() const { return m_label; }
     const String& deviceId() const { return m_deviceId; }
     const String& groupId() const { return m_groupId; }
-    MediaDeviceKind kind() const { return m_kind; }
+    Kind kind() const { return m_kind; }
 
 private:
-    MediaDeviceInfo(ScriptExecutionContext*, const String&, const String&, const String&, MediaDeviceKind);
+    MediaDeviceInfo(ScriptExecutionContext*, const String&, const String&, const String&, Kind);
 
     const String m_label;
     const String m_deviceId;
     const String m_groupId;
-    const MediaDeviceKind m_kind;
+    const Kind m_kind;
 };
 
 typedef Vector<RefPtr<MediaDeviceInfo>> MediaDeviceInfoVector;
index 848ec80..1802cc5 100644 (file)
@@ -155,7 +155,7 @@ void MediaDevicesRequest::didCompleteTrackSourceInfoRequest(const TrackSourceInf
 
         String groupId = hashID(deviceInfo->groupId());
 
-        auto deviceType = deviceInfo->kind() == TrackSourceInfo::SourceKind::Audio ? MediaDeviceKind::Audioinput : MediaDeviceKind::Videoinput;
+        auto deviceType = deviceInfo->kind() == TrackSourceInfo::SourceKind::Audio ? MediaDeviceInfo::Kind::Audioinput : MediaDeviceInfo::Kind::Videoinput;
 
         devices.append(MediaDeviceInfo::create(scriptExecutionContext(), label, id, groupId, deviceType));
     }
index 15fc98e..3b392da 100644 (file)
@@ -111,9 +111,9 @@ bool MediaStreamTrack::remote() const
     return m_private->remote();
 }
 
-MediaStreamTrackState MediaStreamTrack::readyState() const
+auto MediaStreamTrack::readyState() const -> State
 {
-    return ended() ? MediaStreamTrackState::Ended : MediaStreamTrackState::Live;
+    return ended() ? State::Ended : State::Live;
 }
 
 bool MediaStreamTrack::ended() const
index c8dfae4..c99f4ce 100644 (file)
@@ -46,8 +46,6 @@ class MediaConstraintsImpl;
 class MediaSourceSettings;
 class MediaTrackConstraints;
 
-enum class MediaStreamTrackState { New, Live, Ended };
-
 class MediaStreamTrack final : public RefCounted<MediaStreamTrack>, public ActiveDOMObject, public EventTargetWithInlineData, private MediaStreamTrackPrivate::Observer {
 public:
     class Observer {
@@ -70,7 +68,8 @@ public:
     bool readonly() const;
     bool remote() const;
 
-    MediaStreamTrackState readyState() const;
+    enum class State { New, Live, Ended };
+    State readyState() const;
 
     bool ended() const;
 
index c9c988b..b9fa48f 100644 (file)
@@ -142,11 +142,11 @@ void RTCConfiguration::initialize(const Dictionary& configuration, ExceptionCode
     String iceTransportPolicy;
     if (configuration.get("iceTransportPolicy", iceTransportPolicy)) {
         if (iceTransportPolicy == "public")
-            m_iceTransportPolicy = RTCIceTransportPolicy::Public;
+            m_iceTransportPolicy = IceTransportPolicy::Public;
         else if (iceTransportPolicy == "relay")
-            m_iceTransportPolicy = RTCIceTransportPolicy::Relay;
+            m_iceTransportPolicy = IceTransportPolicy::Relay;
         else if (iceTransportPolicy == "all")
-            m_iceTransportPolicy = RTCIceTransportPolicy::All;
+            m_iceTransportPolicy = IceTransportPolicy::All;
         else {
             ec = TypeError;
             return;
@@ -156,11 +156,11 @@ void RTCConfiguration::initialize(const Dictionary& configuration, ExceptionCode
     String bundlePolicy;
     if (configuration.get("bundlePolicy", bundlePolicy)) {
         if (bundlePolicy == "balanced")
-            m_bundlePolicy = RTCBundlePolicy::Balanced;
+            m_bundlePolicy = BundlePolicy::Balanced;
         else if (bundlePolicy == "max-compat")
-            m_bundlePolicy = RTCBundlePolicy::MaxCompat;
+            m_bundlePolicy = BundlePolicy::MaxCompat;
         else if (bundlePolicy == "max-bundle")
-            m_bundlePolicy = RTCBundlePolicy::MaxBundle;
+            m_bundlePolicy = BundlePolicy::MaxBundle;
         else
             ec = TypeError;
     }
index 1402fed..e5b443b 100644 (file)
@@ -45,16 +45,17 @@ class Dictionary;
 
 typedef int ExceptionCode;
 
-enum class RTCBundlePolicy { Balanced, MaxCompat, MaxBundle };
-enum class RTCIceTransportPolicy { Public, Relay, All };
-
 class RTCConfiguration : public RefCounted<RTCConfiguration> {
 public:
     static RefPtr<RTCConfiguration> create(const Dictionary& configuration, ExceptionCode&);
     virtual ~RTCConfiguration() { }
 
-    RTCIceTransportPolicy iceTransportPolicy() const { return m_iceTransportPolicy; }
-    RTCBundlePolicy bundlePolicy() const { return m_bundlePolicy; }
+    enum class IceTransportPolicy { Public, Relay, All };
+    IceTransportPolicy iceTransportPolicy() const { return m_iceTransportPolicy; }
+
+    enum class BundlePolicy { Balanced, MaxCompat, MaxBundle };
+    BundlePolicy bundlePolicy() const { return m_bundlePolicy; }
+
     Vector<RefPtr<RTCIceServer>> iceServers() const { return m_iceServers; }
 
 private:
@@ -63,8 +64,8 @@ private:
     void initialize(const Dictionary& configuration, ExceptionCode&);
 
     Vector<RefPtr<RTCIceServer>> m_iceServers;
-    RTCIceTransportPolicy m_iceTransportPolicy { RTCIceTransportPolicy::All };
-    RTCBundlePolicy m_bundlePolicy { RTCBundlePolicy::Balanced };
+    IceTransportPolicy m_iceTransportPolicy { IceTransportPolicy::All };
+    BundlePolicy m_bundlePolicy { BundlePolicy::Balanced };
 };
 
 } // namespace WebCore
index b09da16..858f647 100644 (file)
@@ -71,8 +71,6 @@ class PeriodicWave;
 class ScriptProcessorNode;
 class WaveShaperNode;
 
-enum class AudioContextState { Suspended, Running, Interrupted, Closed };
-
 // AudioContext is the cornerstone of the web audio API and all AudioNodes are created from it.
 // For thread safety between the audio thread and the main thread, it has a rendering graph locking mechanism. 
 
@@ -117,7 +115,7 @@ public:
     void resume(Promise&&);
     void close(Promise&&);
 
-    using State = AudioContextState;
+    enum class State { Suspended, Running, Interrupted, Closed };
     State state() const;
 
     // The AudioNode create methods are called on the main thread (from JavaScript).
@@ -405,7 +403,7 @@ inline bool operator!=(const AudioContext& lhs, const AudioContext& rhs)
     return &lhs != &rhs;
 }
 
-inline AudioContextState AudioContext::state() const
+inline AudioContext::State AudioContext::state() const
 {
     return m_state;
 }
index ecd3f47..5ed6ba2 100644 (file)
@@ -54,14 +54,14 @@ Float32Array* WaveShaperNode::curve()
     return waveShaperProcessor()->curve();
 }
 
-static inline WaveShaperProcessor::OverSampleType processorType(OverSampleType type)
+static inline WaveShaperProcessor::OverSampleType processorType(WaveShaperNode::OverSampleType type)
 {
     switch (type) {
-    case OverSampleType::None:
+    case WaveShaperNode::OverSampleType::None:
         return WaveShaperProcessor::OverSampleNone;
-    case OverSampleType::_2x:
+    case WaveShaperNode::OverSampleType::_2x:
         return WaveShaperProcessor::OverSample2x;
-    case OverSampleType::_4x:
+    case WaveShaperNode::OverSampleType::_4x:
         return WaveShaperProcessor::OverSample4x;
     }
     ASSERT_NOT_REACHED();
@@ -77,7 +77,7 @@ void WaveShaperNode::setOversample(OverSampleType type)
     waveShaperProcessor()->setOversample(processorType(type));
 }
 
-OverSampleType WaveShaperNode::oversample() const
+auto WaveShaperNode::oversample() const -> OverSampleType
 {
     switch (const_cast<WaveShaperNode*>(this)->waveShaperProcessor()->oversample()) {
     case WaveShaperProcessor::OverSampleNone:
index 94f2596..c908373 100644 (file)
@@ -30,8 +30,6 @@
 
 namespace WebCore {
 
-enum class OverSampleType { None, _2x, _4x };
-
 class WaveShaperNode final : public AudioBasicProcessorNode {
 public:
     static Ref<WaveShaperNode> create(AudioContext& context)
@@ -43,6 +41,7 @@ public:
     void setCurve(Float32Array*);
     Float32Array* curve();
 
+    enum class OverSampleType { None, _2x, _4x };
     void setOversample(OverSampleType);
     OverSampleType oversample() const;
 
index 4b34f87..74ccb96 100644 (file)
@@ -189,8 +189,8 @@ JSValue JSXMLHttpRequest::response(ExecState& state) const
     auto type = wrapped().responseType();
 
     switch (type) {
-    case XMLHttpRequestResponseType::EmptyString:
-    case XMLHttpRequestResponseType::Text:
+    case XMLHttpRequest::ResponseType::EmptyString:
+    case XMLHttpRequest::ResponseType::Text:
         return responseText(state);
     default:
         break;
@@ -200,12 +200,12 @@ JSValue JSXMLHttpRequest::response(ExecState& state) const
         return jsNull();
 
     switch (type) {
-    case XMLHttpRequestResponseType::EmptyString:
-    case XMLHttpRequestResponseType::Text:
+    case XMLHttpRequest::ResponseType::EmptyString:
+    case XMLHttpRequest::ResponseType::Text:
         ASSERT_NOT_REACHED();
         break;
 
-    case XMLHttpRequestResponseType::Json:
+    case XMLHttpRequest::ResponseType::Json:
         {
             JSValue value = JSONParse(&state, wrapped().responseTextIgnoringResponseType());
             if (!value)
@@ -215,7 +215,7 @@ JSValue JSXMLHttpRequest::response(ExecState& state) const
             return value;
         }
 
-    case XMLHttpRequestResponseType::Document:
+    case XMLHttpRequest::ResponseType::Document:
         {
             ExceptionCode ec = 0;
             Document* document = wrapped().responseXML(ec);
@@ -226,10 +226,10 @@ JSValue JSXMLHttpRequest::response(ExecState& state) const
             return toJS(&state, globalObject(), document);
         }
 
-    case XMLHttpRequestResponseType::Blob:
+    case XMLHttpRequest::ResponseType::Blob:
         return toJS(&state, globalObject(), wrapped().responseBlob());
 
-    case XMLHttpRequestResponseType::Arraybuffer:
+    case XMLHttpRequest::ResponseType::Arraybuffer:
         return toJS(&state, globalObject(), wrapped().responseArrayBuffer());
     }
 
index 33a38d0..1e6cd2b 100644 (file)
@@ -321,7 +321,7 @@ sub IsDOMGlobalObject
 
 sub GenerateGetOwnPropertySlotBody
 {
-    my ($interface, $interfaceName, $className, $hasInstanceProperties, $inlined) = @_;
+    my ($interface, $className, $hasInstanceProperties, $inlined) = @_;
 
     my $namespaceMaybe = ($inlined ? "JSC::" : "");
     my $namedGetterFunction = GetNamedGetterFunction($interface);
@@ -511,35 +511,27 @@ sub ShouldGenerateToJSImplementation
 
 sub GetAttributeGetterName
 {
-    my ($interfaceName, $className, $interface, $attribute) = @_;
-    if ($attribute->isStatic) {
-        return $codeGenerator->WK_lcfirst($className) . "Constructor" . $codeGenerator->WK_ucfirst($attribute->signature->name);
-    }
-    if (IsJSBuiltin($interface, $attribute)) {
-        return GetJSBuiltinFunctionName($className, $attribute);
-    }
-    return "js" . $interfaceName . $codeGenerator->WK_ucfirst($attribute->signature->name) . ($attribute->signature->type =~ /Constructor$/ ? "Constructor" : "");
+    my ($interface, $className, $attribute) = @_;
+
+    return $codeGenerator->WK_lcfirst($className) . "Constructor" . $codeGenerator->WK_ucfirst($attribute->signature->name) if $attribute->isStatic;
+    return GetJSBuiltinFunctionName($className, $attribute) if IsJSBuiltin($interface, $attribute);
+    return "js" . $interface->name . $codeGenerator->WK_ucfirst($attribute->signature->name) . ($attribute->signature->type =~ /Constructor$/ ? "Constructor" : "");
 }
 
 sub GetAttributeSetterName
 {
-    my ($interfaceName, $className, $interface, $attribute) = @_;
-    if ($attribute->isStatic) {
-        return "set" . $codeGenerator->WK_ucfirst($className) . "Constructor" . $codeGenerator->WK_ucfirst($attribute->signature->name);
-    }
-    if (IsJSBuiltin($interface, $attribute)) {
-        return "set" . $codeGenerator->WK_ucfirst(GetJSBuiltinFunctionName($className, $attribute));
-    }
-    return "setJS" . $interfaceName . $codeGenerator->WK_ucfirst($attribute->signature->name) . ($attribute->signature->type =~ /Constructor$/ ? "Constructor" : "");
+    my ($interface, $className, $attribute) = @_;
+
+    return "set" . $codeGenerator->WK_ucfirst($className) . "Constructor" . $codeGenerator->WK_ucfirst($attribute->signature->name) if $attribute->isStatic;
+    return "set" . $codeGenerator->WK_ucfirst(GetJSBuiltinFunctionName($className, $attribute)) if IsJSBuiltin($interface, $attribute);
+    return "setJS" . $interface->name . $codeGenerator->WK_ucfirst($attribute->signature->name) . ($attribute->signature->type =~ /Constructor$/ ? "Constructor" : "");
 }
 
 sub GetFunctionName
 {
     my ($interface, $className, $function) = @_;
 
-    if (IsJSBuiltin($interface, $function)) {
-        return GetJSBuiltinFunctionName($className, $function);
-    }
+    return GetJSBuiltinFunctionName($className, $function) if IsJSBuiltin($interface, $function);
 
     my $functionName = $function->signature->name;
     $functionName = "SymbolIterator" if $functionName eq "[Symbol.Iterator]";
@@ -619,14 +611,6 @@ sub InterfaceRequiresAttributesOnInstance
     return 0;
 }
 
-sub AttributeShouldBeOnInstanceForCompatibility
-{
-    my $interface = shift;
-    my $attribute = shift;
-    my $interfaceName = $interface->name;
-    return 0;
-}
-
 sub AttributeShouldBeOnInstance
 {
     my $interface = shift;
@@ -642,8 +626,6 @@ sub AttributeShouldBeOnInstance
     # https://heycam.github.io/webidl/#Unforgeable
     return 1 if IsUnforgeable($interface, $attribute);
 
-    return 1 if AttributeShouldBeOnInstanceForCompatibility($interface, $attribute);
-
     if ($interface->extendedAttributes->{"CheckSecurity"}) {
         if ($attribute->signature->extendedAttributes->{"DoNotCheckSecurity"} or
             $attribute->signature->extendedAttributes->{"DoNotCheckSecurityOnGetter"}) {
@@ -813,33 +795,85 @@ sub GetImplClassName
     return $name;
 }
 
+sub IsClassNameWordBoundary
+{
+    my ($name, $i) = @_;
+
+    # Interpret negative numbers as distance from end of string, just as the substr function does.
+    $i += length($name) if $i < 0;
+
+    return 0 if $i < 0;
+    return 1 if $i == 0;
+    return 1 if $i == length($name);
+    return 0 if $i > length($name);
+
+    my $checkString = substr($name, $i - 1);
+    return $checkString =~ /^[^A-Z][A-Z]/ || $checkString =~ /^[A-Z][A-Z][^A-Z]/;
+}
+
+sub IsPrefixRemovable
+{
+    my ($class, $name, $i) = @_;
+
+    return IsClassNameWordBoundary($name, $i)
+        && (IsClassNameWordBoundary($class, $i) && substr($class, 0, $i) eq substr($name, 0, $i)
+            || IsClassNameWordBoundary($class, -$i) && substr($class, -$i) eq substr($name, 0, $i));
+}
+
 sub GetEnumerationClassName
 {
-    my ($name) = @_;
-    return $codeGenerator->WK_ucfirst($name);
-};
+    my ($interface, $name) = @_;
+
+    my $class = GetImplClassName($interface->name);
+    my $enum = $codeGenerator->WK_ucfirst($name);
+
+    # Since the enumeration name will be nested in the class name's namespace, remove any words
+    # that happen to match the start or end of the class name. If an enumeration is named TrackType or
+    # TextTrackType, and the class is named TextTrack, then we will get a name like TextTrack::Type.
+    my $enumLength = length($enum);
+    my $longestPrefixLength = 0;
+    if ($enum =~ /^[A-Z]./) {
+        for (my $i = 2; $i < $enumLength - 1; $i++) {
+            $longestPrefixLength = $i if IsPrefixRemovable($class, $enum, $i);
+        }
+    }
+    $enum = substr($enum, $longestPrefixLength);
+
+    return "${class}::$enum";
+}
+
+sub GetEnumerationClassIdentifier
+{
+    my ($interface, $name) = @_;
+
+    my $identifier = GetEnumerationClassName($interface, $name);
+    $identifier =~ s/:://;
+    return $identifier;
+}
 
 sub GetEnumerationValueName
 {
     my ($name) = @_;
+
     return "EmptyString" if $name eq "";
     $name = join("", map { $codeGenerator->WK_ucfirst($_) } split("-", $name));
     $name = "_$name" if $name =~ /^\d/;
     return $name;
-};
+}
 
-sub GetEnumerationImplementationContent
+sub GenerateEnumerationImplementationContent
 {
-    my ($enumerations) = @_;
+    my ($interface, $enumerations) = @_;
 
-    # FIXME: Could optimize this to only generate things that are used, which would require
-    # iterating over everything in the interface.
+    # FIXME: Could optimize this to only generate the parts of each enumeration that are actually
+    # used, which would require iterating over everything in the interface.
 
     my $result = "";
     foreach my $enumeration (@$enumerations) {
         my $name = $enumeration->name;
 
-        my $className = GetEnumerationClassName($name);
+        my $className = GetEnumerationClassName($interface, $name);
+        my $classIdentifier = GetEnumerationClassIdentifier($interface, $name);
 
         # FIXME: A little ugly to have this be a side effect instead of a return value.
         AddToImplIncludes("<runtime/JSString.h>");
@@ -850,8 +884,8 @@ sub GetEnumerationImplementationContent
         # Declare these instead of using "static" because these may be unused and we don't
         # want to get warnings about them.
         $result .= "JSString* jsStringWithCache(ExecState*, $className);\n";
-        $result .= "Optional<$className> parse$className(ExecState&, JSValue);\n";
-        $result .= "extern const char expectedEnumerationValues${className}[];\n\n";
+        $result .= "Optional<$className> parse$classIdentifier(ExecState&, JSValue);\n";
+        $result .= "extern const char expectedEnumerationValues${classIdentifier}[];\n\n";
 
         # Take an ExecState* instead of an ExecState& to match the jsStringWithCache from JSString.h.
         # FIXME: Change to take VM& instead of ExecState*.
@@ -885,7 +919,7 @@ sub GetEnumerationImplementationContent
         # FIXME: Change to take VM& instead of ExecState&.
         # FIXME: Consider using toStringOrNull to make exception checking faster.
         # FIXME: Consider finding a more efficient way to match against all the strings quickly.
-        $result .= "Optional<$className> parse$className(ExecState& state, JSValue value)\n";
+        $result .= "Optional<$className> parse$classIdentifier(ExecState& state, JSValue value)\n";
         $result .= "{\n";
         $result .= "    auto stringValue = value.toWTFString(&state);\n";
         foreach my $value (@{$enumeration->values}) {
@@ -900,7 +934,7 @@ sub GetEnumerationImplementationContent
         $result .= "    return Nullopt;\n";
         $result .= "}\n\n";
 
-        $result .= "const char expectedEnumerationValues${className}[] = \"\\\"" . join ("\\\", \\\"", @{$enumeration->values}) . "\\\"\";\n\n";
+        $result .= "const char expectedEnumerationValues${classIdentifier}[] = \"\\\"" . join ("\\\", \\\"", @{$enumeration->values}) . "\\\"\";\n\n";
 
         $result .= "#endif\n\n" if $conditionalString;
     }
@@ -1348,10 +1382,7 @@ sub GenerateHeader
 
     push(@headerContent, "\n");
 
-    # Add prototype declaration.
-    if (HeaderNeedsPrototypeDeclaration($interface)) {
-        GeneratePrototypeDeclaration(\@headerContent, $className, $interface, $interfaceName);
-    }
+    GeneratePrototypeDeclaration(\@headerContent, $className, $interface) if HeaderNeedsPrototypeDeclaration($interface);
 
     if ($hasForwardDeclaringFunctions) {
         my $inAppleCopyright = 0;
@@ -1389,10 +1420,10 @@ sub GenerateHeader
 
             my $conditionalString = $codeGenerator->GenerateConditionalString($attribute->signature);
             push(@headerContent, "#if ${conditionalString}\n") if $conditionalString;
-            my $getter = GetAttributeGetterName($interfaceName, $className, $interface, $attribute);
+            my $getter = GetAttributeGetterName($interface, $className, $attribute);
             push(@headerContent, "JSC::EncodedJSValue ${getter}(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);\n");
             if (!IsReadonly($attribute)) {
-                my $setter = GetAttributeSetterName($interfaceName, $className, $interface, $attribute);
+                my $setter = GetAttributeSetterName($interface, $className, $attribute);
                 push(@headerContent, "bool ${setter}(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);\n");
             }
             push(@headerContent, "#endif\n") if $conditionalString;
@@ -1458,13 +1489,13 @@ sub GeneratePropertiesHashTable
         my $special = GetJSCAttributesForAttribute($interface, $attribute);
         push(@$hashSpecials, $special);
 
-        my $getter = GetAttributeGetterName($interfaceName, $className, $interface, $attribute);
+        my $getter = GetAttributeGetterName($interface, $className, $attribute);
         push(@$hashValue1, $getter);
 
         if (IsReadonly($attribute)) {
             push(@$hashValue2, "0");
         } else {
-            my $setter = GetAttributeSetterName($interfaceName, $className, $interface, $attribute);
+            my $setter = GetAttributeSetterName($interface, $className, $attribute);
             push(@$hashValue2, $setter);
         }
 
@@ -1641,9 +1672,7 @@ sub LengthOfLongestFunctionParameterList
 
 sub GenerateOverloadedFunction
 {
-    my $function = shift;
-    my $interface = shift;
-    my $interfaceName = shift;
+    my ($function, $interface) = @_;
 
     # Generate code for choosing the correct overload to call. Overloads are
     # chosen based on the total number of arguments passed and the type of
@@ -1652,6 +1681,7 @@ sub GenerateOverloadedFunction
     # declaration in the IDL.
 
     my $kind = $function->isStatic ? "Constructor" : (OperationShouldBeOnInstance($interface, $function) ? "Instance" : "Prototype");
+    my $interfaceName = $interface->name;
     my $functionName = "js${interfaceName}${kind}Function" . $codeGenerator->WK_ucfirst($function->signature->name);
 
     # FIXME: Implement support for overloaded functions with variadic arguments.
@@ -1901,7 +1931,7 @@ sub GenerateImplementation
     push(@implContent, "\nusing namespace JSC;\n\n");
     push(@implContent, "namespace WebCore {\n\n");
 
-    push(@implContent, GetEnumerationImplementationContent($enumerations));
+    push(@implContent, GenerateEnumerationImplementationContent($interface, $enumerations));
 
     my @functions = @{$interface->functions};
     push(@functions, @{$interface->iterable->functions}) if $interface->iterable;
@@ -1949,10 +1979,10 @@ sub GenerateImplementation
 
             my $conditionalString = $codeGenerator->GenerateConditionalString($attribute->signature);
             push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
-            my $getter = GetAttributeGetterName($interfaceName, $className, $interface, $attribute);
+            my $getter = GetAttributeGetterName($interface, $className, $attribute);
             push(@implContent, "JSC::EncodedJSValue ${getter}(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);\n");
             if (!IsReadonly($attribute)) {
-                my $setter = GetAttributeSetterName($interfaceName, $className, $interface, $attribute);
+                my $setter = GetAttributeSetterName($interface, $className, $attribute);
                 push(@implContent, "bool ${setter}(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);\n");
             }
             push(@implContent, "#endif\n") if $conditionalString;
@@ -1969,16 +1999,9 @@ sub GenerateImplementation
         push(@implContent, "\n");
     }
 
-    # Add prototype declaration.
-    if (!HeaderNeedsPrototypeDeclaration($interface)) {
-        GeneratePrototypeDeclaration(\@implContent, $className, $interface, $interfaceName);
-    }
-
-    # Add constructor declaration
-    if (NeedsConstructorProperty($interface)) {
-        GenerateConstructorDeclaration(\@implContent, $className, $interface, $interfaceName);
-    }
+    GeneratePrototypeDeclaration(\@implContent, $className, $interface) if !HeaderNeedsPrototypeDeclaration($interface);
 
+    GenerateConstructorDeclaration(\@implContent, $className, $interface) if NeedsConstructorProperty($interface);
 
     my @hashKeys = ();
     my @hashValue1 = ();
@@ -2043,13 +2066,13 @@ sub GenerateImplementation
             my $special = (@specials > 0) ? join(" | ", @specials) : "0";
             push(@hashSpecials, $special);
 
-            my $getter = GetAttributeGetterName($interfaceName, $className, $interface, $attribute);
+            my $getter = GetAttributeGetterName($interface, $className, $attribute);
             push(@hashValue1, $getter);
 
             if (IsReadonly($attribute)) {
                 push(@hashValue2, "0");
             } else {
-                my $setter = GetAttributeSetterName($interfaceName, $className, $interface, $attribute);
+                my $setter = GetAttributeSetterName($interface, $className, $attribute);
                 push(@hashValue2, $setter);
             }
 
@@ -2091,9 +2114,9 @@ sub GenerateImplementation
         push(@implContent, $codeGenerator->GenerateCompileTimeCheckForEnumsIfNeeded($interface));
 
         my $protoClassName = "${className}Prototype";
-        GenerateConstructorDefinitions(\@implContent, $className, $protoClassName, $interfaceName, $visibleInterfaceName, $interface);
+        GenerateConstructorDefinitions(\@implContent, $className, $protoClassName, $visibleInterfaceName, $interface);
         if ($interface->extendedAttributes->{"NamedConstructor"}) {
-            GenerateConstructorDefinitions(\@implContent, $className, $protoClassName, $interfaceName, $interface->extendedAttributes->{"NamedConstructor"}, $interface, "GeneratingNamedConstructor");
+            GenerateConstructorDefinitions(\@implContent, $className, $protoClassName, $interface->extendedAttributes->{"NamedConstructor"}, $interface, "GeneratingNamedConstructor");
         }
     }
 
@@ -2280,8 +2303,8 @@ sub GenerateImplementation
             my $enable_function = GetRuntimeEnableFunctionName($attribute->signature);
             my $attributeName = $attribute->signature->name;
             push(@implContent, "    if (${enable_function}()) {\n");
-            my $getter = GetAttributeGetterName($interfaceName, $className, $interface, $attribute);
-            my $setter = IsReadonly($attribute) ? "nullptr" : GetAttributeSetterName($interfaceName, $className, $interface, $attribute);
+            my $getter = GetAttributeGetterName($interface, $className, $attribute);
+            my $setter = IsReadonly($attribute) ? "nullptr" : GetAttributeSetterName($interface, $className, $attribute);
             push(@implContent, "        auto* customGetterSetter = CustomGetterSetter::create(vm, $getter, $setter);\n");
             my $jscAttributes = GetJSCAttributesForAttribute($interface, $attribute);
             push(@implContent, "        putDirectCustomAccessor(vm, vm.propertyNames->$attributeName, customGetterSetter, attributesForStructure($jscAttributes));\n");
@@ -2340,7 +2363,7 @@ sub GenerateImplementation
             push(@implContent, "{\n");
             push(@implContent, "    auto* thisObject = jsCast<${className}*>(object);\n");
             push(@implContent, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");
-            push(@implContent, GenerateGetOwnPropertySlotBody($interface, $interfaceName, $className, $numInstanceProperties > 0, 0));
+            push(@implContent, GenerateGetOwnPropertySlotBody($interface, $className, $numInstanceProperties > 0, 0));
             push(@implContent, "}\n\n");
         }
 
@@ -2415,7 +2438,7 @@ sub GenerateImplementation
             my $name = $attribute->signature->name;
             my $type = $attribute->signature->type;
             $codeGenerator->AssertNotSequenceType($type);
-            my $getFunctionName = GetAttributeGetterName($interfaceName, $className, $interface, $attribute);
+            my $getFunctionName = GetAttributeGetterName($interface, $className, $attribute);
             my $implGetterFunctionName = $codeGenerator->WK_lcfirst($attribute->signature->extendedAttributes->{"ImplementedAs"} || $name);
             my $getterExceptionsWithMessage = $attribute->signature->extendedAttributes->{"GetterRaisesExceptionWithMessage"};
             my $getterExceptions = $attribute->signature->extendedAttributes->{"GetterRaisesException"} || $getterExceptionsWithMessage;
@@ -2720,7 +2743,7 @@ sub GenerateImplementation
 
             my $name = $attribute->signature->name;
             my $type = $attribute->signature->type;
-            my $putFunctionName = GetAttributeSetterName($interfaceName, $className, $interface, $attribute);
+            my $putFunctionName = GetAttributeSetterName($interface, $className, $attribute);
             my $implSetterFunctionName = $codeGenerator->WK_ucfirst($name);
             my $setterRaisesExceptionWithMessage = $attribute->signature->extendedAttributes->{"SetterRaisesExceptionWithMessage"};
             my $setterRaisesException = $attribute->signature->extendedAttributes->{"SetterRaisesException"} || $setterRaisesExceptionWithMessage;
@@ -2840,7 +2863,7 @@ sub GenerateImplementation
                     push(@implContent, "    };\n");
                 }
 
-                push(@implContent, "    " . GetNativeTypeFromSignature($attribute->signature) . " nativeValue = " . JSValueToNative($attribute->signature, "value", $attribute->signature->extendedAttributes->{"Conditional"}) . ";\n");
+                push(@implContent, "    " . GetNativeTypeFromSignature($attribute->signature) . " nativeValue = " . JSValueToNative($interface, $attribute->signature, "value", $attribute->signature->extendedAttributes->{"Conditional"}) . ";\n");
                 push(@implContent, "    if (UNLIKELY(state->hadException()))\n");
                 push(@implContent, "        return false;\n");
 
@@ -3048,11 +3071,11 @@ END
                     }
 
                     my $numParameters = @{$function->parameters};
-                    my ($functionString, $dummy) = GenerateParametersCheck(\@implContent, $function, $interface, $numParameters, $interfaceName, $functionImplementationName, $svgPropertyType, $svgPropertyOrListPropertyType, $svgListPropertyType);
+                    my ($functionString, $dummy) = GenerateParametersCheck(\@implContent, $function, $interface, $numParameters, $functionImplementationName, $svgPropertyType, $svgPropertyOrListPropertyType, $svgListPropertyType);
                     GenerateImplementationFunctionCall($function, $functionString, "    ", $svgPropertyType, $interfaceName);
                 }
             } else {
-                GenerateFunctionCastedThis($interface, $interfaceName, $className, $function);
+                GenerateFunctionCastedThis($interface, $className, $function);
 
                 if ($interface->extendedAttributes->{"CheckSecurity"} and
                     !$function->signature->extendedAttributes->{"DoNotCheckSecurity"}) {
@@ -3102,7 +3125,7 @@ END
                         }
 
                         my $numParameters = @{$function->parameters};
-                        my ($functionString, $dummy) = GenerateParametersCheck(\@implContent, $function, $interface, $numParameters, $interfaceName, $functionImplementationName, $svgPropertyType, $svgPropertyOrListPropertyType, $svgListPropertyType);
+                        my ($functionString, $dummy) = GenerateParametersCheck(\@implContent, $function, $interface, $numParameters, $functionImplementationName, $svgPropertyType, $svgPropertyOrListPropertyType, $svgListPropertyType);
                         GenerateImplementationFunctionCall($function, $functionString, "    ", $svgPropertyType, $interfaceName);
                     }
                 }
@@ -3111,11 +3134,8 @@ END
             push(@implContent, "}\n\n");
             push(@implContent, "#endif\n\n") if $conditional;
 
-            if (!$isCustom && $isOverloaded && $function->{overloadIndex} == @{$function->{overloads}}) {
-                # Generate a function dispatching call to the rest of the overloads.
-                GenerateOverloadedFunction($function, $interface, $interfaceName);
-            }
-
+            # Generate a function dispatching call to the rest of the overloads.
+            GenerateOverloadedFunction($function, $interface) if !$isCustom && $isOverloaded && $function->{overloadIndex} == @{$function->{overloads}};
         }
 
         push(@implContent, $endAppleCopyright) if $inAppleCopyright;
@@ -3361,10 +3381,8 @@ END
 
 sub GenerateFunctionCastedThis
 {
-    my $interface = shift;
-    my $interfaceName = shift;
-    my $className = shift;
-    my $function = shift;
+    my ($interface, $className, $function) = @_;
+
     if ($interface->extendedAttributes->{"CustomProxyToJSObject"}) {
         push(@implContent, "    $className* castedThis = to${className}(state->thisValue().toThis(state, NotStrictMode));\n");
         push(@implContent, "    if (UNLIKELY(!castedThis))\n");
@@ -3372,6 +3390,7 @@ sub GenerateFunctionCastedThis
     } else {
         push(@implContent, "    JSValue thisValue = state->thisValue();\n");
         my $castingHelper = GetCastingHelperForThisObject($interface);
+        my $interfaceName = $interface->name;
         if ($interfaceName eq "EventTarget") {
             # We allow calling the EventTarget API without an explicit 'this' value and fall back to using the global object instead.
             # As of early 2016, this matches Firefox and Chrome's behavior.
@@ -3384,7 +3403,7 @@ sub GenerateFunctionCastedThis
         push(@implContent, "        return throwThisTypeError(*state, \"$interfaceName\", \"$domFunctionName\");\n");
     }
 
-    push(@implContent, "    ASSERT_GC_OBJECT_INHERITS(castedThis, ${className}::info());\n") unless $interfaceName eq "EventTarget";
+    push(@implContent, "    ASSERT_GC_OBJECT_INHERITS(castedThis, ${className}::info());\n") unless $interface->name eq "EventTarget";
 }
 
 sub GenerateCallWith
@@ -3493,20 +3512,9 @@ sub WillConvertUndefinedToDefaultParameterValue
 
 sub GenerateParametersCheck
 {
-    my $outputArray = shift;
-    my $function = shift;
-    my $interface = shift;
-    my $numParameters = shift;
-    my $interfaceName = shift;
-    my $functionImplementationName = shift;
-    my $svgPropertyType = shift;
-    my $svgPropertyOrListPropertyType = shift;
-    my $svgListPropertyType = shift;
-
-    my $argsIndex = 0;
-    my $hasOptionalArguments = 0;
+    my ($outputArray, $function, $interface, $numParameters, $functionImplementationName, $svgPropertyType, $svgPropertyOrListPropertyType, $svgListPropertyType) = @_;
 
-    my $className = $interface->name;
+    my $interfaceName = $interface->name;
     my @arguments;
     my $functionName;
     my $implementedBy = $function->signature->extendedAttributes->{"ImplementedBy"};
@@ -3533,6 +3541,8 @@ sub GenerateParametersCheck
 
     $implIncludes{"ExceptionCode.h"} = 1;
     $implIncludes{"JSDOMBinding.h"} = 1;
+
+    my $argsIndex = 0;
     foreach my $parameter (@{$function->parameters}) {
         my $argType = $parameter->type;
         my $optional = $parameter->isOptional;
@@ -3625,7 +3635,9 @@ sub GenerateParametersCheck
                 push(@$outputArray, "        return JSValue::encode(jsUndefined());\n");
             }
         } elsif ($codeGenerator->IsEnumType($argType)) {
-            my $className = GetEnumerationClassName($argType);
+            my $className = GetEnumerationClassName($interface, $argType);
+            my $classIdentifier = GetEnumerationClassIdentifier($interface, $argType);
+
             $implIncludes{"<runtime/Error.h>"} = 1;
 
             my $nativeType = $className;
@@ -3652,11 +3664,11 @@ sub GenerateParametersCheck
                 $indent = "    ";
             }
 
-            push(@$outputArray, "$indent    $defineOptionalValue = parse$className(*state, ${name}Value);\n");
+            push(@$outputArray, "$indent    $defineOptionalValue = parse$classIdentifier(*state, ${name}Value);\n");
             push(@$outputArray, "$indent    if (UNLIKELY(state->hadException()))\n");
             push(@$outputArray, "$indent        return JSValue::encode(jsUndefined());\n");
             push(@$outputArray, "$indent    if (UNLIKELY(!$optionalValue))\n");
-            push(@$outputArray, "$indent        return throwArgumentMustBeEnumError(*state, $argsIndex, \"$name\", \"$interfaceName\", $quotedFunctionName, expectedEnumerationValues$className);\n");
+            push(@$outputArray, "$indent        return throwArgumentMustBeEnumError(*state, $argsIndex, \"$name\", \"$interfaceName\", $quotedFunctionName, expectedEnumerationValues$classIdentifier);\n");
             push(@$outputArray, "$indent    $name = optionalValue.value();\n") if $optionalValue ne $name;
 
             push(@$outputArray, "    }\n") if $indent ne "";
@@ -3719,7 +3731,7 @@ sub GenerateParametersCheck
                     $outer = "";
                     $inner = "state->argument($argsIndex)";
                 }
-                push(@$outputArray, "    $nativeType $name = $outer" . JSValueToNative($parameter, $inner, $function->signature->extendedAttributes->{"Conditional"}) . ";\n");
+                push(@$outputArray, "    $nativeType $name = $outer" . JSValueToNative($interface, $parameter, $inner, $function->signature->extendedAttributes->{"Conditional"}) . ";\n");
             }
 
             # Check if the type conversion succeeded.
@@ -3862,7 +3874,7 @@ sub GenerateCallbackImplementation
     push(@implContent, "\nusing namespace JSC;\n\n");
     push(@implContent, "namespace WebCore {\n\n");
 
-    push(@implContent, GetEnumerationImplementationContent($enumerations));
+    push(@implContent, GenerateEnumerationImplementationContent($interface, $enumerations));
 
     # Constructor
     push(@implContent, "${className}::${className}(JSObject* callback, JSDOMGlobalObject* globalObject)\n");
@@ -3939,7 +3951,7 @@ sub GenerateCallbackImplementation
 
        push(@implContent, $codeGenerator->GenerateCompileTimeCheckForEnumsIfNeeded($interface));
 
-       GenerateConstructorDefinitions(\@implContent, $className, "", $interfaceName, $visibleInterfaceName, $interface);
+       GenerateConstructorDefinitions(\@implContent, $className, "", $visibleInterfaceName, $interface);
 
        push(@implContent, "JSValue ${className}::getConstructor(VM& vm, const JSGlobalObject* globalObject)\n{\n");
        push(@implContent, "    return getDOMConstructor<${className}Constructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));\n");
@@ -4317,9 +4329,7 @@ my %integerConversionFunction = (
 
 sub JSValueToNative
 {
-    my $signature = shift;
-    my $value = shift;
-    my $conditional = shift;
+    my ($interface, $signature, $value, $conditional) = @_;
 
     my $type = $signature->type;
 
@@ -4368,7 +4378,7 @@ sub JSValueToNative
     return "valueToDate(state, $value)" if $type eq "Date";
 
     return "to$type($value)" if $codeGenerator->IsTypedArrayType($type);
-    return "parse" . GetEnumerationClassName($type) . "(*state, $value)" if $codeGenerator->IsEnumType($type);
+    return "parse" . GetEnumerationClassIdentifier($interface, $type) . "(*state, $value)" if $codeGenerator->IsEnumType($type);
 
     AddToImplIncludes("JS$type.h", $conditional);
 
@@ -4747,10 +4757,7 @@ sub WriteData
 
 sub GeneratePrototypeDeclaration
 {
-    my $outputArray = shift;
-    my $className = shift;
-    my $interface = shift;
-    my $interfaceName = shift;
+    my ($outputArray, $className, $interface) = @_;
 
     my $prototypeClassName = "${className}Prototype";
 
@@ -4826,11 +4833,9 @@ sub GetConstructorTemplateClassName
 
 sub GenerateConstructorDeclaration
 {
-    my $outputArray = shift;
-    my $className = shift;
-    my $interface = shift;
-    my $interfaceName = shift;
+    my ($outputArray, $className, $interface) = @_;
 
+    my $interfaceName = $interface->name;
     my $constructorClassName = "${className}Constructor";
     my $templateClassName = GetConstructorTemplateClassName($interface);
 
@@ -4843,29 +4848,23 @@ sub GenerateConstructorDeclaration
 
 sub GenerateConstructorDefinitions
 {
-    my $outputArray = shift;
-    my $className = shift;
-    my $protoClassName = shift;
-    my $interfaceName = shift;
-    my $visibleInterfaceName = shift;
-    my $interface = shift;
-    my $generatingNamedConstructor = shift;
+    my ($outputArray, $className, $protoClassName, $visibleInterfaceName, $interface, $generatingNamedConstructor) = @_;
 
     if (IsConstructable($interface)) {
         my @constructors = @{$interface->constructors};
         if (@constructors > 1) {
             foreach my $constructor (@constructors) {
-                GenerateConstructorDefinition($outputArray, $className, $protoClassName, $interfaceName, $visibleInterfaceName, $interface, $generatingNamedConstructor, $constructor);
+                GenerateConstructorDefinition($outputArray, $className, $protoClassName, $visibleInterfaceName, $interface, $generatingNamedConstructor, $constructor);
             }
             GenerateOverloadedConstructorDefinition($outputArray, $className, $interface);
         } elsif (@constructors == 1) {
-            GenerateConstructorDefinition($outputArray, $className, $protoClassName, $interfaceName, $visibleInterfaceName, $interface, $generatingNamedConstructor, $constructors[0]);
+            GenerateConstructorDefinition($outputArray, $className, $protoClassName, $visibleInterfaceName, $interface, $generatingNamedConstructor, $constructors[0]);
         } else {
-            GenerateConstructorDefinition($outputArray, $className, $protoClassName, $interfaceName, $visibleInterfaceName, $interface, $generatingNamedConstructor);
+            GenerateConstructorDefinition($outputArray, $className, $protoClassName, $visibleInterfaceName, $interface, $generatingNamedConstructor);
         }
     }
 
-    GenerateConstructorHelperMethods($outputArray, $className, $protoClassName, $interfaceName, $visibleInterfaceName, $interface, $generatingNamedConstructor);
+    GenerateConstructorHelperMethods($outputArray, $className, $protoClassName, $visibleInterfaceName, $interface, $generatingNamedConstructor);
 }
 
 sub GenerateOverloadedConstructorDefinition
@@ -4915,19 +4914,11 @@ END
 
 sub GenerateConstructorDefinition
 {
-    my $outputArray = shift;
-    my $className = shift;
-    my $protoClassName = shift;
-    my $interfaceName = shift;
-    my $visibleInterfaceName = shift;
-    my $interface = shift;
-    my $generatingNamedConstructor = shift;
-    my $function = shift;
+    my ($outputArray, $className, $protoClassName, $visibleInterfaceName, $interface, $generatingNamedConstructor, $function) = @_;
 
-    if (IsJSBuiltinConstructor($interface)) {
-        return;
-    }
+    return if IsJSBuiltinConstructor($interface);
 
+    my $interfaceName = $interface->name;
     my $constructorClassName = $generatingNamedConstructor ? "${className}NamedConstructor" : "${className}Constructor";
 
     if (IsConstructable($interface)) {
@@ -5040,7 +5031,7 @@ END
             # FIXME: For now, we do not support SVG constructors.
             # FIXME: Currently [Constructor(...)] does not yet support optional arguments without [Default=...]
             my $numParameters = @{$function->parameters};
-            my ($dummy, $paramIndex) = GenerateParametersCheck($outputArray, $function, $interface, $numParameters, $interfaceName, "constructorCallback", undef, undef, undef);
+            my ($dummy, $paramIndex) = GenerateParametersCheck($outputArray, $function, $interface, $numParameters, "constructorCallback", undef, undef, undef);
 
             if ($codeGenerator->ExtendedAttributeContains($interface->extendedAttributes->{"ConstructorCallWith"}, "ScriptState")) {
                 push(@constructorArgList, "*state");
@@ -5126,13 +5117,7 @@ sub ConstructorHasProperties
 
 sub GenerateConstructorHelperMethods
 {
-    my $outputArray = shift;
-    my $className = shift;
-    my $protoClassName = shift;
-    my $interfaceName = shift;
-    my $visibleInterfaceName = shift;
-    my $interface = shift;
-    my $generatingNamedConstructor = shift;
+    my ($outputArray, $className, $protoClassName, $visibleInterfaceName, $interface, $generatingNamedConstructor) = @_;
 
     my $constructorClassName = $generatingNamedConstructor ? "${className}NamedConstructor" : "${className}Constructor";
     my $leastConstructorLength = 0;
@@ -5183,14 +5168,8 @@ sub GenerateConstructorHelperMethods
     }
 
     push(@$outputArray, "    putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral(\"$visibleInterfaceName\"))), ReadOnly | DontEnum);\n");
-
-    if (defined $leastConstructorLength) {
-        push(@$outputArray, "    putDirect(vm, vm.propertyNames->length, jsNumber(${leastConstructorLength}), ReadOnly | DontEnum);\n");
-    }
-
-    if (ConstructorHasProperties($interface)) {
-        push(@$outputArray, "    reifyStaticProperties(vm, ${className}ConstructorTableValues, *this);\n");
-    }
+    push(@$outputArray, "    putDirect(vm, vm.propertyNames->length, jsNumber(${leastConstructorLength}), ReadOnly | DontEnum);\n") if defined $leastConstructorLength;
+    push(@$outputArray, "    reifyStaticProperties(vm, ${className}ConstructorTableValues, *this);\n") if ConstructorHasProperties($interface);
 
     push(@$outputArray, "}\n\n");
 
@@ -5212,7 +5191,7 @@ sub GenerateConstructorHelperMethods
     if (IsJSBuiltinConstructor($interface)) {
         push(@$outputArray, "template<> FunctionExecutable* ${constructorClassName}::initializeExecutable(VM& vm)\n");
         push(@$outputArray, "{\n");
-        push(@$outputArray, "    return " . GetJSBuiltinFunctionNameFromString($interfaceName, "initialize" . $interfaceName) . "(vm);\n");
+        push(@$outputArray, "    return " . GetJSBuiltinFunctionNameFromString($interface->name, "initialize" . $interface->name) . "(vm);\n");
         push(@$outputArray, "}\n");
         push(@$outputArray, "\n");
     }
index ccd13ba..b8e1350 100644 (file)
@@ -87,11 +87,11 @@ using namespace JSC;
 
 namespace WebCore {
 
-JSString* jsStringWithCache(ExecState*, TestEnumType);
-Optional<TestEnumType> parseTestEnumType(ExecState&, JSValue);
-extern const char expectedEnumerationValuesTestEnumType[];
+JSString* jsStringWithCache(ExecState*, TestObj::EnumType);
+Optional<TestObj::EnumType> parseTestObjEnumType(ExecState&, JSValue);
+extern const char expectedEnumerationValuesTestObjEnumType[];
 
-JSString* jsStringWithCache(ExecState* state, TestEnumType enumerationValue)
+JSString* jsStringWithCache(ExecState* state, TestObj::EnumType enumerationValue)
 {
     static NeverDestroyed<const String> values[] = {
         emptyString(),
@@ -99,39 +99,39 @@ JSString* jsStringWithCache(ExecState* state, TestEnumType enumerationValue)
         ASCIILiteral("EnumValue2"),
         ASCIILiteral("EnumValue3"),
     };
-    static_assert(static_cast<size_t>(TestEnumType::EmptyString) == 0, "TestEnumType::EmptyString is not 0 as expected");
-    static_assert(static_cast<size_t>(TestEnumType::EnumValue1) == 1, "TestEnumType::EnumValue1 is not 1 as expected");
-    static_assert(static_cast<size_t>(TestEnumType::EnumValue2) == 2, "TestEnumType::EnumValue2 is not 2 as expected");
-    static_assert(static_cast<size_t>(TestEnumType::EnumValue3) == 3, "TestEnumType::EnumValue3 is not 3 as expected");
+    static_assert(static_cast<size_t>(TestObj::EnumType::EmptyString) == 0, "TestObj::EnumType::EmptyString is not 0 as expected");
+    static_assert(static_cast<size_t>(TestObj::EnumType::EnumValue1) == 1, "TestObj::EnumType::EnumValue1 is not 1 as expected");
+    static_assert(static_cast<size_t>(TestObj::EnumType::EnumValue2) == 2, "TestObj::EnumType::EnumValue2 is not 2 as expected");
+    static_assert(static_cast<size_t>(TestObj::EnumType::EnumValue3) == 3, "TestObj::EnumType::EnumValue3 is not 3 as expected");
     ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
     return jsStringWithCache(state, values[static_cast<size_t>(enumerationValue)]);
 }
 
-template<> struct JSValueTraits<TestEnumType> {
-    static JSString* arrayJSValue(ExecState* state, JSDOMGlobalObject*, TestEnumType value) { return jsStringWithCache(state, value); }
+template<> struct JSValueTraits<TestObj::EnumType> {
+    static JSString* arrayJSValue(ExecState* state, JSDOMGlobalObject*, TestObj::EnumType value) { return jsStringWithCache(state, value); }
 };
 
-Optional<TestEnumType> parseTestEnumType(ExecState& state, JSValue value)
+Optional<TestObj::EnumType> parseTestObjEnumType(ExecState& state, JSValue value)
 {
     auto stringValue = value.toWTFString(&state);
     if (stringValue.isEmpty())
-        return TestEnumType::EmptyString;
+        return TestObj::EnumType::EmptyString;
     if (stringValue == "EnumValue1")
-        return TestEnumType::EnumValue1;
+        return TestObj::EnumType::EnumValue1;
     if (stringValue == "EnumValue2")
-        return TestEnumType::EnumValue2;
+        return TestObj::EnumType::EnumValue2;
     if (stringValue == "EnumValue3")
-        return TestEnumType::EnumValue3;
+        return TestObj::EnumType::EnumValue3;
     return Nullopt;
 }
 
-const char expectedEnumerationValuesTestEnumType[] = "\"\", \"EnumValue1\", \"EnumValue2\", \"EnumValue3\"";
+const char expectedEnumerationValuesTestObjEnumType[] = "\"\", \"EnumValue1\", \"EnumValue2\", \"EnumValue3\"";
 
-JSString* jsStringWithCache(ExecState*, Optional);
-Optional<Optional> parseOptional(ExecState&, JSValue);
-extern const char expectedEnumerationValuesOptional[];
+JSString* jsStringWithCache(ExecState*, TestObj::Optional);
+Optional<TestObj::Optional> parseTestObjOptional(ExecState&, JSValue);
+extern const char expectedEnumerationValuesTestObjOptional[];
 
-JSString* jsStringWithCache(ExecState* state, Optional enumerationValue)
+JSString* jsStringWithCache(ExecState* state, TestObj::Optional enumerationValue)
 {
     static NeverDestroyed<const String> values[] = {
         emptyString(),
@@ -139,130 +139,226 @@ JSString* jsStringWithCache(ExecState* state, Optional enumerationValue)
         ASCIILiteral("OptionalValue2"),
         ASCIILiteral("OptionalValue3"),
     };
-    static_assert(static_cast<size_t>(Optional::EmptyString) == 0, "Optional::EmptyString is not 0 as expected");
-    static_assert(static_cast<size_t>(Optional::OptionalValue1) == 1, "Optional::OptionalValue1 is not 1 as expected");
-    static_assert(static_cast<size_t>(Optional::OptionalValue2) == 2, "Optional::OptionalValue2 is not 2 as expected");
-    static_assert(static_cast<size_t>(Optional::OptionalValue3) == 3, "Optional::OptionalValue3 is not 3 as expected");
+    static_assert(static_cast<size_t>(TestObj::Optional::EmptyString) == 0, "TestObj::Optional::EmptyString is not 0 as expected");
+    static_assert(static_cast<size_t>(TestObj::Optional::OptionalValue1) == 1, "TestObj::Optional::OptionalValue1 is not 1 as expected");
+    static_assert(static_cast<size_t>(TestObj::Optional::OptionalValue2) == 2, "TestObj::Optional::OptionalValue2 is not 2 as expected");
+    static_assert(static_cast<size_t>(TestObj::Optional::OptionalValue3) == 3, "TestObj::Optional::OptionalValue3 is not 3 as expected");
     ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
     return jsStringWithCache(state, values[static_cast<size_t>(enumerationValue)]);
 }
 
-template<> struct JSValueTraits<Optional> {
-    static JSString* arrayJSValue(ExecState* state, JSDOMGlobalObject*, Optional value) { return jsStringWithCache(state, value); }
+template<> struct JSValueTraits<TestObj::Optional> {
+    static JSString* arrayJSValue(ExecState* state, JSDOMGlobalObject*, TestObj::Optional value) { return jsStringWithCache(state, value); }
 };
 
-Optional<Optional> parseOptional(ExecState& state, JSValue value)
+Optional<TestObj::Optional> parseTestObjOptional(ExecState& state, JSValue value)
 {
     auto stringValue = value.toWTFString(&state);
     if (stringValue.isEmpty())
-        return Optional::EmptyString;
+        return TestObj::Optional::EmptyString;
     if (stringValue == "OptionalValue1")
-        return Optional::OptionalValue1;
+        return TestObj::Optional::OptionalValue1;
     if (stringValue == "OptionalValue2")
-        return Optional::OptionalValue2;
+        return TestObj::Optional::OptionalValue2;
     if (stringValue == "OptionalValue3")
-        return Optional::OptionalValue3;
+        return TestObj::Optional::OptionalValue3;
     return Nullopt;
 }
 
-const char expectedEnumerationValuesOptional[] = "\"\", \"OptionalValue1\", \"OptionalValue2\", \"OptionalValue3\"";
+const char expectedEnumerationValuesTestObjOptional[] = "\"\", \"OptionalValue1\", \"OptionalValue2\", \"OptionalValue3\"";
 
 #if ENABLE(Condition1)
 
-JSString* jsStringWithCache(ExecState*, TestEnumA);
-Optional<TestEnumA> parseTestEnumA(ExecState&, JSValue);
-extern const char expectedEnumerationValuesTestEnumA[];
+JSString* jsStringWithCache(ExecState*, TestObj::EnumA);
+Optional<TestObj::EnumA> parseTestObjEnumA(ExecState&, JSValue);
+extern const char expectedEnumerationValuesTestObjEnumA[];
 
-JSString* jsStringWithCache(ExecState* state, TestEnumA enumerationValue)
+JSString* jsStringWithCache(ExecState* state, TestObj::EnumA enumerationValue)
 {
     static NeverDestroyed<const String> values[] = {
         ASCIILiteral("A"),
     };
-    static_assert(static_cast<size_t>(TestEnumA::A) == 0, "TestEnumA::A is not 0 as expected");
+    static_assert(static_cast<size_t>(TestObj::EnumA::A) == 0, "TestObj::EnumA::A is not 0 as expected");
     ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
     return jsStringWithCache(state, values[static_cast<size_t>(enumerationValue)]);
 }
 
-template<> struct JSValueTraits<TestEnumA> {
-    static JSString* arrayJSValue(ExecState* state, JSDOMGlobalObject*, TestEnumA value) { return jsStringWithCache(state, value); }
+template<> struct JSValueTraits<TestObj::EnumA> {
+    static JSString* arrayJSValue(ExecState* state, JSDOMGlobalObject*, TestObj::EnumA value) { return jsStringWithCache(state, value); }
 };
 
-Optional<TestEnumA> parseTestEnumA(ExecState& state, JSValue value)
+Optional<TestObj::EnumA> parseTestObjEnumA(ExecState& state, JSValue value)
 {
     auto stringValue = value.toWTFString(&state);
     if (stringValue == "A")
-        return TestEnumA::A;
+        return TestObj::EnumA::A;
     return Nullopt;
 }
 
-const char expectedEnumerationValuesTestEnumA[] = "\"A\"";
+const char expectedEnumerationValuesTestObjEnumA[] = "\"A\"";
 
 #endif
 
 #if ENABLE(Condition1) && ENABLE(Condition2)
 
-JSString* jsStringWithCache(ExecState*, TestEnumB);
-Optional<TestEnumB> parseTestEnumB(ExecState&, JSValue);
-extern const char expectedEnumerationValuesTestEnumB[];
+JSString* jsStringWithCache(ExecState*, TestObj::EnumB);
+Optional<TestObj::EnumB> parseTestObjEnumB(ExecState&, JSValue);
+extern const char expectedEnumerationValuesTestObjEnumB[];
 
-JSString* jsStringWithCache(ExecState* state, TestEnumB enumerationValue)
+JSString* jsStringWithCache(ExecState* state, TestObj::EnumB enumerationValue)
 {
     static NeverDestroyed<const String> values[] = {
         ASCIILiteral("B"),
     };
-    static_assert(static_cast<size_t>(TestEnumB::B) == 0, "TestEnumB::B is not 0 as expected");
+    static_assert(static_cast<size_t>(TestObj::EnumB::B) == 0, "TestObj::EnumB::B is not 0 as expected");
     ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
     return jsStringWithCache(state, values[static_cast<size_t>(enumerationValue)]);
 }
 
-template<> struct JSValueTraits<TestEnumB> {
-    static JSString* arrayJSValue(ExecState* state, JSDOMGlobalObject*, TestEnumB value) { return jsStringWithCache(state, value); }
+template<> struct JSValueTraits<TestObj::EnumB> {
+    static JSString* arrayJSValue(ExecState* state, JSDOMGlobalObject*, TestObj::EnumB value) { return jsStringWithCache(state, value); }
 };
 
-Optional<TestEnumB> parseTestEnumB(ExecState& state, JSValue value)
+Optional<TestObj::EnumB> parseTestObjEnumB(ExecState& state, JSValue value)
 {
     auto stringValue = value.toWTFString(&state);
     if (stringValue == "B")
-        return TestEnumB::B;
+        return TestObj::EnumB::B;
     return Nullopt;
 }
 
-const char expectedEnumerationValuesTestEnumB[] = "\"B\"";
+const char expectedEnumerationValuesTestObjEnumB[] = "\"B\"";
 
 #endif
 
 #if ENABLE(Condition1) || ENABLE(Condition2)
 
-JSString* jsStringWithCache(ExecState*, TestEnumC);
-Optional<TestEnumC> parseTestEnumC(ExecState&, JSValue);
-extern const char expectedEnumerationValuesTestEnumC[];
+JSString* jsStringWithCache(ExecState*, TestObj::EnumC);
+Optional<TestObj::EnumC> parseTestObjEnumC(ExecState&, JSValue);
+extern const char expectedEnumerationValuesTestObjEnumC[];
 
-JSString* jsStringWithCache(ExecState* state, TestEnumC enumerationValue)
+JSString* jsStringWithCache(ExecState* state, TestObj::EnumC enumerationValue)
 {
     static NeverDestroyed<const String> values[] = {
         ASCIILiteral("C"),
     };
-    static_assert(static_cast<size_t>(TestEnumC::C) == 0, "TestEnumC::C is not 0 as expected");
+    static_assert(static_cast<size_t>(TestObj::EnumC::C) == 0, "TestObj::EnumC::C is not 0 as expected");
     ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
     return jsStringWithCache(state, values[static_cast<size_t>(enumerationValue)]);
 }
 
-template<> struct JSValueTraits<TestEnumC> {
-    static JSString* arrayJSValue(ExecState* state, JSDOMGlobalObject*, TestEnumC value) { return jsStringWithCache(state, value); }
+template<> struct JSValueTraits<TestObj::EnumC> {
+    static JSString* arrayJSValue(ExecState* state, JSDOMGlobalObject*, TestObj::EnumC value) { return jsStringWithCache(state, value); }
 };
 
-Optional<TestEnumC> parseTestEnumC(ExecState& state, JSValue value)
+Optional<TestObj::EnumC> parseTestObjEnumC(ExecState& state, JSValue value)
 {
     auto stringValue = value.toWTFString(&state);
     if (stringValue == "C")
-        return TestEnumC::C;
+        return TestObj::EnumC::C;
     return Nullopt;
 }
 
-const char expectedEnumerationValuesTestEnumC[] = "\"C\"";
+const char expectedEnumerationValuesTestObjEnumC[] = "\"C\"";
 
 #endif
 
+JSString* jsStringWithCache(ExecState*, TestObj::Kind);
+Optional<TestObj::Kind> parseTestObjKind(ExecState&, JSValue);
+extern const char expectedEnumerationValuesTestObjKind[];
+
+JSString* jsStringWithCache(ExecState* state, TestObj::Kind enumerationValue)
+{
+    static NeverDestroyed<const String> values[] = {
+        ASCIILiteral("quick"),
+        ASCIILiteral("dead"),
+    };
+    static_assert(static_cast<size_t>(TestObj::Kind::Quick) == 0, "TestObj::Kind::Quick is not 0 as expected");
+    static_assert(static_cast<size_t>(TestObj::Kind::Dead) == 1, "TestObj::Kind::Dead is not 1 as expected");
+    ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
+    return jsStringWithCache(state, values[static_cast<size_t>(enumerationValue)]);
+}
+
+template<> struct JSValueTraits<TestObj::Kind> {
+    static JSString* arrayJSValue(ExecState* state, JSDOMGlobalObject*, TestObj::Kind value) { return jsStringWithCache(state, value); }
+};
+
+Optional<TestObj::Kind> parseTestObjKind(ExecState& state, JSValue value)
+{
+    auto stringValue = value.toWTFString(&state);
+    if (stringValue == "quick")
+        return TestObj::Kind::Quick;
+    if (stringValue == "dead")
+        return TestObj::Kind::Dead;
+    return Nullopt;
+}
+
+const char expectedEnumerationValuesTestObjKind[] = "\"quick\", \"dead\"";
+
+JSString* jsStringWithCache(ExecState*, TestObj::Size);
+Optional<TestObj::Size> parseTestObjSize(ExecState&, JSValue);
+extern const char expectedEnumerationValuesTestObjSize[];
+
+JSString* jsStringWithCache(ExecState* state, TestObj::Size enumerationValue)
+{
+    static NeverDestroyed<const String> values[] = {
+        ASCIILiteral("small"),
+        ASCIILiteral("much-much-larger"),
+    };
+    static_assert(static_cast<size_t>(TestObj::Size::Small) == 0, "TestObj::Size::Small is not 0 as expected");
+    static_assert(static_cast<size_t>(TestObj::Size::MuchMuchLarger) == 1, "TestObj::Size::MuchMuchLarger is not 1 as expected");
+    ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
+    return jsStringWithCache(state, values[static_cast<size_t>(enumerationValue)]);
+}
+
+template<> struct JSValueTraits<TestObj::Size> {
+    static JSString* arrayJSValue(ExecState* state, JSDOMGlobalObject*, TestObj::Size value) { return jsStringWithCache(state, value); }
+};
+
+Optional<TestObj::Size> parseTestObjSize(ExecState& state, JSValue value)
+{
+    auto stringValue = value.toWTFString(&state);
+    if (stringValue == "small")
+        return TestObj::Size::Small;
+    if (stringValue == "much-much-larger")
+        return TestObj::Size::MuchMuchLarger;
+    return Nullopt;
+}
+
+const char expectedEnumerationValuesTestObjSize[] = "\"small\", \"much-much-larger\"";
+
+JSString* jsStringWithCache(ExecState*, TestObj::Confidence);
+Optional<TestObj::Confidence> parseTestObjConfidence(ExecState&, JSValue);
+extern const char expectedEnumerationValuesTestObjConfidence[];
+
+JSString* jsStringWithCache(ExecState* state, TestObj::Confidence enumerationValue)
+{
+    static NeverDestroyed<const String> values[] = {
+        ASCIILiteral("high"),
+        ASCIILiteral("kinda-low"),
+    };
+    static_assert(static_cast<size_t>(TestObj::Confidence::High) == 0, "TestObj::Confidence::High is not 0 as expected");
+    static_assert(static_cast<size_t>(TestObj::Confidence::KindaLow) == 1, "TestObj::Confidence::KindaLow is not 1 as expected");
+    ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
+    return jsStringWithCache(state, values[static_cast<size_t>(enumerationValue)]);
+}
+
+template<> struct JSValueTraits<TestObj::Confidence> {
+    static JSString* arrayJSValue(ExecState* state, JSDOMGlobalObject*, TestObj::Confidence value) { return jsStringWithCache(state, value); }
+};
+
+Optional<TestObj::Confidence> parseTestObjConfidence(ExecState& state, JSValue value)
+{
+    auto stringValue = value.toWTFString(&state);
+    if (stringValue == "high")
+        return TestObj::Confidence::High;
+    if (stringValue == "kinda-low")
+        return TestObj::Confidence::KindaLow;
+    return Nullopt;
+}
+
+const char expectedEnumerationValuesTestObjConfidence[] = "\"high\", \"kinda-low\"";
+
 // Functions
 
 #if ENABLE(TEST_FEATURE)
@@ -2398,7 +2494,7 @@ bool setJSTestObjEnumAttr(ExecState* state, EncodedJSValue thisValue, EncodedJSV
         return throwSetterTypeError(*state, "TestObj", "enumAttr");
     }
     auto& impl = castedThis->wrapped();
-    auto nativeValue = parseTestEnumType(*state, value);
+    auto nativeValue = parseTestObjEnumType(*state, value);
     if (UNLIKELY(state->hadException()))
         return false;
     if (UNLIKELY(!nativeValue))
@@ -3530,7 +3626,7 @@ bool setJSTestObjAttributeWithReservedEnumType(ExecState* state, EncodedJSValue
         return throwSetterTypeError(*state, "TestObj", "attributeWithReservedEnumType");
     }
     auto& impl = castedThis->wrapped();
-    auto nativeValue = parseOptional(*state, value);
+    auto nativeValue = parseTestObjOptional(*state, value);
     if (UNLIKELY(state->hadException()))
         return false;
     if (UNLIKELY(!nativeValue))
@@ -3944,12 +4040,12 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithEnumArg(ExecSta
     if (UNLIKELY(state->argumentCount() < 1))
         return throwVMError(state, createNotEnoughArgumentsError(state));
     auto enumArgValue = state->argument(0);
-    TestEnumType enumArg;
-    auto optionalValue = parseTestEnumType(*state, enumArgValue);
+    TestObj::EnumType enumArg;
+    auto optionalValue = parseTestObjEnumType(*state, enumArgValue);
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
     if (UNLIKELY(!optionalValue))
-        return throwArgumentMustBeEnumError(*state, 0, "enumArg", "TestObj", "methodWithEnumArg", expectedEnumerationValuesTestEnumType);
+        return throwArgumentMustBeEnumError(*state, 0, "enumArg", "TestObj", "methodWithEnumArg", expectedEnumerationValuesTestObjEnumType);
     enumArg = optionalValue.value();
     impl.methodWithEnumArg(enumArg);
     return JSValue::encode(jsUndefined());
@@ -3964,15 +4060,15 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalEnumArg
     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
     auto& impl = castedThis->wrapped();
     auto enumArgValue = state->argument(0);
-    TestEnumType enumArg;
+    TestObj::EnumType enumArg;
     if (enumArgValue.isUndefined()) {
-        enumArg = TestEnumType::EnumValue1;
+        enumArg = TestObj::EnumType::EnumValue1;
     } else {
-        auto optionalValue = parseTestEnumType(*state, enumArgValue);
+        auto optionalValue = parseTestObjEnumType(*state, enumArgValue);
         if (UNLIKELY(state->hadException()))
             return JSValue::encode(jsUndefined());
         if (UNLIKELY(!optionalValue))
-            return throwArgumentMustBeEnumError(*state, 0, "enumArg", "TestObj", "methodWithOptionalEnumArgAndDefaultValue", expectedEnumerationValuesTestEnumType);
+            return throwArgumentMustBeEnumError(*state, 0, "enumArg", "TestObj", "methodWithOptionalEnumArgAndDefaultValue", expectedEnumerationValuesTestObjEnumType);
         enumArg = optionalValue.value();
     }
     impl.methodWithOptionalEnumArgAndDefaultValue(enumArg);
index fe13ce7..7743eed 100644 (file)
@@ -39,6 +39,10 @@ enum _optional { "", "OptionalValue1", "OptionalValue2", "OptionalValue3" };
 [Conditional=Condition1&Condition2] enum TestEnumB { "B" };
 [Conditional=Condition1|Condition2] enum TestEnumC { "C" };
 
+enum TestObjKind { "quick", "dead" };
+enum ObjSize { "small", "much-much-larger" };
+enum TestConfidence { "high", "kinda-low" };
+
 [
     Constructor(TestCallback testCallback, TestCallbackFunction testCallbackFunction),
     InterfaceName=TestObject
index df67c29..d827f7c 100644 (file)
@@ -35,7 +35,7 @@
 
 namespace WebCore {
 
-CryptoKey::CryptoKey(CryptoAlgorithmIdentifier algorithm, CryptoKeyType type, bool extractable, CryptoKeyUsage usages)
+CryptoKey::CryptoKey(CryptoAlgorithmIdentifier algorithm, Type type, bool extractable, CryptoKeyUsage usages)
     : m_algorithm(algorithm)
     , m_type(type)
     , m_extractable(extractable)
@@ -53,26 +53,26 @@ void CryptoKey::buildAlgorithmDescription(CryptoAlgorithmDescriptionBuilder& bui
     // Subclasses will add other keys.
 }
 
-Vector<KeyUsage> CryptoKey::usages() const
+auto CryptoKey::usages() const -> Vector<Usage>
 {
     // The result is ordered alphabetically.
-    Vector<KeyUsage> result;
+    Vector<Usage> result;
     if (m_usages & CryptoKeyUsageDecrypt)
-        result.append(KeyUsage::Decrypt);
+        result.append(Usage::Decrypt);
     if (m_usages & CryptoKeyUsageDeriveBits)
-        result.append(KeyUsage::DeriveBits);
+        result.append(Usage::DeriveBits);
     if (m_usages & CryptoKeyUsageDeriveKey)
-        result.append(KeyUsage::DeriveKey);
+        result.append(Usage::DeriveKey);
     if (m_usages & CryptoKeyUsageEncrypt)
-        result.append(KeyUsage::Encrypt);
+        result.append(Usage::Encrypt);
     if (m_usages & CryptoKeyUsageSign)
-        result.append(KeyUsage::Sign);
+        result.append(Usage::Sign);
     if (m_usages & CryptoKeyUsageUnwrapKey)
-        result.append(KeyUsage::UnwrapKey);
+        result.append(Usage::UnwrapKey);
     if (m_usages & CryptoKeyUsageVerify)
-        result.append(KeyUsage::Verify);
+        result.append(Usage::Verify);
     if (m_usages & CryptoKeyUsageWrapKey)
-        result.append(KeyUsage::WrapKey);
+        result.append(Usage::WrapKey);
     return result;
 }
 
@@ -84,6 +84,7 @@ Vector<uint8_t> CryptoKey::randomData(size_t size)
     return result;
 }
 #endif
+
 } // namespace WebCore
 
 #endif // ENABLE(SUBTLE_CRYPTO)
index 07fb7d9..eb6b701 100644 (file)
@@ -47,21 +47,23 @@ enum class CryptoKeyClass {
     RSA
 };
 
-enum class KeyUsage { Encrypt, Decrypt, Sign, Verify, DeriveKey, DeriveBits, WrapKey, UnwrapKey };
-
-using KeyType = CryptoKeyType;
-
 class CryptoKey : public RefCounted<CryptoKey> {
 public:
-    CryptoKey(CryptoAlgorithmIdentifier, CryptoKeyType, bool extractable, CryptoKeyUsage);
+    using Type = CryptoKeyType;
+    CryptoKey(CryptoAlgorithmIdentifier, Type, bool extractable, CryptoKeyUsage);
     virtual ~CryptoKey();
 
     virtual CryptoKeyClass keyClass() const = 0;
 
-    CryptoKeyType type() const;
+    Type type() const;
     bool extractable() const { return m_extractable; }
     virtual void buildAlgorithmDescription(CryptoAlgorithmDescriptionBuilder&) const;
-    Vector<KeyUsage> usages() const;
+
+    // FIXME: Confusing to have CryptoKeyUsage and CryptoKey::Usage named almost the same, but be slightly different.
+    // CryptoKeyUsage values are bit masks so they can be combined with "or", while this is a normal enum that must
+    // match what is defined in the IDL. Maybe we can rename CryptoKeyUsage to CryptoKey::UsagesBitmap?
+    enum class Usage { Encrypt, Decrypt, Sign, Verify, DeriveKey, DeriveBits, WrapKey, UnwrapKey };
+    Vector<Usage> usages() const;
 
     CryptoAlgorithmIdentifier algorithmIdentifier() const { return m_algorithm; }
     CryptoKeyUsage usagesBitmap() const { return m_usages; }
@@ -73,12 +75,12 @@ public:
 
 private:
     CryptoAlgorithmIdentifier m_algorithm;
-    CryptoKeyType m_type;
+    Type m_type;
     bool m_extractable;
     CryptoKeyUsage m_usages;
 };
 
-inline CryptoKeyType CryptoKey::type() const
+inline auto CryptoKey::type() const -> Type
 {
     return m_type;
 }
index 173a582..ca8f985 100644 (file)
@@ -317,22 +317,22 @@ String FontFace::featureSettings() const
     return list->cssText();
 }
 
-FontFaceLoadStatus FontFace::status() const
+auto FontFace::status() const -> LoadStatus
 {
     switch (m_backing->status()) {
     case CSSFontFace::Status::Pending:
-        return FontFaceLoadStatus::Unloaded;
+        return LoadStatus::Unloaded;
     case CSSFontFace::Status::Loading:
-        return FontFaceLoadStatus::Loading;
+        return LoadStatus::Loading;
     case CSSFontFace::Status::TimedOut:
-        return FontFaceLoadStatus::Error;
+        return LoadStatus::Error;
     case CSSFontFace::Status::Success:
-        return FontFaceLoadStatus::Loaded;
+        return LoadStatus::Loaded;
     case CSSFontFace::Status::Failure:
-        return FontFaceLoadStatus::Error;
+        return LoadStatus::Error;
     }
     ASSERT_NOT_REACHED();
-    return FontFaceLoadStatus::Error;
+    return LoadStatus::Error;
 }
 
 void FontFace::fontStateChanged(CSSFontFace& face, CSSFontFace::Status, CSSFontFace::Status newState)
index 2b2a94b..f4b437a 100644 (file)
@@ -42,8 +42,6 @@ class CSSFontFace;
 class CSSValue;
 class Dictionary;
 
-enum class FontFaceLoadStatus { Unloaded, Loading, Loaded, Error };
-
 class FontFace final : public RefCounted<FontFace>, public CSSFontFace::Client {
 public:
     static RefPtr<FontFace> create(JSC::ExecState&, ScriptExecutionContext&, const String& family, JSC::JSValue source, const Dictionary& descriptors, ExceptionCode&);
@@ -65,7 +63,9 @@ public:
     String unicodeRange() const;
     String variant() const;
     String featureSettings() const;
-    FontFaceLoadStatus status() const;
+
+    enum class LoadStatus { Unloaded, Loading, Loaded, Error };
+    LoadStatus status() const;
 
     typedef DOMPromise<FontFace&, DOMCoreException&> Promise;
     Promise& promise() { return m_promise; }
index 0050993..45622ca 100644 (file)
@@ -182,16 +182,16 @@ auto FontFaceSet::promise(JSC::ExecState& execState) -> Promise&
     return m_promise.value();
 }
     
-FontFaceSetLoadStatus FontFaceSet::status() const
+auto FontFaceSet::status() const -> LoadStatus
 {
     switch (m_backing->status()) {
     case CSSFontFaceSet::Status::Loading:
-        return FontFaceSetLoadStatus::Loading;
+        return LoadStatus::Loading;
     case CSSFontFaceSet::Status::Loaded:
-        return FontFaceSetLoadStatus::Loaded;
+        return LoadStatus::Loaded;
     }
     ASSERT_NOT_REACHED();
-    return FontFaceSetLoadStatus::Loaded;
+    return LoadStatus::Loaded;
 }
 
 bool FontFaceSet::canSuspendForDocumentSuspension() const
index 2953a9a..b175836 100644 (file)
@@ -35,8 +35,6 @@ namespace WebCore {
 
 class DOMCoreException;
 
-enum class FontFaceSetLoadStatus { Loading, Loaded };
-
 class FontFaceSet final : public RefCounted<FontFaceSet>, private CSSFontFaceSetClient, public EventTargetWithInlineData, private ActiveDOMObject {
 public:
     static Ref<FontFaceSet> create(Document&, const Vector<RefPtr<FontFace>>& initialFaces);
@@ -52,7 +50,8 @@ public:
     void load(JSC::ExecState&, const String& font, const String& text, DeferredWrapper&& promise, ExceptionCode&);
     bool check(const String& font, const String& text, ExceptionCode&);
 
-    FontFaceSetLoadStatus status() const;
+    enum class LoadStatus { Loading, Loaded };
+    LoadStatus status() const;
 
     typedef DOMPromise<FontFaceSet&, DOMCoreException&> Promise;
     Promise& promise(JSC::ExecState&);
index 0545efc..fa7f6d0 100644 (file)
@@ -521,7 +521,7 @@ Document::Document(Frame* frame, const URL& url, unsigned documentClasses, unsig
 #endif
     , m_loadEventDelayCount(0)
     , m_loadEventDelayTimer(*this, &Document::loadEventDelayTimerFired)
-    , m_referrerPolicy(ReferrerHeaderPolicy::Default)
+    , m_referrerPolicy(ReferrerPolicy::Default)
     , m_writeRecursionIsTooDeep(false)
     , m_writeRecursionDepth(0)
     , m_lastHandledUserGestureTimestamp(0)
@@ -3360,16 +3360,16 @@ void Document::processReferrerPolicy(const String& policy)
     // Note that we're supporting both the standard and legacy keywords for referrer
     // policies, as defined by http://www.w3.org/TR/referrer-policy/#referrer-policy-delivery-meta
     if (equalLettersIgnoringASCIICase(policy, "no-referrer") || equalLettersIgnoringASCIICase(policy, "never"))
-        setReferrerPolicy(ReferrerHeaderPolicy::Never);
+        setReferrerPolicy(ReferrerPolicy::Never);
     else if (equalLettersIgnoringASCIICase(policy, "unsafe-url") || equalLettersIgnoringASCIICase(policy, "always"))
-        setReferrerPolicy(ReferrerHeaderPolicy::Always);
+        setReferrerPolicy(ReferrerPolicy::Always);
     else if (equalLettersIgnoringASCIICase(policy, "origin"))
-        setReferrerPolicy(ReferrerHeaderPolicy::Origin);
+        setReferrerPolicy(ReferrerPolicy::Origin);
     else if (equalLettersIgnoringASCIICase(policy, "no-referrer-when-downgrade") || equalLettersIgnoringASCIICase(policy, "default"))
-        setReferrerPolicy(ReferrerHeaderPolicy::Default);
+        setReferrerPolicy(ReferrerPolicy::Default);
     else {
         addConsoleMessage(MessageSource::Rendering, MessageLevel::Error, "Failed to set referrer policy: The value '" + policy + "' is not one of 'no-referrer', 'origin', 'no-referrer-when-downgrade', or 'unsafe-url'. Defaulting to 'no-referrer'.");
-        setReferrerPolicy(ReferrerHeaderPolicy::Never);
+        setReferrerPolicy(ReferrerPolicy::Never);
     }
 }
 
@@ -6937,7 +6937,7 @@ void Document::applyContentDispositionAttachmentSandbox()
 {
     ASSERT(shouldEnforceContentDispositionAttachmentSandbox());
 
-    setReferrerPolicy(ReferrerHeaderPolicy::Never);
+    setReferrerPolicy(ReferrerPolicy::Never);
     if (!isMediaDocument())
         enforceSandboxFlags(SandboxAll);
     else
index 16621eb..1bcb48b 100644 (file)
@@ -361,8 +361,8 @@ public:
     bool didDispatchViewportPropertiesChanged() const { return m_didDispatchViewportPropertiesChanged; }
 #endif
 
-    void setReferrerPolicy(ReferrerHeaderPolicy referrerPolicy) { m_referrerPolicy = referrerPolicy; }
-    ReferrerHeaderPolicy referrerPolicy() const { return m_referrerPolicy; }
+    void setReferrerPolicy(ReferrerPolicy referrerPolicy) { m_referrerPolicy = referrerPolicy; }
+    ReferrerPolicy referrerPolicy() const { return m_referrerPolicy; }
 
     DocumentType* doctype() const;
 
@@ -1640,7 +1640,7 @@ private:
 
     ViewportArguments m_viewportArguments;
 
-    ReferrerHeaderPolicy m_referrerPolicy;
+    ReferrerPolicy m_referrerPolicy;
 
 #if ENABLE(WEB_TIMING)
     DocumentTiming m_documentTiming;
index a83ebb7..b18e297 100644 (file)
@@ -1174,7 +1174,7 @@ void HTMLMediaElement::loadInternal()
         if (m_textTracks) {
             for (unsigned i = 0; i < m_textTracks->length(); ++i) {
                 TextTrack* track = m_textTracks->item(i);
-                if (track->mode() != TextTrackMode::Disabled)
+                if (track->mode() != TextTrack::Mode::Disabled)
                     m_textTracksWhenResourceSelectionBegan.append(track);
             }
         }
@@ -1731,7 +1731,7 @@ void HTMLMediaElement::textTrackModeChanged(TextTrack* track)
     // Mark this track as "configured" so configureTextTracks won't change the mode again.
     track->setHasBeenConfigured(true);
     
-    if (track->mode() != TextTrackMode::Disabled && trackIsLoaded)
+    if (track->mode() != TextTrack::Mode::Disabled && trackIsLoaded)
         textTrackAddCues(track, track->cues());
 
     configureTextTrackDisplay(AssumeTextTrackVisibilityChanged);
@@ -1755,8 +1755,8 @@ void HTMLMediaElement::videoTrackSelectedChanged(VideoTrack* track)
 
 void HTMLMediaElement::textTrackKindChanged(TextTrack* track)
 {
-    if (track->kind() != TextTrackKind::Captions && track->kind() != TextTrackKind::Subtitles && track->mode() == TextTrackMode::Showing)
-        track->setMode(TextTrackMode::Hidden);
+    if (track->kind() != TextTrack::Kind::Captions && track->kind() != TextTrack::Kind::Subtitles && track->mode() == TextTrack::Mode::Showing)
+        track->setMode(TextTrack::Mode::Hidden);
 }
 
 void HTMLMediaElement::beginIgnoringTrackDisplayUpdateRequests()
@@ -1774,7 +1774,7 @@ void HTMLMediaElement::endIgnoringTrackDisplayUpdateRequests()
 
 void HTMLMediaElement::textTrackAddCues(TextTrack* track, const TextTrackCueList* cues) 
 {
-    if (track->mode() == TextTrackMode::Disabled)
+    if (track->mode() == TextTrack::Mode::Disabled)
         return;
 
     TrackDisplayUpdateScope scope(this);
@@ -1791,7 +1791,7 @@ void HTMLMediaElement::textTrackRemoveCues(TextTrack*, const TextTrackCueList* c
 
 void HTMLMediaElement::textTrackAddCue(TextTrack* track, PassRefPtr<TextTrackCue> prpCue)
 {
-    if (track->mode() == TextTrackMode::Disabled)
+    if (track->mode() == TextTrack::Mode::Disabled)
         return;
 
     RefPtr<TextTrackCue> cue = prpCue;
@@ -3664,7 +3664,7 @@ PassRefPtr<TextTrack> HTMLMediaElement::addTextTrack(const String& kind, const S
     textTrack->setReadinessState(TextTrack::Loaded);
 
     // ... its text track mode to the text track hidden mode, and its text track list of cues to an empty list ...
-    textTrack->setMode(TextTrackMode::Hidden);
+    textTrack->setMode(TextTrack::Mode::Hidden);
 
     return textTrack.release();
 }
@@ -3792,7 +3792,7 @@ void HTMLMediaElement::configureTextTrackGroup(const TrackGroup& group)
     for (size_t i = 0; i < group.tracks.size(); ++i) {
         RefPtr<TextTrack> textTrack = group.tracks[i];
 
-        if (m_processingPreferenceChange && textTrack->mode() == TextTrackMode::Showing)
+        if (m_processingPreferenceChange && textTrack->mode() == TextTrack::Mode::Showing)
             currentlyEnabledTracks.append(textTrack);
 
         int trackScore = captionPreferences ? captionPreferences->textTrackSelectionScore(textTrack.get(), this) : 0;
@@ -3861,12 +3861,12 @@ void HTMLMediaElement::configureTextTrackGroup(const TrackGroup& group)
         for (size_t i = 0; i < currentlyEnabledTracks.size(); ++i) {
             RefPtr<TextTrack> textTrack = currentlyEnabledTracks[i];
             if (textTrack != trackToEnable)
-                textTrack->setMode(TextTrackMode::Disabled);
+                textTrack->setMode(TextTrack::Mode::Disabled);
         }
     }
 
     if (trackToEnable) {
-        trackToEnable->setMode(TextTrackMode::Showing);
+        trackToEnable->setMode(TextTrack::Mode::Showing);
 
         // If user preferences indicate we should always display captions, make sure we reflect the
         // proper status via the webkitClosedCaptionsVisible API call:
@@ -3996,13 +3996,13 @@ void HTMLMediaElement::setSelectedTextTrack(TextTrack* trackToSelect)
         for (int i = 0, length = trackList->length(); i < length; ++i) {
             TextTrack* track = trackList->item(i);
             if (!trackToSelect || track != trackToSelect)
-                track->setMode(TextTrackMode::Disabled);
+                track->setMode(TextTrack::Mode::Disabled);
             else
-                track->setMode(TextTrackMode::Showing);
+                track->setMode(TextTrack::Mode::Showing);
         }
     } else if (trackToSelect == TextTrack::captionMenuOffItem()) {
         for (int i = 0, length = trackList->length(); i < length; ++i)
-            trackList->item(i)->setMode(TextTrackMode::Disabled);
+            trackList->item(i)->setMode(TextTrack::Mode::Disabled);
     }
 
     if (!document().page())
@@ -4041,18 +4041,18 @@ void HTMLMediaElement::configureTextTracks()
 
         auto kind = textTrack->kind();
         TrackGroup* currentGroup;
-        if (kind == TextTrackKind::Subtitles || kind == TextTrackKind::Captions || kind == TextTrackKind::Forced)
+        if (kind == TextTrack::Kind::Subtitles || kind == TextTrack::Kind::Captions || kind == TextTrack::Kind::Forced)
             currentGroup = &captionAndSubtitleTracks;
-        else if (kind == TextTrackKind::Descriptions)
+        else if (kind == TextTrack::Kind::Descriptions)
             currentGroup = &descriptionTracks;
-        else if (kind == TextTrackKind::Chapters)
+        else if (kind == TextTrack::Kind::Chapters)
             currentGroup = &chapterTracks;
-        else if (kind == TextTrackKind::Metadata)
+        else if (kind == TextTrack::Kind::Metadata)
             currentGroup = &metadataTracks;
         else
             currentGroup = &otherTracks;
 
-        if (!currentGroup->visibleTrack && textTrack->mode() == TextTrackMode::Showing)
+        if (!currentGroup->visibleTrack && textTrack->mode() == TextTrack::Mode::Showing)
             currentGroup->visibleTrack = textTrack;
         if (!currentGroup->defaultTrack && textTrack->isDefault())
             currentGroup->defaultTrack = textTrack;
@@ -5491,7 +5491,7 @@ bool HTMLMediaElement::hasClosedCaptions() const
         auto& track = *m_textTracks->item(i);
         if (track.readinessState() == TextTrack::FailedToLoad)
             continue;
-        if (track.kind() == TextTrackKind::Captions || track.kind() == TextTrackKind::Subtitles)
+        if (track.kind() == TextTrack::Kind::Captions || track.kind() == TextTrack::Kind::Subtitles)
             return true;
     }
 #endif
@@ -5758,7 +5758,7 @@ void HTMLMediaElement::configureTextTrackDisplay(TextTrackVisibilityCheckType ch
 
     bool haveVisibleTextTrack = false;
     for (unsigned i = 0; i < m_textTracks->length(); ++i) {
-        if (m_textTracks->item(i)->mode() == TextTrackMode::Showing) {
+        if (m_textTracks->item(i)->mode() == TextTrack::Mode::Showing) {
             haveVisibleTextTrack = true;
             break;
         }
@@ -5834,7 +5834,7 @@ void HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured(ReconfigureMod
     for (unsigned i = 0; i < m_textTracks->length(); ++i) {
         auto& track = *m_textTracks->item(i);
         auto kind = track.kind();
-        if (kind == TextTrackKind::Subtitles || kind == TextTrackKind::Captions)
+        if (kind == TextTrack::Kind::Subtitles || kind == TextTrack::Kind::Captions)
             track.setHasBeenConfigured(false);
     }
 
@@ -6080,34 +6080,34 @@ String HTMLMediaElement::mediaPlayerUserAgent() const
 
 #if ENABLE(AVF_CAPTIONS)
 
-static inline PlatformTextTrack::TrackKind toPlatform(TextTrackKind kind)
+static inline PlatformTextTrack::TrackKind toPlatform(TextTrack::Kind kind)
 {
     switch (kind) {
-    case TextTrackKind::Captions:
+    case TextTrack::Kind::Captions:
         return PlatformTextTrack::Caption;
-    case TextTrackKind::Chapters:
+    case TextTrack::Kind::Chapters:
         return PlatformTextTrack::Chapter;
-    case TextTrackKind::Descriptions:
+    case TextTrack::Kind::Descriptions:
         return PlatformTextTrack::Description;
-    case TextTrackKind::Forced:
+    case TextTrack::Kind::Forced:
         return PlatformTextTrack::Forced;
-    case TextTrackKind::Metadata:
+    case TextTrack::Kind::Metadata:
         return PlatformTextTrack::MetaData;
-    case TextTrackKind::Subtitles:
+    case TextTrack::Kind::Subtitles:
         return PlatformTextTrack::Subtitle;
     }
     ASSERT_NOT_REACHED();
     return PlatformTextTrack::Caption;
 }
 
-static inline PlatformTextTrack::TrackMode toPlatform(TextTrackMode mode)
+static inline PlatformTextTrack::TrackMode toPlatform(TextTrack::Mode mode)
 {
     switch (mode) {
-    case TextTrackMode::Disabled:
+    case TextTrack::Mode::Disabled:
         return PlatformTextTrack::Disabled;
-    case TextTrackMode::Hidden:
+    case TextTrack::Mode::Hidden:
         return PlatformTextTrack::Hidden;
-    case TextTrackMode::Showing:
+    case TextTrack::Mode::Showing:
         return PlatformTextTrack::Showing;
     }
     ASSERT_NOT_REACHED();
@@ -6131,13 +6131,13 @@ Vector<RefPtr<PlatformTextTrack>> HTMLMediaElement::outOfBandTrackSources()
         // FIXME: The switch statement below preserves existing behavior where we ignore chapters and metadata tracks.
         // If we confirm this behavior is valuable, we should remove this comment. Otherwise, remove both comment and switch.
         switch (kind) {
-        case TextTrackKind::Captions:
-        case TextTrackKind::Descriptions:
-        case TextTrackKind::Forced:
-        case TextTrackKind::Subtitles:
+        case TextTrack::Kind::Captions:
+        case TextTrack::Kind::Descriptions:
+        case TextTrack::Kind::Forced:
+        case TextTrack::Kind::Subtitles:
             break;
-        case TextTrackKind::Chapters:
-        case TextTrackKind::Metadata:
+        case TextTrack::Kind::Chapters:
+        case TextTrack::Kind::Metadata:
             continue;
         }
 
index 454bc26..c201abe 100644 (file)
@@ -174,7 +174,7 @@ void HTMLTrackElement::scheduleLoad()
         return;
 
     // 2. If the text track's text track mode is not set to one of hidden or showing, abort these steps.
-    if (ensureTrack().mode() != TextTrackMode::Hidden && ensureTrack().mode() != TextTrackMode::Showing)
+    if (ensureTrack().mode() != TextTrack::Mode::Hidden && ensureTrack().mode() != TextTrack::Mode::Showing)
         return;
 
     // 3. If the text track's track element does not have a media element as a parent, abort these steps.
index 18e0b6d..1025736 100644 (file)
@@ -401,14 +401,14 @@ bool HTMLVideoElement::webkitSupportsPresentationMode(VideoPresentationMode mode
     return false;
 }
 
-static inline HTMLMediaElementEnums::VideoFullscreenMode toFullscreenMode(VideoPresentationMode mode)
+static inline HTMLMediaElementEnums::VideoFullscreenMode toFullscreenMode(HTMLVideoElement::VideoPresentationMode mode)
 {
     switch (mode) {
-    case VideoPresentationMode::Fullscreen:
+    case HTMLVideoElement::VideoPresentationMode::Fullscreen:
         return HTMLMediaElementEnums::VideoFullscreenModeStandard;
-    case VideoPresentationMode::PictureInPicture:
+    case HTMLVideoElement::VideoPresentationMode::PictureInPicture:
         return HTMLMediaElementEnums::VideoFullscreenModePictureInPicture;
-    case VideoPresentationMode::Inline:
+    case HTMLVideoElement::VideoPresentationMode::Inline:
         return HTMLMediaElementEnums::VideoFullscreenModeNone;
     }
     ASSERT_NOT_REACHED();
@@ -433,22 +433,22 @@ void HTMLVideoElement::setFullscreenMode(HTMLMediaElementEnums::VideoFullscreenM
     enterFullscreen(mode);
 }
 
-static VideoPresentationMode toPresentationMode(HTMLMediaElement::VideoFullscreenMode mode)
+static HTMLVideoElement::VideoPresentationMode toPresentationMode(HTMLMediaElementEnums::VideoFullscreenMode mode)
 {
     if (mode == HTMLMediaElementEnums::VideoFullscreenModeStandard)
-        return VideoPresentationMode::Fullscreen;
+        return HTMLVideoElement::VideoPresentationMode::Fullscreen;
 
     if (mode & HTMLMediaElementEnums::VideoFullscreenModePictureInPicture)
-        return VideoPresentationMode::PictureInPicture;
+        return HTMLVideoElement::VideoPresentationMode::PictureInPicture;
 
     if (mode == HTMLMediaElementEnums::VideoFullscreenModeNone)
-        return VideoPresentationMode::Inline;
+        return HTMLVideoElement::VideoPresentationMode::Inline;
 
     ASSERT_NOT_REACHED();
-    return VideoPresentationMode::Inline;
+    return HTMLVideoElement::VideoPresentationMode::Inline;
 }
 
-VideoPresentationMode HTMLVideoElement::webkitPresentationMode() const
+auto HTMLVideoElement::webkitPresentationMode() const -> VideoPresentationMode
 {
     return toPresentationMode(fullscreenMode());
 }
index f493137..9a1df7b 100644 (file)
@@ -34,8 +34,6 @@ namespace WebCore {
 
 class HTMLImageLoader;
 
-enum class VideoPresentationMode { Fullscreen, PictureInPicture, Inline };
-
 class HTMLVideoElement final : public HTMLMediaElement {
 public:
     static Ref<HTMLVideoElement> create(const QualifiedName&, Document&, bool);
@@ -43,7 +41,6 @@ public:
     WEBCORE_EXPORT unsigned videoWidth() const;
     WEBCORE_EXPORT unsigned videoHeight() const;
 
-    // Fullscreen
     void webkitEnterFullscreen(ExceptionCode&);
     void webkitExitFullscreen();
     bool webkitSupportsFullscreen();
@@ -62,7 +59,6 @@ public:
 #endif
 
 #if ENABLE(MEDIA_STATISTICS)
-    // Statistics
     unsigned webkitDecodedFrameCount() const;
     unsigned webkitDroppedFrameCount() const;
 #endif
@@ -82,6 +78,7 @@ public:
     RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
 
 #if ENABLE(VIDEO_PRESENTATION_MODE)
+    enum class VideoPresentationMode { Fullscreen, PictureInPicture, Inline };
     bool webkitSupportsPresentationMode(VideoPresentationMode) const;
     void webkitSetPresentationMode(VideoPresentationMode);
     VideoPresentationMode webkitPresentationMode() const;
index c3c7e17..b82855e 100644 (file)
@@ -23,9 +23,6 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-// FIXME: This should be Conditional=VIDEO_PRESENTATION_MODE.
-enum VideoPresentationMode { "fullscreen", "picture-in-picture", "inline" };
-
 [
     Conditional=VIDEO,
     JSGenerateToNativeObject,
@@ -63,3 +60,5 @@ enum VideoPresentationMode { "fullscreen", "picture-in-picture", "inline" };
     [Conditional=VIDEO_PRESENTATION_MODE] void webkitSetPresentationMode(VideoPresentationMode mode);
 #endif
 };
+
+[Conditional=VIDEO_PRESENTATION_MODE] enum VideoPresentationMode { "fullscreen", "picture-in-picture", "inline" };
index 7ea7e45..f2ae0a1 100644 (file)
@@ -76,9 +76,9 @@ namespace WebCore {
 using namespace HTMLNames;
 
 #if USE(CG)
-const ImageSmoothingQuality defaultSmoothingQuality = ImageSmoothingQuality::Low;
+const CanvasRenderingContext2D::ImageSmoothingQuality defaultSmoothingQuality = CanvasRenderingContext2D::ImageSmoothingQuality::Low;
 #else
-const ImageSmoothingQuality defaultSmoothingQuality = ImageSmoothingQuality::Medium;
+const CanvasRenderingContext2D::ImageSmoothingQuality defaultSmoothingQuality = CanvasRenderingContext2D::ImageSmoothingQuality::Medium;
 #endif
 
 static const int defaultFontSize = 10;
@@ -930,12 +930,12 @@ static bool isFullCanvasCompositeMode(CompositeOperator op)
     return op == CompositeSourceIn || op == CompositeSourceOut || op == CompositeDestinationIn || op == CompositeDestinationAtop;
 }
 
-static WindRule toWindRule(CanvasWindingRule rule)
+static WindRule toWindRule(CanvasRenderingContext2D::WindingRule rule)
 {
-    return rule == CanvasWindingRule::Nonzero ? RULE_NONZERO : RULE_EVENODD;
+    return rule == CanvasRenderingContext2D::WindingRule::Nonzero ? RULE_NONZERO : RULE_EVENODD;
 }
 
-void CanvasRenderingContext2D::fill(CanvasWindingRule windingRule)
+void CanvasRenderingContext2D::fill(WindingRule windingRule)
 {
     fillInternal(m_path, windingRule);
 
@@ -953,7 +953,7 @@ void CanvasRenderingContext2D::stroke()
 #endif
 }
 
-void CanvasRenderingContext2D::clip(CanvasWindingRule windingRule)
+void CanvasRenderingContext2D::clip(WindingRule windingRule)
 {
     clipInternal(m_path, windingRule);
 
@@ -962,7 +962,7 @@ void CanvasRenderingContext2D::clip(CanvasWindingRule windingRule)
 #endif
 }
 
-void CanvasRenderingContext2D::fill(DOMPath& path, CanvasWindingRule windingRule)
+void CanvasRenderingContext2D::fill(DOMPath& path, WindingRule windingRule)
 {
     fillInternal(path.path(), windingRule);
 }
@@ -972,12 +972,12 @@ void CanvasRenderingContext2D::stroke(DOMPath& path)
     strokeInternal(path.path());
 }
 
-void CanvasRenderingContext2D::clip(DOMPath& path, CanvasWindingRule windingRule)
+void CanvasRenderingContext2D::clip(DOMPath& path, WindingRule windingRule)
 {
     clipInternal(path.path(), windingRule);
 }
 
-void CanvasRenderingContext2D::fillInternal(const Path& path, CanvasWindingRule windingRule)
+void CanvasRenderingContext2D::fillInternal(const Path& path, WindingRule windingRule)
 {
     GraphicsContext* c = drawingContext();
     if (!c)
@@ -1044,7 +1044,7 @@ void CanvasRenderingContext2D::strokeInternal(const Path& path)
     }
 }
 
-void CanvasRenderingContext2D::clipInternal(const Path& path, CanvasWindingRule windingRule)
+void CanvasRenderingContext2D::clipInternal(const Path& path, WindingRule windingRule)
 {
     GraphicsContext* c = drawingContext();
     if (!c)
@@ -1070,7 +1070,7 @@ inline void CanvasRenderingContext2D::endCompositeLayer()
 #endif
 }
 
-bool CanvasRenderingContext2D::isPointInPath(float x, float y, CanvasWindingRule windingRule)
+bool CanvasRenderingContext2D::isPointInPath(float x, float y, WindingRule windingRule)
 {
     return isPointInPathInternal(m_path, x, y, windingRule);
 }
@@ -1080,7 +1080,7 @@ bool CanvasRenderingContext2D::isPointInStroke(float x, float y)
     return isPointInStrokeInternal(m_path, x, y);
 }
 
-bool CanvasRenderingContext2D::isPointInPath(DOMPath& path, float x, float y, CanvasWindingRule windingRule)
+bool CanvasRenderingContext2D::isPointInPath(DOMPath& path, float x, float y, WindingRule windingRule)
 {
     return isPointInPathInternal(path.path(), x, y, windingRule);
 }
@@ -1090,7 +1090,7 @@ bool CanvasRenderingContext2D::isPointInStroke(DOMPath& path, float x, float y)
     return isPointInStrokeInternal(path.path(), x, y);
 }
 
-bool CanvasRenderingContext2D::isPointInPathInternal(const Path& path, float x, float y, CanvasWindingRule windingRule)
+bool CanvasRenderingContext2D::isPointInPathInternal(const Path& path, float x, float y, WindingRule windingRule)
 {
     GraphicsContext* c = drawingContext();
     if (!c)
@@ -2537,14 +2537,14 @@ PlatformLayer* CanvasRenderingContext2D::platformLayer() const
 }
 #endif
 
-static InterpolationQuality smoothingToInterpolationQuality(ImageSmoothingQuality quality)
+static InterpolationQuality smoothingToInterpolationQuality(CanvasRenderingContext2D::ImageSmoothingQuality quality)
 {
     switch (quality) {
-    case ImageSmoothingQuality::Low:
+    case CanvasRenderingContext2D::ImageSmoothingQuality::Low:
         return InterpolationLow;
-    case ImageSmoothingQuality::Medium:
+    case CanvasRenderingContext2D::ImageSmoothingQuality::Medium:
         return InterpolationMedium;
-    case ImageSmoothingQuality::High:
+    case CanvasRenderingContext2D::ImageSmoothingQuality::High:
         return InterpolationHigh;
     }
 
@@ -2552,7 +2552,7 @@ static InterpolationQuality smoothingToInterpolationQuality(ImageSmoothingQualit
     return InterpolationLow;
 };
 
-ImageSmoothingQuality CanvasRenderingContext2D::imageSmoothingQuality() const
+auto CanvasRenderingContext2D::imageSmoothingQuality() const -> ImageSmoothingQuality
 {
     return state().imageSmoothingQuality;
 }
index bc062ae..91bd856 100644 (file)
@@ -57,9 +57,6 @@ class TextMetrics;
 
 typedef int ExceptionCode;
 
-enum class CanvasWindingRule { Nonzero, Evenodd };
-enum class ImageSmoothingQuality { Low, Medium, High };
-
 class CanvasRenderingContext2D final : public CanvasRenderingContext, public CanvasPathMethods {
 public:
     CanvasRenderingContext2D(HTMLCanvasElement*, bool usesCSSCompatibilityParseMode, bool usesDashboardCompatibilityMode);
@@ -131,18 +128,20 @@ public:
 
     void beginPath();
 
-    void fill(CanvasWindingRule = CanvasWindingRule::Nonzero);
+    enum class WindingRule { Nonzero, Evenodd };
+
+    void fill(WindingRule = WindingRule::Nonzero);
     void stroke();
-    void clip(CanvasWindingRule = CanvasWindingRule::Nonzero);
+    void clip(WindingRule = WindingRule::Nonzero);
 
-    void fill(DOMPath&, CanvasWindingRule = CanvasWindingRule::Nonzero);
+    void fill(DOMPath&, WindingRule = WindingRule::Nonzero);
     void stroke(DOMPath&);
-    void clip(DOMPath&, CanvasWindingRule = CanvasWindingRule::Nonzero);
+    void clip(DOMPath&, WindingRule = WindingRule::Nonzero);
 
-    bool isPointInPath(float x, float y, CanvasWindingRule = CanvasWindingRule::Nonzero);
+    bool isPointInPath(float x, float y, WindingRule = WindingRule::Nonzero);
     bool isPointInStroke(float x, float y);
 
-    bool isPointInPath(DOMPath&, float x, float y, CanvasWindingRule = CanvasWindingRule::Nonzero);
+    bool isPointInPath(DOMPath&, float x, float y, WindingRule = WindingRule::Nonzero);
     bool isPointInStroke(DOMPath&, float x, float y);
 
     void clearRect(float x, float y, float width, float height);
@@ -222,6 +221,7 @@ public:
     bool imageSmoothingEnabled() const;
     void setImageSmoothingEnabled(bool);
 
+    enum class ImageSmoothingQuality { Low, Medium, High };
     ImageSmoothingQuality imageSmoothingQuality() const;
     void setImageSmoothingQuality(ImageSmoothingQuality);
 
@@ -345,11 +345,11 @@ private:
     void beginCompositeLayer();
     void endCompositeLayer();
 
-    void fillInternal(const Path&, CanvasWindingRule);
+    void fillInternal(const Path&, WindingRule);
     void strokeInternal(const Path&);
-    void clipInternal(const Path&, CanvasWindingRule);
+    void clipInternal(const Path&, WindingRule);
 
-    bool isPointInPathInternal(const Path&, float x, float y, CanvasWindingRule);
+    bool isPointInPathInternal(const Path&, float x, float y, WindingRule);
     bool isPointInStrokeInternal(const Path&, float x, float y);
 
     void drawFocusIfNeededInternal(const Path&, Element*);
index d9c1f9d..dc43e2c 100644 (file)
@@ -765,7 +765,7 @@ void MediaControlClosedCaptionsTrackListElement::updateDisplay()
             continue;
         }
 
-        if (displayMode != CaptionUserPreferences::Automatic && textTrack->mode() == TextTrackMode::Showing) {
+        if (displayMode != CaptionUserPreferences::Automatic && textTrack->mode() == TextTrack::Mode::Showing) {
             trackMenuItemSelected = true;
             trackItem->classList().add(selectedClassValue, ASSERT_NO_EXCEPTION);
         } else
@@ -1173,7 +1173,7 @@ void MediaControlTextTrackContainerElement::updateDisplay()
         LOG(Media, "MediaControlTextTrackContainerElement::updateDisplay(%p) - adding and positioning cue #%zu: \"%s\", start=%.2f, end=%.2f, line=%.2f", this, i, cue->text().utf8().data(), cue->startTime(), cue->endTime(), cue->line());
 
         RefPtr<VTTCueBox> displayBox = cue->getDisplayTree(m_videoDisplaySize.size(), m_fontSize);
-        if (cue->track()->mode() == TextTrackMode::Disabled)
+        if (cue->track()->mode() == TextTrack::Mode::Disabled)
             continue;
 
         VTTRegion* region = cue->track()->regions()->getRegionById(cue->regionId());
index 3c10a44..f062862 100644 (file)
@@ -89,27 +89,27 @@ void InbandTextTrack::setPrivate(PassRefPtr<InbandTextTrackPrivate> trackPrivate
     updateKindFromPrivate();
 }
 
-void InbandTextTrack::setMode(TextTrackMode mode)
+void InbandTextTrack::setMode(Mode mode)
 {
     TextTrack::setMode(mode);
     setModeInternal(mode);
 }
 
-static inline InbandTextTrackPrivate::Mode toPrivate(TextTrackMode mode)
+static inline InbandTextTrackPrivate::Mode toPrivate(TextTrack::Mode mode)
 {
     switch (mode) {
-    case TextTrackMode::Disabled:
+    case TextTrack::Mode::Disabled:
         return InbandTextTrackPrivate::Disabled;
-    case TextTrackMode::Hidden:
+    case TextTrack::Mode::Hidden:
         return InbandTextTrackPrivate::Hidden;
-    case TextTrackMode::Showing:
+    case TextTrack::Mode::Showing:
         return InbandTextTrackPrivate::Showing;
     }
     ASSERT_NOT_REACHED();
     return InbandTextTrackPrivate::Disabled;
 }
 
-void InbandTextTrack::setModeInternal(TextTrackMode mode)
+void InbandTextTrack::setModeInternal(Mode mode)
 {
     m_private->setMode(toPrivate(mode));
 }
@@ -196,22 +196,22 @@ void InbandTextTrack::updateKindFromPrivate()
 {
     switch (m_private->kind()) {
     case InbandTextTrackPrivate::Subtitles:
-        setKind(TextTrackKind::Subtitles);
+        setKind(Kind::Subtitles);
         break;
     case InbandTextTrackPrivate::Captions:
-        setKind(TextTrackKind::Captions);
+        setKind(Kind::Captions);
         break;
     case InbandTextTrackPrivate::Descriptions:
-        setKind(TextTrackKind::Descriptions);
+        setKind(Kind::Descriptions);
         break;
     case InbandTextTrackPrivate::Chapters:
-        setKind(TextTrackKind::Chapters);
+        setKind(Kind::Chapters);
         break;
     case InbandTextTrackPrivate::Metadata:
-        setKind(TextTrackKind::Metadata);
+        setKind(Kind::Metadata);
         break;
     case InbandTextTrackPrivate::Forced:
-        setKind(TextTrackKind::Forced);
+        setKind(Kind::Forced);
         break;
     case InbandTextTrackPrivate::None:
     default:
index a3aa010..e5f8d2b 100644 (file)
@@ -45,7 +45,7 @@ public:
     bool containsOnlyForcedSubtitles() const override;
     bool isMainProgramContent() const override;
     bool isEasyToRead() const override;
-    void setMode(TextTrackMode) override;
+    void setMode(Mode) override;
     size_t inbandTrackIndex();
 
     AtomicString inBandMetadataTrackDispatchType() const override;
@@ -55,7 +55,7 @@ public:
 protected:
     InbandTextTrack(ScriptExecutionContext*, TextTrackClient*, PassRefPtr<InbandTextTrackPrivate>);
 
-    void setModeInternal(TextTrackMode);
+    void setModeInternal(Mode);
     void updateKindFromPrivate();
 
     RefPtr<InbandTextTrackPrivate> m_private;
index a7d81be..3188781 100644 (file)
@@ -104,15 +104,15 @@ TextTrack::TextTrack(ScriptExecutionContext* context, TextTrackClient* client, c
     , m_renderedTrackIndex(invalidTrackIndex)
 {
     if (kind == captionsKeyword())
-        m_kind = TextTrackKind::Captions;
+        m_kind = Kind::Captions;
     else if (kind == chaptersKeyword())
-        m_kind = TextTrackKind::Chapters;
+        m_kind = Kind::Chapters;
     else if (kind == descriptionsKeyword())
-        m_kind = TextTrackKind::Descriptions;
+        m_kind = Kind::Descriptions;
     else if (kind == forcedKeyword())
-        m_kind = TextTrackKind::Forced;
+        m_kind = Kind::Forced;
     else if (kind == metadataKeyword())
-        m_kind = TextTrackKind::Metadata;
+        m_kind = Kind::Metadata;
 }
 
 TextTrack::~TextTrack()
@@ -132,7 +132,7 @@ TextTrack::~TextTrack()
 
 bool TextTrack::enabled() const
 {
-    return m_mode != TextTrackMode::Disabled;
+    return m_mode != Mode::Disabled;
 }
 
 bool TextTrack::isValidKindKeyword(const AtomicString& value)
@@ -156,24 +156,24 @@ bool TextTrack::isValidKindKeyword(const AtomicString& value)
 const AtomicString& TextTrack::kindKeyword() const
 {
     switch (m_kind) {
-    case TextTrackKind::Captions:
+    case Kind::Captions:
         return captionsKeyword();
-    case TextTrackKind::Chapters:
+    case Kind::Chapters:
         return chaptersKeyword();
-    case TextTrackKind::Descriptions:
+    case Kind::Descriptions:
         return descriptionsKeyword();
-    case TextTrackKind::Forced:
+    case Kind::Forced:
         return forcedKeyword();
-    case TextTrackKind::Metadata:
+    case Kind::Metadata:
         return metadataKeyword();
-    case TextTrackKind::Subtitles:
+    case Kind::Subtitles:
         return subtitlesKeyword();
     }
     ASSERT_NOT_REACHED();
     return subtitlesKeyword();
 }
 
-void TextTrack::setKind(TextTrackKind newKind)
+void TextTrack::setKind(Kind newKind)
 {
     auto oldKind = m_kind;
 
@@ -203,28 +203,28 @@ void TextTrack::setKind(TextTrackKind newKind)
 void TextTrack::setKindKeywordIgnoringASCIICase(StringView keyword)
 {
     if (equalLettersIgnoringASCIICase(keyword, "captions"))
-        setKind(TextTrackKind::Captions);
+        setKind(Kind::Captions);
     else if (equalLettersIgnoringASCIICase(keyword, "chapters"))
-        setKind(TextTrackKind::Chapters);
+        setKind(Kind::Chapters);
     else if (equalLettersIgnoringASCIICase(keyword, "descriptions"))
-        setKind(TextTrackKind::Descriptions);
+        setKind(Kind::Descriptions);
     else if (equalLettersIgnoringASCIICase(keyword, "forced"))
-        setKind(TextTrackKind::Forced);
+        setKind(Kind::Forced);
     else if (equalLettersIgnoringASCIICase(keyword, "metadata"))
-        setKind(TextTrackKind::Metadata);
+        setKind(Kind::Metadata);
     else if (equalLettersIgnoringASCIICase(keyword, "subtitles"))
-        setKind(TextTrackKind::Subtitles);
+        setKind(Kind::Subtitles);
 #if !ENABLE(MEDIA_SOURCE)
     // FIXME: This preserves the behavior of an older version of this code before refactoring.
     // !ENABLE(MEDIA_SOURCE): unknown keywords all get turned into Subtitles.
     // ENABLE(MEDIA_SOURCE): unknown keywords leave the old value for kind untouched.
     // I am not sure that either of those is the correct behavior; should test and fix.
     else
-        setKind(TextTrackKind::Subtitles);
+        setKind(Kind::Subtitles);
 #endif
 }
 
-void TextTrack::setMode(TextTrackMode mode)
+void TextTrack::setMode(Mode mode)
 {
     // On setting, if the new value isn't equal to what the attribute would currently
     // return, the new value must be processed as follows ...
@@ -233,10 +233,10 @@ void TextTrack::setMode(TextTrackMode mode)
 
     // If mode changes to disabled, remove this track's cues from the client
     // because they will no longer be accessible from the cues() function.
-    if (mode == TextTrackMode::Disabled && m_client && m_cues)
+    if (mode == Mode::Disabled && m_client && m_cues)
         m_client->textTrackRemoveCues(this, m_cues.get());
 
-    if (mode != TextTrackMode::Showing && m_cues) {
+    if (mode != Mode::Showing && m_cues) {
         for (size_t i = 0; i < m_cues->length(); ++i) {
             TextTrackCue* cue = m_cues->item(i);
             if (cue->isRenderable())
@@ -257,7 +257,7 @@ TextTrackCueList* TextTrack::cues()
     // Otherwise, it must return null. When an object is returned, the
     // same object must be returned each time.
     // http://www.whatwg.org/specs/web-apps/current-work/#dom-texttrack-cues
-    if (m_mode == TextTrackMode::Disabled)
+    if (m_mode == Mode::Disabled)
         return nullptr;
     return &ensureTextTrackCueList();
 }
@@ -284,7 +284,7 @@ TextTrackCueList* TextTrack::activeCues() const
     // order. Otherwise, it must return null. When an object is returned, the
     // same object must be returned each time.
     // http://www.whatwg.org/specs/web-apps/current-work/#dom-texttrack-activecues
-    if (!m_cues || m_mode == TextTrackMode::Disabled)
+    if (!m_cues || m_mode == Mode::Disabled)
         return nullptr;
     return m_cues->activeCues();
 }
@@ -302,7 +302,7 @@ void TextTrack::addCue(PassRefPtr<TextTrackCue> prpCue, ExceptionCode& ec)
     // If a DataCue is added to a TextTrack via the addCue() method but the text track does not have its text
     // track kind set to metadata, throw a InvalidNodeTypeError exception and don't add the cue to the TextTrackList
     // of the TextTrack.
-    if (cue->cueType() == TextTrackCue::Data && m_kind != TextTrackKind::Metadata) {
+    if (cue->cueType() == TextTrackCue::Data && m_kind != Kind::Metadata) {
         ec = INVALID_NODE_TYPE_ERR;
         return;
     }
@@ -372,7 +372,7 @@ VTTRegionList* TextTrack::regions()
     // the text track list of regions of the text track. Otherwise, it must
     // return null. When an object is returned, the same object must be returned
     // each time.
-    if (m_mode == TextTrackMode::Disabled)
+    if (m_mode == Mode::Disabled)
         return nullptr;
     return &ensureVTTRegionList();
 }
@@ -467,8 +467,8 @@ void TextTrack::invalidateTrackIndex()
 
 bool TextTrack::isRendered()
 {
-    return (m_kind == TextTrackKind::Captions || m_kind == TextTrackKind::Subtitles || m_kind == TextTrackKind::Forced)
-        && m_mode == TextTrackMode::Showing;
+    return (m_kind == Kind::Captions || m_kind == Kind::Subtitles || m_kind == Kind::Forced)
+        && m_mode == Mode::Showing;
 }
 
 TextTrackCueList& TextTrack::ensureTextTrackCueList()
@@ -553,12 +553,12 @@ bool TextTrack::isMainProgramContent() const
     // directors commentary is not "main program" because it is not essential for the presentation. HTML5 doesn't have
     // a way to express this in a machine-reable form, it is typically done with the track label, so we assume that caption
     // tracks are main content and all other track types are not.
-    return m_kind == TextTrackKind::Captions;
+    return m_kind == Kind::Captions;
 }
 
 bool TextTrack::containsOnlyForcedSubtitles() const
 {
-    return m_kind == TextTrackKind::Forced;
+    return m_kind == Kind::Forced;
 }
 
 #if ENABLE(MEDIA_SOURCE)
index 5cb2490..7818d22 100644 (file)
@@ -42,9 +42,6 @@ class TextTrackCueList;
 class VTTRegion;
 class VTTRegionList;
 
-enum class TextTrackKind { Subtitles, Captions, Descriptions, Chapters, Metadata, Forced };
-enum class TextTrackMode { Disabled, Hidden, Showing };
-
 class TextTrackClient {
 public:
     virtual ~TextTrackClient() { }
@@ -77,19 +74,21 @@ public:
     static const AtomicString& hiddenKeyword();
     static const AtomicString& showingKeyword();
 
-    TextTrackKind kind() const;
-    void setKind(TextTrackKind);
+    enum class Kind { Subtitles, Captions, Descriptions, Chapters, Metadata, Forced };
+    Kind kind() const;
+    void setKind(Kind);
 
-    TextTrackKind kindForBindings() const;
-    void setKindForBindings(TextTrackKind);
+    Kind kindForBindings() const;
+    void setKindForBindings(Kind);
 
     const AtomicString& kindKeyword() const;
     void setKindKeywordIgnoringASCIICase(StringView);
 
     virtual AtomicString inBandMetadataTrackDispatchType() const { return emptyString(); }
 
-    TextTrackMode mode() const;
-    virtual void setMode(TextTrackMode);
+    enum class Mode { Disabled, Hidden, Showing };
+    Mode mode() const;
+    virtual void setMode(Mode);
 
     enum ReadinessState { NotLoaded = 0, Loading = 1, Loaded = 2, FailedToLoad = 3 };
     ReadinessState readinessState() const { return m_readinessState; }
@@ -164,8 +163,8 @@ private:
     TextTrackCueList& ensureTextTrackCueList();
 
     ScriptExecutionContext* m_scriptExecutionContext;
-    TextTrackMode m_mode { TextTrackMode::Disabled };
-    TextTrackKind m_kind { TextTrackKind::Subtitles };
+    Mode m_mode { Mode::Disabled };
+    Kind m_kind { Kind::Subtitles };
     TextTrackClient* m_client;
     TextTrackType m_trackType;
     ReadinessState m_readinessState { NotLoaded };
@@ -180,24 +179,24 @@ inline TextTrack* toTextTrack(TrackBase* track)
     return static_cast<TextTrack*>(track);
 }
 
-inline TextTrackMode TextTrack::mode() const
+inline auto TextTrack::mode() const -> Mode
 {
     return m_mode;
 }
 
-inline TextTrackKind TextTrack::kind() const
+inline auto TextTrack::kind() const -> Kind
 {
     return m_kind;
 }
 
-inline TextTrackKind TextTrack::kindForBindings() const
+inline auto TextTrack::kindForBindings() const -> Kind
 {
     return kind();
 }
 
 #if !ENABLE(MEDIA_SOURCE)
 
-inline void TextTrack::setKindForBindings(TextTrackKind)
+inline void TextTrack::setKindForBindings(Kind)
 {
     // FIXME: We are using kindForBindings only to implement this empty function, preserving the
     // behavior of doing nothing when trying to set the kind, originally implemented in a custom setter.
@@ -206,7 +205,7 @@ inline void TextTrack::setKindForBindings(TextTrackKind)
 
 #else
 
-inline void TextTrack::setKindForBindings(TextTrackKind kind)
+inline void TextTrack::setKindForBindings(Kind kind)
 {
     setKind(kind);
 }
index 42736fb..b7ee225 100644 (file)
@@ -193,7 +193,7 @@ void TextTrackCue::invalidateCueIndex()
 bool TextTrackCue::dispatchEvent(Event& event)
 {
     // When a TextTrack's mode is disabled: no cues are active, no events fired.
-    if (!track() || track()->mode() == TextTrackMode::Disabled)
+    if (!track() || track()->mode() == TextTrack::Mode::Disabled)
         return false;
 
     return EventTarget::dispatchEvent(event);
@@ -201,7 +201,7 @@ bool TextTrackCue::dispatchEvent(Event& event)
 
 bool TextTrackCue::isActive()
 {
-    return m_isActive && track() && track()->mode() != TextTrackMode::Disabled;
+    return m_isActive && track() && track()->mode() != TextTrack::Mode::Disabled;
 }
 
 void TextTrackCue::setIsActive(bool active)
index ff51b3b..d87cf9e 100644 (file)
@@ -39,7 +39,7 @@ public:
         if (!m_frame)
             return true;
 
-        return m_frame->document()->referrerPolicy() == ReferrerHeaderPolicy::Default;
+        return m_frame->document()->referrerPolicy() == ReferrerPolicy::Default;
     }
 
 protected:
index 1d06c2d..935c1fb 100644 (file)
@@ -217,7 +217,7 @@ Vector<RefPtr<TextTrack>> CaptionUserPreferences::sortedTrackListForMenu(TextTra
     for (unsigned i = 0, length = trackList->length(); i < length; ++i) {
         TextTrack* track = trackList->item(i);
         auto kind = track->kind();
-        if (kind == TextTrackKind::Captions || kind == TextTrackKind::Descriptions || kind == TextTrackKind::Subtitles)
+        if (kind == TextTrack::Kind::Captions || kind == TextTrack::Kind::Descriptions || kind == TextTrack::Kind::Subtitles)
             tracksForMenu.append(track);
     }
 
@@ -265,7 +265,7 @@ Vector<RefPtr<AudioTrack>> CaptionUserPreferences::sortedTrackListForMenu(AudioT
 
 int CaptionUserPreferences::textTrackSelectionScore(TextTrack* track, HTMLMediaElement*) const
 {
-    if (track->kind() != TextTrackKind::Captions && track->kind() != TextTrackKind::Subtitles)
+    if (track->kind() != TextTrack::Kind::Captions && track->kind() != TextTrack::Kind::Subtitles)
         return 0;
     
     if (!userPrefersSubtitles() && !userPrefersCaptions())
index 3d116f9..8bc029d 100644 (file)
@@ -710,7 +710,7 @@ int CaptionUserPreferencesMediaAF::textTrackSelectionScore(TextTrack* track, HTM
     bool legacyOverride = mediaElement->webkitClosedCaptionsVisible();
     if (displayMode == AlwaysOn && (!userPrefersSubtitles() && !userPrefersCaptions() && !legacyOverride))
         return 0;
-    if (track->kind() != TextTrackKind::Captions && track->kind() != TextTrackKind::Subtitles && track->kind() != TextTrackKind::Forced)
+    if (track->kind() != TextTrack::Kind::Captions && track->kind() != TextTrack::Kind::Subtitles && track->kind() != TextTrack::Kind::Forced)
         return 0;
     if (!track->isMainProgramContent())
         return 0;
@@ -771,7 +771,7 @@ int CaptionUserPreferencesMediaAF::textTrackSelectionScore(TextTrack* track, HTM
 
     if (userPrefersCaptions()) {
         // When the user prefers accessibility tracks, rank is SDH, then CC, then subtitles.
-        if (track->kind() == TextTrackKind::Subtitles)
+        if (track->kind() == TextTrack::Kind::Subtitles)
             trackScore = 1;
         else if (track->isClosedCaptions())
             trackScore = 2;
@@ -779,7 +779,7 @@ int CaptionUserPreferencesMediaAF::textTrackSelectionScore(TextTrack* track, HTM
             trackScore = 3;
     } else {
         // When the user prefers translation tracks, rank is subtitles, then SDH, then CC tracks.
-        if (track->kind() == TextTrackKind::Subtitles)
+        if (track->kind() == TextTrack::Kind::Subtitles)
             trackScore = 3;
         else if (!track->isClosedCaptions())
             trackScore = 2;
@@ -865,7 +865,7 @@ Vector<RefPtr<TextTrack>> CaptionUserPreferencesMediaAF::sortedTrackListForMenu(
         }
 
         auto kind = track->kind();
-        if (kind != TextTrackKind::Captions && kind != TextTrackKind::Descriptions && kind != TextTrackKind::Subtitles)
+        if (kind != TextTrack::Kind::Captions && kind != TextTrack::Kind::Descriptions && kind != TextTrack::Kind::Subtitles)
             continue;
 
         if (track->containsOnlyForcedSubtitles()) {
@@ -881,7 +881,7 @@ Vector<RefPtr<TextTrack>> CaptionUserPreferencesMediaAF::sortedTrackListForMenu(
             continue;
         }
 
-        if (track->mode() == TextTrackMode::Showing) {
+        if (track->mode() == TextTrack::Mode::Showing) {
             LOG(Media, "CaptionUserPreferencesMediaAF::sortedTrackListForMenu - adding '%s' track with language '%s' because it is already visible", track->kindKeyword().string().utf8().data(), language.utf8().data());
             if (!language.isEmpty())
                 languagesIncluded.add(language);
@@ -890,7 +890,7 @@ Vector<RefPtr<TextTrack>> CaptionUserPreferencesMediaAF::sortedTrackListForMenu(
         }
 
         if (!language.isEmpty() && track->isMainProgramContent()) {
-            bool isAccessibilityTrack = track->kind() == TextTrackKind::Captions;
+            bool isAccessibilityTrack = track->kind() == TextTrack::Kind::Captions;
             if (prefersAccessibilityTracks) {
                 // In the first pass, include only caption tracks if the user prefers accessibility tracks.
                 if (!isAccessibilityTrack && filterTrackList) {
@@ -926,7 +926,7 @@ Vector<RefPtr<TextTrack>> CaptionUserPreferencesMediaAF::sortedTrackListForMenu(
             continue;
 
         auto kind = track->kind();
-        if (kind != TextTrackKind::Captions && kind != TextTrackKind::Descriptions && kind != TextTrackKind::Subtitles)
+        if (kind != TextTrack::Kind::Captions && kind != TextTrack::Kind::Descriptions && kind != TextTrack::Kind::Subtitles)
             continue;
 
         // All candidates with no languge were added the first time through.
index 23dcf11..5db273d 100644 (file)
@@ -66,7 +66,7 @@ bool SecurityPolicy::shouldHideReferrer(const URL& url, const String& referrer)
     return !URLIsSecureURL;
 }
 
-String SecurityPolicy::generateReferrerHeader(ReferrerHeaderPolicy referrerPolicy, const URL& url, const String& referrer)
+String SecurityPolicy::generateReferrerHeader(ReferrerPolicy referrerPolicy, const URL& url, const String& referrer)
 {
     if (referrer.isEmpty())
         return String();
@@ -75,11 +75,11 @@ String SecurityPolicy::generateReferrerHeader(ReferrerHeaderPolicy referrerPolic
         return String();
 
     switch (referrerPolicy) {
-    case ReferrerHeaderPolicy::Never:
+    case ReferrerPolicy::Never:
         return String();
-    case ReferrerHeaderPolicy::Always:
+    case ReferrerPolicy::Always:
         return referrer;
-    case ReferrerHeaderPolicy::Origin: {
+    case ReferrerPolicy::Origin: {
         String origin = SecurityOrigin::createFromString(referrer)->toString();
         if (origin == "null")
             return String();
@@ -87,7 +87,7 @@ String SecurityPolicy::generateReferrerHeader(ReferrerHeaderPolicy referrerPolic
         // to turn it into a canonical URL we can use as referrer.
         return origin + "/";
     }
-    case ReferrerHeaderPolicy::Default:
+    case ReferrerPolicy::Default:
         break;
     }
 
index ab6e68f..6c818fd 100644 (file)
@@ -38,14 +38,14 @@ class URL;
 
 class SecurityPolicy {
 public:
-    // True if the referrer should be omitted according to ReferrerHeaderPolicy::Default.
+    // True if the referrer should be omitted according to ReferrerPolicy::Default.
     // If you intend to send a referrer header, you should use generateReferrerHeader instead.
     WEBCORE_EXPORT static bool shouldHideReferrer(const URL&, const String& referrer);
 
     // Returns the referrer modified according to the referrer policy for a
     // navigation to a given URL. If the referrer returned is empty, the
     // referrer header should be omitted.
-    WEBCORE_EXPORT static String generateReferrerHeader(ReferrerHeaderPolicy, const URL&, const String& referrer);
+    WEBCORE_EXPORT static String generateReferrerHeader(ReferrerPolicy, const URL&, const String& referrer);
 
     enum LocalLoadPolicy {
         AllowLocalLoadsForAll, // No restriction on local loads.
index e51c580..870c169 100644 (file)
@@ -37,9 +37,8 @@ namespace WebCore {
 // FIXME: Move this workaround to a global location, perhaps config.h; maybe a GTK-specific location.
 #undef Always
 
-// FIXME: Merge this with the ReferrerPolicy defined in the Fetch specification.
-// FIXME: Rename back to ReferrerPolicy even before that, if we find a way.
-enum class ReferrerHeaderPolicy {
+// FIXME: Merge this with FetchOptions::ReferrerPolicy, which is the one defined in the Fetch specification.
+enum class ReferrerPolicy {
     Always,
     Default,
     Never,
index 754eb1e..0299e7a 100644 (file)
@@ -158,9 +158,9 @@ void WebPlaybackSessionModelMediaElement::updateForEventName(const WTF::AtomicSt
 
         if (m_mediaElement->mediaControlsHost()) {
             auto type = m_mediaElement->mediaControlsHost()->externalDeviceType();
-            if (type == DeviceType::Airplay)
+            if (type == MediaControlsHost::DeviceType::Airplay)
                 targetType = WebPlaybackSessionInterface::TargetTypeAirPlay;
-            else if (type == DeviceType::Tvout)
+            else if (type == MediaControlsHost::DeviceType::Tvout)
                 targetType = WebPlaybackSessionInterface::TargetTypeTVOut;
             localizedDeviceName = m_mediaElement->mediaControlsHost()->externalDeviceDisplayName();
         }
@@ -303,7 +303,7 @@ void WebPlaybackSessionModelMediaElement::updateLegibleOptions()
             trackMenuItemSelected = true;
         }
 
-        if (displayMode != MediaControlsHost::automaticKeyword() && track->mode() == TextTrackMode::Showing) {
+        if (displayMode != MediaControlsHost::automaticKeyword() && track->mode() == TextTrack::Mode::Showing) {
             selectedIndex = index;
             trackMenuItemSelected = true;
         }
index 80f594c..56fda69 100644 (file)
@@ -563,23 +563,23 @@ bool Internals::isStyleSheetLoadingSubresources(HTMLLinkElement& link)
     return link.sheet() && link.sheet()->contents().isLoadingSubresources();
 }
 
-static ResourceRequestCachePolicy toResourceRequestCachePolicy(InternalsCachePolicy policy)
+static ResourceRequestCachePolicy toResourceRequestCachePolicy(Internals::CachePolicy policy)
 {
     switch (policy) {
-    case InternalsCachePolicy::UseProtocolCachePolicy:
+    case Internals::CachePolicy::UseProtocolCachePolicy:
         return UseProtocolCachePolicy;
-    case InternalsCachePolicy::ReloadIgnoringCacheData:
+    case Internals::CachePolicy::ReloadIgnoringCacheData:
         return ReloadIgnoringCacheData;
-    case InternalsCachePolicy::ReturnCacheDataElseLoad:
+    case Internals::CachePolicy::ReturnCacheDataElseLoad:
         return ReturnCacheDataElseLoad;
-    case InternalsCachePolicy::ReturnCacheDataDontLoad:
+    case Internals::CachePolicy::ReturnCacheDataDontLoad:
         return ReturnCacheDataDontLoad;
     }
     ASSERT_NOT_REACHED();
     return UseProtocolCachePolicy;
 }
 
-void Internals::setOverrideCachePolicy(InternalsCachePolicy policy)
+void Internals::setOverrideCachePolicy(CachePolicy policy)
 {
     frame()->loader().setOverrideCachePolicyForTesting(toResourceRequestCachePolicy(policy));
 }
@@ -594,25 +594,25 @@ void Internals::setCanShowModalDialogOverride(bool allow, ExceptionCode& ec)
     contextDocument()->domWindow()->setCanShowModalDialogOverride(allow);
 }
 
-static ResourceLoadPriority toResourceLoadPriority(InternalsResourceLoadPriority priority)
+static ResourceLoadPriority toResourceLoadPriority(Internals::ResourceLoadPriority priority)
 {
     switch (priority) {
-    case InternalsResourceLoadPriority::ResourceLoadPriorityVeryLow:
+    case Internals::ResourceLoadPriority::ResourceLoadPriorityVeryLow:
         return ResourceLoadPriority::VeryLow;
-    case InternalsResourceLoadPriority::ResourceLoadPriorityLow:
+    case Internals::ResourceLoadPriority::ResourceLoadPriorityLow:
         return ResourceLoadPriority::Low;
-    case InternalsResourceLoadPriority::ResourceLoadPriorityMedium:
+    case Internals::ResourceLoadPriority::ResourceLoadPriorityMedium:
         return ResourceLoadPriority::Medium;
-    case InternalsResourceLoadPriority::ResourceLoadPriorityHigh:
+    case Internals::ResourceLoadPriority::ResourceLoadPriorityHigh:
         return ResourceLoadPriority::High;
-    case InternalsResourceLoadPriority::ResourceLoadPriorityVeryHigh:
+    case Internals::ResourceLoadPriority::ResourceLoadPriorityVeryHigh:
         return ResourceLoadPriority::VeryHigh;
     }
     ASSERT_NOT_REACHED();
     return ResourceLoadPriority::Low;
 }
 
-void Internals::setOverrideResourceLoadPriority(InternalsResourceLoadPriority priority)
+void Internals::setOverrideResourceLoadPriority(ResourceLoadPriority priority)
 {
     frame()->loader().setOverrideResourceLoadPriorityForTesting(toResourceLoadPriority(priority));
 }
@@ -1218,21 +1218,21 @@ void Internals::setAutofilled(HTMLInputElement& element, bool enabled)
     element.setAutoFilled(enabled);
 }
 
-static AutoFillButtonType toAutoFillButtonType(InternalsAutoFillButtonType type)
+static AutoFillButtonType toAutoFillButtonType(Internals::AutoFillButtonType type)
 {
     switch (type) {
-    case InternalsAutoFillButtonType::AutoFillButtonTypeNone:
+    case Internals::AutoFillButtonType::AutoFillButtonTypeNone:
         return AutoFillButtonType::None;
-    case InternalsAutoFillButtonType::AutoFillButtonTypeCredentials:
+    case Internals::AutoFillButtonType::AutoFillButtonTypeCredentials:
         return AutoFillButtonType::Credentials;
-    case InternalsAutoFillButtonType::AutoFillButtonTypeContacts:
+    case Internals::AutoFillButtonType::AutoFillButtonTypeContacts:
         return AutoFillButtonType::Contacts;
     }
     ASSERT_NOT_REACHED();
     return AutoFillButtonType::None;
 }
 
-void Internals::setShowAutoFillButton(HTMLInputElement& element, InternalsAutoFillButtonType type)
+void Internals::setShowAutoFillButton(HTMLInputElement& element, AutoFillButtonType type)
 {
     element.setShowAutoFillButton(toAutoFillButtonType(type));
 }
index 39067ef..11f8c88 100644 (file)
@@ -70,12 +70,6 @@ class XMLHttpRequest;
 
 typedef int ExceptionCode;
 
-enum class InternalsAutoFillButtonType { AutoFillButtonTypeNone, AutoFillButtonTypeContacts, AutoFillButtonTypeCredentials };
-enum class InternalsCachePolicy { UseProtocolCachePolicy, ReloadIgnoringCacheData, ReturnCacheDataElseLoad, ReturnCacheDataDontLoad };
-enum class InternalsResourceLoadPriority { ResourceLoadPriorityVeryLow, ResourceLoadPriorityLow, ResourceLoadPriorityMedium, ResourceLoadPriorityHigh, ResourceLoadPriorityVeryHigh };
-enum class MediaControlEvent { PlayPause, NextTrack, PreviousTrack };
-enum class PageOverlayType { View, Document };
-
 class Internals final : public RefCounted<Internals>, private ContextDestructionObserver {
 public:
     static Ref<Internals> create(Document&);
@@ -96,9 +90,11 @@ public:
     String xhrResponseSource(XMLHttpRequest&);
     bool isSharingStyleSheetContents(HTMLLinkElement&, HTMLLinkElement&);
     bool isStyleSheetLoadingSubresources(HTMLLinkElement&);
-    void setOverrideCachePolicy(InternalsCachePolicy);
+    enum class CachePolicy { UseProtocolCachePolicy, ReloadIgnoringCacheData, ReturnCacheDataElseLoad, ReturnCacheDataDontLoad };
+    void setOverrideCachePolicy(CachePolicy);
     void setCanShowModalDialogOverride(bool allow, ExceptionCode&);
-    void setOverrideResourceLoadPriority(InternalsResourceLoadPriority);
+    enum class ResourceLoadPriority { ResourceLoadPriorityVeryLow, ResourceLoadPriorityLow, ResourceLoadPriorityMedium, ResourceLoadPriorityHigh, ResourceLoadPriorityVeryHigh };
+    void setOverrideResourceLoadPriority(ResourceLoadPriority);
     void setStrictRawResourceValidationPolicyDisabled(bool);
 
     void clearMemoryCache();
@@ -175,7 +171,8 @@ public:
     bool elementShouldAutoComplete(HTMLInputElement&);
     void setEditingValue(HTMLInputElement&, const String&);
     void setAutofilled(HTMLInputElement&, bool enabled);
-    void setShowAutoFillButton(HTMLInputElement&, InternalsAutoFillButtonType);
+    enum class AutoFillButtonType { AutoFillButtonTypeNone, AutoFillButtonTypeContacts, AutoFillButtonTypeCredentials };
+    void setShowAutoFillButton(HTMLInputElement&, AutoFillButtonType);
     void scrollElementToRect(Element&, int x, int y, int w, int h, ExceptionCode&);
 
     String autofillFieldName(Element&, ExceptionCode&);
@@ -420,6 +417,7 @@ public:
     void sendMediaSessionEndOfInterruptionNotification(MediaSessionInterruptingCategory);
     String mediaSessionCurrentState(MediaSession&) const;
     double mediaElementPlayerVolume(HTMLMediaElement&) const;
+    enum class MediaControlEvent { PlayPause, NextTrack, PreviousTrack };
     void sendMediaControlEvent(MediaControlEvent);
 #endif
 
@@ -435,6 +433,7 @@ public:
     void simulateSystemSleep() const;
     void simulateSystemWake() const;
 
+    enum class PageOverlayType { View, Document };
     RefPtr<MockPageOverlay> installMockPageOverlay(PageOverlayType, ExceptionCode&);
     String pageOverlayLayerTreeAsText(ExceptionCode&) const;
 
index 1ca0fe6..b34897c 100644 (file)
@@ -30,7 +30,7 @@ enum PageOverlayType {
 };
 
 // These map to ResourceRequestCachePolicy.
-enum InternalsCachePolicy {
+enum CachePolicy {
     "UseProtocolCachePolicy",
     "ReloadIgnoringCacheData",
     "ReturnCacheDataElseLoad",
@@ -38,7 +38,7 @@ enum InternalsCachePolicy {
 };
 
 // FIXME: Strings in an enum should not have the name of the enum as a prefix.
-enum InternalsResourceLoadPriority {
+enum ResourceLoadPriority {
     "ResourceLoadPriorityVeryLow",
     "ResourceLoadPriorityLow",
     "ResourceLoadPriorityMedium",
@@ -59,7 +59,7 @@ enum InternalsResourceLoadPriority {
 };
 
 // FIXME: Strings in an enum should not have the name of the enum as a prefix.
-enum InternalsAutoFillButtonType {
+enum AutoFillButtonType {
     "AutoFillButtonTypeNone",
     "AutoFillButtonTypeContacts",
     "AutoFillButtonTypeCredentials"
@@ -86,8 +86,8 @@ enum InternalsAutoFillButtonType {
     void clearMemoryCache();
     void pruneMemoryCacheToSize(long size);
     long memoryCacheSize();
-    void setOverrideCachePolicy(InternalsCachePolicy policy);
-    void setOverrideResourceLoadPriority(InternalsResourceLoadPriority priority);
+    void setOverrideCachePolicy(CachePolicy policy);
+    void setOverrideResourceLoadPriority(ResourceLoadPriority priority);
     void setStrictRawResourceValidationPolicyDisabled(boolean disabled);
 
     void clearPageCache();
@@ -159,7 +159,7 @@ enum InternalsAutoFillButtonType {
     boolean elementShouldAutoComplete(HTMLInputElement inputElement);
     void setEditingValue(HTMLInputElement inputElement, DOMString value);
     void setAutofilled(HTMLInputElement inputElement, boolean enabled);
-    void setShowAutoFillButton(HTMLInputElement inputElement, InternalsAutoFillButtonType autoFillButtonType);
+    void setShowAutoFillButton(HTMLInputElement inputElement, AutoFillButtonType autoFillButtonType);
     [RaisesException] unsigned long countMatchesForText(DOMString text, unsigned long findOptions, DOMString markMatches);
 
     [RaisesException] DOMString autofillFieldName(Element formControlElement);
index 224b865..6ab3159 100644 (file)
@@ -163,7 +163,7 @@ XMLHttpRequest::State XMLHttpRequest::readyState() const
 
 String XMLHttpRequest::responseText(ExceptionCode& ec)
 {
-    if (m_responseType != XMLHttpRequestResponseType::EmptyString && m_responseType != XMLHttpRequestResponseType::Text) {
+    if (m_responseType != ResponseType::EmptyString && m_responseType != ResponseType::Text) {
         ec = INVALID_STATE_ERR;
         return { };
     }
@@ -172,7 +172,7 @@ String XMLHttpRequest::responseText(ExceptionCode& ec)
 
 void XMLHttpRequest::didCacheResponseJSON()
 {
-    ASSERT(m_responseType == XMLHttpRequestResponseType::Json);
+    ASSERT(m_responseType == ResponseType::Json);
     ASSERT(doneWithoutErrors());
     m_responseCacheIsValid = true;
     m_responseBuilder.clear();
@@ -180,7 +180,7 @@ void XMLHttpRequest::didCacheResponseJSON()
 
 Document* XMLHttpRequest::responseXML(ExceptionCode& ec)
 {
-    if (m_responseType != XMLHttpRequestResponseType::EmptyString && m_responseType != XMLHttpRequestResponseType::Document) {
+    if (m_responseType != ResponseType::EmptyString && m_responseType != ResponseType::Document) {
         ec = INVALID_STATE_ERR;
         return nullptr;
     }
@@ -195,7 +195,7 @@ Document* XMLHttpRequest::responseXML(ExceptionCode& ec)
         // The W3C spec requires the final MIME type to be some valid XML type, or text/html.
         // If it is text/html, then the responseType of "document" must have been supplied explicitly.
         if ((m_response.isHTTP() && !responseIsXML() && !isHTML)
-            || (isHTML && m_responseType == XMLHttpRequestResponseType::EmptyString)
+            || (isHTML && m_responseType == ResponseType::EmptyString)
             || scriptExecutionContext()->isWorkerGlobalScope()) {
             m_responseDocument = nullptr;
         } else {
@@ -219,7 +219,7 @@ Document* XMLHttpRequest::responseXML(ExceptionCode& ec)
 
 Blob* XMLHttpRequest::responseBlob()
 {
-    ASSERT(m_responseType == XMLHttpRequestResponseType::Blob);
+    ASSERT(m_responseType == ResponseType::Blob);
     ASSERT(doneWithoutErrors());
 
     if (!m_responseBlob) {
@@ -241,7 +241,7 @@ Blob* XMLHttpRequest::responseBlob()
 
 ArrayBuffer* XMLHttpRequest::responseArrayBuffer()
 {
-    ASSERT(m_responseType == XMLHttpRequestResponseType::Arraybuffer);
+    ASSERT(m_responseType == ResponseType::Arraybuffer);
     ASSERT(doneWithoutErrors());
 
     if (!m_responseArrayBuffer) {
@@ -273,7 +273,7 @@ void XMLHttpRequest::setTimeout(unsigned timeout, ExceptionCode& ec)
     m_timeoutTimer.startOneShot(std::max(0.0, interval.count()));
 }
 
-void XMLHttpRequest::setResponseType(XMLHttpRequestResponseType type, ExceptionCode& ec)
+void XMLHttpRequest::setResponseType(ResponseType type, ExceptionCode& ec)
 {
     if (m_state >= LOADING) {
         ec = INVALID_STATE_ERR;
@@ -463,7 +463,7 @@ void XMLHttpRequest::open(const String& method, const URL& url, bool async, Exce
         // attempt to discourage synchronous XHR use. responseType is one such piece of functionality.
         // We'll only disable this functionality for HTTP(S) requests since sync requests for local protocols
         // such as file: and data: still make sense to allow.
-        if (url.protocolIsInHTTPFamily() && m_responseType != XMLHttpRequestResponseType::EmptyString) {
+        if (url.protocolIsInHTTPFamily() && m_responseType != ResponseType::EmptyString) {
             logConsoleError(scriptExecutionContext(), "Synchronous HTTP(S) requests made from the window context cannot have XMLHttpRequest.responseType set.");
             ec = INVALID_ACCESS_ERR;
             return;
@@ -1095,16 +1095,16 @@ void XMLHttpRequest::didReceiveResponse(unsigned long identifier, const Resource
         m_response.setHTTPHeaderField(HTTPHeaderName::ContentType, m_mimeTypeOverride);
 }
 
-static inline bool shouldDecodeResponse(XMLHttpRequestResponseType type)
+static inline bool shouldDecodeResponse(XMLHttpRequest::ResponseType type)
 {
     switch (type) {
-    case XMLHttpRequestResponseType::EmptyString:
-    case XMLHttpRequestResponseType::Document:
-    case XMLHttpRequestResponseType::Json:
-    case XMLHttpRequestResponseType::Text:
+    case XMLHttpRequest::ResponseType::EmptyString:
+    case XMLHttpRequest::ResponseType::Document:
+    case XMLHttpRequest::ResponseType::Json:
+    case XMLHttpRequest::ResponseType::Text:
         return true;
-    case XMLHttpRequestResponseType::Arraybuffer:
-    case XMLHttpRequestResponseType::Blob:
+    case XMLHttpRequest::ResponseType::Arraybuffer:
+    case XMLHttpRequest::ResponseType::Blob:
         return false;
     }
     ASSERT_NOT_REACHED();
index 1e8d09b..b880872 100644 (file)
@@ -44,8 +44,6 @@ class SharedBuffer;
 class TextResourceDecoder;
 class ThreadableLoader;
 
-enum class XMLHttpRequestResponseType { EmptyString, Arraybuffer, Blob, Document, Json, Text };
-
 class XMLHttpRequest final : public RefCounted<XMLHttpRequest>, public XMLHttpRequestEventTarget, private ThreadableLoaderClient, public ActiveDOMObject {
     WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -106,8 +104,9 @@ public:
     static String uppercaseKnownHTTPMethod(const String&);
     static bool isAllowedHTTPHeader(const String&);
 
-    void setResponseType(XMLHttpRequestResponseType, ExceptionCode&);
-    XMLHttpRequestResponseType responseType() const;
+    enum class ResponseType { EmptyString, Arraybuffer, Blob, Document, Json, Text };
+    void setResponseType(ResponseType, ExceptionCode&);
+    ResponseType responseType() const;
 
     String responseURL() const;
 
@@ -225,7 +224,7 @@ private:
 
     XMLHttpRequestProgressEventThrottle m_progressEventThrottle;
 
-    XMLHttpRequestResponseType m_responseType { XMLHttpRequestResponseType::EmptyString };
+    ResponseType m_responseType { ResponseType::EmptyString };
     bool m_responseCacheIsValid { false };
 
     Timer m_resumeTimer;
@@ -239,7 +238,7 @@ private:
     Timer m_timeoutTimer;
 };
 
-inline XMLHttpRequestResponseType XMLHttpRequest::responseType() const
+inline auto XMLHttpRequest::responseType() const -> ResponseType
 {
     return m_responseType;
 }
index 693ad63..53620e9 100644 (file)
@@ -1,3 +1,15 @@
+2016-05-02  Darin Adler  <darin@apple.com>
+
+        Change IDL enumerations to be nested in their C++ class instead of at WebCore namespace level
+        https://bugs.webkit.org/show_bug.cgi?id=157257
+
+        Reviewed by Chris Dumez.
+
+        * WebProcess/Network/WebLoaderStrategy.cpp:
+        (WebKit::WebLoaderStrategy::loadResource): Updated since we changed
+        ReferrerHeaderPolicy back to ReferrerPolicy.
+        (WebKit::WebLoaderStrategy::schedulePluginStreamLoad): Ditto.
+
 2016-05-02  Brady Eidson  <beidson@apple.com>
 
         Const-ify some IDB code.
index 18096c2..e3d4a48 100644 (file)
@@ -75,7 +75,7 @@ RefPtr<SubresourceLoader> WebLoaderStrategy::loadResource(Frame* frame, CachedRe
 {
     RefPtr<SubresourceLoader> loader = SubresourceLoader::create(frame, resource, request, options);
     if (loader)
-        scheduleLoad(loader.get(), resource, frame->document()->referrerPolicy() == ReferrerHeaderPolicy::Default);
+        scheduleLoad(loader.get(), resource, frame->document()->referrerPolicy() == ReferrerPolicy::Default);
     return loader;
 }
 
@@ -83,7 +83,7 @@ RefPtr<NetscapePlugInStreamLoader> WebLoaderStrategy::schedulePluginStreamLoad(F
 {
     RefPtr<NetscapePlugInStreamLoader> loader = NetscapePlugInStreamLoader::create(frame, client, request);
     if (loader)
-        scheduleLoad(loader.get(), 0, frame->document()->referrerPolicy() == ReferrerHeaderPolicy::Default);
+        scheduleLoad(loader.get(), 0, frame->document()->referrerPolicy() == ReferrerPolicy::Default);
     return loader;
 }