Title: [224873] trunk/Source/WebCore
Revision
224873
Author
zandober...@gmail.com
Date
2017-11-15 05:00:19 -0800 (Wed, 15 Nov 2017)

Log Message

[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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (224872 => 224873)


--- trunk/Source/WebCore/ChangeLog	2017-11-15 12:06:43 UTC (rev 224872)
+++ trunk/Source/WebCore/ChangeLog	2017-11-15 13:00:19 UTC (rev 224873)
@@ -1,3 +1,20 @@
+2017-11-15  Zan Dobersek  <zdober...@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  <giva...@igalia.com>
 
         [GTK] Automatically adjust font size when gtk-xft-dpi changes

Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp (224872 => 224873)


--- trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp	2017-11-15 12:06:43 UTC (rev 224872)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp	2017-11-15 13:00:19 UTC (rev 224873)
@@ -400,15 +400,8 @@
 
 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)

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


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2017-11-15 12:06:43 UTC (rev 224872)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2017-11-15 13:00:19 UTC (rev 224873)
@@ -450,9 +450,17 @@
     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()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to