haikuwebkit/Source/WebCore/html/ImageBitmapOptions.h

47 lines
2.0 KiB
C
Raw Permalink Normal View History

ImageBitmap API stubs https://bugs.webkit.org/show_bug.cgi?id=177984 <rdar://problem/34848023> Patch by Sam and Dean. Reviewed by Dean and Sam. Source/WebCore: Add the IDL for ImageBitmap and ImageBitmapOptions, plus some stub implementations (complete with all the algorithms from the HTML specification as comments). * CMakeLists.txt: Add the new files. * DerivedSources.make: Create the JS bindings for ImageBitmap and ImageBitmapOptions. * WebCore.xcodeproj/project.pbxproj: * bindings/js/CallTracerTypes.h: * html/ImageBitmap.cpp: Added. (WebCore::ImageBitmap::create): (WebCore::ImageBitmap::createPromise): (WebCore::ImageBitmap::ImageBitmap): (WebCore::ImageBitmap::~ImageBitmap): (WebCore::ImageBitmap::width const): (WebCore::ImageBitmap::height const): (WebCore::ImageBitmap::close): * html/ImageBitmap.h: Added. (WebCore::ImageBitmap::isDetached const): * html/ImageBitmap.idl: Copied from Source/WebCore/html/canvas/CanvasDrawImage.idl. * html/ImageBitmapOptions.h: Copied from Source/WebCore/html/canvas/CanvasDrawImage.idl. * html/ImageBitmapOptions.idl: Copied from Source/WebCore/html/canvas/CanvasDrawImage.idl. * html/canvas/CanvasDrawImage.idl: * html/canvas/CanvasFillStrokeStyles.idl: * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::size): (WebCore::CanvasRenderingContext2D::drawImage): (WebCore::CanvasRenderingContext2D::createPattern): * html/canvas/CanvasRenderingContext2D.h: * inspector/InspectorCanvas.cpp: (WebCore::InspectorCanvas::indexForData): (WebCore::InspectorCanvas::buildAction): (WebCore::InspectorCanvas::buildArrayForImageBitmap): * inspector/InspectorCanvas.h: * inspector/RecordingSwizzleTypes.h: LayoutTests: New global constructors, so go through the pain of updating all the platform results :( * js/dom/global-constructors-attributes-expected.txt: * platform/gtk/js/dom/global-constructors-attributes-expected.txt: * platform/mac-elcapitan-wk2/js/dom/global-constructors-attributes-expected.txt: * platform/mac-elcapitan/js/dom/global-constructors-attributes-expected.txt: * platform/mac-sierra-wk2/js/dom/global-constructors-attributes-expected.txt: * platform/mac-sierra/js/dom/global-constructors-attributes-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac-wk2/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: * platform/wpe/js/dom/global-constructors-attributes-expected.txt: Canonical link: https://commits.webkit.org/194258@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-06 16:51:47 +00:00
/*
* Copyright (C) 2017 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.
*/
#pragma once
Remove <wtf/Optional.h> https://bugs.webkit.org/show_bug.cgi?id=226437 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Remove include of <wtf/Optional.h>. * inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py: (CppBackendDispatcherHeaderGenerator._generate_secondary_header_includes): Don't generate an include of wtf/Optional.h; including WTFString.h takes care of this anyway. * inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py: (CppFrontendDispatcherHeaderGenerator._generate_secondary_header_includes): Ditto. * inspector/scripts/codegen/generate_cpp_protocol_types_header.py: (CppProtocolTypesHeaderGenerator._generate_secondary_header_includes): Ditto. * inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py: (CppProtocolTypesImplementationGenerator.generate_output): Generate an include of <optional> instead of <wtf/Optional.h>. * inspector/scripts/tests/expected/*: Regenerate. Source/WebCore: * <many files>: Removed include of <wtf/Optional.h>. * platform/graphics/Font.h: Tweaked style a bit. * Modules/geolocation/GeolocationClient.h: Added include of <optional>. * Modules/mediastream/DoubleRange.h: Ditto. * Modules/mediastream/LongRange.h: Ditto. * Modules/webauthn/AuthenticationExtensionsClientOutputs.h: Ditto. * css/CSSToLengthConversionData.h: Ditto. * css/DOMMatrix2DInit.h: Ditto. * dom/AddEventListenerOptions.h: Ditto. * dom/DeviceMotionData.h: Ditto. * dom/DeviceOrientationData.h: Ditto. * dom/SuccessOr.h: Ditto. * html/DateTimeFieldsState.h: Ditto. * html/ImageBitmapOptions.h: Ditto. * html/canvas/PredefinedColorSpace.h: Ditto. * layout/LayoutPhase.h: Ditto. * layout/MarginTypes.h: Ditto. * loader/ResourceLoadNotifier.h: Ditto. * page/RuntimeEnabledFeatures.h: Ditto. * page/ScrollOptions.h: Ditto. * platform/MediaCapabilitiesInfo.h: Ditto. * platform/cocoa/SystemBattery.h: Ditto. * platform/graphics/DecodingOptions.h: Ditto. * platform/graphics/DestinationColorSpace.h: Ditto. * platform/graphics/DisplayRefreshMonitorClient.h: Ditto. * platform/graphics/FloatLine.h: Ditto. * platform/graphics/gpu/GPURequestAdapterOptions.h: Ditto. * platform/graphics/x11/PlatformDisplayX11.h: Ditto. * platform/ios/SelectionGeometry.h: Ditto. * platform/mac/NSScrollerImpDetails.h: Ditto. * platform/network/DNS.h: Ditto. * platform/text/EncodingTables.h: Ditto. * platform/text/TextCodecCJK.h: Ditto. * platform/text/TextCodecUTF16.h: Ditto. * platform/text/TextFlags.h: Ditto. Source/WebCore/PAL: * pal/SessionID.h: Include <optional>. * pal/crypto/gcrypt/Utilities.h: Ditto. * pal/crypto/tasn1/Utilities.cpp: Removed include of <wtf/Optional.h>. Source/WebDriver: * SessionHost.h: Removed include of <wtf/Optional.h>. Source/WebKit: * <many files>: Removed include of <wtf/Optional.h>. Source/WebKitLegacy/mac: * DOM/DOMRangeInternal.h: Added import of <optional>. * WebView/WebGeolocationPosition.mm: Removed import of <wtf/Optional.h>. * WebView/WebGeolocationPositionInternal.h: Added import of <optional>. Source/WTF: * <many files>: Removed include of <wtf/Optional.h>. * WTF.xcodeproj/project.pbxproj: Removed Optional.h. * wtf/Markable.h: Added include of <optional>. * wtf/OptionSet.h: Ditto. * wtf/Optional.h: Emptied this file. On the Windows build system, we can't seem to build successfully without an empty file here. The copied forwarding header seems to linger even if we remove the original. Until we fix the Windows build system, if we want to support incremental builds, we need to keep this empty file around. * wtf/PrintStream.h: Added include of <optional>. * wtf/Seconds.h: Ditto. * wtf/StackTrace.h: Ditto. * wtf/StdLibExtras.h: Moved the valueOrCompute function here from Optional.h. Re-sorted the "using" at the bottom of the file. * wtf/URLHelpers.h: Added include of <optional>. * wtf/Vector.h: Ditto. Tools: * <many files>: Removed include of <wtf/Optional.h>. Canonical link: https://commits.webkit.org/238372@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278340 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-02 06:45:51 +00:00
#include <optional>
ImageBitmap API stubs https://bugs.webkit.org/show_bug.cgi?id=177984 <rdar://problem/34848023> Patch by Sam and Dean. Reviewed by Dean and Sam. Source/WebCore: Add the IDL for ImageBitmap and ImageBitmapOptions, plus some stub implementations (complete with all the algorithms from the HTML specification as comments). * CMakeLists.txt: Add the new files. * DerivedSources.make: Create the JS bindings for ImageBitmap and ImageBitmapOptions. * WebCore.xcodeproj/project.pbxproj: * bindings/js/CallTracerTypes.h: * html/ImageBitmap.cpp: Added. (WebCore::ImageBitmap::create): (WebCore::ImageBitmap::createPromise): (WebCore::ImageBitmap::ImageBitmap): (WebCore::ImageBitmap::~ImageBitmap): (WebCore::ImageBitmap::width const): (WebCore::ImageBitmap::height const): (WebCore::ImageBitmap::close): * html/ImageBitmap.h: Added. (WebCore::ImageBitmap::isDetached const): * html/ImageBitmap.idl: Copied from Source/WebCore/html/canvas/CanvasDrawImage.idl. * html/ImageBitmapOptions.h: Copied from Source/WebCore/html/canvas/CanvasDrawImage.idl. * html/ImageBitmapOptions.idl: Copied from Source/WebCore/html/canvas/CanvasDrawImage.idl. * html/canvas/CanvasDrawImage.idl: * html/canvas/CanvasFillStrokeStyles.idl: * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::size): (WebCore::CanvasRenderingContext2D::drawImage): (WebCore::CanvasRenderingContext2D::createPattern): * html/canvas/CanvasRenderingContext2D.h: * inspector/InspectorCanvas.cpp: (WebCore::InspectorCanvas::indexForData): (WebCore::InspectorCanvas::buildAction): (WebCore::InspectorCanvas::buildArrayForImageBitmap): * inspector/InspectorCanvas.h: * inspector/RecordingSwizzleTypes.h: LayoutTests: New global constructors, so go through the pain of updating all the platform results :( * js/dom/global-constructors-attributes-expected.txt: * platform/gtk/js/dom/global-constructors-attributes-expected.txt: * platform/mac-elcapitan-wk2/js/dom/global-constructors-attributes-expected.txt: * platform/mac-elcapitan/js/dom/global-constructors-attributes-expected.txt: * platform/mac-sierra-wk2/js/dom/global-constructors-attributes-expected.txt: * platform/mac-sierra/js/dom/global-constructors-attributes-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac-wk2/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: * platform/wpe/js/dom/global-constructors-attributes-expected.txt: Canonical link: https://commits.webkit.org/194258@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-06 16:51:47 +00:00
namespace WebCore {
struct ImageBitmapOptions {
enum class Orientation { None, FlipY };
enum class PremultiplyAlpha { None, Premultiply, Default };
enum class ColorSpaceConversion { None, Default };
enum class ResizeQuality { Pixelated, Low, Medium, High };
Orientation imageOrientation { Orientation::None };
PremultiplyAlpha premultiplyAlpha { PremultiplyAlpha::Default };
ColorSpaceConversion colorSpaceConversion { ColorSpaceConversion::Default };
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
std::optional<unsigned> resizeWidth;
std::optional<unsigned> resizeHeight;
ImageBitmap API stubs https://bugs.webkit.org/show_bug.cgi?id=177984 <rdar://problem/34848023> Patch by Sam and Dean. Reviewed by Dean and Sam. Source/WebCore: Add the IDL for ImageBitmap and ImageBitmapOptions, plus some stub implementations (complete with all the algorithms from the HTML specification as comments). * CMakeLists.txt: Add the new files. * DerivedSources.make: Create the JS bindings for ImageBitmap and ImageBitmapOptions. * WebCore.xcodeproj/project.pbxproj: * bindings/js/CallTracerTypes.h: * html/ImageBitmap.cpp: Added. (WebCore::ImageBitmap::create): (WebCore::ImageBitmap::createPromise): (WebCore::ImageBitmap::ImageBitmap): (WebCore::ImageBitmap::~ImageBitmap): (WebCore::ImageBitmap::width const): (WebCore::ImageBitmap::height const): (WebCore::ImageBitmap::close): * html/ImageBitmap.h: Added. (WebCore::ImageBitmap::isDetached const): * html/ImageBitmap.idl: Copied from Source/WebCore/html/canvas/CanvasDrawImage.idl. * html/ImageBitmapOptions.h: Copied from Source/WebCore/html/canvas/CanvasDrawImage.idl. * html/ImageBitmapOptions.idl: Copied from Source/WebCore/html/canvas/CanvasDrawImage.idl. * html/canvas/CanvasDrawImage.idl: * html/canvas/CanvasFillStrokeStyles.idl: * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::size): (WebCore::CanvasRenderingContext2D::drawImage): (WebCore::CanvasRenderingContext2D::createPattern): * html/canvas/CanvasRenderingContext2D.h: * inspector/InspectorCanvas.cpp: (WebCore::InspectorCanvas::indexForData): (WebCore::InspectorCanvas::buildAction): (WebCore::InspectorCanvas::buildArrayForImageBitmap): * inspector/InspectorCanvas.h: * inspector/RecordingSwizzleTypes.h: LayoutTests: New global constructors, so go through the pain of updating all the platform results :( * js/dom/global-constructors-attributes-expected.txt: * platform/gtk/js/dom/global-constructors-attributes-expected.txt: * platform/mac-elcapitan-wk2/js/dom/global-constructors-attributes-expected.txt: * platform/mac-elcapitan/js/dom/global-constructors-attributes-expected.txt: * platform/mac-sierra-wk2/js/dom/global-constructors-attributes-expected.txt: * platform/mac-sierra/js/dom/global-constructors-attributes-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac-wk2/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: * platform/wpe/js/dom/global-constructors-attributes-expected.txt: Canonical link: https://commits.webkit.org/194258@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-06 16:51:47 +00:00
ResizeQuality resizeQuality { ResizeQuality::Low };
};
}