From 88954e3e1800dee658837684f9376a321fca59b7 Mon Sep 17 00:00:00 2001 From: Diego Marcos Date: Wed, 25 Mar 2015 17:17:18 -0700 Subject: [PATCH] Implements drawImage for html image as ImageSource --- components/canvas/canvas_paint_task.rs | 165 ++++++++++---- components/canvas/lib.rs | 1 + components/script/Cargo.toml | 3 + .../script/dom/canvasrenderingcontext2d.rs | 215 ++++++++++++++---- components/script/dom/htmlimageelement.rs | 10 + .../webidls/CanvasRenderingContext2D.webidl | 4 +- components/script/lib.rs | 1 + components/servo/Cargo.lock | 1 + ports/cef/Cargo.lock | 1 + ports/gonk/Cargo.lock | 1 + ...html => test_canvas_drawimage_canvas.html} | 46 +--- .../test_canvas_drawimage_html_image.html | 209 +++++++++++++++++ ...awimage_1.html => drawimage_canvas_1.html} | 0 ...image_10.html => drawimage_canvas_10.html} | 11 +- ..._ref.html => drawimage_canvas_10_ref.html} | 0 ...image_11.html => drawimage_canvas_11.html} | 0 ..._ref.html => drawimage_canvas_11_ref.html} | 0 ...image_12.html => drawimage_canvas_12.html} | 4 +- ..._ref.html => drawimage_canvas_12_ref.html} | 0 ...1_ref.html => drawimage_canvas_1_ref.html} | 0 ...awimage_2.html => drawimage_canvas_2.html} | 0 ...2_ref.html => drawimage_canvas_2_ref.html} | 0 ...awimage_3.html => drawimage_canvas_3.html} | 0 ...3_ref.html => drawimage_canvas_3_ref.html} | 0 ...awimage_4.html => drawimage_canvas_4.html} | 0 ...4_ref.html => drawimage_canvas_4_ref.html} | 0 ...awimage_5.html => drawimage_canvas_5.html} | 3 +- ...5_ref.html => drawimage_canvas_5_ref.html} | 0 ...awimage_6.html => drawimage_canvas_6.html} | 0 ...6_ref.html => drawimage_canvas_6_ref.html} | 0 ...awimage_7.html => drawimage_canvas_7.html} | 0 ...7_ref.html => drawimage_canvas_7_ref.html} | 0 ...awimage_8.html => drawimage_canvas_8.html} | 0 ...8_ref.html => drawimage_canvas_8_ref.html} | 0 ...awimage_9.html => drawimage_canvas_9.html} | 0 ...9_ref.html => drawimage_canvas_9_ref.html} | 0 .../ref/2dcontext/drawimage_html_image_1.html | 34 +++ .../2dcontext/drawimage_html_image_10.html | 38 ++++ .../drawimage_html_image_10_ref.html | 19 ++ .../2dcontext/drawimage_html_image_11.html | 36 +++ .../drawimage_html_image_11_ref.html | 19 ++ .../2dcontext/drawimage_html_image_12.html | 36 +++ .../drawimage_html_image_12_ref.html | 32 +++ .../2dcontext/drawimage_html_image_13.html | 44 ++++ .../drawimage_html_image_13_ref.html | 20 ++ .../2dcontext/drawimage_html_image_1_ref.html | 19 ++ .../ref/2dcontext/drawimage_html_image_2.html | 35 +++ .../2dcontext/drawimage_html_image_2_ref.html | 23 ++ .../ref/2dcontext/drawimage_html_image_3.html | 35 +++ .../2dcontext/drawimage_html_image_3_ref.html | 23 ++ .../ref/2dcontext/drawimage_html_image_4.html | 36 +++ .../2dcontext/drawimage_html_image_4_ref.html | 29 +++ .../ref/2dcontext/drawimage_html_image_5.html | 35 +++ .../2dcontext/drawimage_html_image_5_ref.html | 39 ++++ .../ref/2dcontext/drawimage_html_image_6.html | 36 +++ .../2dcontext/drawimage_html_image_6_ref.html | 25 ++ .../ref/2dcontext/drawimage_html_image_7.html | 36 +++ .../2dcontext/drawimage_html_image_7_ref.html | 35 +++ .../ref/2dcontext/drawimage_html_image_8.html | 36 +++ .../2dcontext/drawimage_html_image_8_ref.html | 35 +++ .../ref/2dcontext/drawimage_html_image_9.html | 43 ++++ .../2dcontext/drawimage_html_image_9_ref.html | 19 ++ tests/ref/2x2.png | Bin 0 -> 788238 bytes tests/ref/basic.list | 38 +++- .../2d.drawImage.3arg.html.ini | 5 - .../2d.drawImage.5arg.html.ini | 5 - .../2d.drawImage.9arg.basic.html.ini | 5 - .../2d.drawImage.9arg.destpos.html.ini | 5 - .../2d.drawImage.9arg.destsize.html.ini | 5 - .../2d.drawImage.9arg.sourcepos.html.ini | 5 - .../2d.drawImage.9arg.sourcesize.html.ini | 5 - .../2d.drawImage.animated.apng.html.ini | 5 - .../2d.drawImage.animated.gif.html.ini | 5 - .../2d.drawImage.animated.poster.html.ini | 5 - .../2d.drawImage.floatsource.html.ini | 5 - .../2d.drawImage.nonfinite.html.ini | 5 - .../2d.drawImage.nowrap.html.ini | 5 - .../2d.drawImage.transform.html.ini | 5 - .../2d.drawImage.zerocanvas.html.ini | 5 - .../2d.drawImage.zerosource.html.ini | 5 - .../2d.shadow.canvas.transparent.1.html.ini | 5 - .../2d.shadow.canvas.transparent.2.html.ini | 1 - .../shadows/2d.shadow.image.section.html.ini | 5 - .../2d.shadow.image.transparent.1.html.ini | 5 - .../2d.shadow.image.transparent.2.html.ini | 1 - .../shadows/canvas_shadows_002.htm.ini | 4 + 86 files changed, 1380 insertions(+), 251 deletions(-) rename tests/html/{test_canvas_drawimage.html => test_canvas_drawimage_canvas.html} (83%) create mode 100644 tests/html/test_canvas_drawimage_html_image.html rename tests/ref/2dcontext/{drawimage_1.html => drawimage_canvas_1.html} (100%) rename tests/ref/2dcontext/{drawimage_10.html => drawimage_canvas_10.html} (77%) rename tests/ref/2dcontext/{drawimage_10_ref.html => drawimage_canvas_10_ref.html} (100%) rename tests/ref/2dcontext/{drawimage_11.html => drawimage_canvas_11.html} (100%) rename tests/ref/2dcontext/{drawimage_11_ref.html => drawimage_canvas_11_ref.html} (100%) rename tests/ref/2dcontext/{drawimage_12.html => drawimage_canvas_12.html} (89%) rename tests/ref/2dcontext/{drawimage_12_ref.html => drawimage_canvas_12_ref.html} (100%) rename tests/ref/2dcontext/{drawimage_1_ref.html => drawimage_canvas_1_ref.html} (100%) rename tests/ref/2dcontext/{drawimage_2.html => drawimage_canvas_2.html} (100%) rename tests/ref/2dcontext/{drawimage_2_ref.html => drawimage_canvas_2_ref.html} (100%) rename tests/ref/2dcontext/{drawimage_3.html => drawimage_canvas_3.html} (100%) rename tests/ref/2dcontext/{drawimage_3_ref.html => drawimage_canvas_3_ref.html} (100%) rename tests/ref/2dcontext/{drawimage_4.html => drawimage_canvas_4.html} (100%) rename tests/ref/2dcontext/{drawimage_4_ref.html => drawimage_canvas_4_ref.html} (100%) rename tests/ref/2dcontext/{drawimage_5.html => drawimage_canvas_5.html} (99%) rename tests/ref/2dcontext/{drawimage_5_ref.html => drawimage_canvas_5_ref.html} (100%) rename tests/ref/2dcontext/{drawimage_6.html => drawimage_canvas_6.html} (100%) rename tests/ref/2dcontext/{drawimage_6_ref.html => drawimage_canvas_6_ref.html} (100%) rename tests/ref/2dcontext/{drawimage_7.html => drawimage_canvas_7.html} (100%) rename tests/ref/2dcontext/{drawimage_7_ref.html => drawimage_canvas_7_ref.html} (100%) rename tests/ref/2dcontext/{drawimage_8.html => drawimage_canvas_8.html} (100%) rename tests/ref/2dcontext/{drawimage_8_ref.html => drawimage_canvas_8_ref.html} (100%) rename tests/ref/2dcontext/{drawimage_9.html => drawimage_canvas_9.html} (100%) rename tests/ref/2dcontext/{drawimage_9_ref.html => drawimage_canvas_9_ref.html} (100%) create mode 100644 tests/ref/2dcontext/drawimage_html_image_1.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_10.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_10_ref.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_11.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_11_ref.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_12.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_12_ref.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_13.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_13_ref.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_1_ref.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_2.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_2_ref.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_3.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_3_ref.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_4.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_4_ref.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_5.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_5_ref.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_6.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_6_ref.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_7.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_7_ref.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_8.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_8_ref.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_9.html create mode 100644 tests/ref/2dcontext/drawimage_html_image_9_ref.html create mode 100644 tests/ref/2x2.png delete mode 100644 tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.3arg.html.ini delete mode 100644 tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.5arg.html.ini delete mode 100644 tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.html.ini delete mode 100644 tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.html.ini delete mode 100644 tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.html.ini delete mode 100644 tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.html.ini delete mode 100644 tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.html.ini delete mode 100644 tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.animated.apng.html.ini delete mode 100644 tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.animated.gif.html.ini delete mode 100644 tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.animated.poster.html.ini delete mode 100644 tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.floatsource.html.ini delete mode 100644 tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.nonfinite.html.ini delete mode 100644 tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.nowrap.html.ini delete mode 100644 tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.transform.html.ini delete mode 100644 tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.zerocanvas.html.ini delete mode 100644 tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.zerosource.html.ini delete mode 100644 tests/wpt/metadata/2dcontext/shadows/2d.shadow.canvas.transparent.1.html.ini delete mode 100644 tests/wpt/metadata/2dcontext/shadows/2d.shadow.image.section.html.ini delete mode 100644 tests/wpt/metadata/2dcontext/shadows/2d.shadow.image.transparent.1.html.ini create mode 100644 tests/wpt/metadata/2dcontext/shadows/canvas_shadows_002.htm.ini diff --git a/components/canvas/canvas_paint_task.rs b/components/canvas/canvas_paint_task.rs index 403e4b2a3c7..aa4ac307f83 100644 --- a/components/canvas/canvas_paint_task.rs +++ b/components/canvas/canvas_paint_task.rs @@ -16,7 +16,7 @@ use util::vec::byte_swap; use cssparser::RGBA; use std::borrow::ToOwned; -use std::num::Float; +use std::num::{Float, ToPrimitive}; use std::sync::mpsc::{channel, Sender}; #[derive(Clone)] @@ -28,8 +28,8 @@ pub enum CanvasMsg { ClosePath, Fill, Stroke, - DrawImage(Vec, Rect, Rect, bool), - DrawImageSelf(Size2D, Rect, Rect, bool), + DrawImage(Vec, Size2D, Rect, Rect, bool), + DrawImageSelf(Size2D, Rect, Rect, bool), MoveTo(Point2D), LineTo(Point2D), QuadraticCurveTo(Point2D, Point2D), @@ -41,8 +41,8 @@ pub enum CanvasMsg { SetTransform(Matrix2D), Recreate(Size2D), SendPixelContents(Sender>), - GetImageData(Rect, Size2D, Sender>), - PutImageData(Vec, Rect, Option>), + GetImageData(Rect, Size2D, Sender>), + PutImageData(Vec, Rect, Option>), Close, } @@ -50,7 +50,9 @@ impl<'a> CanvasPaintTask<'a> { /// It reads image data from the canvas /// canvas_size: The size of the canvas we're reading from /// read_rect: The area of the canvas we want to read from - fn read_pixels(&self, read_rect: Rect, canvas_size: Size2D) -> Vec{ + fn read_pixels(&self, read_rect: Rect, canvas_size: Size2D) -> Vec{ + let read_rect = read_rect.to_i32(); + let canvas_size = canvas_size.to_i32(); let canvas_rect = Rect(Point2D(0i32, 0i32), canvas_size); let src_read_rect = canvas_rect.intersection(&read_rect).unwrap_or(Rect::zero()); @@ -81,9 +83,9 @@ impl<'a> CanvasPaintTask<'a> { /// dest_rect: The area of the canvas where the imagedata will be copied /// smoothing_enabled: if smoothing is applied to the copied pixels fn write_pixels(&self, imagedata: &[u8], - image_size: Size2D, - source_rect: Rect, - dest_rect: Rect, + image_size: Size2D, + source_rect: Rect, + dest_rect: Rect, smoothing_enabled: bool) { // From spec https://html.spec.whatwg.org/multipage/scripting.html#dom-context-2d-drawimage // When scaling up, if the imageSmoothingEnabled attribute is set to true, the user agent should attempt @@ -94,8 +96,11 @@ impl<'a> CanvasPaintTask<'a> { } else { Filter::Point }; + // azure_hl operates with integers. We need to cast the image size + let image_size = image_size.to_i32(); - let source_surface = self.drawtarget.create_source_surface_from_data(imagedata, + let source_surface = self.drawtarget.create_source_surface_from_data( + &imagedata, image_size, image_size.width * 4, SurfaceFormat::B8G8R8A8); let draw_surface_options = DrawSurfaceOptions::new(filter, true); @@ -112,33 +117,33 @@ impl<'a> CanvasPaintTask<'a> { /// Result: It retuns the modified dirty_rect by the rules described in /// the spec https://html.spec.whatwg.org/#dom-context-2d-putimagedata fn calculate_dirty_rect(&self, - mut dirty_rect: Rect, - image_data_rect: Rect) -> Rect{ + mut dirty_rect: Rect, + image_data_rect: Rect) -> Rect{ // 1) If dirtyWidth is negative, // let dirtyX be dirtyX+dirtyWidth, // and let dirtyWidth be equal to the absolute magnitude of dirtyWidth. - if dirty_rect.size.width < 0 { + if dirty_rect.size.width < 0.0f64 { dirty_rect.origin.x = dirty_rect.origin.x + dirty_rect.size.width; dirty_rect.size.width = -dirty_rect.size.width; } // 2) If dirtyHeight is negative, let dirtyY be dirtyY+dirtyHeight, // and let dirtyHeight be equal to the absolute magnitude of dirtyHeight. - if dirty_rect.size.height < 0 { + if dirty_rect.size.height < 0.0f64 { dirty_rect.origin.y = dirty_rect.origin.y + dirty_rect.size.height; dirty_rect.size.height = -dirty_rect.size.height; } // 3) If dirtyX is negative, let dirtyWidth be dirtyWidth+dirtyX, and let dirtyX be zero. - if dirty_rect.origin.x < 0 { + if dirty_rect.origin.x < 0.0f64 { dirty_rect.size.width += dirty_rect.origin.x; - dirty_rect.origin.x = 0; + dirty_rect.origin.x = 0.0f64; } // 3) If dirtyY is negative, let dirtyHeight be dirtyHeight+dirtyY, and let dirtyY be zero. - if dirty_rect.origin.y < 0 { + if dirty_rect.origin.y < 0.0f64 { dirty_rect.size.height += dirty_rect.origin.y; - dirty_rect.origin.y = 0; + dirty_rect.origin.y = 0.0f64; } // 4) If dirtyX+dirtyWidth is greater than the width attribute of the imagedata argument, @@ -157,21 +162,19 @@ impl<'a> CanvasPaintTask<'a> { } /// It writes an image to the destination canvas - /// imagedata: Pixel information of the image to be written - /// source_rect: Area of the source image to be copied + /// imagedata: Pixel information of the image to be written. It takes RGBA8 + /// image_size: The size of the image to be written /// dest_rect: Area of the destination canvas where the pixels will be copied /// smoothing_enabled: It determines if smoothing is applied to the image result fn write_image(&self, mut imagedata: Vec, - source_rect: Rect, dest_rect: Rect, smoothing_enabled: bool) { + image_size: Size2D, dest_rect: Rect, smoothing_enabled: bool) { if imagedata.len() == 0 { return } - // Image data already contains the portion of the image we want to draw - // so the source rect corresponds to the whole area of the copied imagedata - let source_rect = Rect(Point2D(0i32, 0i32), source_rect.size); + let image_rect = Rect(Point2D(0f64, 0f64), image_size); // rgba -> bgra byte_swap(imagedata.as_mut_slice()); - self.write_pixels(&imagedata, source_rect.size, source_rect, dest_rect, smoothing_enabled); + self.write_pixels(&imagedata, image_size, image_rect, dest_rect, smoothing_enabled); } } @@ -215,8 +218,8 @@ impl<'a> CanvasPaintTask<'a> { CanvasMsg::ClosePath => painter.close_path(), CanvasMsg::Fill => painter.fill(), CanvasMsg::Stroke => painter.stroke(), - CanvasMsg::DrawImage(imagedata, dest_rect, source_rect, smoothing_enabled) => { - painter.draw_image(imagedata, dest_rect, source_rect, smoothing_enabled) + CanvasMsg::DrawImage(imagedata, image_size, dest_rect, source_rect, smoothing_enabled) => { + painter.draw_image(imagedata, image_size, dest_rect, source_rect, smoothing_enabled) } CanvasMsg::DrawImageSelf(image_size, dest_rect, source_rect, smoothing_enabled) => { painter.draw_image_self(image_size, dest_rect, source_rect, smoothing_enabled) @@ -304,19 +307,23 @@ impl<'a> CanvasPaintTask<'a> { }; } - fn draw_image(&self, imagedata: Vec, dest_rect: Rect, - source_rect: Rect, smoothing_enabled: bool) { - self.write_image(imagedata, source_rect, dest_rect, smoothing_enabled); + fn draw_image(&self, image_data: Vec, image_size: Size2D, + dest_rect: Rect, source_rect: Rect, smoothing_enabled: bool) { + // We round up the floating pixel values to draw the pixels + let source_rect = source_rect.ceil(); + // It discards the extra pixels (if any) that won't be painted + let image_data = crop_image(image_data, image_size, source_rect); + self.write_image(image_data, source_rect.size, dest_rect, smoothing_enabled); } - fn draw_image_self(&self, image_size: Size2D, - dest_rect: Rect, source_rect: Rect, + fn draw_image_self(&self, image_size: Size2D, + dest_rect: Rect, source_rect: Rect, smoothing_enabled: bool) { // Reads pixels from source image // In this case source and target are the same canvas let imagedata = self.read_pixels(source_rect, image_size); // Writes on target canvas - self.write_image(imagedata, source_rect, dest_rect, smoothing_enabled); + self.write_image(imagedata, image_size, dest_rect, smoothing_enabled); } fn move_to(&self, point: &Point2D) { @@ -431,20 +438,20 @@ impl<'a> CanvasPaintTask<'a> { }) } - fn get_image_data(&self, mut dest_rect: Rect, canvas_size: Size2D, chan: Sender>) { - if dest_rect.size.width < 0 { + fn get_image_data(&self, mut dest_rect: Rect, canvas_size: Size2D, chan: Sender>) { + if dest_rect.size.width < 0.0 { dest_rect.size.width = -dest_rect.size.width; dest_rect.origin.x -= dest_rect.size.width; } - if dest_rect.size.height < 0 { + if dest_rect.size.height < 0.0 { dest_rect.size.height = -dest_rect.size.height; dest_rect.origin.y -= dest_rect.size.height; } - if dest_rect.size.width == 0 { - dest_rect.size.width = 1; + if dest_rect.size.width == 0.0 { + dest_rect.size.width = 1.0; } - if dest_rect.size.height == 0 { - dest_rect.size.height = 1; + if dest_rect.size.height == 0.0 { + dest_rect.size.height = 1.0; } let mut dest_data = self.read_pixels(dest_rect, canvas_size); @@ -455,18 +462,18 @@ impl<'a> CanvasPaintTask<'a> { } fn put_image_data(&mut self, mut imagedata: Vec, - image_data_rect: Rect, - dirty_rect: Option>) { + image_data_rect: Rect, + dirty_rect: Option>) { - if image_data_rect.size.width <= 0 || image_data_rect.size.height <= 0 { + if image_data_rect.size.width <= 0.0 || image_data_rect.size.height <= 0.0 { return } - assert!(image_data_rect.size.width * image_data_rect.size.height * 4 == imagedata.len() as i32); + assert!(image_data_rect.size.width * image_data_rect.size.height * 4.0 == imagedata.len() as f64); // rgba -> bgra byte_swap(imagedata.as_mut_slice()); - let image_rect = Rect(Point2D(0i32, 0i32), + let image_rect = Rect(Point2D(0f64, 0f64), Size2D(image_data_rect.size.width, image_data_rect.size.height)); // Dirty rectangle defines the area of the source image to be copied @@ -481,7 +488,7 @@ impl<'a> CanvasPaintTask<'a> { // 5) If either dirtyWidth or dirtyHeight is negative or zero, // stop without affecting any bitmaps - if source_rect.size.width <= 0 || source_rect.size.height <= 0 { + if source_rect.size.width <= 0.0 || source_rect.size.height <= 0.0 { return } @@ -603,11 +610,75 @@ impl FillOrStrokeStyle { } } +/// Used by drawImage to get rid of the extra pixels of the image data that +/// won't be copied to the canvas +/// image_data: Color pixel data of the image +/// image_size: Image dimensions +/// crop_rect: It determines the area of the image we want to keep +fn crop_image(image_data: Vec, + image_size: Size2D, + crop_rect: Rect) -> Vec{ + // We're going to iterate over a pixel values array so we need integers + let crop_rect = crop_rect.to_i32(); + let image_size = image_size.to_i32(); + // Assuming 4 bytes per pixel and row-major order for storage + // (consecutive elements in a pixel row of the image are contiguous in memory) + let stride = image_size.width * 4; + let image_bytes_length = image_size.height * image_size.width * 4; + let crop_area_bytes_length = crop_rect.size.height * crop_rect.size.height * 4; + // If the image size is less or equal than the crop area we do nothing + if image_bytes_length <= crop_area_bytes_length { + return image_data; + } + + let mut new_image_data = Vec::new(); + let mut src = (crop_rect.origin.y * stride + crop_rect.origin.x * 4) as usize; + for _ in (0..crop_rect.size.height) { + let row = &image_data[src .. src + (4 * crop_rect.size.width) as usize]; + new_image_data.push_all(row); + src += stride as usize; + } + new_image_data +} + +pub trait SizeToi32 { + fn to_i32(&self) -> Size2D; +} + +impl SizeToi32 for Size2D { + fn to_i32(&self) -> Size2D { + Size2D(self.width.to_i32().unwrap(), + self.height.to_i32().unwrap()) + } +} + +pub trait RectToi32 { + fn to_i32(&self) -> Rect; + fn ceil(&self) -> Rect; +} + +impl RectToi32 for Rect { + fn to_i32(&self) -> Rect { + Rect(Point2D(self.origin.x.to_i32().unwrap(), + self.origin.y.to_i32().unwrap()), + Size2D(self.size.width.to_i32().unwrap(), + self.size.height.to_i32().unwrap())) + } + + fn ceil(&self) -> Rect { + Rect(Point2D(self.origin.x.ceil(), + self.origin.y.ceil()), + Size2D(self.size.width.ceil(), + self.size.height.ceil())) + } + +} + pub trait ToAzFloat { fn to_azfloat(&self) -> Rect; } -impl ToAzFloat for Rect { +impl ToAzFloat for Rect { fn to_azfloat(&self) -> Rect { Rect(Point2D(self.origin.x as AzFloat, self.origin.y as AzFloat), Size2D(self.size.width as AzFloat, self.size.height as AzFloat)) diff --git a/components/canvas/lib.rs b/components/canvas/lib.rs index dba859dc9df..2b5c51feec1 100644 --- a/components/canvas/lib.rs +++ b/components/canvas/lib.rs @@ -3,6 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #![feature(collections)] +#![feature(core)] #![feature(std_misc)] extern crate azure; diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index 9e7db847a86..63eaea80142 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -57,6 +57,9 @@ git = "https://github.com/servo/html5ever" [dependencies.js] git = "https://github.com/servo/rust-mozjs" +[dependencies.png] +git = "https://github.com/servo/rust-png" + [dependencies.uuid] git = "https://github.com/rust-lang/uuid" diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs index fc8573923d0..b4863d876a2 100644 --- a/components/script/dom/canvasrenderingcontext2d.rs +++ b/components/script/dom/canvasrenderingcontext2d.rs @@ -6,9 +6,9 @@ use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding; use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasRenderingContext2DMethods; use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasWindingRule; use dom::bindings::codegen::Bindings::ImageDataBinding::ImageDataMethods; -use dom::bindings::codegen::UnionTypes::HTMLCanvasElementOrCanvasRenderingContext2D; +use dom::bindings::codegen::UnionTypes::HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D; use dom::bindings::codegen::UnionTypes::StringOrCanvasGradientOrCanvasPattern; -use dom::bindings::error::Error::{IndexSize, NotSupported, Type}; +use dom::bindings::error::Error::{IndexSize, NotSupported, Type, InvalidState}; use dom::bindings::error::Fallible; use dom::bindings::global::{GlobalRef, GlobalField}; use dom::bindings::js::{JS, JSRef, LayoutJS, Temporary}; @@ -16,7 +16,9 @@ use dom::bindings::num::Finite; use dom::bindings::utils::{Reflector, reflect_dom_object}; use dom::canvasgradient::{CanvasGradient, CanvasGradientStyle, ToFillOrStrokeStyle}; use dom::htmlcanvaselement::{HTMLCanvasElement, HTMLCanvasElementHelpers}; +use dom::htmlimageelement::{HTMLImageElement, HTMLImageElementHelpers}; use dom::imagedata::{ImageData, ImageDataHelpers}; +use dom::node::{window_from_node}; use cssparser::Color as CSSColor; use cssparser::{Parser, RGBA, ToCss}; @@ -28,11 +30,19 @@ use geom::size::Size2D; use canvas::canvas_paint_task::{CanvasMsg, CanvasPaintTask, FillOrStrokeStyle}; use canvas::canvas_paint_task::{LinearGradientStyle, RadialGradientStyle}; +use net_traits::image::base::Image; +use net_traits::image_cache_task::{ImageResponseMsg, Msg}; +use png::PixelsByColorType; + use std::borrow::ToOwned; use std::cell::Cell; use std::num::{Float, ToPrimitive}; +use std::sync::{Arc}; use std::sync::mpsc::{channel, Sender}; +use url::Url; +use util::vec::byte_swap; + #[dom_struct] pub struct CanvasRenderingContext2D { reflector_: Reflector, @@ -85,10 +95,9 @@ impl CanvasRenderingContext2D { // source rectangle = area of the original image to be copied // destination rectangle = area of the destination canvas where the source image is going to be drawn fn adjust_source_dest_rects(&self, - canvas: JSRef, + image_size: Size2D, sx: f64, sy: f64, sw: f64, sh: f64, - dx: f64, dy: f64, dw: f64, dh: f64) -> (Rect, Rect) { - let image_size = canvas.get_size(); + dx: f64, dy: f64, dw: f64, dh: f64) -> (Rect, Rect) { let image_rect = Rect(Point2D(0f64, 0f64), Size2D(image_size.width as f64, image_size.height as f64)); @@ -112,15 +121,13 @@ impl CanvasRenderingContext2D { // The destination rectangle is the rectangle whose corners are the four points (dx, dy), // (dx+dw, dy), (dx+dw, dy+dh), (dx, dy+dh). - let dest_rect = Rect(Point2D(dx.to_i32().unwrap(), - dy.to_i32().unwrap()), - Size2D(dest_rect_width_scaled.to_i32().unwrap(), - dest_rect_height_scaled.to_i32().unwrap())); + let dest_rect = Rect(Point2D(dx, dy), + Size2D(dest_rect_width_scaled, dest_rect_height_scaled)); - let source_rect = Rect(Point2D(source_rect_clipped.origin.x.to_i32().unwrap(), - source_rect_clipped.origin.y.to_i32().unwrap()), - Size2D(source_rect_clipped.size.width.to_i32().unwrap(), - source_rect_clipped.size.height.to_i32().unwrap())); + let source_rect = Rect(Point2D(source_rect_clipped.origin.x, + source_rect_clipped.origin.y), + Size2D(source_rect_clipped.size.width, + source_rect_clipped.size.height)); return (source_rect, dest_rect) } @@ -150,39 +157,103 @@ impl CanvasRenderingContext2D { canvas: JSRef, sx: f64, sy: f64, sw: f64, sh: f64, dx: f64, dy: f64, dw: f64, dh: f64) -> Fallible<()> { - // 1. Check the usability of the image argument if !canvas.is_valid() { - return Ok(()) + return Err(InvalidState) } + let canvas_size = canvas.get_size(); + let image_size = Size2D(canvas_size.width as f64, canvas_size.height as f64); // 2. Establish the source and destination rectangles - let (source_rect, dest_rect) = self.adjust_source_dest_rects(canvas, sx, sy, sw, sh, dx, dy, dw, dh); + let (source_rect, dest_rect) = self.adjust_source_dest_rects(image_size, sx, sy, sw, sh, dx, dy, dw, dh); if !is_rect_valid(source_rect) || !is_rect_valid(dest_rect) { return Err(IndexSize) } let smoothing_enabled = self.image_smoothing_enabled.get(); - let canvas_size = canvas.get_size(); // If the source and target canvas are the same let msg = if self.canvas.root().r() == canvas { - CanvasMsg::DrawImageSelf(canvas_size, dest_rect, source_rect, smoothing_enabled) + CanvasMsg::DrawImageSelf(image_size, dest_rect, source_rect, smoothing_enabled) } else { // Source and target canvases are different let context = canvas.get_2d_context().root(); let renderer = context.r().get_renderer(); let (sender, receiver) = channel::>(); // Reads pixels from source image - renderer.send(CanvasMsg::GetImageData(source_rect, canvas_size, sender)).unwrap(); + renderer.send(CanvasMsg::GetImageData(source_rect, image_size, sender)).unwrap(); let imagedata = receiver.recv().unwrap(); // Writes pixels to destination canvas - CanvasMsg::DrawImage(imagedata, dest_rect, source_rect, smoothing_enabled) + CanvasMsg::DrawImage(imagedata, source_rect.size, dest_rect, source_rect, smoothing_enabled) }; self.renderer.send(msg).unwrap(); Ok(()) } + + fn draw_image_data(&self, + image_data: Vec, + image_size: Size2D, + sx: f64, sy: f64, sw: f64, sh: f64, + dx: f64, dy: f64, dw: f64, dh: f64) -> Fallible<()> { + // Establish the source and destination rectangles + let (source_rect, dest_rect) = self.adjust_source_dest_rects(image_size, sx, sy, sw, sh, dx, dy, dw, dh); + + if !is_rect_valid(source_rect) || !is_rect_valid(dest_rect) { + return Err(IndexSize) + } + + let smoothing_enabled = self.image_smoothing_enabled.get(); + self.renderer.send(CanvasMsg::DrawImage( + image_data, image_size, dest_rect, + source_rect, smoothing_enabled)).unwrap(); + Ok(()) + } + + fn fetch_image_data(&self, + image_element: &JSRef) + -> Option<(Vec, Size2D)> { + let url = match image_element.get_url() { + Some(url) => url, + None => return None, + }; + + let img = match self.request_image_from_cache(url) { + Some(img) => img, + None => return None, + }; + + let image_size = Size2D(img.width as f64, img.height as f64); + let mut image_data = match img.pixels { + PixelsByColorType::RGBA8(ref pixels) => pixels.to_vec(), + PixelsByColorType::K8(_) => panic!("K8 color type not supported"), + PixelsByColorType::RGB8(_) => panic!("RGB8 color type not supported"), + PixelsByColorType::KA8(_) => panic!("KA8 color type not supported"), + }; + // Pixels come from cache in BGRA order and drawImage expects RGBA so we + // have to swap the color values + { + let mut pixel_colors = image_data.as_mut_slice(); + byte_swap(pixel_colors); + } + return Some((image_data, image_size)); + } + + fn request_image_from_cache(&self, url: Url) -> Option>> { + let canvas = self.canvas.root(); + let window = window_from_node(canvas.r()).root(); + let window = window.r(); + let image_cache_task = window.image_cache_task().clone(); + image_cache_task.send(Msg::Prefetch(url.clone())); + image_cache_task.send(Msg::Decode(url.clone())); + let (response_chan, response_port) = channel(); + image_cache_task.send(Msg::WaitForImage(url, response_chan)); + match response_port.recv().unwrap() { + ImageResponseMsg::ImageReady(image) => Some(image), + ImageResponseMsg::ImageFailed => None, + _ => panic!("Image Cache: Unknown Result") + } + } } pub trait CanvasRenderingContext2DHelpers { @@ -316,7 +387,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> } // https://html.spec.whatwg.org/multipage/scripting.html#dom-context-2d-drawimage - fn DrawImage(self, image: HTMLCanvasElementOrCanvasRenderingContext2D, + fn DrawImage(self, image: HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D, dx: f64, dy: f64) -> Fallible<()> { if !(dx.is_finite() && dy.is_finite()) { return Ok(()); @@ -330,7 +401,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> let sy: f64 = 0f64; match image { - HTMLCanvasElementOrCanvasRenderingContext2D::eHTMLCanvasElement(image) => { + HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eHTMLCanvasElement(image) => { let canvas = image.root(); let canvas_size = canvas.r().get_size(); let dw: f64 = canvas_size.width as f64; @@ -341,7 +412,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> sx, sy, sw, sh, dx, dy, dw, dh) } - HTMLCanvasElementOrCanvasRenderingContext2D::eCanvasRenderingContext2D(image) => { + HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eCanvasRenderingContext2D(image) => { let image = image.root(); let context = image.r(); let canvas = context.Canvas().root(); @@ -354,11 +425,31 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> sx, sy, sw, sh, dx, dy, dw, dh) } + HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eHTMLImageElement(image) => { + let image = image.root(); + let image_element = image.r(); + // https://html.spec.whatwg.org/multipage/embedded-content.html#img-error + // If the image argument is an HTMLImageElement object that is in the broken state, + // then throw an InvalidStateError exception + let (image_data, image_size) = match self.fetch_image_data(&image_element) { + Some((data, size)) => (data, size), + None => return Err(InvalidState), + }; + let dw: f64 = image_size.width as f64; + let dh: f64 = image_size.height as f64; + let sw: f64 = dw; + let sh: f64 = dh; + return self.draw_image_data(image_data, + image_size, + sx, sy, sw, sh, + dx, dy, dw, dh) + } + } } // https://html.spec.whatwg.org/multipage/scripting.html#dom-context-2d-drawimage - fn DrawImage_(self, image: HTMLCanvasElementOrCanvasRenderingContext2D, + fn DrawImage_(self, image: HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D, dx: f64, dy: f64, dw: f64, dh: f64) -> Fallible<()> { if !(dx.is_finite() && dy.is_finite() && dw.is_finite() && dh.is_finite()) { @@ -373,7 +464,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> let sy: f64 = 0f64; match image { - HTMLCanvasElementOrCanvasRenderingContext2D::eHTMLCanvasElement(image) => { + HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eHTMLCanvasElement(image) => { let canvas = image.root(); let canvas_size = canvas.r().get_size(); let sw: f64 = canvas_size.width as f64; @@ -382,7 +473,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> sx, sy, sw, sh, dx, dy, dw, dh) } - HTMLCanvasElementOrCanvasRenderingContext2D::eCanvasRenderingContext2D(image) => { + HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eCanvasRenderingContext2D(image) => { let image = image.root(); let context = image.r(); let canvas = context.Canvas().root(); @@ -393,11 +484,28 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> sx, sy, sw, sh, dx, dy, dw, dh) } + HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eHTMLImageElement(image) => { + let image = image.root(); + let image_element = image.r(); + // https://html.spec.whatwg.org/multipage/embedded-content.html#img-error + // If the image argument is an HTMLImageElement object that is in the broken state, + // then throw an InvalidStateError exception + let (image_data, image_size) = match self.fetch_image_data(&image_element) { + Some((data, size)) => (data, size), + None => return Err(InvalidState), + }; + let sw: f64 = image_size.width as f64; + let sh: f64 = image_size.height as f64; + return self.draw_image_data(image_data, + image_size, + sx, sy, sw, sh, + dx, dy, dw, dh) + } } } // https://html.spec.whatwg.org/multipage/scripting.html#dom-context-2d-drawimage - fn DrawImage__(self, image: HTMLCanvasElementOrCanvasRenderingContext2D, + fn DrawImage__(self, image: HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D, sx: f64, sy: f64, sw: f64, sh: f64, dx: f64, dy: f64, dw: f64, dh: f64) -> Fallible<()> { if !(sx.is_finite() && sy.is_finite() && sw.is_finite() && sh.is_finite() && @@ -406,13 +514,13 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> } match image { - HTMLCanvasElementOrCanvasRenderingContext2D::eHTMLCanvasElement(image) => { + HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eHTMLCanvasElement(image) => { let canvas = image.root(); return self.draw_html_canvas_element(canvas.r(), sx, sy, sw, sh, dx, dy, dw, dh) } - HTMLCanvasElementOrCanvasRenderingContext2D::eCanvasRenderingContext2D(image) => { + HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eCanvasRenderingContext2D(image) => { let image = image.root(); let context = image.r(); let canvas = context.Canvas().root(); @@ -420,6 +528,21 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> sx, sy, sw, sh, dx, dy, dw, dh) } + HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eHTMLImageElement(image) => { + let image = image.root(); + let image_element = image.r(); + // https://html.spec.whatwg.org/multipage/embedded-content.html#img-error + // If the image argument is an HTMLImageElement object that is in the broken state, + // then throw an InvalidStateError exception + let (image_data, image_size) = match self.fetch_image_data(&image_element) { + Some((data, size)) => (data, size), + None => return Err(InvalidState), + }; + return self.draw_image_data(image_data, + image_size, + sx, sy, sw, sh, + dx, dy, dw, dh) + } } } @@ -574,6 +697,8 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> } fn GetImageData(self, sx: Finite, sy: Finite, sw: Finite, sh: Finite) -> Fallible> { + let sx = *sx; + let sy = *sy; let sw = *sw; let sh = *sh; @@ -582,14 +707,18 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> } let (sender, receiver) = channel::>(); - let dest_rect = Rect(Point2D(sx.to_i32().unwrap(), sy.to_i32().unwrap()), Size2D(sw.to_i32().unwrap(), sh.to_i32().unwrap())); + let dest_rect = Rect(Point2D(sx as f64, sy as f64), Size2D(sw as f64, sh as f64)); let canvas_size = self.canvas.root().r().get_size(); + let canvas_size = Size2D(canvas_size.width as f64, canvas_size.height as f64); self.renderer.send(CanvasMsg::GetImageData(dest_rect, canvas_size, sender)).unwrap(); let data = receiver.recv().unwrap(); Ok(ImageData::new(self.global.root().r(), sw.abs().to_u32().unwrap(), sh.abs().to_u32().unwrap(), Some(data))) } fn PutImageData(self, imagedata: JSRef, dx: Finite, dy: Finite) { + let dx = *dx; + let dy = *dy; + // XXX: // By the spec: http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas_CR/#dom-context-2d-putimagedata // "If any of the arguments to the method are infinite or NaN, the method must throw a NotSupportedError exception" @@ -597,13 +726,22 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> // they will be TypeError by WebIDL spec before call this methods. let data = imagedata.get_data_array(&self.global.root().r()); - let image_data_rect = Rect(Point2D(dx.to_i32().unwrap(), dy.to_i32().unwrap()), imagedata.get_size()); + let image_data_size = imagedata.get_size(); + let image_data_size = Size2D(image_data_size.width as f64, image_data_size.height as f64); + let image_data_rect = Rect(Point2D(dx, dy), image_data_size); let dirty_rect = None; self.renderer.send(CanvasMsg::PutImageData(data, image_data_rect, dirty_rect)).unwrap() } fn PutImageData_(self, imagedata: JSRef, dx: Finite, dy: Finite, dirtyX: Finite, dirtyY: Finite, dirtyWidth: Finite, dirtyHeight: Finite) { + let dx = *dx; + let dy = *dy; + let dirtyX = *dirtyX; + let dirtyY = *dirtyY; + let dirtyWidth = *dirtyWidth; + let dirtyHeight = *dirtyHeight; + // XXX: // By the spec: http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas_CR/#dom-context-2d-putimagedata // "If any of the arguments to the method are infinite or NaN, the method must throw a NotSupportedError exception" @@ -611,12 +749,11 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> // they will be TypeError by WebIDL spec before call this methods. let data = imagedata.get_data_array(&self.global.root().r()); - let image_data_rect = Rect(Point2D(dx.to_i32().unwrap(), dy.to_i32().unwrap()), - Size2D(imagedata.Width().to_i32().unwrap(), - imagedata.Height().to_i32().unwrap())); - let dirty_rect = Some(Rect(Point2D(dirtyX.to_i32().unwrap(), dirtyY.to_i32().unwrap()), - Size2D(dirtyWidth.to_i32().unwrap(), - dirtyHeight.to_i32().unwrap()))); + let image_data_rect = Rect(Point2D(dx, dy), + Size2D(imagedata.Width() as f64, + imagedata.Height() as f64)); + let dirty_rect = Some(Rect(Point2D(dirtyX, dirtyY), + Size2D(dirtyWidth, dirtyHeight))); self.renderer.send(CanvasMsg::PutImageData(data, image_data_rect, dirty_rect)).unwrap() } @@ -667,6 +804,6 @@ pub fn parse_color(string: &str) -> Result { // Used by drawImage to determine if a source or destination rectangle is valid // Origin coordinates and size cannot be negative. Size has to be greater than zero -fn is_rect_valid(rect: Rect) -> bool { - rect.origin.x >= 0 && rect.origin.y >= 0 && rect.size.width > 0 && rect.size.height > 0 +fn is_rect_valid(rect: Rect) -> bool { + rect.size.width > 0.0 && rect.size.height > 0.0 } diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index dadcd776238..f93d525f1fc 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -39,6 +39,16 @@ impl HTMLImageElementDerived for EventTarget { } } +pub trait HTMLImageElementHelpers { + fn get_url(&self) -> Option; +} + +impl<'a> HTMLImageElementHelpers for JSRef<'a, HTMLImageElement> { + fn get_url(&self) -> Option{ + self.image.borrow().clone() + } +} + trait PrivateHTMLImageElementHelpers { fn update_image(self, value: Option<(DOMString, &Url)>); } diff --git a/components/script/dom/webidls/CanvasRenderingContext2D.webidl b/components/script/dom/webidls/CanvasRenderingContext2D.webidl index 511a26ae66b..44f6d8d3251 100644 --- a/components/script/dom/webidls/CanvasRenderingContext2D.webidl +++ b/components/script/dom/webidls/CanvasRenderingContext2D.webidl @@ -6,8 +6,8 @@ enum CanvasWindingRule { "nonzero", "evenodd" }; // http://www.whatwg.org/html/#2dcontext -typedef (/* HTMLImageElement or - HTMLVideoElement or */ +typedef (HTMLImageElement or + /* HTMLVideoElement or */ HTMLCanvasElement or CanvasRenderingContext2D /* or ImageBitmap */) CanvasImageSource; diff --git a/components/script/lib.rs b/components/script/lib.rs index 75699c419cc..c51219cb11d 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -39,6 +39,7 @@ extern crate js; extern crate libc; extern crate msg; extern crate net_traits; +extern crate png; extern crate "rustc-serialize" as rustc_serialize; extern crate time; extern crate canvas; diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index acf5eb43377..67fac783c24 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -803,6 +803,7 @@ dependencies = [ "msg 0.0.1", "net_traits 0.0.1", "plugins 0.0.1", + "png 0.1.0 (git+https://github.com/servo/rust-png)", "profile 0.0.1", "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "script_traits 0.0.1", diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index e274f8ba6b4..7cd06499343 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -807,6 +807,7 @@ dependencies = [ "msg 0.0.1", "net_traits 0.0.1", "plugins 0.0.1", + "png 0.1.0 (git+https://github.com/servo/rust-png)", "profile 0.0.1", "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "script_traits 0.0.1", diff --git a/ports/gonk/Cargo.lock b/ports/gonk/Cargo.lock index 7f07df26684..ddc5afd7988 100644 --- a/ports/gonk/Cargo.lock +++ b/ports/gonk/Cargo.lock @@ -732,6 +732,7 @@ dependencies = [ "msg 0.0.1", "net_traits 0.0.1", "plugins 0.0.1", + "png 0.1.0 (git+https://github.com/servo/rust-png)", "profile 0.0.1", "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "script_traits 0.0.1", diff --git a/tests/html/test_canvas_drawimage.html b/tests/html/test_canvas_drawimage_canvas.html similarity index 83% rename from tests/html/test_canvas_drawimage.html rename to tests/html/test_canvas_drawimage_canvas.html index 54a7082f9f3..fdf00daee39 100644 --- a/tests/html/test_canvas_drawimage.html +++ b/tests/html/test_canvas_drawimage_canvas.html @@ -171,50 +171,6 @@ function renderExample(title) { return container; } -function drawImage() { - var args = Array.prototype.slice.call(arguments); - - var div = renderExample('drawImage(' + args.toString() + ')'); - var canvasEls = div.querySelectorAll('canvas'); - var canvas1 = canvasEls[0]; - var canvas2 = canvasEls[1]; - - canvas1.width = imageSource.width; - canvas1.height = imageSource.height; - - var ctx1 = canvas1.getContext('2d'); - ctx1.fillStyle = "#00FFFF"; - ctx1.fillRect(0, 0, imageSource.width, imageSource.height); - - ctx1.fillStyle = "#000000"; - ctx1.fillRect(5,5,40,40); - ctx1.clearRect(10,10,30,30); - ctx1.strokeRect(15,15,20,20); - - canvas2.width = destCanvas.width; - canvas2.height = destCanvas.height; - - var ctx2 = canvas2.getContext('2d'); - ctx2.fillStyle = "#FF0000"; - ctx2.fillRect(0, 0, destCanvas.width, destCanvas.height); - ctx2.imageSmoothingEnabled = smoothingEnabled; - - args.unshift(canvas1); - try { - ctx2.drawImage.apply(ctx2, args); - } - catch(err) { - var title = div.querySelector('.example-title'); - var error = document.createElement('h2'); - error.setAttribute('class', 'example-title error'); - div.insertBefore(error, title); - error.textContent += "Call Failed: " + err.message; - } - - document.body.appendChild(div); -}; - - function drawImage() { var args = Array.prototype.slice.call(arguments); @@ -260,4 +216,4 @@ function drawImage() { - \ No newline at end of file + diff --git a/tests/html/test_canvas_drawimage_html_image.html b/tests/html/test_canvas_drawimage_html_image.html new file mode 100644 index 00000000000..c317f7895df --- /dev/null +++ b/tests/html/test_canvas_drawimage_html_image.html @@ -0,0 +1,209 @@ + + + + + + + +

