[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.16-1409-g5afdf4d

darin at apple.com darin at apple.com
Thu Dec 3 13:39:49 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit ded050e9a6afdec81698e6e3bf61921e1cb0d035
Author: darin at apple.com <darin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Nov 19 02:07:23 2009 +0000

    Get rid of the redundant strokeType and fillType data members on
    a GraphicsContext as well as the FillOrStrokeType enum. Use
    null pointers instead.
    
    Reviewed by Sam Weinig.
    
    * platform/graphics/GraphicsContext.cpp:
    (WebCore::GraphicsContext::setStrokeColor): Null out the pattern
    and gradient.
    (WebCore::GraphicsContext::setFillColor): Ditto.
    (WebCore::GraphicsContext::setStrokePattern): Null out the graident.
    (WebCore::GraphicsContext::setFillPattern): Ditto.
    (WebCore::GraphicsContext::setStrokeGradient): Null out the pattern.
    (WebCore::GraphicsContext::setFillGradient): Ditto.
    
    * platform/graphics/GraphicsContextPrivate.h: Remove all that stuff.
    
    * platform/graphics/cairo/GraphicsContextCairo.cpp:
    (WebCore::setPlatformFill): Use null checks on fillPattern and
    fillGraident instead of a switch statement.
    (WebCore::setPlatformStroke): Ditto.
    
    * platform/graphics/cg/GraphicsContextCG.cpp:
    (WebCore::GraphicsContext::applyStrokePattern): Removed unneeded get.
    (WebCore::GraphicsContext::applyFillPattern): Ditto.
    (WebCore::calculateDrawingMode): Use fillPattern and strokePattern
    to see if there is a pattern instead of fillType and strokeType.
    (WebCore::GraphicsContext::drawPath): Use fillGradient, strokeGradient,
    fillPattern, and strokePattern instead of fillType and strokeType.
    (WebCore::GraphicsContext::fillPath): Added FIXME about color space that
    is used in the pattern and gradient case probably erroneously. Moved
    gradient code inside an if statement. Streamlined pattern code and
    use an if statement. No switch any more.
    (WebCore::GraphicsContext::strokePath): Ditto.
    (WebCore::GraphicsContext::fillRect): Ditto.
    (WebCore::GraphicsContext::strokeRect): Ditto.
    
    * platform/graphics/qt/GraphicsContextQt.cpp:
    (WebCore::GraphicsContext::fillPath): Use null checks on fillPattern and
    fillGraident instead of a switch statement.
    (WebCore::GraphicsContext::strokePath): Ditto.
    (WebCore::GraphicsContext::fillRect): Ditto.
    
    * platform/graphics/wince/GraphicsContextWince.cpp:
    (WebCore::GraphicsContext::fillPath): Removed unneeded check of fillType.
    (WebCore::GraphicsContext::fillRect): Ditto.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51161 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 84b6200..5ecac83 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,52 @@
+2009-11-18  Darin Adler  <darin at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Get rid of the redundant strokeType and fillType data members on
+        a GraphicsContext as well as the FillOrStrokeType enum. Use
+        null pointers instead.
+
+        * platform/graphics/GraphicsContext.cpp:
+        (WebCore::GraphicsContext::setStrokeColor): Null out the pattern
+        and gradient.
+        (WebCore::GraphicsContext::setFillColor): Ditto.
+        (WebCore::GraphicsContext::setStrokePattern): Null out the graident.
+        (WebCore::GraphicsContext::setFillPattern): Ditto.
+        (WebCore::GraphicsContext::setStrokeGradient): Null out the pattern.
+        (WebCore::GraphicsContext::setFillGradient): Ditto.
+
+        * platform/graphics/GraphicsContextPrivate.h: Remove all that stuff.
+
+        * platform/graphics/cairo/GraphicsContextCairo.cpp:
+        (WebCore::setPlatformFill): Use null checks on fillPattern and
+        fillGraident instead of a switch statement.
+        (WebCore::setPlatformStroke): Ditto.
+
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::GraphicsContext::applyStrokePattern): Removed unneeded get.
+        (WebCore::GraphicsContext::applyFillPattern): Ditto.
+        (WebCore::calculateDrawingMode): Use fillPattern and strokePattern
+        to see if there is a pattern instead of fillType and strokeType.
+        (WebCore::GraphicsContext::drawPath): Use fillGradient, strokeGradient,
+        fillPattern, and strokePattern instead of fillType and strokeType.
+        (WebCore::GraphicsContext::fillPath): Added FIXME about color space that
+        is used in the pattern and gradient case probably erroneously. Moved
+        gradient code inside an if statement. Streamlined pattern code and
+        use an if statement. No switch any more.
+        (WebCore::GraphicsContext::strokePath): Ditto.
+        (WebCore::GraphicsContext::fillRect): Ditto.
+        (WebCore::GraphicsContext::strokeRect): Ditto.
+
+        * platform/graphics/qt/GraphicsContextQt.cpp:
+        (WebCore::GraphicsContext::fillPath): Use null checks on fillPattern and
+        fillGraident instead of a switch statement.
+        (WebCore::GraphicsContext::strokePath): Ditto.
+        (WebCore::GraphicsContext::fillRect): Ditto.
+
+        * platform/graphics/wince/GraphicsContextWince.cpp:
+        (WebCore::GraphicsContext::fillPath): Removed unneeded check of fillType.
+        (WebCore::GraphicsContext::fillRect): Ditto.
+
 2009-11-18  Kent Tamura  <tkent at chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/platform/graphics/GraphicsContext.cpp b/WebCore/platform/graphics/GraphicsContext.cpp
index bf4600e..bc4bf88 100644
--- a/WebCore/platform/graphics/GraphicsContext.cpp
+++ b/WebCore/platform/graphics/GraphicsContext.cpp
@@ -122,9 +122,10 @@ void GraphicsContext::setStrokeStyle(const StrokeStyle& style)
 
 void GraphicsContext::setStrokeColor(const Color& color, ColorSpace colorSpace)
 {
-    m_common->state.strokeType = SolidColorType;
     m_common->state.strokeColor = color;
     m_common->state.strokeColorSpace = colorSpace;
+    m_common->state.strokeGradient.clear();
+    m_common->state.strokePattern.clear();
     setPlatformStrokeColor(color, colorSpace);
 }
 
@@ -185,9 +186,10 @@ void GraphicsContext::setFillRule(WindRule fillRule)
 
 void GraphicsContext::setFillColor(const Color& color, ColorSpace colorSpace)
 {
-    m_common->state.fillType = SolidColorType;
     m_common->state.fillColor = color;
     m_common->state.fillColorSpace = colorSpace;
+    m_common->state.fillGradient.clear();
+    m_common->state.fillPattern.clear();
     setPlatformFillColor(color, colorSpace);
 }
 
@@ -219,7 +221,7 @@ void GraphicsContext::setStrokePattern(PassRefPtr<Pattern> pattern)
         setStrokeColor(Color::black, DeviceColorSpace);
         return;
     }
-    m_common->state.strokeType = PatternType;
+    m_common->state.strokeGradient.clear();
     m_common->state.strokePattern = pattern;
     setPlatformStrokePattern(m_common->state.strokePattern.get());
 }
@@ -231,7 +233,7 @@ void GraphicsContext::setFillPattern(PassRefPtr<Pattern> pattern)
         setFillColor(Color::black, DeviceColorSpace);
         return;
     }
-    m_common->state.fillType = PatternType;
+    m_common->state.fillGradient.clear();
     m_common->state.fillPattern = pattern;
     setPlatformFillPattern(m_common->state.fillPattern.get());
 }
@@ -243,8 +245,8 @@ void GraphicsContext::setStrokeGradient(PassRefPtr<Gradient> gradient)
         setStrokeColor(Color::black, DeviceColorSpace);
         return;
     }
-    m_common->state.strokeType = GradientType;
     m_common->state.strokeGradient = gradient;
+    m_common->state.strokePattern.clear();
     setPlatformStrokeGradient(m_common->state.strokeGradient.get());
 }
 
@@ -255,8 +257,8 @@ void GraphicsContext::setFillGradient(PassRefPtr<Gradient> gradient)
         setFillColor(Color::black, DeviceColorSpace);
         return;
     }
-    m_common->state.fillType = GradientType;
     m_common->state.fillGradient = gradient;
+    m_common->state.fillPattern.clear();
     setPlatformFillGradient(m_common->state.fillGradient.get());
 }
 
