Title: [94714] trunk
Revision
94714
Author
[email protected]
Date
2011-09-07 14:35:03 -0700 (Wed, 07 Sep 2011)

Log Message

Text rendered with a simple (i.e. 0px blur) shadow inside a transparency layer has a double shadow
https://bugs.webkit.org/show_bug.cgi?id=67543
<rdar://problem/10070536>

Reviewed by Simon Fraser.

Generalize (begin|end)TransparencyLayer, which now forward
through to (begin|end)PlatformTransparencyLayer, so that
isInTransparencyLayer can exist on every platform.

Make use of isInTransparencyLayer in FontMac to disable
"simple" shadow drawing when the text is being rendered
into a transparency layer.

Test: svg/custom/simple-text-double-shadow.svg

* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::GraphicsContext):
(WebCore::GraphicsContext::~GraphicsContext):
(WebCore::GraphicsContext::beginTransparencyLayer):
(WebCore::GraphicsContext::endTransparencyLayer):
(WebCore::GraphicsContext::isInTransparencyLayer):
* platform/graphics/GraphicsContext.h:
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::beginPlatformTransparencyLayer):
(WebCore::GraphicsContext::endPlatformTransparencyLayer):
(WebCore::GraphicsContext::supportsTransparencyLayers):
* platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h:
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::beginPlatformTransparencyLayer):
(WebCore::GraphicsContext::endPlatformTransparencyLayer):
(WebCore::GraphicsContext::supportsTransparencyLayers):
* platform/graphics/cg/GraphicsContextPlatformPrivateCG.h:
(WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
* platform/graphics/haiku/GraphicsContextHaiku.cpp:
(WebCore::GraphicsContext::beginPlatformTransparencyLayer):
(WebCore::GraphicsContext::endPlatformTransparencyLayer):
(WebCore::GraphicsContext::supportsTransparencyLayers):
* platform/graphics/mac/FontMac.mm:
(WebCore::Font::drawGlyphs):
* platform/graphics/openvg/GraphicsContextOpenVG.cpp:
(WebCore::GraphicsContext::beginPlatformTransparencyLayer):
(WebCore::GraphicsContext::endPlatformTransparencyLayer):
(WebCore::GraphicsContext::supportsTransparencyLayers):
* platform/graphics/qt/GraphicsContextQt.cpp:
(WebCore::GraphicsContext::isInTransparencyLayer):
(WebCore::GraphicsContext::beginPlatformTransparencyLayer):
(WebCore::GraphicsContext::endPlatformTransparencyLayer):
(WebCore::GraphicsContext::supportsTransparencyLayers):
* platform/graphics/skia/GraphicsContextSkia.cpp:
(WebCore::GraphicsContext::beginPlatformTransparencyLayer):
(WebCore::GraphicsContext::endPlatformTransparencyLayer):
(WebCore::GraphicsContext::supportsTransparencyLayers):
* platform/graphics/win/FontCGWin.cpp:
(WebCore::drawGDIGlyphs):
* platform/graphics/win/GraphicsContextCGWin.cpp:
(WebCore::GraphicsContext::releaseWindowsContext):
* platform/graphics/win/GraphicsContextCairoWin.cpp:
(WebCore::GraphicsContext::releaseWindowsContext):
* platform/graphics/win/GraphicsContextWin.cpp:
(WebCore::GraphicsContext::getWindowsContext):
* platform/graphics/wince/GraphicsContextWinCE.cpp:
(WebCore::GraphicsContext::beginPlatformTransparencyLayer):
(WebCore::GraphicsContext::endPlatformTransparencyLayer):
(WebCore::GraphicsContext::supportsTransparencyLayers):
* platform/graphics/wx/GraphicsContextWx.cpp:
(WebCore::GraphicsContext::beginPlatformTransparencyLayer):
(WebCore::GraphicsContext::endPlatformTransparencyLayer):
(WebCore::GraphicsContext::supportsTransparencyLayers):
* platform/win/ScrollbarThemeWin.cpp:
* plugins/win/PluginViewWin.cpp:
* rendering/RenderThemeWin.cpp:

Add a test ensuring that text with 0px blur CSS shadow doesn't get rendered
with a second shadow when inside a transparency layer.

* platform/mac/svg/custom/simple-text-double-shadow-expected.png: Added.
* platform/mac/svg/custom/simple-text-double-shadow-expected.txt: Added.
* svg/custom/simple-text-double-shadow.svg: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (94713 => 94714)


--- trunk/LayoutTests/ChangeLog	2011-09-07 21:10:29 UTC (rev 94713)
+++ trunk/LayoutTests/ChangeLog	2011-09-07 21:35:03 UTC (rev 94714)
@@ -1,3 +1,18 @@
+2011-09-07  Tim Horton  <[email protected]>
+
+        Text rendered with a simple (i.e. 0px blur) shadow inside a transparency layer has a double shadow
+        https://bugs.webkit.org/show_bug.cgi?id=67543
+        <rdar://problem/10070536>
+
+        Reviewed by Simon Fraser.
+
+        Add a test ensuring that text with 0px blur CSS shadow doesn't get rendered
+        with a second shadow when inside a transparency layer.
+
+        * platform/mac/svg/custom/simple-text-double-shadow-expected.png: Added.
+        * platform/mac/svg/custom/simple-text-double-shadow-expected.txt: Added.
+        * svg/custom/simple-text-double-shadow.svg: Added.
+
 2011-09-07  Nate Chapin  <[email protected]>
 
         Unreviewed, chromium expectations update.

Added: trunk/LayoutTests/platform/mac/svg/custom/simple-text-double-shadow-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/svg/custom/simple-text-double-shadow-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/svg/custom/simple-text-double-shadow-expected.txt (0 => 94714)


--- trunk/LayoutTests/platform/mac/svg/custom/simple-text-double-shadow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/svg/custom/simple-text-double-shadow-expected.txt	2011-09-07 21:35:03 UTC (rev 94714)
@@ -0,0 +1,8 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderSVGRoot {svg} at (20,26) size 380x194
+    RenderSVGText {text} at (20,26) size 217x18 contains 1 chunk(s)
+      RenderSVGInlineText {#text} at (0,0) size 217x18
+        chunk 1 text run 1 at (20.00,40.00) startOffset 0 endOffset 34 width 217.00: "This text should appear only twice"
+    RenderSVGPath {rect} at (100,100) size 250x70 [fill={[type=SOLID] [color=#0000FF]}] [x=100.00] [y=100.00] [width=200.00] [height=20.00]

Added: trunk/LayoutTests/svg/custom/simple-text-double-shadow.svg (0 => 94714)


--- trunk/LayoutTests/svg/custom/simple-text-double-shadow.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/simple-text-double-shadow.svg	2011-09-07 21:35:03 UTC (rev 94714)
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" id="asdf" style="-webkit-svg-shadow: 50px 50px 0px red;">
+<text x="20" y="40" fill="black">This text should appear only twice</text>
+<rect x="100" y="100" height="20" width="200" fill="blue" />
+</svg>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (94713 => 94714)


--- trunk/Source/WebCore/ChangeLog	2011-09-07 21:10:29 UTC (rev 94713)
+++ trunk/Source/WebCore/ChangeLog	2011-09-07 21:35:03 UTC (rev 94714)
@@ -1,3 +1,78 @@
+2011-09-07  Tim Horton  <[email protected]>
+
+        Text rendered with a simple (i.e. 0px blur) shadow inside a transparency layer has a double shadow
+        https://bugs.webkit.org/show_bug.cgi?id=67543
+        <rdar://problem/10070536>
+
+        Reviewed by Simon Fraser.
+
+        Generalize (begin|end)TransparencyLayer, which now forward
+        through to (begin|end)PlatformTransparencyLayer, so that
+        isInTransparencyLayer can exist on every platform.
+
+        Make use of isInTransparencyLayer in FontMac to disable
+        "simple" shadow drawing when the text is being rendered
+        into a transparency layer.
+
+        Test: svg/custom/simple-text-double-shadow.svg
+
+        * platform/graphics/GraphicsContext.cpp:
+        (WebCore::GraphicsContext::GraphicsContext):
+        (WebCore::GraphicsContext::~GraphicsContext):
+        (WebCore::GraphicsContext::beginTransparencyLayer):
+        (WebCore::GraphicsContext::endTransparencyLayer):
+        (WebCore::GraphicsContext::isInTransparencyLayer):
+        * platform/graphics/GraphicsContext.h:
+        * platform/graphics/cairo/GraphicsContextCairo.cpp:
+        (WebCore::GraphicsContext::beginPlatformTransparencyLayer):
+        (WebCore::GraphicsContext::endPlatformTransparencyLayer):
+        (WebCore::GraphicsContext::supportsTransparencyLayers):
+        * platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h:
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::GraphicsContext::beginPlatformTransparencyLayer):
+        (WebCore::GraphicsContext::endPlatformTransparencyLayer):
+        (WebCore::GraphicsContext::supportsTransparencyLayers):
+        * platform/graphics/cg/GraphicsContextPlatformPrivateCG.h:
+        (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
+        * platform/graphics/haiku/GraphicsContextHaiku.cpp:
+        (WebCore::GraphicsContext::beginPlatformTransparencyLayer):
+        (WebCore::GraphicsContext::endPlatformTransparencyLayer):
+        (WebCore::GraphicsContext::supportsTransparencyLayers):
+        * platform/graphics/mac/FontMac.mm:
+        (WebCore::Font::drawGlyphs):
+        * platform/graphics/openvg/GraphicsContextOpenVG.cpp:
+        (WebCore::GraphicsContext::beginPlatformTransparencyLayer):
+        (WebCore::GraphicsContext::endPlatformTransparencyLayer):
+        (WebCore::GraphicsContext::supportsTransparencyLayers):
+        * platform/graphics/qt/GraphicsContextQt.cpp:
+        (WebCore::GraphicsContext::isInTransparencyLayer):
+        (WebCore::GraphicsContext::beginPlatformTransparencyLayer):
+        (WebCore::GraphicsContext::endPlatformTransparencyLayer):
+        (WebCore::GraphicsContext::supportsTransparencyLayers):
+        * platform/graphics/skia/GraphicsContextSkia.cpp:
+        (WebCore::GraphicsContext::beginPlatformTransparencyLayer):
+        (WebCore::GraphicsContext::endPlatformTransparencyLayer):
+        (WebCore::GraphicsContext::supportsTransparencyLayers):
+        * platform/graphics/win/FontCGWin.cpp:
+        (WebCore::drawGDIGlyphs):
+        * platform/graphics/win/GraphicsContextCGWin.cpp:
+        (WebCore::GraphicsContext::releaseWindowsContext):
+        * platform/graphics/win/GraphicsContextCairoWin.cpp:
+        (WebCore::GraphicsContext::releaseWindowsContext):
+        * platform/graphics/win/GraphicsContextWin.cpp:
+        (WebCore::GraphicsContext::getWindowsContext):
+        * platform/graphics/wince/GraphicsContextWinCE.cpp:
+        (WebCore::GraphicsContext::beginPlatformTransparencyLayer):
+        (WebCore::GraphicsContext::endPlatformTransparencyLayer):
+        (WebCore::GraphicsContext::supportsTransparencyLayers):
+        * platform/graphics/wx/GraphicsContextWx.cpp:
+        (WebCore::GraphicsContext::beginPlatformTransparencyLayer):
+        (WebCore::GraphicsContext::endPlatformTransparencyLayer):
+        (WebCore::GraphicsContext::supportsTransparencyLayers):
+        * platform/win/ScrollbarThemeWin.cpp:
+        * plugins/win/PluginViewWin.cpp:
+        * rendering/RenderThemeWin.cpp:
+
 2011-09-07  Dan Bernstein  <[email protected]>
 
         <rdar://problem/8881922> Support the hyphenate-limit-lines property

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (94713 => 94714)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2011-09-07 21:10:29 UTC (rev 94713)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2011-09-07 21:35:03 UTC (rev 94714)
@@ -78,6 +78,7 @@
 
 GraphicsContext::GraphicsContext(PlatformGraphicsContext* platformGraphicsContext)
     : m_updatingControlTints(false)
+    , m_transparencyCount(0)
 {
     platformInit(platformGraphicsContext);
 }
@@ -85,6 +86,7 @@
 GraphicsContext::~GraphicsContext()
 {
     ASSERT(m_stack.isEmpty());
+    ASSERT(!m_transparencyCount);
     platformDestroy();
 }
 
@@ -330,6 +332,26 @@
     return m_state.shadowsIgnoreTransforms;
 }
 
+void GraphicsContext::beginTransparencyLayer(float opacity)
+{
+    beginPlatformTransparencyLayer(opacity);
+    ++m_transparencyCount;
+}
+
+void GraphicsContext::endTransparencyLayer()
+{
+    endPlatformTransparencyLayer();
+    ASSERT(m_transparencyCount > 0);
+    --m_transparencyCount;
+}
+
+#if !PLATFORM(QT)
+bool GraphicsContext::isInTransparencyLayer() const
+{
+    return (m_transparencyCount > 0) && supportsTransparencyLayers();
+}
+#endif
+
 bool GraphicsContext::updatingControlTints() const
 {
     return m_updatingControlTints;

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (94713 => 94714)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2011-09-07 21:10:29 UTC (rev 94713)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2011-09-07 21:35:03 UTC (rev 94714)
@@ -370,6 +370,7 @@
 
         void beginTransparencyLayer(float opacity);
         void endTransparencyLayer();
+        bool isInTransparencyLayer() const;
 
         bool hasShadow() const;
         void setShadow(const FloatSize&, float blur, const Color&, ColorSpace);
@@ -425,13 +426,11 @@
         void drawBitmap(SharedBitmap*, const IntRect& dstRect, const IntRect& srcRect, ColorSpace styleColorSpace, CompositeOperator compositeOp);
         void drawBitmapPattern(SharedBitmap*, const FloatRect& tileRectIn, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect, const IntSize& origSourceSize);
         void drawIcon(HICON icon, const IntRect& dstRect, UINT flags);
-        bool inTransparencyLayer() const { return false; }
         HDC getWindowsContext(const IntRect&, bool supportAlphaBlend = false, bool mayCreateBitmap = true); // The passed in rect is used to create a bitmap for compositing inside transparency layers.
         void releaseWindowsContext(HDC, const IntRect&, bool supportAlphaBlend = false, bool mayCreateBitmap = true);    // The passed in HDC should be the one handed back by getWindowsContext.
         void drawRoundCorner(bool newClip, RECT clipRect, RECT rectWin, HDC dc, int width, int height);
 #elif PLATFORM(WIN)
         GraphicsContext(HDC, bool hasAlpha = false); // FIXME: To be removed.
-        bool inTransparencyLayer() const;
         HDC getWindowsContext(const IntRect&, bool supportAlphaBlend = true, bool mayCreateBitmap = true); // The passed in rect is used to create a bitmap for compositing inside transparency layers.
         void releaseWindowsContext(HDC, const IntRect&, bool supportAlphaBlend = true, bool mayCreateBitmap = true);    // The passed in HDC should be the one handed back by getWindowsContext.
 
@@ -481,11 +480,9 @@
         // This is needed because of a bug whereby getting an HDC from a GDI+ context
         // loses the scale operations applied to the context.
         FloatSize currentScale(); 
-        bool inTransparencyLayer() const { return false; }
 #endif
 
 #if PLATFORM(QT)
-        bool inTransparencyLayer() const;
         void pushTransparencyLayerInternal(const QRect &rect, qreal opacity, QPixmap& alphaMask);
         void takeOwnershipOfPlatformContext();
 #endif
@@ -538,11 +535,16 @@
 
         void setPlatformCompositeOperation(CompositeOperator);
 
+        void beginPlatformTransparencyLayer(float opacity);
+        void endPlatformTransparencyLayer();
+        static bool supportsTransparencyLayers();
+
         GraphicsContextPlatformPrivate* m_data;
 
         GraphicsContextState m_state;
         Vector<GraphicsContextState> m_stack;
         bool m_updatingControlTints;
+        unsigned m_transparencyCount;
     };
 
     class GraphicsContextStateSaver {

Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp (94713 => 94714)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2011-09-07 21:10:29 UTC (rev 94713)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2011-09-07 21:35:03 UTC (rev 94714)
@@ -879,7 +879,7 @@
     platformContext()->shadowBlur().clear();
 }
 
-void GraphicsContext::beginTransparencyLayer(float opacity)
+void GraphicsContext::beginPlatformTransparencyLayer(float opacity)
 {
     if (paintingDisabled())
         return;
@@ -887,10 +887,9 @@
     cairo_t* cr = platformContext()->cr();
     cairo_push_group(cr);
     m_data->layers.append(opacity);
-    m_data->beginTransparencyLayer();
 }
 
-void GraphicsContext::endTransparencyLayer()
+void GraphicsContext::endPlatformTransparencyLayer()
 {
     if (paintingDisabled())
         return;
@@ -900,9 +899,13 @@
     cairo_pop_group_to_source(cr);
     cairo_paint_with_alpha(cr, m_data->layers.last());
     m_data->layers.removeLast();
-    m_data->endTransparencyLayer();
 }
 
+bool GraphicsContext::supportsTransparencyLayers()
+{
+    return true;
+}
+
 void GraphicsContext::clearRect(const FloatRect& rect)
 {
     if (paintingDisabled())

Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h (94713 => 94714)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h	2011-09-07 21:10:29 UTC (rev 94713)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h	2011-09-07 21:35:03 UTC (rev 94714)
@@ -77,8 +77,6 @@
     void translate(float, float);
     void concatCTM(const AffineTransform&);
     void setCTM(const AffineTransform&);
-    void beginTransparencyLayer() { m_transparencyCount++; }
-    void endTransparencyLayer() { m_transparencyCount--; }
     void syncContext(cairo_t* cr);
 #else
     // On everything else, we do nothing.
@@ -92,8 +90,6 @@
     void translate(float, float) {}
     void concatCTM(const AffineTransform&) {}
     void setCTM(const AffineTransform&) {}
-    void beginTransparencyLayer() {}
-    void endTransparencyLayer() {}
     void syncContext(cairo_t* cr) {}
 #endif
 
@@ -105,7 +101,6 @@
     GdkEventExpose* expose;
 #elif PLATFORM(WIN)
     HDC m_hdc;
-    unsigned m_transparencyCount;
     bool m_shouldIncludeChildWindows;
 #endif
 };

Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (94713 => 94714)


--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2011-09-07 21:10:29 UTC (rev 94713)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2011-09-07 21:35:03 UTC (rev 94714)
@@ -963,7 +963,7 @@
     CGContextEOClip(context);
 }
 
-void GraphicsContext::beginTransparencyLayer(float opacity)
+void GraphicsContext::beginPlatformTransparencyLayer(float opacity)
 {
     if (paintingDisabled())
         return;
@@ -973,21 +973,24 @@
     CGContextRef context = platformContext();
     CGContextSetAlpha(context, opacity);
     CGContextBeginTransparencyLayer(context, 0);
-    m_data->beginTransparencyLayer();
     m_data->m_userToDeviceTransformKnownToBeIdentity = false;
 }
 
-void GraphicsContext::endTransparencyLayer()
+void GraphicsContext::endPlatformTransparencyLayer()
 {
     if (paintingDisabled())
         return;
     CGContextRef context = platformContext();
     CGContextEndTransparencyLayer(context);
-    m_data->endTransparencyLayer();
 
     restore();
 }
 
+bool GraphicsContext::supportsTransparencyLayers()
+{
+    return true;
+}
+
 void GraphicsContext::setPlatformShadow(const FloatSize& offset, float blur, const Color& color, ColorSpace colorSpace)
 {
     if (paintingDisabled())

Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h (94713 => 94714)


--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h	2011-09-07 21:10:29 UTC (rev 94713)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h	2011-09-07 21:35:03 UTC (rev 94714)
@@ -46,18 +46,10 @@
         , m_hdc(0)
         , m_shouldIncludeChildWindows(false)
 #endif
-#if PLATFORM(WIN) || !ASSERT_DISABLED
-        , m_transparencyCount(0)
-#endif
         , m_userToDeviceTransformKnownToBeIdentity(false)
         , m_contextFlags(flags)
     {
     }
-    
-    ~GraphicsContextPlatformPrivate()
-    {
-        ASSERT(!m_transparencyCount);
-    }
 
 #if PLATFORM(MAC) || PLATFORM(CHROMIUM)
     // These methods do nothing on Mac.
@@ -90,24 +82,7 @@
     bool m_shouldIncludeChildWindows;
 #endif
 
-    void beginTransparencyLayer()
-    {
-#if PLATFORM(WIN) || !ASSERT_DISABLED
-        m_transparencyCount++;
-#endif
-    }
-    void endTransparencyLayer()
-    {
-#if PLATFORM(WIN) || !ASSERT_DISABLED
-        ASSERT(m_transparencyCount > 0);
-        m_transparencyCount--;
-#endif
-    }
-
     RetainPtr<CGContextRef> m_cgContext;
-#if PLATFORM(WIN) || !ASSERT_DISABLED
-    int m_transparencyCount;
-#endif
     bool m_userToDeviceTransformKnownToBeIdentity;
     GraphicsContextCGFlags m_contextFlags;
 };

Modified: trunk/Source/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp (94713 => 94714)


--- trunk/Source/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp	2011-09-07 21:10:29 UTC (rev 94713)
+++ trunk/Source/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp	2011-09-07 21:35:03 UTC (rev 94714)
@@ -249,7 +249,7 @@
     return rect;
 }
 
-void GraphicsContext::beginTransparencyLayer(float opacity)
+void GraphicsContext::beginPlatformTransparencyLayer(float opacity)
 {
     if (paintingDisabled())
         return;
@@ -257,7 +257,7 @@
     notImplemented();
 }
 
-void GraphicsContext::endTransparencyLayer()
+void GraphicsContext::endPlatformTransparencyLayer()
 {
     if (paintingDisabled())
         return;
@@ -265,6 +265,11 @@
     notImplemented();
 }
 
+bool GraphicsContext::supportsTransparencyLayers()
+{
+    return false;
+}
+
 void GraphicsContext::clearRect(const FloatRect& rect)
 {
     if (paintingDisabled())

Modified: trunk/Source/WebCore/platform/graphics/mac/FontMac.mm (94713 => 94714)


--- trunk/Source/WebCore/platform/graphics/mac/FontMac.mm	2011-09-07 21:10:29 UTC (rev 94713)
+++ trunk/Source/WebCore/platform/graphics/mac/FontMac.mm	2011-09-07 21:35:03 UTC (rev 94714)
@@ -222,7 +222,7 @@
     ColorSpace fillColorSpace = context->fillColorSpace();
     context->getShadow(shadowOffset, shadowBlur, shadowColor, shadowColorSpace);
 
-    bool hasSimpleShadow = context->textDrawingMode() == TextModeFill && shadowColor.isValid() && !shadowBlur && !platformData.isColorBitmapFont() && (!context->shadowsIgnoreTransforms() || context->getCTM().isIdentityOrTranslationOrFlipped());
+    bool hasSimpleShadow = context->textDrawingMode() == TextModeFill && shadowColor.isValid() && !shadowBlur && !platformData.isColorBitmapFont() && (!context->shadowsIgnoreTransforms() || context->getCTM().isIdentityOrTranslationOrFlipped()) && !context->isInTransparencyLayer();
     if (hasSimpleShadow) {
         // Paint simple shadows ourselves instead of relying on CG shadows, to avoid losing subpixel antialiasing.
         context->clearShadow();

Modified: trunk/Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp (94713 => 94714)


--- trunk/Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp	2011-09-07 21:10:29 UTC (rev 94713)
+++ trunk/Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp	2011-09-07 21:35:03 UTC (rev 94714)
@@ -285,7 +285,7 @@
     notImplemented();
 }
 
-void GraphicsContext::beginTransparencyLayer(float opacity)
+void GraphicsContext::beginPlatformTransparencyLayer(float opacity)
 {
     if (paintingDisabled())
         return;
@@ -294,7 +294,7 @@
     UNUSED_PARAM(opacity);
 }
 
-void GraphicsContext::endTransparencyLayer()
+void GraphicsContext::endPlatformTransparencyLayer()
 {
     if (paintingDisabled())
         return;
@@ -302,6 +302,11 @@
     notImplemented();
 }
 
+bool GraphicsContext::supportsTransparencyLayers()
+{
+    return false;
+}
+
 void GraphicsContext::clearRect(const FloatRect& rect)
 {
     if (paintingDisabled())

Modified: trunk/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp (94713 => 94714)


--- trunk/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp	2011-09-07 21:10:29 UTC (rev 94713)
+++ trunk/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp	2011-09-07 21:35:03 UTC (rev 94714)
@@ -186,7 +186,7 @@
     bool antiAliasingForRectsAndLines;
 
     QStack<TransparencyLayer*> layers;
-    // Counting real layers. Required by inTransparencyLayer() calls
+    // Counting real layers. Required by isInTransparencyLayer() calls
     // For example, layers with valid alphaMask are not real layers
     int layerCount;
 
@@ -763,7 +763,7 @@
     p->fillPath(path.platformPath(), QColor(color));
 }
 
-bool GraphicsContext::inTransparencyLayer() const
+bool GraphicsContext::isInTransparencyLayer() const
 {
     return m_data->layerCount;
 }
@@ -1060,7 +1060,7 @@
     m_data->layers.push(new TransparencyLayer(p, deviceClip, 1.0, alphaMask));
 }
 
-void GraphicsContext::beginTransparencyLayer(float opacity)
+void GraphicsContext::beginPlatformTransparencyLayer(float opacity)
 {
     if (paintingDisabled())
         return;
@@ -1084,7 +1084,7 @@
     ++m_data->layerCount;
 }
 
-void GraphicsContext::endTransparencyLayer()
+void GraphicsContext::endPlatformTransparencyLayer()
 {
     if (paintingDisabled())
         return;
@@ -1108,6 +1108,11 @@
     delete layer;
 }
 
+bool GraphicsContext::supportsTransparencyLayers()
+{
+    return true;
+}
+
 void GraphicsContext::clearRect(const FloatRect& rect)
 {
     if (paintingDisabled())

Modified: trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp (94713 => 94714)


--- trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp	2011-09-07 21:10:29 UTC (rev 94713)
+++ trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp	2011-09-07 21:35:03 UTC (rev 94714)
@@ -262,7 +262,7 @@
     platformContext()->restore();
 }
 
-void GraphicsContext::beginTransparencyLayer(float opacity)
+void GraphicsContext::beginPlatformTransparencyLayer(float opacity)
 {
     if (paintingDisabled())
         return;
@@ -283,13 +283,18 @@
                                          SkCanvas::kFullColorLayer_SaveFlag));
 }
 
