Bug 26331

Summary: [Canvas] add: lineStyle = none|solid|dotted|dashed
Product: WebKit Reporter: Dirk Schulze <krit>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: ian
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Attachments:
Description Flags
canvas lineStyle none

Description Dirk Schulze 2009-06-11 14:42:38 PDT
It would helpful to have something like lineStyle, that draws a path dotted, solid, dashed or not at all (last is maybe senceless).
Comment 1 Dirk Schulze 2009-06-11 14:56:59 PDT
Created attachment 31174 [details]
canvas lineStyle

lineStyle is not in the spec of HTML 5 atm. This patch adds a basic concept for lineStyle and supports dashed, dotted or solid strokes as well as none. You can make use of it with:
context.webkitLineStyle = 'dashed|dotted|solid|none'
the default is solid of course.
There are no configurations possible at the moment (size of gaps between dashes and so on). And maybe it would make it to difficult.

I hope to get some feedback or improvement.
Comment 2 Oliver Hunt 2009-06-11 15:33:31 PDT
Comment on attachment 31174 [details]
canvas lineStyle

I'm not sure what the correct approach to get webkitLineStyle vs. lineStyle -- i think sam would be the right person to ask.

Otherwise this patch is fine -- i'm clearing the review flag so no one else reviews or tries to land.
Comment 3 Dirk Schulze 2009-06-13 13:47:25 PDT
I could just test it on gtk atm and I see a bad behavior of dotted paths. The length of a dot is not scaled to the thickness of the stroked path. That means that the distance between two dots is always the same, independently of the stroke width.
I looked to the css implemenatation and the benefit on css is that it only needs to stroke lines and circles. All ports have a special implementation (all the same?) to solve the problem in GraphicsContext.
I don't know if we can reuse the logic to calculate the size of the dot in a universal path. I'll take a look at this.
The situation for solid and none is clear. And dashed lines look ok, but we may use the same logic as for dotted paths.
Comment 4 Dirk Schulze 2009-08-21 01:57:32 PDT
(In reply to comment #3)
The problems with dotted lines dont affect on Qt. I'll test the patch on Cg soon but this might be a cairo bug.
Comment 5 Ian 'Hixie' Hickson 2012-02-28 14:22:53 PST

*** This bug has been marked as a duplicate of bug 63933 ***