haikuwebkit/Source/WebCore/animation/AnimationFrameProvider.idl

31 lines
1.6 KiB
Plaintext
Raw Permalink Normal View History

[WebIDL] Support extended attributes on includes statements to allow for conditionalized inclusion https://bugs.webkit.org/show_bug.cgi?id=216235 Reviewed by Darin Adler. In some circumstancs, such as with the AnimationFrameProvider interface mixin, it is useful to only include a mixin based on some conditional. For AnimationFrameProvider, we currently only want to include it in DedicatedWorkerGlobalScope if ENABLE(OFFSCREEN_CANVAS) is set at compile time, and the runtime feature flag offscreenCanvasEnabled() is turned on. To support that, this change adds support for specifying extended attributes on the includes statement itself, and having those extended attributes applied to each member of the mixin. For AnimationFrameProvider in DedicatedWorkerGlobalScope, that looks like: [Conditional=OFFSCREEN_CANVAS, EnabledAtRuntime=OffscreenCanvas] DedicatedWorkerGlobalScope includes AnimationFrameProvider; * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: Add new files, update xcfilelists. * animation/AnimationFrameProvider.idl: Added. * page/DOMWindow.idl: * workers/DedicatedWorkerGlobalScope.idl: Split AnimationFrameProvider.idl out into its own mixin (as specified) and included it in both DOMWindow and DedicatedWorkerGlobalScope (conditionally). * bindings/scripts/CodeGenerator.pm: (ProcessDocument): (ProcessDictionaryAndEnumerationImplementedAsOverrides): (ProcessInterfaces): (ProcessCallbackFunctions): (ProcessDictionaries): (ProcessEnumerations): Split processing of each different type of top level type into its own function, and defer processing of supplemental dependencies until the primary type has been selected. (MergeExtendedAttributesFromSupplemental): (IsValidSupplementalInterface): (IsValidSupplementalDictionary): (ProcessInterfaceSupplementalDependencies): (ProcessDictionarySupplementalDependencies): Split ProcessSupplementalDependencies into ProcessInterfaceSupplementalDependencies and ProcessDictionarySupplementalDependencies, which now get passed the primary interface or dictionary that needs supplementing. ProcessInterfaceSupplementalDependencies now also supports merging extended attributes from includes statements and checking that all includes are listed in the dependency set. * bindings/scripts/IDLAttributes.json: Allow setting use of Conditional, EnabledAtRuntime and EnabledBySetting for includes statements. * bindings/scripts/IDLParser.pm: (parseIncludesStatement): Fix ordering of struct members so that extendedAttributes is always last (no real good reason other than most of the structs already did this and the lack of consistency bothered me). Add extendedAttributes to IDLIncludesStatement and set it when parsing. * bindings/scripts/preprocess-idls.pl: (getIncludedInterfacesFromIDL): Fix bug in regex (found easily by the validation parser!) that incorrectly required the interface name in the includes statement to be the first word on a line. * bindings/scripts/test/BindingTestGlobalConstructors.idl: * bindings/scripts/test/JS/JSTestConditionalIncludes.cpp: Added. * bindings/scripts/test/JS/JSTestConditionalIncludes.h: Added. * bindings/scripts/test/JS/JSTestGlobalObject.cpp: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/SupplementalDependencies.dep: * bindings/scripts/test/TestConditionalIncludes.idl: Added. * bindings/scripts/test/TestIncludes.idl: Add tests for extended attributes on includes statements. Canonical link: https://commits.webkit.org/229075@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266706 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-07 18:42:24 +00:00
/*
* Copyright (C) 2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
// https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#animationframeprovider
interface mixin AnimationFrameProvider {
unsigned long requestAnimationFrame(RequestAnimationFrameCallback callback);
undefined cancelAnimationFrame(unsigned long handle);
};