[Cairo] GraphicsContext::setPlatformShadow() has to update state's shadow offset...
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Nov 2017 13:00:19 +0000 (13:00 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Nov 2017 13:00:19 +0000 (13:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=179725

Reviewed by Carlos Garcia Campos.

In r224753, GraphicsContext::setPlatformShadow() stopped updating the
shadow offset value that's kept in GraphicsContextState. This regressed
a few tests, so the adjustment of the shadow offset value in the
GraphicsContext state is brought back.

* platform/graphics/cairo/CairoOperations.cpp:
(WebCore::Cairo::State::setShadowValues):
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::setPlatformShadow):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224873 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/cairo/CairoOperations.cpp
Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp

index ec67f52..04f5801 100644 (file)
@@ -1,3 +1,20 @@
+2017-11-15  Zan Dobersek  <zdobersek@igalia.com>
+
+        [Cairo] GraphicsContext::setPlatformShadow() has to update state's shadow offset when ignoring transforms
+        https://bugs.webkit.org/show_bug.cgi?id=179725
+
+        Reviewed by Carlos Garcia Campos.
+
+        In r224753, GraphicsContext::setPlatformShadow() stopped updating the
+        shadow offset value that's kept in GraphicsContextState. This regressed
+        a few tests, so the adjustment of the shadow offset value in the
+        GraphicsContext state is brought back.
+
+        * platform/graphics/cairo/CairoOperations.cpp:
+        (WebCore::Cairo::State::setShadowValues):
+        * platform/graphics/cairo/GraphicsContextCairo.cpp:
+        (WebCore::GraphicsContext::setPlatformShadow):
+
 2017-11-15  Gabriel Ivascu  <givascu@igalia.com>
 
         [GTK] Automatically adjust font size when gtk-xft-dpi changes
index 8fad9d9..5b8a310 100644 (file)
@@ -400,15 +400,8 @@ AffineTransform getCTM(PlatformContextCairo& platformContext)
 
 void setShadowValues(PlatformContextCairo& platformContext, const FloatSize& radius, const FloatSize& offset, const Color& color, bool ignoreTransforms)
 {
-    FloatSize adjustedOffset = offset;
-    if (ignoreTransforms) {
-        // Meaning that this graphics context is associated with a CanvasRenderingContext
-        // We flip the height since CG and HTML5 Canvas have opposite Y axis
-        adjustedOffset.setHeight(-offset.height());
-    }
-
     // Cairo doesn't support shadows natively, they are drawn manually in the draw* functions using ShadowBlur.
-    platformContext.shadowBlur().setShadowValues(radius, adjustedOffset, color, ignoreTransforms);
+    platformContext.shadowBlur().setShadowValues(radius, offset, color, ignoreTransforms);
 }
 
 void clearShadow(PlatformContextCairo& platformContext)
index a063bff..e60f13a 100644 (file)
@@ -450,9 +450,17 @@ void GraphicsContext::setPlatformShadow(const FloatSize& offset, float blur, con
     if (paintingDisabled())
         return;
 
+    FloatSize adjustedOffset = offset;
+    if (m_state.shadowsIgnoreTransforms) {
+        // Meaning that this graphics context is associated with a CanvasRenderingContext
+        // We flip the height since CG and HTML5 Canvas have opposite Y axis
+        adjustedOffset.setHeight(-offset.height());
+        m_state.shadowOffset = adjustedOffset;
+    }
+
     ASSERT(hasPlatformContext());
     Cairo::State::setShadowValues(*platformContext(), FloatSize { blur, blur },
-        offset, color, m_state.shadowsIgnoreTransforms);
+        adjustedOffset, color, m_state.shadowsIgnoreTransforms);
 }
 
 void GraphicsContext::clearPlatformShadow()