[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

andersca at apple.com andersca at apple.com
Sun Feb 20 23:44:14 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 6c85ea429e1013246bd5ecaf4446c46a3df392eb
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jan 24 19:11:58 2011 +0000

    2011-01-24  Anders Carlsson  <andersca at apple.com>
    
            Reviewed by Sam Weinig.
    
            Fill unpainted rects with the background color.
            https://bugs.webkit.org/show_bug.cgi?id=53025
    
            * UIProcess/API/mac/WKView.mm:
            (drawPageBackground):
            Add new helper function.
    
            (-[WKView drawRect:]):
            Iterate over the unpainted rects and fill them with the background color.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76533 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index f1d02db..a106644 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,17 @@
+2011-01-24  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Fill unpainted rects with the background color.
+        https://bugs.webkit.org/show_bug.cgi?id=53025
+
+        * UIProcess/API/mac/WKView.mm:
+        (drawPageBackground):
+        Add new helper function.
+
+        (-[WKView drawRect:]):
+        Iterate over the unpainted rects and fill them with the background color.
+
 2011-01-24  Dan Bernstein  <mitz at apple.com>
 
         Reviewed by John Sullivan.
diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm
index cc2ec92..4277a90 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKView.mm
+++ b/Source/WebKit2/UIProcess/API/mac/WKView.mm
@@ -1224,14 +1224,34 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
     [self _updateWindowAndViewFrames];
 }
 
+static void drawPageBackground(CGContextRef context, WebPageProxy* page, const IntRect& rect)
+{
+    if (!page->drawsBackground())
+        return;
+
+    CGContextSaveGState(context);
+    CGContextSetBlendMode(context, kCGBlendModeCopy);
+
+    CGColorRef backgroundColor;
+    if (page->drawsTransparentBackground())
+        backgroundColor = CGColorGetConstantColor(kCGColorClear);
+    else
+        backgroundColor = CGColorGetConstantColor(kCGColorWhite);
+
+    CGContextSetFillColorWithColor(context, backgroundColor);
+    CGContextFillRect(context, rect);
+
+    CGContextRestoreGState(context);
+}
+
 - (void)drawRect:(NSRect)rect
 {
     LOG(View, "drawRect: x:%g, y:%g, width:%g, height:%g", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
     _data->_page->endPrinting();
     if (useNewDrawingArea()) {
-        if (DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(_data->_page->drawingArea())) {
-            CGContextRef context = static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]);
+        CGContextRef context = static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]);
 
+        if (DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(_data->_page->drawingArea())) {
             const NSRect *rectsBeingDrawn;
             NSInteger numRectsBeingDrawn;
             [self getRectsBeingDrawn:&rectsBeingDrawn count:&numRectsBeingDrawn];
@@ -1239,11 +1259,13 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
                 Region unpaintedRegion;
                 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]);
             }
-        } else if (_data->_page->drawsBackground()) {
-            [_data->_page->drawsTransparentBackground() ? [NSColor clearColor] : [NSColor whiteColor] set];
-            NSRectFill(rect);
-        }
+        } else 
+            drawPageBackground(context, _data->_page.get(), enclosingIntRect(rect));
 
         _data->_page->didDraw();
         return;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list