DrawImage canvas to canvas

+ + + + + diff --git a/tests/ref/2dcontext/drawimage_1.html b/tests/ref/2dcontext/drawimage_canvas_1.html similarity index 100% rename from tests/ref/2dcontext/drawimage_1.html rename to tests/ref/2dcontext/drawimage_canvas_1.html diff --git a/tests/ref/2dcontext/drawimage_10.html b/tests/ref/2dcontext/drawimage_canvas_10.html similarity index 77% rename from tests/ref/2dcontext/drawimage_10.html rename to tests/ref/2dcontext/drawimage_canvas_10.html index 0430a54d1c0..35f7245c563 100644 --- a/tests/ref/2dcontext/drawimage_10.html +++ b/tests/ref/2dcontext/drawimage_canvas_10.html @@ -31,12 +31,13 @@ destCtx.fillStyle = "#FF0000"; destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height); destCtx.imageSmoothingEnabled = smoothingEnabled; -// The destination rectangle is larger thant the destination canvas -// When the destination rectangle is outside the destination image (the scratch bitmap), the pixels -// that land outside the scratch bitmap are discarded, as if the destination was an infinite canvas -// whose rendering was clipped to the dimensions of the scratch bitmap. +// The destination rectangle is larger than the destination canvas +// When the destination rectangle is outside the destination image (the scratch bitmap), +// the pixels that land outside the scratch bitmap are discarded, +// as if the destination was an infinite canvas whose rendering was +// clipped to the dimensions of the scratch bitmap. destCtx.drawImage(sourceCanvas, 0, 0, 50, 50, 0, 0, 200, 200); - \ No newline at end of file + diff --git a/tests/ref/2dcontext/drawimage_10_ref.html b/tests/ref/2dcontext/drawimage_canvas_10_ref.html similarity index 100% rename from tests/ref/2dcontext/drawimage_10_ref.html rename to tests/ref/2dcontext/drawimage_canvas_10_ref.html diff --git a/tests/ref/2dcontext/drawimage_11.html b/tests/ref/2dcontext/drawimage_canvas_11.html similarity index 100% rename from tests/ref/2dcontext/drawimage_11.html rename to tests/ref/2dcontext/drawimage_canvas_11.html diff --git a/tests/ref/2dcontext/drawimage_11_ref.html b/tests/ref/2dcontext/drawimage_canvas_11_ref.html similarity index 100% rename from tests/ref/2dcontext/drawimage_11_ref.html rename to tests/ref/2dcontext/drawimage_canvas_11_ref.html diff --git a/tests/ref/2dcontext/drawimage_12.html b/tests/ref/2dcontext/drawimage_canvas_12.html similarity index 89% rename from tests/ref/2dcontext/drawimage_12.html rename to tests/ref/2dcontext/drawimage_canvas_12.html index f667f9fa093..36a31cbaf2c 100644 --- a/tests/ref/2dcontext/drawimage_12.html +++ b/tests/ref/2dcontext/drawimage_canvas_12.html @@ -31,9 +31,9 @@ destCtx.fillStyle = "#FF0000"; destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height); destCtx.imageSmoothingEnabled = smoothingEnabled; -// Negative coorditanes of the source rectangle +// Negative coordinates of the source rectangle // The source area is clipped to fit the source image -// and the destination are is clipped in the same proportion +// and the destination area is clipped in the same proportion destCtx.drawImage(sourceCanvas, -25, -25, 50, 50, 0, 0, 50, 50); diff --git a/tests/ref/2dcontext/drawimage_12_ref.html b/tests/ref/2dcontext/drawimage_canvas_12_ref.html similarity index 100% rename from tests/ref/2dcontext/drawimage_12_ref.html rename to tests/ref/2dcontext/drawimage_canvas_12_ref.html diff --git a/tests/ref/2dcontext/drawimage_1_ref.html b/tests/ref/2dcontext/drawimage_canvas_1_ref.html similarity index 100% rename from tests/ref/2dcontext/drawimage_1_ref.html rename to tests/ref/2dcontext/drawimage_canvas_1_ref.html diff --git a/tests/ref/2dcontext/drawimage_2.html b/tests/ref/2dcontext/drawimage_canvas_2.html similarity index 100% rename from tests/ref/2dcontext/drawimage_2.html rename to tests/ref/2dcontext/drawimage_canvas_2.html diff --git a/tests/ref/2dcontext/drawimage_2_ref.html b/tests/ref/2dcontext/drawimage_canvas_2_ref.html similarity index 100% rename from tests/ref/2dcontext/drawimage_2_ref.html rename to tests/ref/2dcontext/drawimage_canvas_2_ref.html diff --git a/tests/ref/2dcontext/drawimage_3.html b/tests/ref/2dcontext/drawimage_canvas_3.html similarity index 100% rename from tests/ref/2dcontext/drawimage_3.html rename to tests/ref/2dcontext/drawimage_canvas_3.html diff --git a/tests/ref/2dcontext/drawimage_3_ref.html b/tests/ref/2dcontext/drawimage_canvas_3_ref.html similarity index 100% rename from tests/ref/2dcontext/drawimage_3_ref.html rename to tests/ref/2dcontext/drawimage_canvas_3_ref.html diff --git a/tests/ref/2dcontext/drawimage_4.html b/tests/ref/2dcontext/drawimage_canvas_4.html similarity index 100% rename from tests/ref/2dcontext/drawimage_4.html rename to tests/ref/2dcontext/drawimage_canvas_4.html diff --git a/tests/ref/2dcontext/drawimage_4_ref.html b/tests/ref/2dcontext/drawimage_canvas_4_ref.html similarity index 100% rename from tests/ref/2dcontext/drawimage_4_ref.html rename to tests/ref/2dcontext/drawimage_canvas_4_ref.html diff --git a/tests/ref/2dcontext/drawimage_5.html b/tests/ref/2dcontext/drawimage_canvas_5.html similarity index 99% rename from tests/ref/2dcontext/drawimage_5.html rename to tests/ref/2dcontext/drawimage_canvas_5.html index 3052d66ece8..0ddff823a35 100644 --- a/tests/ref/2dcontext/drawimage_5.html +++ b/tests/ref/2dcontext/drawimage_canvas_5.html @@ -34,9 +34,8 @@ destCtx.imageSmoothingEnabled = smoothingEnabled; // The source canvas will copied to the 50,50 position of the destination canvas // over an area of 50x25 pixels // The copied image will be distorted along the x axis - destCtx.drawImage(sourceCanvas, 50, 50, 50, 20); - \ No newline at end of file + diff --git a/tests/ref/2dcontext/drawimage_5_ref.html b/tests/ref/2dcontext/drawimage_canvas_5_ref.html similarity index 100% rename from tests/ref/2dcontext/drawimage_5_ref.html rename to tests/ref/2dcontext/drawimage_canvas_5_ref.html diff --git a/tests/ref/2dcontext/drawimage_6.html b/tests/ref/2dcontext/drawimage_canvas_6.html similarity index 100% rename from tests/ref/2dcontext/drawimage_6.html rename to tests/ref/2dcontext/drawimage_canvas_6.html diff --git a/tests/ref/2dcontext/drawimage_6_ref.html b/tests/ref/2dcontext/drawimage_canvas_6_ref.html similarity index 100% rename from tests/ref/2dcontext/drawimage_6_ref.html rename to tests/ref/2dcontext/drawimage_canvas_6_ref.html diff --git a/tests/ref/2dcontext/drawimage_7.html b/tests/ref/2dcontext/drawimage_canvas_7.html similarity index 100% rename from tests/ref/2dcontext/drawimage_7.html rename to tests/ref/2dcontext/drawimage_canvas_7.html diff --git a/tests/ref/2dcontext/drawimage_7_ref.html b/tests/ref/2dcontext/drawimage_canvas_7_ref.html similarity index 100% rename from tests/ref/2dcontext/drawimage_7_ref.html rename to tests/ref/2dcontext/drawimage_canvas_7_ref.html diff --git a/tests/ref/2dcontext/drawimage_8.html b/tests/ref/2dcontext/drawimage_canvas_8.html similarity index 100% rename from tests/ref/2dcontext/drawimage_8.html rename to tests/ref/2dcontext/drawimage_canvas_8.html diff --git a/tests/ref/2dcontext/drawimage_8_ref.html b/tests/ref/2dcontext/drawimage_canvas_8_ref.html similarity index 100% rename from tests/ref/2dcontext/drawimage_8_ref.html rename to tests/ref/2dcontext/drawimage_canvas_8_ref.html diff --git a/tests/ref/2dcontext/drawimage_9.html b/tests/ref/2dcontext/drawimage_canvas_9.html similarity index 100% rename from tests/ref/2dcontext/drawimage_9.html rename to tests/ref/2dcontext/drawimage_canvas_9.html diff --git a/tests/ref/2dcontext/drawimage_9_ref.html b/tests/ref/2dcontext/drawimage_canvas_9_ref.html similarity index 100% rename from tests/ref/2dcontext/drawimage_9_ref.html rename to tests/ref/2dcontext/drawimage_canvas_9_ref.html diff --git a/tests/ref/2dcontext/drawimage_html_image_1.html b/tests/ref/2dcontext/drawimage_html_image_1.html new file mode 100644 index 00000000000..9619103b0fe --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_1.html @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/tests/ref/2dcontext/drawimage_html_image_10.html b/tests/ref/2dcontext/drawimage_html_image_10.html new file mode 100644 index 00000000000..704e51109b6 --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_10.html @@ -0,0 +1,38 @@ + + + + + + + + + + + diff --git a/tests/ref/2dcontext/drawimage_html_image_10_ref.html b/tests/ref/2dcontext/drawimage_html_image_10_ref.html new file mode 100644 index 00000000000..60545df17ff --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_10_ref.html @@ -0,0 +1,19 @@ + + + + + + + +
+ + diff --git a/tests/ref/2dcontext/drawimage_html_image_11.html b/tests/ref/2dcontext/drawimage_html_image_11.html new file mode 100644 index 00000000000..fa3ad4125f8 --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_11.html @@ -0,0 +1,36 @@ + + + + + + + + + + + diff --git a/tests/ref/2dcontext/drawimage_html_image_11_ref.html b/tests/ref/2dcontext/drawimage_html_image_11_ref.html new file mode 100644 index 00000000000..10d8885f2b0 --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_11_ref.html @@ -0,0 +1,19 @@ + + + + + + + +
+ + diff --git a/tests/ref/2dcontext/drawimage_html_image_12.html b/tests/ref/2dcontext/drawimage_html_image_12.html new file mode 100644 index 00000000000..a9a7560b94b --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_12.html @@ -0,0 +1,36 @@ + + + + + + + + + + + diff --git a/tests/ref/2dcontext/drawimage_html_image_12_ref.html b/tests/ref/2dcontext/drawimage_html_image_12_ref.html new file mode 100644 index 00000000000..5f6f22111da --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_12_ref.html @@ -0,0 +1,32 @@ + + + + + + + +
+
+
+ + diff --git a/tests/ref/2dcontext/drawimage_html_image_13.html b/tests/ref/2dcontext/drawimage_html_image_13.html new file mode 100644 index 00000000000..4d81d63b8b1 --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_13.html @@ -0,0 +1,44 @@ + + + + + + + + + + + diff --git a/tests/ref/2dcontext/drawimage_html_image_13_ref.html b/tests/ref/2dcontext/drawimage_html_image_13_ref.html new file mode 100644 index 00000000000..9ac306a5cc6 --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_13_ref.html @@ -0,0 +1,20 @@ + + + + + + + +
+ + diff --git a/tests/ref/2dcontext/drawimage_html_image_1_ref.html b/tests/ref/2dcontext/drawimage_html_image_1_ref.html new file mode 100644 index 00000000000..78c31206c50 --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_1_ref.html @@ -0,0 +1,19 @@ + + + + + + + +
+ + diff --git a/tests/ref/2dcontext/drawimage_html_image_2.html b/tests/ref/2dcontext/drawimage_html_image_2.html new file mode 100644 index 00000000000..e38c85fc27e --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_2.html @@ -0,0 +1,35 @@ + + + + + + + + + + + diff --git a/tests/ref/2dcontext/drawimage_html_image_2_ref.html b/tests/ref/2dcontext/drawimage_html_image_2_ref.html new file mode 100644 index 00000000000..c8f719b2b14 --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_2_ref.html @@ -0,0 +1,23 @@ + + + + + + + +
+ + diff --git a/tests/ref/2dcontext/drawimage_html_image_3.html b/tests/ref/2dcontext/drawimage_html_image_3.html new file mode 100644 index 00000000000..8a85fc2fef9 --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_3.html @@ -0,0 +1,35 @@ + + + + + + + + + + + diff --git a/tests/ref/2dcontext/drawimage_html_image_3_ref.html b/tests/ref/2dcontext/drawimage_html_image_3_ref.html new file mode 100644 index 00000000000..b72687a8ace --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_3_ref.html @@ -0,0 +1,23 @@ + + + + + + + +
+ + diff --git a/tests/ref/2dcontext/drawimage_html_image_4.html b/tests/ref/2dcontext/drawimage_html_image_4.html new file mode 100644 index 00000000000..8158fe2b4db --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_4.html @@ -0,0 +1,36 @@ + + + + + + + + + + + diff --git a/tests/ref/2dcontext/drawimage_html_image_4_ref.html b/tests/ref/2dcontext/drawimage_html_image_4_ref.html new file mode 100644 index 00000000000..baa6591a220 --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_4_ref.html @@ -0,0 +1,29 @@ + + + + + + + +
+ +
+ + diff --git a/tests/ref/2dcontext/drawimage_html_image_5.html b/tests/ref/2dcontext/drawimage_html_image_5.html new file mode 100644 index 00000000000..871379e500a --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_5.html @@ -0,0 +1,35 @@ + + + + + + + + + + + diff --git a/tests/ref/2dcontext/drawimage_html_image_5_ref.html b/tests/ref/2dcontext/drawimage_html_image_5_ref.html new file mode 100644 index 00000000000..66b7cc194ac --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_5_ref.html @@ -0,0 +1,39 @@ + + + + + + + +
+
+ +
+
+ + diff --git a/tests/ref/2dcontext/drawimage_html_image_6.html b/tests/ref/2dcontext/drawimage_html_image_6.html new file mode 100644 index 00000000000..793a1757547 --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_6.html @@ -0,0 +1,36 @@ + + + + + + + + + + + diff --git a/tests/ref/2dcontext/drawimage_html_image_6_ref.html b/tests/ref/2dcontext/drawimage_html_image_6_ref.html new file mode 100644 index 00000000000..d7343375508 --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_6_ref.html @@ -0,0 +1,25 @@ + + + + + + + +
+ + diff --git a/tests/ref/2dcontext/drawimage_html_image_7.html b/tests/ref/2dcontext/drawimage_html_image_7.html new file mode 100644 index 00000000000..1b0de346bc1 --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_7.html @@ -0,0 +1,36 @@ + + + + + + + + + + + diff --git a/tests/ref/2dcontext/drawimage_html_image_7_ref.html b/tests/ref/2dcontext/drawimage_html_image_7_ref.html new file mode 100644 index 00000000000..e823ffbb75a --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_7_ref.html @@ -0,0 +1,35 @@ + + + + + + + +
+
+
+ + diff --git a/tests/ref/2dcontext/drawimage_html_image_8.html b/tests/ref/2dcontext/drawimage_html_image_8.html new file mode 100644 index 00000000000..0197f28c494 --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_8.html @@ -0,0 +1,36 @@ + + + + + + + + + + + diff --git a/tests/ref/2dcontext/drawimage_html_image_8_ref.html b/tests/ref/2dcontext/drawimage_html_image_8_ref.html new file mode 100644 index 00000000000..1a025d26d99 --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_8_ref.html @@ -0,0 +1,35 @@ + + + + + + + +
+
+
+ + diff --git a/tests/ref/2dcontext/drawimage_html_image_9.html b/tests/ref/2dcontext/drawimage_html_image_9.html new file mode 100644 index 00000000000..7caf475065c --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_9.html @@ -0,0 +1,43 @@ + + + + + + + + + + + diff --git a/tests/ref/2dcontext/drawimage_html_image_9_ref.html b/tests/ref/2dcontext/drawimage_html_image_9_ref.html new file mode 100644 index 00000000000..5341e05c1e1 --- /dev/null +++ b/tests/ref/2dcontext/drawimage_html_image_9_ref.html @@ -0,0 +1,19 @@ + + + + + + + +
+ + diff --git a/tests/ref/2x2.png b/tests/ref/2x2.png new file mode 100644 index 0000000000000000000000000000000000000000..276791c4348ada7e1da71041f2ccd383305e209c GIT binary patch literal 788238 zcmeI#d(@Rxoxt$}F+)~r3kB~+$!Hl})C_dg3PiyQ6`f{j(NHE@CNJKSk+Jid(`8Z< zD%8-*+iK;Ij%XPUE6lu+GLoTaUNSW&%gQihQo}R)e}C-rzUSfh?!7;*<Xko-wH9BpZL2k+^~uST4?FDmzEk^7Ilgc1*lCj|kDYsR-|SC*`q)-$-h<~YTHUwx zvD@D9p5=eO`+J+6w#9dbk2zwums*n!xxW8>+mCqU4{v{H(%UXR@thNn`S=aj_nm&n z^yBV0efC}FufKIl-=!}N+x_G}&3gQ&Bid7zwMK3}Zp7wG-?+zPhdqA&>!&T-cE*<1 zKl07B?|yFo{a-xurq%!V`~j<9{KUu^-@fq7M?ZMjie;&E==qI-N+J}C(#k6mI zY^#}{-uJkk5bbpN@R)lXooIWBCpr>8#%C>33i7 z^l7i!>E=}{_n5WYxas%Z``)XzYk&O0KkxG6a~3T7;}?H1>e`(~wcj=S_C0_6_NfQ# zef3w)o$}XTFFEd0SM&|P_>D)M^pl(K+4ZxxU%dSRJ3qPWJ67F${-VW~JpGxUy=Sxi zw*2Yxz4w{8_4D_9cjZTRernj&%hzsu{O?XU`0N`O{`I=Mzj1VD?v+!X&BePq&Get!QoFMMq2Z{PRf^$$OG+0-L0+H>Xk{(8cmL0IcW(2ho!0$u{q2hvzp(a@eNKPf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N*C|i1PBli0N(%s0t6}*5P(V-@7e?i5D)<0009C7DisibN*C|i1PBli0N=ph66o)= z|JFbD&j=7GPCx~UTd4~XAV45ZKmgL5JVk&2f#L)NptzN~5CH-N(gXw`&B;>)2oNYv zKmdwcsS6PxKp;&(0MeX1MSuW-;sgYsxRtsP0RjZl1Oy<>$x{Rf5GYPS0E%0w3lShd zAWc93(wsa+fB=Ew1O%YCmAViC0tC_o1R%}HQv?VQC{92Cid(4*5gZ1kwZqAkE2B1PBl)PCx*PTd4~XAV45ZKmgL5JVk&2f#L)NptzN~ z5CH-N(gXw`&B;>)2oNYvKmdwcsS6S4MqqenV>gd`wn%|aXIQJ%=?p*nHNXGS*<+u5 Q<&M*)Oh53NNwYrp|3PDCIRF3v literal 0 HcmV?d00001 diff --git a/tests/ref/basic.list b/tests/ref/basic.list index 1d814a10e87..66beb8136ca 100644 --- a/tests/ref/basic.list +++ b/tests/ref/basic.list @@ -9,18 +9,32 @@ # Should be == with expected failure: fragment=top != ../html/acid2.html acid2_ref.html -== 2dcontext/drawimage_1.html 2dcontext/drawimage_1_ref.html -== 2dcontext/drawimage_10.html 2dcontext/drawimage_10_ref.html -== 2dcontext/drawimage_11.html 2dcontext/drawimage_11_ref.html -== 2dcontext/drawimage_12.html 2dcontext/drawimage_12_ref.html -== 2dcontext/drawimage_2.html 2dcontext/drawimage_2_ref.html -== 2dcontext/drawimage_3.html 2dcontext/drawimage_3_ref.html -== 2dcontext/drawimage_4.html 2dcontext/drawimage_4_ref.html -== 2dcontext/drawimage_5.html 2dcontext/drawimage_5_ref.html -== 2dcontext/drawimage_6.html 2dcontext/drawimage_6_ref.html -== 2dcontext/drawimage_7.html 2dcontext/drawimage_7_ref.html -== 2dcontext/drawimage_8.html 2dcontext/drawimage_8_ref.html -== 2dcontext/drawimage_9.html 2dcontext/drawimage_9_ref.html +== 2dcontext/drawimage_canvas_1.html 2dcontext/drawimage_canvas_1_ref.html +== 2dcontext/drawimage_canvas_10.html 2dcontext/drawimage_canvas_10_ref.html +== 2dcontext/drawimage_canvas_11.html 2dcontext/drawimage_canvas_11_ref.html +== 2dcontext/drawimage_canvas_12.html 2dcontext/drawimage_canvas_12_ref.html +== 2dcontext/drawimage_canvas_2.html 2dcontext/drawimage_canvas_2_ref.html +== 2dcontext/drawimage_canvas_3.html 2dcontext/drawimage_canvas_3_ref.html +== 2dcontext/drawimage_canvas_4.html 2dcontext/drawimage_canvas_4_ref.html +== 2dcontext/drawimage_canvas_5.html 2dcontext/drawimage_canvas_5_ref.html +== 2dcontext/drawimage_canvas_6.html 2dcontext/drawimage_canvas_6_ref.html +== 2dcontext/drawimage_canvas_7.html 2dcontext/drawimage_canvas_7_ref.html +== 2dcontext/drawimage_canvas_8.html 2dcontext/drawimage_canvas_8_ref.html +== 2dcontext/drawimage_canvas_9.html 2dcontext/drawimage_canvas_9_ref.html +== 2dcontext/drawimage_html_image_1.html 2dcontext/drawimage_html_image_1_ref.html +== 2dcontext/drawimage_html_image_10.html 2dcontext/drawimage_html_image_10_ref.html +== 2dcontext/drawimage_html_image_11.html 2dcontext/drawimage_html_image_11_ref.html +== 2dcontext/drawimage_html_image_12.html 2dcontext/drawimage_html_image_12_ref.html +== 2dcontext/drawimage_html_image_2.html 2dcontext/drawimage_html_image_2_ref.html +== 2dcontext/drawimage_html_image_3.html 2dcontext/drawimage_html_image_3_ref.html +== 2dcontext/drawimage_html_image_4.html 2dcontext/drawimage_html_image_4_ref.html +== 2dcontext/drawimage_html_image_5.html 2dcontext/drawimage_html_image_5_ref.html +== 2dcontext/drawimage_html_image_6.html 2dcontext/drawimage_html_image_6_ref.html +== 2dcontext/drawimage_html_image_7.html 2dcontext/drawimage_html_image_7_ref.html +== 2dcontext/drawimage_html_image_8.html 2dcontext/drawimage_html_image_8_ref.html +== 2dcontext/drawimage_html_image_9.html 2dcontext/drawimage_html_image_9_ref.html + + == 2dcontext/lineto_a.html 2dcontext/lineto_ref.html == 2dcontext/transform_a.html 2dcontext/transform_ref.html diff --git a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.3arg.html.ini b/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.3arg.html.ini deleted file mode 100644 index 36849de7ae0..00000000000 --- a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.3arg.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.drawImage.3arg.html] - type: testharness - [Canvas test: 2d.drawImage.3arg] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.5arg.html.ini b/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.5arg.html.ini deleted file mode 100644 index 29ca7fccdd3..00000000000 --- a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.5arg.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.drawImage.5arg.html] - type: testharness - [Canvas test: 2d.drawImage.5arg] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.html.ini b/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.html.ini deleted file mode 100644 index 8847e0db8c5..00000000000 --- a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.drawImage.9arg.basic.html] - type: testharness - [Canvas test: 2d.drawImage.9arg.basic] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.html.ini b/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.html.ini deleted file mode 100644 index d3d8a6f1a14..00000000000 --- a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.drawImage.9arg.destpos.html] - type: testharness - [Canvas test: 2d.drawImage.9arg.destpos] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.html.ini b/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.html.ini deleted file mode 100644 index eb84f28d686..00000000000 --- a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.drawImage.9arg.destsize.html] - type: testharness - [Canvas test: 2d.drawImage.9arg.destsize] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.html.ini b/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.html.ini deleted file mode 100644 index 3d8cc371b4b..00000000000 --- a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.drawImage.9arg.sourcepos.html] - type: testharness - [Canvas test: 2d.drawImage.9arg.sourcepos] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.html.ini b/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.html.ini deleted file mode 100644 index 2f90478b571..00000000000 --- a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.drawImage.9arg.sourcesize.html] - type: testharness - [Canvas test: 2d.drawImage.9arg.sourcesize] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.animated.apng.html.ini b/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.animated.apng.html.ini deleted file mode 100644 index 12bbb87fda1..00000000000 --- a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.animated.apng.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.drawImage.animated.apng.html] - type: testharness - [drawImage() of an APNG with no poster frame draws the first frame] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.animated.gif.html.ini b/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.animated.gif.html.ini deleted file mode 100644 index ab2c8e2cb02..00000000000 --- a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.animated.gif.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.drawImage.animated.gif.html] - type: testharness - [drawImage() of an animated GIF draws the first frame] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.animated.poster.html.ini b/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.animated.poster.html.ini deleted file mode 100644 index bcbaad2c882..00000000000 --- a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.animated.poster.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.drawImage.animated.poster.html] - type: testharness - [drawImage() of an APNG draws the poster frame] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.floatsource.html.ini b/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.floatsource.html.ini deleted file mode 100644 index 58a5608ae50..00000000000 --- a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.floatsource.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.drawImage.floatsource.html] - type: testharness - [Canvas test: 2d.drawImage.floatsource] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.nonfinite.html.ini b/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.nonfinite.html.ini deleted file mode 100644 index 59c2ed1eda1..00000000000 --- a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.nonfinite.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.drawImage.nonfinite.html] - type: testharness - [drawImage() with Infinity/NaN is ignored] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.nowrap.html.ini b/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.nowrap.html.ini deleted file mode 100644 index 65d4f782665..00000000000 --- a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.nowrap.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.drawImage.nowrap.html] - type: testharness - [Stretched images do not get pixels wrapping around the edges] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.transform.html.ini b/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.transform.html.ini deleted file mode 100644 index 65ee855d48a..00000000000 --- a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.transform.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.drawImage.transform.html] - type: testharness - [Canvas test: 2d.drawImage.transform] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.zerocanvas.html.ini b/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.zerocanvas.html.ini deleted file mode 100644 index fd39e5a9200..00000000000 --- a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.zerocanvas.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.drawImage.zerocanvas.html] - type: testharness - [Canvas test: 2d.drawImage.zerocanvas] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.zerosource.html.ini b/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.zerosource.html.ini deleted file mode 100644 index 92e485ec36e..00000000000 --- a/tests/wpt/metadata/2dcontext/drawing-images-to-the-canvas/2d.drawImage.zerosource.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.drawImage.zerosource.html] - type: testharness - [drawImage with zero-sized source rectangle throws INDEX_SIZE_ERR] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/shadows/2d.shadow.canvas.transparent.1.html.ini b/tests/wpt/metadata/2dcontext/shadows/2d.shadow.canvas.transparent.1.html.ini deleted file mode 100644 index e63cfb92258..00000000000 --- a/tests/wpt/metadata/2dcontext/shadows/2d.shadow.canvas.transparent.1.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.shadow.canvas.transparent.1.html] - type: testharness - [Shadows are not drawn for transparent canvases] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/shadows/2d.shadow.canvas.transparent.2.html.ini b/tests/wpt/metadata/2dcontext/shadows/2d.shadow.canvas.transparent.2.html.ini index b3623a00589..f0485ad1623 100644 --- a/tests/wpt/metadata/2dcontext/shadows/2d.shadow.canvas.transparent.2.html.ini +++ b/tests/wpt/metadata/2dcontext/shadows/2d.shadow.canvas.transparent.2.html.ini @@ -2,4 +2,3 @@ type: testharness [Shadows are not drawn for transparent parts of canvases] expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/shadows/2d.shadow.image.section.html.ini b/tests/wpt/metadata/2dcontext/shadows/2d.shadow.image.section.html.ini deleted file mode 100644 index 4bedaf32833..00000000000 --- a/tests/wpt/metadata/2dcontext/shadows/2d.shadow.image.section.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.shadow.image.section.html] - type: testharness - [Shadows are not drawn for areas outside image source rectangles] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/shadows/2d.shadow.image.transparent.1.html.ini b/tests/wpt/metadata/2dcontext/shadows/2d.shadow.image.transparent.1.html.ini deleted file mode 100644 index 0798e2c6553..00000000000 --- a/tests/wpt/metadata/2dcontext/shadows/2d.shadow.image.transparent.1.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.shadow.image.transparent.1.html] - type: testharness - [Shadows are not drawn for transparent images] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/shadows/2d.shadow.image.transparent.2.html.ini b/tests/wpt/metadata/2dcontext/shadows/2d.shadow.image.transparent.2.html.ini index 4b5b797c037..c4f70567f88 100644 --- a/tests/wpt/metadata/2dcontext/shadows/2d.shadow.image.transparent.2.html.ini +++ b/tests/wpt/metadata/2dcontext/shadows/2d.shadow.image.transparent.2.html.ini @@ -2,4 +2,3 @@ type: testharness [Shadows are not drawn for transparent parts of images] expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/shadows/canvas_shadows_002.htm.ini b/tests/wpt/metadata/2dcontext/shadows/canvas_shadows_002.htm.ini new file mode 100644 index 00000000000..8a5384818b7 --- /dev/null +++ b/tests/wpt/metadata/2dcontext/shadows/canvas_shadows_002.htm.ini @@ -0,0 +1,4 @@ +[canvas_shadows_002.html] + type: testharness + [Shadows must be drawn for images] + expected: FAIL