-void GraphicsContext::endTransparencyLayer()
+void GraphicsContext::endPlatformTransparencyLayer()
 {
     if (paintingDisabled())
         return;
     platformContext()->canvas()->restore();
 }
 
+bool GraphicsContext::supportsTransparencyLayers()
+{
+    return true;
+}
+
 // Graphics primitives ---------------------------------------------------------
 
 void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness)

Modified: trunk/Source/WebCore/platform/graphics/win/FontCGWin.cpp (94713 => 94714)


--- trunk/Source/WebCore/platform/graphics/win/FontCGWin.cpp	2011-09-07 21:10:29 UTC (rev 94713)
+++ trunk/Source/WebCore/platform/graphics/win/FontCGWin.cpp	2011-09-07 21:35:03 UTC (rev 94714)
@@ -138,7 +138,7 @@
         if (!fillColor.alpha())
             return;
 
-        drawIntoBitmap = fillColor.alpha() != 255 || graphicsContext->inTransparencyLayer();
+        drawIntoBitmap = fillColor.alpha() != 255 || graphicsContext->isInTransparencyLayer();
         if (!drawIntoBitmap) {
             FloatSize offset;
             float blur;

Modified: trunk/Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp (94713 => 94714)


--- trunk/Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp	2011-09-07 21:10:29 UTC (rev 94713)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp	2011-09-07 21:35:03 UTC (rev 94714)
@@ -89,7 +89,7 @@
 // suitable for all clients?
 void GraphicsContext::releaseWindowsContext(HDC hdc, const IntRect& dstRect, bool supportAlphaBlend, bool mayCreateBitmap)
 {
-    bool createdBitmap = mayCreateBitmap && (!m_data->m_hdc || inTransparencyLayer());
+    bool createdBitmap = mayCreateBitmap && (!m_data->m_hdc || isInTransparencyLayer());
     if (!createdBitmap) {
         m_data->restore();
         return;

Modified: trunk/Source/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp (94713 => 94714)


--- trunk/Source/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp	2011-09-07 21:10:29 UTC (rev 94713)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp	2011-09-07 21:35:03 UTC (rev 94714)
@@ -122,7 +122,7 @@
 
 void GraphicsContext::releaseWindowsContext(HDC hdc, const IntRect& dstRect, bool supportAlphaBlend, bool mayCreateBitmap)
 {
-    bool createdBitmap = mayCreateBitmap && (!m_data->m_hdc || inTransparencyLayer());
+    bool createdBitmap = mayCreateBitmap && (!m_data->m_hdc || isInTransparencyLayer());
     if (!hdc || !createdBitmap) {
         m_data->restore();
         return;

Modified: trunk/Source/WebCore/platform/graphics/win/GraphicsContextWin.cpp (94713 => 94714)


--- trunk/Source/WebCore/platform/graphics/win/GraphicsContextWin.cpp	2011-09-07 21:10:29 UTC (rev 94713)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsContextWin.cpp	2011-09-07 21:35:03 UTC (rev 94714)
@@ -51,8 +51,6 @@
     memset(bmpInfo.bmBits, 0, bufferSize);
 }
 
-bool GraphicsContext::inTransparencyLayer() const { return m_data->m_transparencyCount; }
-
 void GraphicsContext::setShouldIncludeChildWindows(bool include)
 {
     m_data->m_shouldIncludeChildWindows = include;
@@ -100,7 +98,7 @@
 HDC GraphicsContext::getWindowsContext(const IntRect& dstRect, bool supportAlphaBlend, bool mayCreateBitmap)
 {
     // FIXME: Should a bitmap be created also when a shadow is set?
-    if (mayCreateBitmap && (!m_data->m_hdc || inTransparencyLayer())) {
+    if (mayCreateBitmap && (!m_data->m_hdc || isInTransparencyLayer())) {
         if (dstRect.isEmpty())
             return 0;
 

Modified: trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp (94713 => 94714)


--- trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp	2011-09-07 21:10:29 UTC (rev 94713)
+++ trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp	2011-09-07 21:35:03 UTC (rev 94714)
@@ -1113,17 +1113,22 @@
     SelectObject(dc, oldPen);
 }
 
-void GraphicsContext::beginTransparencyLayer(float opacity)
+void GraphicsContext::beginPlatformTransparencyLayer(float opacity)
 {
     m_data->save();
     m_data->m_opacity *= opacity;
 }
 
-void GraphicsContext::endTransparencyLayer()
+void GraphicsContext::endPlatformTransparencyLayer()
 {
     m_data->restore();
 }
 
+bool GraphicsContext::supportsTransparencyLayers()
+{
+    return true;
+}
+
 void GraphicsContext::concatCTM(const AffineTransform& transform)
 {
     m_data->concatCTM(transform);

Modified: trunk/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp (94713 => 94714)


--- trunk/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp	2011-09-07 21:10:29 UTC (rev 94713)
+++ trunk/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp	2011-09-07 21:35:03 UTC (rev 94714)
@@ -665,16 +665,21 @@
     notImplemented(); 
 }
 
-void GraphicsContext::beginTransparencyLayer(float) 
+void GraphicsContext::beginPlatformTransparencyLayer(float)
 { 
     notImplemented(); 
 }
 
-void GraphicsContext::endTransparencyLayer() 
+void GraphicsContext::endPlatformTransparencyLayer()
 { 
     notImplemented(); 
 }
 
+bool GraphicsContext::supportsTransparencyLayers()
+{
+    return false;
+}
+
 void GraphicsContext::clearRect(const FloatRect&) 
 { 
     notImplemented(); 

Modified: trunk/Source/WebCore/platform/win/ScrollbarThemeWin.cpp (94713 => 94714)


--- trunk/Source/WebCore/platform/win/ScrollbarThemeWin.cpp	2011-09-07 21:10:29 UTC (rev 94713)
+++ trunk/Source/WebCore/platform/win/ScrollbarThemeWin.cpp	2011-09-07 21:35:03 UTC (rev 94714)
@@ -271,7 +271,7 @@
     }
 
 #if !OS(WINCE)
-    if (!alphaBlend && !context->inTransparencyLayer())
+    if (!alphaBlend && !context->isInTransparencyLayer())
         DIBPixelData::setRGBABitmapAlpha(windowsContext.hdc(), rect, 255);
 #endif
 }
@@ -325,7 +325,7 @@
         ::DrawFrameControl(windowsContext.hdc(), &themeRect, DFC_SCROLL, classicState);
 
 #if !OS(WINCE)
-    if (!alphaBlend && !context->inTransparencyLayer())
+    if (!alphaBlend && !context->isInTransparencyLayer())
         DIBPixelData::setRGBABitmapAlpha(windowsContext.hdc(), rect, 255);
 #endif
 }
@@ -384,7 +384,7 @@
         ::DrawEdge(hdc, &themeRect, EDGE_RAISED, BF_RECT | BF_MIDDLE);
 
 #if !OS(WINCE)
-    if (!alphaBlend && !context->inTransparencyLayer())
+    if (!alphaBlend && !context->isInTransparencyLayer())
         DIBPixelData::setRGBABitmapAlpha(hdc, rect, 255);
 #endif
     context->releaseWindowsContext(hdc, rect, alphaBlend);

Modified: trunk/Source/WebCore/plugins/win/PluginViewWin.cpp (94713 => 94714)


--- trunk/Source/WebCore/plugins/win/PluginViewWin.cpp	2011-09-07 21:10:29 UTC (rev 94713)
+++ trunk/Source/WebCore/plugins/win/PluginViewWin.cpp	2011-09-07 21:35:03 UTC (rev 94714)
@@ -636,7 +636,7 @@
     // In the Qt port we always draw in an offscreen buffer and therefore need to preserve
     // the translation set in getWindowsContext.
 #if !PLATFORM(QT) && !OS(WINCE)
-    if (!context->inTransparencyLayer()) {
+    if (!context->isInTransparencyLayer()) {
         XFORM transform;
         GetWorldTransform(windowsContext.hdc(), &transform);
         transform.eDx = 0;

Modified: trunk/Source/WebCore/rendering/RenderThemeWin.cpp (94713 => 94714)


--- trunk/Source/WebCore/rendering/RenderThemeWin.cpp	2011-09-07 21:10:29 UTC (rev 94713)
+++ trunk/Source/WebCore/rendering/RenderThemeWin.cpp	2011-09-07 21:35:03 UTC (rev 94714)
@@ -674,7 +674,7 @@
 
 
 #if !OS(WINCE)
-    if (!alphaBlend && !context->inTransparencyLayer())
+    if (!alphaBlend && !context->isInTransparencyLayer())
         DIBPixelData::setRGBABitmapAlpha(windowsContext.hdc(), r, 255);
 #endif
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to