Diff
Modified: trunk/Source/WebCore/ChangeLog (207613 => 207614)
--- trunk/Source/WebCore/ChangeLog 2016-10-20 11:12:31 UTC (rev 207613)
+++ trunk/Source/WebCore/ChangeLog 2016-10-20 12:36:06 UTC (rev 207614)
@@ -1,3 +1,21 @@
+2016-10-20 Carlos Garcia Campos <cgar...@igalia.com>
+
+ [GTK] Avoid strstr() when checking (E)GL extensions
+ https://bugs.webkit.org/show_bug.cgi?id=161958
+
+ Reviewed by Žan Doberšek.
+
+ Add static method GLContext::isExtensionSupported() to properly search extenstions in the given extension
+ list, and use it instead of strstr().
+
+ * platform/graphics/GLContext.cpp:
+ (WebCore::GLContext::isExtensionSupported):
+ * platform/graphics/GLContext.h:
+ * platform/graphics/egl/GLContextEGL.cpp:
+ (WebCore::GLContextEGL::createSurfacelessContext):
+ * platform/graphics/glx/GLContextGLX.cpp:
+ (WebCore::hasSGISwapControlExtension):
+
2016-10-20 Per Arne Vollan <pvol...@apple.com>
[Win][Direct2D] Implement ImageBufferData::getData.
Modified: trunk/Source/WebCore/platform/graphics/GLContext.cpp (207613 => 207614)
--- trunk/Source/WebCore/platform/graphics/GLContext.cpp 2016-10-20 11:12:31 UTC (rev 207613)
+++ trunk/Source/WebCore/platform/graphics/GLContext.cpp 2016-10-20 12:36:06 UTC (rev 207614)
@@ -149,6 +149,22 @@
return currentContext()->context();
}
+bool GLContext::isExtensionSupported(const char* extensionList, const char* extension)
+{
+ if (!extensionList)
+ return false;
+
+ ASSERT(extension);
+ int extensionLen = strlen(extension);
+ const char* extensionListPtr = extensionList;
+ while ((extensionListPtr = strstr(extensionListPtr, extension))) {
+ if (extensionListPtr[extensionLen] == ' ' || extensionListPtr[extensionLen] == '\0')
+ return true;
+ extensionListPtr += extensionLen;
+ }
+ return false;
+}
+
} // namespace WebCore
#endif
Modified: trunk/Source/WebCore/platform/graphics/GLContext.h (207613 => 207614)
--- trunk/Source/WebCore/platform/graphics/GLContext.h 2016-10-20 11:12:31 UTC (rev 207613)
+++ trunk/Source/WebCore/platform/graphics/GLContext.h 2016-10-20 12:36:06 UTC (rev 207614)
@@ -48,6 +48,7 @@
static std::unique_ptr<GLContext> createOffscreenContext(PlatformDisplay* = nullptr);
static std::unique_ptr<GLContext> createSharingContext(PlatformDisplay&);
static GLContext* current();
+ static bool isExtensionSupported(const char* extensionList, const char* extension);
PlatformDisplay& display() const { return m_display; }
Modified: trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp (207613 => 207614)
--- trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp 2016-10-20 11:12:31 UTC (rev 207613)
+++ trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp 2016-10-20 12:36:06 UTC (rev 207614)
@@ -151,7 +151,7 @@
return nullptr;
const char* extensions = eglQueryString(display, EGL_EXTENSIONS);
- if (!strstr(extensions, "EGL_KHR_surfaceless_context") && !strstr(extensions, "EGL_KHR_surfaceless_opengl"))
+ if (!GLContext::isExtensionSupported(extensions, "EGL_KHR_surfaceless_context") && !GLContext::isExtensionSupported(extensions, "EGL_KHR_surfaceless_opengl"))
return nullptr;
EGLConfig config;
Modified: trunk/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp (207613 => 207614)
--- trunk/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp 2016-10-20 11:12:31 UTC (rev 207613)
+++ trunk/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp 2016-10-20 12:36:06 UTC (rev 207614)
@@ -45,8 +45,7 @@
return !!glXSwapIntervalSGI;
initialized = true;
- const char* extensions = glXQueryExtensionsString(display, 0);
- if (!strstr(extensions, "GLX_SGI_swap_control"))
+ if (!GLContext::isExtensionSupported(glXQueryExtensionsString(display, 0), "GLX_SGI_swap_control"))
return false;
glXSwapIntervalSGI = reinterpret_cast<PFNGLXSWAPINTERVALSGIPROC>(glXGetProcAddress(reinterpret_cast<const unsigned char*>("glXSwapIntervalSGI")));
Modified: trunk/Source/WebKit2/ChangeLog (207613 => 207614)
--- trunk/Source/WebKit2/ChangeLog 2016-10-20 11:12:31 UTC (rev 207613)
+++ trunk/Source/WebKit2/ChangeLog 2016-10-20 12:36:06 UTC (rev 207614)
@@ -1,5 +1,17 @@
2016-10-20 Carlos Garcia Campos <cgar...@igalia.com>
+ [GTK] Avoid strstr() when checking (E)GL extensions
+ https://bugs.webkit.org/show_bug.cgi?id=161958
+
+ Reviewed by Žan Doberšek.
+
+ Use GLContext::isExtensionSupported() instead of strstr().
+
+ * UIProcess/gtk/WaylandCompositor.cpp:
+ (WebKit::WaylandCompositor::initializeEGL):
+
+2016-10-20 Carlos Garcia Campos <cgar...@igalia.com>
+
Wrong use of EGL_DEPTH_SIZE
https://bugs.webkit.org/show_bug.cgi?id=155536
Modified: trunk/Source/WebKit2/UIProcess/gtk/WaylandCompositor.cpp (207613 => 207614)
--- trunk/Source/WebKit2/UIProcess/gtk/WaylandCompositor.cpp 2016-10-20 11:12:31 UTC (rev 207613)
+++ trunk/Source/WebKit2/UIProcess/gtk/WaylandCompositor.cpp 2016-10-20 12:36:06 UTC (rev 207614)
@@ -335,7 +335,7 @@
eglDestroyImage = reinterpret_cast<PFNEGLDESTROYIMAGEKHRPROC>(eglGetProcAddress("eglDestroyImage"));
} else {
const char* extensions = eglQueryString(PlatformDisplay::sharedDisplay().eglDisplay(), EGL_EXTENSIONS);
- if (strstr(extensions, "EGL_KHR_image_base")) {
+ if (GLContext::isExtensionSupported(extensions, "EGL_KHR_image_base")) {
eglCreateImage = reinterpret_cast<PFNEGLCREATEIMAGEKHRPROC>(eglGetProcAddress("eglCreateImageKHR"));
eglDestroyImage = reinterpret_cast<PFNEGLDESTROYIMAGEKHRPROC>(eglGetProcAddress("eglDestroyImageKHR"));
}