Title: [246354] trunk
Revision
246354
Author
[email protected]
Date
2019-06-12 09:21:20 -0700 (Wed, 12 Jun 2019)

Log Message

Unreviewed, rolling out r246350.

r246350 Introduced a failing and timing out test svg/clip-path
/clip-hidpi.svg

Reverted changeset:

"[cairo][SVG] Putting multiple path elements in clippath
causes rendering artifacts"
https://bugs.webkit.org/show_bug.cgi?id=198701
https://trac.webkit.org/changeset/246350

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (246353 => 246354)


--- trunk/LayoutTests/ChangeLog	2019-06-12 16:07:42 UTC (rev 246353)
+++ trunk/LayoutTests/ChangeLog	2019-06-12 16:21:20 UTC (rev 246354)
@@ -1,3 +1,17 @@
+2019-06-12  Truitt Savell  <[email protected]>
+
+        Unreviewed, rolling out r246350.
+
+        r246350 Introduced a failing and timing out test svg/clip-path
+        /clip-hidpi.svg
+
+        Reverted changeset:
+
+        "[cairo][SVG] Putting multiple path elements in clippath
+        causes rendering artifacts"
+        https://bugs.webkit.org/show_bug.cgi?id=198701
+        https://trac.webkit.org/changeset/246350
+
 2019-06-12  Carlos Garcia Campos  <[email protected]>
 
         [cairo][SVG] Putting multiple path elements in clippath causes rendering artifacts

Deleted: trunk/LayoutTests/svg/clip-path/clip-hidpi-expected.svg (246353 => 246354)


--- trunk/LayoutTests/svg/clip-path/clip-hidpi-expected.svg	2019-06-12 16:07:42 UTC (rev 246353)
+++ trunk/LayoutTests/svg/clip-path/clip-hidpi-expected.svg	2019-06-12 16:21:20 UTC (rev 246354)
@@ -1,18 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg">
-<!-- The FO should be clipped with only the green half visible. -->
-<defs>
-<clipPath id="clip">
-    <rect width="200" height="50"/>
-    <rect width="200" height="50"/>
-</clipPath>
-</defs>
-<foreignObject width="200" height="100" clip-path="url(#clip)" opacity=".5">
-    <html xmlns="http://www.w3.org/1999/xhtml">
-    <body>
-        <div style="background: green; height: 50px;"></div>
-        <div style="background: red; height: 50px;"></div>
-    </body>
-    </html>
-</foreignObject>
-</svg>
-

Deleted: trunk/LayoutTests/svg/clip-path/clip-hidpi.svg (246353 => 246354)


--- trunk/LayoutTests/svg/clip-path/clip-hidpi.svg	2019-06-12 16:07:42 UTC (rev 246353)
+++ trunk/LayoutTests/svg/clip-path/clip-hidpi.svg	2019-06-12 16:21:20 UTC (rev 246354)
@@ -1,22 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg">
-<!-- The FO should be clipped with only the green half visible. -->
-<defs>
-<clipPath id="clip">
-    <rect width="200" height="50"/>
-    <rect width="200" height="50"/>
-</clipPath>
-</defs>
-<foreignObject width="200" height="100" clip-path="url(#clip)" opacity=".5">
-    <html xmlns="http://www.w3.org/1999/xhtml">
-    <body>
-        <div style="background: green; height: 50px;"></div>
-        <div style="background: red; height: 50px;"></div>
-    </body>
-    </html>
-</foreignObject>
-<script>
-  testRunner.setBackingScaleFactor(2, function() { testRunner.notifyDone() });
-  testRunner.waitUntilDone();
-</script>
-</svg>
-

Deleted: trunk/LayoutTests/svg/clip-path/clip-opacity-translate-expected.svg (246353 => 246354)


--- trunk/LayoutTests/svg/clip-path/clip-opacity-translate-expected.svg	2019-06-12 16:07:42 UTC (rev 246353)
+++ trunk/LayoutTests/svg/clip-path/clip-opacity-translate-expected.svg	2019-06-12 16:21:20 UTC (rev 246354)
@@ -1,18 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="350">
-<g>
-  <circle cx="50" cy="50" r="50" fill="green"/>
-  <circle cx="100" cy="50" r="50" fill="red" />
-  <g opacity=".5">
-    <circle cx="50" cy="100" r="50" fill="green"/>
-    <circle cx="100" cy="100" r="50" fill="red" />
-  </g>
-</g>
-<g transform="translate(200,0)">
-  <circle cx="50" cy="50" r="50" fill="green"/>
-  <circle cx="100" cy="50" r="50" fill="red" />
-  <g opacity=".5">
-    <circle cx="50" cy="100" r="50" fill="green"/>
-    <circle cx="100" cy="100" r="50" fill="red" />
-  </g>
-</g>
-</svg>

Deleted: trunk/LayoutTests/svg/clip-path/clip-opacity-translate.svg (246353 => 246354)


