[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

mrobinson at webkit.org mrobinson at webkit.org
Wed Dec 22 11:35:41 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 38adf0c21df5bc74297106b9776a52ed1b459646
Author: mrobinson at webkit.org <mrobinson at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jul 30 06:13:10 2010 +0000

    2010-07-29  Sheriff Bot  <webkit.review.bot at gmail.com>
    
            Unreviewed, rolling out r64313.
            http://trac.webkit.org/changeset/64313
            https://bugs.webkit.org/show_bug.cgi?id=43233
    
            Some Chromium bots are not happy with it for some unknown
            reason. (Requested by dumi on #webkit).
    
            * bindings/js/JSCustomVoidCallback.cpp:
            (WebCore::JSCustomVoidCallback::~JSCustomVoidCallback):
            * bindings/scripts/CodeGeneratorJS.pm:
            * bindings/scripts/test/JS/JSTestCallback.cpp:
            (WebCore::JSTestCallback::~JSTestCallback):
            * platform/sql/SQLiteDatabase.cpp:
            (WebCore::SQLiteDatabase::SQLiteDatabase):
            (WebCore::SQLiteDatabase::close):
            (WebCore::SQLiteDatabase::lock):
            (WebCore::SQLiteDatabase::unlock):
            * platform/sql/SQLiteDatabase.h:
            * platform/sql/SQLiteStatement.cpp:
            (WebCore::SQLiteStatement::prepare):
            (WebCore::SQLiteStatement::step):
            * storage/AbstractDatabase.cpp:
            * storage/AbstractDatabase.h:
            * storage/DatabaseTracker.cpp:
            * storage/DatabaseTracker.h:
            * storage/SQLStatement.cpp:
            (WebCore::SQLStatement::execute):
            * storage/SQLStatementSync.cpp:
            (WebCore::SQLStatementSync::execute):
            * storage/SQLTransaction.cpp:
            (WebCore::SQLTransaction::checkAndHandleClosedDatabase):
            (WebCore::SQLTransaction::performNextStep):
            (WebCore::SQLTransaction::performPendingCallback):
            (WebCore::SQLTransaction::deliverTransactionCallback):
            (WebCore::SQLTransaction::postflightAndCommit):
            (WebCore::SQLTransaction::deliverTransactionErrorCallback):
            (WebCore::SQLTransaction::cleanupAfterTransactionErrorCallback):
            * storage/SQLTransaction.h:
            * storage/chromium/DatabaseTrackerChromium.cpp:
            * workers/WorkerThread.cpp:
            (WebCore::WorkerThread::stop):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64335 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 2491cda..12a0056 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -108,6 +108,51 @@
 
         Reviewed by Dirk Schulze.
 
+        [Cairo] Bring behavior of paths on the Cairo GraphicsContext into line with the CoreGraphics port
+        https://bugs.webkit.org/show_bug.cgi?id=41732
+
+        Do not apply paths added to the Cairo GraphicsContext, until they are used.
+        This prevents drawing routines such as fillRect from interacting with any
+        path which callers are constructing on the GraphicsContext.
+
+         This behavior is necessary to close bug https://bugs.webkit.org/show_bug.cgi?id=41308
+         so tests for that issue will test this fix.
+
+        * platform/graphics/cairo/GraphicsContextCairo.cpp:
+        (WebCore::appendPathToCairoContext): Added. A helper method which adds a path
+        to a native Cairo context.
+        (WebCore::setPathOnCairoContext): Added. Like appendPathToCairoContext, but clears the
+        existing path first.
+        (WebCore::appendWebCorePathToCairoContext): Added. Like appendPathToCairoContext, but
+        operates on a WebCore path.
+        (WebCore::fillCurrentCairoPath): Added. Helper which fills the current cairo context path.
+        (WebCore::strokeCurrentCairoPath): Added. Helper which strokes the current cairo context path.
+        (WebCore::GraphicsContext::drawEllipse): Only clear the Cairo path if cairo_stroke
+        was not called, because cairo_stroke implicitly clears the path.
+        (WebCore::GraphicsContext::drawConvexPolygon): Ditto.
+        (WebCore::GraphicsContext::fillPath): Copy the path from m_pendingPath to the context
+        and clear m_pendingPath, instead of relying on the pre-existing context path. Do the
+        actual fill via the new helper.
+        (WebCore::GraphicsContext::strokePath): Ditto.
+        (WebCore::GraphicsContext::drawPath): Ditto.
+        (WebCore::GraphicsContext::fillRect): Use the new fillCurrentCairoPath helper.
+        (WebCore::GraphicsContext::drawFocusRing): Use the new appendWebCorePathToCairoContext helper instead
+        of addPath (which will blow away any path callers are building).
+        (WebCore::GraphicsContext::addInnerRoundedRectClip): Use the new appendWebCorePathToCairoContext helper instead
+        of addPath (which will blow away any path callers are building).
+        (WebCore::GraphicsContext::strokeRect): Use the new strokeCurrentCairoPath helper.
+        (WebCore::GraphicsContext::beginPath): Clear out m_pendingPath here instead of the main native context.
+        (WebCore::GraphicsContext::addPath): Add the path to m_pendingPath instead of the main native context.
+        Also ensure that the transformation matrix of the m_pendingPath is equal to that of the main
+        cairo context.
+        (WebCore::GraphicsContext::clipOut): Use the appendWebCorePathToCairoContext helper here.
+        (WebCore::GraphicsContext::fillRoundedRect): Ditto and remove an unnecessary beginPath call.
+        * platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h: Add a new m_pendingPath member.
+
+2010-07-29  Martin Robinson  <mrobinson at igalia.com>
+
+        Reviewed by Dirk Schulze.
+
         [Cairo] Remove setStrokeStyle workaround for InlineTextBoxes
         https://bugs.webkit.org/show_bug.cgi?id=43136
 
diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
index 79431f0..ca468ad 100644
--- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
+++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
@@ -4,6 +4,7 @@
  * Copyright (C) 2008, 2009 Dirk Schulze <krit at webkit.org>
  * Copyright (C) 2008 Nuanti Ltd.
  * Copyright (C) 2009 Brent Fulgham <bfulgham at webkit.org>
+ * Copyright (C) 2010 Igalia S.L.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -143,6 +144,27 @@ static inline void copyContextProperties(cairo_t* srcCr, cairo_t* dstCr)
     cairo_set_fill_rule(dstCr, cairo_get_fill_rule(srcCr));
 }
 
+static void appendPathToCairoContext(cairo_t* to, cairo_t* from)
+{
+    cairo_path_t* cairoPath = cairo_copy_path(from);
+    cairo_append_path(to, cairoPath);
+    cairo_path_destroy(cairoPath);
+}
+
+// We apply the pending path built via addPath to the Cairo context
+// lazily. This prevents interaction between the path and other routines
+// such as fillRect.
+static void setPathOnCairoContext(cairo_t* to, cairo_t* from)
+{
+    cairo_new_path(to);
+    appendPathToCairoContext(to, from);
+}
+
+static void appendWebCorePathToCairoContext(cairo_t* context, const Path& path)
+{
+    appendPathToCairoContext(context, path.platformPath()->m_cr);
+}
+
 void GraphicsContext::calculateShadowBufferDimensions(IntSize& shadowBufferSize, FloatRect& shadowRect, float& kernelSize, const FloatRect& sourceRect, const FloatSize& shadowSize, float shadowBlur)
 {
 #if ENABLE(FILTERS)
@@ -201,6 +223,22 @@ static inline void drawPathShadow(GraphicsContext* context, GraphicsContextPriva
 #endif
 }
 
+static void fillCurrentCairoPath(GraphicsContext* context, GraphicsContextPrivate* gcp, cairo_t* cairoContext)
+{
+    cairo_set_fill_rule(cairoContext, context->fillRule() == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING);
+    drawPathShadow(context, gcp, true, false);
+
+    setPlatformFill(context, cairoContext, gcp);
+    cairo_new_path(cairoContext);
+}
+
+static void strokeCurrentCairoPath(GraphicsContext* context, GraphicsContextPrivate* gcp, cairo_t* cairoContext)
+{
+    drawPathShadow(context, gcp, false, true);
+    setPlatformStroke(context, cairoContext, gcp);
+    cairo_new_path(cairoContext);
+}
+
 GraphicsContext::GraphicsContext(PlatformGraphicsContext* cr)
     : m_common(createGraphicsContextPrivate())
     , m_data(new GraphicsContextPlatformPrivate)
@@ -380,9 +418,8 @@ void GraphicsContext::drawEllipse(const IntRect& rect)
         setColor(cr, strokeColor());
         cairo_set_line_width(cr, strokeThickness());
         cairo_stroke(cr);
-    }
-
-    cairo_new_path(cr);
+    } else
+        cairo_new_path(cr);
 }
 
 void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSpan)
@@ -498,9 +535,9 @@ void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points
         setColor(cr, strokeColor());
         cairo_set_line_width(cr, strokeThickness());
         cairo_stroke(cr);
-    }
+    } else
+        cairo_new_path(cr);
 
-    cairo_new_path(cr);
     cairo_restore(cr);
 }
 
@@ -522,11 +559,8 @@ void GraphicsContext::fillPath()
 
     cairo_t* cr = m_data->cr;
 
-    cairo_set_fill_rule(cr, fillRule() == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING);
-    drawPathShadow(this, m_common, true, false);
-
-    setPlatformFill(this, cr, m_common);
-    cairo_new_path(cr);
+    setPathOnCairoContext(cr, m_data->m_pendingPath.m_cr);
+    fillCurrentCairoPath(this, m_common, cr);
 }
 
 void GraphicsContext::strokePath()
@@ -535,11 +569,8 @@ void GraphicsContext::strokePath()
         return;
 
     cairo_t* cr = m_data->cr;
-    drawPathShadow(this, m_common, false, true);
-
-    setPlatformStroke(this, cr, m_common);
-    cairo_new_path(cr);
-
+    setPathOnCairoContext(cr, m_data->m_pendingPath.m_cr);
+    strokeCurrentCairoPath(this, m_common, cr);
 }
 
 void GraphicsContext::drawPath()
