mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Auto merge of #25710 - pylbrecht:pattern.incomplete, r=jdm
Make CanvasRenderingContext2D.createPattern() return null for incomplete images <!-- Please describe your changes on the following line: --> `createPattern()` should return `null` if the passed `image` argument is not usable. References: - https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-createpattern - https://html.spec.whatwg.org/multipage/canvas.html#check-the-usability-of-the-image-argument --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix part of #25331 <!-- Either: --> - [x] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
commit
55058b2875
11 changed files with 17 additions and 35 deletions
|
@ -566,7 +566,7 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {
|
|||
&self,
|
||||
image: CanvasImageSource,
|
||||
repetition: DOMString,
|
||||
) -> Fallible<DomRoot<CanvasPattern>> {
|
||||
) -> Fallible<Option<DomRoot<CanvasPattern>>> {
|
||||
self.canvas_state
|
||||
.borrow()
|
||||
.create_pattern(&self.global(), image, repetition)
|
||||
|
|
|
@ -210,7 +210,7 @@ impl OffscreenCanvasRenderingContext2DMethods for OffscreenCanvasRenderingContex
|
|||
&self,
|
||||
image: CanvasImageSource,
|
||||
repetition: DOMString,
|
||||
) -> Fallible<DomRoot<CanvasPattern>> {
|
||||
) -> Fallible<Option<DomRoot<CanvasPattern>>> {
|
||||
self.canvas_state
|
||||
.borrow()
|
||||
.create_pattern(&self.global(), image, repetition)
|
||||
|
|
|
@ -340,7 +340,7 @@ impl PaintRenderingContext2DMethods for PaintRenderingContext2D {
|
|||
&self,
|
||||
image: CanvasImageSource,
|
||||
repetition: DOMString,
|
||||
) -> Fallible<DomRoot<CanvasPattern>> {
|
||||
) -> Fallible<Option<DomRoot<CanvasPattern>>> {
|
||||
self.context.CreatePattern(image, repetition)
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ interface mixin CanvasFillStrokeStyles {
|
|||
[Throws]
|
||||
CanvasGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1);
|
||||
[Throws]
|
||||
CanvasPattern createPattern(CanvasImageSource image, [TreatNullAs=EmptyString] DOMString repetition);
|
||||
CanvasPattern? createPattern(CanvasImageSource image, [TreatNullAs=EmptyString] DOMString repetition);
|
||||
};
|
||||
|
||||
[Exposed=(PaintWorklet, Window, Worker)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue