Title: [206675] trunk/Source/WebKit2
Revision
206675
Author
[email protected]
Date
2016-09-30 14:32:54 -0700 (Fri, 30 Sep 2016)

Log Message

Second time going into fullscreen using silverlight, will hide the menu bar and dock for Safari
https://bugs.webkit.org/show_bug.cgi?id=162805
rdar://problem/28208495

Reviewed by Dan Bernstein.

Turns out that the WindowRef wrappers for full screen NSWindows can end up in the m_windows HashSet,
and never go away.

Fix this by storing the canonical CGWindowIDs in the hash map instead.

* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::cgWindowID):
(WebKit::windowCoversAnyScreen):
(WebKit::FullscreenWindowTracker::windowShown):
(WebKit::FullscreenWindowTracker::windowHidden):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (206674 => 206675)


--- trunk/Source/WebKit2/ChangeLog	2016-09-30 21:31:01 UTC (rev 206674)
+++ trunk/Source/WebKit2/ChangeLog	2016-09-30 21:32:54 UTC (rev 206675)
@@ -1,3 +1,22 @@
+2016-09-30  Anders Carlsson  <[email protected]>
+
+        Second time going into fullscreen using silverlight, will hide the menu bar and dock for Safari
+        https://bugs.webkit.org/show_bug.cgi?id=162805
+        rdar://problem/28208495
+
+        Reviewed by Dan Bernstein.
+
+        Turns out that the WindowRef wrappers for full screen NSWindows can end up in the m_windows HashSet,
+        and never go away. 
+        
+        Fix this by storing the canonical CGWindowIDs in the hash map instead.
+
+        * PluginProcess/mac/PluginProcessMac.mm:
+        (WebKit::cgWindowID):
+        (WebKit::windowCoversAnyScreen):
+        (WebKit::FullscreenWindowTracker::windowShown):
+        (WebKit::FullscreenWindowTracker::windowHidden):
+
 2016-09-30  Myles C. Maxfield  <[email protected]>
 
         Create runtime flag for variation font work

Modified: trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm (206674 => 206675)


--- trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm	2016-09-30 21:31:01 UTC (rev 206674)
+++ trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm	2016-09-30 21:32:54 UTC (rev 206675)
@@ -70,8 +70,7 @@
     template<typename T> void windowHidden(T window);
 
 private:
-    typedef HashSet<void*> WindowSet;
-    WindowSet m_windows;
+    HashSet<CGWindowID> m_windows;
 };
 
 static bool rectCoversAnyScreen(NSRect rect)
@@ -94,18 +93,33 @@
 
     return rectCoversAnyScreen(NSRectFromCGRect(bounds));
 }
+
+static CGWindowID cgWindowID(WindowRef window)
+{
+    return reinterpret_cast<CGWindowID>(WKGetNativeWindowFromWindowRef(window));
+}
+
 #endif
 
-static bool windowCoversAnyScreen(NSWindow* window)
+static bool windowCoversAnyScreen(NSWindow *window)
 {
-    return rectCoversAnyScreen([window frame]);
+    return rectCoversAnyScreen(window.frame);
 }
 
-template<typename T> void FullscreenWindowTracker::windowShown(T window)
+static CGWindowID cgWindowID(NSWindow *window)
 {
+    return window.windowNumber;
+}
+
+template<typename T>
+void FullscreenWindowTracker::windowShown(T window)
+{
+    CGWindowID windowID = cgWindowID(window);
+    if (!windowID)
+        return;
+
     // If this window is already visible then there is nothing to do.
-    WindowSet::iterator it = m_windows.find(window);
-    if (it != m_windows.end())
+    if (m_windows.contains(windowID))
         return;
     
     // If the window is not full-screen then we're not interested in it.
@@ -114,7 +128,7 @@
 
     bool windowSetWasEmpty = m_windows.isEmpty();
 
-    m_windows.add(window);
+    m_windows.add(windowID);
     
     // If this is the first full screen window to be shown, notify the UI process.
     if (windowSetWasEmpty)
@@ -121,15 +135,17 @@
         PluginProcess::singleton().setFullscreenWindowIsShowing(true);
 }
 
-template<typename T> void FullscreenWindowTracker::windowHidden(T window)
+template<typename T>
+void FullscreenWindowTracker::windowHidden(T window)
 {
+    CGWindowID windowID = cgWindowID(window);
+    if (!windowID)
+        return;
+
     // If this is not a window that we're tracking then there is nothing to do.
-    WindowSet::iterator it = m_windows.find(window);
-    if (it == m_windows.end())
+    if (!m_windows.remove(windowID))
         return;
 
-    m_windows.remove(it);
-
     // If this was the last full screen window that was visible, notify the UI process.
     if (m_windows.isEmpty())
         PluginProcess::singleton().setFullscreenWindowIsShowing(false);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to