Explicit check for degenerate SVG radial gradients
Both Canvas2D and SVG expect degenerate radial gradients
(p0 == p1 && r0 == r1) to not draw anything [1]. Canvas2D enforces this
behavior explicitly, but SVG relies on the current Skia semantics.
Skia is about to start handling this case differently [2]. This CL
updates LayoutSVGResourceRadialGradient to also enforce the spec behavior
explicitly:
* add a DegenerateHandling flag to Gradient (all subtypes) to control
degenerate behavior
* when degenerates are not allowed, return an SkEmptyShader to draw nothing
* in order to support the above, plumb SkEmptyShader in PaintShader
* update clients to pass this new flag as required by spec
* clean up degenerate tracking in CanvasGradient/BaseRenderingContext2D
(no longer needed)
* also drop the bool return type for BaseRenderingContext2D::Draw (not used)
[1] https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-createradialgradient
[2] https://skia-review.googlesource.com/c/skia/+/168487
Change-Id: I940fcfd87907ebd2df9fae59102770a6031606e5
Reviewed-on: https://chromium-review.googlesource.com/c/1324612
Reviewed-by: Fernando Serboncini <fserb@chromium.org>
Reviewed-by: Khushal <khushalsagar@chromium.org>
Reviewed-by: Fredrik Söderquist <fs@opera.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606553}Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .