Unreviewed, rolling out r212639.
authorjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Feb 2017 17:52:57 +0000 (17:52 +0000)
committerjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Feb 2017 17:52:57 +0000 (17:52 +0000)
Have a fix for the linker error on iOS.

Reverted changeset:

"Unreviewed, rolling out r212637."
https://bugs.webkit.org/show_bug.cgi?id=168595
http://trac.webkit.org/changeset/212639

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212650 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/canvas/webgl/webglcontextchangedevent-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/webgl/webglcontextchangedevent.html [new file with mode: 0644]
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/win/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/dom/EventNames.h
Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
Source/WebCore/html/canvas/WebGLRenderingContextBase.h
Source/WebCore/html/canvas/WebGLRenderingContextBase.idl
Source/WebCore/platform/graphics/GraphicsContext3D.cpp
Source/WebCore/platform/graphics/GraphicsContext3D.h
Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm
Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl

index 892a71f..bd8bc86 100644 (file)
@@ -1,3 +1,15 @@
+2017-02-20  Jon Lee  <jonlee@apple.com>
+
+        Unreviewed, rolling out r212639.
+
+        Have a fix for the linker error on iOS.
+
+        Reverted changeset:
+
+        "Unreviewed, rolling out r212637."
+        https://bugs.webkit.org/show_bug.cgi?id=168595
+        http://trac.webkit.org/changeset/212639
+
 2017-02-20  Ryan Haddad  <ryanhaddad@apple.com>
 
         Unreviewed, rolling out r212637.
diff --git a/LayoutTests/fast/canvas/webgl/webglcontextchangedevent-expected.txt b/LayoutTests/fast/canvas/webgl/webglcontextchangedevent-expected.txt
new file mode 100644 (file)
index 0000000..a3ffb5f
--- /dev/null
@@ -0,0 +1,8 @@
+  
+We should see three changed events.
+
+Saw webglcontextchanged event.
+
+Saw webglcontextchanged event.
+
+Saw webglcontextchanged event.
diff --git a/LayoutTests/fast/canvas/webgl/webglcontextchangedevent.html b/LayoutTests/fast/canvas/webgl/webglcontextchangedevent.html
new file mode 100644 (file)
index 0000000..39d77b7
--- /dev/null
@@ -0,0 +1,50 @@
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+function log(msg)
+{
+    let p = document.createElement("p");
+    p.textContent = msg;
+    document.body.appendChild(p);
+}
+
+function runTest()
+{
+    if (!window.internals) {
+        log("This test must run inside DRT/WKTR.");
+        return;
+    }
+
+    log("We should see three changed events.");
+
+    let changedEventsSeen = 0;
+
+    let handleChangedEvent = (event) => {
+        log("Saw webglcontextchanged event.");
+        changedEventsSeen++;
+        if (changedEventsSeen == 3)
+            testRunner.notifyDone();
+    }
+
+    document.querySelectorAll("canvas").forEach((c) =>
+    {
+        c.addEventListener("webglcontextchanged", handleChangedEvent, false);
+        let gl = c.getContext("webgl");
+        gl.clearColor(1, 0, 0, 1);
+        gl.clear(gl.COLOR_BUFFER_BIT);
+    });
+
+    let gl = document.querySelector("canvas").getContext("webgl");
+    window.internals.simulateWebGLContextChanged(gl);
+}
+
+
+window.addEventListener("load", runTest, false);
+</script>
+
+<canvas></canvas>
+<canvas></canvas>
+<canvas></canvas>
index 1998c79..12006c0 100644 (file)
@@ -665,6 +665,9 @@ webkit.org/b/153466 inspector/sampling-profiler [ Skip ]
 # This requires a specific font on Mac
 fast/text/hidpi-text-selection-gap-between-words.html [ Skip ]
 
+# webglcontextchanged event not supported
+fast/canvas/webgl/webglcontextchangedevent.html [ Skip ]
+
 # Test requires hardcoded font names, which I do not have for this port.
 fast/text/han-generic-font-families.html [ WontFix ]
 fast/text/hangul-generic-font-families.html [ WontFix ]
index ea297a4..74c0491 100644 (file)
@@ -3784,3 +3784,6 @@ imported/w3c/web-platform-tests/webrtc [ Skip ]
 
 # WebCrypto tests are failing.
 webkit.org/b/165090 imported/w3c/WebCryptoAPI [ Skip ]
+
+# webglcontextchanged event not supported
+fast/canvas/webgl/webglcontextchangedevent.html [ Skip ]
index 8300625..6e56c4d 100644 (file)
@@ -1,3 +1,15 @@
+2017-02-20  Jon Lee  <jonlee@apple.com>
+
+        Unreviewed, rolling out r212639.
+
+        Have a fix for the linker error on iOS.
+
+        Reverted changeset:
+
+        "Unreviewed, rolling out r212637."
+        https://bugs.webkit.org/show_bug.cgi?id=168595
+        http://trac.webkit.org/changeset/212639
+
 2017-02-20  Youenn Fablet  <youenn@apple.com>
 
         [WebRTC] Fix some memory leaks in libwebrtc binding code
index 877ffb7..3ec71c1 100644 (file)
@@ -242,6 +242,7 @@ namespace WebCore {
     macro(volumechange) \
     macro(waiting) \
     macro(waitingforkey) \
+    macro(webglcontextchanged) \
     macro(webglcontextcreationerror) \
     macro(webglcontextlost) \
     macro(webglcontextrestored) \
index fe3cb0c..079535a 100644 (file)
@@ -5631,6 +5631,17 @@ void WebGLRenderingContextBase::maybeRestoreContext()
     canvas().dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextrestoredEvent, false, true, emptyString()));
 }
 
