<!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>[212637] trunk</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/212637">212637</a></dd>
<dt>Author</dt> <dd>dino@apple.com</dd>
<dt>Date</dt> <dd>2017-02-20 07:47:23 -0800 (Mon, 20 Feb 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add 'webglcontextchanged' WebGLContextEvent
https://bugs.webkit.org/show_bug.cgi?id=168595
&lt;rdar://problem/30604254&gt;

Reviewed by Antoine Quint.

Source/WebCore:

Add a new event that is dispatched when the GraphicsContext3D
notices that the active GPU has changed.

Test: fast/canvas/webgl/webglcontextchangedevent.html

* dom/EventNames.h: Add 'webglcontextchanged'.
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::dispatchContextChangedEvent): Dispatch the new event.
(WebCore::WebGLRenderingContextBase::simulateContextChanged): Tell the GraphicsContext3D to
pretend there was a GPU switch. This is called from Internals for testing.
* html/canvas/WebGLRenderingContextBase.h:
* html/canvas/WebGLRenderingContextBase.idl: Export the interface so Internals can see it.

* platform/graphics/GraphicsContext3D.cpp:
(WebCore::GraphicsContext3D::simulateContextChanged): Tell the GraphicsContext3DManager
that it should pretend a GPU change has happened, which causes it to notify all the
active contexts.
* platform/graphics/GraphicsContext3D.h:

* platform/graphics/mac/GraphicsContext3DMac.mm:
(WebCore::GraphicsContext3DManager::updateAllContexts): Tell the GraphicsContext3Ds
to tell their WebGLRenderingContexts to dispatch an event.
(WebCore::GraphicsContext3D::simulateContextChanged): Fake the display change.
* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
(WebCore::GraphicsContext3D::dispatchContextChangedNotification): Tell the WebGLRenderingContext
that a change has occurred, and that it should dispatch an event. This is a layering
violation which will need to be fixed (although with other communication from GC3D back
to WebGL).
* testing/Internals.cpp:
(WebCore::Internals::simulateWebGLContextChanged):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

Add a new webglcontextchanged event. This test only
runs on Cocoa platforms at the moment, because it
needs GraphicsContext3D to keep track of all
active contexts in order to dispatch events.

