Title: [277659] trunk/Source/WebCore
Revision
277659
Author
[email protected]
Date
2021-05-18 10:32:22 -0700 (Tue, 18 May 2021)

Log Message

Clean up code distinguishing between webgl/webgl2 contexts
https://bugs.webkit.org/show_bug.cgi?id=225887

Patch by Kenneth Russell <[email protected]> on 2021-05-18
Reviewed by Darin Adler.

Address code review feedback on earlier bug.

Covered by existing WebGL conformance tests.

* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::getContext):
(WebCore::HTMLCanvasElement::getContextWebGL):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (277658 => 277659)


--- trunk/Source/WebCore/ChangeLog	2021-05-18 17:04:34 UTC (rev 277658)
+++ trunk/Source/WebCore/ChangeLog	2021-05-18 17:32:22 UTC (rev 277659)
@@ -1,3 +1,18 @@
+2021-05-18  Kenneth Russell  <[email protected]>
+
+        Clean up code distinguishing between webgl/webgl2 contexts
+        https://bugs.webkit.org/show_bug.cgi?id=225887
+
+        Reviewed by Darin Adler.
+
+        Address code review feedback on earlier bug.
+
+        Covered by existing WebGL conformance tests.
+
+        * html/HTMLCanvasElement.cpp:
+        (WebCore::HTMLCanvasElement::getContext):
+        (WebCore::HTMLCanvasElement::getContextWebGL):
+
 2021-05-18  Chris Dumez  <[email protected]>
 
         Make sure SQLiteStatement objects get destroyed before the database is closed

Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (277658 => 277659)


--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2021-05-18 17:04:34 UTC (rev 277658)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2021-05-18 17:32:22 UTC (rev 277659)
@@ -260,10 +260,8 @@
             if (!isWebGLType(contextId))
                 return Optional<RenderingContext> { WTF::nullopt };
             auto version = toWebGLVersion(contextId);
-            if (version == WebGLVersion::WebGL1 && !m_context->isWebGL1())
+            if ((version == WebGLVersion::WebGL1) != m_context->isWebGL1())
                 return Optional<RenderingContext> { WTF::nullopt };
-            if (version != WebGLVersion::WebGL1 && m_context->isWebGL1())
-                return Optional<RenderingContext> { WTF::nullopt };
             if (is<WebGLRenderingContext>(*m_context))
                 return Optional<RenderingContext> { RefPtr<WebGLRenderingContext> { &downcast<WebGLRenderingContext>(*m_context) } };
 #if ENABLE(WEBGL2)
@@ -487,12 +485,8 @@
         if (!m_context->isWebGL())
             return nullptr;
 
-        // The phrasing of these checks avoids compile-time guards for WebGL2 support.
-        if (type == WebGLVersion::WebGL1 && !m_context->isWebGL1())
+        if ((type == WebGLVersion::WebGL1) != m_context->isWebGL1())
             return nullptr;
-
-        if (type != WebGLVersion::WebGL1 && m_context->isWebGL1())
-            return nullptr;
     }
 
     if (!m_context)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to