mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
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:
parent
f7fb130a2a
commit
ec2961920b
32 changed files with 211 additions and 131 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -1307,9 +1307,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "euclid"
|
name = "euclid"
|
||||||
version = "0.20.1"
|
version = "0.20.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "89c879a4e57d6a2785d517b0771ea6857916173debef0102bf81142d36ca9254"
|
checksum = "f46a3516f04c5e05870f71ae6242a97e8f72ee12cfc2f7f5deb16111a98b0670"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"serde",
|
"serde",
|
||||||
|
|
|
@ -13,7 +13,7 @@ use std::marker::PhantomData;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use webrender::api::DirtyRect;
|
use webrender::api::DirtyRect;
|
||||||
use webrender_api::units::RectExt;
|
use webrender_api::units::RectExt as RectExt_;
|
||||||
|
|
||||||
/// The canvas data stores a state machine for the current status of
|
/// The canvas data stores a state machine for the current status of
|
||||||
/// the path data and any relevant transformations that are
|
/// the path data and any relevant transformations that are
|
||||||
|
@ -449,7 +449,7 @@ impl<'a> CanvasData<'a> {
|
||||||
let source_rect = source_rect.ceil();
|
let source_rect = source_rect.ceil();
|
||||||
// It discards the extra pixels (if any) that won't be painted
|
// It discards the extra pixels (if any) that won't be painted
|
||||||
let image_data = if Rect::from_size(image_size).contains_rect(&source_rect) {
|
let image_data = if Rect::from_size(image_size).contains_rect(&source_rect) {
|
||||||
pixels::rgba8_get_rect(&image_data, image_size.to_u32(), source_rect.to_u32()).into()
|
pixels::rgba8_get_rect(&image_data, image_size.to_u64(), source_rect.to_u64()).into()
|
||||||
} else {
|
} else {
|
||||||
image_data.into()
|
image_data.into()
|
||||||
};
|
};
|
||||||
|
@ -927,10 +927,10 @@ impl<'a> CanvasData<'a> {
|
||||||
self.backend.set_global_composition(op, &mut self.state);
|
self.backend.set_global_composition(op, &mut self.state);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn recreate(&mut self, size: Size2D<u32>) {
|
pub fn recreate(&mut self, size: Size2D<u64>) {
|
||||||
self.drawtarget = self
|
self.drawtarget = self
|
||||||
.backend
|
.backend
|
||||||
.create_drawtarget(Size2D::new(size.width as u64, size.height as u64));
|
.create_drawtarget(Size2D::new(size.width, size.height));
|
||||||
self.state = self.backend.recreate_paint_state(&self.state);
|
self.state = self.backend.recreate_paint_state(&self.state);
|
||||||
self.saved_states.clear();
|
self.saved_states.clear();
|
||||||
// Webrender doesn't let images change size, so we clear the webrender image key.
|
// Webrender doesn't let images change size, so we clear the webrender image key.
|
||||||
|
@ -997,7 +997,7 @@ impl<'a> CanvasData<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-putimagedata
|
// https://html.spec.whatwg.org/multipage/#dom-context-2d-putimagedata
|
||||||
pub fn put_image_data(&mut self, mut imagedata: Vec<u8>, rect: Rect<u32>) {
|
pub fn put_image_data(&mut self, mut imagedata: Vec<u8>, rect: Rect<u64>) {
|
||||||
assert_eq!(imagedata.len() % 4, 0);
|
assert_eq!(imagedata.len() % 4, 0);
|
||||||
assert_eq!(rect.size.area() as usize, imagedata.len() / 4);
|
assert_eq!(rect.size.area() as usize, imagedata.len() / 4);
|
||||||
pixels::rgba8_byte_swap_and_premultiply_inplace(&mut imagedata);
|
pixels::rgba8_byte_swap_and_premultiply_inplace(&mut imagedata);
|
||||||
|
@ -1082,7 +1082,7 @@ impl<'a> CanvasData<'a> {
|
||||||
/// canvas_size: The size of the canvas we're reading from
|
/// canvas_size: The size of the canvas we're reading from
|
||||||
/// read_rect: The area of the canvas we want to read from
|
/// read_rect: The area of the canvas we want to read from
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
pub fn read_pixels(&self, read_rect: Rect<u32>, canvas_size: Size2D<u32>) -> Vec<u8> {
|
pub fn read_pixels(&self, read_rect: Rect<u64>, canvas_size: Size2D<u64>) -> Vec<u8> {
|
||||||
let canvas_rect = Rect::from_size(canvas_size);
|
let canvas_rect = Rect::from_size(canvas_size);
|
||||||
if canvas_rect
|
if canvas_rect
|
||||||
.intersection(&read_rect)
|
.intersection(&read_rect)
|
||||||
|
@ -1092,7 +1092,7 @@ impl<'a> CanvasData<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
self.drawtarget.snapshot_data(&|bytes| {
|
self.drawtarget.snapshot_data(&|bytes| {
|
||||||
pixels::rgba8_get_rect(bytes, canvas_size.to_u32(), read_rect.to_u32()).into_owned()
|
pixels::rgba8_get_rect(bytes, canvas_size, read_rect).into_owned()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1189,3 +1189,35 @@ impl RectToi32 for Rect<f64> {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub trait Size2DExt {
|
||||||
|
fn to_u64(&self) -> Size2D<u64>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Size2DExt for Size2D<f64> {
|
||||||
|
fn to_u64(&self) -> Size2D<u64> {
|
||||||
|
self.cast()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Size2DExt for Size2D<u32> {
|
||||||
|
fn to_u64(&self) -> Size2D<u64> {
|
||||||
|
self.cast()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait RectExt {
|
||||||
|
fn to_u64(&self) -> Rect<u64>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl RectExt for Rect<f64> {
|
||||||
|
fn to_u64(&self) -> Rect<u64> {
|
||||||
|
self.cast()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl RectExt for Rect<u32> {
|
||||||
|
fn to_u64(&self) -> Rect<u64> {
|
||||||
|
self.cast()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ impl<'a> CanvasPaintThread<'a> {
|
||||||
) => {
|
) => {
|
||||||
let image_data = self
|
let image_data = self
|
||||||
.canvas(canvas_id)
|
.canvas(canvas_id)
|
||||||
.read_pixels(source_rect.to_u32(), image_size.to_u32());
|
.read_pixels(source_rect.to_u64(), image_size.to_u64());
|
||||||
self.canvas(other_canvas_id).draw_image(
|
self.canvas(other_canvas_id).draw_image(
|
||||||
image_data.into(),
|
image_data.into(),
|
||||||
source_rect.size,
|
source_rect.size,
|
||||||
|
|
|
@ -29,7 +29,7 @@ pub enum CanvasMsg {
|
||||||
),
|
),
|
||||||
FromLayout(FromLayoutMsg, CanvasId),
|
FromLayout(FromLayoutMsg, CanvasId),
|
||||||
FromScript(FromScriptMsg, CanvasId),
|
FromScript(FromScriptMsg, CanvasId),
|
||||||
Recreate(Size2D<u32>, CanvasId),
|
Recreate(Size2D<u64>, CanvasId),
|
||||||
Close(CanvasId),
|
Close(CanvasId),
|
||||||
Exit,
|
Exit,
|
||||||
}
|
}
|
||||||
|
@ -54,11 +54,11 @@ pub enum Canvas2dMsg {
|
||||||
Fill,
|
Fill,
|
||||||
FillText(String, f64, f64, Option<f64>),
|
FillText(String, f64, f64, Option<f64>),
|
||||||
FillRect(Rect<f32>),
|
FillRect(Rect<f32>),
|
||||||
GetImageData(Rect<u32>, Size2D<u32>, IpcBytesSender),
|
GetImageData(Rect<u64>, Size2D<u64>, IpcBytesSender),
|
||||||
IsPointInPath(f64, f64, FillRule, IpcSender<bool>),
|
IsPointInPath(f64, f64, FillRule, IpcSender<bool>),
|
||||||
LineTo(Point2D<f32>),
|
LineTo(Point2D<f32>),
|
||||||
MoveTo(Point2D<f32>),
|
MoveTo(Point2D<f32>),
|
||||||
PutImageData(Rect<u32>, IpcBytesReceiver),
|
PutImageData(Rect<u64>, IpcBytesReceiver),
|
||||||
QuadraticCurveTo(Point2D<f32>, Point2D<f32>),
|
QuadraticCurveTo(Point2D<f32>, Point2D<f32>),
|
||||||
Rect(Rect<f32>),
|
Rect(Rect<f32>),
|
||||||
RestoreContext,
|
RestoreContext,
|
||||||
|
|
|
@ -23,7 +23,7 @@ pub enum PixelFormat {
|
||||||
BGRA8,
|
BGRA8,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn rgba8_get_rect(pixels: &[u8], size: Size2D<u32>, rect: Rect<u32>) -> Cow<[u8]> {
|
pub fn rgba8_get_rect(pixels: &[u8], size: Size2D<u64>, rect: Rect<u64>) -> Cow<[u8]> {
|
||||||
assert!(!rect.is_empty());
|
assert!(!rect.is_empty());
|
||||||
assert!(Rect::from_size(size).contains_rect(&rect));
|
assert!(Rect::from_size(size).contains_rect(&rect));
|
||||||
assert_eq!(pixels.len() % 4, 0);
|
assert_eq!(pixels.len() % 4, 0);
|
||||||
|
@ -85,18 +85,19 @@ pub fn multiply_u8_color(a: u8, b: u8) -> u8 {
|
||||||
|
|
||||||
pub fn clip(
|
pub fn clip(
|
||||||
mut origin: Point2D<i32>,
|
mut origin: Point2D<i32>,
|
||||||
mut size: Size2D<u32>,
|
mut size: Size2D<u64>,
|
||||||
surface: Size2D<u32>,
|
surface: Size2D<u64>,
|
||||||
) -> Option<Rect<u32>> {
|
) -> Option<Rect<u64>> {
|
||||||
if origin.x < 0 {
|
if origin.x < 0 {
|
||||||
size.width = size.width.saturating_sub(-origin.x as u32);
|
size.width = size.width.saturating_sub(-origin.x as u64);
|
||||||
origin.x = 0;
|
origin.x = 0;
|
||||||
}
|
}
|
||||||
if origin.y < 0 {
|
if origin.y < 0 {
|
||||||
size.height = size.height.saturating_sub(-origin.y as u32);
|
size.height = size.height.saturating_sub(-origin.y as u64);
|
||||||
origin.y = 0;
|
origin.y = 0;
|
||||||
}
|
}
|
||||||
Rect::new(origin.to_u32(), size)
|
let origin = Point2D::new(origin.x as u64, origin.y as u64);
|
||||||
|
Rect::new(origin, size)
|
||||||
.intersection(&Rect::from_size(surface))
|
.intersection(&Rect::from_size(surface))
|
||||||
.filter(|rect| !rect.is_empty())
|
.filter(|rect| !rect.is_empty())
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ use crate::dom::imagedata::ImageData;
|
||||||
use crate::dom::node::{Node, NodeDamage};
|
use crate::dom::node::{Node, NodeDamage};
|
||||||
use crate::dom::paintworkletglobalscope::PaintWorkletGlobalScope;
|
use crate::dom::paintworkletglobalscope::PaintWorkletGlobalScope;
|
||||||
use crate::dom::textmetrics::TextMetrics;
|
use crate::dom::textmetrics::TextMetrics;
|
||||||
|
use crate::euclidext::Size2DExt;
|
||||||
use crate::unpremultiplytable::UNPREMULTIPLY_TABLE;
|
use crate::unpremultiplytable::UNPREMULTIPLY_TABLE;
|
||||||
use canvas_traits::canvas::{Canvas2dMsg, CanvasId, CanvasMsg};
|
use canvas_traits::canvas::{Canvas2dMsg, CanvasId, CanvasMsg};
|
||||||
use canvas_traits::canvas::{CompositionOrBlending, FillOrStrokeStyle, FillRule};
|
use canvas_traits::canvas::{CompositionOrBlending, FillOrStrokeStyle, FillRule};
|
||||||
|
@ -180,6 +181,19 @@ impl CanvasState {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#concept-canvas-set-bitmap-dimensions
|
||||||
|
pub fn set_bitmap_dimensions(&self, size: Size2D<u64>) {
|
||||||
|
self.reset_to_initial_state();
|
||||||
|
self.ipc_renderer
|
||||||
|
.send(CanvasMsg::Recreate(size, self.get_canvas_id()))
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn reset_to_initial_state(&self) {
|
||||||
|
self.saved_states.borrow_mut().clear();
|
||||||
|
*self.state.borrow_mut() = CanvasContextState::new();
|
||||||
|
}
|
||||||
|
|
||||||
fn create_drawable_rect(&self, x: f64, y: f64, w: f64, h: f64) -> Option<Rect<f32>> {
|
fn create_drawable_rect(&self, x: f64, y: f64, w: f64, h: f64) -> Option<Rect<f32>> {
|
||||||
if !([x, y, w, h].iter().all(|val| val.is_finite())) {
|
if !([x, y, w, h].iter().all(|val| val.is_finite())) {
|
||||||
return None;
|
return None;
|
||||||
|
@ -300,7 +314,7 @@ impl CanvasState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_rect(&self, canvas_size: Size2D<u32>, rect: Rect<u32>) -> Vec<u8> {
|
pub fn get_rect(&self, canvas_size: Size2D<u64>, rect: Rect<u64>) -> Vec<u8> {
|
||||||
assert!(self.origin_is_clean());
|
assert!(self.origin_is_clean());
|
||||||
|
|
||||||
assert!(Rect::from_size(canvas_size).contains_rect(&rect));
|
assert!(Rect::from_size(canvas_size).contains_rect(&rect));
|
||||||
|
@ -1019,7 +1033,7 @@ impl CanvasState {
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-getimagedata
|
// https://html.spec.whatwg.org/multipage/#dom-context-2d-getimagedata
|
||||||
pub fn get_image_data(
|
pub fn get_image_data(
|
||||||
&self,
|
&self,
|
||||||
canvas_size: Size2D<u32>,
|
canvas_size: Size2D<u64>,
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
sx: i32,
|
sx: i32,
|
||||||
sy: i32,
|
sy: i32,
|
||||||
|
@ -1038,7 +1052,7 @@ impl CanvasState {
|
||||||
}
|
}
|
||||||
|
|
||||||
let (origin, size) = adjust_size_sign(Point2D::new(sx, sy), Size2D::new(sw, sh));
|
let (origin, size) = adjust_size_sign(Point2D::new(sx, sy), Size2D::new(sw, sh));
|
||||||
let read_rect = match pixels::clip(origin, size, canvas_size) {
|
let read_rect = match pixels::clip(origin, size.to_u64(), canvas_size) {
|
||||||
Some(rect) => rect,
|
Some(rect) => rect,
|
||||||
None => {
|
None => {
|
||||||
// All the pixels are outside the canvas surface.
|
// All the pixels are outside the canvas surface.
|
||||||
|
@ -1057,7 +1071,7 @@ impl CanvasState {
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-putimagedata
|
// https://html.spec.whatwg.org/multipage/#dom-context-2d-putimagedata
|
||||||
pub fn put_image_data(
|
pub fn put_image_data(
|
||||||
&self,
|
&self,
|
||||||
canvas_size: Size2D<u32>,
|
canvas_size: Size2D<u64>,
|
||||||
imagedata: &ImageData,
|
imagedata: &ImageData,
|
||||||
dx: i32,
|
dx: i32,
|
||||||
dy: i32,
|
dy: i32,
|
||||||
|
@ -1078,7 +1092,7 @@ impl CanvasState {
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
pub fn put_image_data_(
|
pub fn put_image_data_(
|
||||||
&self,
|
&self,
|
||||||
canvas_size: Size2D<u32>,
|
canvas_size: Size2D<u64>,
|
||||||
imagedata: &ImageData,
|
imagedata: &ImageData,
|
||||||
dx: i32,
|
dx: i32,
|
||||||
dy: i32,
|
dy: i32,
|
||||||
|
@ -1106,7 +1120,7 @@ impl CanvasState {
|
||||||
Point2D::new(dirty_x, dirty_y),
|
Point2D::new(dirty_x, dirty_y),
|
||||||
Size2D::new(dirty_width, dirty_height),
|
Size2D::new(dirty_width, dirty_height),
|
||||||
);
|
);
|
||||||
let src_rect = match pixels::clip(src_origin, src_size, imagedata_size) {
|
let src_rect = match pixels::clip(src_origin, src_size.to_u64(), imagedata_size.to_u64()) {
|
||||||
Some(rect) => rect,
|
Some(rect) => rect,
|
||||||
None => return,
|
None => return,
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,9 +22,10 @@ use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::dom::htmlcanvaselement::HTMLCanvasElement;
|
use crate::dom::htmlcanvaselement::HTMLCanvasElement;
|
||||||
use crate::dom::imagedata::ImageData;
|
use crate::dom::imagedata::ImageData;
|
||||||
use crate::dom::textmetrics::TextMetrics;
|
use crate::dom::textmetrics::TextMetrics;
|
||||||
|
use crate::euclidext::Size2DExt;
|
||||||
use canvas_traits::canvas::{Canvas2dMsg, CanvasId, CanvasMsg};
|
use canvas_traits::canvas::{Canvas2dMsg, CanvasId, CanvasMsg};
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use euclid::default::{Rect, Size2D};
|
use euclid::default::{Point2D, Rect, Size2D};
|
||||||
use ipc_channel::ipc::IpcSender;
|
use ipc_channel::ipc::IpcSender;
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
@ -75,12 +76,13 @@ impl CanvasRenderingContext2D {
|
||||||
.borrow()
|
.borrow()
|
||||||
.get_ipc_renderer()
|
.get_ipc_renderer()
|
||||||
.send(CanvasMsg::Recreate(
|
.send(CanvasMsg::Recreate(
|
||||||
size,
|
size.to_u64(),
|
||||||
self.canvas_state.borrow().get_canvas_id(),
|
self.canvas_state.borrow().get_canvas_id(),
|
||||||
))
|
))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: This duplicates functionality in canvas state
|
||||||
// https://html.spec.whatwg.org/multipage/#reset-the-rendering-context-to-its-default-state
|
// https://html.spec.whatwg.org/multipage/#reset-the-rendering-context-to-its-default-state
|
||||||
fn reset_to_initial_state(&self) {
|
fn reset_to_initial_state(&self) {
|
||||||
self.canvas_state
|
self.canvas_state
|
||||||
|
@ -90,6 +92,15 @@ impl CanvasRenderingContext2D {
|
||||||
.clear();
|
.clear();
|
||||||
*self.canvas_state.borrow().get_state().borrow_mut() = CanvasContextState::new();
|
*self.canvas_state.borrow().get_state().borrow_mut() = CanvasContextState::new();
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
pub fn get_canvas_state(&self) -> Ref<CanvasState> {
|
||||||
|
self.canvas_state.borrow()
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
pub fn set_canvas_bitmap_dimensions(&self, size: Size2D<u64>) {
|
||||||
|
self.canvas_state.borrow().set_bitmap_dimensions(size);
|
||||||
|
}
|
||||||
|
|
||||||
pub fn mark_as_dirty(&self) {
|
pub fn mark_as_dirty(&self) {
|
||||||
self.canvas_state
|
self.canvas_state
|
||||||
|
@ -116,6 +127,7 @@ impl CanvasRenderingContext2D {
|
||||||
self.canvas_state.borrow().send_canvas_2d_msg(msg)
|
self.canvas_state.borrow().send_canvas_2d_msg(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Remove this
|
||||||
pub fn get_ipc_renderer(&self) -> IpcSender<CanvasMsg> {
|
pub fn get_ipc_renderer(&self) -> IpcSender<CanvasMsg> {
|
||||||
self.canvas_state.borrow().get_ipc_renderer().clone()
|
self.canvas_state.borrow().get_ipc_renderer().clone()
|
||||||
}
|
}
|
||||||
|
@ -125,10 +137,14 @@ impl CanvasRenderingContext2D {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_rect(&self, rect: Rect<u32>) -> Vec<u8> {
|
pub fn get_rect(&self, rect: Rect<u32>) -> Vec<u8> {
|
||||||
|
let rect = Rect::new(
|
||||||
|
Point2D::new(rect.origin.x as u64, rect.origin.y as u64),
|
||||||
|
Size2D::new(rect.size.width as u64, rect.size.height as u64),
|
||||||
|
);
|
||||||
self.canvas_state.borrow().get_rect(
|
self.canvas_state.borrow().get_rect(
|
||||||
self.canvas
|
self.canvas
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map_or(Size2D::zero(), |c| c.get_size()),
|
.map_or(Size2D::zero(), |c| c.get_size().to_u64()),
|
||||||
rect,
|
rect,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -469,7 +485,7 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {
|
||||||
self.canvas_state.borrow().get_image_data(
|
self.canvas_state.borrow().get_image_data(
|
||||||
self.canvas
|
self.canvas
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map_or(Size2D::zero(), |c| c.get_size()),
|
.map_or(Size2D::zero(), |c| c.get_size().to_u64()),
|
||||||
&self.global(),
|
&self.global(),
|
||||||
sx,
|
sx,
|
||||||
sy,
|
sy,
|
||||||
|
@ -483,7 +499,7 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {
|
||||||
self.canvas_state.borrow().put_image_data(
|
self.canvas_state.borrow().put_image_data(
|
||||||
self.canvas
|
self.canvas
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map_or(Size2D::zero(), |c| c.get_size()),
|
.map_or(Size2D::zero(), |c| c.get_size().to_u64()),
|
||||||
imagedata,
|
imagedata,
|
||||||
dx,
|
dx,
|
||||||
dy,
|
dy,
|
||||||
|
@ -505,7 +521,7 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {
|
||||||
self.canvas_state.borrow().put_image_data_(
|
self.canvas_state.borrow().put_image_data_(
|
||||||
self.canvas
|
self.canvas
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map_or(Size2D::zero(), |c| c.get_size()),
|
.map_or(Size2D::zero(), |c| c.get_size().to_u64()),
|
||||||
imagedata,
|
imagedata,
|
||||||
dx,
|
dx,
|
||||||
dy,
|
dy,
|
||||||
|
|
|
@ -28,6 +28,7 @@ use crate::dom::webgl2renderingcontext::WebGL2RenderingContext;
|
||||||
use crate::dom::webglrenderingcontext::{
|
use crate::dom::webglrenderingcontext::{
|
||||||
LayoutCanvasWebGLRenderingContextHelpers, WebGLRenderingContext,
|
LayoutCanvasWebGLRenderingContextHelpers, WebGLRenderingContext,
|
||||||
};
|
};
|
||||||
|
use crate::euclidext::Size2DExt;
|
||||||
use crate::script_runtime::JSContext;
|
use crate::script_runtime::JSContext;
|
||||||
use base64;
|
use base64;
|
||||||
use canvas_traits::canvas::{CanvasId, CanvasMsg, FromScriptMsg};
|
use canvas_traits::canvas::{CanvasId, CanvasMsg, FromScriptMsg};
|
||||||
|
@ -94,7 +95,9 @@ impl HTMLCanvasElement {
|
||||||
let size = self.get_size();
|
let size = self.get_size();
|
||||||
if let Some(ref context) = *self.context.borrow() {
|
if let Some(ref context) = *self.context.borrow() {
|
||||||
match *context {
|
match *context {
|
||||||
CanvasContext::Context2d(ref context) => context.set_bitmap_dimensions(size),
|
CanvasContext::Context2d(ref context) => {
|
||||||
|
context.set_canvas_bitmap_dimensions(size.to_u64())
|
||||||
|
},
|
||||||
CanvasContext::WebGL(ref context) => context.recreate(size),
|
CanvasContext::WebGL(ref context) => context.recreate(size),
|
||||||
CanvasContext::WebGL2(ref context) => context.recreate(size),
|
CanvasContext::WebGL2(ref context) => context.recreate(size),
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,8 +169,8 @@ impl ImageData {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
pub unsafe fn get_rect(&self, rect: Rect<u32>) -> Cow<[u8]> {
|
pub unsafe fn get_rect(&self, rect: Rect<u64>) -> Cow<[u8]> {
|
||||||
pixels::rgba8_get_rect(self.as_slice(), self.get_size(), rect)
|
pixels::rgba8_get_rect(self.as_slice(), self.get_size().to_u64(), rect)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_size(&self) -> Size2D<u32> {
|
pub fn get_size(&self) -> Size2D<u32> {
|
||||||
|
@ -194,3 +194,13 @@ impl ImageDataMethods for ImageData {
|
||||||
NonNull::new(self.data.get()).expect("got a null pointer")
|
NonNull::new(self.data.get()).expect("got a null pointer")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub trait Size2DExt {
|
||||||
|
fn to_u64(&self) -> Size2D<u64>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Size2DExt for Size2D<u32> {
|
||||||
|
fn to_u64(&self) -> Size2D<u64> {
|
||||||
|
return Size2D::new(self.width as u64, self.height as u64);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -92,11 +92,9 @@ impl OffscreenCanvas {
|
||||||
OffscreenCanvasContext::OffscreenContext2d(ref ctx) => Some(DomRoot::from_ref(ctx)),
|
OffscreenCanvasContext::OffscreenContext2d(ref ctx) => Some(DomRoot::from_ref(ctx)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
let size = self.get_size();
|
|
||||||
let context = OffscreenCanvasRenderingContext2D::new(
|
let context = OffscreenCanvasRenderingContext2D::new(
|
||||||
&self.global(),
|
&self.global(),
|
||||||
self,
|
self,
|
||||||
size,
|
|
||||||
self.placeholder.as_ref().map(|c| &**c),
|
self.placeholder.as_ref().map(|c| &**c),
|
||||||
);
|
);
|
||||||
*self.context.borrow_mut() = Some(OffscreenCanvasContext::OffscreenContext2d(
|
*self.context.borrow_mut() = Some(OffscreenCanvasContext::OffscreenContext2d(
|
||||||
|
@ -136,6 +134,14 @@ impl OffscreenCanvasMethods for OffscreenCanvas {
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-offscreencanvas-width
|
// https://html.spec.whatwg.org/multipage/#dom-offscreencanvas-width
|
||||||
fn SetWidth(&self, value: u64) {
|
fn SetWidth(&self, value: u64) {
|
||||||
self.width.set(value);
|
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
|
// 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
|
// https://html.spec.whatwg.org/multipage/#dom-offscreencanvas-height
|
||||||
fn SetHeight(&self, value: u64) {
|
fn SetHeight(&self, value: u64) {
|
||||||
self.height.set(value);
|
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());
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,44 +30,32 @@ use euclid::default::Size2D;
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct OffscreenCanvasRenderingContext2D {
|
pub struct OffscreenCanvasRenderingContext2D {
|
||||||
reflector_: Reflector,
|
reflector_: Reflector,
|
||||||
canvas: Option<Dom<OffscreenCanvas>>,
|
canvas: Dom<OffscreenCanvas>,
|
||||||
canvas_state: DomRefCell<CanvasState>,
|
canvas_state: DomRefCell<CanvasState>,
|
||||||
htmlcanvas: Option<Dom<HTMLCanvasElement>>,
|
htmlcanvas: Option<Dom<HTMLCanvasElement>>,
|
||||||
width: u32,
|
|
||||||
height: u32,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl OffscreenCanvasRenderingContext2D {
|
impl OffscreenCanvasRenderingContext2D {
|
||||||
fn new_inherited(
|
fn new_inherited(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
canvas: Option<&OffscreenCanvas>,
|
canvas: &OffscreenCanvas,
|
||||||
size: Size2D<u64>,
|
|
||||||
htmlcanvas: Option<&HTMLCanvasElement>,
|
htmlcanvas: Option<&HTMLCanvasElement>,
|
||||||
) -> OffscreenCanvasRenderingContext2D {
|
) -> OffscreenCanvasRenderingContext2D {
|
||||||
OffscreenCanvasRenderingContext2D {
|
OffscreenCanvasRenderingContext2D {
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
canvas: canvas.map(Dom::from_ref),
|
canvas: Dom::from_ref(canvas),
|
||||||
htmlcanvas: htmlcanvas.map(Dom::from_ref),
|
htmlcanvas: htmlcanvas.map(Dom::from_ref),
|
||||||
canvas_state: DomRefCell::new(CanvasState::new(
|
canvas_state: DomRefCell::new(CanvasState::new(global, canvas.get_size())),
|
||||||
global,
|
|
||||||
Size2D::new(size.width as u64, size.height as u64),
|
|
||||||
)),
|
|
||||||
width: size.width as u32,
|
|
||||||
height: size.height as u32,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(
|
pub fn new(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
canvas: &OffscreenCanvas,
|
canvas: &OffscreenCanvas,
|
||||||
size: Size2D<u64>,
|
|
||||||
htmlcanvas: Option<&HTMLCanvasElement>,
|
htmlcanvas: Option<&HTMLCanvasElement>,
|
||||||
) -> DomRoot<OffscreenCanvasRenderingContext2D> {
|
) -> DomRoot<OffscreenCanvasRenderingContext2D> {
|
||||||
let boxed = Box::new(OffscreenCanvasRenderingContext2D::new_inherited(
|
let boxed = Box::new(OffscreenCanvasRenderingContext2D::new_inherited(
|
||||||
global,
|
global, canvas, htmlcanvas,
|
||||||
Some(canvas),
|
|
||||||
size,
|
|
||||||
htmlcanvas,
|
|
||||||
));
|
));
|
||||||
reflect_dom_object(
|
reflect_dom_object(
|
||||||
boxed,
|
boxed,
|
||||||
|
@ -75,12 +63,21 @@ impl OffscreenCanvasRenderingContext2D {
|
||||||
OffscreenCanvasRenderingContext2DBinding::Wrap,
|
OffscreenCanvasRenderingContext2DBinding::Wrap,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
pub fn get_canvas_state(&self) -> Ref<CanvasState> {
|
||||||
|
self.canvas_state.borrow()
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
pub fn set_canvas_bitmap_dimensions(&self, size: Size2D<u64>) {
|
||||||
|
self.canvas_state.borrow().set_bitmap_dimensions(size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl OffscreenCanvasRenderingContext2DMethods for OffscreenCanvasRenderingContext2D {
|
impl OffscreenCanvasRenderingContext2DMethods for OffscreenCanvasRenderingContext2D {
|
||||||
// https://html.spec.whatwg.org/multipage/offscreencontext2d-canvas
|
// https://html.spec.whatwg.org/multipage/offscreencontext2d-canvas
|
||||||
fn Canvas(&self) -> DomRoot<OffscreenCanvas> {
|
fn Canvas(&self) -> DomRoot<OffscreenCanvas> {
|
||||||
DomRoot::from_ref(self.canvas.as_ref().expect("No canvas."))
|
DomRoot::from_ref(&self.canvas)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-fillrect
|
// https://html.spec.whatwg.org/multipage/#dom-context-2d-fillrect
|
||||||
|
@ -315,7 +312,7 @@ impl OffscreenCanvasRenderingContext2DMethods for OffscreenCanvasRenderingContex
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-getimagedata
|
// https://html.spec.whatwg.org/multipage/#dom-context-2d-getimagedata
|
||||||
fn GetImageData(&self, sx: i32, sy: i32, sw: i32, sh: i32) -> Fallible<DomRoot<ImageData>> {
|
fn GetImageData(&self, sx: i32, sy: i32, sw: i32, sh: i32) -> Fallible<DomRoot<ImageData>> {
|
||||||
self.canvas_state.borrow().get_image_data(
|
self.canvas_state.borrow().get_image_data(
|
||||||
Size2D::new(self.width, self.height),
|
self.canvas.get_size(),
|
||||||
&self.global(),
|
&self.global(),
|
||||||
sx,
|
sx,
|
||||||
sy,
|
sy,
|
||||||
|
@ -326,12 +323,9 @@ impl OffscreenCanvasRenderingContext2DMethods for OffscreenCanvasRenderingContex
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-putimagedata
|
// https://html.spec.whatwg.org/multipage/#dom-context-2d-putimagedata
|
||||||
fn PutImageData(&self, imagedata: &ImageData, dx: i32, dy: i32) {
|
fn PutImageData(&self, imagedata: &ImageData, dx: i32, dy: i32) {
|
||||||
self.canvas_state.borrow().put_image_data(
|
self.canvas_state
|
||||||
Size2D::new(self.width, self.height),
|
.borrow()
|
||||||
imagedata,
|
.put_image_data(self.canvas.get_size(), imagedata, dx, dy)
|
||||||
dx,
|
|
||||||
dy,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-putimagedata
|
// https://html.spec.whatwg.org/multipage/#dom-context-2d-putimagedata
|
||||||
|
@ -347,7 +341,7 @@ impl OffscreenCanvasRenderingContext2DMethods for OffscreenCanvasRenderingContex
|
||||||
dirty_height: i32,
|
dirty_height: i32,
|
||||||
) {
|
) {
|
||||||
self.canvas_state.borrow().put_image_data_(
|
self.canvas_state.borrow().put_image_data_(
|
||||||
Size2D::new(self.width, self.height),
|
self.canvas.get_size(),
|
||||||
imagedata,
|
imagedata,
|
||||||
dx,
|
dx,
|
||||||
dy,
|
dy,
|
||||||
|
|
|
@ -21,6 +21,7 @@ use crate::dom::canvasgradient::CanvasGradient;
|
||||||
use crate::dom::canvaspattern::CanvasPattern;
|
use crate::dom::canvaspattern::CanvasPattern;
|
||||||
use crate::dom::canvasrenderingcontext2d::CanvasRenderingContext2D;
|
use crate::dom::canvasrenderingcontext2d::CanvasRenderingContext2D;
|
||||||
use crate::dom::paintworkletglobalscope::PaintWorkletGlobalScope;
|
use crate::dom::paintworkletglobalscope::PaintWorkletGlobalScope;
|
||||||
|
use crate::euclidext::Size2DExt;
|
||||||
use canvas_traits::canvas::CanvasImageData;
|
use canvas_traits::canvas::CanvasImageData;
|
||||||
use canvas_traits::canvas::CanvasMsg;
|
use canvas_traits::canvas::CanvasMsg;
|
||||||
use canvas_traits::canvas::FromLayoutMsg;
|
use canvas_traits::canvas::FromLayoutMsg;
|
||||||
|
@ -75,7 +76,7 @@ impl PaintRenderingContext2D {
|
||||||
let size = size * device_pixel_ratio;
|
let size = size * device_pixel_ratio;
|
||||||
self.device_pixel_ratio.set(device_pixel_ratio);
|
self.device_pixel_ratio.set(device_pixel_ratio);
|
||||||
self.context
|
self.context
|
||||||
.set_bitmap_dimensions(size.to_untyped().to_u32());
|
.set_canvas_bitmap_dimensions(size.to_untyped().to_u64());
|
||||||
self.scale_by_device_pixel_ratio();
|
self.scale_by_device_pixel_ratio();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2963,11 +2963,16 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
let src_origin = Point2D::new(x, y);
|
let src_origin = Point2D::new(x, y);
|
||||||
let src_size = Size2D::new(width as u32, height as u32);
|
let src_size = Size2D::new(width as u32, height as u32);
|
||||||
let fb_size = Size2D::new(fb_width as u32, fb_height as u32);
|
let fb_size = Size2D::new(fb_width as u32, fb_height as u32);
|
||||||
let src_rect = match pixels::clip(src_origin, src_size, fb_size) {
|
let src_rect = match pixels::clip(src_origin, src_size.to_u64(), fb_size.to_u64()) {
|
||||||
Some(rect) => rect,
|
Some(rect) => rect,
|
||||||
None => return,
|
None => return,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Note: we're casting a Rect<u64> back into a Rect<u32> here, but it's okay because
|
||||||
|
// it used u32 data types to begin with. It just got converted to Rect<u64> in
|
||||||
|
// pixels::clip
|
||||||
|
let src_rect = src_rect.to_u32();
|
||||||
|
|
||||||
let mut dest_offset = 0;
|
let mut dest_offset = 0;
|
||||||
if x < 0 {
|
if x < 0 {
|
||||||
dest_offset += -x * bytes_per_pixel;
|
dest_offset += -x * bytes_per_pixel;
|
||||||
|
@ -4485,3 +4490,13 @@ impl WebGLMessageSender {
|
||||||
self.wake_after_send(|| self.sender.send_dom_to_texture(command))
|
self.wake_after_send(|| self.sender.send_dom_to_texture(command))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub trait Size2DExt {
|
||||||
|
fn to_u64(&self) -> Size2D<u64>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Size2DExt for Size2D<u32> {
|
||||||
|
fn to_u64(&self) -> Size2D<u64> {
|
||||||
|
return Size2D::new(self.width as u64, self.height as u64);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
43
components/script/euclidext.rs
Normal file
43
components/script/euclidext.rs
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use euclid::default::{Rect, Size2D};
|
||||||
|
|
||||||
|
pub trait Size2DExt {
|
||||||
|
fn to_u64(&self) -> Size2D<u64>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Size2DExt for Size2D<f32> {
|
||||||
|
fn to_u64(&self) -> Size2D<u64> {
|
||||||
|
self.cast()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Size2DExt for Size2D<f64> {
|
||||||
|
fn to_u64(&self) -> Size2D<u64> {
|
||||||
|
self.cast()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Size2DExt for Size2D<u32> {
|
||||||
|
fn to_u64(&self) -> Size2D<u64> {
|
||||||
|
self.cast()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait RectExt {
|
||||||
|
fn to_u64(&self) -> Rect<u64>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl RectExt for Rect<f64> {
|
||||||
|
fn to_u64(&self) -> Rect<u64> {
|
||||||
|
self.cast()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl RectExt for Rect<u32> {
|
||||||
|
fn to_u64(&self) -> Rect<u64> {
|
||||||
|
self.cast()
|
||||||
|
}
|
||||||
|
}
|
|
@ -65,6 +65,7 @@ mod dom;
|
||||||
mod canvas_state;
|
mod canvas_state;
|
||||||
#[warn(deprecated)]
|
#[warn(deprecated)]
|
||||||
mod compartments;
|
mod compartments;
|
||||||
|
mod euclidext;
|
||||||
#[warn(deprecated)]
|
#[warn(deprecated)]
|
||||||
pub mod fetch;
|
pub mod fetch;
|
||||||
#[warn(deprecated)]
|
#[warn(deprecated)]
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
[2d.gradient.interpolate.multiple.html]
|
[2d.gradient.interpolate.multiple.html]
|
||||||
[OffscreenCanvas test: 2d.gradient.interpolate.multiple]
|
[OffscreenCanvas test: 2d.gradient.interpolate.multiple]
|
||||||
expected: FAIL
|
expected: PASS
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
[2d.gradient.interpolate.multiple.worker.html]
|
[2d.gradient.interpolate.multiple.worker.html]
|
||||||
[2d]
|
[2d]
|
||||||
expected: FAIL
|
expected: PASS
|
||||||
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
[2d.gradient.interpolate.overlap.html]
|
|
||||||
[OffscreenCanvas test: 2d.gradient.interpolate.overlap]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
[2d.gradient.interpolate.overlap.worker.html]
|
|
||||||
[2d]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
[initial.reset.2dstate.html]
|
|
||||||
[Resetting the canvas state resets 2D state variables]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
[initial.reset.2dstate.worker.html]
|
|
||||||
[Resetting the canvas state resets 2D state variables]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
[initial.reset.clip.html]
|
|
||||||
[Resetting the canvas state resets the current clip region]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
[initial.reset.clip.worker.html]
|
|
||||||
[Resetting the canvas state resets the current clip region]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
[initial.reset.different.html]
|
|
||||||
[Changing size resets canvas to transparent black]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
[initial.reset.different.worker.html]
|
|
||||||
[Changing size resets canvas to transparent black]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
[initial.reset.gradient.html]
|
|
||||||
[Resetting the canvas state does not invalidate any existing gradients]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
[initial.reset.gradient.worker.html]
|
|
||||||
[Resetting the canvas state does not invalidate any existing gradients]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
[initial.reset.same.html]
|
|
||||||
[Setting size (not changing the value) resets canvas to transparent black]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
[initial.reset.same.worker.html]
|
|
||||||
[Setting size (not changing the value) resets canvas to transparent black]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
[initial.reset.transform.html]
|
|
||||||
[Resetting the canvas state resets the current transformation matrix]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
[initial.reset.transform.worker.html]
|
|
||||||
[Resetting the canvas state resets the current transformation matrix]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
[offscreencanvas.resize.html]
|
[offscreencanvas.resize.html]
|
||||||
[Verify that resizing a 2d context resets its state.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Verify that writing to the width and height attributes of an OffscreenCanvas works when there is a 2d context attached.]
|
[Verify that writing to the width and height attributes of an OffscreenCanvas works when there is a 2d context attached.]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
@ -8,9 +6,6 @@
|
||||||
[Verify that resizing an OffscreenCanvas with a webgl context propagates the new size to its placeholder canvas asynchronously.]
|
[Verify that resizing an OffscreenCanvas with a webgl context propagates the new size to its placeholder canvas asynchronously.]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[Verify that setting the size of a 2d context to the same size it already had resets its state.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Verify that resizing an OffscreenCanvas with a 2d context propagates the new size to its placeholder canvas asynchronously.]
|
[Verify that resizing an OffscreenCanvas with a 2d context propagates the new size to its placeholder canvas asynchronously.]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
@ -25,4 +20,3 @@
|
||||||
|
|
||||||
[Verify that writing to the width or height attribute of a placeholder canvas throws an exception even when not changing the value of the attribute.]
|
[Verify that writing to the width or height attribute of a placeholder canvas throws an exception even when not changing the value of the attribute.]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue