haikuwebkit/Source/WebCore/dom/NavigatorMaxTouchPoints.idl

33 lines
1.7 KiB
Plaintext
Raw Permalink Normal View History

[Pointer Events] Expose navigator.maxTouchPoints https://bugs.webkit.org/show_bug.cgi?id=198468 <rdar://problem/51273029> Reviewed by Chris Dumez. Source/WebCore: Expose the navigator.maxTouchPoints property when Pointer Events are enabled both at compile-time and run-time. We return a canned value for this on iOS touch-enabled devices that matches the number of simultaneous touches supported by the system, which is 5. In fact, iPad support more simultaneous touches, but it doesn't seem worthy to expose this level of granularity due to fingerprinting practices. In practice, what really matters is returning 0, 1 or more than 1 for this value to identify multi-touch support. Test: js/dom/navigator-maxtouchpoints.html * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * dom/NavigatorMaxTouchPoints.idl: Added. * page/Navigator.idl: * page/Navigator.h: (WebCore::Navigator::maxTouchPoints const): LayoutTests: * js/dom/navigator-maxtouchpoints-expected.txt: Added. * js/dom/navigator-maxtouchpoints.html: Added. * platform/mac-highsierra-wk1/fast/dom/navigator-detached-no-crash-expected.txt: * platform/mac-highsierra/fast/dom/navigator-detached-no-crash-expected.txt: * platform/mac-wk1/fast/dom/navigator-detached-no-crash-expected.txt: * platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt: * platform/win/js/dom/navigator-maxtouchpoints-expected.txt: Added. Canonical link: https://commits.webkit.org/212531@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246070 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-06-04 17:45:43 +00:00
/*
* Copyright (C) 2019 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.
* 3. Neither the name of Apple Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
*/
[WebIDL] Add support for interface mixins https://bugs.webkit.org/show_bug.cgi?id=216217 Reviewed by Darin Adler. Implement support for WebIDL interface mixins, which are interface fragments that can be included into other interfaces (using an 'includes' statement), but do not create new types themselves. Prior to this, we have been emulating the behavior by allowing any interface to be included in another interface, and marking some interfaces with the [LegacyNoInterfaceObject] extended attribute. This change codifies that with in the spec approved way. - Updates IDL parser to parse mixin interfaces (and fixes the parsing of callback interfaces to be a bit more strict while I was there). - Updates IDL pre-processor to avoid creating global variables and IsoSubspaces for mixins. - Updates IDL code generator to only support including mixin interfaces during supplemental inclusion. - Updates IDL files to use interface mixin where appropriately specified. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * CMakeLists.txt: * DerivedSources-output.xcfilelist: * DerivedSources.make: * dom/DeviceOrientationOrMotionEvent.idl: Removed. Remove DeviceOrientationOrMotionEvent.idl and corresponding generated files, inlining it into DeviceMotionEvent.idl and DeviceOrientationEvent.idl as specified. This is needed as mixin interfaces do not support static operations or attributes. * bindings/scripts/CodeGenerator.pm: (IsValidSupplementalInterface): (IsValidSupplementalDictionary): (ProcessSupplementalDependencies): (GetInterfaceExtendedAttributesFromName): Update IDL code generator to only support including mixin interfaces during supplemental inclusion. Also removes some left of remnents of exception interface support. * bindings/scripts/IDLParser.pm: (parseCallbackRestOrInterface): (parseCallbackInterface): (parseCallbackInterfaceMembers): (parseCallbackInterfaceMember): (parseMixin): (parseMixinMembers): (parseMixinMember): (parseNamespace): (parsePartialInterfaceMember): (parseAttributeOrOperationForStringifierOrStatic): Update IDL parser to parse mixin interfaces and fix the parsing of callback interfaces to match the spec by restricting its members to constants and regular functions. * bindings/scripts/preprocess-idls.pl: (isMixinInterfaceFromIDL): (containsInterfaceFromIDL): (getInterfaceExtendedAttributesFromIDL): (containsInterfaceOrExceptionFromIDL): Deleted. Ensure mixin interfaces don't get exposed on any global objects and remove some left of remnents of exception interface support. * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestLegacyNoInterfaceObject.cpp: Added. * bindings/scripts/test/JS/JSTestLegacyNoInterfaceObject.h: Added. * bindings/scripts/test/SupplementalDependencies.dep: * bindings/scripts/test/TestIncludes.idl: * bindings/scripts/test/TestLegacyNoInterfaceObject.idl: Added. * bindings/scripts/test/TestOperationBase.idl: Update bindings tests to use mixins for includes. Add new dedicated [LegacyNoInterfaceObject] since it was no longer being tested. * Modules/fetch/FetchBody.idl: * Modules/mediasource/VideoPlaybackQuality.idl: * Modules/speech/SpeechSynthesis.idl: * Modules/speech/SpeechSynthesisVoice.idl: * Modules/streams/ReadableStreamSink.idl: * accessibility/AccessibilityRole.idl: * accessibility/AriaAttributes.idl: * animation/Animatable.idl: * css/ElementCSSInlineStyle.idl: * css/StyleMedia.idl: * dom/ChildNode.idl: * dom/DeviceMotionEvent.idl: * dom/DeviceOrientationEvent.idl: * dom/Document.idl: * dom/DocumentAndElementEventHandlers.idl: * dom/DocumentOrShadowRoot.idl: * dom/EventListener.idl: * dom/GlobalEventHandlers.idl: * dom/NavigatorMaxTouchPoints.idl: * dom/NonDocumentTypeChildNode.idl: * dom/NonElementParentNode.idl: * dom/ParentNode.idl: * dom/Slotable.idl: * html/HTMLHyperlinkElementUtils.idl: * html/HTMLOrForeignElement.idl: * html/canvas/CanvasCompositing.idl: * html/canvas/CanvasDrawImage.idl: * html/canvas/CanvasDrawPath.idl: * html/canvas/CanvasFillStrokeStyles.idl: * html/canvas/CanvasFilters.idl: * html/canvas/CanvasGradient.idl: * html/canvas/CanvasImageData.idl: * html/canvas/CanvasImageSmoothing.idl: * html/canvas/CanvasPath.idl: * html/canvas/CanvasPathDrawingStyles.idl: * html/canvas/CanvasRect.idl: * html/canvas/CanvasShadowStyles.idl: * html/canvas/CanvasState.idl: * html/canvas/CanvasText.idl: * html/canvas/CanvasTextDrawingStyles.idl: * html/canvas/CanvasTransform.idl: * html/canvas/CanvasUserInterface.idl: * html/canvas/WebGLRenderingContextBase.idl: * page/GlobalCrypto.idl: * page/GlobalPerformance.idl: * page/Navigator.idl: * page/NavigatorID.idl: * page/NavigatorLanguage.idl: * page/NavigatorOnLine.idl: * page/NavigatorPlugins.idl: * page/NavigatorServiceWorker.idl: * page/NavigatorShare.idl: * page/WindowEventHandlers.idl: * page/WindowOrWorkerGlobalScope.idl: * svg/SVGFilterPrimitiveStandardAttributes.idl: * svg/SVGFitToViewBox.idl: * svg/SVGTests.idl: * svg/SVGURIReference.idl: * svg/SVGZoomAndPan.idl: * workers/AbstractWorker.idl: * xml/XPathEvaluator.idl: * xml/XPathNSResolver.idl: Update IDLs. Canonical link: https://commits.webkit.org/229047@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266678 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-06 02:49:22 +00:00
// https://w3c.github.io/pointerevents/#extensions-to-the-navigator-interface
interface mixin NavigatorMaxTouchPoints {
[Pointer Events] Expose navigator.maxTouchPoints https://bugs.webkit.org/show_bug.cgi?id=198468 <rdar://problem/51273029> Reviewed by Chris Dumez. Source/WebCore: Expose the navigator.maxTouchPoints property when Pointer Events are enabled both at compile-time and run-time. We return a canned value for this on iOS touch-enabled devices that matches the number of simultaneous touches supported by the system, which is 5. In fact, iPad support more simultaneous touches, but it doesn't seem worthy to expose this level of granularity due to fingerprinting practices. In practice, what really matters is returning 0, 1 or more than 1 for this value to identify multi-touch support. Test: js/dom/navigator-maxtouchpoints.html * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * dom/NavigatorMaxTouchPoints.idl: Added. * page/Navigator.idl: * page/Navigator.h: (WebCore::Navigator::maxTouchPoints const): LayoutTests: * js/dom/navigator-maxtouchpoints-expected.txt: Added. * js/dom/navigator-maxtouchpoints.html: Added. * platform/mac-highsierra-wk1/fast/dom/navigator-detached-no-crash-expected.txt: * platform/mac-highsierra/fast/dom/navigator-detached-no-crash-expected.txt: * platform/mac-wk1/fast/dom/navigator-detached-no-crash-expected.txt: * platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt: * platform/win/js/dom/navigator-maxtouchpoints-expected.txt: Added. Canonical link: https://commits.webkit.org/212531@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246070 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-06-04 17:45:43 +00:00
readonly attribute long maxTouchPoints;
};