Diff
Modified: trunk/LayoutTests/ChangeLog (200434 => 200435)
--- trunk/LayoutTests/ChangeLog 2016-05-04 22:22:31 UTC (rev 200434)
+++ trunk/LayoutTests/ChangeLog 2016-05-04 22:27:58 UTC (rev 200435)
@@ -1,3 +1,16 @@
+2016-05-04 Dean Jackson <[email protected]>
+
+ Disabling WebGL2 should mean no context is created
+ https://bugs.webkit.org/show_bug.cgi?id=157352
+ <rdar://problem/26096346>
+
+ Reviewed by Eric Carlson.
+
+ Check that toggling the runtime flag enables/disables WebGL 2.0.
+
+ * fast/canvas/webgl/webgl2-runtime-flag-expected.txt: Added.
+ * fast/canvas/webgl/webgl2-runtime-flag.html: Added.
+
2016-05-04 Chris Dumez <[email protected]>
Media elements should not be paused right away when removed from the document
Added: trunk/LayoutTests/fast/canvas/webgl/webgl2-runtime-flag-expected.txt (0 => 200435)
--- trunk/LayoutTests/fast/canvas/webgl/webgl2-runtime-flag-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/webgl2-runtime-flag-expected.txt 2016-05-04 22:27:58 UTC (rev 200435)
@@ -0,0 +1,2 @@
+PASS: WebGL 2.0 was available when enabled.
+PASS: WebGL 2.0 was not available when disabled.
Property changes on: trunk/LayoutTests/fast/canvas/webgl/webgl2-runtime-flag-expected.txt
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Added: trunk/LayoutTests/fast/canvas/webgl/webgl2-runtime-flag.html (0 => 200435)
--- trunk/LayoutTests/fast/canvas/webgl/webgl2-runtime-flag.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/webgl2-runtime-flag.html 2016-05-04 22:27:58 UTC (rev 200435)
@@ -0,0 +1,46 @@
+<script>
+
+if (window.testRunner)
+ window.testRunner.dumpAsText();
+
+function getContext(name) {
+ var c = document.createElement("canvas");
+ return c.getContext(name);
+}
+
+function run() {
+ var output;
+
+ output = document.getElementById("output1");
+
+ if (!window.testRunner) {
+ output.textContent = "This test only runs inside DRT/WKTR.";
+ return;
+ }
+
+ var originalSetting = window.internals.webGL2Enabled();
+
+ window.internals.setWebGL2Enabled(true);
+ var ctx = getContext("webgl2");
+ if (ctx)
+ output.textContent = "PASS: WebGL 2.0 was available when enabled.";
+ else
+ output.textContent = "FAIL: WebGL 2.0 was not available when enabled.";
+
+ output = document.getElementById("output2");
+
+ window.internals.setWebGL2Enabled(false);
+ var ctx = getContext("webgl2");
+ if (ctx)
+ output.textContent = "FAIL: WebGL 2.0 was available when disabled.";
+ else
+ output.textContent = "PASS: WebGL 2.0 was not available when disabled.";
+
+ window.internals.setWebGL2Enabled(originalSetting);
+}
+
+window.addEventListener("load", run, false);
+
+</script>
+<div id="output1"></div>
+<div id="output2"></div>
Property changes on: trunk/LayoutTests/fast/canvas/webgl/webgl2-runtime-flag.html
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Modified: trunk/Source/WebCore/ChangeLog (200434 => 200435)
--- trunk/Source/WebCore/ChangeLog 2016-05-04 22:22:31 UTC (rev 200434)
+++ trunk/Source/WebCore/ChangeLog 2016-05-04 22:27:58 UTC (rev 200435)
@@ -1,3 +1,24 @@
+2016-05-04 Dean Jackson <[email protected]>
+
+ Disabling WebGL2 should mean no context is created
+ https://bugs.webkit.org/show_bug.cgi?id=157352
+ <rdar://problem/26096346>
+
+ Reviewed by Eric Carlson.
+
+ If WebGL2 is disabled by the runtime flag, we should
+ not create a context.
+
+ Test: fast/canvas/webgl/webgl2-runtime-flag.html
+
+ * html/canvas/WebGLRenderingContextBase.cpp:
+ (WebCore::WebGLRenderingContextBase::create):
+ * testing/Internals.cpp: Added some helpers to toggle the runtime setting.
+ (WebCore::Internals::webGL2Enabled):
+ (WebCore::Internals::setWebGL2Enabled):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
2016-05-04 Anders Carlsson <[email protected]>
Add an override point for drawing named images in ThemeCocoa
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (200434 => 200435)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2016-05-04 22:22:31 UTC (rev 200434)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2016-05-04 22:27:58 UTC (rev 200435)
@@ -62,6 +62,7 @@
#include "OESVertexArrayObject.h"
#include "Page.h"
#include "RenderBox.h"
+#include "RuntimeEnabledFeatures.h"
#include "Settings.h"
#include "WebGL2RenderingContext.h"
#include "WebGLActiveInfo.h"
@@ -348,7 +349,10 @@
std::unique_ptr<WebGLRenderingContextBase> WebGLRenderingContextBase::create(HTMLCanvasElement* canvas, WebGLContextAttributes* attrs, const String& type)
{
-#if !ENABLE(WEBGL2)
+#if ENABLE(WEBGL2)
+ if (type == "webgl2" && !RuntimeEnabledFeatures::sharedFeatures().webGL2Enabled())
+ return nullptr;
+#else
UNUSED_PARAM(type);
#endif
Modified: trunk/Source/WebCore/testing/Internals.cpp (200434 => 200435)
--- trunk/Source/WebCore/testing/Internals.cpp 2016-05-04 22:22:31 UTC (rev 200434)
+++ trunk/Source/WebCore/testing/Internals.cpp 2016-05-04 22:27:58 UTC (rev 200435)
@@ -3316,6 +3316,18 @@
}
#endif
+#if ENABLE(WEBGL2)
+bool Internals::webGL2Enabled() const
+{
+ return RuntimeEnabledFeatures::sharedFeatures().webGL2Enabled();
+}
+
+void Internals::setWebGL2Enabled(bool enable)
+{
+ RuntimeEnabledFeatures::sharedFeatures().setWebGL2Enabled(enable);
+}
+#endif
+
void Internals::setResourceTimingSupport(bool enable)
{
RuntimeEnabledFeatures::sharedFeatures().setResourceTimingEnabled(enable);
Modified: trunk/Source/WebCore/testing/Internals.h (200434 => 200435)
--- trunk/Source/WebCore/testing/Internals.h 2016-05-04 22:22:31 UTC (rev 200434)
+++ trunk/Source/WebCore/testing/Internals.h 2016-05-04 22:27:58 UTC (rev 200435)
@@ -478,6 +478,11 @@
void setCSSGridLayoutEnabled(bool);
#endif
+#if ENABLE(WEBGL2)
+ bool webGL2Enabled() const;
+ void setWebGL2Enabled(bool);
+#endif
+
private:
explicit Internals(Document&);
Document* contextDocument() const;
Modified: trunk/Source/WebCore/testing/Internals.idl (200434 => 200435)
--- trunk/Source/WebCore/testing/Internals.idl 2016-05-04 22:22:31 UTC (rev 200434)
+++ trunk/Source/WebCore/testing/Internals.idl 2016-05-04 22:27:58 UTC (rev 200435)
@@ -453,5 +453,10 @@
void setCSSGridLayoutEnabled(boolean enable);
#endif
+#if defined(ENABLE_WEBGL2) && ENABLE_WEBGL2
+ boolean webGL2Enabled();
+ void setWebGL2Enabled(boolean enable);
+#endif
+
void setResourceTimingSupport(boolean scalable);
};