[WebGL] Contexts are not updated when display configuration changed.
authorpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Aug 2018 18:04:48 +0000 (18:04 +0000)
committerpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Aug 2018 18:04:48 +0000 (18:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188750

Reviewed by Brent Fulgham.

Source/WebCore:

Calling CGDisplayRegisterReconfigurationCallback in GraphicsContext3DManager::addContext
returns kCGErrorSuccess when WindowServer access is blocked in the WebContent process,
but the callback function is never called. We should register the callback function in
the UI process, and send a message to the WebContent process when the display
configuration changed.

Test: fast/canvas/webgl/context-update-on-display-configuration.html

* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/GraphicsContext3DManager.cpp:
(WebCore::GraphicsContext3DManager::displayWasReconfigured):
(WebCore::GraphicsContext3DManager::addContext):
(WebCore::GraphicsContext3DManager::removeContext):
(WebCore::displayWasReconfigured): Deleted.
* platform/graphics/GraphicsContext3DManager.h:

Source/WebKit:

Calling CGDisplayRegisterReconfigurationCallback in GraphicsContext3DManager::addContext
returns kCGErrorSuccess when WindowServer access is blocked in the WebContent process,
but the callback function is never called. We should register the callback function in
the UI process, and send a message to the WebContent process when the display
configuration changed.

* Sources.txt:
* UIProcess/API/C/WKMockDisplay.cpp: Added.
(WKSendDisplayConfigurationChangedMessageForTesting):
* UIProcess/API/C/WKMockDisplay.h: Added.
* UIProcess/WebProcessPool.cpp:
(WebKit::displayReconfigurationCallBack):
(WebKit::WebProcessPool::sendDisplayConfigurationChangedMessageForTesting):
* UIProcess/WebProcessPool.h:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::displayConfigurationChanged):

Tools:

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::sendDisplayConfigurationChangedMessageForTesting):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::sendDisplayConfigurationChangedMessageForTesting):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):

LayoutTests:

* TestExpectations:
* fast/canvas/webgl/context-update-on-display-configuration-expected.txt: Added.
* fast/canvas/webgl/context-update-on-display-configuration.html: Added.
* platform/mac-wk2/TestExpectations:

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

26 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/fast/canvas/webgl/context-update-on-display-configuration-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/webgl/context-update-on-display-configuration.html [new file with mode: 0644]
LayoutTests/platform/mac-wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/graphics/GraphicsContext3DManager.cpp
Source/WebCore/platform/graphics/GraphicsContext3DManager.h
Source/WebKit/ChangeLog
Source/WebKit/Sources.txt
Source/WebKit/UIProcess/API/C/WKMockDisplay.cpp [new file with mode: 0644]
Source/WebKit/UIProcess/API/C/WKMockDisplay.h [new file with mode: 0644]
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/WebProcessPool.h
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/WebProcess/WebProcess.h
Source/WebKit/WebProcess/WebProcess.messages.in
Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestController.h
Tools/WebKitTestRunner/TestInvocation.cpp

index bbdbdb8..0652cb1 100644 (file)
@@ -1,3 +1,15 @@
+2018-08-21  Per Arne Vollan  <pvollan@apple.com>
+
+        [WebGL] Contexts are not updated when display configuration changed.
+        https://bugs.webkit.org/show_bug.cgi?id=188750
+
+        Reviewed by Brent Fulgham.
+
+        * TestExpectations:
+        * fast/canvas/webgl/context-update-on-display-configuration-expected.txt: Added.
+        * fast/canvas/webgl/context-update-on-display-configuration.html: Added.
+        * platform/mac-wk2/TestExpectations:
+
 2018-08-21  John Wilander  <wilander@apple.com>
 
         Make ResourceLoadObserver::logWebSocketLoading() handle websockets in detached frames
index bef5b5d..980318b 100644 (file)
@@ -2223,3 +2223,6 @@ webkit.org/b/187762 http/tests/websocket/tests/hybi/websocket-cookie-overwrite-b
 webkit.org/b/187269 [ Debug ] imported/w3c/web-platform-tests/FileAPI/reading-data-section/filereader_abort.html [ Skip ]
 
 webkit.org/b/185308 legacy-animation-engine/animations/combo-transform-translate+scale.html [ Pass Failure ]
