Title: [203335] trunk/Source/WebKit2
Revision
203335
Author
[email protected]
Date
2016-07-17 13:35:20 -0700 (Sun, 17 Jul 2016)

Log Message

REGRESSION (r191907): Maxthon Browser -After exit full screen video playback the browser window is blank with audio running
https://bugs.webkit.org/show_bug.cgi?id=159731
<rdar://problem/26674003>

Patch by Jeremy Jones <[email protected]> on 2016-07-17
Reviewed by Tim Horton.

Primarily written by Jer Noble  <[email protected]>.

When a view is removed from it's superview, and that superview's constraints property references
the removed superview, those constraints are removed as well. Make sure to save off a copy of
the superview's constraints before swapping in the placeholder view, and reapply those constraints
when swapping the web view back into its original superview.

* UIProcess/mac/WKFullScreenWindowController.h:
* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController setSavedConstraints:]):
(-[WKFullScreenWindowController savedConstraints]):
(-[WKFullScreenWindowController enterFullScreen:]):
(-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
(-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (203334 => 203335)


--- trunk/Source/WebKit2/ChangeLog	2016-07-17 19:12:49 UTC (rev 203334)
+++ trunk/Source/WebKit2/ChangeLog	2016-07-17 20:35:20 UTC (rev 203335)
@@ -1,3 +1,26 @@
+2016-07-17  Jeremy Jones  <[email protected]>
+
+        REGRESSION (r191907): Maxthon Browser -After exit full screen video playback the browser window is blank with audio running
+        https://bugs.webkit.org/show_bug.cgi?id=159731
+        <rdar://problem/26674003>
+
+        Reviewed by Tim Horton.
+
+        Primarily written by Jer Noble  <[email protected]>.
+
+        When a view is removed from it's superview, and that superview's constraints property references
+        the removed superview, those constraints are removed as well. Make sure to save off a copy of
+        the superview's constraints before swapping in the placeholder view, and reapply those constraints
+        when swapping the web view back into its original superview.
+
+        * UIProcess/mac/WKFullScreenWindowController.h:
+        * UIProcess/mac/WKFullScreenWindowController.mm:
+        (-[WKFullScreenWindowController setSavedConstraints:]):
+        (-[WKFullScreenWindowController savedConstraints]):
+        (-[WKFullScreenWindowController enterFullScreen:]):
+        (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
+        (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
+
 2016-07-16  Ryosuke Niwa  <[email protected]>
 
         Rename fastGetAttribute to attributeWithoutSynchronization

Modified: trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h (203334 => 203335)


--- trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h	2016-07-17 19:12:49 UTC (rev 203334)
+++ trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h	2016-07-17 20:35:20 UTC (rev 203335)
@@ -53,6 +53,7 @@
     NSRect _initialFrame;
     NSRect _finalFrame;
     RetainPtr<NSTimer> _watchdogTimer;
+    RetainPtr<NSArray> _savedConstraints;
 
     FullScreenState _fullScreenState;
 
@@ -63,6 +64,7 @@
 
 @property (readonly) NSRect initialFrame;
 @property (readonly) NSRect finalFrame;
+@property (assign) NSArray *savedConstraints;
 
 - (id)initWithWindow:(NSWindow *)window webView:(NSView *)webView page:(WebKit::WebPageProxy&)page;
 

Modified: trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm (203334 => 203335)


--- trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm	2016-07-17 19:12:49 UTC (rev 203334)
+++ trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm	2016-07-17 20:35:20 UTC (rev 203335)
@@ -43,6 +43,7 @@
 #import <WebCore/LocalizedStrings.h>
 #import <WebCore/WebCoreFullScreenPlaceholderView.h>
 #import <WebCore/WebCoreFullScreenWindow.h>
+#import <wtf/BlockObjCExceptions.h>
 
 using namespace WebKit;
 using namespace WebCore;
@@ -152,6 +153,16 @@
     return _webViewPlaceholder.get();
 }
 
+- (void)setSavedConstraints:(NSArray *)savedConstraints
+{
+    _savedConstraints = savedConstraints;
+}
+
+- (NSArray *)savedConstraints
+{
+    return _savedConstraints.get();
+}
+
 #pragma mark -
 #pragma mark NSWindowController overrides
 
@@ -237,6 +248,7 @@
     }
     [_webViewPlaceholder setTarget:nil];
     [_webViewPlaceholder setContents:(id)webViewContents.get()];
+    self.savedConstraints = _webView.superview.constraints;
     [self _replaceView:_webView with:_webViewPlaceholder.get()];
     
     // Then insert the WebView into the full screen window
@@ -299,6 +311,10 @@
 
         NSResponder *firstResponder = [[self window] firstResponder];
         [self _replaceView:_webViewPlaceholder.get() with:_webView];
+        BEGIN_BLOCK_OBJC_EXCEPTIONS
+        [NSLayoutConstraint activateConstraints:self.savedConstraints];
+        END_BLOCK_OBJC_EXCEPTIONS
+        self.savedConstraints = nil;
         makeResponderFirstResponderIfDescendantOfView(_webView.window, firstResponder, _webView);
         [[_webView window] makeKeyAndOrderFront:self];
 
@@ -388,6 +404,10 @@
 
     NSResponder *firstResponder = [[self window] firstResponder];
     [self _replaceView:_webViewPlaceholder.get() with:_webView];
+    BEGIN_BLOCK_OBJC_EXCEPTIONS
+    [NSLayoutConstraint activateConstraints:self.savedConstraints];
+    END_BLOCK_OBJC_EXCEPTIONS
+    self.savedConstraints = nil;
     makeResponderFirstResponderIfDescendantOfView(_webView.window, firstResponder, _webView);
 
     [[_webView window] makeKeyAndOrderFront:self];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to