Addresses issues raised in #24465; removes redundancy in set_bitmap_dimensions

Removed passing test .ini files and moved euclid extensions to euclidext.rs to factor out redundant code
This commit is contained in:
Bailey Blankenship 2019-10-16 18:18:27 -04:00
parent f7fb130a2a
commit ec2961920b
32 changed files with 211 additions and 131 deletions

View file

@ -92,11 +92,9 @@ impl OffscreenCanvas {
OffscreenCanvasContext::OffscreenContext2d(ref ctx) => Some(DomRoot::from_ref(ctx)),
};
}
let size = self.get_size();
let context = OffscreenCanvasRenderingContext2D::new(
&self.global(),
self,
size,
self.placeholder.as_ref().map(|c| &**c),
);
*self.context.borrow_mut() = Some(OffscreenCanvasContext::OffscreenContext2d(
@ -136,6 +134,14 @@ impl OffscreenCanvasMethods for OffscreenCanvas {
// https://html.spec.whatwg.org/multipage/#dom-offscreencanvas-width
fn SetWidth(&self, value: u64) {
self.width.set(value);
if let Some(canvas_context) = self.context() {
match &*canvas_context {
OffscreenCanvasContext::OffscreenContext2d(rendering_context) => {
rendering_context.set_canvas_bitmap_dimensions(self.get_size());
},
}
}
}
// https://html.spec.whatwg.org/multipage/#dom-offscreencanvas-height
@ -146,5 +152,13 @@ impl OffscreenCanvasMethods for OffscreenCanvas {
// https://html.spec.whatwg.org/multipage/#dom-offscreencanvas-height
fn SetHeight(&self, value: u64) {
self.height.set(value);
if let Some(canvas_context) = self.context() {
match &*canvas_context {
OffscreenCanvasContext::OffscreenContext2d(rendering_context) => {
rendering_context.set_canvas_bitmap_dimensions(self.get_size());
},
}
}
}
}