[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

bfulgham at webkit.org bfulgham at webkit.org
Thu Apr 8 00:58:35 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit b7163d5f637cf6fb8663d126ec20766b01a20468
Author: bfulgham at webkit.org <bfulgham at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jan 8 17:30:33 2010 +0000

    WebCore: WebKit plugins are not rendered during printing.
    https://bugs.webkit.org/show_bug.cgi?id=33022.
    
    Reviewed by Adam Roben.
    
    * plugins/win/PluginViewWin.cpp:
    (WebCore::PluginView::paintWindowedPluginIntoContext): Tell
      cairo printing surface to flush so that blank regions do
      not write over the plugin's paint operations.
    * rendering/RenderLayer.cpp: Build fix.
    (WebCore::RenderLayer::beginTransparencyLayers): Correct
      method signature missing for ColorSpace.
    
    WebKit/win: Use correct cairo surface data type for handling print operations.
    https://bugs.webkit.org/show_bug.cgi?id=33022.
    
    Reviewed by Adam Roben.
    
    * WebFrame.cpp:
    (scaleFactor): Handle 'scale = 0' case.
    (WebFrame::spoolPage): Use scaleFactor helper function.  Account for
     margin size in region passed to header/footer routines.
    (WebFrame::spoolPages): Properly clean up Cairo surface.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52995 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a327d22..eb7a4c3 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-01-08  Brent Fulgham  <bfulgham at webkit.org>
+
+        Reviewed by Adam Roben.
+
+        WebKit plugins are not rendered during printing.
+        https://bugs.webkit.org/show_bug.cgi?id=33022.
+
+        * plugins/win/PluginViewWin.cpp:
+        (WebCore::PluginView::paintWindowedPluginIntoContext): Tell
+          cairo printing surface to flush so that blank regions do
+          not write over the plugin's paint operations.
+        * rendering/RenderLayer.cpp: Build fix.
+        (WebCore::RenderLayer::beginTransparencyLayers): Correct
+          method signature missing for ColorSpace.
+
 2010-01-08  Chris Fleizach  <cfleizach at apple.com>
 
         Reviewed by Eric Seidel.
diff --git a/WebCore/plugins/win/PluginViewWin.cpp b/WebCore/plugins/win/PluginViewWin.cpp
index 87360aa..40a34d8 100644
--- a/WebCore/plugins/win/PluginViewWin.cpp
+++ b/WebCore/plugins/win/PluginViewWin.cpp
@@ -79,6 +79,10 @@
 #define LOG_PLUGIN_NET_ERROR()
 #endif
 
+#if PLATFORM(CAIRO)
+#include <cairo-win32.h>
+#endif
+
 #if PLATFORM(QT)
 #include "QWebPageClient.h"
 #include <QWidget>
@@ -566,6 +570,14 @@ void PluginView::paintWindowedPluginIntoContext(GraphicsContext* context, const
 
     HDC hdc = context->getWindowsContext(frameRect(), false);
 
+#if PLATFORM(CAIRO)
+    // Must flush drawings up to this point to the backing metafile, otherwise the
+    // plugin region will be overwritten with any clear regions specified in the
+    // cairo-controlled portions of the rendering.
+    PlatformGraphicsContext* ctx = context->platformContext();
+    cairo_show_page(ctx);
+#endif
+
     XFORM originalTransform;
     GetWorldTransform(hdc, &originalTransform);
 
diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp
index 0d1eacf..6ea7659 100644
--- a/WebCore/rendering/RenderLayer.cpp
+++ b/WebCore/rendering/RenderLayer.cpp
@@ -826,7 +826,7 @@ void RenderLayer::beginTransparencyLayers(GraphicsContext* p, const RenderLayer*
         p->clip(clipRect);
         p->beginTransparencyLayer(renderer()->opacity());
 #ifdef REVEAL_TRANSPARENCY_LAYERS
-        p->setFillColor(Color(0.0f, 0.0f, 0.5f, 0.2f));
+        p->setFillColor(Color(0.0f, 0.0f, 0.5f, 0.2f), DeviceColorSpace);
         p->fillRect(clipRect);
 #endif
     }
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 70e6496..d0ada00 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,16 @@
+2010-01-08  Brent Fulgham  <bfulgham at webkit.org>
+
+        Reviewed by Adam Roben.
+
+        Use correct cairo surface data type for handling print operations.
+        https://bugs.webkit.org/show_bug.cgi?id=33022.
+
+        * WebFrame.cpp:
+        (scaleFactor): Handle 'scale = 0' case.
+        (WebFrame::spoolPage): Use scaleFactor helper function.  Account for
+         margin size in region passed to header/footer routines.
+        (WebFrame::spoolPages): Properly clean up Cairo surface.
+
 2010-01-07  Kent Tamura  <tkent at chromium.org>
 
         Reviewed by Maciej Stachowiak.
diff --git a/WebKit/win/WebFrame.cpp b/WebKit/win/WebFrame.cpp
index ff40b65..2c8aa03 100644
--- a/WebKit/win/WebFrame.cpp
+++ b/WebKit/win/WebFrame.cpp
@@ -2011,13 +2011,21 @@ static float scaleFactor(HDC printDC, const IntRect& pageRect)
 {
     const IntRect& printRect = printerRect(printDC);
 
-    return static_cast<float>(printRect.width()) / static_cast<float>(pageRect.width());
+    float scale = static_cast<float>(printRect.width()) / static_cast<float>(pageRect.width());
+    if (!scale)
+       scale = 1.0;
+
+    return scale;
 }
 
 static HDC hdcFromContext(PlatformGraphicsContext* pctx)
 {
     cairo_surface_t* surface = cairo_get_target(pctx);
-    return cairo_win32_surface_get_dc(surface);
+    HDC hdc = cairo_win32_surface_get_dc(surface);
+
+    SetGraphicsMode(hdc, GM_ADVANCED);
+
+    return hdc;
 }
 
 void WebFrame::drawHeader(PlatformGraphicsContext* pctx, IWebUIDelegate* ui, const IntRect& pageRect, float headerHeight)
@@ -2048,23 +2056,38 @@ void WebFrame::spoolPage(PlatformGraphicsContext* pctx, GraphicsContext* spoolCt
 {
     Frame* coreFrame = core(this);
 
-    IntRect pageRect = m_pageRects[page];
-    IntRect printRect = printerRect(printDC);
+    const IntRect& pageRect = m_pageRects[page];
+    IntRect marginRect = printerMarginRect(printDC);
 
     cairo_save(pctx);
-    float scale = static_cast<float>(printRect.width()) / static_cast<float>(pageRect.width());
+    float scale = scaleFactor(printDC, pageRect);
     cairo_scale(pctx, scale, scale);
 
-    cairo_translate(pctx, -pageRect.x(), -pageRect.y()+headerHeight);
+    cairo_translate(pctx, -pageRect.x() + marginRect.x(), -pageRect.y() + marginRect.y() + headerHeight);
     coreFrame->view()->paintContents(spoolCtx, pageRect);
 
+    cairo_translate(pctx, pageRect.x() - marginRect.x(), pageRect.y() - marginRect.y() - headerHeight);
+
+    XFORM originalWorld;
+    ::GetWorldTransform(printDC, &originalWorld);
+
+    // Position world transform to account for margin
+    XFORM newWorld = originalWorld;
+    newWorld.eDx = scale * marginRect.x();
+    newWorld.eDy = scale * marginRect.y();
+
+    ::SetWorldTransform(printDC, &newWorld);
+
     if (headerHeight)
         drawHeader(pctx, ui, pageRect, headerHeight);
     
     if (footerHeight)
         drawFooter(pctx, ui, pageRect, page, pageCount, headerHeight, footerHeight);
 
+    ::SetWorldTransform(printDC, &originalWorld);
+
     cairo_show_page(pctx);
+    ASSERT(!cairo_status(pctx));
     cairo_restore(pctx);
 }
 #endif
@@ -2132,6 +2155,8 @@ HRESULT STDMETHODCALLTYPE WebFrame::spoolPages(
 
 #if PLATFORM(CAIRO)
     cairo_destroy(pctx);
+    cairo_surface_finish(printSurface);
+    ASSERT(!cairo_surface_status(printSurface));
     cairo_surface_destroy(printSurface);
 #endif
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list