+
+# This test is currently only relevant on mac-wk2
+fast/canvas/webgl/context-update-on-display-configuration.html [ Skip ]
diff --git a/LayoutTests/fast/canvas/webgl/context-update-on-display-configuration-expected.txt b/LayoutTests/fast/canvas/webgl/context-update-on-display-configuration-expected.txt
new file mode 100644 (file)
index 0000000..09d11ee
--- /dev/null
@@ -0,0 +1,9 @@
+Tests that context is updated when display configuration changes.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/canvas/webgl/context-update-on-display-configuration.html b/LayoutTests/fast/canvas/webgl/context-update-on-display-configuration.html
new file mode 100644 (file)
index 0000000..2ca9d1b
--- /dev/null
@@ -0,0 +1,39 @@
+<html>
+<head>
+<style>
+#example {
+  width: 100%;
+  height: 100%;
+}
+</style>
+<script src="../../../resources/js-test.js"></script>
+<script src="resources/webgl-test-utils.js"> </script>
+<script>
+description('Tests that context is updated when display configuration changes.');
+
+function start()
+{
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+    }
+    
+    var canvas = document.getElementById('example');
+    var gl = WebGLTestUtils.create3DContext(canvas);
+
+    canvas.addEventListener('webglcontextchanged', function(e) {
+                            if (window.testRunner)
+                                testRunner.notifyDone();
+                            }, false);
+    
+    if (window.testRunner)
+        testRunner.sendDisplayConfigurationChangedMessageForTesting();
+}
+</script>
+</head>
+
+<body onload="start()">
+    <canvas id="example"></canvas>
+</body>
+</html>
+
index 284fea1..73ad354 100644 (file)
@@ -846,3 +846,5 @@ webkit.org/b/183705 http/tests/workers/service/client-removed-from-clients-while
 webkit.org/b/183705 http/tests/workers/service/serviceworkerclients-matchAll.https.html [ Pass Failure ]
 
 webkit.org/b/187658 http/tests/security/bypassing-cors-checks-for-extension-urls.html [ Pass Failure ]
+
+[ Mojave+ ] fast/canvas/webgl/context-update-on-display-configuration.html [ Pass ]
index f4c755d..03a81b7 100644 (file)
@@ -1,3 +1,26 @@
+2018-08-21  Per Arne Vollan  <pvollan@apple.com>
+
+        [WebGL] Contexts are not updated when display configuration changed.
+        https://bugs.webkit.org/show_bug.cgi?id=188750
+
+        Reviewed by Brent Fulgham.
+
+        Calling CGDisplayRegisterReconfigurationCallback in GraphicsContext3DManager::addContext
+        returns kCGErrorSuccess when WindowServer access is blocked in the WebContent process,
+        but the callback function is never called. We should register the callback function in
+        the UI process, and send a message to the WebContent process when the display
+        configuration changed.
+
+        Test: fast/canvas/webgl/context-update-on-display-configuration.html
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/graphics/GraphicsContext3DManager.cpp:
+        (WebCore::GraphicsContext3DManager::displayWasReconfigured):
+        (WebCore::GraphicsContext3DManager::addContext):
+        (WebCore::GraphicsContext3DManager::removeContext):
+        (WebCore::displayWasReconfigured): Deleted.
+        * platform/graphics/GraphicsContext3DManager.h:
+
 2018-08-21  John Wilander  <wilander@apple.com>
 
         Make ResourceLoadObserver::logWebSocketLoading() handle websockets in detached frames
index 4301656..ee295f9 100644 (file)
                D05CED2A0A40BB2C00C5AF38 /* FormatBlockCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = D05CED280A40BB2C00C5AF38 /* FormatBlockCommand.h */; };
                D06C0D8F0CFD11460065F43F /* RemoveFormatCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = D06C0D8D0CFD11460065F43F /* RemoveFormatCommand.h */; };
                D07DEABA0A36554A00CA30F8 /* InsertListCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = D07DEAB80A36554A00CA30F8 /* InsertListCommand.h */; };