@@ -549,6 +580,8 @@ void GraphicsContext::drawPath()
 
     cairo_t* cr = m_data->cr;
 
+    setPathOnCairoContext(cr, m_data->m_pendingPath.m_cr);
+
     cairo_set_fill_rule(cr, fillRule() == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING);
     drawPathShadow(this, m_common, true, true);
 
@@ -565,7 +598,7 @@ void GraphicsContext::fillRect(const FloatRect& rect)
     cairo_t* cr = m_data->cr;
     cairo_save(cr);
     cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());
-    fillPath();
+    fillCurrentCairoPath(this, m_common, cr);
     cairo_restore(cr);
 }
 
@@ -673,7 +706,7 @@ void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int
 #else
     int radius = (width - 1) / 2;
     for (unsigned i = 0; i < rectCount; i++)
-        addPath(Path::createRoundedRectangle(rects[i], FloatSize(radius, radius)));
+        appendWebCorePathToCairoContext(cr, Path::createRoundedRectangle(rects[i], FloatSize(radius, radius)));
 
     // Force the alpha to 50%.  This matches what the Mac does with outline rings.
     Color ringColor(color.red(), color.green(), color.blue(), 127);
@@ -840,6 +873,7 @@ void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness
     if (paintingDisabled())
         return;
 
+    cairo_t* cr = m_data->cr;
     clip(rect);
 
     Path p;
@@ -849,9 +883,8 @@ void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness
     // Add inner ellipse
     r.inflate(-thickness);
     p.addEllipse(r);
-    addPath(p);
+    appendWebCorePathToCairoContext(cr, p);
 
-    cairo_t* cr = m_data->cr;
     cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr);
     cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
     cairo_clip(cr);
@@ -962,7 +995,7 @@ void GraphicsContext::strokeRect(const FloatRect& rect, float width)
     cairo_save(cr);
     cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());
     cairo_set_line_width(cr, width);
-    strokePath();
+    strokeCurrentCairoPath(this, m_common, cr);
     cairo_restore(cr);
 }
 
@@ -1079,8 +1112,7 @@ void GraphicsContext::beginPath()
     if (paintingDisabled())
         return;
 
-    cairo_t* cr = m_data->cr;
-    cairo_new_path(cr);
+    cairo_new_path(m_data->m_pendingPath.m_cr);
 }
 
 void GraphicsContext::addPath(const Path& path)
@@ -1088,10 +1120,10 @@ void GraphicsContext::addPath(const Path& path)
     if (paintingDisabled())
         return;
 
-    cairo_t* cr = m_data->cr;
-    cairo_path_t* p = cairo_copy_path(path.platformPath()->m_cr);
-    cairo_append_path(cr, p);
-    cairo_path_destroy(p);
+    cairo_matrix_t currentMatrix;
+    cairo_get_matrix(m_data->cr, &currentMatrix);
+    cairo_set_matrix(m_data->m_pendingPath.m_cr, &currentMatrix);
+    appendWebCorePathToCairoContext(m_data->m_pendingPath.m_cr, path);
 }
 
 void GraphicsContext::clip(const Path& path)
@@ -1124,7 +1156,7 @@ void GraphicsContext::clipOut(const Path& path)
     double x1, y1, x2, y2;
     cairo_clip_extents(cr, &x1, &y1, &x2, &y2);
     cairo_rectangle(cr, x1, y1, x2 - x1, y2 - y1);
-    addPath(path);
+    appendWebCorePathToCairoContext(cr, path);
 
     cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr);
     cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
@@ -1183,8 +1215,7 @@ void GraphicsContext::fillRoundedRect(const IntRect& r, const IntSize& topLeft,
 
     cairo_t* cr = m_data->cr;
     cairo_save(cr);
-    beginPath();
-    addPath(Path::createRoundedRectangle(r, topLeft, topRight, bottomLeft, bottomRight));
+    appendWebCorePathToCairoContext(cr, Path::createRoundedRectangle(r, topLeft, topRight, bottomLeft, bottomRight));
     setColor(cr, color);
     drawPathShadow(this, m_common, true, false);
     cairo_fill(cr);
diff --git a/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h b/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h
index 5e38832..97e7e07 100644
--- a/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h
+++ b/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h
@@ -95,6 +95,7 @@ public:
 
     cairo_t* cr;
     Vector<float> layers;
+    CairoPath m_pendingPath;
 
 #if PLATFORM(GTK)
     GdkEventExpose* expose;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list