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

simon.fraser at apple.com simon.fraser at apple.com
Mon Feb 21 00:24:45 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 33875137a0d83ecebd406cf52ddf14f6c8f4bef4
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jan 31 04:26:43 2011 +0000

    2011-01-30  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Ariya Hidayat.
    
            Enhance ShadowBlur to render inset box shadows; Part 1.
            https://bugs.webkit.org/show_bug.cgi?id=51567
    
            Add a new method to GraphicsContext to render a rect with a rounded hole,
            for use by inset box-shadow code. Knowledge that we're rendering a rounded
            hole will enable ShadowBlur to be used here in future.
    
            * platform/graphics/GraphicsContext.cpp:
            (WebCore::GraphicsContext::fillRectWithRoundedHole):
            * platform/graphics/GraphicsContext.h:
            * rendering/RenderBoxModelObject.cpp:
            (WebCore::RenderBoxModelObject::paintBoxShadow):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77106 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 8eb1a02..b3f5d13 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2011-01-30  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Ariya Hidayat.
+
+        Enhance ShadowBlur to render inset box shadows; Part 1.
+        https://bugs.webkit.org/show_bug.cgi?id=51567
+        
+        Add a new method to GraphicsContext to render a rect with a rounded hole,
+        for use by inset box-shadow code. Knowledge that we're rendering a rounded
+        hole will enable ShadowBlur to be used here in future.
+
+        * platform/graphics/GraphicsContext.cpp:
+        (WebCore::GraphicsContext::fillRectWithRoundedHole):
+        * platform/graphics/GraphicsContext.h:
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintBoxShadow):
+
 2011-01-23  MORITA Hajime  <morrita at google.com>
 
         Reviewed by Eric Seidel.
diff --git a/Source/WebCore/platform/graphics/GraphicsContext.cpp b/Source/WebCore/platform/graphics/GraphicsContext.cpp
index 400cba0..20971e7 100644
--- a/Source/WebCore/platform/graphics/GraphicsContext.cpp
+++ b/Source/WebCore/platform/graphics/GraphicsContext.cpp
@@ -610,6 +610,32 @@ void GraphicsContext::fillRoundedRect(const RoundedIntRect& rect, const Color& c
     fillRoundedRect(rect.rect(), rect.radii().topLeft(), rect.radii().topRight(), rect.radii().bottomLeft(), rect.radii().bottomRight(), color, colorSpace);
 }
 
+void GraphicsContext::fillRectWithRoundedHole(const IntRect& rect, const RoundedIntRect& roundedHoleRect, const Color& color, ColorSpace colorSpace)
+{
+    if (paintingDisabled())
+        return;
+
+    Path path;
+    path.addRect(rect);
+
+    if (!roundedHoleRect.radii().isZero())
+        path.addRoundedRect(roundedHoleRect.rect(), roundedHoleRect.radii().topLeft(), roundedHoleRect.radii().topRight(), roundedHoleRect.radii().bottomLeft(), roundedHoleRect.radii().bottomRight());
+    else
+        path.addRect(roundedHoleRect.rect());
+
+    WindRule oldFillRule = fillRule();
+    Color oldFillColor = fillColor();
+    ColorSpace oldFillColorSpace = fillColorSpace();
+    
+    setFillRule(RULE_EVENODD);
+    setFillColor(color, colorSpace);
+
+    fillPath(path);
+    
+    setFillRule(oldFillRule);
+    setFillColor(oldFillColor, oldFillColorSpace);
+}
+
 void GraphicsContext::setCompositeOperation(CompositeOperator compositeOperation)
 {
     m_state.compositeOperator = compositeOperation;
diff --git a/Source/WebCore/platform/graphics/GraphicsContext.h b/Source/WebCore/platform/graphics/GraphicsContext.h
index 47d1aa3..ad5cedc 100644
--- a/Source/WebCore/platform/graphics/GraphicsContext.h
+++ b/Source/WebCore/platform/graphics/GraphicsContext.h
@@ -293,6 +293,7 @@ namespace WebCore {
         void fillRect(const FloatRect&, Generator&);
         void fillRoundedRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color&, ColorSpace);
         void fillRoundedRect(const RoundedIntRect&, const Color&, ColorSpace);
+        void fillRectWithRoundedHole(const IntRect&, const RoundedIntRect& roundedHoleRect, const Color&, ColorSpace);
 
         void clearRect(const FloatRect&);
 
diff --git a/Source/WebCore/rendering/RenderBoxModelObject.cpp b/Source/WebCore/rendering/RenderBoxModelObject.cpp
index 0180b85..0172d6c 100644
--- a/Source/WebCore/rendering/RenderBoxModelObject.cpp
+++ b/Source/WebCore/rendering/RenderBoxModelObject.cpp
@@ -1707,9 +1707,9 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int
 
             Path path;
             if (hasBorderRadius) {
+                Path path;
                 path.addRoundedRect(border.rect(), border.radii().topLeft(), border.radii().topRight(), border.radii().bottomLeft(), border.radii().bottomRight());
                 context->clip(path);
-                path.clear();
             } else
                 context->clip(border.rect());
 
@@ -1717,24 +1717,16 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int
             context->translate(extraOffset.width(), extraOffset.height());
             shadowOffset -= extraOffset;
 
-            path.addRect(outerRect);
-
-            if (hasBorderRadius) {
-                if (shadowSpread > 0)
-                    border.shrinkRadii(shadowSpread);
-                path.addRoundedRect(holeRect, border.radii().topLeft(), border.radii().topRight(), border.radii().bottomLeft(), border.radii().bottomRight());
-            } else
-                path.addRect(holeRect);
-
-            context->setFillRule(RULE_EVENODD);
-            context->setFillColor(fillColor, s->colorSpace());
-
+            if (hasBorderRadius && shadowSpread > 0)
+                border.shrinkRadii(shadowSpread);
+            
             if (shadow->isWebkitBoxShadow())
                 context->setLegacyShadow(shadowOffset, shadowBlur, shadowColor, s->colorSpace());
             else
                 context->setShadow(shadowOffset, shadowBlur, shadowColor, s->colorSpace());
 
-            context->fillPath(path);
+            RoundedIntRect roundedHole(holeRect, border.radii());
+            context->fillRectWithRoundedHole(outerRect, roundedHole, fillColor, s->colorSpace());
 
             context->restore();
         }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list