Title: [207030] trunk/Source/WebCore
Revision
207030
Author
[email protected]
Date
2016-10-10 16:02:04 -0700 (Mon, 10 Oct 2016)

Log Message

<Error>: CGContextSetLineDash: invalid dash array: at least one element must be non-zero
https://bugs.webkit.org/show_bug.cgi?id=138555

Patch by Said Abou-Hallawa <[email protected]> on 2016-10-10
Reviewed by Simon Fraser.

Ensure the dashArray has at least one non-zero element before calling
GraphicsContext::setLineDash(). Call GraphicsContext::setStrokeStyle()
instead, if the dashArray does not have one.

* rendering/svg/SVGRenderSupport.cpp:
(WebCore::SVGRenderSupport::applyStrokeStyleToContext):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (207029 => 207030)


--- trunk/Source/WebCore/ChangeLog	2016-10-10 22:16:05 UTC (rev 207029)
+++ trunk/Source/WebCore/ChangeLog	2016-10-10 23:02:04 UTC (rev 207030)
@@ -1,3 +1,17 @@
+2016-10-10  Said Abou-Hallawa  <[email protected]>
+
+        <Error>: CGContextSetLineDash: invalid dash array: at least one element must be non-zero
+        https://bugs.webkit.org/show_bug.cgi?id=138555
+
+        Reviewed by Simon Fraser.
+
+        Ensure the dashArray has at least one non-zero element before calling
+        GraphicsContext::setLineDash(). Call GraphicsContext::setStrokeStyle()
+        instead, if the dashArray does not have one.
+
+        * rendering/svg/SVGRenderSupport.cpp:
+        (WebCore::SVGRenderSupport::applyStrokeStyleToContext):
+
 2016-10-10  Brent Fulgham  <[email protected]>
 
         [Win][Direct2D] Correct Radial Graident Bug

Modified: trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp (207029 => 207030)


--- trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp	2016-10-10 22:16:05 UTC (rev 207029)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp	2016-10-10 23:02:04 UTC (rev 207030)
@@ -439,10 +439,18 @@
     else {
         DashArray dashArray;
         dashArray.reserveInitialCapacity(dashes.size());
-        for (auto& dash : dashes)
+        bool canSetLineDash = false;
+
+        for (auto& dash : dashes) {
             dashArray.uncheckedAppend(dash.value(lengthContext));
+            if (dashArray.last() > 0)
+                canSetLineDash = true;
+        }
 
-        context->setLineDash(dashArray, lengthContext.valueForLength(svgStyle.strokeDashOffset()));
+        if (canSetLineDash)
+            context->setLineDash(dashArray, lengthContext.valueForLength(svgStyle.strokeDashOffset()));
+        else
+            context->setStrokeStyle(SolidStroke);
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to