Diff
Modified: trunk/LayoutTests/ChangeLog (209548 => 209549)
--- trunk/LayoutTests/ChangeLog 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/LayoutTests/ChangeLog 2016-12-08 19:09:35 UTC (rev 209549)
@@ -1,3 +1,40 @@
+2016-12-08 Sam Weinig <s...@webkit.org>
+
+ [WebIDL] WebGLContextAttributes should be a dictionary
+ https://bugs.webkit.org/show_bug.cgi?id=165572
+
+ Reviewed by Dean Jackson.
+
+ * fast/canvas/webgl/context-creation-attributes-expected.txt:
+ Update test results.
+
+2016-12-05 Sam Weinig <s...@webkit.org>
+
+ [WebIDL] Add support for converting dictionaries to JS
+ https://bugs.webkit.org/show_bug.cgi?id=165367
+
+ Reviewed by Darin Adler and Alex Christensen.
+
+ * crypto/subtle/rsa-oaep-generate-key-expected.txt:
+ * crypto/subtle/rsa-oaep-generate-key.html:
+ * crypto/subtle/rsaes-pkcs1-v1_5-generate-key-expected.txt:
+ * crypto/subtle/rsaes-pkcs1-v1_5-generate-key-extractable-expected.txt:
+ * crypto/subtle/rsaes-pkcs1-v1_5-generate-key-extractable.html:
+ * crypto/subtle/rsaes-pkcs1-v1_5-generate-key.html:
+ * crypto/subtle/rsassa-pkcs1-v1_5-generate-key-expected.txt:
+ * crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html:
+ * crypto/webkitSubtle/rsa-oaep-generate-non-extractable-key-expected.txt:
+ * crypto/webkitSubtle/rsa-oaep-generate-non-extractable-key.html:
+ * crypto/webkitSubtle/rsa-oaep-key-manipulation-expected.txt:
+ * crypto/webkitSubtle/rsa-oaep-key-manipulation.html:
+ * crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key-expected.txt:
+ * crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent-expected.txt:
+ * crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent.html:
+ * crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key.html:
+ * crypto/workers/subtle/resources/rsa-generate-key.js:
+ * crypto/workers/subtle/rsa-generate-key-expected.txt:
+ Update tests and expected results to show that CryptoKeyPair is now a vanilla object, not a platform object.
+
2016-12-08 Dave Hyatt <hy...@apple.com>
[CSS Parser] Unskip/remove more tests
Modified: trunk/LayoutTests/fast/canvas/webgl/context-creation-attributes-expected.txt (209548 => 209549)
--- trunk/LayoutTests/fast/canvas/webgl/context-creation-attributes-expected.txt 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/LayoutTests/fast/canvas/webgl/context-creation-attributes-expected.txt 2016-12-08 19:09:35 UTC (rev 209549)
@@ -1,6 +1,6 @@
Note that some of the values tested here might not be supported, and thus should return the default values.
-{"alpha":true,"depth":true,"stencil":false,"antialias":true,"premultipliedAlpha":true,"preserveDrawingBuffer":false,"preferLowPowerToHighPerformance":false,"failIfMajorPerformanceCaveat":false}
-{"alpha":true,"depth":true,"stencil":true,"antialias":true,"premultipliedAlpha":true,"preserveDrawingBuffer":false,"preferLowPowerToHighPerformance":false,"failIfMajorPerformanceCaveat":false}
-{"alpha":true,"depth":true,"stencil":false,"antialias":true,"premultipliedAlpha":true,"preserveDrawingBuffer":false,"preferLowPowerToHighPerformance":true,"failIfMajorPerformanceCaveat":false}
-{"alpha":true,"depth":true,"stencil":false,"antialias":true,"premultipliedAlpha":true,"preserveDrawingBuffer":false,"preferLowPowerToHighPerformance":false,"failIfMajorPerformanceCaveat":false}
+{"alpha":true,"antialias":true,"depth":true,"failIfMajorPerformanceCaveat":false,"preferLowPowerToHighPerformance":false,"premultipliedAlpha":true,"preserveDrawingBuffer":false,"stencil":false}
+{"alpha":true,"antialias":true,"depth":true,"failIfMajorPerformanceCaveat":false,"preferLowPowerToHighPerformance":false,"premultipliedAlpha":true,"preserveDrawingBuffer":false,"stencil":true}
+{"alpha":true,"antialias":true,"depth":true,"failIfMajorPerformanceCaveat":false,"preferLowPowerToHighPerformance":true,"premultipliedAlpha":true,"preserveDrawingBuffer":false,"stencil":false}
+{"alpha":true,"antialias":true,"depth":true,"failIfMajorPerformanceCaveat":true,"preferLowPowerToHighPerformance":false,"premultipliedAlpha":true,"preserveDrawingBuffer":false,"stencil":false}
Modified: trunk/Source/WebCore/CMakeLists.txt (209548 => 209549)
--- trunk/Source/WebCore/CMakeLists.txt 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/CMakeLists.txt 2016-12-08 19:09:35 UTC (rev 209549)
@@ -1783,7 +1783,6 @@
html/WeekInputType.cpp
html/canvas/ANGLEInstancedArrays.cpp
- html/canvas/CanvasContextAttributes.cpp
html/canvas/CanvasGradient.cpp
html/canvas/CanvasPath.cpp
html/canvas/CanvasPattern.cpp
@@ -1809,7 +1808,6 @@
html/canvas/WebGLCompressedTextureATC.cpp
html/canvas/WebGLCompressedTexturePVRTC.cpp
html/canvas/WebGLCompressedTextureS3TC.cpp
- html/canvas/WebGLContextAttributes.cpp
html/canvas/WebGLContextEvent.cpp
html/canvas/WebGLContextGroup.cpp
html/canvas/WebGLContextObject.cpp
@@ -3104,7 +3102,6 @@
html/canvas/WebGLCompressedTextureATC.cpp
html/canvas/WebGLCompressedTexturePVRTC.cpp
html/canvas/WebGLCompressedTextureS3TC.cpp
- html/canvas/WebGLContextAttributes.cpp
html/canvas/WebGLContextEvent.cpp
html/canvas/WebGLContextGroup.cpp
html/canvas/WebGLContextObject.cpp
Modified: trunk/Source/WebCore/ChangeLog (209548 => 209549)
--- trunk/Source/WebCore/ChangeLog 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/ChangeLog 2016-12-08 19:09:35 UTC (rev 209549)
@@ -1,3 +1,69 @@
+2016-12-07 Sam Weinig <s...@webkit.org>
+
+ [WebIDL] WebGLContextAttributes should be a dictionary
+ https://bugs.webkit.org/show_bug.cgi?id=165572
+
+ Reviewed by Dean Jackson.
+
+ * CMakeLists.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ Remove unused files.
+
+ * bindings/js/JSHTMLCanvasElementCustom.cpp:
+ (WebCore::JSHTMLCanvasElement::getContext):
+ (WebCore::attributesFor3DContext): Deleted.
+ Re-work getContext to use JSDOMConvert and use the WebGLContextAttributes dictionary.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (NativeToJSValueDOMConvertNeedsState):
+ (NativeToJSValueDOMConvertNeedsGlobalObject):
+ Add missing inclusion of dictionaries.
+
+ * html/HTMLCanvasElement.cpp:
+ (WebCore::maxActivePixelMemory):
+ (WebCore::HTMLCanvasElement::getContext):
+ (WebCore::HTMLCanvasElement::is2dType):
+ (WebCore::HTMLCanvasElement::getContext2d):
+ (WebCore::shouldEnableWebGL):
+ (WebCore::HTMLCanvasElement::is3dType):
+ (WebCore::HTMLCanvasElement::getContextWebGL):
+ * html/HTMLCanvasElement.h:
+ Refactor context creation of 2d and WebGL contexts into their own functions. Make the
+ WebGL one take a WebGLContextAttributes struct.
+
+ * html/HTMLCanvasElement.idl:
+ No functionality change. Make IDL match the latest spec.
+
+ * html/canvas/CanvasContextAttributes.cpp: Removed.
+ * html/canvas/CanvasContextAttributes.h: Removed.
+ Remove unneeded base class.
+
+ * html/canvas/WebGLContextAttributes.cpp: Removed.
+ * html/canvas/WebGLContextAttributes.h:
+ Instead of a class, we can use a type alias of GraphicsContext3D::Attributes for
+ WebGLContextAttributes.
+
+ * html/canvas/WebGLContextAttributes.idl:
+ Convert to a dictionary.
+
+ * html/canvas/WebGL2RenderingContext.cpp:
+ * html/canvas/WebGL2RenderingContext.h:
+ * html/canvas/WebGLRenderingContextBase.cpp:
+ (WebCore::WebGLRenderingContextBase::create):
+ (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
+ (WebCore::WebGLRenderingContextBase::clearIfComposited):
+ (WebCore::WebGLRenderingContextBase::getContextAttributes):
+ (WebCore::WebGLRenderingContextBase::applyStencilTest):
+ * html/canvas/WebGLRenderingContextBase.h:
+ Update to WebGLContextAttributes by value, since it is a simple struct now. Update getContextAttributes
+ to return a std::optional<WebGLContextAttributes>.
+
+ * html/canvas/WebGLRenderingContextBase.idl:
+ Make getContextAttributes return a nullable WebGLContextAttributes, as per spec.
+
+ * platform/graphics/GraphicsContext3D.h:
+ Sort attributes into categories, one that match WebGLContextAttributes, and the remainder.
+
2016-12-08 Zalan Bujtas <za...@apple.com>
Do not create multicolumn context for certain type of renderers.
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (209548 => 209549)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-12-08 19:09:35 UTC (rev 209549)
@@ -2655,10 +2655,7 @@
6E47E66110B7944B00B186C8 /* WebGLGetInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E47E65F10B7944B00B186C8 /* WebGLGetInfo.h */; };
6E4ABCD4138EA0B70071D291 /* JSHTMLUnknownElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E4ABCD2138EA0B70071D291 /* JSHTMLUnknownElement.cpp */; };
6E4ABCD5138EA0B70071D291 /* JSHTMLUnknownElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E4ABCD3138EA0B70071D291 /* JSHTMLUnknownElement.h */; };
- 6E4E91AC10F7FB3100A2779C /* CanvasContextAttributes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E4E91A710F7FB3100A2779C /* CanvasContextAttributes.cpp */; };
- 6E4E91AD10F7FB3100A2779C /* CanvasContextAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E4E91A810F7FB3100A2779C /* CanvasContextAttributes.h */; };
- 6E4E91AE10F7FB3100A2779C /* WebGLContextAttributes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E4E91A910F7FB3100A2779C /* WebGLContextAttributes.cpp */; };
- 6E4E91AF10F7FB3100A2779C /* WebGLContextAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E4E91AA10F7FB3100A2779C /* WebGLContextAttributes.h */; };
+ 6E4E91AF10F7FB3100A2779C /* WebGLContextAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E4E91AA10F7FB3100A2779C /* WebGLContextAttributes.h */; settings = {ATTRIBUTES = (Private, ); }; };
6E67D2A61280E8A4008758F7 /* Extensions3DOpenGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E67D2A41280E8A4008758F7 /* Extensions3DOpenGL.cpp */; };
6E67D2A71280E8A4008758F7 /* Extensions3DOpenGL.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E67D2A51280E8A4008758F7 /* Extensions3DOpenGL.h */; };
6E67D2A91280E8BD008758F7 /* Extensions3D.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E67D2A81280E8BD008758F7 /* Extensions3D.h */; };
@@ -2843,6 +2840,7 @@
7C1E97281A9F9834007BF0FB /* AutoFillButtonElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C1E97261A9F9834007BF0FB /* AutoFillButtonElement.h */; };
7C2BDD3D17C7F98C0038FF15 /* JSDOMGlobalObjectTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C2BDD3B17C7F98B0038FF15 /* JSDOMGlobalObjectTask.cpp */; };
7C2BDD3E17C7F98C0038FF15 /* JSDOMGlobalObjectTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C2BDD3C17C7F98B0038FF15 /* JSDOMGlobalObjectTask.h */; };
+ 7C330A021DF8FAC600D3395C /* GraphicsContext3DAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C330A011DF8FAC600D3395C /* GraphicsContext3DAttributes.h */; settings = {ATTRIBUTES = (Private, ); }; };
7C33F3621B4A050400502CAF /* JSDocumentFragmentCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C33F3601B4A050400502CAF /* JSDocumentFragmentCustom.cpp */; };
7C39C3641DDA864C00FEFB29 /* SVGLengthListValues.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C39C3621DDA864900FEFB29 /* SVGLengthListValues.cpp */; };
7C39C3651DDA865200FEFB29 /* SVGLengthListValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C39C3631DDA864900FEFB29 /* SVGLengthListValues.h */; };
@@ -9952,9 +9950,6 @@
6E47E65F10B7944B00B186C8 /* WebGLGetInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGLGetInfo.h; sourceTree = "<group>"; };
6E4ABCD2138EA0B70071D291 /* JSHTMLUnknownElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLUnknownElement.cpp; sourceTree = "<group>"; };
6E4ABCD3138EA0B70071D291 /* JSHTMLUnknownElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLUnknownElement.h; sourceTree = "<group>"; };
- 6E4E91A710F7FB3100A2779C /* CanvasContextAttributes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CanvasContextAttributes.cpp; sourceTree = "<group>"; };
- 6E4E91A810F7FB3100A2779C /* CanvasContextAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CanvasContextAttributes.h; sourceTree = "<group>"; };
- 6E4E91A910F7FB3100A2779C /* WebGLContextAttributes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGLContextAttributes.cpp; sourceTree = "<group>"; };
6E4E91AA10F7FB3100A2779C /* WebGLContextAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGLContextAttributes.h; sourceTree = "<group>"; };
6E4E91AB10F7FB3100A2779C /* WebGLContextAttributes.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebGLContextAttributes.idl; sourceTree = "<group>"; };
6E67D2A41280E8A4008758F7 /* Extensions3DOpenGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Extensions3DOpenGL.cpp; sourceTree = "<group>"; };
@@ -10318,6 +10313,7 @@
7C1E97261A9F9834007BF0FB /* AutoFillButtonElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutoFillButtonElement.h; sourceTree = "<group>"; };
7C2BDD3B17C7F98B0038FF15 /* JSDOMGlobalObjectTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMGlobalObjectTask.cpp; sourceTree = "<group>"; };
7C2BDD3C17C7F98B0038FF15 /* JSDOMGlobalObjectTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMGlobalObjectTask.h; sourceTree = "<group>"; };
+ 7C330A011DF8FAC600D3395C /* GraphicsContext3DAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsContext3DAttributes.h; sourceTree = "<group>"; };
7C33F3601B4A050400502CAF /* JSDocumentFragmentCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDocumentFragmentCustom.cpp; sourceTree = "<group>"; };
7C39C3621DDA864900FEFB29 /* SVGLengthListValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGLengthListValues.cpp; sourceTree = "<group>"; };
7C39C3631DDA864900FEFB29 /* SVGLengthListValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLengthListValues.h; sourceTree = "<group>"; };
@@ -16769,8 +16765,6 @@
31A795C11888B72400382F90 /* ANGLEInstancedArrays.cpp */,
31A795C21888B72400382F90 /* ANGLEInstancedArrays.h */,
31A795C31888B72400382F90 /* ANGLEInstancedArrays.idl */,
- 6E4E91A710F7FB3100A2779C /* CanvasContextAttributes.cpp */,
- 6E4E91A810F7FB3100A2779C /* CanvasContextAttributes.h */,
49484FB3102CF23C00187DD3 /* CanvasGradient.cpp */,
49484FB4102CF23C00187DD3 /* CanvasGradient.h */,
49484FB5102CF23C00187DD3 /* CanvasGradient.idl */,
@@ -16845,7 +16839,6 @@
6E3FAE8C14733FDB00E42306 /* WebGLCompressedTextureS3TC.cpp */,
6E3FAE8D14733FDB00E42306 /* WebGLCompressedTextureS3TC.h */,
6E3FAE9014733FEA00E42306 /* WebGLCompressedTextureS3TC.idl */,
- 6E4E91A910F7FB3100A2779C /* WebGLContextAttributes.cpp */,
6E4E91AA10F7FB3100A2779C /* WebGLContextAttributes.h */,
6E4E91AB10F7FB3100A2779C /* WebGLContextAttributes.idl */,
93F6F1EA127F70B10055CB06 /* WebGLContextEvent.cpp */,
@@ -21614,6 +21607,7 @@
B2A015930AF6CD53006BCE0E /* GraphicsContext.h */,
6E21C6BF1126338500A7BE02 /* GraphicsContext3D.cpp */,
49C7B9FB1042D3650009D447 /* GraphicsContext3D.h */,
+ 7C330A011DF8FAC600D3395C /* GraphicsContext3DAttributes.h */,
0F580B090F12A2690051D689 /* GraphicsLayer.cpp */,
0F580B0A0F12A2690051D689 /* GraphicsLayer.h */,
0F580B0B0F12A2690051D689 /* GraphicsLayerClient.h */,
@@ -25012,7 +25006,6 @@
E43AF8E71AC5B7EC00CA717E /* CacheValidation.h in Headers */,
49AE2D97134EE5F90072920A /* CalculationValue.h in Headers */,
B1D5ECB5134B58DA0087C78F /* CallbackFunction.h in Headers */,
- 6E4E91AD10F7FB3100A2779C /* CanvasContextAttributes.h in Headers */,
49484FC2102CF23C00187DD3 /* CanvasGradient.h in Headers */,
4671E0661D67A59600C6B497 /* CanvasPath.h in Headers */,
49484FC5102CF23C00187DD3 /* CanvasPattern.h in Headers */,
@@ -27876,6 +27869,7 @@
BC22747B0E8366E200E7F975 /* SVGRenderStyleDefs.h in Headers */,
436708F212D9CA4B00044234 /* SVGRenderSupport.h in Headers */,
436708F412D9CA4B00044234 /* SVGRenderTreeAsText.h in Headers */,
+ 7C330A021DF8FAC600D3395C /* GraphicsContext3DAttributes.h in Headers */,
436708F612D9CA4B00044234 /* SVGResources.h in Headers */,
436708F812D9CA4B00044234 /* SVGResourcesCache.h in Headers */,
436708FA12D9CA4B00044234 /* SVGResourcesCycleSolver.h in Headers */,
@@ -28409,7 +28403,7 @@
37A1EAA3142699BC0087F425 /* Check For Inappropriate Objective-C Class Names */,
5DF50887116F3077005202AB /* Check For Inappropriate Files In Framework */,
71D6AA381DA4E69400B23969 /* Copy modern media controls code and assets */,
- 51D394771DF2486700ABE875 /* Copy internal scripts */,
+ 51D394771DF2486700ABE875 /* Copy Internal Scripts */,
);
buildRules = (
);
@@ -28866,7 +28860,6 @@
E43AF8E61AC5B7E800CA717E /* CacheValidation.cpp in Sources */,
49AE2D96134EE5F90072920A /* CalculationValue.cpp in Sources */,
B1827493134CA4C100B98C2D /* CallbackFunction.cpp in Sources */,
- 6E4E91AC10F7FB3100A2779C /* CanvasContextAttributes.cpp in Sources */,
49484FC1102CF23C00187DD3 /* CanvasGradient.cpp in Sources */,
4671E0651D67A59600C6B497 /* CanvasPath.cpp in Sources */,
49484FC4102CF23C00187DD3 /* CanvasPattern.cpp in Sources */,
@@ -31682,7 +31675,6 @@
7E66E23316D6EB6C00F7E7FF /* WebGLCompressedTextureATC.cpp in Sources */,
7E66E23317E6EB6C00F7E7FF /* WebGLCompressedTexturePVRTC.cpp in Sources */,
6E3FAE8E14733FDB00E42306 /* WebGLCompressedTextureS3TC.cpp in Sources */,
- 6E4E91AE10F7FB3100A2779C /* WebGLContextAttributes.cpp in Sources */,
93F6F1ED127F70B10055CB06 /* WebGLContextEvent.cpp in Sources */,
01D3CF8214BD0A3000FE9970 /* WebGLContextGroup.cpp in Sources */,
01D3CF8414BD0A3000FE9970 /* WebGLContextObject.cpp in Sources */,
Modified: trunk/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp (209548 => 209549)
--- trunk/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp 2016-12-08 19:09:35 UTC (rev 209549)
@@ -27,7 +27,6 @@
#include "config.h"
#include "JSHTMLCanvasElement.h"
-#include "CanvasContextAttributes.h"
#include "HTMLCanvasElement.h"
#include "JSCanvasRenderingContext2D.h"
#include <bindings/ScriptObject.h>
@@ -34,9 +33,8 @@
#include <wtf/GetPtr.h>
#if ENABLE(WEBGL)
-#include "JSDictionary.h"
+#include "JSWebGLContextAttributes.h"
#include "JSWebGLRenderingContextBase.h"
-#include "WebGLContextAttributes.h"
#endif
using namespace JSC;
@@ -43,63 +41,30 @@
namespace WebCore {
-#if ENABLE(WEBGL)
-
-static RefPtr<CanvasContextAttributes> attributesFor3DContext(ExecState& state, ThrowScope& scope)
-{
- JSValue initializerValue = state.argument(1);
- if (initializerValue.isUndefinedOrNull())
- return nullptr;
-
- JSObject* initializerObject = initializerValue.toObject(&state);
- ASSERT_UNUSED(scope, !scope.exception());
- JSDictionary dictionary(&state, initializerObject);
-
- GraphicsContext3D::Attributes graphicsAttrs;
-
- dictionary.tryGetProperty("alpha", graphicsAttrs.alpha);
- dictionary.tryGetProperty("depth", graphicsAttrs.depth);
- dictionary.tryGetProperty("stencil", graphicsAttrs.stencil);
- dictionary.tryGetProperty("antialias", graphicsAttrs.antialias);
- dictionary.tryGetProperty("premultipliedAlpha", graphicsAttrs.premultipliedAlpha);
- dictionary.tryGetProperty("preserveDrawingBuffer", graphicsAttrs.preserveDrawingBuffer);
- dictionary.tryGetProperty("preferLowPowerToHighPerformance", graphicsAttrs.preferLowPowerToHighPerformance);
-
- return WebGLContextAttributes::create(graphicsAttrs);
-}
-
-#endif
-
JSValue JSHTMLCanvasElement::getContext(ExecState& state)
{
- VM& vm = state.vm();
+ auto& vm = state.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
if (UNLIKELY(state.argumentCount() < 1))
return throwException(&state, scope, createNotEnoughArgumentsError(&state));
- HTMLCanvasElement& canvas = wrapped();
- const String& contextId = state.uncheckedArgument(0).toWTFString(&state);
-
- RefPtr<CanvasContextAttributes> attributes;
+ auto contextId = convert<IDLDOMString>(state, state.uncheckedArgument(0), StringConversionConfiguration::Normal);
+ RETURN_IF_EXCEPTION(scope, JSValue());
+ if (HTMLCanvasElement::is2dType(contextId))
+ return toJS<IDLNullable<IDLInterface<CanvasRenderingContext2D>>>(state, *globalObject(), static_cast<CanvasRenderingContext2D*>(wrapped().getContext2d(contextId)));
+
#if ENABLE(WEBGL)
if (HTMLCanvasElement::is3dType(contextId)) {
- attributes = attributesFor3DContext(state, scope);
+ auto attributes = convert<IDLDictionary<WebGLContextAttributes>>(state, state.argument(1));
RETURN_IF_EXCEPTION(scope, JSValue());
+
+ return toJS<IDLNullable<IDLInterface<WebGLRenderingContextBase>>>(state, *globalObject(), static_cast<WebGLRenderingContextBase*>(wrapped().getContextWebGL(contextId, WTFMove(attributes))));
}
#endif
-
- auto* context = canvas.getContext(contextId, attributes.get());
- if (!context)
- return jsNull();
-#if ENABLE(WEBGL)
- if (is<WebGLRenderingContextBase>(*context))
- return toJS(&state, globalObject(), downcast<WebGLRenderingContextBase>(*context));
-#endif
-
- return toJS(&state, globalObject(), downcast<CanvasRenderingContext2D>(*context));
+ return jsNull();
}
JSValue JSHTMLCanvasElement::toDataURL(ExecState& state)
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (209548 => 209549)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-12-08 19:09:35 UTC (rev 209549)
@@ -5335,6 +5335,7 @@
return 1 if $codeGenerator->IsRecordType($type);
return 1 if $codeGenerator->IsStringType($type);
return 1 if $codeGenerator->IsEnumType($type);
+ return 1 if $codeGenerator->IsDictionaryType($type);
return 1 if $codeGenerator->IsInterfaceType($type);
return 1 if $codeGenerator->IsTypedArrayType($type);
return 1 if $type->name eq "Date";
@@ -5352,6 +5353,7 @@
return 1 if $type->isUnion;
return 1 if $codeGenerator->IsSequenceOrFrozenArrayType($type);
return 1 if $codeGenerator->IsRecordType($type);
+ return 1 if $codeGenerator->IsDictionaryType($type);
return 1 if $codeGenerator->IsInterfaceType($type);
return 1 if $codeGenerator->IsTypedArrayType($type);
return 1 if $type->name eq "SerializedScriptValue";
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (209548 => 209549)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-12-08 19:09:35 UTC (rev 209549)
@@ -1268,6 +1268,10 @@
bool setJSTestObjStringObjRecordAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsTestObjStringNullableObjRecordAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSTestObjStringNullableObjRecordAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
+JSC::EncodedJSValue jsTestObjDictionaryAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+bool setJSTestObjDictionaryAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
+JSC::EncodedJSValue jsTestObjNullableDictionaryAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+bool setJSTestObjNullableDictionaryAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsTestObjImplementationEnumAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSTestObjImplementationEnumAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsTestObjXMLObjAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
@@ -1600,6 +1604,8 @@
{ "usvstringLongRecordAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjUsvstringLongRecordAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjUsvstringLongRecordAttr) } },
{ "stringObjRecordAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjStringObjRecordAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjStringObjRecordAttr) } },
{ "stringNullableObjRecordAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjStringNullableObjRecordAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjStringNullableObjRecordAttr) } },
+ { "dictionaryAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjDictionaryAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjDictionaryAttr) } },
+ { "nullableDictionaryAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjNullableDictionaryAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjNullableDictionaryAttr) } },
{ "implementationEnumAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjImplementationEnumAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjImplementationEnumAttr) } },
{ "XMLObjAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjXMLObjAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjXMLObjAttr) } },
{ "create", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCreate), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjCreate) } },
@@ -2465,6 +2471,38 @@
return result;
}
+static inline JSValue jsTestObjDictionaryAttrGetter(ExecState&, JSTestObj&, ThrowScope& throwScope);
+
+EncodedJSValue jsTestObjDictionaryAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
+{
+ return BindingCaller<JSTestObj>::attribute<jsTestObjDictionaryAttrGetter>(state, thisValue, "dictionaryAttr");
+}
+
+static inline JSValue jsTestObjDictionaryAttrGetter(ExecState& state, JSTestObj& thisObject, ThrowScope& throwScope)
+{
+ UNUSED_PARAM(throwScope);
+ UNUSED_PARAM(state);
+ auto& impl = thisObject.wrapped();
+ JSValue result = toJS<IDLDictionary<TestObj::Dictionary>>(state, *thisObject.globalObject(), impl.dictionaryAttr());
+ return result;
+}
+
+static inline JSValue jsTestObjNullableDictionaryAttrGetter(ExecState&, JSTestObj&, ThrowScope& throwScope);
+
+EncodedJSValue jsTestObjNullableDictionaryAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
+{
+ return BindingCaller<JSTestObj>::attribute<jsTestObjNullableDictionaryAttrGetter>(state, thisValue, "nullableDictionaryAttr");
+}
+
+static inline JSValue jsTestObjNullableDictionaryAttrGetter(ExecState& state, JSTestObj& thisObject, ThrowScope& throwScope)
+{
+ UNUSED_PARAM(throwScope);
+ UNUSED_PARAM(state);
+ auto& impl = thisObject.wrapped();
+ JSValue result = toJS<IDLNullable<IDLDictionary<TestObj::Dictionary>>>(state, *thisObject.globalObject(), impl.nullableDictionaryAttr());
+ return result;
+}
+
static inline JSValue jsTestObjImplementationEnumAttrGetter(ExecState&, JSTestObj&, ThrowScope& throwScope);
EncodedJSValue jsTestObjImplementationEnumAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
@@ -4011,6 +4049,44 @@
}
+static inline bool setJSTestObjDictionaryAttrFunction(ExecState&, JSTestObj&, JSValue, ThrowScope&);
+
+bool setJSTestObjDictionaryAttr(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+ return BindingCaller<JSTestObj>::setAttribute<setJSTestObjDictionaryAttrFunction>(state, thisValue, encodedValue, "dictionaryAttr");
+}
+
+static inline bool setJSTestObjDictionaryAttrFunction(ExecState& state, JSTestObj& thisObject, JSValue value, ThrowScope& throwScope)
+{
+ UNUSED_PARAM(state);
+ UNUSED_PARAM(throwScope);
+ auto& impl = thisObject.wrapped();
+ auto nativeValue = convert<IDLDictionary<TestObj::Dictionary>>(state, value);
+ RETURN_IF_EXCEPTION(throwScope, false);
+ impl.setDictionaryAttr(WTFMove(nativeValue));
+ return true;
+}
+
+
+static inline bool setJSTestObjNullableDictionaryAttrFunction(ExecState&, JSTestObj&, JSValue, ThrowScope&);
+
+bool setJSTestObjNullableDictionaryAttr(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+ return BindingCaller<JSTestObj>::setAttribute<setJSTestObjNullableDictionaryAttrFunction>(state, thisValue, encodedValue, "nullableDictionaryAttr");
+}
+
+static inline bool setJSTestObjNullableDictionaryAttrFunction(ExecState& state, JSTestObj& thisObject, JSValue value, ThrowScope& throwScope)
+{
+ UNUSED_PARAM(state);
+ UNUSED_PARAM(throwScope);
+ auto& impl = thisObject.wrapped();
+ auto nativeValue = convert<IDLNullable<IDLDictionary<TestObj::Dictionary>>>(state, value);
+ RETURN_IF_EXCEPTION(throwScope, false);
+ impl.setNullableDictionaryAttr(WTFMove(nativeValue));
+ return true;
+}
+
+
static inline bool setJSTestObjImplementationEnumAttrFunction(ExecState&, JSTestObj&, JSValue, ThrowScope&);
bool setJSTestObjImplementationEnumAttr(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (209548 => 209549)
--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2016-12-08 19:09:35 UTC (rev 209549)
@@ -82,6 +82,8 @@
attribute record<ByteString, long> usvstringLongRecordAttr;
attribute record<DOMString, TestObj> stringObjRecordAttr;
attribute record<DOMString, TestObj?> stringNullableObjRecordAttr;
+ attribute TestDictionary dictionaryAttr;
+ attribute TestDictionary? nullableDictionaryAttr;
attribute TestEnumTypeWithAlternateImplementationName implementationEnumAttr;
Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (209548 => 209549)
--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2016-12-08 19:09:35 UTC (rev 209549)
@@ -170,7 +170,73 @@
setAttributeWithoutSynchronization(widthAttr, AtomicString::number(limitToOnlyHTMLNonNegative(value, defaultWidth)));
}
+static inline size_t maxActivePixelMemory()
+{
+ static size_t maxPixelMemory;
+ static std::once_flag onceFlag;
+ std::call_once(onceFlag, [] {
+ maxPixelMemory = std::max(ramSize() / 4, 2151 * MB);
+ });
+ return maxPixelMemory;
+}
+
+CanvasRenderingContext* HTMLCanvasElement::getContext(const String& type)
+{
+ if (HTMLCanvasElement::is2dType(type))
+ return getContext2d(type);
+
#if ENABLE(WEBGL)
+ if (HTMLCanvasElement::is3dType(type))
+ return getContextWebGL(type);
+#endif
+
+ return nullptr;
+}
+
+bool HTMLCanvasElement::is2dType(const String& type)
+{
+ return type == "2d";
+}
+
+CanvasRenderingContext* HTMLCanvasElement::getContext2d(const String& type)
+{
+ ASSERT_UNUSED(HTMLCanvasElement::is2dType(type), type);
+
+ if (m_context && !m_context->is2d())
+ return nullptr;
+ if (!m_context) {
+ bool usesDashboardCompatibilityMode = false;
+#if ENABLE(DASHBOARD_SUPPORT)
+ if (Settings* settings = document().settings())
+ usesDashboardCompatibilityMode = 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;
+ }
+
+ m_context = std::make_unique<CanvasRenderingContext2D>(*this, document().inQuirksMode(), usesDashboardCompatibilityMode);
+
+ downcast<CanvasRenderingContext2D>(*m_context).setUsesDisplayListDrawing(m_usesDisplayListDrawing);
+ downcast<CanvasRenderingContext2D>(*m_context).setTracksDisplayListReplay(m_tracksDisplayListReplay);
+
+#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();
+#endif
+ }
+
+ return m_context.get();
+}
+
+#if ENABLE(WEBGL)
static bool requiresAcceleratedCompositingForWebGL()
{
#if PLATFORM(GTK) || PLATFORM(EFL)
@@ -193,91 +259,38 @@
return settings->acceleratedCompositingEnabled();
}
-#endif
-static inline size_t maxActivePixelMemory()
+bool HTMLCanvasElement::is3dType(const String& type)
{
- static size_t maxPixelMemory;
- static std::once_flag onceFlag;
- std::call_once(onceFlag, [] {
- maxPixelMemory = std::max(ramSize() / 4, 2151 * MB);
- });
- return maxPixelMemory;
+ // Retain support for the legacy "webkit-3d" name.
+ return type == "webgl" || type == "experimental-webgl"
+#if ENABLE(WEBGL2)
+ || type == "webgl2"
+#endif
+ || type == "webkit-3d";
}
-CanvasRenderingContext* HTMLCanvasElement::getContext(const String& type, CanvasContextAttributes* attrs)
+CanvasRenderingContext* HTMLCanvasElement::getContextWebGL(const String& type, WebGLContextAttributes&& attrs)
{
- if (is2dType(type)) {
- if (m_context && !m_context->is2d())
- return nullptr;
- if (!m_context) {
- bool usesDashboardCompatibilityMode = false;
-#if ENABLE(DASHBOARD_SUPPORT)
- if (Settings* settings = document().settings())
- usesDashboardCompatibilityMode = settings->usesDashboardBackwardCompatibilityMode();
-#endif
+ ASSERT(HTMLCanvasElement::is3dType(type));
- // 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;
- }
+ if (!shouldEnableWebGL(document().settings()))
+ return nullptr;
- m_context = std::make_unique<CanvasRenderingContext2D>(*this, document().inQuirksMode(), usesDashboardCompatibilityMode);
+ if (m_context && !m_context->is3d())
+ return nullptr;
- downcast<CanvasRenderingContext2D>(*m_context).setUsesDisplayListDrawing(m_usesDisplayListDrawing);
- downcast<CanvasRenderingContext2D>(*m_context).setTracksDisplayListReplay(m_tracksDisplayListReplay);
-
-#if USE(IOSURFACE_CANVAS_BACKING_STORE) || ENABLE(ACCELERATED_2D_CANVAS)
+ 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();
-#endif
}
- return m_context.get();
}
-#if ENABLE(WEBGL)
- if (shouldEnableWebGL(document().settings())) {
- if (is3dType(type)) {
- if (m_context && !m_context->is3d())
- return nullptr;
- if (!m_context) {
- m_context = WebGLRenderingContextBase::create(*this, static_cast<WebGLContextAttributes*>(attrs), type);
- if (m_context) {
- // Need to make sure a RenderLayer and compositing layer get created for the Canvas
- invalidateStyleAndLayerComposition();
- }
- }
- return m_context.get();
- }
- }
-#else
- UNUSED_PARAM(attrs);
-#endif
- return nullptr;
+ return m_context.get();
}
-
-bool HTMLCanvasElement::is2dType(const String& type)
-{
- return type == "2d";
-}
-
-#if ENABLE(WEBGL)
-bool HTMLCanvasElement::is3dType(const String& type)
-{
- // Retain support for the legacy "webkit-3d" name.
- return type == "webgl" || type == "experimental-webgl"
-#if ENABLE(WEBGL2)
- || type == "webgl2"
#endif
- || type == "webkit-3d";
-}
-#endif
void HTMLCanvasElement::didDraw(const FloatRect& rect)
{
Modified: trunk/Source/WebCore/html/HTMLCanvasElement.h (209548 => 209549)
--- trunk/Source/WebCore/html/HTMLCanvasElement.h 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.h 2016-12-08 19:09:35 UTC (rev 209549)
@@ -33,9 +33,12 @@
#include <memory>
#include <wtf/Forward.h>
+#if ENABLE(WEBGL)
+#include "WebGLContextAttributes.h"
+#endif
+
namespace WebCore {
-class CanvasContextAttributes;
class CanvasRenderingContext;
class GraphicsContext;
class GraphicsContextStateSaver;
@@ -85,10 +88,14 @@
reset();
}
- CanvasRenderingContext* getContext(const String&, CanvasContextAttributes* = nullptr);
+ CanvasRenderingContext* getContext(const String&);
+
static bool is2dType(const String&);
+ CanvasRenderingContext* getContext2d(const String&);
+
#if ENABLE(WEBGL)
static bool is3dType(const String&);
+ CanvasRenderingContext* getContextWebGL(const String&, WebGLContextAttributes&& = { });
#endif
static String toEncodingMimeType(const String& mimeType);
Modified: trunk/Source/WebCore/html/HTMLCanvasElement.idl (209548 => 209549)
--- trunk/Source/WebCore/html/HTMLCanvasElement.idl 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.idl 2016-12-08 19:09:35 UTC (rev 209549)
@@ -24,6 +24,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+typedef (CanvasRenderingContext2D or WebGLRenderingContextBase) RenderingContext;
+
[
JSGenerateToNativeObject,
ReportExtraMemoryCost,
@@ -32,8 +34,7 @@
attribute unsigned long width;
attribute unsigned long height;
+ [Custom] RenderingContext? getContext(DOMString contextId, any... arguments);
+
[Custom, MayThrowException] DOMString toDataURL(optional DOMString? type);
-
- // The custom binding is needed to handle context creation attributes.
- [Custom] any getContext(DOMString contextId, any... arguments);
};
Deleted: trunk/Source/WebCore/html/canvas/CanvasContextAttributes.cpp (209548 => 209549)
--- trunk/Source/WebCore/html/canvas/CanvasContextAttributes.cpp 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/html/canvas/CanvasContextAttributes.cpp 2016-12-08 19:09:35 UTC (rev 209549)
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2010, Google 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:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
- * OWNER OR 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 "CanvasContextAttributes.h"
-
-namespace WebCore {
-
-CanvasContextAttributes::CanvasContextAttributes()
-{
-}
-
-CanvasContextAttributes::~CanvasContextAttributes()
-{
-}
-
-} // namespace WebCore
Deleted: trunk/Source/WebCore/html/canvas/CanvasContextAttributes.h (209548 => 209549)
--- trunk/Source/WebCore/html/canvas/CanvasContextAttributes.h 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/html/canvas/CanvasContextAttributes.h 2016-12-08 19:09:35 UTC (rev 209549)
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2010, Google 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:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
- * OWNER OR 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 <wtf/RefCounted.h>
-
-namespace WebCore {
-
-// A base class for any attributes that are needed which would affect
-// the creation of the Canvas's rendering context. Currently only the
-// WebGLRenderingContext uses this mechanism.
-
-class CanvasContextAttributes : public RefCounted<CanvasContextAttributes> {
-public:
- virtual ~CanvasContextAttributes();
-
-protected:
- CanvasContextAttributes();
-};
-
-} // namespace WebCore
Modified: trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp (209548 => 209549)
--- trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp 2016-12-08 19:09:35 UTC (rev 209549)
@@ -44,7 +44,6 @@
#include "WebGLCompressedTextureATC.h"
#include "WebGLCompressedTexturePVRTC.h"
#include "WebGLCompressedTextureS3TC.h"
-#include "WebGLContextAttributes.h"
#include "WebGLDebugRendererInfo.h"
#include "WebGLDebugShaders.h"
#include "WebGLDepthTexture.h"
@@ -59,12 +58,12 @@
namespace WebCore {
-WebGL2RenderingContext::WebGL2RenderingContext(HTMLCanvasElement& passedCanvas, GraphicsContext3D::Attributes attributes)
+WebGL2RenderingContext::WebGL2RenderingContext(HTMLCanvasElement& passedCanvas, GraphicsContext3DAttributes attributes)
: WebGLRenderingContextBase(passedCanvas, attributes)
{
}
-WebGL2RenderingContext::WebGL2RenderingContext(HTMLCanvasElement& passedCanvas, RefPtr<GraphicsContext3D>&& context, GraphicsContext3D::Attributes attributes)
+WebGL2RenderingContext::WebGL2RenderingContext(HTMLCanvasElement& passedCanvas, RefPtr<GraphicsContext3D>&& context, GraphicsContext3DAttributes attributes)
: WebGLRenderingContextBase(passedCanvas, WTFMove(context), attributes)
{
initializeShaderExtensions();
Modified: trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.h (209548 => 209549)
--- trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.h 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.h 2016-12-08 19:09:35 UTC (rev 209549)
@@ -40,8 +40,8 @@
class WebGL2RenderingContext final : public WebGLRenderingContextBase {
public:
- WebGL2RenderingContext(HTMLCanvasElement&, GraphicsContext3D::Attributes);
- WebGL2RenderingContext(HTMLCanvasElement&, RefPtr<GraphicsContext3D>&&, GraphicsContext3D::Attributes);
+ WebGL2RenderingContext(HTMLCanvasElement&, WebGLContextAttributes);
+ WebGL2RenderingContext(HTMLCanvasElement&, RefPtr<GraphicsContext3D>&&, WebGLContextAttributes);
/* Buffer objects */
using WebGLRenderingContextBase::bufferData;
Deleted: trunk/Source/WebCore/html/canvas/WebGLContextAttributes.cpp (209548 => 209549)
--- trunk/Source/WebCore/html/canvas/WebGLContextAttributes.cpp 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/html/canvas/WebGLContextAttributes.cpp 2016-12-08 19:09:35 UTC (rev 209549)
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2010, Google 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:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
- * OWNER OR 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"
-
-#if ENABLE(WEBGL)
-
-#include "WebGLContextAttributes.h"
-
-namespace WebCore {
-
-Ref<WebGLContextAttributes> WebGLContextAttributes::create()
-{
- return adoptRef(*new WebGLContextAttributes());
-}
-
-Ref<WebGLContextAttributes> WebGLContextAttributes::create(GraphicsContext3D::Attributes attributes)
-{
- return adoptRef(*new WebGLContextAttributes(attributes));
-}
-
-WebGLContextAttributes::WebGLContextAttributes()
- : CanvasContextAttributes()
-{
-}
-
-WebGLContextAttributes::WebGLContextAttributes(GraphicsContext3D::Attributes attributes)
- : CanvasContextAttributes()
- , m_attrs(attributes)
-{
-}
-
-WebGLContextAttributes::~WebGLContextAttributes()
-{
-}
-
-bool WebGLContextAttributes::alpha() const
-{
- return m_attrs.alpha;
-}
-
-void WebGLContextAttributes::setAlpha(bool alpha)
-{
- m_attrs.alpha = alpha;
-}
-
-bool WebGLContextAttributes::depth() const
-{
- return m_attrs.depth;
-}
-
-void WebGLContextAttributes::setDepth(bool depth)
-{
- m_attrs.depth = depth;
-}
-
-bool WebGLContextAttributes::stencil() const
-{
- return m_attrs.stencil;
-}
-
-void WebGLContextAttributes::setStencil(bool stencil)
-{
- m_attrs.stencil = stencil;
-}
-
-bool WebGLContextAttributes::antialias() const
-{
- return m_attrs.antialias;
-}
-
-void WebGLContextAttributes::setAntialias(bool antialias)
-{
- m_attrs.antialias = antialias;
-}
-
-bool WebGLContextAttributes::premultipliedAlpha() const
-{
- return m_attrs.premultipliedAlpha;
-}
-
-void WebGLContextAttributes::setPremultipliedAlpha(bool premultipliedAlpha)
-{
- m_attrs.premultipliedAlpha = premultipliedAlpha;
-}
-
-bool WebGLContextAttributes::preserveDrawingBuffer() const
-{
- return m_attrs.preserveDrawingBuffer;
-}
-
-void WebGLContextAttributes::setPreserveDrawingBuffer(bool preserveDrawingBuffer)
-{
- m_attrs.preserveDrawingBuffer = preserveDrawingBuffer;
-}
-
-bool WebGLContextAttributes::preferLowPowerToHighPerformance() const
-{
- return m_attrs.preferLowPowerToHighPerformance;
-}
-
-void WebGLContextAttributes::setPreferLowPowerToHighPerformance(bool preferLowPower)
-{
- m_attrs.preferLowPowerToHighPerformance = preferLowPower;
-}
-
-bool WebGLContextAttributes::failIfMajorPerformanceCaveat() const
-{
- return m_attrs.failIfMajorPerformanceCaveat;
-}
-
-void WebGLContextAttributes::setFailIfMajorPerformanceCaveat(bool fail)
-{
- m_attrs.failIfMajorPerformanceCaveat = fail;
-}
-
-GraphicsContext3D::Attributes WebGLContextAttributes::attributes() const
-{
- return m_attrs;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGL)
Modified: trunk/Source/WebCore/html/canvas/WebGLContextAttributes.h (209548 => 209549)
--- trunk/Source/WebCore/html/canvas/WebGLContextAttributes.h 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/html/canvas/WebGLContextAttributes.h 2016-12-08 19:09:35 UTC (rev 209549)
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2010, Google Inc. All rights reserved.
+ * 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
@@ -26,68 +27,10 @@
#pragma once
-#include "CanvasContextAttributes.h"
-#include "GraphicsContext3D.h"
+#include "GraphicsContext3DAttributes.h"
namespace WebCore {
-class WebGLContextAttributes final : public CanvasContextAttributes {
- public:
- virtual ~WebGLContextAttributes();
+using WebGLContextAttributes = GraphicsContext3DAttributes;
- // Create a new attributes object
- static Ref<WebGLContextAttributes> create();
-
- // Create a new attributes object initialized with preexisting attributes
- static Ref<WebGLContextAttributes> create(GraphicsContext3D::Attributes);
-
- // Whether or not the drawing buffer has an alpha channel. Default is true.
- bool alpha() const;
- void setAlpha(bool alpha);
-
- // Whether or not the drawing buffer has a depth buffer. Default is true.
- bool depth() const;
- void setDepth(bool depth);
-
- // Whether or not the drawing buffer has a stencil buffer. Default is true.
- bool stencil() const;
- void setStencil(bool stencil);
-
- // Whether or not the drawing buffer is antialiased. Default is true.
- bool antialias() const;
- void setAntialias(bool antialias);
-
- // Whether or not to treat the values in the drawing buffer as
- // though their alpha channel has already been multiplied into the
- // color channels. Default is true.
- bool premultipliedAlpha() const;
- void setPremultipliedAlpha(bool premultipliedAlpha);
-
- // Whether or not to preserve the drawing buffer after presentation to the
- // screen. Default is false.
- bool preserveDrawingBuffer() const;
- void setPreserveDrawingBuffer(bool);
-
- // Whether or not to attempt to use a lower-power GPU if it is available.
- // Default is false.
- bool preferLowPowerToHighPerformance() const;
- void setPreferLowPowerToHighPerformance(bool);
-
- // Whether or not to immediately fail if a performant GPU is not available.
- // Default is false.
- bool failIfMajorPerformanceCaveat() const;
- void setFailIfMajorPerformanceCaveat(bool);
-
- // Fetches a copy of the attributes stored in this object in a
- // form that can be used to initialize a GraphicsContext3D.
- GraphicsContext3D::Attributes attributes() const;
-
- protected:
- WebGLContextAttributes();
- WebGLContextAttributes(GraphicsContext3D::Attributes attributes);
-
- private:
- GraphicsContext3D::Attributes m_attrs;
-};
-
} // namespace WebCore
Modified: trunk/Source/WebCore/html/canvas/WebGLContextAttributes.idl (209548 => 209549)
--- trunk/Source/WebCore/html/canvas/WebGLContextAttributes.idl 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/html/canvas/WebGLContextAttributes.idl 2016-12-08 19:09:35 UTC (rev 209549)
@@ -24,16 +24,18 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+typedef boolean GLboolean;
+
[
- NoInterfaceObject,
Conditional=WEBGL,
-] interface WebGLContextAttributes {
- attribute boolean alpha;
- attribute boolean depth;
- attribute boolean stencil;
- attribute boolean antialias;
- attribute boolean premultipliedAlpha;
- attribute boolean preserveDrawingBuffer;
- attribute boolean preferLowPowerToHighPerformance;
- attribute boolean failIfMajorPerformanceCaveat;
+ JSGenerateToJSObject
+] dictionary WebGLContextAttributes {
+ GLboolean alpha = true;
+ GLboolean depth = true;
+ GLboolean stencil = false;
+ GLboolean antialias = true;
+ GLboolean premultipliedAlpha = true;
+ GLboolean preserveDrawingBuffer = false;
+ GLboolean preferLowPowerToHighPerformance = false;
+ GLboolean failIfMajorPerformanceCaveat = false;
};
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (209548 => 209549)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp 2016-12-08 19:09:35 UTC (rev 209549)
@@ -65,13 +65,13 @@
namespace WebCore {
-WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement& passedCanvas, GraphicsContext3D::Attributes attributes)
+WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement& passedCanvas, GraphicsContext3DAttributes attributes)
: WebGLRenderingContextBase(passedCanvas, attributes)
{
}
WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement& passedCanvas, PassRefPtr<GraphicsContext3D> context,
- GraphicsContext3D::Attributes attributes) : WebGLRenderingContextBase(passedCanvas, context, attributes)
+ GraphicsContext3DAttributes attributes) : WebGLRenderingContextBase(passedCanvas, context, attributes)
{
initializeVertexArrayObjects();
}
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h (209548 => 209549)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h 2016-12-08 19:09:35 UTC (rev 209549)
@@ -31,8 +31,8 @@
class WebGLRenderingContext final : public WebGLRenderingContextBase {
public:
- WebGLRenderingContext(HTMLCanvasElement&, GraphicsContext3D::Attributes);
- WebGLRenderingContext(HTMLCanvasElement&, PassRefPtr<GraphicsContext3D>, GraphicsContext3D::Attributes);
+ WebGLRenderingContext(HTMLCanvasElement&, GraphicsContext3DAttributes);
+ WebGLRenderingContext(HTMLCanvasElement&, PassRefPtr<GraphicsContext3D>, GraphicsContext3DAttributes);
private:
bool isWebGL1() const final { return true; }
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (209548 => 209549)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2016-12-08 19:09:35 UTC (rev 209549)
@@ -348,7 +348,7 @@
WebGLRenderingContextBase* m_context;
};
-std::unique_ptr<WebGLRenderingContextBase> WebGLRenderingContextBase::create(HTMLCanvasElement& canvas, WebGLContextAttributes* attrs, const String& type)
+std::unique_ptr<WebGLRenderingContextBase> WebGLRenderingContextBase::create(HTMLCanvasElement& canvas, WebGLContextAttributes& attributes, const String& type)
{
#if ENABLE(WEBGL2)
if (type == "webgl2" && !RuntimeEnabledFeatures::sharedFeatures().webGL2Enabled())
@@ -388,8 +388,6 @@
}
}
- GraphicsContext3D::Attributes attributes = attrs ? attrs->attributes() : GraphicsContext3D::Attributes();
-
if (attributes.antialias) {
if (!frame->settings().openGLMultisamplingEnabled())
attributes.antialias = false;
@@ -453,7 +451,7 @@
return renderingContext;
}
-WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement& passedCanvas, GraphicsContext3D::Attributes attributes)
+WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement& passedCanvas, WebGLContextAttributes attributes)
: CanvasRenderingContext(passedCanvas)
, ActiveDOMObject(&passedCanvas.document())
, m_context(nullptr)
@@ -471,7 +469,7 @@
{
}
-WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement& passedCanvas, RefPtr<GraphicsContext3D>&& context, GraphicsContext3D::Attributes attributes)
+WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement& passedCanvas, RefPtr<GraphicsContext3D>&& context, WebGLContextAttributes attributes)
: CanvasRenderingContext(passedCanvas)
, ActiveDOMObject(&passedCanvas.document())
, m_context(WTFMove(context))
@@ -667,7 +665,8 @@
|| m_attributes.preserveDrawingBuffer || (mask && m_framebufferBinding))
return false;
- RefPtr<WebGLContextAttributes> contextAttributes = getContextAttributes();
+ auto contextAttributes = getContextAttributes();
+ ASSERT(contextAttributes);
// Determine if it's possible to combine the clear the user asked for and this clear.
bool combinedClear = mask && !m_scissorEnabled;
@@ -682,13 +681,13 @@
m_context->clearColor(0, 0, 0, 0);
m_context->colorMask(true, true, true, true);
GC3Dbitfield clearMask = GraphicsContext3D::COLOR_BUFFER_BIT;
- if (contextAttributes->depth()) {
+ if (contextAttributes->depth) {
if (!combinedClear || !m_depthMask || !(mask & GraphicsContext3D::DEPTH_BUFFER_BIT))
m_context->clearDepth(1.0f);
clearMask |= GraphicsContext3D::DEPTH_BUFFER_BIT;
m_context->depthMask(true);
}
- if (contextAttributes->stencil()) {
+ if (contextAttributes->stencil) {
if (combinedClear && (mask & GraphicsContext3D::STENCIL_BUFFER_BIT))
m_context->clearStencil(m_clearStencil & m_stencilMask);
else
@@ -2223,21 +2222,20 @@
return WebGLGetInfo(static_cast<unsigned int>(value));
}
-RefPtr<WebGLContextAttributes> WebGLRenderingContextBase::getContextAttributes()
+std::optional<WebGLContextAttributes> WebGLRenderingContextBase::getContextAttributes()
{
if (isContextLostOrPending())
- return nullptr;
- // We always need to return a new WebGLContextAttributes object to
- // prevent the user from mutating any cached version.
+ return std::nullopt;
// Also, we need to enforce requested values of "false" for depth
// and stencil, regardless of the properties of the underlying
// GraphicsContext3D.
- auto attributes = WebGLContextAttributes::create(m_context->getContextAttributes());
+
+ auto attributes = m_context->getContextAttributes();
if (!m_attributes.depth)
- attributes->setDepth(false);
+ attributes.depth = false;
if (!m_attributes.stencil)
- attributes->setStencil(false);
+ attributes.stencil = false;
return WTFMove(attributes);
}
@@ -5787,11 +5785,11 @@
if (m_framebufferBinding)
haveStencilBuffer = m_framebufferBinding->hasStencilBuffer();
else {
- RefPtr<WebGLContextAttributes> attributes = getContextAttributes();
- haveStencilBuffer = attributes->stencil();
+ auto attributes = getContextAttributes();
+ ASSERT(attributes);
+ haveStencilBuffer = attributes->stencil;
}
- enableOrDisable(GraphicsContext3D::STENCIL_TEST,
- m_stencilEnabled && haveStencilBuffer);
+ enableOrDisable(GraphicsContext3D::STENCIL_TEST, m_stencilEnabled && haveStencilBuffer);
}
void WebGLRenderingContextBase::enableOrDisable(GC3Denum capability, bool enable)
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h (209548 => 209549)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h 2016-12-08 19:09:35 UTC (rev 209549)
@@ -30,6 +30,7 @@
#include "GraphicsContext3D.h"
#include "ImageBuffer.h"
#include "Timer.h"
+#include "WebGLContextAttributes.h"
#include "WebGLGetInfo.h"
#include "WebGLObject.h"
#include "WebGLTexture.h"
@@ -64,7 +65,6 @@
class WebGLCompressedTextureATC;
class WebGLCompressedTexturePVRTC;
class WebGLCompressedTextureS3TC;
-class WebGLContextAttributes;
class WebGLDebugRendererInfo;
class WebGLDebugShaders;
class WebGLDepthTexture;
@@ -108,7 +108,7 @@
class WebGLRenderingContextBase : public CanvasRenderingContext, public ActiveDOMObject {
public:
- static std::unique_ptr<WebGLRenderingContextBase> create(HTMLCanvasElement&, WebGLContextAttributes*, const String&);
+ static std::unique_ptr<WebGLRenderingContextBase> create(HTMLCanvasElement&, WebGLContextAttributes&, const String&);
virtual ~WebGLRenderingContextBase();
#if PLATFORM(WIN)
@@ -192,7 +192,7 @@
bool getAttachedShaders(WebGLProgram*, Vector<RefPtr<WebGLShader>>&);
GC3Dint getAttribLocation(WebGLProgram*, const String& name);
WebGLGetInfo getBufferParameter(GC3Denum target, GC3Denum pname);
- RefPtr<WebGLContextAttributes> getContextAttributes();
+ std::optional<WebGLContextAttributes> getContextAttributes();
GC3Denum getError();
virtual WebGLExtension* getExtension(const String& name) = 0;
virtual WebGLGetInfo getFramebufferAttachmentParameter(GC3Denum target, GC3Denum attachment, GC3Denum pname) = 0;
@@ -334,8 +334,8 @@
void vertexAttribDivisor(GC3Duint index, GC3Duint divisor);
protected:
- WebGLRenderingContextBase(HTMLCanvasElement&, GraphicsContext3D::Attributes);
- WebGLRenderingContextBase(HTMLCanvasElement&, RefPtr<GraphicsContext3D>&&, GraphicsContext3D::Attributes);
+ WebGLRenderingContextBase(HTMLCanvasElement&, WebGLContextAttributes);
+ WebGLRenderingContextBase(HTMLCanvasElement&, RefPtr<GraphicsContext3D>&&, WebGLContextAttributes);
friend class WebGLDrawBuffers;
friend class WebGLFramebuffer;
@@ -515,7 +515,7 @@
GC3Denum m_unpackColorspaceConversion;
bool m_contextLost;
LostContextMode m_contextLostMode;
- GraphicsContext3D::Attributes m_attributes;
+ WebGLContextAttributes m_attributes;
bool m_layerCleared;
GC3Dfloat m_clearColor[4];
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.idl (209548 => 209549)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.idl 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.idl 2016-12-08 19:09:35 UTC (rev 209549)
@@ -551,7 +551,7 @@
[Custom] any getBufferParameter(GLenum target, GLenum pname);
- WebGLContextAttributes getContextAttributes();
+ WebGLContextAttributes? getContextAttributes();
GLenum getError();
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h (209548 => 209549)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h 2016-12-08 19:09:35 UTC (rev 209549)
@@ -23,10 +23,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef GraphicsContext3D_h
-#define GraphicsContext3D_h
+#pragma once
#include "ANGLEWebKitBridge.h"
+#include "GraphicsContext3DAttributes.h"
#include "GraphicsTypes3D.h"
#include "Image.h"
#include "IntRect.h"
@@ -718,23 +718,6 @@
MAP_READ_BIT = 0x0001
};
- // Context creation attributes.
- struct Attributes {
- bool alpha { true };
- bool depth { true };
- bool stencil { false };
- bool antialias { true };
- bool premultipliedAlpha { true };
- bool preserveDrawingBuffer { false };
- bool noExtensions { false };
- bool shareResources { true };
- bool preferLowPowerToHighPerformance { false };
- bool forceSoftwareRenderer { false };
- bool failIfMajorPerformanceCaveat { false };
- bool useGLES3 { false };
- float devicePixelRatio { 1 };
- };
-
enum RenderStyle {
RenderOffscreen,
RenderDirectlyToHostWindow,
@@ -756,7 +739,7 @@
void setContextLostCallback(std::unique_ptr<ContextLostCallback>);
void setErrorMessageCallback(std::unique_ptr<ErrorMessageCallback>);
- static RefPtr<GraphicsContext3D> create(Attributes, HostWindow*, RenderStyle = RenderOffscreen);
+ static RefPtr<GraphicsContext3D> create(GraphicsContext3DAttributes, HostWindow*, RenderStyle = RenderOffscreen);
static PassRefPtr<GraphicsContext3D> createForCurrentGLContext();
~GraphicsContext3D();
@@ -1026,7 +1009,7 @@
GC3Dint getAttribLocation(Platform3DObject, const String& name);
void getBooleanv(GC3Denum pname, GC3Dboolean* value);
void getBufferParameteriv(GC3Denum target, GC3Denum pname, GC3Dint* value);
- Attributes getContextAttributes();
+ GraphicsContext3DAttributes getContextAttributes();
GC3Denum getError();
void getFloatv(GC3Denum pname, GC3Dfloat* value);
void getFramebufferAttachmentParameteriv(GC3Denum target, GC3Denum attachment, GC3Denum pname, GC3Dint* value);
@@ -1272,7 +1255,7 @@
};
private:
- GraphicsContext3D(Attributes, HostWindow*, RenderStyle = RenderOffscreen);
+ GraphicsContext3D(GraphicsContext3DAttributes, HostWindow*, RenderStyle = RenderOffscreen);
static int GPUCheckCounter;
// Helper for packImageData/extractImageData/extractTextureData which implement packing of pixel
@@ -1390,7 +1373,7 @@
#endif
friend class Extensions3DOpenGLCommon;
- Attributes m_attrs;
+ GraphicsContext3DAttributes m_attrs;
RenderStyle m_renderStyle;
Vector<Vector<float>> m_vertexArray;
@@ -1444,5 +1427,3 @@
};
} // namespace WebCore
-
-#endif // GraphicsContext3D_h
Added: trunk/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h (0 => 209549)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h (rev 0)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h 2016-12-08 19:09:35 UTC (rev 209549)
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+namespace WebCore {
+
+struct GraphicsContext3DAttributes {
+ // WebGLContextAttributes
+ bool alpha { true };
+ bool depth { true };
+ bool stencil { false };
+ bool antialias { true };
+ bool premultipliedAlpha { true };
+ bool preserveDrawingBuffer { false };
+ bool preferLowPowerToHighPerformance { false };
+ bool failIfMajorPerformanceCaveat { false };
+
+ // Additional attributes.
+ bool forceSoftwareRenderer { false };
+ bool shareResources { true };
+ bool useGLES3 { false };
+ bool noExtensions { false };
+ float devicePixelRatio { 1 };
+};
+
+}
Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp (209548 => 209549)
--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp 2016-12-08 19:09:35 UTC (rev 209549)
@@ -56,7 +56,7 @@
namespace WebCore {
-RefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attributes, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
+RefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3DAttributes attributes, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
{
// This implementation doesn't currently support rendering directly to the HostWindow.
if (renderStyle == RenderDirectlyToHostWindow)
@@ -76,7 +76,7 @@
return adoptRef(new GraphicsContext3D(attributes, hostWindow, renderStyle));
}
-GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attributes, HostWindow*, GraphicsContext3D::RenderStyle renderStyle)
+GraphicsContext3D::GraphicsContext3D(GraphicsContext3DAttributes attributes, HostWindow*, GraphicsContext3D::RenderStyle renderStyle)
: m_currentWidth(0)
, m_currentHeight(0)
, m_attrs(attributes)
Modified: trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp (209548 => 209549)
--- trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp 2016-12-08 19:09:35 UTC (rev 209549)
@@ -30,13 +30,13 @@
namespace WebCore {
-RefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, RenderStyle renderStyle)
+RefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3DAttributes attrs, HostWindow* hostWindow, RenderStyle renderStyle)
{
RefPtr<GraphicsContext3D> context = adoptRef(new GraphicsContext3D(attrs, hostWindow, renderStyle));
return context->m_private ? context : nullptr;
}
-GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
+GraphicsContext3D::GraphicsContext3D(GraphicsContext3DAttributes attrs, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
: m_currentWidth(0)
, m_currentHeight(0)
, m_compiler(isGLES2Compliant() ? SH_ESSL_OUTPUT : SH_GLSL_COMPATIBILITY_OUTPUT)
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (209548 => 209549)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2016-12-08 19:09:35 UTC (rev 209549)
@@ -601,7 +601,7 @@
std::unique_ptr<TextureMapperPlatformLayerBuffer> buffer = m_platformLayerProxy->getAvailableBuffer(size, GraphicsContext3D::DONT_CARE);
if (UNLIKELY(!buffer)) {
if (UNLIKELY(!m_context3D))
- m_context3D = GraphicsContext3D::create(GraphicsContext3D::Attributes(), nullptr, GraphicsContext3D::RenderToCurrentGLContext);
+ m_context3D = GraphicsContext3D::create(GraphicsContext3DAttributes(), nullptr, GraphicsContext3D::RenderToCurrentGLContext);
RefPtr<BitmapTexture> texture = adoptRef(new BitmapTextureGL(m_context3D));
texture->reset(size, GST_VIDEO_INFO_HAS_ALPHA(&videoInfo) ? BitmapTexture::SupportsAlpha : BitmapTexture::NoFlag);
Modified: trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm (209548 => 209549)
--- trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm 2016-12-08 19:09:35 UTC (rev 209549)
@@ -127,7 +127,7 @@
}
#endif // !PLATFORM(IOS)
-RefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
+RefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3DAttributes attrs, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
{
// This implementation doesn't currently support rendering directly to the HostWindow.
if (renderStyle == RenderDirectlyToHostWindow)
@@ -153,7 +153,7 @@
return context;
}
-GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
+GraphicsContext3D::GraphicsContext3D(GraphicsContext3DAttributes attrs, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
: m_currentWidth(0)
, m_currentHeight(0)
, m_contextObj(0)
Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp (209548 => 209549)
--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp 2016-12-08 19:09:35 UTC (rev 209549)
@@ -132,7 +132,7 @@
PassRefPtr<GraphicsContext3D> GraphicsContext3D::createForCurrentGLContext()
{
- auto context = adoptRef(*new GraphicsContext3D(Attributes(), 0, GraphicsContext3D::RenderToCurrentGLContext));
+ auto context = adoptRef(*new GraphicsContext3D({ }, 0, GraphicsContext3D::RenderToCurrentGLContext));
if (!context->m_private)
return nullptr;
return WTFMove(context);
@@ -1007,7 +1007,7 @@
return ::glGetAttribLocation(program, mappedName.utf8().data());
}
-GraphicsContext3D::Attributes GraphicsContext3D::getContextAttributes()
+GraphicsContext3DAttributes GraphicsContext3D::getContextAttributes()
{
return m_attrs;
}
Modified: trunk/Source/WebCore/platform/graphics/win/GraphicsContext3DWin.cpp (209548 => 209549)
--- trunk/Source/WebCore/platform/graphics/win/GraphicsContext3DWin.cpp 2016-12-08 18:57:34 UTC (rev 209548)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsContext3DWin.cpp 2016-12-08 19:09:35 UTC (rev 209549)
@@ -45,7 +45,7 @@
namespace WebCore {
-RefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attributes, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
+RefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3DAttributes attributes, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
{
// This implementation doesn't currently support rendering directly to the HostWindow.
if (renderStyle == RenderDirectlyToHostWindow)
@@ -65,7 +65,7 @@
return adoptRef(new GraphicsContext3D(attributes, hostWindow, renderStyle));
}
-GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attributes, HostWindow*, GraphicsContext3D::RenderStyle renderStyle)
+GraphicsContext3D::GraphicsContext3D(GraphicsContext3DAttributes attributes, HostWindow*, GraphicsContext3D::RenderStyle renderStyle)
: m_currentWidth(0)
, m_currentHeight(0)
, m_compiler(isGLES2Compliant() ? SH_ESSL_OUTPUT : SH_GLSL_COMPATIBILITY_OUTPUT)