-               D0843A4B20FEBE3D00FE860E /* GraphicsContext3DManager.h in Headers */ = {isa = PBXBuildFile; fileRef = D0843A4A20FEBE3D00FE860E /* GraphicsContext3DManager.h */; };
+               D0843A4B20FEBE3D00FE860E /* GraphicsContext3DManager.h in Headers */ = {isa = PBXBuildFile; fileRef = D0843A4A20FEBE3D00FE860E /* GraphicsContext3DManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
                D0843A4D20FEC16500FE860E /* GraphicsContext3DManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0843A4C20FEC16500FE860E /* GraphicsContext3DManager.cpp */; };
                D086FE9809D53AAB005BC74D /* UnlinkCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = D086FE9609D53AAB005BC74D /* UnlinkCommand.h */; };
                D08B00E220A282490004BC0A /* WebGLCompressedTextureASTC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A20D562092A0A600E0C259 /* WebGLCompressedTextureASTC.cpp */; };
index 85e07d5..8adf30e 100644 (file)
@@ -123,7 +123,7 @@ GraphicsContext3DManager& GraphicsContext3DManager::sharedManager()
 }
 
 #if PLATFORM(MAC)
-static void displayWasReconfigured(CGDirectDisplayID, CGDisplayChangeSummaryFlags flags, void*)
+void GraphicsContext3DManager::displayWasReconfigured(CGDirectDisplayID, CGDisplayChangeSummaryFlags flags, void*)
 {
     if (flags & kCGDisplaySetModeFlag)
         GraphicsContext3DManager::sharedManager().updateAllContexts();
@@ -158,7 +158,7 @@ void GraphicsContext3DManager::addContext(GraphicsContext3D* context, HostWindow
     if (!context)
         return;
     
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) && !ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
     if (!m_contexts.size())
         CGDisplayRegisterReconfigurationCallback(displayWasReconfigured, nullptr);
 #endif
@@ -175,7 +175,7 @@ void GraphicsContext3DManager::removeContext(GraphicsContext3D* context)
     m_contextWindowMap.remove(context);
     removeContextRequiringHighPerformance(context);
     
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) && !ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
     if (!m_contexts.size())
         CGDisplayRemoveReconfigurationCallback(displayWasReconfigured, nullptr);
 #endif
index 13725ee..efedf36 100644 (file)
 
 #pragma once
 
-#include <Timer.h>
+#include "Timer.h"
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
 
 #if PLATFORM(MAC)
+#include <CoreGraphics/CGDisplayConfiguration.h>
 #include <OpenGL/CGLTypes.h>
 #endif
 
@@ -65,6 +66,7 @@ public:
 
 #if PLATFORM(MAC)
     void screenDidChange(PlatformDisplayID, const HostWindow*);
+    WEBCORE_EXPORT static void displayWasReconfigured(CGDirectDisplayID, CGDisplayChangeSummaryFlags, void*);
 #endif
     
 private:
index 6bf0ad9..4510bce 100644 (file)
@@ -1,3 +1,30 @@
+2018-08-21  Per Arne Vollan  <pvollan@apple.com>
+
+        [WebGL] Contexts are not updated when display configuration changed.
+        https://bugs.webkit.org/show_bug.cgi?id=188750
+
+        Reviewed by Brent Fulgham.
+
+        Calling CGDisplayRegisterReconfigurationCallback in GraphicsContext3DManager::addContext
+        returns kCGErrorSuccess when WindowServer access is blocked in the WebContent process,
+        but the callback function is never called. We should register the callback function in
+        the UI process, and send a message to the WebContent process when the display
+        configuration changed.
+
+        * Sources.txt:
+        * UIProcess/API/C/WKMockDisplay.cpp: Added.
+        (WKSendDisplayConfigurationChangedMessageForTesting):
+        * UIProcess/API/C/WKMockDisplay.h: Added.
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::displayReconfigurationCallBack):
+        (WebKit::WebProcessPool::sendDisplayConfigurationChangedMessageForTesting):
+        * UIProcess/WebProcessPool.h:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/WebProcess.h:
+        * WebProcess/WebProcess.messages.in:
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::displayConfigurationChanged):
+
 2018-08-21  John Wilander  <wilander@apple.com>
 
         Make ResourceLoadObserver::logWebSocketLoading() handle websockets in detached frames
index f38add1..1fe4d50 100644 (file)
@@ -328,6 +328,7 @@ UIProcess/API/C/WKIconDatabase.cpp @no-unify
 UIProcess/API/C/WKInspector.cpp @no-unify
 UIProcess/API/C/WKKeyValueStorageManager.cpp @no-unify
 UIProcess/API/C/WKMediaSessionMetadata.cpp @no-unify