diff --git a/WebCore/platform/graphics/GraphicsContextPrivate.h b/WebCore/platform/graphics/GraphicsContextPrivate.h
index 6ad49ab..c532162 100644
--- a/WebCore/platform/graphics/GraphicsContextPrivate.h
+++ b/WebCore/platform/graphics/GraphicsContextPrivate.h
@@ -33,18 +33,14 @@
 
 namespace WebCore {
 
-    enum FillOrStrokeType { SolidColorType, PatternType, GradientType };
-
     struct GraphicsContextState {
         GraphicsContextState()
             : textDrawingMode(cTextFill)
             , strokeStyle(SolidStroke)
             , strokeThickness(0)
-            , strokeType(SolidColorType)
             , strokeColor(Color::black)
             , strokeColorSpace(DeviceColorSpace)
             , fillRule(RULE_NONZERO)
-            , fillType(SolidColorType)
             , fillColor(Color::black)
             , fillColorSpace(DeviceColorSpace)
             , shouldAntialias(true)
@@ -61,14 +57,12 @@ namespace WebCore {
         
         StrokeStyle strokeStyle;
         float strokeThickness;
-        FillOrStrokeType strokeType;
         Color strokeColor;
         ColorSpace strokeColorSpace;
         RefPtr<Gradient> strokeGradient;
         RefPtr<Pattern> strokePattern;
         
         WindRule fillRule;
-        FillOrStrokeType fillType;
         Color fillColor;
         ColorSpace fillColorSpace;
         RefPtr<Gradient> fillGradient;
diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
index cd7dc52..3f280d7 100644
--- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
+++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
@@ -76,48 +76,31 @@ static inline void setColor(cairo_t* cr, const Color& col)
 static inline void setPlatformFill(GraphicsContext* context, cairo_t* cr, GraphicsContextPrivate* gcp)
 {
     cairo_save(cr);
-    switch (gcp->state.fillType) {
-    case SolidColorType: {
-        setColor(cr, context->fillColor());
-        cairo_clip_preserve(cr);
-        cairo_paint_with_alpha(cr, gcp->state.globalAlpha);
-        break;
-    }
-    case PatternType: {
+    if (gcp->state.fillPattern) {
         TransformationMatrix affine;
         cairo_set_source(cr, gcp->state.fillPattern->createPlatformPattern(affine));
-        cairo_clip_preserve(cr);
-        cairo_paint_with_alpha(cr, gcp->state.globalAlpha);
-        break;
-    }
-    case GradientType:
+    } else if (gcp->state.fillGradient)
         cairo_set_source(cr, gcp->state.fillGradient->platformGradient());
-        cairo_clip_preserve(cr);
-        cairo_paint_with_alpha(cr, gcp->state.globalAlpha);
-        break;
-    }
+    else
+        setColor(cr, context->fillColor());
+    cairo_clip_preserve(cr);
+    cairo_paint_with_alpha(cr, gcp->state.globalAlpha);
     cairo_restore(cr);
 }
 
 static inline void setPlatformStroke(GraphicsContext* context, cairo_t* cr, GraphicsContextPrivate* gcp)
 {
     cairo_save(cr);
-    switch (gcp->state.strokeType) {
-    case SolidColorType: {
-        Color strokeColor = colorWithOverrideAlpha(context->strokeColor().rgb(), context->strokeColor().alpha() / 255.f * gcp->state.globalAlpha);
-        setColor(cr, strokeColor);
-        break;
-    }
-    case PatternType: {
+    if (gcp->state.strokePattern) {
         TransformationMatrix affine;
         cairo_set_source(cr, gcp->state.strokePattern->createPlatformPattern(affine));
-        break;
-    }
-    case GradientType:
+    } else if (gcp->state.strokeGradient)
         cairo_set_source(cr, gcp->state.strokeGradient->platformGradient());
-        break;
+    else  {
+        Color strokeColor = colorWithOverrideAlpha(context->strokeColor().rgb(), context->strokeColor().alpha() / 255.f * gcp->state.globalAlpha);
+        setColor(cr, strokeColor);
     }
-    if (gcp->state.globalAlpha < 1.0f && gcp->state.strokeType != SolidColorType) {
+    if (gcp->state.globalAlpha < 1.0f && (gcp->state.strokePattern || gcp->state.strokeGradient)) {
         cairo_push_group(cr);
         cairo_paint_with_alpha(cr, gcp->state.globalAlpha);
         cairo_pop_group_to_source(cr);
diff --git a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
index 9f79a4d..15e1904 100644
--- a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
+++ b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
@@ -461,7 +461,7 @@ void GraphicsContext::applyStrokePattern()
 {
     CGContextRef cgContext = platformContext();
 
-    RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_common->state.strokePattern.get()->createPlatformPattern(getCTM()));
+    RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_common->state.strokePattern->createPlatformPattern(getCTM()));
     if (!platformPattern)
         return;
 
@@ -476,7 +476,7 @@ void GraphicsContext::applyFillPattern()
 {
     CGContextRef cgContext = platformContext();
 
-    RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_common->state.fillPattern.get()->createPlatformPattern(getCTM()));
+    RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_common->state.fillPattern->createPlatformPattern(getCTM()));
     if (!platformPattern)
         return;
 
@@ -489,8 +489,8 @@ void GraphicsContext::applyFillPattern()
 
 static inline bool calculateDrawingMode(const GraphicsContextState& state, CGPathDrawingMode& mode)
 {
-    bool shouldFill = state.fillType == PatternType || state.fillColor.alpha();
-    bool shouldStroke = state.strokeType == PatternType || (state.strokeStyle != NoStroke && state.strokeColor.alpha());
+    bool shouldFill = state.fillPattern || state.fillColor.alpha();
+    bool shouldStroke = state.strokePattern || (state.strokeStyle != NoStroke && state.strokeColor.alpha());
     bool useEOFill = state.fillRule == RULE_EVENODD;
 
     if (shouldFill) {
@@ -522,16 +522,16 @@ void GraphicsContext::drawPath()
     CGContextRef context = platformContext();
     const GraphicsContextState& state = m_common->state;
 
-    if (state.fillType == GradientType || state.strokeType == GradientType) {
+    if (state.fillGradient || state.strokeGradient) {
         // We don't have any optimized way to fill & stroke a path using gradients
         fillPath();
         strokePath();
         return;
     }
 
-    if (state.fillType == PatternType)
+    if (state.fillPattern)
         applyFillPattern();
-    if (state.strokeType == PatternType)
+    if (state.strokePattern)
         applyStrokePattern();
 
     CGPathDrawingMode drawingMode;
@@ -553,17 +553,11 @@ void GraphicsContext::fillPath()
         return;
 
     CGContextRef context = platformContext();
+
+    // FIXME: Is this helpful and correct in the fillPattern and fillGradient cases?
     setCGFillColorSpace(context, m_common->state.fillColorSpace);
 
-    switch (m_common->state.fillType) {
-    case SolidColorType:
-        fillPathWithFillRule(context, fillRule());
-        break;
-    case PatternType:
-        applyFillPattern();
-        fillPathWithFillRule(context, fillRule());
-        break;
-    case GradientType:
+    if (m_common->state.fillGradient) {
         CGContextSaveGState(context);
         if (fillRule() == RULE_EVENODD)
             CGContextEOClip(context);
@@ -572,8 +566,12 @@ void GraphicsContext::fillPath()
         CGContextConcatCTM(context, m_common->state.fillGradient->gradientSpaceTransform());
         CGContextDrawShading(context, m_common->state.fillGradient->platformGradient());
         CGContextRestoreGState(context);
-        break;
+        return;
     }
+
+    if (m_common->state.fillPattern)
+        applyFillPattern();
+    fillPathWithFillRule(context, fillRule());
 }
 
 void GraphicsContext::strokePath()
@@ -582,25 +580,23 @@ void GraphicsContext::strokePath()
         return;
 
     CGContextRef context = platformContext();
+
+    // FIXME: Is this helpful and correct in the strokePattern and strokeGradient cases?
     setCGStrokeColorSpace(context, m_common->state.strokeColorSpace);
 
-    switch (m_common->state.strokeType) {
-    case SolidColorType:
-        CGContextStrokePath(context);
-        break;
-    case PatternType:
-        applyStrokePattern();
-        CGContextStrokePath(context);
-        break;
-    case GradientType:
+    if (m_common->state.strokeGradient) {
         CGContextSaveGState(context);
         CGContextReplacePathWithStrokedPath(context);
         CGContextClip(context);
         CGContextConcatCTM(context, m_common->state.strokeGradient->gradientSpaceTransform());
         CGContextDrawShading(context, m_common->state.strokeGradient->platformGradient());
         CGContextRestoreGState(context);
-        break;
+        return;
     }
+
+    if (m_common->state.strokePattern)
+        applyStrokePattern();
+    CGContextStrokePath(context);
 }
 
 void GraphicsContext::fillRect(const FloatRect& rect)
@@ -609,24 +605,22 @@ void GraphicsContext::fillRect(const FloatRect& rect)
         return;
 
     CGContextRef context = platformContext();
+
+    // FIXME: Is this helpful and correct in the fillPattern and fillGradient cases?
     setCGFillColorSpace(context, m_common->state.fillColorSpace);
 
-    switch (m_common->state.fillType) {
-    case SolidColorType:
-        CGContextFillRect(context, rect);
-        break;
-    case PatternType:
-        applyFillPattern();
-        CGContextFillRect(context, rect);
-        break;
-    case GradientType:
+    if (m_common->state.fillGradient) {
         CGContextSaveGState(context);
         CGContextClipToRect(context, rect);
         CGContextConcatCTM(context, m_common->state.fillGradient->gradientSpaceTransform());
         CGContextDrawShading(context, m_common->state.fillGradient->platformGradient());
         CGContextRestoreGState(context);
-        break;
+        return;
     }
+
+    if (m_common->state.fillPattern)
+        applyFillPattern();
+    CGContextFillRect(context, rect);
 }
 
 void GraphicsContext::fillRect(const FloatRect& rect, const Color& color, ColorSpace colorSpace)
@@ -851,17 +845,11 @@ void GraphicsContext::strokeRect(const FloatRect& r, float lineWidth)
         return;
 
     CGContextRef context = platformContext();
+
+    // FIXME: Is this helpful and correct in the strokePattern and strokeGradient cases?
     setCGStrokeColorSpace(context, m_common->state.strokeColorSpace);
 
-    switch (m_common->state.strokeType) {
-    case SolidColorType:
-        CGContextStrokeRectWithWidth(context, r, lineWidth);
-        break;
-    case PatternType:
-        applyStrokePattern();
-        CGContextStrokeRectWithWidth(context, r, lineWidth);
-        break;
-    case GradientType:
+    if (m_common->state.strokeGradient) {
         CGContextSaveGState(context);
         setStrokeThickness(lineWidth);
         CGContextAddRect(context, r);
@@ -869,8 +857,12 @@ void GraphicsContext::strokeRect(const FloatRect& r, float lineWidth)
         CGContextClip(context);
         CGContextDrawShading(context, m_common->state.strokeGradient->platformGradient());
         CGContextRestoreGState(context);
-        break;
+        return;
     }
+
+    if (m_common->state.strokePattern)
+        applyStrokePattern();
+    CGContextStrokeRectWithWidth(context, r, lineWidth);
 }
 
 void GraphicsContext::setLineCap(LineCap cap)
diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index 5cdfac2..a095476 100644
--- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -639,24 +639,18 @@ void GraphicsContext::fillPath()
     QPainterPath path = m_data->currentPath;
     path.setFillRule(toQtFillRule(fillRule()));
 
-    if ((m_common->state.fillType != SolidColorType)
-            || (fillColor().alpha())) {
+    if (m_common->state.fillPattern || m_common->state.fillGradient || fillColor().alpha()) {
         drawFilledShadowPath(this, p, &path);
-        switch (m_common->state.fillType) {
-        case SolidColorType:
-            if (fillColor().alpha())
-                p->fillPath(path, p->brush());
-            break;
-        case PatternType: {
+        if (m_common->state.fillPattern) {
             TransformationMatrix affine;
             p->fillPath(path, QBrush(m_common->state.fillPattern->createPlatformPattern(affine)));
-            break;
-        }
-        case GradientType:
+        } else if (m_common->state.fillGradient) {
             QBrush brush(*m_common->state.fillGradient->platformGradient());
             brush.setTransform(m_common->state.fillGradient->gradientSpaceTransform());
             p->fillPath(path, brush);
-            break;
+        } else {
+            if (fillColor().alpha())
+                p->fillPath(path, p->brush());
         }
     }
     m_data->currentPath = QPainterPath();
@@ -672,8 +666,7 @@ void GraphicsContext::strokePath()
     QPainterPath path = m_data->currentPath;
     path.setFillRule(toQtFillRule(fillRule()));
 
-    if ((m_common->state.strokeType != SolidColorType)
-            || (strokeColor().alpha())) {
+    if (m_common->state.strokePattern || m_common->state.strokeGradient || strokeColor().alpha()) {
         IntSize shadowSize;
         int shadowBlur;
         Color shadowColor;
@@ -685,26 +678,20 @@ void GraphicsContext::strokePath()
             p->strokePath(path, shadowPen);
             p->setWorldTransform(t);
         }
-        switch (m_common->state.strokeType) {
-        case SolidColorType:
-            if (strokeColor().alpha())
-                p->strokePath(path, pen);
-            break;
-        case PatternType: {
+        if (m_common->state.strokePattern) {
             TransformationMatrix affine;
             pen.setBrush(QBrush(m_common->state.strokePattern->createPlatformPattern(affine)));
             p->setPen(pen);
             p->strokePath(path, pen);
-            break;
-        }
-        case GradientType: {
+        } else if (m_common->state.strokeGradient) {
             QBrush brush(*m_common->state.strokeGradient->platformGradient());
             brush.setTransform(m_common->state.strokeGradient->gradientSpaceTransform());
             pen.setBrush(brush);
             p->setPen(pen);
             p->strokePath(path, pen);
-            break;
-        }
+        } else {
+            if (strokeColor().alpha())
+                p->strokePath(path, pen);
         }
     }
     m_data->currentPath = QPainterPath();
@@ -729,24 +716,18 @@ void GraphicsContext::fillRect(const FloatRect& rect)
 
     QPainter* p = m_data->p();
 
-    if ((m_common->state.fillType != SolidColorType)
-            || (fillColor().alpha())) {
+    if (m_common->state.fillPattern || m_common->state.fillGradient || fillColor().alpha()) {
         drawBorderlessRectShadow(this, p, rect);
-        switch (m_common->state.fillType) {
-        case SolidColorType:
-            if (fillColor().alpha())
-                p->fillRect(rect, p->brush());
-            break;
-        case PatternType: {
+        if (m_common->state.fillPattern) {
             TransformationMatrix affine;
             p->fillRect(rect, QBrush(m_common->state.fillPattern->createPlatformPattern(affine)));
-            break;
-        }
-        case GradientType:
+        } else if (m_common->state.fillGradient) {
             QBrush brush(*m_common->state.fillGradient->platformGradient());
             brush.setTransform(m_common->state.fillGradient->gradientSpaceTransform());
             p->fillRect(rect, brush);
-            break;
+        } else {
+            if (fillColor().alpha())
+                p->fillRect(rect, p->brush());
         }
     }
 }
diff --git a/WebCore/platform/graphics/wince/GraphicsContextWince.cpp b/WebCore/platform/graphics/wince/GraphicsContextWince.cpp
index 441cd28..f22e6c9 100644
--- a/WebCore/platform/graphics/wince/GraphicsContextWince.cpp
+++ b/WebCore/platform/graphics/wince/GraphicsContextWince.cpp
@@ -1355,7 +1355,7 @@ Color gradientAverageColor(const Gradient* gradient)
 
 void GraphicsContext::fillPath()
 {
-    Color c = m_common->state.fillType == GradientType && m_common->state.fillGradient
+    Color c = m_common->state.fillGradient
         ? gradientAverageColor(m_common->state.fillGradient.get())
         : fillColor();
 
@@ -1539,7 +1539,7 @@ void GraphicsContext::clipToImageBuffer(const FloatRect&, const ImageBuffer*)
 
 void GraphicsContext::fillRect(const FloatRect& rect)
 {
-    if (m_common->state.fillType == GradientType && m_common->state.fillGradient)
+    if (m_common->state.fillGradient)
         fillRect(rect, m_common->state.fillGradient.get());
     else
         fillRect(rect, fillColor(), DeviceColorSpace);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list