--- trunk/LayoutTests/svg/clip-path/clip-opacity-translate.svg	2019-06-12 16:07:42 UTC (rev 246353)
+++ trunk/LayoutTests/svg/clip-path/clip-opacity-translate.svg	2019-06-12 16:21:20 UTC (rev 246354)
@@ -1,27 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="350">
-<defs>
-<clipPath id="clip1">
-    <rect width="200" height="200"/>
-</clipPath>
-<clipPath id="clip2">
-    <rect width="200" height="200"/>
-    <rect width="200" height="200"/>
-</clipPath>
-</defs>
-<g>
-  <circle cx="50" cy="50" r="50" fill="green"/>
-  <circle cx="100" cy="50" r="50" fill="red" />
-  <g clip-path="url(#clip1)" opacity=".5">
-    <circle cx="50" cy="100" r="50" fill="green"/>
-    <circle cx="100" cy="100" r="50" fill="red" />
-  </g>
-</g>
-<g transform="translate(200,0)">
-  <circle cx="50" cy="50" r="50" fill="green"/>
-  <circle cx="100" cy="50" r="50" fill="red" />
-  <g clip-path="url(#clip2)" opacity=".5">
-    <circle cx="50" cy="100" r="50" fill="green"/>
-    <circle cx="100" cy="100" r="50" fill="red" />
-  </g>
-</g>
-</svg>

Modified: trunk/Source/WebCore/ChangeLog (246353 => 246354)


--- trunk/Source/WebCore/ChangeLog	2019-06-12 16:07:42 UTC (rev 246353)
+++ trunk/Source/WebCore/ChangeLog	2019-06-12 16:21:20 UTC (rev 246354)
@@ -1,3 +1,17 @@
+2019-06-12  Truitt Savell  <[email protected]>
+
+        Unreviewed, rolling out r246350.
+
+        r246350 Introduced a failing and timing out test svg/clip-path
+        /clip-hidpi.svg
+
+        Reverted changeset:
+
+        "[cairo][SVG] Putting multiple path elements in clippath
+        causes rendering artifacts"
+        https://bugs.webkit.org/show_bug.cgi?id=198701
+        https://trac.webkit.org/changeset/246350
+
 2019-06-12  Carlos Garcia Campos  <[email protected]>
 
         [cairo][SVG] Putting multiple path elements in clippath causes rendering artifacts

Modified: trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp (246353 => 246354)


--- trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp	2019-06-12 16:07:42 UTC (rev 246353)
+++ trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp	2019-06-12 16:21:20 UTC (rev 246354)
@@ -30,10 +30,34 @@
 
 #if USE(CAIRO)
 
+#include "CairoUtilities.h"
+#include "Gradient.h"
+#include "GraphicsContext.h"
+#include "Pattern.h"
 #include <cairo.h>
 
 namespace WebCore {
 
+// In Cairo image masking is immediate, so to emulate image clipping we must save masking
+// details as part of the context state and apply them during platform restore.
+class ImageMaskInformation {
+public:
+    void update(cairo_surface_t* maskSurface, const FloatRect& maskRect)
+    {
+        m_maskSurface = maskSurface;
+        m_maskRect = maskRect;
+    }
+
+    bool isValid() const { return m_maskSurface; }
+    cairo_surface_t* maskSurface() const { return m_maskSurface.get(); }
+    const FloatRect& maskRect() const { return m_maskRect; }
+
+private:
+    RefPtr<cairo_surface_t> m_maskSurface;
+    FloatRect m_maskRect;
+};
+
+
 // Encapsulates the additional painting state information we store for each
 // pushed graphics state.
 class PlatformContextCairo::State {
@@ -40,10 +64,7 @@
 public:
     State() = default;
 
-    struct {
-        RefPtr<cairo_pattern_t> pattern;
-        cairo_matrix_t matrix;
-    } m_mask;
+    ImageMaskInformation m_imageMaskInformation;
 };
 
 PlatformContextCairo::PlatformContextCairo(cairo_t* cr)
@@ -55,14 +76,11 @@
 
 void PlatformContextCairo::restore()
 {
-    if (m_state->m_mask.pattern) {
+    const ImageMaskInformation& maskInformation = m_state->m_imageMaskInformation;
+    if (maskInformation.isValid()) {
+        const FloatRect& maskRect = maskInformation.maskRect();
         cairo_pop_group_to_source(m_cr.get());
-
-        cairo_matrix_t matrix;
-        cairo_get_matrix(m_cr.get(), &matrix);
-        cairo_set_matrix(m_cr.get(), &m_state->m_mask.matrix);
-        cairo_mask(m_cr.get(), m_state->m_mask.pattern.get());
-        cairo_set_matrix(m_cr.get(), &matrix);
+        cairo_mask_surface(m_cr.get(), maskInformation.maskSurface(), maskRect.x(), maskRect.y());
     }
 
     m_stateStack.removeLast();
@@ -87,13 +105,11 @@
     // We must call savePlatformState at least once before we can use image masking,
     // since we actually apply the mask in restorePlatformState.
     ASSERT(!m_stateStack.isEmpty());
-    m_state->m_mask.pattern = adoptRef(cairo_pattern_create_for_surface(surface));
-    cairo_get_matrix(m_cr.get(), &m_state->m_mask.matrix);
+    m_state->m_imageMaskInformation.update(surface, rect);
 
-    cairo_matrix_t matrix;
-    cairo_matrix_init_translate(&matrix, -rect.x(), -rect.y());
-    cairo_pattern_set_matrix(m_state->m_mask.pattern.get(), &matrix);
-
+    // Cairo doesn't support the notion of an image clip, so we push a group here
+    // and then paint it to the surface with an image mask (which is an immediate
+    // operation) during restorePlatformState.
     cairo_push_group(m_cr.get());
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to