+UIProcess/API/C/WKMockDisplay.cpp @no-unify
 UIProcess/API/C/WKMockMediaDevice.cpp @no-unify
 UIProcess/API/C/WKNavigationActionRef.cpp @no-unify
 UIProcess/API/C/WKNavigationDataRef.cpp @no-unify
diff --git a/Source/WebKit/UIProcess/API/C/WKMockDisplay.cpp b/Source/WebKit/UIProcess/API/C/WKMockDisplay.cpp
new file mode 100644 (file)
index 0000000..ba6e0eb
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "config.h"
+#include "WKMockDisplay.h"
+
+#include "WKAPICast.h"
+#include "WKString.h"
+#include "WebProcessPool.h"
+
+using namespace WebKit;
+
+void WKSendDisplayConfigurationChangedMessageForTesting(WKContextRef context)
+{
+    toImpl(context)->sendDisplayConfigurationChangedMessageForTesting();
+}
diff --git a/Source/WebKit/UIProcess/API/C/WKMockDisplay.h b/Source/WebKit/UIProcess/API/C/WKMockDisplay.h
new file mode 100644 (file)
index 0000000..8b0e913
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#pragma once
+
+#include <WebKit/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+    
+WK_EXPORT void WKSendDisplayConfigurationChangedMessageForTesting(WKContextRef);
+    
+#ifdef __cplusplus
+}
+#endif
index 7a93bf7..942efb0 100644 (file)
@@ -831,8 +831,12 @@ RefPtr<WebProcessProxy> WebProcessPool::tryTakePrewarmedProcess(WebsiteDataStore
 static void displayReconfigurationCallBack(CGDirectDisplayID display, CGDisplayChangeSummaryFlags flags, void *userInfo)
 {
     auto screenProperties = WebCore::collectScreenProperties();
-    for (auto& processPool : WebProcessPool::allProcessPools())
+    for (auto& processPool : WebProcessPool::allProcessPools()) {
         processPool->sendToAllProcesses(Messages::WebProcess::SetScreenProperties(screenProperties));
+#if ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
+        processPool->sendToAllProcesses(Messages::WebProcess::DisplayConfigurationChanged(display, flags));
+#endif
+    }
 }
 
 static void registerDisplayConfigurationCallback()
@@ -2292,4 +2296,16 @@ void WebProcessPool::resetMockMediaDevices()
 #endif
 }
 
+void WebProcessPool::sendDisplayConfigurationChangedMessageForTesting()
+{
+#if PLATFORM(MAC) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
+    auto display = CGSMainDisplayID();
+
+    for (auto& processPool : WebProcessPool::allProcessPools()) {
+        processPool->sendToAllProcesses(Messages::WebProcess::DisplayConfigurationChanged(display, kCGDisplayBeginConfigurationFlag));
+        processPool->sendToAllProcesses(Messages::WebProcess::DisplayConfigurationChanged(display, kCGDisplaySetModeFlag | kCGDisplayDesktopShapeChangedFlag));
+    }
+#endif
+}
+
 } // namespace WebKit
index 25cc4d4..6a29140 100644 (file)
@@ -472,6 +472,8 @@ public:
     void removeMockMediaDevice(const String& persistentId);
     void resetMockMediaDevices();
 
+    void sendDisplayConfigurationChangedMessageForTesting();
+
 private:
     void platformInitialize();
 
index 59d09c9..608ed95 100644 (file)
                C0CE72A11247E71D00BC0EC4 /* WebPageMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = C0CE729F1247E71D00BC0EC4 /* WebPageMessages.h */; };
                C0CE72AD1247E78D00BC0EC4 /* HandleMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = C0CE72AC1247E78D00BC0EC4 /* HandleMessage.h */; };
                C0E3AA7C1209E83C00A49D01 /* Module.h in Headers */ = {isa = PBXBuildFile; fileRef = C0E3AA441209E2BA00A49D01 /* Module.h */; };