* fast/canvas/webgl/webglcontextchangedevent-expected.txt: Added.
* fast/canvas/webgl/webglcontextchangedevent.html: Added.
* platform/gtk/TestExpectations:
* platform/win/TestExpectations:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformgtkTestExpectations">trunk/LayoutTests/platform/gtk/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformwinTestExpectations">trunk/LayoutTests/platform/win/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomEventNamesh">trunk/Source/WebCore/dom/EventNames.h</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>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsContext3Dcpp">trunk/Source/WebCore/platform/graphics/GraphicsContext3D.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsContext3Dh">trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacGraphicsContext3DMacmm">trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsopenglGraphicsContext3DOpenGLCommoncpp">trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalscpp">trunk/Source/WebCore/testing/Internals.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsh">trunk/Source/WebCore/testing/Internals.h</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsidl">trunk/Source/WebCore/testing/Internals.idl</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastcanvaswebglwebglcontextchangedeventexpectedtxt">trunk/LayoutTests/fast/canvas/webgl/webglcontextchangedevent-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcanvaswebglwebglcontextchangedeventhtml">trunk/LayoutTests/fast/canvas/webgl/webglcontextchangedevent.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (212636 => 212637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-02-20 15:30:24 UTC (rev 212636)
+++ trunk/LayoutTests/ChangeLog        2017-02-20 15:47:23 UTC (rev 212637)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2017-02-20  Dean Jackson  &lt;dino@apple.com&gt;
+
+        Add 'webglcontextchanged' WebGLContextEvent
+        https://bugs.webkit.org/show_bug.cgi?id=168595
+        &lt;rdar://problem/30604254&gt;
+
+        Reviewed by Antoine Quint.
+
+        Add a new webglcontextchanged event. This test only
+        runs on Cocoa platforms at the moment, because it
+        needs GraphicsContext3D to keep track of all
+        active contexts in order to dispatch events.
+
+        * fast/canvas/webgl/webglcontextchangedevent-expected.txt: Added.
+        * fast/canvas/webgl/webglcontextchangedevent.html: Added.
+        * platform/gtk/TestExpectations:
+        * platform/win/TestExpectations:
+
</ins><span class="cx"> 2017-02-20  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed GTK+ gardening. Fix tests reporting missing results.
</span></span></pre></div>
<a id="trunkLayoutTestsfastcanvaswebglwebglcontextchangedeventexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/canvas/webgl/webglcontextchangedevent-expected.txt (0 => 212637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/canvas/webgl/webglcontextchangedevent-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/webglcontextchangedevent-expected.txt        2017-02-20 15:47:23 UTC (rev 212637)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+  
+We should see three changed events.
+
+Saw webglcontextchanged event.
+
+Saw webglcontextchanged event.
+
+Saw webglcontextchanged event.
</ins><span class="cx">Property changes on: trunk/LayoutTests/fast/canvas/webgl/webglcontextchangedevent-expected.txt
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<ins>+native
</ins><span class="cx">\ No newline at end of property
</span><a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<ins>+Date Revision
</ins><span class="cx">\ No newline at end of property
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<ins>+text/plain
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkLayoutTestsfastcanvaswebglwebglcontextchangedeventhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/canvas/webgl/webglcontextchangedevent.html (0 => 212637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/canvas/webgl/webglcontextchangedevent.html                                (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/webglcontextchangedevent.html        2017-02-20 15:47:23 UTC (rev 212637)
</span><span class="lines">@@ -0,0 +1,50 @@
</span><ins>+&lt;script&gt;
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+function log(msg)
+{
+    let p = document.createElement(&quot;p&quot;);
+    p.textContent = msg;
+    document.body.appendChild(p);
+}
+
+function runTest()
+{
+    if (!window.internals) {
+        log(&quot;This test must run inside DRT/WKTR.&quot;);
+        return;
+    }
+
+    log(&quot;We should see three changed events.&quot;);
+
+    let changedEventsSeen = 0;
+
+    let handleChangedEvent = (event) =&gt; {
+        log(&quot;Saw webglcontextchanged event.&quot;);
+        changedEventsSeen++;
+        if (changedEventsSeen == 3)
+            testRunner.notifyDone();
+    }
+
+    document.querySelectorAll(&quot;canvas&quot;).forEach((c) =&gt;
+    {
+        c.addEventListener(&quot;webglcontextchanged&quot;, handleChangedEvent, false);
+        let gl = c.getContext(&quot;webgl&quot;);
+        gl.clearColor(1, 0, 0, 1);
+        gl.clear(gl.COLOR_BUFFER_BIT);
+    });
+
+    let gl = document.querySelector(&quot;canvas&quot;).getContext(&quot;webgl&quot;);
+    window.internals.simulateWebGLContextChanged(gl);
+}
+
+
+window.addEventListener(&quot;load&quot;, runTest, false);
+&lt;/script&gt;
+
+&lt;canvas&gt;&lt;/canvas&gt;
+&lt;canvas&gt;&lt;/canvas&gt;
+&lt;canvas&gt;&lt;/canvas&gt;
</ins><span class="cx">Property changes on: trunk/LayoutTests/fast/canvas/webgl/webglcontextchangedevent.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<ins>+native
</ins><span class="cx">\ No newline at end of property
</span><a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<ins>+Date Revision
</ins><span class="cx">\ No newline at end of property
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<ins>+text/html
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkLayoutTestsplatformgtkTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/gtk/TestExpectations (212636 => 212637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/TestExpectations        2017-02-20 15:30:24 UTC (rev 212636)
+++ trunk/LayoutTests/platform/gtk/TestExpectations        2017-02-20 15:47:23 UTC (rev 212637)
</span><span class="lines">@@ -665,6 +665,9 @@
</span><span class="cx"> # This requires a specific font on Mac
</span><span class="cx"> fast/text/hidpi-text-selection-gap-between-words.html [ Skip ]
</span><span class="cx"> 
</span><ins>+# webglcontextchanged event not supported
+fast/canvas/webgl/webglcontextchangedevent.html [ Skip ]
+
</ins><span class="cx"> # Test requires hardcoded font names, which I do not have for this port.
</span><span class="cx"> fast/text/han-generic-font-families.html [ WontFix ]
</span><span class="cx"> fast/text/hangul-generic-font-families.html [ WontFix ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformwinTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/win/TestExpectations (212636 => 212637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/win/TestExpectations        2017-02-20 15:30:24 UTC (rev 212636)
+++ trunk/LayoutTests/platform/win/TestExpectations        2017-02-20 15:47:23 UTC (rev 212637)
</span><span class="lines">@@ -3784,3 +3784,6 @@
</span><span class="cx"> 
</span><span class="cx"> # WebCrypto tests are failing.
</span><span class="cx"> webkit.org/b/165090 imported/w3c/WebCryptoAPI [ Skip ]
</span><ins>+
+# webglcontextchanged event not supported
+fast/canvas/webgl/webglcontextchangedevent.html [ Skip ]
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (212636 => 212637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-02-20 15:30:24 UTC (rev 212636)
+++ trunk/Source/WebCore/ChangeLog        2017-02-20 15:47:23 UTC (rev 212637)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2017-02-20  Dean Jackson  &lt;dino@apple.com&gt;
+
+        Add 'webglcontextchanged' WebGLContextEvent
+        https://bugs.webkit.org/show_bug.cgi?id=168595
+        &lt;rdar://problem/30604254&gt;
+
+        Reviewed by Antoine Quint.
+
+        Add a new event that is dispatched when the GraphicsContext3D
+        notices that the active GPU has changed.
+
+        Test: fast/canvas/webgl/webglcontextchangedevent.html
+
+        * dom/EventNames.h: Add 'webglcontextchanged'.
+        * html/canvas/WebGLRenderingContextBase.cpp:
+        (WebCore::WebGLRenderingContextBase::dispatchContextChangedEvent): Dispatch the new event.
+        (WebCore::WebGLRenderingContextBase::simulateContextChanged): Tell the GraphicsContext3D to
+        pretend there was a GPU switch. This is called from Internals for testing.
+        * html/canvas/WebGLRenderingContextBase.h:
+        * html/canvas/WebGLRenderingContextBase.idl: Export the interface so Internals can see it.
+
+        * platform/graphics/GraphicsContext3D.cpp:
+        (WebCore::GraphicsContext3D::simulateContextChanged): Tell the GraphicsContext3DManager
+        that it should pretend a GPU change has happened, which causes it to notify all the
+        active contexts.
+        * platform/graphics/GraphicsContext3D.h:
+
+        * platform/graphics/mac/GraphicsContext3DMac.mm:
+        (WebCore::GraphicsContext3DManager::updateAllContexts): Tell the GraphicsContext3Ds
+        to tell their WebGLRenderingContexts to dispatch an event.
+        (WebCore::GraphicsContext3D::simulateContextChanged): Fake the display change.
+        * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
+        (WebCore::GraphicsContext3D::dispatchContextChangedNotification): Tell the WebGLRenderingContext
+        that a change has occurred, and that it should dispatch an event. This is a layering
+        violation which will need to be fixed (although with other communication from GC3D back
+        to WebGL).
+        * testing/Internals.cpp:
+        (WebCore::Internals::simulateWebGLContextChanged):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
</ins><span class="cx"> 2017-02-19  Dean Jackson  &lt;dino@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Activate/deactivate high performance GPU when requested
</span></span></pre></div>
<a id="trunkSourceWebCoredomEventNamesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/EventNames.h (212636 => 212637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/EventNames.h        2017-02-20 15:30:24 UTC (rev 212636)
+++ trunk/Source/WebCore/dom/EventNames.h        2017-02-20 15:47:23 UTC (rev 212637)
</span><span class="lines">@@ -242,6 +242,7 @@
</span><span class="cx">     macro(volumechange) \
</span><span class="cx">     macro(waiting) \
</span><span class="cx">     macro(waitingforkey) \
</span><ins>+    macro(webglcontextchanged) \
</ins><span class="cx">     macro(webglcontextcreationerror) \
</span><span class="cx">     macro(webglcontextlost) \
</span><span class="cx">     macro(webglcontextrestored) \
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLRenderingContextBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (212636 => 212637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp        2017-02-20 15:30:24 UTC (rev 212636)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp        2017-02-20 15:47:23 UTC (rev 212637)
</span><span class="lines">@@ -5631,6 +5631,17 @@
</span><span class="cx">     canvas().dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextrestoredEvent, false, true, emptyString()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebGLRenderingContextBase::dispatchContextChangedEvent()
+{
+    canvas().dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextchangedEvent, false, true, emptyString()));
+}
+
+void WebGLRenderingContextBase::simulateContextChanged()
+{
+    if (m_context)
+        m_context-&gt;simulateContextChanged();
+}
+
</ins><span class="cx"> String WebGLRenderingContextBase::ensureNotNull(const String&amp; text) const
</span><span class="cx"> {
</span><span class="cx">     if (text.isNull())
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLRenderingContextBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h (212636 => 212637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h        2017-02-20 15:30:24 UTC (rev 212636)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h        2017-02-20 15:47:23 UTC (rev 212637)
</span><span class="lines">@@ -340,6 +340,8 @@
</span><span class="cx">     void recycleContext();
</span><span class="cx">     void forceRestoreContext();
</span><span class="cx">     void loseContextImpl(LostContextMode);
</span><ins>+    void dispatchContextChangedEvent();
+    WEBCORE_EXPORT void simulateContextChanged();
</ins><span class="cx"> 
</span><span class="cx">     GraphicsContext3D* graphicsContext3D() const { return m_context.get(); }
</span><span class="cx">     WebGLContextGroup* contextGroup() const { return m_contextGroup.get(); }
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLRenderingContextBaseidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.idl (212636 => 212637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.idl        2017-02-20 15:30:24 UTC (rev 212636)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.idl        2017-02-20 15:47:23 UTC (rev 212637)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx">     DoNotCheckConstants,
</span><span class="cx">     JSCustomMarkFunction,
</span><span class="cx">     NoInterfaceObject,
</span><ins>+    ExportMacro=WEBCORE_EXPORT,
</ins><span class="cx"> ] interface WebGLRenderingContextBase {
</span><span class="cx"> 
</span><span class="cx">     // back-reference to the canvas
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsContext3Dcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.cpp (212636 => 212637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.cpp        2017-02-20 15:30:24 UTC (rev 212636)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.cpp        2017-02-20 15:47:23 UTC (rev 212637)
</span><span class="lines">@@ -659,6 +659,10 @@
</span><span class="cx"> void GraphicsContext3D::setContextVisibility(bool)
</span><span class="cx"> {
</span><span class="cx"> }
</span><ins>+
+void GraphicsContext3D::simulateContextChanged()
+{
+}
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsContext3Dh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h (212636 => 212637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h        2017-02-20 15:30:24 UTC (rev 212636)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h        2017-02-20 15:47:23 UTC (rev 212637)
</span><span class="lines">@@ -1133,6 +1133,9 @@
</span><span class="cx">     void forceContextLost();
</span><span class="cx">     void recycleContext();
</span><span class="cx"> 
</span><ins>+    void dispatchContextChangedNotification();
+    void simulateContextChanged();
+
</ins><span class="cx">     void paintRenderingResultsToCanvas(ImageBuffer*);
</span><span class="cx">     RefPtr&lt;ImageData&gt; paintRenderingResultsToImageData();
</span><span class="cx">     bool paintCompositedResultsToCanvas(ImageBuffer*);
</span><span class="lines">@@ -1427,7 +1430,8 @@
</span><span class="cx">     friend class GraphicsContext3DPrivate;
</span><span class="cx">     std::unique_ptr&lt;GraphicsContext3DPrivate&gt; m_private;
</span><span class="cx"> #endif
</span><del>-    
</del><ins>+
+    // FIXME: Layering violation.
</ins><span class="cx">     WebGLRenderingContextBase* m_webglContext;
</span><span class="cx"> 
</span><span class="cx">     bool m_isForWebGL2 { false };
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacGraphicsContext3DMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm (212636 => 212637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm        2017-02-20 15:30:24 UTC (rev 212636)
+++ trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm        2017-02-20 15:47:23 UTC (rev 212637)
</span><span class="lines">@@ -189,8 +189,10 @@
</span><span class="cx"> void GraphicsContext3DManager::updateAllContexts()
</span><span class="cx"> {
</span><span class="cx"> #if PLATFORM(MAC)
</span><del>-    for (auto* context : m_contexts)
</del><ins>+    for (auto* context : m_contexts) {
</ins><span class="cx">         context-&gt;updateCGLContext();
</span><ins>+        context-&gt;dispatchContextChangedNotification();
+    }
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -720,6 +722,11 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void GraphicsContext3D::simulateContextChanged()
+{
+    manager().updateAllContexts();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+}
+
</ins><span class="cx"> #endif // ENABLE(GRAPHICS_CONTEXT_3D)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsopenglGraphicsContext3DOpenGLCommoncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp (212636 => 212637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp        2017-02-20 15:30:24 UTC (rev 212636)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp        2017-02-20 15:47:23 UTC (rev 212637)
</span><span class="lines">@@ -1895,6 +1895,14 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void GraphicsContext3D::dispatchContextChangedNotification()
+{
+#if ENABLE(WEBGL)
+    if (m_webglContext)
+        m_webglContext-&gt;dispatchContextChangedEvent();
+#endif
+}
+
</ins><span class="cx"> void GraphicsContext3D::texImage2DDirect(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, const void* pixels)
</span><span class="cx"> {
</span><span class="cx">     makeContextCurrent();
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (212636 => 212637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2017-02-20 15:30:24 UTC (rev 212636)
+++ trunk/Source/WebCore/testing/Internals.cpp        2017-02-20 15:47:23 UTC (rev 212637)
</span><span class="lines">@@ -134,6 +134,7 @@
</span><span class="cx"> #include &quot;UserMediaController.h&quot;
</span><span class="cx"> #include &quot;ViewportArguments.h&quot;
</span><span class="cx"> #include &quot;WebCoreJSClientData.h&quot;
</span><ins>+#include &quot;WebGLRenderingContextBase.h&quot;
</ins><span class="cx"> #include &quot;WorkerThread.h&quot;
</span><span class="cx"> #include &quot;WritingDirection.h&quot;
</span><span class="cx"> #include &quot;XMLHttpRequest.h&quot;
</span><span class="lines">@@ -3712,4 +3713,12 @@
</span><span class="cx">         document.page()-&gt;setAsRunningUserScripts();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEBGL)
+void Internals::simulateWebGLContextChanged(WebGLRenderingContextBase&amp; context)
+{
+    context.simulateContextChanged();
+}
+#endif
+
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.h (212636 => 212637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.h        2017-02-20 15:30:24 UTC (rev 212636)
+++ trunk/Source/WebCore/testing/Internals.h        2017-02-20 15:47:23 UTC (rev 212637)
</span><span class="lines">@@ -71,6 +71,7 @@
</span><span class="cx"> class StyleSheet;
</span><span class="cx"> class TimeRanges;
</span><span class="cx"> class TypeConversions;
</span><ins>+class WebGLRenderingContextBase;
</ins><span class="cx"> class XMLHttpRequest;
</span><span class="cx"> 
</span><span class="cx"> class Internals final : public RefCounted&lt;Internals&gt;, private ContextDestructionObserver {
</span><span class="lines">@@ -531,6 +532,10 @@
</span><span class="cx"> 
</span><span class="cx">     void setAsRunningUserScripts(Document&amp;);
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEBGL)
+    void simulateWebGLContextChanged(WebGLRenderingContextBase&amp;);
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     explicit Internals(Document&amp;);
</span><span class="cx">     Document* contextDocument() const;
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.idl (212636 => 212637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.idl        2017-02-20 15:30:24 UTC (rev 212636)
+++ trunk/Source/WebCore/testing/Internals.idl        2017-02-20 15:47:23 UTC (rev 212637)
</span><span class="lines">@@ -504,4 +504,6 @@
</span><span class="cx">     [CallWith=Document] void setAsRunningUserScripts();
</span><span class="cx"> 
</span><span class="cx">     void disableTileSizeUpdateDelay();
</span><ins>+
+    [Conditional=WEBGL] void simulateWebGLContextChanged(WebGLRenderingContextBase context);
</ins><span class="cx"> };
</span></span></pre>
</div>
</div>

</body>
</html>