servo: Merge #9080 - Enable Pattern variant of CanvasFillOrStrokeStyle (from jdm:canvaspattern); r=Ms2ger

This is a rebase of #8104, with a test added that exposes pre-existing problems in the canvas code for dealing with patterns.

Source-Repo: https://github.com/servo/servo
Source-Revision: 80135a70ce7f9c478a79ce9f572c42cce246e1d8
This commit is contained in:
Josh Matthews 2015-12-30 13:27:43 +05:01
Родитель 7f8dfa2fbf
Коммит dc02986896
1 изменённых файлов: 8 добавлений и 1 удалений

Просмотреть файл

@ -50,10 +50,11 @@ use util::vec::byte_swap;
#[must_root]
#[derive(JSTraceable, Clone, HeapSizeOf)]
#[allow(dead_code)]
enum CanvasFillOrStrokeStyle {
Color(RGBA),
Gradient(JS<CanvasGradient>),
// Pattern(JS<CanvasPattern>), // https://github.com/servo/servo/pull/6157
Pattern(JS<CanvasPattern>),
}
// https://html.spec.whatwg.org/multipage/#canvasrenderingcontext2d
@ -922,6 +923,9 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {
CanvasFillOrStrokeStyle::Gradient(ref gradient) => {
StringOrCanvasGradientOrCanvasPattern::eCanvasGradient(Root::from_ref(&*gradient))
},
CanvasFillOrStrokeStyle::Pattern(ref pattern) => {
StringOrCanvasGradientOrCanvasPattern::eCanvasPattern(Root::from_ref(&*pattern))
}
}
}
@ -966,6 +970,9 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {
CanvasFillOrStrokeStyle::Gradient(ref gradient) => {
StringOrCanvasGradientOrCanvasPattern::eCanvasGradient(Root::from_ref(&*gradient))
},
CanvasFillOrStrokeStyle::Pattern(ref pattern) => {
StringOrCanvasGradientOrCanvasPattern::eCanvasPattern(Root::from_ref(&*pattern))
}
}
}