+               C11E1694212B87C500985FF6 /* WKMockDisplay.h in Headers */ = {isa = PBXBuildFile; fileRef = C11E1692212B87C500985FF6 /* WKMockDisplay.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               C11E1695212B87C500985FF6 /* WKMockDisplay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C11E1693212B87C500985FF6 /* WKMockDisplay.cpp */; };
                C181735F205839F600DFDA65 /* DrawingAreaMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C181735E205839F600DFDA65 /* DrawingAreaMac.cpp */; };
                C18173612058424700DFDA65 /* DisplayLink.h in Headers */ = {isa = PBXBuildFile; fileRef = C18173602058424700DFDA65 /* DisplayLink.h */; };
                C1817363205844A900DFDA65 /* DisplayLink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C1817362205844A900DFDA65 /* DisplayLink.cpp */; };
                C0E3AA441209E2BA00A49D01 /* Module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Module.h; sourceTree = "<group>"; };
                C0E3AA451209E2BA00A49D01 /* Module.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Module.cpp; sourceTree = "<group>"; };
                C0E3AA481209E45000A49D01 /* ModuleCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ModuleCF.cpp; sourceTree = "<group>"; };
+               C11E1692212B87C500985FF6 /* WKMockDisplay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKMockDisplay.h; sourceTree = "<group>"; };
+               C11E1693212B87C500985FF6 /* WKMockDisplay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKMockDisplay.cpp; sourceTree = "<group>"; };
                C181735E205839F600DFDA65 /* DrawingAreaMac.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DrawingAreaMac.cpp; sourceTree = "<group>"; };
                C18173602058424700DFDA65 /* DisplayLink.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisplayLink.h; sourceTree = "<group>"; };
                C1817362205844A900DFDA65 /* DisplayLink.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayLink.cpp; sourceTree = "<group>"; };
                                C98C48A81B6FD5B500145103 /* WKMediaSessionFocusManager.h */,
                                C9CD43991B4B024200239E33 /* WKMediaSessionMetadata.cpp */,
                                C9CD439A1B4B024200239E33 /* WKMediaSessionMetadata.h */,
+                               C11E1693212B87C500985FF6 /* WKMockDisplay.cpp */,
+                               C11E1692212B87C500985FF6 /* WKMockDisplay.h */,
                                411A8DDA20DDB6050060D34F /* WKMockMediaDevice.cpp */,
                                411A8DD920DDB6050060D34F /* WKMockMediaDevice.h */,
                                C09AE5E8125257C20025825D /* WKNativeEvent.h */,
                                C98C48AA1B6FD5B500145103 /* WKMediaSessionFocusManager.h in Headers */,
                                C9CD439D1B4B024F00239E33 /* WKMediaSessionMetadata.h in Headers */,
                                1AB40EE61BF677E300BA81BE /* WKMenuItemIdentifiersPrivate.h in Headers */,
+                               C11E1694212B87C500985FF6 /* WKMockDisplay.h in Headers */,
                                411A8DDB20DDD1AC0060D34F /* WKMockMediaDevice.h in Headers */,
                                BC4075FE124FF0270068F20A /* WKMutableArray.h in Headers */,
                                BC407600124FF0270068F20A /* WKMutableDictionary.h in Headers */,
                                C98C48A91B6FD5B500145103 /* WKMediaSessionFocusManager.cpp in Sources */,
                                C9CD439E1B4B025300239E33 /* WKMediaSessionMetadata.cpp in Sources */,
                                1AB40EE51BF677E300BA81BE /* WKMenuItemIdentifiers.mm in Sources */,
+                               C11E1695212B87C500985FF6 /* WKMockDisplay.cpp in Sources */,
                                411A8DDC20DDD23F0060D34F /* WKMockMediaDevice.cpp in Sources */,
                                BC4075FD124FF0270068F20A /* WKMutableArray.cpp in Sources */,
                                BC4075FF124FF0270068F20A /* WKMutableDictionary.cpp in Sources */,
index 817c54c..0a3e645 100644 (file)
@@ -383,6 +383,7 @@ private:
     void setScreenProperties(const WebCore::ScreenProperties&);
 #if ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
     void scrollerStylePreferenceChanged(bool useOverlayScrollbars);
+    void displayConfigurationChanged(CGDirectDisplayID, CGDisplayChangeSummaryFlags);
 #endif
 #endif
 
index 6712f39..65c6610 100644 (file)
@@ -133,6 +133,7 @@ messages -> WebProcess LegacyReceiver {
     SetScreenProperties(struct WebCore::ScreenProperties screenProperties)
 #if ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
     ScrollerStylePreferenceChanged(bool useOvelayScrollbars)
+    DisplayConfigurationChanged(CGDirectDisplayID displayID, CGDisplayChangeSummaryFlags flags)
 #endif
 #endif
 
index eedb923..72ef801 100644 (file)
@@ -86,6 +86,7 @@
 #endif
 
 #if PLATFORM(MAC)
+#import <WebCore/GraphicsContext3DManager.h>
 #import <WebCore/ScrollbarThemeMac.h>
 #import <pal/spi/mac/NSScrollerImpSPI.h>
 #endif
@@ -601,7 +602,12 @@ void WebProcess::scrollerStylePreferenceChanged(bool useOverlayScrollbars)
     NSScrollerStyle style = useOverlayScrollbars ? NSScrollerStyleOverlay : NSScrollerStyleLegacy;
     [NSScrollerImpPair _updateAllScrollerImpPairsForNewRecommendedScrollerStyle:style];
 }
