+2017-10-06 Sam Weinig <sam@webkit.org>
+
+ Add basic support for getting a ImageBitmapRenderingContext
+ https://bugs.webkit.org/show_bug.cgi?id=177983
+
+ Reviewed by Dean Jackson.
+
+ * 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-wk1/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-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:
+
+ Update test results.
+
2017-10-06 Ryan Haddad <ryanhaddad@apple.com>
Mark inspector/canvas/create-context-2d.html as flaky.
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').value is ImageBitmapRenderingContext
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').value is ImageData
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').value is ImageBitmapRenderingContext
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').value is ImageData
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').value is ImageBitmapRenderingContext
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').value is InputEvent
PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').value is ImageBitmapRenderingContext
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').value is ImageData
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').value is ImageBitmapRenderingContext
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').value is ImageData
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').value is ImageBitmapRenderingContext
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').value is ImageData
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').value is ImageBitmapRenderingContext
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').value is ImageData
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').value is ImageBitmapRenderingContext
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').value is ImageData
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'Image').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'Image').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'Image').configurable is true
-PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').value is ImageBitmap
-PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').hasOwnProperty('get') is false
-PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').hasOwnProperty('set') is false
-PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').enumerable is false
-PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').value is ImageBitmapRenderingContext
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').value is ImageData
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').value is ImageBitmapRenderingContext
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').value is ImageData
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmap').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').value is ImageBitmapRenderingContext
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'ImageBitmapRenderingContext').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').value is ImageData
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('set') is false
html/canvas/CanvasTextDrawingStyles.idl
html/canvas/CanvasTransform.idl
html/canvas/CanvasUserInterface.idl
+ html/canvas/ImageBitmapRenderingContext.idl
html/canvas/ImageSmoothingQuality.idl
html/canvas/Path2D.idl
html/canvas/WebGPUBuffer.idl
html/canvas/CanvasRenderingContext.cpp
html/canvas/CanvasRenderingContext2D.cpp
html/canvas/CanvasStyle.cpp
+ html/canvas/ImageBitmapRenderingContext.cpp
html/canvas/Path2D.cpp
+ html/canvas/PlaceholderRenderingContext.cpp
html/canvas/WebGPUBuffer.cpp
html/canvas/WebGPUCommandBuffer.cpp
html/canvas/WebGPUCommandQueue.cpp
+2017-10-06 Sam Weinig <sam@webkit.org>
+
+ Add basic support for getting a ImageBitmapRenderingContext
+ https://bugs.webkit.org/show_bug.cgi?id=177983
+
+ Reviewed by Dean Jackson.
+
+ Add initial support for ImageBitmapRenderingContext.
+
+ * CMakeLists.txt:
+ * DerivedSources.make:
+ * WebCore.xcodeproj/project.pbxproj:
+
+ Add new files.
+
+ * dom/Document.cpp:
+ * dom/Document.h:
+ * dom/Document.idl:
+
+ Add ImageBitmapRenderingContext to RenderingContext variant so it wil be able to
+ be used with Document.getCSSCanvasContext.
+
+ * html/HTMLCanvasElement.h:
+ * html/HTMLCanvasElement.cpp:
+ (WebCore::HTMLCanvasElement::setHeight):
+ (WebCore::HTMLCanvasElement::setWidth):
+
+ Throw an exception if the context is in the placeholder mode (which we
+ signify via a special PlaceholderRenderingContext) as speced. This can't
+ currently be hit, as setting a placeholder requires offscreen canvas
+ support, coming soon.
+
+ (WebCore::HTMLCanvasElement::getContext):
+
+ Re-work to match the spec's matrix of options, adding in support
+ for 'bitmaprenderer'/ ImageBitmapRenderingContext type as well as
+ the placeholder mode.
+
+ (WebCore::HTMLCanvasElement::createContext2d):
+ (WebCore::HTMLCanvasElement::getContext2d):
+ (WebCore::HTMLCanvasElement::isWebGLType):
+ (WebCore::HTMLCanvasElement::createContextWebGL):
+ (WebCore::HTMLCanvasElement::getContextWebGL):
+ (WebCore::HTMLCanvasElement::createContextWebGPU):
+ (WebCore::HTMLCanvasElement::getContextWebGPU):
+ (WebCore::HTMLCanvasElement::isBitmapRendererType):
+ (WebCore::HTMLCanvasElement::createContextBitmapRenderer):
+ (WebCore::HTMLCanvasElement::getContextBitmapRenderer):
+
+ Split creation out of the get functions so it can be called
+ by getContext, where we know if the canvas is null or not.
+
+ * html/HTMLCanvasElement.idl:
+
+ Add ImageBitmapRenderingContext to RenderingContext variant so it wil be able to
+ be used with HTMLCanvasElement.getContext.
+
+ * html/canvas/CanvasRenderingContext.h:
+ (WebCore::CanvasRenderingContext::isBitmapRenderer const):
+ (WebCore::CanvasRenderingContext::isPlaceholder const):
+
+ Add predicates for ImageBitmapRenderingContext and
+ PlaceholderRenderingContext.
+
+ * html/canvas/ImageBitmapRenderingContext.cpp: Added.
+ (WebCore::ImageBitmapRenderingContext::ImageBitmapRenderingContext):
+ * html/canvas/ImageBitmapRenderingContext.h: Added.
+ * html/canvas/ImageBitmapRenderingContext.idl: Added.
+ * html/canvas/PlaceholderRenderingContext.cpp: Added.
+ (WebCore::PlaceholderRenderingContext::PlaceholderRenderingContext):
+ * html/canvas/PlaceholderRenderingContext.h: Added.
+
+ Add stubbed out implementations for the new contexts.
+
2017-10-06 Jer Noble <jer.noble@apple.com>
Netflix playback fails with S7353 error
$(WebCore)/html/canvas/EXTShaderTextureLOD.idl \
$(WebCore)/html/canvas/EXTTextureFilterAnisotropic.idl \
$(WebCore)/html/canvas/EXTsRGB.idl \
+ $(WebCore)/html/canvas/ImageBitmapRenderingContext.idl \
$(WebCore)/html/canvas/ImageSmoothingQuality.idl \
$(WebCore)/html/canvas/OESElementIndexUint.idl \
$(WebCore)/html/canvas/OESStandardDerivatives.idl \
7C73FB0D191EF5A8007DE061 /* JSUserMessageHandlersNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C73FB0B191EF5A8007DE061 /* JSUserMessageHandlersNamespace.h */; };
7C73FB11191EF6F4007DE061 /* JSUserMessageHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C73FB0F191EF6F4007DE061 /* JSUserMessageHandler.cpp */; };
7C73FB12191EF6F4007DE061 /* JSUserMessageHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C73FB10191EF6F4007DE061 /* JSUserMessageHandler.h */; };
+ 7C7761A81F878A8B00F869FC /* JSImageBitmapRenderingContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C7903B71F86FDE400463A70 /* JSImageBitmapRenderingContext.cpp */; };
+ 7C7761AA1F878AA500F869FC /* JSImageBitmapRenderingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C7903B81F86FDE600463A70 /* JSImageBitmapRenderingContext.h */; };
7C77C3D11DEE472400A50BFA /* BlobPropertyBag.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C77C3D01DEE472400A50BFA /* BlobPropertyBag.h */; settings = {ATTRIBUTES = (Private, ); }; };
7C77C3D41DEF178E00A50BFA /* JSBlobPropertyBag.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C77C3D21DEF178E00A50BFA /* JSBlobPropertyBag.cpp */; };
7C77C3D51DEF178E00A50BFA /* JSBlobPropertyBag.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C77C3D31DEF178E00A50BFA /* JSBlobPropertyBag.h */; };
7C77C3D71DEF850A00A50BFA /* BlobLineEndings.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C77C3D61DEF850A00A50BFA /* BlobLineEndings.h */; settings = {ATTRIBUTES = (Private, ); }; };
7C77C3DB1DEF86D700A50BFA /* JSBlobLineEndings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C77C3D91DEF86D700A50BFA /* JSBlobLineEndings.cpp */; };
7C77C3DC1DEF86D700A50BFA /* JSBlobLineEndings.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C77C3DA1DEF86D700A50BFA /* JSBlobLineEndings.h */; };
+ 7C7903B31F86F95C00463A70 /* ImageBitmapRenderingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C7903B01F86F95C00463A70 /* ImageBitmapRenderingContext.h */; };
+ 7C7903B41F86F95C00463A70 /* ImageBitmapRenderingContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C7903B11F86F95C00463A70 /* ImageBitmapRenderingContext.cpp */; };
7C7941E41C56C29300A4C58E /* DataDetectorsCoreSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C7941E21C56C29300A4C58E /* DataDetectorsCoreSoftLink.mm */; };
7C7941E51C56C29300A4C58E /* DataDetectorsCoreSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C7941E31C56C29300A4C58E /* DataDetectorsCoreSoftLink.h */; };
7C8139A61ED6286A00CE26E8 /* JSDOMAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C8139A31ED6281D00CE26E8 /* JSDOMAttribute.h */; settings = {ATTRIBUTES = (Private, ); }; };
7C77C3D81DEF854000A50BFA /* BlobLineEndings.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = BlobLineEndings.idl; sourceTree = "<group>"; };
7C77C3D91DEF86D700A50BFA /* JSBlobLineEndings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSBlobLineEndings.cpp; sourceTree = "<group>"; };
7C77C3DA1DEF86D700A50BFA /* JSBlobLineEndings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBlobLineEndings.h; sourceTree = "<group>"; };
+ 7C7903B01F86F95C00463A70 /* ImageBitmapRenderingContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageBitmapRenderingContext.h; sourceTree = "<group>"; };
+ 7C7903B11F86F95C00463A70 /* ImageBitmapRenderingContext.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ImageBitmapRenderingContext.cpp; sourceTree = "<group>"; };
+ 7C7903B21F86F95C00463A70 /* ImageBitmapRenderingContext.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = ImageBitmapRenderingContext.idl; sourceTree = "<group>"; };
+ 7C7903B71F86FDE400463A70 /* JSImageBitmapRenderingContext.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSImageBitmapRenderingContext.cpp; sourceTree = "<group>"; };
+ 7C7903B81F86FDE600463A70 /* JSImageBitmapRenderingContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSImageBitmapRenderingContext.h; sourceTree = "<group>"; };
+ 7C7903BA1F86FF3300463A70 /* PlaceholderRenderingContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlaceholderRenderingContext.cpp; sourceTree = "<group>"; };
+ 7C7903BC1F86FF3400463A70 /* PlaceholderRenderingContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlaceholderRenderingContext.h; sourceTree = "<group>"; };
7C7941E21C56C29300A4C58E /* DataDetectorsCoreSoftLink.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DataDetectorsCoreSoftLink.mm; sourceTree = "<group>"; };
7C7941E31C56C29300A4C58E /* DataDetectorsCoreSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataDetectorsCoreSoftLink.h; sourceTree = "<group>"; };
7C8139A31ED6281D00CE26E8 /* JSDOMAttribute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMAttribute.h; sourceTree = "<group>"; };
7728694C14F8882500F484DC /* EXTTextureFilterAnisotropic.h */,
7728694D14F8882500F484DC /* EXTTextureFilterAnisotropic.idl */,
311518FB1E78C15F00EC514A /* GPUBasedCanvasRenderingContext.h */,
+ 7C7903B11F86F95C00463A70 /* ImageBitmapRenderingContext.cpp */,
+ 7C7903B01F86F95C00463A70 /* ImageBitmapRenderingContext.h */,
+ 7C7903B21F86F95C00463A70 /* ImageBitmapRenderingContext.idl */,
7C193BAF1F5E0EB40088F3E6 /* ImageSmoothingQuality.h */,
7C193BA81F5E0EAF0088F3E6 /* ImageSmoothingQuality.idl */,
7E5D7A73161D3F8F00896C34 /* OESElementIndexUint.cpp */,
7C193BA71F5E0EAF0088F3E6 /* Path2D.cpp */,
7C193BAB1F5E0EB10088F3E6 /* Path2D.h */,
7C193BB41F5E0EB70088F3E6 /* Path2D.idl */,
+ 7C7903BA1F86FF3300463A70 /* PlaceholderRenderingContext.cpp */,
+ 7C7903BC1F86FF3400463A70 /* PlaceholderRenderingContext.h */,
D3F3D35B1A69A5060059FC2B /* WebGL2RenderingContext.cpp */,
D3F3D35C1A69A5060059FC2B /* WebGL2RenderingContext.h */,
D3F3D35D1A69A5060059FC2B /* WebGL2RenderingContext.idl */,
6E4ABCD3138EA0B70071D291 /* JSHTMLUnknownElement.h */,
E446140E0CD6826900FADA75 /* JSHTMLVideoElement.cpp */,
E446140F0CD6826900FADA75 /* JSHTMLVideoElement.h */,
+ 7C7903B71F86FDE400463A70 /* JSImageBitmapRenderingContext.cpp */,
+ 7C7903B81F86FDE600463A70 /* JSImageBitmapRenderingContext.h */,
31D26BC61F86D269008FF255 /* JSImageBitmap.cpp */,
31D26BC31F86D265008FF255 /* JSImageBitmap.h */,
31D26BC41F86D266008FF255 /* JSImageBitmapOptions.cpp */,
467302021C4EFE7800BCB357 /* IgnoreOpensDuringUnloadCountIncrementer.h in Headers */,
B27535700B053814002CE64F /* Image.h in Headers */,
55A336F91D821E3C0022C4C7 /* ImageBackingStore.h in Headers */,
+ 7C7903B31F86F95C00463A70 /* ImageBitmapRenderingContext.h in Headers */,
B2A10B920B3818BD00099AA4 /* ImageBuffer.h in Headers */,
22BD9F7F1353625C009BD102 /* ImageBufferData.h in Headers */,
22BD9F81135364FE009BD102 /* ImageBufferDataCG.h in Headers */,
CDC8B5A7180474F70016E685 /* MediaSourcePrivateAVFObjC.h in Headers */,
CDDC1E7A18A952F30027A9D4 /* MediaSourcePrivateClient.h in Headers */,
CD61FE681794AADB004101EB /* MediaSourceRegistry.h in Headers */,
+ 7C7761AA1F878AA500F869FC /* JSImageBitmapRenderingContext.h in Headers */,
078E091517D14D1C00420AA1 /* MediaStream.h in Headers */,
078E094C17D1709600420AA1 /* MediaStreamAudioDestinationNode.h in Headers */,
0783228518013ED800999E0C /* MediaStreamAudioSource.h in Headers */,
4A6E9FC313C17D1D0046A7F8 /* CSSFontFeatureValue.cpp in Sources */,
BC64B4DB0CB4298A005F2B62 /* CSSFontSelector.cpp in Sources */,
C2E38F011E84573500CA3ADF /* CSSFontStyleRangeValue.cpp in Sources */,
+ 7C7761A81F878A8B00F869FC /* JSImageBitmapRenderingContext.cpp in Sources */,
C2E38EFD1E8396FD00CA3ADF /* CSSFontStyleValue.cpp in Sources */,
A80E6CF10A1989CA007FB8C5 /* CSSFontValue.cpp in Sources */,
C21DF2E91D9E4E9900F5B24C /* CSSFontVariationValue.cpp in Sources */,
C3CF17A415B0063F00276D39 /* IdTargetObserver.cpp in Sources */,
C3CF17A615B0063F00276D39 /* IdTargetObserverRegistry.cpp in Sources */,
B275356F0B053814002CE64F /* Image.cpp in Sources */,
+ 7C7903B41F86F95C00463A70 /* ImageBitmapRenderingContext.cpp in Sources */,
31D26BCB1F87065B008FF255 /* ImageBitmap.cpp in Sources */,
43D2597713C816F400608559 /* ImageBuffer.cpp in Sources */,
B2A10B940B3818D700099AA4 /* ImageBufferCG.cpp in Sources */,
#include "HashChangeEvent.h"
#include "History.h"
#include "HitTestResult.h"
+#include "ImageBitmapRenderingContext.h"
#include "ImageLoader.h"
#include "InspectorInstrumentation.h"
#include "JSCustomElementInterface.h"
class HTMLScriptElement;
class HitTestRequest;
class HitTestResult;
+class ImageBitmapRenderingContext;
class IntPoint;
class JSNode;
class LayoutPoint;
#if ENABLE(WEBGPU)
RefPtr<WebGPURenderingContext>,
#endif
- RefPtr<CanvasRenderingContext2D>>;
+ RefPtr<ImageBitmapRenderingContext>,
+ RefPtr<CanvasRenderingContext2D>
+>;
class Document
: public ContainerNode
#if defined(ENABLE_WEBGPU) && ENABLE_WEBGPU
WebGPURenderingContext or
#endif
+ ImageBitmapRenderingContext or
CanvasRenderingContext2D) RenderingContext;
[
#include "GraphicsContext.h"
#include "HTMLNames.h"
#include "HTMLParserIdioms.h"
+#include "ImageBitmapRenderingContext.h"
#include "ImageData.h"
#include "InspectorInstrumentation.h"
#include "JSDOMConvertDictionary.h"
return cssCanvasClients;
}
-void HTMLCanvasElement::setHeight(unsigned value)
+ExceptionOr<void> HTMLCanvasElement::setHeight(unsigned value)
{
+ if (m_context && m_context->isPlaceholder())
+ return Exception { InvalidStateError };
setAttributeWithoutSynchronization(heightAttr, AtomicString::number(limitToOnlyHTMLNonNegative(value, defaultHeight)));
+ return { };
}
-void HTMLCanvasElement::setWidth(unsigned value)
+ExceptionOr<void> HTMLCanvasElement::setWidth(unsigned value)
{
+ if (m_context && m_context->isPlaceholder())
+ return Exception { InvalidStateError };
setAttributeWithoutSynchronization(widthAttr, AtomicString::number(limitToOnlyHTMLNonNegative(value, defaultWidth)));
+ return { };
}
static inline size_t maxActivePixelMemory()
ExceptionOr<std::optional<RenderingContext>> HTMLCanvasElement::getContext(JSC::ExecState& state, const String& contextId, Vector<JSC::Strong<JSC::Unknown>>&& arguments)
{
- if (is2dType(contextId)) {
- if (auto context = getContext2d(contextId))
- return std::optional<RenderingContext> { RefPtr<CanvasRenderingContext2D> { context } };
+ if (m_context) {
+ if (m_context->isPlaceholder())
+ return Exception { InvalidStateError };
+
+ if (m_context->is2d()) {
+ if (!is2dType(contextId))
+ return std::optional<RenderingContext> { std::nullopt };
+ return std::optional<RenderingContext> { RefPtr<CanvasRenderingContext2D> { &downcast<CanvasRenderingContext2D>(*m_context) } };
+ }
+
+ if (m_context->isBitmapRenderer()) {
+ if (!isBitmapRendererType(contextId))
+ return std::optional<RenderingContext> { std::nullopt };
+ return std::optional<RenderingContext> { RefPtr<ImageBitmapRenderingContext> { &downcast<ImageBitmapRenderingContext>(*m_context) } };
+ }
+
+#if ENABLE(WEBGL)
+ if (m_context->isWebGL()) {
+ if (!isWebGLType(contextId))
+ return std::optional<RenderingContext> { std::nullopt };
+ if (is<WebGLRenderingContext>(*m_context))
+ return std::optional<RenderingContext> { RefPtr<WebGLRenderingContext> { &downcast<WebGLRenderingContext>(*m_context) } };
+#if ENABLE(WEBGL2)
+ ASSERT(is<WebGL2RenderingContext>(*m_context));
+ return std::optional<RenderingContext> { RefPtr<WebGL2RenderingContext> { &downcast<WebGL2RenderingContext>(*m_context) } };
+#endif
+ }
+#endif
+
+#if ENABLE(WEBGPU)
+ if (m_context->isWebGPU()) {
+ if (!isWebGPUType(contextId))
+ return std::optional<RenderingContext> { std::nullopt };
+ return std::optional<RenderingContext> { RefPtr<WebGPURenderingContext> { &downcast<WebGPURenderingContext>(*m_context) } };
+ }
+#endif
+
+ ASSERT_NOT_REACHED();
return std::optional<RenderingContext> { std::nullopt };
}
+ if (is2dType(contextId)) {
+ auto context = createContext2d(contextId);
+ if (!context)
+ return std::optional<RenderingContext> { std::nullopt };
+ return std::optional<RenderingContext> { RefPtr<CanvasRenderingContext2D> { context } };
+ }
+
+ if (isBitmapRendererType(contextId)) {
+ auto context = createContextBitmapRenderer(contextId);
+ if (!context)
+ return std::optional<RenderingContext> { std::nullopt };
+ return std::optional<RenderingContext> { RefPtr<ImageBitmapRenderingContext> { context } };
+ }
+
#if ENABLE(WEBGL)
- if (is3dType(contextId)) {
+ if (isWebGLType(contextId)) {
auto scope = DECLARE_THROW_SCOPE(state.vm());
auto attributes = convert<IDLDictionary<WebGLContextAttributes>>(state, !arguments.isEmpty() ? arguments[0].get() : JSC::jsUndefined());
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
- if (auto context = getContextWebGL(contextId, WTFMove(attributes))) {
- if (is<WebGLRenderingContext>(*context))
- return std::optional<RenderingContext> { RefPtr<WebGLRenderingContext> { &downcast<WebGLRenderingContext>(*context) } };
+ auto context = createContextWebGL(contextId, WTFMove(attributes));
+ if (!context)
+ return std::optional<RenderingContext> { std::nullopt };
+
+ if (is<WebGLRenderingContext>(*context))
+ return std::optional<RenderingContext> { RefPtr<WebGLRenderingContext> { &downcast<WebGLRenderingContext>(*context) } };
#if ENABLE(WEBGL2)
- if (is<WebGL2RenderingContext>(*context))
- return std::optional<RenderingContext> { RefPtr<WebGL2RenderingContext> { &downcast<WebGL2RenderingContext>(*context) } };
+ ASSERT(is<WebGL2RenderingContext>(*context));
+ return std::optional<RenderingContext> { RefPtr<WebGL2RenderingContext> { &downcast<WebGL2RenderingContext>(*context) } };
#endif
- }
-
- return std::optional<RenderingContext> { std::nullopt };
}
#endif
#if ENABLE(WEBGPU)
if (isWebGPUType(contextId)) {
- if (auto context = getContextWebGPU(contextId))
- return std::optional<RenderingContext> { RefPtr<WebGPURenderingContext> { context } };
- return std::optional<RenderingContext> { std::nullopt };
+ auto context = createContextWebGPU(contextId);
+ if (!context)
+ return std::optional<RenderingContext> { std::nullopt };
+ return std::optional<RenderingContext> { RefPtr<WebGPURenderingContext> { context } };
}
#endif
if (HTMLCanvasElement::is2dType(type))
return getContext2d(type);
+ if (HTMLCanvasElement::isBitmapRendererType(type))
+ return getContextBitmapRenderer(type);
+
#if ENABLE(WEBGPU)
if (HTMLCanvasElement::isWebGPUType(type) && RuntimeEnabledFeatures::sharedFeatures().webGPUEnabled())
return getContextWebGPU(type);
#endif
#if ENABLE(WEBGL)
- if (HTMLCanvasElement::is3dType(type))
+ if (HTMLCanvasElement::isWebGLType(type))
return getContextWebGL(type);
#endif
return type == "2d";
}
-CanvasRenderingContext2D* HTMLCanvasElement::getContext2d(const String& type)
+CanvasRenderingContext2D* HTMLCanvasElement::createContext2d(const String& type)
{
ASSERT_UNUSED(HTMLCanvasElement::is2dType(type), type);
+ ASSERT(!m_context);
- if (m_context && !m_context->is2d())
- return nullptr;
-
- if (!m_context) {
- bool usesDashboardCompatibilityMode = false;
+ bool usesDashboardCompatibilityMode = false;
#if ENABLE(DASHBOARD_SUPPORT)
- usesDashboardCompatibilityMode = document().settings().usesDashboardBackwardCompatibilityMode();
+ usesDashboardCompatibilityMode = document().settings().usesDashboardBackwardCompatibilityMode();
#endif
- // Make sure we don't use more pixel memory than the system can support.
- size_t requestedPixelMemory = 4 * width() * height();
- if (activePixelMemory + requestedPixelMemory > maxActivePixelMemory()) {
- StringBuilder stringBuilder;
- stringBuilder.appendLiteral("Total canvas memory use exceeds the maximum limit (");
- stringBuilder.appendNumber(maxActivePixelMemory() / 1024 / 1024);
- stringBuilder.appendLiteral(" MB).");
- document().addConsoleMessage(MessageSource::JS, MessageLevel::Warning, stringBuilder.toString());
- return nullptr;
- }
+ // Make sure we don't use more pixel memory than the system can support.
+ size_t requestedPixelMemory = 4 * width() * height();
+ if (activePixelMemory + requestedPixelMemory > maxActivePixelMemory()) {
+ StringBuilder stringBuilder;
+ stringBuilder.appendLiteral("Total canvas memory use exceeds the maximum limit (");
+ stringBuilder.appendNumber(maxActivePixelMemory() / 1024 / 1024);
+ stringBuilder.appendLiteral(" MB).");
+ document().addConsoleMessage(MessageSource::JS, MessageLevel::Warning, stringBuilder.toString());
+ return nullptr;
+ }
- m_context = std::make_unique<CanvasRenderingContext2D>(*this, document().inQuirksMode(), usesDashboardCompatibilityMode);
+ m_context = std::make_unique<CanvasRenderingContext2D>(*this, document().inQuirksMode(), usesDashboardCompatibilityMode);
- downcast<CanvasRenderingContext2D>(*m_context).setUsesDisplayListDrawing(m_usesDisplayListDrawing);
- downcast<CanvasRenderingContext2D>(*m_context).setTracksDisplayListReplay(m_tracksDisplayListReplay);
+ downcast<CanvasRenderingContext2D>(*m_context).setUsesDisplayListDrawing(m_usesDisplayListDrawing);
+ downcast<CanvasRenderingContext2D>(*m_context).setTracksDisplayListReplay(m_tracksDisplayListReplay);
- InspectorInstrumentation::didCreateCanvasRenderingContext(*this);
+ InspectorInstrumentation::didCreateCanvasRenderingContext(*this);
#if USE(IOSURFACE_CANVAS_BACKING_STORE) || ENABLE(ACCELERATED_2D_CANVAS)
- // Need to make sure a RenderLayer and compositing layer get created for the Canvas
- invalidateStyleAndLayerComposition();
+ // Need to make sure a RenderLayer and compositing layer get created for the Canvas
+ invalidateStyleAndLayerComposition();
#endif
- }
return static_cast<CanvasRenderingContext2D*>(m_context.get());
}
+CanvasRenderingContext2D* HTMLCanvasElement::getContext2d(const String& type)
+{
+ ASSERT_UNUSED(HTMLCanvasElement::is2dType(type), type);
+
+ if (m_context && !m_context->is2d())
+ return nullptr;
+
+ if (!m_context)
+ return createContext2d(type);
+ return static_cast<CanvasRenderingContext2D*>(m_context.get());
+}
+
#if ENABLE(WEBGL)
static bool requiresAcceleratedCompositingForWebGL()
{
return settings.acceleratedCompositingEnabled();
}
-bool HTMLCanvasElement::is3dType(const String& type)
+bool HTMLCanvasElement::isWebGLType(const String& type)
{
// Retain support for the legacy "webkit-3d" name.
return type == "webgl" || type == "experimental-webgl"
|| type == "webkit-3d";
}
+WebGLRenderingContextBase* HTMLCanvasElement::createContextWebGL(const String& type, WebGLContextAttributes&& attrs)
+{
+ ASSERT(HTMLCanvasElement::isWebGLType(type));
+ ASSERT(!m_context);
+
+ if (!shouldEnableWebGL(document().settings()))
+ return nullptr;
+
+ m_context = WebGLRenderingContextBase::create(*this, attrs, type);
+ if (m_context) {
+ // Need to make sure a RenderLayer and compositing layer get created for the Canvas
+ invalidateStyleAndLayerComposition();
+
+ InspectorInstrumentation::didCreateCanvasRenderingContext(*this);
+ }
+
+ return static_cast<WebGLRenderingContextBase*>(m_context.get());
+}
+
WebGLRenderingContextBase* HTMLCanvasElement::getContextWebGL(const String& type, WebGLContextAttributes&& attrs)
{
- ASSERT(HTMLCanvasElement::is3dType(type));
+ ASSERT(HTMLCanvasElement::isWebGLType(type));
if (!shouldEnableWebGL(document().settings()))
return nullptr;
if (m_context && !m_context->isWebGL())
return nullptr;
- if (!m_context) {
- m_context = WebGLRenderingContextBase::create(*this, attrs, type);
- if (m_context) {
- // Need to make sure a RenderLayer and compositing layer get created for the Canvas
- invalidateStyleAndLayerComposition();
-
- InspectorInstrumentation::didCreateCanvasRenderingContext(*this);
- }
- }
-
+ if (!m_context)
+ return createContextWebGL(type, WTFMove(attrs));
return static_cast<WebGLRenderingContextBase*>(m_context.get());
}
#endif
return type == "webgpu";
}
+WebGPURenderingContext* HTMLCanvasElement::createContextWebGPU(const String& type)
+{
+ ASSERT_UNUSED(type, HTMLCanvasElement::isWebGPUType(type));
+ ASSERT(!m_context);
+
+ if (!RuntimeEnabledFeatures::sharedFeatures().webGPUEnabled())
+ return nullptr;
+
+ m_context = WebGPURenderingContext::create(*this);
+ if (m_context) {
+ // Need to make sure a RenderLayer and compositing layer get created for the Canvas
+ invalidateStyleAndLayerComposition();
+
+ InspectorInstrumentation::didCreateCanvasRenderingContext(*this);
+ }
+
+ return static_cast<WebGPURenderingContext*>(m_context.get());
+}
+
WebGPURenderingContext* HTMLCanvasElement::getContextWebGPU(const String& type)
{
ASSERT_UNUSED(type, HTMLCanvasElement::isWebGPUType(type));
if (m_context && !m_context->isWebGPU())
return nullptr;
- if (!m_context) {
- m_context = WebGPURenderingContext::create(*this);
- if (m_context) {
- // Need to make sure a RenderLayer and compositing layer get created for the Canvas
- invalidateStyleAndLayerComposition();
-
- InspectorInstrumentation::didCreateCanvasRenderingContext(*this);
- }
- }
-
+ if (!m_context)
+ return createContextWebGPU(type);
return static_cast<WebGPURenderingContext*>(m_context.get());
}
#endif
+bool HTMLCanvasElement::isBitmapRendererType(const String& type)
+{
+ return type == "bitmaprenderer";
+}
+
+ImageBitmapRenderingContext* HTMLCanvasElement::createContextBitmapRenderer(const String& type)
+{
+ ASSERT_UNUSED(type, HTMLCanvasElement::isBitmapRendererType(type));
+ ASSERT(!m_context);
+
+ m_context = std::make_unique<ImageBitmapRenderingContext>(*this);
+
+ return static_cast<ImageBitmapRenderingContext*>(m_context.get());
+}
+
+ImageBitmapRenderingContext* HTMLCanvasElement::getContextBitmapRenderer(const String& type)
+{
+ ASSERT_UNUSED(type, HTMLCanvasElement::isBitmapRendererType(type));
+ if (!m_context)
+ return createContextBitmapRenderer(type);
+ return static_cast<ImageBitmapRenderingContext*>(m_context.get());
+}
+
void HTMLCanvasElement::didDraw(const FloatRect& rect)
{
clearCopiedImage();
unsigned width() const { return size().width(); }
unsigned height() const { return size().height(); }
- const IntSize& size() const { return m_size; }
+ WEBCORE_EXPORT ExceptionOr<void> setWidth(unsigned);
+ WEBCORE_EXPORT ExceptionOr<void> setHeight(unsigned);
- WEBCORE_EXPORT void setWidth(unsigned);
- WEBCORE_EXPORT void setHeight(unsigned);
+ const IntSize& size() const { return m_size; }
void setSize(const IntSize& newSize)
{
CanvasRenderingContext* getContext(const String&);
static bool is2dType(const String&);
+ CanvasRenderingContext2D* createContext2d(const String& type);
CanvasRenderingContext2D* getContext2d(const String&);
#if ENABLE(WEBGL)
- static bool is3dType(const String&);
+ static bool isWebGLType(const String&);
+ WebGLRenderingContextBase* createContextWebGL(const String&, WebGLContextAttributes&& = { });
WebGLRenderingContextBase* getContextWebGL(const String&, WebGLContextAttributes&& = { });
#endif
#if ENABLE(WEBGPU)
static bool isWebGPUType(const String&);
+ WebGPURenderingContext* createContextWebGPU(const String&);
WebGPURenderingContext* getContextWebGPU(const String&);
#endif
+ static bool isBitmapRendererType(const String&);
+ ImageBitmapRenderingContext* createContextBitmapRenderer(const String&);
+ ImageBitmapRenderingContext* getContextBitmapRenderer(const String&);
+
WEBCORE_EXPORT ExceptionOr<UncachedString> toDataURL(const String& mimeType, JSC::JSValue quality);
WEBCORE_EXPORT ExceptionOr<UncachedString> toDataURL(const String& mimeType);
ExceptionOr<void> toBlob(ScriptExecutionContext&, Ref<BlobCallback>&&, const String& mimeType, JSC::JSValue quality);
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
- typedef (
- #if defined(ENABLE_WEBGL) && ENABLE_WEBGL
- WebGLRenderingContext or
- #endif
- #if defined(ENABLE_WEBGL2) && ENABLE_WEBGL2
- WebGL2RenderingContext or
- #endif
- #if defined(ENABLE_WEBGPU) && ENABLE_WEBGPU
- WebGPURenderingContext or
- #endif
- CanvasRenderingContext2D) RenderingContext;
+typedef (
+#if defined(ENABLE_WEBGL) && ENABLE_WEBGL
+ WebGLRenderingContext or
+#endif
+#if defined(ENABLE_WEBGL2) && ENABLE_WEBGL2
+ WebGL2RenderingContext or
+#endif
+#if defined(ENABLE_WEBGPU) && ENABLE_WEBGPU
+ WebGPURenderingContext or
+#endif
+ ImageBitmapRenderingContext or
+ CanvasRenderingContext2D) RenderingContext;
[
JSGenerateToNativeObject,
#endif
virtual bool isGPUBased() const { return false; }
virtual bool isAccelerated() const { return false; }
+ virtual bool isBitmapRenderer() const { return false; }
+ virtual bool isPlaceholder() const { return false; }
virtual void paintRenderingResultsToCanvas() {}
virtual PlatformLayer* platformLayer() const { return 0; }
--- /dev/null
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "ImageBitmapRenderingContext.h"
+
+namespace WebCore {
+
+ImageBitmapRenderingContext::ImageBitmapRenderingContext(HTMLCanvasElement& canvas)
+ : CanvasRenderingContext(canvas)
+{
+}
+
+}
--- /dev/null
+/*
+ * 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
+
+#include "CanvasRenderingContext.h"
+
+namespace WebCore {
+
+class ImageBitmapRenderingContext final : public CanvasRenderingContext {
+public:
+ struct Settings {
+ bool alpha = true;
+ };
+
+ ImageBitmapRenderingContext(HTMLCanvasElement&);
+
+private:
+ bool isBitmapRenderer() const final { return true; }
+};
+
+}
+
+SPECIALIZE_TYPE_TRAITS_CANVASRENDERINGCONTEXT(WebCore::ImageBitmapRenderingContext, isBitmapRenderer())
--- /dev/null
+/*
+ * 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.
+ */
+
+[
+ Exposed=Window
+] interface ImageBitmapRenderingContext {
+ readonly attribute HTMLCanvasElement canvas;
+
+ // FIXME: Add support for transferFromImageBitmap once we have ImageBitmap support.
+ // void transferFromImageBitmap(ImageBitmap? bitmap);
+};
+
+dictionary ImageBitmapRenderingContextSettings {
+ boolean alpha = true;
+};
--- /dev/null
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "PlaceholderRenderingContext.h"
+
+namespace WebCore {
+
+PlaceholderRenderingContext::PlaceholderRenderingContext(HTMLCanvasElement& canvas)
+ : CanvasRenderingContext(canvas)
+{
+}
+
+}
--- /dev/null
+/*
+ * 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
+
+#include "CanvasRenderingContext.h"
+
+namespace WebCore {
+
+class PlaceholderRenderingContext final : public CanvasRenderingContext {
+public:
+ PlaceholderRenderingContext(HTMLCanvasElement&);
+
+private:
+ bool isPlaceholder() const final { return true; }
+};
+
+}
+
+SPECIALIZE_TYPE_TRAITS_CANVASRENDERINGCONTEXT(WebCore::PlaceholderRenderingContext, isPlaceholder())