[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 22:53:00 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit a9ca7497a2793556e01e96d6a604883dc4c05203
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jan 12 23:29:27 2011 +0000

    2011-01-12  Anders Carlsson  <andersca at apple.com>
    
            Reviewed by Sam Weinig.
    
            More work on getting the drawing area proxy to paint
            https://bugs.webkit.org/show_bug.cgi?id=52328
    
            * UIProcess/API/mac/WKView.mm:
            (-[WKView drawRect:]):
            Handle the new drawing area.
    
            * UIProcess/BackingStore.cpp:
            (WebKit::BackingStore::BackingStore):
            Assert that the size isn't empty.
    
            * UIProcess/BackingStore.h:
            * UIProcess/mac/BackingStoreMac.mm:
            (WebKit::BackingStore::incorporateUpdate):
            Paint all update rects into the bitmap context.
    
            * WebProcess/WebPage/DrawingAreaImpl.cpp:
            (WebKit::DrawingAreaImpl::display):
            Create a handle so the shareable bitmap will actually be transferred over.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75647 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 1fd37ad..bbf837a 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,5 +1,29 @@
 2011-01-12  Anders Carlsson  <andersca at apple.com>
 
+        Reviewed by Sam Weinig.
+
+        More work on getting the drawing area proxy to paint
+        https://bugs.webkit.org/show_bug.cgi?id=52328
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView drawRect:]):
+        Handle the new drawing area.
+
+        * UIProcess/BackingStore.cpp:
+        (WebKit::BackingStore::BackingStore):
+        Assert that the size isn't empty.
+        
+        * UIProcess/BackingStore.h:
+        * UIProcess/mac/BackingStoreMac.mm:
+        (WebKit::BackingStore::incorporateUpdate):
+        Paint all update rects into the bitmap context.
+
+        * WebProcess/WebPage/DrawingAreaImpl.cpp:
+        (WebKit::DrawingAreaImpl::display):
+        Create a handle so the shareable bitmap will actually be transferred over.
+
+2011-01-12  Anders Carlsson  <andersca at apple.com>
+
         Fix build.
 
         * UIProcess/DrawingAreaProxyImpl.cpp:
diff --git a/WebKit2/UIProcess/API/mac/WKView.mm b/WebKit2/UIProcess/API/mac/WKView.mm
index 68fedc6..91843e2 100644
--- a/WebKit2/UIProcess/API/mac/WKView.mm
+++ b/WebKit2/UIProcess/API/mac/WKView.mm
@@ -1113,7 +1113,15 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
 - (void)drawRect:(NSRect)rect
 {
     if (useNewDrawingArea()) {
-        // FIXME: Implement.
+        if (DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(_data->_page->drawingArea())) {
+            CGContextRef context = static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]);
+            drawingArea->paint(context, enclosingIntRect(rect));
+        } else if (_data->_page->drawsBackground()) {
+            [_data->_page->drawsTransparentBackground() ? [NSColor clearColor] : [NSColor whiteColor] set];
+            NSRectFill(rect);
+        }
+
+        _data->_page->didDraw();
         return;
     }
 
diff --git a/WebKit2/UIProcess/BackingStore.cpp b/WebKit2/UIProcess/BackingStore.cpp
index 65d9adc..06d66af 100644
--- a/WebKit2/UIProcess/BackingStore.cpp
+++ b/WebKit2/UIProcess/BackingStore.cpp
@@ -41,6 +41,7 @@ PassOwnPtr<BackingStore> BackingStore::create(const IntSize& size)
 BackingStore::BackingStore(const IntSize& size)
     : m_size(size)
 {
+    ASSERT(!m_size.isEmpty());
 }
 
 BackingStore::~BackingStore()
diff --git a/WebKit2/UIProcess/BackingStore.h b/WebKit2/UIProcess/BackingStore.h
index 4d6a49f..5375ac7 100644
--- a/WebKit2/UIProcess/BackingStore.h
+++ b/WebKit2/UIProcess/BackingStore.h
@@ -60,8 +60,6 @@ public:
 private:
     explicit BackingStore(const WebCore::IntSize&);
 
-    void platformInitialize();
-
     WebCore::IntSize m_size;
 
 #if PLATFORM(MAC)
diff --git a/WebKit2/UIProcess/mac/BackingStoreMac.mm b/WebKit2/UIProcess/mac/BackingStoreMac.mm
index 69a9bcc..3bf6403 100644
--- a/WebKit2/UIProcess/mac/BackingStoreMac.mm
+++ b/WebKit2/UIProcess/mac/BackingStoreMac.mm
@@ -25,25 +25,49 @@
 
 #include "BackingStore.h"
 
+#include "ShareableBitmap.h"
+#include "UpdateInfo.h"
+#include <WebCore/GraphicsContext.h>
+
 using namespace WebCore;
 
 namespace WebKit {
 
-void BackingStore::platformInitialize()
-{
-    RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
-
-    m_bitmapContext.adoptCF(CGBitmapContextCreate(0, m_size.width(), m_size.height(), 8, m_size.width() * 4, colorSpace.get(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host));
-}
-
 void BackingStore::paint(PlatformGraphicsContext, const IntRect&)
 {
     // FIXME: Implement.
 }
 
-void BackingStore::incorporateUpdate(const UpdateInfo&)
+void BackingStore::incorporateUpdate(const UpdateInfo& updateInfo)
 {
-    // FIXME: Implement.
+    ASSERT(m_size == updateInfo.viewSize);
+
+    RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(updateInfo.updateRectBounds.size(), updateInfo.bitmapHandle);
+    if (!bitmap)
+        return;
+
+    if (!m_bitmapContext) {
+        RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
+        
+        m_bitmapContext.adoptCF(CGBitmapContextCreate(0, m_size.width(), m_size.height(), 8, m_size.width() * 4, colorSpace.get(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host));
+        
+        // We want the origin to be in the top left corner so flip the backing store context.
+        CGContextTranslateCTM(m_bitmapContext.get(), 0, m_size.height());
+        CGContextScaleCTM(m_bitmapContext.get(), 1, -1);
+    }
+
+    IntPoint updateRectLocation = updateInfo.updateRectBounds.location();
+
+    GraphicsContext graphicsContext(m_bitmapContext.get());
+
+    // Paint all update rects.
+    for (size_t i = 0; i < updateInfo.updateRects.size(); ++i) {
+        IntRect updateRect = updateInfo.updateRects[i];
+        IntRect srcRect = updateRect;
+        srcRect.move(-updateRectLocation.x(), -updateRectLocation.y());
+
+        bitmap->paint(graphicsContext, updateRect.location(), srcRect);
+    }
 }
 
 } // namespace WebKit
diff --git a/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp b/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
index 55df966..a1b1854 100644
--- a/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
+++ b/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
@@ -152,6 +152,8 @@ void DrawingAreaImpl::display(UpdateInfo& updateInfo)
     m_dirtyRegion = Region();
 
     RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(bounds.size());
+    if (!bitmap->createHandle(updateInfo.bitmapHandle))
+        return;
 
     OwnPtr<GraphicsContext> graphicsContext = bitmap->createGraphicsContext();
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list