<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[207719] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/207719">207719</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-10-22 16:28:39 -0700 (Sat, 22 Oct 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>WebGLRenderingContextBase.texImage2D() should use a union instead of overloading
https://bugs.webkit.org/show_bug.cgi?id=163856

Reviewed by Darin Adler.

WebGLRenderingContextBase.texImage2D() should use a union instead of overloading:
- https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14

* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::texImage2D):
* html/canvas/WebGLRenderingContextBase.h:
* html/canvas/WebGLRenderingContextBase.idl:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGLRenderingContextBasecpp">trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGLRenderingContextBaseh">trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGLRenderingContextBaseidl">trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.idl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (207718 => 207719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-22 22:14:58 UTC (rev 207718)
+++ trunk/Source/WebCore/ChangeLog        2016-10-22 23:28:39 UTC (rev 207719)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2016-10-22  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        WebGLRenderingContextBase.texImage2D() should use a union instead of overloading
+        https://bugs.webkit.org/show_bug.cgi?id=163856
+
+        Reviewed by Darin Adler.
+
+        WebGLRenderingContextBase.texImage2D() should use a union instead of overloading:
+        - https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14
+
+        * html/canvas/WebGLRenderingContextBase.cpp:
+        (WebCore::WebGLRenderingContextBase::texImage2D):
+        * html/canvas/WebGLRenderingContextBase.h:
+        * html/canvas/WebGLRenderingContextBase.idl:
+
</ins><span class="cx"> 2016-10-22  Antti Koivisto  &lt;antti@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(r207669): Dromaeo/jslib-style-jquery.html regressed &gt;20%
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLRenderingContextBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (207718 => 207719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp        2016-10-22 22:14:58 UTC (rev 207718)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp        2016-10-22 23:28:39 UTC (rev 207719)
</span><span class="lines">@@ -3108,29 +3108,108 @@
</span><span class="cx">         m_context-&gt;pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebGLRenderingContextBase::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
-                                       GC3Denum format, GC3Denum type, ImageData* pixels, ExceptionCode&amp; ec)
</del><ins>+void WebGLRenderingContextBase::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Denum format, GC3Denum type, Optional&lt;TexImageSource&gt; source, ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><del>-    ec = 0;
-    if (isContextLostOrPending() || !pixels || !validateTexFunc(&quot;texImage2D&quot;, TexImage, SourceImageData, target, level, internalformat, pixels-&gt;width(), pixels-&gt;height(), 0, format, type, 0, 0))
</del><ins>+    if (!source) {
+        synthesizeGLError(GraphicsContext3D::INVALID_VALUE, &quot;texImage2D&quot;, &quot;source is null&quot;);
</ins><span class="cx">         return;
</span><del>-    Vector&lt;uint8_t&gt; data;
-    bool needConversion = true;
-    // The data from ImageData is always of format RGBA8.
-    // No conversion is needed if destination format is RGBA and type is USIGNED_BYTE and no Flip or Premultiply operation is required.
-    if (!m_unpackFlipY &amp;&amp; !m_unpackPremultiplyAlpha &amp;&amp; format == GraphicsContext3D::RGBA &amp;&amp; type == GraphicsContext3D::UNSIGNED_BYTE)
-        needConversion = false;
-    else {
-        if (!m_context-&gt;extractImageData(pixels, format, type, m_unpackFlipY, m_unpackPremultiplyAlpha, data)) {
-            synthesizeGLError(GraphicsContext3D::INVALID_VALUE, &quot;texImage2D&quot;, &quot;bad image data&quot;);
</del><ins>+    }
+
+    auto visitor = WTF::makeVisitor([&amp;](const RefPtr&lt;ImageData&gt;&amp; pixels) {
+        ec = 0;
+        if (isContextLostOrPending() || !validateTexFunc(&quot;texImage2D&quot;, TexImage, SourceImageData, target, level, internalformat, pixels-&gt;width(), pixels-&gt;height(), 0, format, type, 0, 0))
</ins><span class="cx">             return;
</span><ins>+        Vector&lt;uint8_t&gt; data;
+        bool needConversion = true;
+        // The data from ImageData is always of format RGBA8.
+        // No conversion is needed if destination format is RGBA and type is USIGNED_BYTE and no Flip or Premultiply operation is required.
+        if (!m_unpackFlipY &amp;&amp; !m_unpackPremultiplyAlpha &amp;&amp; format == GraphicsContext3D::RGBA &amp;&amp; type == GraphicsContext3D::UNSIGNED_BYTE)
+            needConversion = false;
+        else {
+            if (!m_context-&gt;extractImageData(pixels.get(), format, type, m_unpackFlipY, m_unpackPremultiplyAlpha, data)) {
+                synthesizeGLError(GraphicsContext3D::INVALID_VALUE, &quot;texImage2D&quot;, &quot;bad image data&quot;);
+                return;
+            }
</ins><span class="cx">         }
</span><del>-    }
-    if (m_unpackAlignment != 1)
-        m_context-&gt;pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, 1);
-    texImage2DBase(target, level, internalformat, pixels-&gt;width(), pixels-&gt;height(), 0, format, type, needConversion ? data.data() : pixels-&gt;data()-&gt;data(), ec);
-    if (m_unpackAlignment != 1)
-        m_context-&gt;pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment);
</del><ins>+        if (m_unpackAlignment != 1)
+            m_context-&gt;pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, 1);
+        texImage2DBase(target, level, internalformat, pixels-&gt;width(), pixels-&gt;height(), 0, format, type, needConversion ? data.data() : pixels-&gt;data()-&gt;data(), ec);
+        if (m_unpackAlignment != 1)
+            m_context-&gt;pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment);
+    }, [&amp;](const RefPtr&lt;HTMLImageElement&gt;&amp; image) {
+        ec = 0;
+        if (isContextLostOrPending() || !validateHTMLImageElement(&quot;texImage2D&quot;, image.get(), ec))
+            return;
+
+        RefPtr&lt;Image&gt; imageForRender = image-&gt;cachedImage()-&gt;imageForRenderer(image-&gt;renderer());
+        if (!imageForRender)
+            return;
+
+        if (imageForRender-&gt;isSVGImage())
+            imageForRender = drawImageIntoBuffer(*imageForRender, image-&gt;width(), image-&gt;height(), 1);
+
+        if (!imageForRender || !validateTexFunc(&quot;texImage2D&quot;, TexImage, SourceHTMLImageElement, target, level, internalformat, imageForRender-&gt;width(), imageForRender-&gt;height(), 0, format, type, 0, 0))
+            return;
+
+        texImage2DImpl(target, level, internalformat, format, type, imageForRender.get(), GraphicsContext3D::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha, ec);
+
+    }, [&amp;](const RefPtr&lt;HTMLCanvasElement&gt;&amp; canvas) {
+        ec = 0;
+        if (isContextLostOrPending() || !validateHTMLCanvasElement(&quot;texImage2D&quot;, canvas.get(), ec) || !validateTexFunc(&quot;texImage2D&quot;, TexImage, SourceHTMLCanvasElement, target, level, internalformat, canvas-&gt;width(), canvas-&gt;height(), 0, format, type, 0, 0))
+            return;
+
+        WebGLTexture* texture = validateTextureBinding(&quot;texImage2D&quot;, target, true);
+        // If possible, copy from the canvas element directly to the texture
+        // via the GPU, without a read-back to system memory.
+        //
+        // FIXME: restriction of (RGB || RGBA)/UNSIGNED_BYTE should be lifted when
+        // ImageBuffer::copyToPlatformTexture implementations are fully functional.
+        if (texture
+            &amp;&amp; (format == GraphicsContext3D::RGB || format == GraphicsContext3D::RGBA)
+            &amp;&amp; type == GraphicsContext3D::UNSIGNED_BYTE
+            &amp;&amp; (texture-&gt;getType(target, level) == GraphicsContext3D::UNSIGNED_BYTE || !texture-&gt;isValid(target, level))) {
+            ImageBuffer* buffer = canvas-&gt;buffer();
+            if (buffer &amp;&amp; buffer-&gt;copyToPlatformTexture(*m_context.get(), target, texture-&gt;object(), internalformat, m_unpackPremultiplyAlpha, m_unpackFlipY)) {
+                texture-&gt;setLevelInfo(target, level, internalformat, canvas-&gt;width(), canvas-&gt;height(), type);
+                return;
+            }
+        }
+
+        RefPtr&lt;ImageData&gt; imageData = canvas-&gt;getImageData();
+        if (imageData)
+            texImage2D(target, level, internalformat, format, type, TexImageSource(imageData.get()), ec);
+        else
+            texImage2DImpl(target, level, internalformat, format, type, canvas-&gt;copiedImage(), GraphicsContext3D::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha, ec);
+    }, [&amp;](const RefPtr&lt;HTMLVideoElement&gt;&amp; video) {
+        ec = 0;
+        if (isContextLostOrPending() || !validateHTMLVideoElement(&quot;texImage2D&quot;, video.get(), ec)
+            || !validateTexFunc(&quot;texImage2D&quot;, TexImage, SourceHTMLVideoElement, target, level, internalformat, video-&gt;videoWidth(), video-&gt;videoHeight(), 0, format, type, 0, 0))
+            return;
+
+        // Go through the fast path doing a GPU-GPU textures copy without a readback to system memory if possible.
+        // Otherwise, it will fall back to the normal SW path.
+        // FIXME: The current restrictions require that format shoud be RGB or RGBA,
+        // type should be UNSIGNED_BYTE and level should be 0. It may be lifted in the future.
+        WebGLTexture* texture = validateTextureBinding(&quot;texImage2D&quot;, target, true);
+        if (GraphicsContext3D::TEXTURE_2D == target &amp;&amp; texture
+            &amp;&amp; (format == GraphicsContext3D::RGB || format == GraphicsContext3D::RGBA)
+            &amp;&amp; type == GraphicsContext3D::UNSIGNED_BYTE
+            &amp;&amp; (texture-&gt;getType(target, level) == GraphicsContext3D::UNSIGNED_BYTE || !texture-&gt;isValid(target, level))
+            &amp;&amp; !level) {
+            if (video-&gt;copyVideoTextureToPlatformTexture(m_context.get(), texture-&gt;object(), target, level, internalformat, format, type, m_unpackPremultiplyAlpha, m_unpackFlipY)) {
+                texture-&gt;setLevelInfo(target, level, internalformat, video-&gt;videoWidth(), video-&gt;videoHeight(), type);
+                return;
+            }
+        }
+
+        // Normal pure SW path.
+        RefPtr&lt;Image&gt; image = videoFrameToImage(video.get(), ImageBuffer::fastCopyImageMode());
+        if (!image)
+            return;
+        texImage2DImpl(target, level, internalformat, format, type, image.get(), GraphicsContext3D::HtmlDomVideo, m_unpackFlipY, m_unpackPremultiplyAlpha, ec);
+    });
+
+    WTF::visit(visitor, source.value());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;Image&gt; WebGLRenderingContextBase::drawImageIntoBuffer(Image&amp; image, int width, int height, int deviceScaleFactor)
</span><span class="lines">@@ -3149,58 +3228,8 @@
</span><span class="cx">     return buf-&gt;copyImage(ImageBuffer::fastCopyImageMode());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebGLRenderingContextBase::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
-                                       GC3Denum format, GC3Denum type, HTMLImageElement* image, ExceptionCode&amp; ec)
-{
-    ec = 0;
-    if (isContextLostOrPending() || !validateHTMLImageElement(&quot;texImage2D&quot;, image, ec))
-        return;
</del><ins>+#if ENABLE(VIDEO)
</ins><span class="cx"> 
</span><del>-    RefPtr&lt;Image&gt; imageForRender = image-&gt;cachedImage()-&gt;imageForRenderer(image-&gt;renderer());
-    if (!imageForRender)
-        return;
-
-    if (imageForRender-&gt;isSVGImage())
-        imageForRender = drawImageIntoBuffer(*imageForRender, image-&gt;width(), image-&gt;height(), 1);
-
-    if (!imageForRender || !validateTexFunc(&quot;texImage2D&quot;, TexImage, SourceHTMLImageElement, target, level, internalformat, imageForRender-&gt;width(), imageForRender-&gt;height(), 0, format, type, 0, 0))
-        return;
-
-    texImage2DImpl(target, level, internalformat, format, type, imageForRender.get(), GraphicsContext3D::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha, ec);
-}
-
-void WebGLRenderingContextBase::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
-                                       GC3Denum format, GC3Denum type, HTMLCanvasElement* canvas, ExceptionCode&amp; ec)
-{
-    ec = 0;
-    if (isContextLostOrPending() || !validateHTMLCanvasElement(&quot;texImage2D&quot;, canvas, ec) || !validateTexFunc(&quot;texImage2D&quot;, TexImage, SourceHTMLCanvasElement, target, level, internalformat, canvas-&gt;width(), canvas-&gt;height(), 0, format, type, 0, 0))
-        return;
-
-    WebGLTexture* texture = validateTextureBinding(&quot;texImage2D&quot;, target, true);
-    // If possible, copy from the canvas element directly to the texture
-    // via the GPU, without a read-back to system memory.
-    //
-    // FIXME: restriction of (RGB || RGBA)/UNSIGNED_BYTE should be lifted when
-    // ImageBuffer::copyToPlatformTexture implementations are fully functional.
-    if (texture
-        &amp;&amp; (format == GraphicsContext3D::RGB || format == GraphicsContext3D::RGBA)
-        &amp;&amp; type == GraphicsContext3D::UNSIGNED_BYTE
-        &amp;&amp; (texture-&gt;getType(target, level) == GraphicsContext3D::UNSIGNED_BYTE || !texture-&gt;isValid(target, level))) {
-        ImageBuffer* buffer = canvas-&gt;buffer();
-        if (buffer &amp;&amp; buffer-&gt;copyToPlatformTexture(*m_context.get(), target, texture-&gt;object(), internalformat, m_unpackPremultiplyAlpha, m_unpackFlipY)) {
-            texture-&gt;setLevelInfo(target, level, internalformat, canvas-&gt;width(), canvas-&gt;height(), type);
-            return;
-        }
-    }
-
-    RefPtr&lt;ImageData&gt; imageData = canvas-&gt;getImageData();
-    if (imageData)
-        texImage2D(target, level, internalformat, format, type, imageData.get(), ec);
-    else
-        texImage2DImpl(target, level, internalformat, format, type, canvas-&gt;copiedImage(), GraphicsContext3D::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha, ec);
-}
-
-#if ENABLE(VIDEO)
</del><span class="cx"> RefPtr&lt;Image&gt; WebGLRenderingContextBase::videoFrameToImage(HTMLVideoElement* video, BackingStoreCopy backingStoreCopy)
</span><span class="cx"> {
</span><span class="cx">     IntSize size(video-&gt;videoWidth(), video-&gt;videoHeight());
</span><span class="lines">@@ -3215,36 +3244,6 @@
</span><span class="cx">     return buf-&gt;copyImage(backingStoreCopy);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebGLRenderingContextBase::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
-                                       GC3Denum format, GC3Denum type, HTMLVideoElement* video, ExceptionCode&amp; ec)
-{
-    ec = 0;
-    if (isContextLostOrPending() || !validateHTMLVideoElement(&quot;texImage2D&quot;, video, ec)
-        || !validateTexFunc(&quot;texImage2D&quot;, TexImage, SourceHTMLVideoElement, target, level, internalformat, video-&gt;videoWidth(), video-&gt;videoHeight(), 0, format, type, 0, 0))
-        return;
-
-    // Go through the fast path doing a GPU-GPU textures copy without a readback to system memory if possible.
-    // Otherwise, it will fall back to the normal SW path.
-    // FIXME: The current restrictions require that format shoud be RGB or RGBA,
-    // type should be UNSIGNED_BYTE and level should be 0. It may be lifted in the future.
-    WebGLTexture* texture = validateTextureBinding(&quot;texImage2D&quot;, target, true);
-    if (GraphicsContext3D::TEXTURE_2D == target &amp;&amp; texture
-        &amp;&amp; (format == GraphicsContext3D::RGB || format == GraphicsContext3D::RGBA)
-        &amp;&amp; type == GraphicsContext3D::UNSIGNED_BYTE
-        &amp;&amp; (texture-&gt;getType(target, level) == GraphicsContext3D::UNSIGNED_BYTE || !texture-&gt;isValid(target, level))
-        &amp;&amp; !level) {
-        if (video-&gt;copyVideoTextureToPlatformTexture(m_context.get(), texture-&gt;object(), target, level, internalformat, format, type, m_unpackPremultiplyAlpha, m_unpackFlipY)) {
-            texture-&gt;setLevelInfo(target, level, internalformat, video-&gt;videoWidth(), video-&gt;videoHeight(), type);
-            return;
-        }
-    }
-
-    // Normal pure SW path.
-    RefPtr&lt;Image&gt; image = videoFrameToImage(video, ImageBuffer::fastCopyImageMode());
-    if (!image)
-        return;
-    texImage2DImpl(target, level, internalformat, format, type, image.get(), GraphicsContext3D::HtmlDomVideo, m_unpackFlipY, m_unpackPremultiplyAlpha, ec);
-}
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> void WebGLRenderingContextBase::texParameter(GC3Denum target, GC3Denum pname, GC3Dfloat paramf, GC3Dint parami, bool isFloat)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLRenderingContextBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h (207718 => 207719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h        2016-10-22 22:14:58 UTC (rev 207718)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h        2016-10-22 23:28:39 UTC (rev 207719)
</span><span class="lines">@@ -243,20 +243,11 @@
</span><span class="cx">     void stencilOp(GC3Denum fail, GC3Denum zfail, GC3Denum zpass);
</span><span class="cx">     void stencilOpSeparate(GC3Denum face, GC3Denum fail, GC3Denum zfail, GC3Denum zpass);
</span><span class="cx"> 
</span><del>-    void texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
-                    GC3Dsizei width, GC3Dsizei height, GC3Dint border,
-                    GC3Denum format, GC3Denum type, RefPtr&lt;ArrayBufferView&gt;&amp;&amp;, ExceptionCode&amp;);
-    void texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
-                    GC3Denum format, GC3Denum type, ImageData*, ExceptionCode&amp;);
-    void texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
-                    GC3Denum format, GC3Denum type, HTMLImageElement*, ExceptionCode&amp;);
-    void texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
-                    GC3Denum format, GC3Denum type, HTMLCanvasElement*, ExceptionCode&amp;);
-#if ENABLE(VIDEO)
-    void texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
-                    GC3Denum format, GC3Denum type, HTMLVideoElement*, ExceptionCode&amp;);
-#endif
</del><ins>+    void texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, RefPtr&lt;ArrayBufferView&gt;&amp;&amp;, ExceptionCode&amp;);
</ins><span class="cx"> 
</span><ins>+    using TexImageSource = WTF::Variant&lt;RefPtr&lt;ImageData&gt;, RefPtr&lt;HTMLImageElement&gt;, RefPtr&lt;HTMLCanvasElement&gt;, RefPtr&lt;HTMLVideoElement&gt;&gt;;
+    void texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Denum format, GC3Denum type, Optional&lt;TexImageSource&gt;, ExceptionCode&amp;);
+
</ins><span class="cx">     void texParameterf(GC3Denum target, GC3Denum pname, GC3Dfloat param);
</span><span class="cx">     void texParameteri(GC3Denum target, GC3Denum pname, GC3Dint param);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLRenderingContextBaseidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.idl (207718 => 207719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.idl        2016-10-22 22:14:58 UTC (rev 207718)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.idl        2016-10-22 23:28:39 UTC (rev 207719)
</span><span class="lines">@@ -39,6 +39,9 @@
</span><span class="cx"> typedef unrestricted float GLclampf;
</span><span class="cx"> typedef (ArrayBuffer or ArrayBufferView) BufferDataSource;
</span><span class="cx"> 
</span><ins>+// FIXME: Should allow ImageBitmap too.
+typedef (ImageData or HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) TexImageSource;
+
</ins><span class="cx"> [
</span><span class="cx">     Conditional=WEBGL,
</span><span class="cx">     CustomIsReachable,
</span><span class="lines">@@ -612,18 +615,8 @@
</span><span class="cx">     void texParameteri(GLenum target, GLenum pname, GLint param);
</span><span class="cx"> 
</span><span class="cx">     // Supported forms:
</span><del>-    [MayThrowLegacyException] void texImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
-  GLint border, GLenum format, GLenum type, ArrayBufferView? pixels);
-    [MayThrowLegacyException] void texImage2D(GLenum target, GLint level, GLenum internalformat,
-  GLenum format, GLenum type, ImageData? pixels);
-    [MayThrowLegacyException] void texImage2D(GLenum target, GLint level, GLenum internalformat,
-  GLenum format, GLenum type, HTMLImageElement? image);
-    [MayThrowLegacyException] void texImage2D(GLenum target, GLint level, GLenum internalformat,
-  GLenum format, GLenum type, HTMLCanvasElement? canvas);
-#if defined(ENABLE_VIDEO) &amp;&amp; ENABLE_VIDEO
-    [MayThrowLegacyException] void texImage2D(GLenum target, GLint level, GLenum internalformat,
-  GLenum format, GLenum type, HTMLVideoElement? video);
-#endif
</del><ins>+    [MayThrowLegacyException] void texImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, ArrayBufferView? pixels);
+    [MayThrowLegacyException] void texImage2D(GLenum target, GLint level, GLenum internalformat, GLenum format, GLenum type, TexImageSource? source);
</ins><span class="cx"> 
</span><span class="cx">     [MayThrowLegacyException] void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
</span><span class="cx">  GLsizei width, GLsizei height,
</span></span></pre>
</div>
</div>

</body>
</html>