[Webkit-unassigned] [Bug 105508] New: Proposal: Add webkitFillRule to canvas

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Dec 20 01:28:27 PST 2012


https://bugs.webkit.org/show_bug.cgi?id=105508

           Summary: Proposal: Add webkitFillRule to canvas
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: All
               URL: https://github.com/mozilla/pdf.js/issues/2351
        OS/Version: All
            Status: UNCONFIRMED
          Severity: Enhancement
          Priority: P2
         Component: Canvas
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: jwal at jwal.me.uk


Created an attachment (id=180297)
 --> (https://bugs.webkit.org/attachment.cgi?id=180297&action=review)
First-cut patch to expose the webkitFillRule canvas property

When a canvas path that intersects itself is filled there are multiple strategies for how to select regions that receive the fill.  The SVG standard has adopted two such strategies [11] which are called nonzero (default) and evenodd.

SVG is not the only vector graphics protocol to support these two strategies.  Quoting [1]: "Some other languages/libraries that support even-odd fill (in alphabetical order): cairo, Direct2D, GDI, PDF, PostScript, Quartz, skia, and SVG."  In fact the WebKit abstract GraphicsContext [2], used for the implementation of CanvasRenderingContext2D, supports this property and uses the same nonzero/evenodd terminology to name the to strategies.

It has been proposed - in [3], [4] and [5] - that this property is incorporated into the HTML5 standard.  It has already been incorporated into the Mozilla Firefox web browser as the mozFillRule canvas attribute [6].  An application that makes use of this attribute is pdf.js [7] which is available as an experimental Google Chrome/Chromium plugin [8] but which fails to correctly render some PDFs due to this missing attribute in other browsers [10].

I propose that this property is added to WebKit's canvas as webkitFillRule.  Justification:

   - It is already a de-facto standard graphics operation with widespread implementation
   - The patch is likely to be small (example at [9]) since it only has to expose an existing graphics context property as a canvas property
   - The name webkitFillRule correctly implies that this is not yet a web standard property

As linked above, I have a patch which I have tested in a recent build of Chromium.  This will be my first attempt at a WebKit patch and I would really appreciate any assistance in improving the quality of the patch and getting it ready to merge.

References...

[1]  http://lists.w3.org/Archives/Public/public-whatwg-archive/2011Jun/0123.html
[2]  https://github.com/WebKit/webkit/blob/master/Source/WebCore/platform/graphics/GraphicsContext.cpp#L207
[3]  http://lists.w3.org/Archives/Public/public-whatwg-archive/2007May/0338.html
[4]  http://lists.w3.org/Archives/Public/public-whatwg-archive/2011Jun/0123.html
[5]  https://www.w3.org/Bugs/Public/show_bug.cgi?id=19932
[6]  http://hg.mozilla.org/mozilla-central/file/21195f52311c/dom/webidl/CanvasRenderingContext2D.webidl#l140
[7]  https://github.com/mozilla/pdf.js
[8]  https://github.com/mozilla/pdf.js/tree/master/extensions/chrome
[9]  https://github.com/WebKit/webkit/pull/3
[10] https://github.com/mozilla/pdf.js/issues/2351
[11] http://www.w3.org/TR/SVG/painting.html#FillProperties

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list