-#endif    
+
+void WebProcess::displayConfigurationChanged(CGDirectDisplayID displayID, CGDisplayChangeSummaryFlags flags)
+{
+    GraphicsContext3DManager::displayWasReconfigured(displayID, flags, nullptr);
+}
+#endif
 
 void WebProcess::setMediaMIMETypes(const Vector<String> types)
 {
index 0be457f..de5efd4 100644 (file)
@@ -1,3 +1,20 @@
+2018-08-21  Per Arne Vollan  <pvollan@apple.com>
+
+        [WebGL] Contexts are not updated when display configuration changed.
+        https://bugs.webkit.org/show_bug.cgi?id=188750
+
+        Reviewed by Brent Fulgham.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::sendDisplayConfigurationChangedMessageForTesting):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::sendDisplayConfigurationChangedMessageForTesting):
+        * WebKitTestRunner/TestController.h:
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+
 2018-08-21  John Wilander  <wilander@apple.com>
 
         Make ResourceLoadObserver::logWebSocketLoading() handle websockets in detached frames
index 634d352..6061f0f 100644 (file)
@@ -345,4 +345,6 @@ interface TestRunner {
 
     void injectUserScript(DOMString string);
     readonly attribute unsigned long userScriptInjectedCount;
+
+    void sendDisplayConfigurationChangedMessageForTesting();
 };
index db5cd6d..8446f73 100644 (file)
@@ -2322,4 +2322,10 @@ void TestRunner::injectUserScript(JSStringRef script)
     WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get(), &returnData);
 }
 
+void TestRunner::sendDisplayConfigurationChangedMessageForTesting()
+{
+    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SendDisplayConfigurationChangedMessageForTesting"));
+    WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), nullptr, nullptr);
+}
+
 } // namespace WTR
index 789095f..013de70 100644 (file)
@@ -462,6 +462,8 @@ public:
     size_t userScriptInjectedCount() const;
     void injectUserScript(JSStringRef);
 
+    void sendDisplayConfigurationChangedMessageForTesting();
+
 private:
     TestRunner();
 
index e0527da..59ce258 100644 (file)
@@ -43,6 +43,7 @@
 #include <WebKit/WKFrameHandleRef.h>
 #include <WebKit/WKFrameInfoRef.h>
 #include <WebKit/WKIconDatabase.h>
+#include <WebKit/WKMockDisplay.h>
 #include <WebKit/WKMockMediaDevice.h>
 #include <WebKit/WKNavigationResponseRef.h>
 #include <WebKit/WKNotification.h>
@@ -2969,4 +2970,9 @@ void TestController::injectUserScript(WKStringRef)
 
 #endif
 
+void TestController::sendDisplayConfigurationChangedMessageForTesting()
+{
+    WKSendDisplayConfigurationChangedMessageForTesting(platformContext());
+}
+
 } // namespace WTR
index b07a9b1..08b67af 100644 (file)
@@ -219,6 +219,8 @@ public:
     void resetMockMediaDevices();
 
     void injectUserScript(WKStringRef);
+    
+    void sendDisplayConfigurationChangedMessageForTesting();
 
 private:
     WKRetainPtr<WKPageConfigurationRef> generatePageConfiguration(WKContextConfigurationRef);
index d3e9d8a..645d74a 100644 (file)
@@ -1430,6 +1430,11 @@ WKRetainPtr<WKTypeRef> TestInvocation::didReceiveSynchronousMessageFromInjectedB
         return nullptr;
     }
 
+    if (WKStringIsEqualToUTF8CString(messageName, "SendDisplayConfigurationChangedMessageForTesting")) {
+        TestController::singleton().sendDisplayConfigurationChangedMessageForTesting();
+        return nullptr;
+    }
+
     ASSERT_NOT_REACHED();
     return nullptr;
 }