REGRESSION (r104727): Strange graphics corruption opening a new tab in Safari
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Feb 2012 23:54:54 +0000 (23:54 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Feb 2012 23:54:54 +0000 (23:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=77578
<rdar://problem/10767174>

Reviewed by Dan Bernstein.

Resizing a window will always invalidate the window backing store, so make sure to set
_data->_windowHasValidBackingStore to NO whenever that happens.

* UIProcess/API/mac/WKView.mm:
(-[WKView addWindowObserversForWindow:]):
Use separate methods for the NSWindowDidMoveNotification and NSWindowDidResizeNotification notifications.

(-[WKView _windowDidMove:]):
Call -[WKView _updateWindowAndViewFrames].

(-[WKView _windowDidResize:]):
Call -[WKView _updateWindowAndViewFrames] and mark the window backing store as invalid.

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/mac/WKView.mm

index 2887506..9334442 100644 (file)
@@ -1,3 +1,24 @@
+2012-02-01  Anders Carlsson  <andersca@apple.com>
+
+        REGRESSION (r104727): Strange graphics corruption opening a new tab in Safari
+        https://bugs.webkit.org/show_bug.cgi?id=77578
+        <rdar://problem/10767174>
+
+        Reviewed by Dan Bernstein.
+
+        Resizing a window will always invalidate the window backing store, so make sure to set
+        _data->_windowHasValidBackingStore to NO whenever that happens.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView addWindowObserversForWindow:]):
+        Use separate methods for the NSWindowDidMoveNotification and NSWindowDidResizeNotification notifications.
+
+        (-[WKView _windowDidMove:]):
+        Call -[WKView _updateWindowAndViewFrames].
+
+        (-[WKView _windowDidResize:]):
+        Call -[WKView _updateWindowAndViewFrames] and mark the window backing store as invalid.
+
 2012-02-01  Beth Dakin  <bdakin@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=77383
index d8f0854..7d21e9b 100644 (file)
@@ -1776,9 +1776,9 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
                                                      name:NSWindowDidMiniaturizeNotification object:window];
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidDeminiaturize:)
                                                      name:NSWindowDidDeminiaturizeNotification object:window];
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowFrameDidChange:)
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidMove:)
                                                      name:NSWindowDidMoveNotification object:window];
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowFrameDidChange:) 
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidResize:) 
                                                      name:NSWindowDidResizeNotification object:window];
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidOrderOffScreen:) 
                                                      name:@"NSWindowDidOrderOffScreenNotification" object:window];
@@ -1906,8 +1906,15 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
     [self _updateWindowVisibility];
 }
 
-- (void)_windowFrameDidChange:(NSNotification *)notification
+- (void)_windowDidMove:(NSNotification *)notification
 {
+    [self _updateWindowAndViewFrames];    
+}
+
+- (void)_windowDidResize:(NSNotification *)notification
+{
+    _data->_windowHasValidBackingStore = NO;
+
     [self _updateWindowAndViewFrames];
 }