+void WebGLRenderingContextBase::dispatchContextChangedEvent()
+{
+    canvas().dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextchangedEvent, false, true, emptyString()));
+}
+
+void WebGLRenderingContextBase::simulateContextChanged()
+{
+    if (m_context)
+        m_context->simulateContextChanged();
+}
+
 String WebGLRenderingContextBase::ensureNotNull(const String& text) const
 {
     if (text.isNull())
index 18334eb..6bb7d44 100644 (file)
@@ -340,6 +340,8 @@ public:
     void recycleContext();
     void forceRestoreContext();
     void loseContextImpl(LostContextMode);
+    void dispatchContextChangedEvent();
+    WEBCORE_EXPORT void simulateContextChanged();
 
     GraphicsContext3D* graphicsContext3D() const { return m_context.get(); }
     WebGLContextGroup* contextGroup() const { return m_contextGroup.get(); }
index 63b64cd..11698be 100644 (file)
@@ -51,6 +51,7 @@ typedef (ImageData or HTMLImageElement or HTMLCanvasElement or HTMLVideoElement)
     DoNotCheckConstants,
     JSCustomMarkFunction,
     NoInterfaceObject,
+    ExportMacro=WEBCORE_EXPORT,
 ] interface WebGLRenderingContextBase {
 
     // back-reference to the canvas
index 76bab7c..2b2cd1c 100644 (file)
@@ -659,6 +659,10 @@ unsigned GraphicsContext3D::getChannelBitsByFormat(GC3Denum format)
 void GraphicsContext3D::setContextVisibility(bool)
 {
 }
+
+void GraphicsContext3D::simulateContextChanged()
+{
+}
 #endif
 
 } // namespace WebCore
index 5f25e3a..0dfe935 100644 (file)
@@ -1133,6 +1133,9 @@ public:
     void forceContextLost();
     void recycleContext();
 
+    void dispatchContextChangedNotification();
+    void simulateContextChanged();
+
     void paintRenderingResultsToCanvas(ImageBuffer*);
     RefPtr<ImageData> paintRenderingResultsToImageData();
     bool paintCompositedResultsToCanvas(ImageBuffer*);
@@ -1427,7 +1430,8 @@ private:
     friend class GraphicsContext3DPrivate;
     std::unique_ptr<GraphicsContext3DPrivate> m_private;
 #endif
-    
+
+    // FIXME: Layering violation.
     WebGLRenderingContextBase* m_webglContext;
 
     bool m_isForWebGL2 { false };
index acae373..35a0cd8 100644 (file)
@@ -189,8 +189,10 @@ static void displayWasReconfigured(CGDirectDisplayID, CGDisplayChangeSummaryFlag
 void GraphicsContext3DManager::updateAllContexts()
 {
 #if PLATFORM(MAC)
-    for (auto* context : m_contexts)
+    for (auto* context : m_contexts) {
         context->updateCGLContext();
+        context->dispatchContextChangedNotification();
+    }
 #endif
 }
 
@@ -720,6 +722,11 @@ void GraphicsContext3D::setErrorMessageCallback(std::unique_ptr<ErrorMessageCall
 {
 }
 
+void GraphicsContext3D::simulateContextChanged()
+{
+    manager().updateAllContexts();
+}
+
 }
 
 #endif // ENABLE(GRAPHICS_CONTEXT_3D)
index 1536faf..d69d62d 100644 (file)
@@ -1895,6 +1895,14 @@ void GraphicsContext3D::recycleContext()
 #endif
 }
 
+void GraphicsContext3D::dispatchContextChangedNotification()
+{
+#if ENABLE(WEBGL)
+    if (m_webglContext)
+        m_webglContext->dispatchContextChangedEvent();
+#endif
+}
+
 void GraphicsContext3D::texImage2DDirect(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, const void* pixels)
 {
     makeContextCurrent();
index 6d26d55..cbb14f7 100644 (file)
 #include "UserMediaController.h"
 #include "ViewportArguments.h"
 #include "WebCoreJSClientData.h"
+#include "WebGLRenderingContextBase.h"
 #include "WorkerThread.h"
 #include "WritingDirection.h"
 #include "XMLHttpRequest.h"
@@ -3712,4 +3713,12 @@ void Internals::setAsRunningUserScripts(Document& document)
         document.page()->setAsRunningUserScripts();
 }
 
+#if ENABLE(WEBGL)
+void Internals::simulateWebGLContextChanged(WebGLRenderingContextBase& context)
+{
+    context.simulateContextChanged();
+}
+#endif
+
+
 } // namespace WebCore
index f5c08a8..473a344 100644 (file)
@@ -71,6 +71,7 @@ class SourceBuffer;
 class StyleSheet;
 class TimeRanges;
 class TypeConversions;
+class WebGLRenderingContextBase;
 class XMLHttpRequest;
 
 class Internals final : public RefCounted<Internals>, private ContextDestructionObserver {
@@ -531,6 +532,10 @@ public:
 
     void setAsRunningUserScripts(Document&);
 
+#if ENABLE(WEBGL)
+    void simulateWebGLContextChanged(WebGLRenderingContextBase&);
+#endif
+
 private:
     explicit Internals(Document&);
     Document* contextDocument() const;
index 155b70b..8bbb9de 100644 (file)
@@ -504,4 +504,6 @@ enum EventThrottlingBehavior {
     [CallWith=Document] void setAsRunningUserScripts();
 
     void disableTileSizeUpdateDelay();
+
+    [Conditional=WEBGL] void simulateWebGLContextChanged(WebGLRenderingContextBase context);
 };