haikuwebkit/Source/WebCore/dom/DOMRect.idl

42 lines
1.9 KiB
Plaintext
Raw Permalink Normal View History

Implement DOMRect/DOMRectReadOnly https://bugs.webkit.org/show_bug.cgi?id=163464 Reviewed by Darin Adler. Source/WebCore: Implement the DOMRectInit/DOMRectReadOnly/DOMRect interfaces specified in https://dev.w3.org/fxtf/geometry/ DOMRects allow negative height/width and require double storage, so we can't just use FloatRect for storage. They also require handling of NaN and Infinity. To have the left/right/top/bottom accessors follow IEEE NaN rules, we need to use custom min/max functions that return NaN if either argument is NaN, so add nanPropagatingMin/nanPropagatingMax helpers to MathExtras.h. Test: fast/dom/domrect.html * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * dom/DOMRect.h: Added. (WebCore::DOMRect::create): (WebCore::DOMRect::fromRect): (WebCore::DOMRect::setX): (WebCore::DOMRect::setY): (WebCore::DOMRect::setWidth): (WebCore::DOMRect::setHeight): (WebCore::DOMRect::DOMRect): * dom/DOMRect.idl: Added. * dom/DOMRectInit.h: Added. * dom/DOMRectInit.idl: Added. * dom/DOMRectReadOnly.h: Added. (WebCore::DOMRectReadOnly::create): (WebCore::DOMRectReadOnly::fromRect): (WebCore::DOMRectReadOnly::x): (WebCore::DOMRectReadOnly::y): (WebCore::DOMRectReadOnly::width): (WebCore::DOMRectReadOnly::height): (WebCore::DOMRectReadOnly::top): (WebCore::DOMRectReadOnly::right): (WebCore::DOMRectReadOnly::bottom): (WebCore::DOMRectReadOnly::left): (WebCore::DOMRectReadOnly::DOMRectReadOnly): * dom/DOMRectReadOnly.idl: Added. Source/WTF: Implement min()/max() in a way that follows Math.min/Math.max, which return NaN if either argument is NaN. * wtf/MathExtras.h: (WTF::nanPropagatingMin): (WTF::nanPropagatingMax): LayoutTests: New test and new results for global constructor tests. * geometry/DOMRect-001-expected.txt: Added. * geometry/DOMRect-001.html: Added. * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/dom/global-constructors-attributes-expected.txt: * platform/efl/js/dom/global-constructors-attributes-expected.txt: * platform/gtk/js/dom/global-constructors-attributes-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * platform/win/js/dom/global-constructors-attributes-expected.txt: Canonical link: https://commits.webkit.org/181356@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207438 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-17 22:30:34 +00:00
/*
* Copyright (C) 2016 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://drafts.fxtf.org/geometry-1/#DOMRect
[
Stop using legacy ClientRect / ClientRectList in Internals https://bugs.webkit.org/show_bug.cgi?id=171412 Reviewed by Simon Fraser. Source/WebCore: Stop using legacy ClientRect / ClientRectList in Internals amd use the newer DOMRect instead. * dom/DOMRect.idl: * page/Page.cpp: (WebCore::Page::nonFastScrollableRects): (WebCore::Page::touchEventRectsForEvent): (WebCore::Page::passiveTouchEventListenerRects): * page/Page.h: * testing/Internals.cpp: (WebCore::Internals::absoluteCaretBounds): (WebCore::Internals::boundingBox): (WebCore::Internals::inspectorHighlightRects): (WebCore::Internals::layoutViewportRect): (WebCore::Internals::visualViewportRect): (WebCore::Internals::touchEventRectsForEvent): (WebCore::Internals::passiveTouchEventListenerRects): (WebCore::Internals::nonFastScrollableRects): (WebCore::Internals::selectionBounds): * testing/Internals.h: * testing/Internals.idl: LayoutTests: Rebaseline existing tests as DOMRect has more properties than ClientRect. * fast/visual-viewport/nonzoomed-rects-expected.txt: * fast/visual-viewport/rtl-nonzoomed-rects-expected.txt: * fast/visual-viewport/rtl-zoomed-rects-expected.txt: * fast/visual-viewport/rubberbanding-viewport-rects-expected.txt: * fast/visual-viewport/rubberbanding-viewport-rects-extended-background-expected.txt: * fast/visual-viewport/rubberbanding-viewport-rects-header-footer-expected.txt: * fast/visual-viewport/zoomed-fixed-expected.txt: * fast/visual-viewport/zoomed-fixed-header-and-footer-expected.txt: * fast/visual-viewport/zoomed-rects-expected.txt: * inspector/dom/hideHighlight-expected.txt: * inspector/dom/highlightQuad-expected.txt: * inspector/dom/highlightRect-expected.txt: Canonical link: https://commits.webkit.org/188349@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215956 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-04-28 23:28:41 +00:00
ExportMacro=WEBCORE_EXPORT,
Implement DOMRect/DOMRectReadOnly https://bugs.webkit.org/show_bug.cgi?id=163464 Reviewed by Darin Adler. Source/WebCore: Implement the DOMRectInit/DOMRectReadOnly/DOMRect interfaces specified in https://dev.w3.org/fxtf/geometry/ DOMRects allow negative height/width and require double storage, so we can't just use FloatRect for storage. They also require handling of NaN and Infinity. To have the left/right/top/bottom accessors follow IEEE NaN rules, we need to use custom min/max functions that return NaN if either argument is NaN, so add nanPropagatingMin/nanPropagatingMax helpers to MathExtras.h. Test: fast/dom/domrect.html * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * dom/DOMRect.h: Added. (WebCore::DOMRect::create): (WebCore::DOMRect::fromRect): (WebCore::DOMRect::setX): (WebCore::DOMRect::setY): (WebCore::DOMRect::setWidth): (WebCore::DOMRect::setHeight): (WebCore::DOMRect::DOMRect): * dom/DOMRect.idl: Added. * dom/DOMRectInit.h: Added. * dom/DOMRectInit.idl: Added. * dom/DOMRectReadOnly.h: Added. (WebCore::DOMRectReadOnly::create): (WebCore::DOMRectReadOnly::fromRect): (WebCore::DOMRectReadOnly::x): (WebCore::DOMRectReadOnly::y): (WebCore::DOMRectReadOnly::width): (WebCore::DOMRectReadOnly::height): (WebCore::DOMRectReadOnly::top): (WebCore::DOMRectReadOnly::right): (WebCore::DOMRectReadOnly::bottom): (WebCore::DOMRectReadOnly::left): (WebCore::DOMRectReadOnly::DOMRectReadOnly): * dom/DOMRectReadOnly.idl: Added. Source/WTF: Implement min()/max() in a way that follows Math.min/Math.max, which return NaN if either argument is NaN. * wtf/MathExtras.h: (WTF::nanPropagatingMin): (WTF::nanPropagatingMax): LayoutTests: New test and new results for global constructor tests. * geometry/DOMRect-001-expected.txt: Added. * geometry/DOMRect-001.html: Added. * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/dom/global-constructors-attributes-expected.txt: * platform/efl/js/dom/global-constructors-attributes-expected.txt: * platform/gtk/js/dom/global-constructors-attributes-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * platform/win/js/dom/global-constructors-attributes-expected.txt: Canonical link: https://commits.webkit.org/181356@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207438 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-17 22:30:34 +00:00
Exposed=(Window,Worker),
ImplementationLacksVTable
Use constructor operations in WebIDL https://bugs.webkit.org/show_bug.cgi?id=201397 Reviewed by Eric Carlson. Add support for constructor syntax in WebIDL (https://heycam.github.io/webidl/#idl-constructors) - [Constructor(...)] extended attributes become constructor(...) operations - [JSBuiltinConstructor] becomes [JSBuiltin] constructor(...) - [CustomConstructor] becomes [Custom] constructor(...) - [ConstructorMayThrowException] becomes [MayThrowException] constructor(...) and can now be unique per-overload - [ConstructorCallWith=Foo] becomes [CallWith=Foo] constructor(...) and can now also be unique per-overload This change leaves NamedConstructor as is, but a subsequent change will replace it with the specified LegacyFactoryFunction extended attribute. * Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.idl: * Modules/applepay/ApplePayError.idl: * Modules/applepay/ApplePaySession.idl: * Modules/applepay/ApplePaySetup.idl: * Modules/async-clipboard/ClipboardItem.idl: * Modules/encryptedmedia/MediaKeyMessageEvent.idl: * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.idl: * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.idl: * Modules/encryptedmedia/legacy/WebKitMediaKeys.idl: * Modules/fetch/FetchHeaders.idl: * Modules/fetch/FetchRequest.idl: * Modules/fetch/FetchResponse.idl: * Modules/gamepad/GamepadEvent.idl: * Modules/highlight/HighlightMap.idl: * Modules/highlight/HighlightRangeGroup.idl: * Modules/indexeddb/IDBVersionChangeEvent.idl: * Modules/mediarecorder/BlobEvent.idl: * Modules/mediarecorder/MediaRecorder.idl: * Modules/mediarecorder/MediaRecorderErrorEvent.idl: * Modules/mediasession/MediaRemoteControls.idl: * Modules/mediasession/MediaSession.idl: * Modules/mediasource/MediaSource.idl: * Modules/mediastream/MediaStream.idl: * Modules/mediastream/MediaStreamTrackEvent.idl: * Modules/mediastream/OverconstrainedError.idl: * Modules/mediastream/OverconstrainedErrorEvent.idl: * Modules/mediastream/RTCDTMFToneChangeEvent.idl: * Modules/mediastream/RTCDataChannelEvent.idl: * Modules/mediastream/RTCIceCandidate.idl: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/RTCPeerConnectionIceEvent.idl: * Modules/mediastream/RTCSessionDescription.idl: * Modules/mediastream/RTCTrackEvent.idl: * Modules/notifications/Notification.idl: * Modules/paymentrequest/MerchantValidationEvent.idl: * Modules/paymentrequest/PaymentMethodChangeEvent.idl: * Modules/paymentrequest/PaymentRequest.idl: * Modules/paymentrequest/PaymentRequestUpdateEvent.idl: * Modules/pictureinpicture/EnterPictureInPictureEvent.idl: * Modules/speech/SpeechSynthesisUtterance.idl: * Modules/streams/ByteLengthQueuingStrategy.idl: * Modules/streams/CountQueuingStrategy.idl: * Modules/streams/ReadableByteStreamController.idl: * Modules/streams/ReadableStream.idl: * Modules/streams/ReadableStreamBYOBReader.idl: * Modules/streams/ReadableStreamBYOBRequest.idl: * Modules/streams/ReadableStreamDefaultController.idl: * Modules/streams/ReadableStreamDefaultReader.idl: * Modules/streams/WritableStream.idl: * Modules/webaudio/AudioContext.idl: * Modules/webaudio/OfflineAudioContext.idl: * Modules/webgpu/GPUOutOfMemoryError.idl: * Modules/webgpu/GPUUncapturedErrorEvent.idl: * Modules/webgpu/GPUValidationError.idl: * Modules/websockets/CloseEvent.idl: * Modules/websockets/WebSocket.idl: * Modules/webxr/WebXRRigidTransform.idl: * Modules/webxr/WebXRWebGLLayer.idl: * Modules/webxr/XRInputSourceEvent.idl: * Modules/webxr/XRInputSourcesChangeEvent.idl: * Modules/webxr/XRReferenceSpaceEvent.idl: * Modules/webxr/XRSessionEvent.idl: * animation/AnimationPlaybackEvent.idl: * animation/DocumentTimeline.idl: * animation/KeyframeEffect.idl: * animation/WebAnimation.idl: * bindings/scripts/CodeGeneratorJS.pm: (ShouldGenerateToJSDeclaration): (GetFullyQualifiedImplementationCallName): (GenerateParametersCheck): (GetConstructorTemplateClassName): (GenerateConstructorDefinition): (GenerateConstructorHelperMethods): (HasCustomConstructor): (IsConstructable): (HasJSBuiltinConstructor): (AddJSBuiltinIncludesIfNeeded): (IsJSBuiltinConstructor): Deleted. * bindings/scripts/IDLAttributes.json: * bindings/scripts/IDLParser.pm: (assertExtendedAttributesValidForContext): (copyExtendedAttributes): (cloneOperation): (applyTypedefs): (parseInterfaceMember): (parseConstructor): (parseExtendedAttributeRest): (applyMemberList): (applyExtendedAttributeList): * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: (WebCore::JSTestNamedConstructorConstructor::initializeProperties): (WebCore::JSTestNamedConstructorNamedConstructor::construct): (WebCore::JSTestNamedConstructorNamedConstructor::initializeProperties): * bindings/scripts/test/TestClassWithJSBuiltinConstructor.idl: * bindings/scripts/test/TestEventConstructor.idl: * bindings/scripts/test/TestInterface.idl: * bindings/scripts/test/TestJSBuiltinConstructor.idl: * bindings/scripts/test/TestNamedConstructor.idl: * bindings/scripts/test/TestNode.idl: * bindings/scripts/test/TestObj.idl: * bindings/scripts/test/TestOverloadedConstructors.idl: * bindings/scripts/test/TestOverloadedConstructorsWithSequence.idl: * bindings/scripts/test/TestPromiseRejectionEvent.idl: * bindings/scripts/test/TestTypedefs.idl: * css/DOMMatrix.idl: * css/DOMMatrixReadOnly.idl: * css/FontFace.idl: * css/FontFaceSet.idl: * css/MediaQueryListEvent.idl: * css/WebKitCSSMatrix.idl: * css/typedom/TypedOMCSSUnitValue.idl: * css/typedom/TypedOMCSSUnparsedValue.idl: * dom/AbortController.idl: * dom/AnimationEvent.idl: * dom/BeforeLoadEvent.idl: * dom/ClipboardEvent.idl: * dom/Comment.idl: * dom/CompositionEvent.idl: * dom/CustomEvent.idl: * dom/DOMException.idl: * dom/DOMPoint.idl: * dom/DOMPointReadOnly.idl: * dom/DOMQuad.idl: * dom/DOMRect.idl: * dom/DOMRectReadOnly.idl: * dom/Document.idl: * dom/DocumentFragment.idl: * dom/DragEvent.idl: * dom/ErrorEvent.idl: * dom/Event.idl: * dom/EventTarget.idl: * dom/FocusEvent.idl: * dom/HashChangeEvent.idl: * dom/InputEvent.idl: * dom/KeyboardEvent.idl: * dom/MessageChannel.idl: * dom/MessageEvent.idl: * dom/MouseEvent.idl: * dom/MutationObserver.idl: * dom/OverflowEvent.idl: * dom/PageTransitionEvent.idl: * dom/PointerEvent.idl: * dom/PopStateEvent.idl: * dom/ProgressEvent.idl: * dom/PromiseRejectionEvent.idl: * dom/Range.idl: * dom/SecurityPolicyViolationEvent.idl: * dom/StaticRange.idl: * dom/Text.idl: * dom/TextDecoder.idl: * dom/TextEncoder.idl: * dom/TransitionEvent.idl: * dom/UIEvent.idl: * dom/WebKitAnimationEvent.idl: * dom/WebKitTransitionEvent.idl: * dom/WheelEvent.idl: * fileapi/Blob.idl: * fileapi/File.idl: * fileapi/FileReader.idl: * fileapi/FileReaderSync.idl: * html/DOMFormData.idl: * html/DOMURL.idl: * html/HTMLElement.idl: * html/HTMLOptionElement.idl: * html/ImageData.idl: * html/MediaController.idl: * html/MediaEncryptedEvent.idl: * html/OffscreenCanvas.idl: * html/URLSearchParams.idl: * html/canvas/Path2D.idl: * html/canvas/WebGLContextEvent.idl: * html/track/DataCue.idl: * html/track/TextTrackCue.idl: * html/track/TrackEvent.idl: * html/track/VTTCue.idl: * html/track/VTTRegion.idl: * page/EventSource.idl: * page/IntersectionObserver.idl: * page/IntersectionObserverEntry.idl: * page/PerformanceObserver.idl: * page/ResizeObserver.idl: * page/UndoItem.idl: * page/WebKitPoint.idl: * storage/StorageEvent.idl: * workers/Worker.idl: * workers/service/ExtendableEvent.idl: * workers/service/ExtendableMessageEvent.idl: * workers/service/FetchEvent.idl: * xml/DOMParser.idl: * xml/XMLHttpRequest.idl: * xml/XMLSerializer.idl: * xml/XPathEvaluator.idl: * xml/XSLTProcessor.idl: Canonical link: https://commits.webkit.org/226091@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@263160 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-06-17 16:56:19 +00:00
] interface DOMRect : DOMRectReadOnly {
constructor(optional unrestricted double x = 0, optional unrestricted double y = 0, optional unrestricted double width = 0, optional unrestricted double height = 0);
Implement DOMRect/DOMRectReadOnly https://bugs.webkit.org/show_bug.cgi?id=163464 Reviewed by Darin Adler. Source/WebCore: Implement the DOMRectInit/DOMRectReadOnly/DOMRect interfaces specified in https://dev.w3.org/fxtf/geometry/ DOMRects allow negative height/width and require double storage, so we can't just use FloatRect for storage. They also require handling of NaN and Infinity. To have the left/right/top/bottom accessors follow IEEE NaN rules, we need to use custom min/max functions that return NaN if either argument is NaN, so add nanPropagatingMin/nanPropagatingMax helpers to MathExtras.h. Test: fast/dom/domrect.html * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * dom/DOMRect.h: Added. (WebCore::DOMRect::create): (WebCore::DOMRect::fromRect): (WebCore::DOMRect::setX): (WebCore::DOMRect::setY): (WebCore::DOMRect::setWidth): (WebCore::DOMRect::setHeight): (WebCore::DOMRect::DOMRect): * dom/DOMRect.idl: Added. * dom/DOMRectInit.h: Added. * dom/DOMRectInit.idl: Added. * dom/DOMRectReadOnly.h: Added. (WebCore::DOMRectReadOnly::create): (WebCore::DOMRectReadOnly::fromRect): (WebCore::DOMRectReadOnly::x): (WebCore::DOMRectReadOnly::y): (WebCore::DOMRectReadOnly::width): (WebCore::DOMRectReadOnly::height): (WebCore::DOMRectReadOnly::top): (WebCore::DOMRectReadOnly::right): (WebCore::DOMRectReadOnly::bottom): (WebCore::DOMRectReadOnly::left): (WebCore::DOMRectReadOnly::DOMRectReadOnly): * dom/DOMRectReadOnly.idl: Added. Source/WTF: Implement min()/max() in a way that follows Math.min/Math.max, which return NaN if either argument is NaN. * wtf/MathExtras.h: (WTF::nanPropagatingMin): (WTF::nanPropagatingMax): LayoutTests: New test and new results for global constructor tests. * geometry/DOMRect-001-expected.txt: Added. * geometry/DOMRect-001.html: Added. * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/dom/global-constructors-attributes-expected.txt: * platform/efl/js/dom/global-constructors-attributes-expected.txt: * platform/gtk/js/dom/global-constructors-attributes-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * platform/win/js/dom/global-constructors-attributes-expected.txt: Canonical link: https://commits.webkit.org/181356@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207438 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-17 22:30:34 +00:00
[NewObject] static DOMRect fromRect(optional DOMRectInit other);
inherit attribute unrestricted double x;
inherit attribute unrestricted double y;
inherit attribute unrestricted double width;
inherit attribute unrestricted double height;
};