Title: [105175] branches/safari-534.54-branch/Source/WebKit2
Revision
105175
Author
[email protected]
Date
2012-01-17 11:13:40 -0800 (Tue, 17 Jan 2012)

Log Message

Merge r104727.

Modified Paths

Diff

Modified: branches/safari-534.54-branch/Source/WebKit2/ChangeLog (105174 => 105175)


--- branches/safari-534.54-branch/Source/WebKit2/ChangeLog	2012-01-17 19:10:16 UTC (rev 105174)
+++ branches/safari-534.54-branch/Source/WebKit2/ChangeLog	2012-01-17 19:13:40 UTC (rev 105175)
@@ -1,3 +1,34 @@
+2012-01-17  Mark Rowe  <[email protected]>
+
+        Merge r104727.
+
+    2012-01-11  Anders Carlsson  <[email protected]>
+
+        Webpages flash white when switching between windows
+        https://bugs.webkit.org/show_bug.cgi?id=76080
+        <rdar://problem/9893565>
+
+        Reviewed by Dan Bernstein.
+
+        Introduce a _windowHasValidBackingStore boolean and only paint the background (white or clear)
+        if it's false.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView setFrameSize:]):
+        Set _windowHasValidBackingStore to false if the new size is different from the old size.
+
+        (-[WKView viewDidMoveToWindow]):
+        Set _windowHasValidBackingStore to false.
+
+        (-[WKView _windowDidMiniaturize:]):
+        Set _windowHasValidBackingStore to false.
+
+        (-[WKView _windowDidChangeBackingProperties:]):
+        Set _windowHasValidBackingStore to false.
+
+        (-[WKView drawRect:]):
+        Only call drawPageBackground if _windowHasValidBackingStore is false. Set it to true after painting.
+
 2012-01-17  Anders Carlsson  <[email protected]>
 
         <rdar://problem/10516690> REGRESSION: Incomplete repaint on Flash element after pinch to zoom

Modified: branches/safari-534.54-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm (105174 => 105175)


--- branches/safari-534.54-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm	2012-01-17 19:10:16 UTC (rev 105174)
+++ branches/safari-534.54-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm	2012-01-17 19:13:40 UTC (rev 105175)
@@ -165,7 +165,14 @@
     BOOL _inSecureInputState;
 
     NSRect _windowBottomCornerIntersectionRect;
+
+    // Whether the containing window of the WKView has a valid backing store.
+    // The window server invalidates the backing store whenever the window is resized or minimized.
+    // We use this flag to determine when we need to paint the background (white or clear)
+    // when the web process is unresponsive or takes too long to paint.
+    BOOL _windowHasValidBackingStore;
 }
+
 @end
 
 @interface WKResponderChainSink : NSResponder {
@@ -367,6 +374,9 @@
 
 - (void)setFrameSize:(NSSize)size
 {
+    if (!NSEqualSizes(size, [self frame].size))
+        _data->_windowHasValidBackingStore = NO;
+
     [super setFrameSize:size];
     
     if (![self frameSizeUpdatesDisabled])
@@ -1777,6 +1787,7 @@
     // update the active state first and then make it visible. If the view is about to be hidden, we hide it first and then
     // update the active state.
     if ([self window]) {
+        _data->_windowHasValidBackingStore = NO;
         _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive);
         _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible | WebPageProxy::ViewIsInWindow);
         [self _updateWindowVisibility];
@@ -1827,6 +1838,8 @@
 
 - (void)_windowDidMiniaturize:(NSNotification *)notification
 {
+    _data->_windowHasValidBackingStore = NO;
+
     [self _updateWindowVisibility];
 }
 
@@ -1857,6 +1870,7 @@
     if (oldBackingScaleFactor == newBackingScaleFactor) 
         return; 
 
+    _data->_windowHasValidBackingStore = NO;
     _data->_page->setIntrinsicDeviceScaleFactor(newBackingScaleFactor);
 }
 
@@ -1895,9 +1909,15 @@
             IntRect rect = enclosingIntRect(rectsBeingDrawn[i]);
             drawingArea->paint(context, rect, unpaintedRegion);
 
-            Vector<IntRect> unpaintedRects = unpaintedRegion.rects();
-            for (size_t i = 0; i < unpaintedRects.size(); ++i)
-                drawPageBackground(context, _data->_page.get(), unpaintedRects[i]);
+            // If the window doesn't have a valid backing store, we need to fill the parts of the page that we
+            // didn't paint with the background color (white or clear), to avoid garbage in those areas.
+            if (!_data->_windowHasValidBackingStore) {
+                Vector<IntRect> unpaintedRects = unpaintedRegion.rects();
+                for (size_t i = 0; i < unpaintedRects.size(); ++i)
+                    drawPageBackground(context, _data->_page.get(), unpaintedRects[i]);
+
+                _data->_windowHasValidBackingStore = YES;
+            }
         }
     } else 
         drawPageBackground(context, _data->_page.get(), enclosingIntRect(rect));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to