diff options
310 files changed, 8378 insertions, 6310 deletions
diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs index f97749610aa..efbb4ca71c5 100644 --- a/components/canvas/webgl_thread.rs +++ b/components/canvas/webgl_thread.rs @@ -7,8 +7,8 @@ use canvas_traits::webgl::*; use euclid::Size2D; use fnv::FnvHashMap; use gleam::gl; +use ipc_channel::ipc::IpcBytesSender; use offscreen_gl_context::{GLContext, GLContextAttributes, GLLimits, NativeGLContextMethods}; -use serde_bytes::ByteBuf; use std::thread; use super::gl_context::{GLContextFactory, GLContextWrapper}; use webrender; @@ -713,8 +713,9 @@ impl WebGLImpl { ctx.gl().pixel_store_i(name, val), WebGLCommand::PolygonOffset(factor, units) => ctx.gl().polygon_offset(factor, units), - WebGLCommand::ReadPixels(x, y, width, height, format, pixel_type, ref chan) => - Self::read_pixels(ctx.gl(), x, y, width, height, format, pixel_type, chan), + WebGLCommand::ReadPixels(x, y, width, height, format, pixel_type, ref chan) => { + Self::read_pixels(ctx.gl(), x, y, width, height, format, pixel_type, chan) + } WebGLCommand::RenderbufferStorage(target, format, width, height) => ctx.gl().renderbuffer_storage(target, format, width, height), WebGLCommand::SampleCoverage(value, invert) => @@ -833,11 +834,32 @@ impl WebGLImpl { WebGLCommand::SetViewport(x, y, width, height) => { ctx.gl().viewport(x, y, width, height); } - WebGLCommand::TexImage2D(target, level, internal, width, height, format, data_type, ref data) => - ctx.gl().tex_image_2d(target, level, internal, width, height, - /*border*/0, format, data_type, Some(data)), - WebGLCommand::TexSubImage2D(target, level, xoffset, yoffset, x, y, width, height, ref data) => - ctx.gl().tex_sub_image_2d(target, level, xoffset, yoffset, x, y, width, height, data), + WebGLCommand::TexImage2D(target, level, internal, width, height, format, data_type, ref chan) => { + ctx.gl().tex_image_2d( + target, + level, + internal, + width, + height, + 0, + format, + data_type, + Some(&chan.recv().unwrap()), + ) + } + WebGLCommand::TexSubImage2D(target, level, xoffset, yoffset, x, y, width, height, ref chan) => { + ctx.gl().tex_sub_image_2d( + target, + level, + xoffset, + yoffset, + x, + y, + width, + height, + &chan.recv().unwrap(), + ) + } WebGLCommand::DrawingBufferWidth(ref sender) => sender.send(ctx.borrow_draw_buffer().unwrap().size().width).unwrap(), WebGLCommand::DrawingBufferHeight(ref sender) => @@ -1165,10 +1187,10 @@ impl WebGLImpl { height: i32, format: u32, pixel_type: u32, - chan: &WebGLSender<ByteBuf>, + chan: &IpcBytesSender, ) { let result = gl.read_pixels(x, y, width, height, format, pixel_type); - chan.send(result.into()).unwrap() + chan.send(&result).unwrap() } fn finish(gl: &gl::Gl, chan: &WebGLSender<()>) { diff --git a/components/canvas_traits/webgl.rs b/components/canvas_traits/webgl.rs index f1f8515002c..57647204910 100644 --- a/components/canvas_traits/webgl.rs +++ b/components/canvas_traits/webgl.rs @@ -4,7 +4,7 @@ use euclid::Size2D; use gleam::gl; -use ipc_channel::ipc::IpcBytesReceiver; +use ipc_channel::ipc::{IpcBytesReceiver, IpcBytesSender}; use offscreen_gl_context::{GLContextAttributes, GLLimits}; use serde_bytes::ByteBuf; use std::borrow::Cow; @@ -214,7 +214,7 @@ pub enum WebGLCommand { GetRenderbufferParameter(u32, u32, WebGLSender<i32>), PolygonOffset(f32, f32), RenderbufferStorage(u32, u32, i32, i32), - ReadPixels(i32, i32, i32, i32, u32, u32, WebGLSender<ByteBuf>), + ReadPixels(i32, i32, i32, i32, u32, u32, IpcBytesSender), SampleCoverage(f32, bool), Scissor(i32, i32, i32, i32), StencilFunc(u32, i32, u32), @@ -252,8 +252,8 @@ pub enum WebGLCommand { VertexAttribPointer(u32, i32, u32, bool, i32, u32), VertexAttribPointer2f(u32, i32, bool, i32, u32), SetViewport(i32, i32, i32, i32), - TexImage2D(u32, i32, i32, i32, i32, u32, u32, ByteBuf), - TexSubImage2D(u32, i32, i32, i32, i32, i32, u32, u32, ByteBuf), + TexImage2D(u32, i32, i32, i32, i32, u32, u32, IpcBytesReceiver), + TexSubImage2D(u32, i32, i32, i32, i32, i32, u32, u32, IpcBytesReceiver), DrawingBufferWidth(WebGLSender<i32>), DrawingBufferHeight(WebGLSender<i32>), Finish(WebGLSender<()>), diff --git a/components/gfx/font.rs b/components/gfx/font.rs index de056747bd9..a3591e3b41a 100644 --- a/components/gfx/font.rs +++ b/components/gfx/font.rs @@ -32,9 +32,9 @@ use unicode_script::Script; use webrender_api; macro_rules! ot_tag { - ($t1:expr, $t2:expr, $t3:expr, $t4:expr) => ( + ($t1:expr, $t2:expr, $t3:expr, $t4:expr) => { (($t1 as u32) << 24) | (($t2 as u32) << 16) | (($t3 as u32) << 8) | ($t4 as u32) - ); + }; } pub const GPOS: u32 = ot_tag!('G', 'P', 'O', 'S'); @@ -87,10 +87,12 @@ trait FontTableTagConversions { impl FontTableTagConversions for FontTableTag { fn tag_to_str(&self) -> String { - let bytes = [(self >> 24) as u8, - (self >> 16) as u8, - (self >> 8) as u8, - (self >> 0) as u8]; + let bytes = [ + (self >> 24) as u8, + (self >> 16) as u8, + (self >> 8) as u8, + (self >> 0) as u8, + ]; str::from_utf8(&bytes).unwrap().to_owned() } } @@ -101,18 +103,18 @@ pub trait FontTableMethods { #[derive(Clone, Debug, Deserialize, Serialize)] pub struct FontMetrics { - pub underline_size: Au, + pub underline_size: Au, pub underline_offset: Au, - pub strikeout_size: Au, + pub strikeout_size: Au, pub strikeout_offset: Au, - pub leading: Au, - pub x_height: Au, - pub em_size: Au, - pub ascent: Au, - pub descent: Au, - pub max_advance: Au, - pub average_advance: Au, - pub line_gap: Au, + pub leading: Au, + pub x_height: Au, + pub em_size: Au, + pub ascent: Au, + pub descent: Au, + pub max_advance: Au, + pub average_advance: Au, + pub line_gap: Au, } /// `FontDescriptor` describes the parameters of a `Font`. It represents rendering a given font @@ -149,10 +151,12 @@ pub struct Font { } impl Font { - pub fn new(handle: FontHandle, - descriptor: FontDescriptor, - actual_pt_size: Au, - font_key: webrender_api::FontInstanceKey) -> Font { + pub fn new( + handle: FontHandle, + descriptor: FontDescriptor, + actual_pt_size: Au, + font_key: webrender_api::FontInstanceKey, + ) -> Font { let metrics = handle.metrics(); Font { @@ -218,28 +222,39 @@ impl Font { text: text.to_owned(), options: *options, }; - let result = self.shape_cache.borrow_mut().entry(lookup_key).or_insert_with(|| { - let start_time = time::precise_time_ns(); - let mut glyphs = GlyphStore::new(text.len(), - options.flags.contains(ShapingFlags::IS_WHITESPACE_SHAPING_FLAG), - options.flags.contains(ShapingFlags::RTL_FLAG)); - - if self.can_do_fast_shaping(text, options) { - debug!("shape_text: Using ASCII fast path."); - self.shape_text_fast(text, options, &mut glyphs); - } else { - debug!("shape_text: Using Harfbuzz."); - if shaper.is_none() { - shaper = Some(Shaper::new(this)); + let result = self + .shape_cache + .borrow_mut() + .entry(lookup_key) + .or_insert_with(|| { + let start_time = time::precise_time_ns(); + let mut glyphs = GlyphStore::new( + text.len(), + options + .flags + .contains(ShapingFlags::IS_WHITESPACE_SHAPING_FLAG), + options.flags.contains(ShapingFlags::RTL_FLAG), + ); + + if self.can_do_fast_shaping(text, options) { + debug!("shape_text: Using ASCII fast path."); + self.shape_text_fast(text, options, &mut glyphs); + } else { + debug!("shape_text: Using Harfbuzz."); + if shaper.is_none() { + shaper = Some(Shaper::new(this)); + } + shaper + .as_ref() + .unwrap() + .shape_text(text, options, &mut glyphs); } - shaper.as_ref().unwrap().shape_text(text, options, &mut glyphs); - } - let end_time = time::precise_time_ns(); - TEXT_SHAPING_PERFORMANCE_COUNTER.fetch_add((end_time - start_time) as usize, - Ordering::Relaxed); - Arc::new(glyphs) - }).clone(); + let end_time = time::precise_time_ns(); + TEXT_SHAPING_PERFORMANCE_COUNTER + .fetch_add((end_time - start_time) as usize, Ordering::Relaxed); + Arc::new(glyphs) + }).clone(); self.shaper = shaper; result } @@ -285,12 +300,21 @@ impl Font { pub fn table_for_tag(&self, tag: FontTableTag) -> Option<FontTable> { let result = self.handle.table_for_tag(tag); - let status = if result.is_some() { "Found" } else { "Didn't find" }; + let status = if result.is_some() { + "Found" + } else { + "Didn't find" + }; - debug!("{} font table[{}] with family={}, face={}", - status, tag.tag_to_str(), - self.handle.family_name().unwrap_or("unavailable".to_owned()), - self.handle.face_name().unwrap_or("unavailable".to_owned())); + debug!( + "{} font table[{}] with family={}, face={}", + status, + tag.tag_to_str(), + self.handle + .family_name() + .unwrap_or("unavailable".to_owned()), + self.handle.face_name().unwrap_or("unavailable".to_owned()) + ); result } @@ -308,18 +332,21 @@ impl Font { self.glyph_index(codepoint).is_some() } - pub fn glyph_h_kerning(&self, first_glyph: GlyphId, second_glyph: GlyphId) - -> FractionalPixel { + pub fn glyph_h_kerning(&self, first_glyph: GlyphId, second_glyph: GlyphId) -> FractionalPixel { self.handle.glyph_h_kerning(first_glyph, second_glyph) } pub fn glyph_h_advance(&self, glyph: GlyphId) -> FractionalPixel { - *self.glyph_advance_cache.borrow_mut().entry(glyph).or_insert_with(|| { - match self.handle.glyph_h_advance(glyph) { - Some(adv) => adv, - None => 10f64 as FractionalPixel // FIXME: Need fallback strategy - } - }) + *self + .glyph_advance_cache + .borrow_mut() + .entry(glyph) + .or_insert_with(|| { + match self.handle.glyph_h_advance(glyph) { + Some(adv) => adv, + None => 10f64 as FractionalPixel, // FIXME: Need fallback strategy + } + }) } } @@ -339,10 +366,12 @@ impl FontGroup { pub fn new(style: &FontStyleStruct) -> FontGroup { let descriptor = FontDescriptor::from(style); - let families = - style.font_family.0.iter() - .map(|family| FontGroupFamily::new(descriptor.clone(), &family)) - .collect(); + let families = style + .font_family + .0 + .iter() + .map(|family| FontGroupFamily::new(descriptor.clone(), &family)) + .collect(); FontGroup { descriptor, @@ -358,25 +387,25 @@ impl FontGroup { pub fn find_by_codepoint<S: FontSource>( &mut self, mut font_context: &mut FontContext<S>, - codepoint: char + codepoint: char, ) -> Option<FontRef> { let has_glyph = |font: &FontRef| font.borrow().has_glyph_for(codepoint); let font = self.find(&mut font_context, |font| has_glyph(font)); if font.is_some() { - return font + return font; } if let Some(ref fallback) = self.last_matching_fallback { if has_glyph(&fallback) { - return self.last_matching_fallback.clone() + return self.last_matching_fallback.clone(); } } let font = self.find_fallback(&mut font_context, Some(codepoint), has_glyph); if font.is_some() { self.last_matching_fallback = font.clone(); - return font + return font; } self.first(&mut font_context) @@ -385,7 +414,7 @@ impl FontGroup { /// Find the first available font in the group, or the first available fallback font. pub fn first<S: FontSource>( &mut self, - mut font_context: &mut FontContext<S> + mut font_context: &mut FontContext<S>, ) -> Option<FontRef> { self.find(&mut font_context, |_| true) .or_else(|| self.find_fallback(&mut font_context, None, |_| true)) @@ -393,16 +422,13 @@ impl FontGroup { /// Find a font which returns true for `predicate`. This method mutates because we may need to /// load new font data in the process of finding a suitable font. - fn find<S, P>( - &mut self, - mut font_context: &mut FontContext<S>, - predicate: P, - ) -> Option<FontRef> + fn find<S, P>(&mut self, mut font_context: &mut FontContext<S>, predicate: P) -> Option<FontRef> where S: FontSource, P: FnMut(&FontRef) -> bool, { - self.families.iter_mut() + self.families + .iter_mut() .filter_map(|family| family.font(&mut font_context)) .find(predicate) } @@ -422,15 +448,9 @@ impl FontGroup { P: FnMut(&FontRef) -> bool, { iter::once(FontFamilyDescriptor::default()) - .chain( - fallback_font_families(codepoint).into_iter().map(|family| { - FontFamilyDescriptor::new( - FontFamilyName::from(family), - FontSearchScope::Local, - ) - }) - ) - .filter_map(|family| font_context.font(&self.descriptor, &family)) + .chain(fallback_font_families(codepoint).into_iter().map(|family| { + FontFamilyDescriptor::new(FontFamilyName::from(family), FontSearchScope::Local) + })).filter_map(|family| font_context.font(&self.descriptor, &family)) .find(predicate) } } @@ -448,10 +468,8 @@ struct FontGroupFamily { impl FontGroupFamily { fn new(font_descriptor: FontDescriptor, family: &SingleFontFamily) -> FontGroupFamily { - let family_descriptor = FontFamilyDescriptor::new( - FontFamilyName::from(family), - FontSearchScope::Any - ); + let family_descriptor = + FontFamilyDescriptor::new(FontFamilyName::from(family), FontSearchScope::Any); FontGroupFamily { font_descriptor, @@ -477,17 +495,19 @@ impl FontGroupFamily { pub struct RunMetrics { // may be negative due to negative width (i.e., kerning of '.' in 'P.T.') pub advance_width: Au, - pub ascent: Au, // nonzero + pub ascent: Au, // nonzero pub descent: Au, // nonzero // this bounding box is relative to the left origin baseline. // so, bounding_box.position.y = -ascent - pub bounding_box: Rect<Au> + pub bounding_box: Rect<Au>, } impl RunMetrics { pub fn new(advance: Au, ascent: Au, descent: Au) -> RunMetrics { - let bounds = Rect::new(Point2D::new(Au(0), -ascent), - Size2D::new(advance, ascent + descent)); + let bounds = Rect::new( + Point2D::new(Au(0), -ascent), + Size2D::new(advance, ascent + descent), + ); // TODO(Issue #125): support loose and tight bounding boxes; using the // ascent+descent and advance is sometimes too generous and @@ -540,11 +560,13 @@ impl FontFamilyName { impl<'a> From<&'a SingleFontFamily> for FontFamilyName { fn from(other: &'a SingleFontFamily) -> FontFamilyName { match *other { - SingleFontFamily::FamilyName(ref family_name) => - FontFamilyName::Specific(family_name.name.clone()), + SingleFontFamily::FamilyName(ref family_name) => { + FontFamilyName::Specific(family_name.name.clone()) + }, - SingleFontFamily::Generic(ref generic_name) => - FontFamilyName::Generic(generic_name.clone()), + SingleFontFamily::Generic(ref generic_name) => { + FontFamilyName::Generic(generic_name.clone()) + }, } } } diff --git a/components/gfx/font_cache_thread.rs b/components/gfx/font_cache_thread.rs index 334a1bb41ec..4bfa3e6dfc2 100644 --- a/components/gfx/font_cache_thread.rs +++ b/components/gfx/font_cache_thread.rs @@ -40,14 +40,15 @@ pub struct FontTemplateInfo { impl FontTemplates { pub fn new() -> FontTemplates { - FontTemplates { - templates: vec!(), - } + FontTemplates { templates: vec![] } } /// Find a font in this family that matches a given descriptor. - pub fn find_font_for_style(&mut self, desc: &FontTemplateDescriptor, fctx: &FontContextHandle) - -> Option<Arc<FontTemplateData>> { + pub fn find_font_for_style( + &mut self, + desc: &FontTemplateDescriptor, + fctx: &FontContextHandle, + ) -> Option<Arc<FontTemplateData>> { // TODO(Issue #189): optimize lookup for // regular/bold/italic/bolditalic with fixed offsets and a // static decision table for fallback between these values. @@ -63,7 +64,8 @@ impl FontTemplates { let (mut best_template_data, mut best_distance) = (None, f32::MAX); for template in &mut self.templates { if let Some((template_data, distance)) = - template.data_for_approximate_descriptor(fctx, desc) { + template.data_for_approximate_descriptor(fctx, desc) + { if distance < best_distance { best_template_data = Some(template_data); best_distance = distance @@ -71,7 +73,7 @@ impl FontTemplates { } } if best_template_data.is_some() { - return best_template_data + return best_template_data; } // If a request is made for a font family that exists, @@ -103,8 +105,16 @@ impl FontTemplates { /// Commands that the FontContext sends to the font cache thread. #[derive(Debug, Deserialize, Serialize)] pub enum Command { - GetFontTemplate(FontTemplateDescriptor, FontFamilyDescriptor, IpcSender<Reply>), - GetFontInstance(webrender_api::FontKey, Au, IpcSender<webrender_api::FontInstanceKey>), + GetFontTemplate( + FontTemplateDescriptor, + FontFamilyDescriptor, + IpcSender<Reply>, + ), + GetFontInstance( + webrender_api::FontKey, + Au, + IpcSender<webrender_api::FontInstanceKey>, + ), AddWebFont(LowercaseString, EffectiveSources, IpcSender<()>), AddDownloadedWebFont(LowercaseString, ServoUrl, Vec<u8>, IpcSender<()>), Exit(IpcSender<()>), @@ -148,7 +158,7 @@ fn populate_generic_fonts() -> HashMap<FontFamilyName, LowercaseString> { ) { let family_name = match system_default_family(generic_name) { Some(system_default) => LowercaseString::new(&system_default), - None => LowercaseString::new(mapped_name) + None => LowercaseString::new(mapped_name), }; let generic_name = FontFamilyName::Generic(Atom::from(generic_name)); @@ -156,7 +166,6 @@ fn populate_generic_fonts() -> HashMap<FontFamilyName, LowercaseString> { generic_fonts.insert(generic_name, family_name); } - generic_fonts } @@ -167,50 +176,50 @@ impl FontCache { match msg { Command::GetFontTemplate(template_descriptor, family_descriptor, result) => { - let maybe_font_template = self.find_font_template(&template_descriptor, &family_descriptor); + let maybe_font_template = + self.find_font_template(&template_descriptor, &family_descriptor); let _ = result.send(Reply::GetFontTemplateReply(maybe_font_template)); - } + }, Command::GetFontInstance(font_key, size, result) => { let webrender_api = &self.webrender_api; - let instance_key = *self.font_instances - .entry((font_key, size)) - .or_insert_with(|| { - let key = webrender_api.generate_font_instance_key(); - let mut txn = webrender_api::Transaction::new(); - txn.add_font_instance(key, - font_key, - size, - None, - None, - Vec::new()); - webrender_api.update_resources(txn.resource_updates); - key - }); + let instance_key = + *self + .font_instances + .entry((font_key, size)) + .or_insert_with(|| { + let key = webrender_api.generate_font_instance_key(); + let mut txn = webrender_api::Transaction::new(); + txn.add_font_instance(key, font_key, size, None, None, Vec::new()); + webrender_api.update_resources(txn.resource_updates); + key + }); let _ = result.send(instance_key); - } + }, Command::AddWebFont(family_name, sources, result) => { self.handle_add_web_font(family_name, sources, result); - } + }, Command::AddDownloadedWebFont(family_name, url, bytes, result) => { let templates = &mut self.web_families.get_mut(&family_name).unwrap(); templates.add_template(Atom::from(url.to_string()), Some(bytes)); drop(result.send(())); - } + }, Command::Ping => (), Command::Exit(result) => { let _ = result.send(()); break; - } + }, } } } - fn handle_add_web_font(&mut self, - family_name: LowercaseString, - mut sources: EffectiveSources, - sender: IpcSender<()>) { + fn handle_add_web_font( + &mut self, + family_name: LowercaseString, + mut sources: EffectiveSources, + sender: IpcSender<()>, + ) { let src = if let Some(src) = sources.next() { src } else { @@ -236,7 +245,7 @@ impl FontCache { destination: Destination::Font, // TODO: Add a proper origin - Can't import GlobalScope from gfx // We can leave origin to be set by default - .. RequestInit::default() + ..RequestInit::default() }; let channel_to_self = self.channel_to_self.clone(); @@ -248,19 +257,27 @@ impl FontCache { FetchResponseMsg::ProcessRequestBody | FetchResponseMsg::ProcessRequestEOF => (), FetchResponseMsg::ProcessResponse(meta_result) => { - trace!("@font-face {} metadata ok={:?}", family_name, meta_result.is_ok()); + trace!( + "@font-face {} metadata ok={:?}", + family_name, + meta_result.is_ok() + ); *response_valid.lock().unwrap() = meta_result.is_ok(); - } + }, FetchResponseMsg::ProcessResponseChunk(new_bytes) => { trace!("@font-face {} chunk={:?}", family_name, new_bytes); if *response_valid.lock().unwrap() { bytes.lock().unwrap().extend(new_bytes.into_iter()) } - } + }, FetchResponseMsg::ProcessResponseEOF(response) => { trace!("@font-face {} EOF={:?}", family_name, response); if response.is_err() || !*response_valid.lock().unwrap() { - let msg = Command::AddWebFont(family_name.clone(), sources.clone(), sender.clone()); + let msg = Command::AddWebFont( + family_name.clone(), + sources.clone(), + sender.clone(), + ); channel_to_self.send(msg).unwrap(); return; } @@ -270,23 +287,31 @@ impl FontCache { Ok(san) => san, Err(_) => { // FIXME(servo/fontsan#1): get an error message - debug!("Sanitiser rejected web font: \ - family={} url={:?}", family_name, url); - let msg = Command::AddWebFont(family_name.clone(), sources.clone(), sender.clone()); + debug!( + "Sanitiser rejected web font: \ + family={} url={:?}", + family_name, url + ); + let msg = Command::AddWebFont( + family_name.clone(), + sources.clone(), + sender.clone(), + ); channel_to_self.send(msg).unwrap(); return; }, }; - let command = - Command::AddDownloadedWebFont(family_name.clone(), - url.clone(), - bytes, - sender.clone()); + let command = Command::AddDownloadedWebFont( + family_name.clone(), + url.clone(), + bytes, + sender.clone(), + ); channel_to_self.send(command).unwrap(); - } + }, } }); - } + }, Source::Local(ref font) => { let font_face_name = LowercaseString::new(&font.name); let templates = &mut self.web_families.get_mut(&family_name).unwrap(); @@ -301,7 +326,7 @@ impl FontCache { let msg = Command::AddWebFont(family_name, sources, sender); self.channel_to_self.send(msg).unwrap(); } - } + }, } } @@ -319,7 +344,7 @@ impl FontCache { fn transform_family(&self, family_name: &FontFamilyName) -> LowercaseString { match self.generic_fonts.get(family_name) { None => LowercaseString::from(family_name), - Some(mapped_family) => (*mapped_family).clone() + Some(mapped_family) => (*mapped_family).clone(), } } @@ -347,7 +372,10 @@ impl FontCache { s.find_font_for_style(template_descriptor, &self.font_context) } else { - debug!("FontList: Couldn't find font family with name={}", &*family_name); + debug!( + "FontList: Couldn't find font family with name={}", + &*family_name + ); None } } @@ -371,17 +399,19 @@ impl FontCache { let webrender_api = &self.webrender_api; let webrender_fonts = &mut self.webrender_fonts; - let font_key = *webrender_fonts.entry(template.identifier.clone()).or_insert_with(|| { - let font_key = webrender_api.generate_font_key(); - let mut txn = webrender_api::Transaction::new(); - match (template.bytes_if_in_memory(), template.native_font()) { - (Some(bytes), _) => txn.add_raw_font(font_key, bytes, 0), - (None, Some(native_font)) => txn.add_native_font(font_key, native_font), - (None, None) => txn.add_raw_font(font_key, template.bytes().clone(), 0), - } - webrender_api.update_resources(txn.resource_updates); - font_key - }); + let font_key = *webrender_fonts + .entry(template.identifier.clone()) + .or_insert_with(|| { + let font_key = webrender_api.generate_font_key(); + let mut txn = webrender_api::Transaction::new(); + match (template.bytes_if_in_memory(), template.native_font()) { + (Some(bytes), _) => txn.add_raw_font(font_key, bytes, 0), + (None, Some(native_font)) => txn.add_native_font(font_key, native_font), + (None, None) => txn.add_raw_font(font_key, template.bytes().clone(), 0), + } + webrender_api.update_resources(txn.resource_updates); + font_key + }); FontTemplateInfo { font_template: template, @@ -395,14 +425,15 @@ impl FontCache { family_descriptor: &FontFamilyDescriptor, ) -> Option<FontTemplateInfo> { match family_descriptor.scope { - FontSearchScope::Any => { - self.find_font_in_web_family(&template_descriptor, &family_descriptor.name) - .or_else(|| self.find_font_in_local_family(&template_descriptor, &family_descriptor.name)) - } + FontSearchScope::Any => self + .find_font_in_web_family(&template_descriptor, &family_descriptor.name) + .or_else(|| { + self.find_font_in_local_family(&template_descriptor, &family_descriptor.name) + }), FontSearchScope::Local => { self.find_font_in_local_family(&template_descriptor, &family_descriptor.name) - } + }, }.map(|t| self.get_font_template_info(t)) } } @@ -415,59 +446,82 @@ pub struct FontCacheThread { } impl FontCacheThread { - pub fn new(core_resource_thread: CoreResourceThread, - webrender_api: webrender_api::RenderApi) -> FontCacheThread { + pub fn new( + core_resource_thread: CoreResourceThread, + webrender_api: webrender_api::RenderApi, + ) -> FontCacheThread { let (chan, port) = ipc::channel().unwrap(); let channel_to_self = chan.clone(); - thread::Builder::new().name("FontCacheThread".to_owned()).spawn(move || { - // TODO: Allow users to specify these. - let generic_fonts = populate_generic_fonts(); - - let mut cache = FontCache { - port: port, - channel_to_self, - generic_fonts, - local_families: HashMap::new(), - web_families: HashMap::new(), - font_context: FontContextHandle::new(), - core_resource_thread, - webrender_api, - webrender_fonts: HashMap::new(), - font_instances: HashMap::new(), - }; - - cache.refresh_local_families(); - cache.run(); - }).expect("Thread spawning failed"); - - FontCacheThread { - chan: chan, - } + thread::Builder::new() + .name("FontCacheThread".to_owned()) + .spawn(move || { + // TODO: Allow users to specify these. + let generic_fonts = populate_generic_fonts(); + + let mut cache = FontCache { + port: port, + channel_to_self, + generic_fonts, + local_families: HashMap::new(), + web_families: HashMap::new(), + font_context: FontContextHandle::new(), + core_resource_thread, + webrender_api, + webrender_fonts: HashMap::new(), + font_instances: HashMap::new(), + }; + + cache.refresh_local_families(); + cache.run(); + }).expect("Thread spawning failed"); + + FontCacheThread { chan: chan } } - pub fn add_web_font(&self, family: FamilyName, sources: EffectiveSources, sender: IpcSender<()>) { - self.chan.send(Command::AddWebFont(LowercaseString::new(&family.name), sources, sender)).unwrap(); + pub fn add_web_font( + &self, + family: FamilyName, + sources: EffectiveSources, + sender: IpcSender<()>, + ) { + self.chan + .send(Command::AddWebFont( + LowercaseString::new(&family.name), + sources, + sender, + )).unwrap(); } pub fn exit(&self) { let (response_chan, response_port) = ipc::channel().unwrap(); - self.chan.send(Command::Exit(response_chan)).expect("Couldn't send FontCacheThread exit message"); - response_port.recv().expect("Couldn't receive FontCacheThread reply"); + self.chan + .send(Command::Exit(response_chan)) + .expect("Couldn't send FontCacheThread exit message"); + response_port + .recv() + .expect("Couldn't receive FontCacheThread reply"); } } impl FontSource for FontCacheThread { - fn get_font_instance(&mut self, key: webrender_api::FontKey, size: Au) -> webrender_api::FontInstanceKey { - let (response_chan, response_port) = - ipc::channel().expect("failed to create IPC channel"); - self.chan.send(Command::GetFontInstance(key, size, response_chan)) + fn get_font_instance( + &mut self, + key: webrender_api::FontKey, + size: Au, + ) -> webrender_api::FontInstanceKey { + let (response_chan, response_port) = ipc::channel().expect("failed to create IPC channel"); + self.chan + .send(Command::GetFontInstance(key, size, response_chan)) .expect("failed to send message to font cache thread"); let instance_key = response_port.recv(); if instance_key.is_err() { let font_thread_has_closed = self.chan.send(Command::Ping).is_err(); - assert!(font_thread_has_closed, "Failed to receive a response from live font cache"); + assert!( + font_thread_has_closed, + "Failed to receive a response from live font cache" + ); panic!("Font cache thread has already exited."); } instance_key.unwrap() @@ -478,23 +532,27 @@ impl FontSource for FontCacheThread { template_descriptor: FontTemplateDescriptor, family_descriptor: FontFamilyDescriptor, ) -> Option<FontTemplateInfo> { - let (response_chan, response_port) = - ipc::channel().expect("failed to create IPC channel"); - self.chan.send(Command::GetFontTemplate(template_descriptor, family_descriptor, response_chan)) - .expect("failed to send message to font cache thread"); + let (response_chan, response_port) = ipc::channel().expect("failed to create IPC channel"); + self.chan + .send(Command::GetFontTemplate( + template_descriptor, + family_descriptor, + response_chan, + )).expect("failed to send message to font cache thread"); let reply = response_port.recv(); if reply.is_err() { let font_thread_has_closed = self.chan.send(Command::Ping).is_err(); - assert!(font_thread_has_closed, "Failed to receive a response from live font cache"); + assert!( + font_thread_has_closed, + "Failed to receive a response from live font cache" + ); panic!("Font cache thread has already exited."); } match reply.unwrap() { - Reply::GetFontTemplateReply(data) => { - data - } + Reply::GetFontTemplateReply(data) => data, } } } diff --git a/components/gfx/font_context.rs b/components/gfx/font_context.rs index a09e6cf7b57..6cb4d8e7ed6 100644 --- a/components/gfx/font_context.rs +++ b/components/gfx/font_context.rs @@ -21,14 +21,18 @@ use style::computed_values::font_variant_caps::T as FontVariantCaps; use style::properties::style_structs::Font as FontStyleStruct; use webrender_api; -static SMALL_CAPS_SCALE_FACTOR: f32 = 0.8; // Matches FireFox (see gfxFont.h) +static SMALL_CAPS_SCALE_FACTOR: f32 = 0.8; // Matches FireFox (see gfxFont.h) /// An epoch for the font context cache. The cache is flushed if the current epoch does not match /// this one. static FONT_CACHE_EPOCH: AtomicUsize = ATOMIC_USIZE_INIT; pub trait FontSource { - fn get_font_instance(&mut self, key: webrender_api::FontKey, size: Au) -> webrender_api::FontInstanceKey; + fn get_font_instance( + &mut self, + key: webrender_api::FontKey, + size: Au, + ) -> webrender_api::FontInstanceKey; fn font_template( &mut self, @@ -74,7 +78,7 @@ impl<S: FontSource> FontContext<S> { fn expire_font_caches_if_necessary(&mut self) { let current_epoch = FONT_CACHE_EPOCH.load(Ordering::SeqCst); if current_epoch == self.epoch { - return + return; } self.font_cache.clear(); @@ -95,7 +99,7 @@ impl<S: FontSource> FontContext<S> { }; if let Some(ref font_group) = self.font_group_cache.get(&cache_key) { - return (*font_group).clone() + return (*font_group).clone(); } let font_group = Rc::new(RefCell::new(FontGroup::new(&cache_key.style))); @@ -115,27 +119,31 @@ impl<S: FontSource> FontContext<S> { family_descriptor: family_descriptor.clone(), }; - self.font_cache.get(&cache_key).map(|v| v.clone()).unwrap_or_else(|| { - debug!( - "FontContext::font cache miss for font_descriptor={:?} family_descriptor={:?}", - font_descriptor, - family_descriptor - ); - - let font = - self.font_template(&font_descriptor.template_descriptor, family_descriptor) - .and_then(|template_info| self.create_font(template_info, font_descriptor.to_owned()).ok()) - .map(|font| Rc::new(RefCell::new(font))); - - self.font_cache.insert(cache_key, font.clone()); - font - }) + self.font_cache + .get(&cache_key) + .map(|v| v.clone()) + .unwrap_or_else(|| { + debug!( + "FontContext::font cache miss for font_descriptor={:?} family_descriptor={:?}", + font_descriptor, family_descriptor + ); + + let font = self + .font_template(&font_descriptor.template_descriptor, family_descriptor) + .and_then(|template_info| { + self.create_font(template_info, font_descriptor.to_owned()) + .ok() + }).map(|font| Rc::new(RefCell::new(font))); + + self.font_cache.insert(cache_key, font.clone()); + font + }) } fn font_template( &mut self, template_descriptor: &FontTemplateDescriptor, - family_descriptor: &FontFamilyDescriptor + family_descriptor: &FontFamilyDescriptor, ) -> Option<FontTemplateInfo> { let cache_key = FontTemplateCacheKey { template_descriptor: template_descriptor.clone(), @@ -164,7 +172,7 @@ impl<S: FontSource> FontContext<S> { fn create_font( &mut self, info: FontTemplateInfo, - descriptor: FontDescriptor + descriptor: FontDescriptor, ) -> Result<Font, ()> { // TODO: (Bug #3463): Currently we only support fake small-caps // painting. We should also support true small-caps (where the @@ -177,11 +185,18 @@ impl<S: FontSource> FontContext<S> { let handle = FontHandle::new_from_template( &self.platform_handle, info.font_template, - Some(actual_pt_size) + Some(actual_pt_size), )?; - let font_instance_key = self.font_source.get_font_instance(info.font_key, actual_pt_size); - Ok(Font::new(handle, descriptor.to_owned(), actual_pt_size, font_instance_key)) + let font_instance_key = self + .font_source + .get_font_instance(info.font_key, actual_pt_size); + Ok(Font::new( + handle, + descriptor.to_owned(), + actual_pt_size, + font_instance_key, + )) } } @@ -219,7 +234,10 @@ impl PartialEq for FontGroupCacheKey { impl Eq for FontGroupCacheKey {} impl Hash for FontGroupCacheKey { - fn hash<H>(&self, hasher: &mut H) where H: Hasher { + fn hash<H>(&self, hasher: &mut H) + where + H: Hasher, + { self.style.hash.hash(hasher) } } diff --git a/components/gfx/font_template.rs b/components/gfx/font_template.rs index 8a72360d0dc..80527dfae38 100644 --- a/components/gfx/font_template.rs +++ b/components/gfx/font_template.rs @@ -26,7 +26,6 @@ pub struct FontTemplateDescriptor { pub style: FontStyle, } - /// FontTemplateDescriptor contains floats, which are not Eq because of NaN. However, /// we know they will never be NaN, so we can manually implement Eq. impl Eq for FontTemplateDescriptor {} @@ -41,14 +40,9 @@ fn style_to_number(s: &FontStyle) -> f32 { } } - impl FontTemplateDescriptor { #[inline] - pub fn new( - weight: FontWeight, - stretch: FontStretch, - style: FontStyle, - ) -> Self { + pub fn new(weight: FontWeight, stretch: FontStretch, style: FontStyle) -> Self { Self { weight, stretch, @@ -138,7 +132,10 @@ impl FontTemplate { } /// Get the descriptor. Returns `None` when instantiating the data fails. - pub fn descriptor(&mut self, font_context: &FontContextHandle) -> Option<FontTemplateDescriptor> { + pub fn descriptor( + &mut self, + font_context: &FontContextHandle, + ) -> Option<FontTemplateDescriptor> { // The font template data can be unloaded when nothing is referencing // it (via the Weak reference to the Arc above). However, if we have // already loaded a font, store the style information about it separately, @@ -147,18 +144,22 @@ impl FontTemplate { self.descriptor.or_else(|| { if self.instantiate(font_context).is_err() { - return None + return None; }; - Some(self.descriptor.expect("Instantiation succeeded but no descriptor?")) + Some( + self.descriptor + .expect("Instantiation succeeded but no descriptor?"), + ) }) } /// Get the data for creating a font if it matches a given descriptor. - pub fn data_for_descriptor(&mut self, - fctx: &FontContextHandle, - requested_desc: &FontTemplateDescriptor) - -> Option<Arc<FontTemplateData>> { + pub fn data_for_descriptor( + &mut self, + fctx: &FontContextHandle, + requested_desc: &FontTemplateDescriptor, + ) -> Option<Arc<FontTemplateData>> { self.descriptor(&fctx).and_then(|descriptor| { if *requested_desc == descriptor { self.data().ok() @@ -176,21 +177,20 @@ impl FontTemplate { requested_descriptor: &FontTemplateDescriptor, ) -> Option<(Arc<FontTemplateData>, f32)> { self.descriptor(&font_context).and_then(|descriptor| { - self.data().ok().map(|data| { - (data, descriptor.distance_from(requested_descriptor)) - }) + self.data() + .ok() + .map(|data| (data, descriptor.distance_from(requested_descriptor))) }) } fn instantiate(&mut self, font_context: &FontContextHandle) -> Result<(), ()> { if !self.is_valid { - return Err(()) + return Err(()); } let data = self.data().map_err(|_| ())?; - let handle: Result<FontHandle, ()> = FontHandleMethods::new_from_template(font_context, - data, - None); + let handle: Result<FontHandle, ()> = + FontHandleMethods::new_from_template(font_context, data, None); self.is_valid = handle.is_ok(); let handle = handle?; self.descriptor = Some(FontTemplateDescriptor::new( @@ -220,7 +220,7 @@ impl FontTemplate { }; if let Some(data) = maybe_data { - return Ok(data) + return Ok(data); } assert!(self.strong_ref.is_none()); diff --git a/components/gfx/lib.rs b/components/gfx/lib.rs index a1b72e4e0c9..442a9c8ae3a 100644 --- a/components/gfx/lib.rs +++ b/components/gfx/lib.rs @@ -9,14 +9,18 @@ extern crate app_units; extern crate bitflags; // Mac OS-specific library dependencies -#[cfg(target_os = "macos")] extern crate byteorder; -#[cfg(target_os = "macos")] extern crate core_foundation; -#[cfg(target_os = "macos")] extern crate core_graphics; -#[cfg(target_os = "macos")] extern crate core_text; +#[cfg(target_os = "macos")] +extern crate byteorder; +#[cfg(target_os = "macos")] +extern crate core_foundation; +#[cfg(target_os = "macos")] +extern crate core_graphics; +#[cfg(target_os = "macos")] +extern crate core_text; // Windows-specific library dependencies -#[cfg(target_os = "windows")] extern crate dwrote; -#[cfg(target_os = "windows")] extern crate truetype; +#[cfg(target_os = "windows")] +extern crate dwrote; extern crate euclid; extern crate fnv; @@ -24,8 +28,8 @@ extern crate fnv; #[cfg(target_os = "linux")] extern crate fontconfig; extern crate fontsan; -#[cfg(any(target_os = "linux", target_os = "android"))] extern crate freetype; -#[cfg(any(target_os = "linux", target_os = "android"))] extern crate servo_allocator; +#[cfg(any(target_os = "linux", target_os = "android"))] +extern crate freetype; extern crate gfx_traits; // Eventually we would like the shaper to be pluggable, as many operating systems have their own @@ -35,23 +39,33 @@ extern crate harfbuzz_sys as harfbuzz; extern crate ipc_channel; #[macro_use] extern crate lazy_static; -#[cfg(any(target_os = "linux", target_os = "android"))] extern crate libc; +#[cfg(any(target_os = "linux", target_os = "android"))] +extern crate libc; #[macro_use] extern crate log; #[cfg_attr(target_os = "windows", macro_use)] extern crate malloc_size_of; extern crate net_traits; extern crate ordered_float; -#[cfg(all(feature = "unstable", any(target_feature = "sse2", target_feature = "neon")))] +#[cfg(all( + feature = "unstable", + any(target_feature = "sse2", target_feature = "neon") +))] extern crate packed_simd; extern crate range; -#[macro_use] extern crate serde; +#[macro_use] +extern crate serde; +#[cfg(any(target_os = "linux", target_os = "android"))] +extern crate servo_allocator; extern crate servo_arc; -#[macro_use] extern crate servo_atoms; +#[macro_use] +extern crate servo_atoms; extern crate servo_url; extern crate smallvec; extern crate style; extern crate time; +#[cfg(target_os = "windows")] +extern crate truetype; extern crate ucd; extern crate unicode_bidi; extern crate unicode_script; @@ -61,7 +75,8 @@ extern crate xi_unicode; extern crate xml5ever; // Fonts -#[macro_use] pub mod font; +#[macro_use] +pub mod font; pub mod font_cache_thread; pub mod font_context; pub mod font_template; diff --git a/components/gfx/tests/font_context.rs b/components/gfx/tests/font_context.rs index dc9d1ac2df5..8608f38329e 100644 --- a/components/gfx/tests/font_context.rs +++ b/components/gfx/tests/font_context.rs @@ -58,26 +58,24 @@ impl TestFontSource { } fn add_face(family: &mut FontTemplates, name: &str, identifier: Option<&str>) { - let mut path: PathBuf = [ - env!("CARGO_MANIFEST_DIR"), - "tests", - "support", - "CSSTest", - ].iter().collect(); + let mut path: PathBuf = [env!("CARGO_MANIFEST_DIR"), "tests", "support", "CSSTest"] + .iter() + .collect(); path.push(format!("{}.ttf", name)); let file = File::open(path).unwrap(); let identifier = Atom::from(identifier.unwrap_or(name)); - family.add_template( - identifier, - Some(file.bytes().map(|b| b.unwrap()).collect()) - ) + family.add_template(identifier, Some(file.bytes().map(|b| b.unwrap()).collect())) } } impl FontSource for TestFontSource { - fn get_font_instance(&mut self, _key: webrender_api::FontKey, _size: Au) -> webrender_api::FontInstanceKey { + fn get_font_instance( + &mut self, + _key: webrender_api::FontKey, + _size: Au, + ) -> webrender_api::FontInstanceKey { webrender_api::FontInstanceKey(webrender_api::IdNamespace(0), 0) } @@ -92,11 +90,9 @@ impl FontSource for TestFontSource { self.families .get_mut(family_descriptor.name()) .and_then(|family| family.find_font_for_style(&template_descriptor, handle)) - .map(|template| { - FontTemplateInfo { - font_template: template, - font_key: webrender_api::FontKey(webrender_api::IdNamespace(0), 0), - } + .map(|template| FontTemplateInfo { + font_template: template, + font_key: webrender_api::FontKey(webrender_api::IdNamespace(0), 0), }) } } @@ -116,12 +112,14 @@ fn style() -> FontStyleStruct { } fn font_family(names: Vec<&str>) -> FontFamily { - let names: Vec<SingleFontFamily> = names.into_iter().map(|name| - SingleFontFamily::FamilyName(FamilyName { - name: Atom::from(name), - syntax: FamilyNameSyntax::Quoted, - }) - ).collect(); + let names: Vec<SingleFontFamily> = names + .into_iter() + .map(|name| { + SingleFontFamily::FamilyName(FamilyName { + name: Atom::from(name), + syntax: FamilyNameSyntax::Quoted, + }) + }).collect(); FontFamily(FontFamilyList::new(names.into_boxed_slice())) } @@ -156,19 +154,36 @@ fn test_font_group_find_by_codepoint() { let mut context = FontContext::new(source); let mut style = style(); - style.set_font_family(font_family(vec!("CSSTest ASCII", "CSSTest Basic"))); + style.set_font_family(font_family(vec!["CSSTest ASCII", "CSSTest Basic"])); let group = context.font_group(Arc::new(style)); - let font = group.borrow_mut().find_by_codepoint(&mut context, 'a').unwrap(); + let font = group + .borrow_mut() + .find_by_codepoint(&mut context, 'a') + .unwrap(); assert_eq!(&*font.borrow().identifier(), "csstest-ascii"); - assert_eq!(count.get(), 1, "only the first font in the list should have been loaded"); + assert_eq!( + count.get(), + 1, + "only the first font in the list should have been loaded" + ); - let font = group.borrow_mut().find_by_codepoint(&mut context, 'a').unwrap(); + let font = group + .borrow_mut() + .find_by_codepoint(&mut context, 'a') + .unwrap(); assert_eq!(&*font.borrow().identifier(), "csstest-ascii"); - assert_eq!(count.get(), 1, "we shouldn't load the same font a second time"); + assert_eq!( + count.get(), + 1, + "we shouldn't load the same font a second time" + ); - let font = group.borrow_mut().find_by_codepoint(&mut context, 'á').unwrap(); + let font = group + .borrow_mut() + .find_by_codepoint(&mut context, 'á') + .unwrap(); assert_eq!(&*font.borrow().identifier(), "csstest-basic-regular"); assert_eq!(count.get(), 2, "both fonts should now have been loaded"); } @@ -179,19 +194,27 @@ fn test_font_fallback() { let mut context = FontContext::new(source); let mut style = style(); - style.set_font_family(font_family(vec!("CSSTest ASCII"))); + style.set_font_family(font_family(vec!["CSSTest ASCII"])); let group = context.font_group(Arc::new(style)); - let font = group.borrow_mut().find_by_codepoint(&mut context, 'a').unwrap(); + let font = group + .borrow_mut() + .find_by_codepoint(&mut context, 'a') + .unwrap(); assert_eq!( - &*font.borrow().identifier(), "csstest-ascii", + &*font.borrow().identifier(), + "csstest-ascii", "a family in the group should be used if there is a matching glyph" ); - let font = group.borrow_mut().find_by_codepoint(&mut context, 'á').unwrap(); + let font = group + .borrow_mut() + .find_by_codepoint(&mut context, 'á') + .unwrap(); assert_eq!( - &*font.borrow().identifier(), "fallback", + &*font.borrow().identifier(), + "fallback", "a fallback font should be used if there is no matching glyph in the group" ); } @@ -212,10 +235,8 @@ fn test_font_template_is_cached() { pt_size: Au(10), }; - let family_descriptor = FontFamilyDescriptor::new( - FontFamilyName::from("CSSTest Basic"), - FontSearchScope::Any, - ); + let family_descriptor = + FontFamilyDescriptor::new(FontFamilyName::from("CSSTest Basic"), FontSearchScope::Any); let font1 = context.font(&font_descriptor, &family_descriptor).unwrap(); @@ -228,5 +249,9 @@ fn test_font_template_is_cached() { "the same font should not have been returned" ); - assert_eq!(count.get(), 1, "we should only have fetched the template data from the cache thread once"); + assert_eq!( + count.get(), + 1, + "we should only have fetched the template data from the cache thread once" + ); } diff --git a/components/gfx/tests/font_template.rs b/components/gfx/tests/font_template.rs index e5857ce4ef7..a6caea2f375 100644 --- a/components/gfx/tests/font_template.rs +++ b/components/gfx/tests/font_template.rs @@ -2,9 +2,12 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#[cfg(not(target_os = "macos"))] extern crate gfx; -#[cfg(not(target_os = "macos"))] extern crate servo_atoms; -#[cfg(not(target_os = "macos"))] extern crate style; +#[cfg(not(target_os = "macos"))] +extern crate gfx; +#[cfg(not(target_os = "macos"))] +extern crate servo_atoms; +#[cfg(not(target_os = "macos"))] +extern crate style; // Test doesn't yet run on Mac, see https://github.com/servo/servo/pull/19928 for explanation. #[cfg(not(target_os = "macos"))] @@ -28,14 +31,16 @@ fn test_font_template_descriptor() { "support", "dejavu-fonts-ttf-2.37", "ttf", - ].iter().collect(); + ] + .iter() + .collect(); path.push(format!("{}.ttf", filename)); let file = File::open(path).unwrap(); let mut template = FontTemplate::new( Atom::from(filename), - Some(file.bytes().map(|b| b.unwrap()).collect()) + Some(file.bytes().map(|b| b.unwrap()).collect()), ).unwrap(); let context = FontContextHandle::new(); @@ -43,27 +48,39 @@ fn test_font_template_descriptor() { template.descriptor(&context).unwrap() } - assert_eq!(descriptor("DejaVuSans"), FontTemplateDescriptor { - weight: FontWeight::normal(), - stretch: FontStretch::hundred(), - style: FontStyle::Normal, - }); + assert_eq!( + descriptor("DejaVuSans"), + FontTemplateDescriptor { + weight: FontWeight::normal(), + stretch: FontStretch::hundred(), + style: FontStyle::Normal, + } + ); - assert_eq!(descriptor("DejaVuSans-Bold"), FontTemplateDescriptor { - weight: FontWeight::bold(), - stretch: FontStretch::hundred(), - style: FontStyle::Normal, - }); + assert_eq!( + descriptor("DejaVuSans-Bold"), + FontTemplateDescriptor { + weight: FontWeight::bold(), + stretch: FontStretch::hundred(), + style: FontStyle::Normal, + } + ); - assert_eq!(descriptor("DejaVuSans-Oblique"), FontTemplateDescriptor { - weight: FontWeight::normal(), - stretch: FontStretch::hundred(), - style: FontStyle::Italic, - }); + assert_eq!( + descriptor("DejaVuSans-Oblique"), + FontTemplateDescriptor { + weight: FontWeight::normal(), + stretch: FontStretch::hundred(), + style: FontStyle::Italic, + } + ); - assert_eq!(descriptor("DejaVuSansCondensed-BoldOblique"), FontTemplateDescriptor { - weight: FontWeight::bold(), - stretch: FontStretch(NonNegative(Percentage(0.875))), - style: FontStyle::Italic, - }); + assert_eq!( + descriptor("DejaVuSansCondensed-BoldOblique"), + FontTemplateDescriptor { + weight: FontWeight::bold(), + stretch: FontStretch(NonNegative(Percentage(0.875))), + style: FontStyle::Italic, + } + ); } diff --git a/components/gfx/tests/text_util.rs b/components/gfx/tests/text_util.rs index 7729a6f78a7..0b8132e9c88 100644 --- a/components/gfx/tests/text_util.rs +++ b/components/gfx/tests/text_util.rs @@ -29,26 +29,13 @@ fn test_transform_compress_none() { #[test] fn test_transform_discard_newline() { let test_strs = [ - (" foo bar", - " foo bar"), - - ("foo bar ", - "foo bar "), - - ("foo\n bar", - "foo bar"), - - ("foo \nbar", - "foo bar"), - - (" foo bar \nbaz", - " foo bar baz"), - - ("foo bar baz", - "foo bar baz"), - - ("foobarbaz\n\n", - "foobarbaz"), + (" foo bar", " foo bar"), + ("foo bar ", "foo bar "), + ("foo\n bar", "foo bar"), + ("foo \nbar", "foo bar"), + (" foo bar \nbaz", " foo bar baz"), + ("foo bar baz", "foo bar baz"), + ("foobarbaz\n\n", "foobarbaz"), ]; let mode = CompressionMode::DiscardNewline; @@ -62,26 +49,13 @@ fn test_transform_discard_newline() { #[test] fn test_transform_compress_whitespace() { let test_strs = [ - (" foo bar", - "foo bar"), - - ("foo bar ", - "foo bar "), - - ("foo\n bar", - "foo\n bar"), - - ("foo \nbar", - "foo \nbar"), - - (" foo bar \nbaz", - "foo bar \nbaz"), - - ("foo bar baz", - "foo bar baz"), - - ("foobarbaz\n\n", - "foobarbaz\n\n"), + (" foo bar", "foo bar"), + ("foo bar ", "foo bar "), + ("foo\n bar", "foo\n bar"), + ("foo \nbar", "foo \nbar"), + (" foo bar \nbaz", "foo bar \nbaz"), + ("foo bar baz", "foo bar baz"), + ("foobarbaz\n\n", "foobarbaz\n\n"), ]; let mode = CompressionMode::CompressWhitespace; @@ -95,26 +69,13 @@ fn test_transform_compress_whitespace() { #[test] fn test_transform_compress_whitespace_newline() { let test_strs = vec![ - (" foo bar", - "foo bar"), - - ("foo bar ", - "foo bar "), - - ("foo\n bar", - "foo bar"), - - ("foo \nbar", - "foo bar"), - - (" foo bar \nbaz", - "foo bar baz"), - - ("foo bar baz", - "foo bar baz"), - - ("foobarbaz\n\n", - "foobarbaz "), + (" foo bar", "foo bar"), + ("foo bar ", "foo bar "), + ("foo\n bar", "foo bar"), + ("foo \nbar", "foo bar"), + (" foo bar \nbaz", "foo bar baz"), + ("foo bar baz", "foo bar baz"), + ("foobarbaz\n\n", "foobarbaz "), ]; let mode = CompressionMode::CompressWhitespaceNewline; @@ -128,29 +89,14 @@ fn test_transform_compress_whitespace_newline() { #[test] fn test_transform_compress_whitespace_newline_no_incoming() { let test_strs = [ - (" foo bar", - " foo bar"), - - ("\nfoo bar", - " foo bar"), - - ("foo bar ", - "foo bar "), - - ("foo\n bar", - "foo bar"), - - ("foo \nbar", - "foo bar"), - - (" foo bar \nbaz", - " foo bar baz"), - - ("foo bar baz", - "foo bar baz"), - - ("foobarbaz\n\n", - "foobarbaz "), + (" foo bar", " foo bar"), + ("\nfoo bar", " foo bar"), + ("foo bar ", "foo bar "), + ("foo\n bar", "foo bar"), + ("foo \nbar", "foo bar"), + (" foo bar \nbaz", " foo bar baz"), + ("foo bar baz", "foo bar baz"), + ("foobarbaz\n\n", "foobarbaz "), ]; let mode = CompressionMode::CompressWhitespaceNewline; diff --git a/components/gfx_traits/lib.rs b/components/gfx_traits/lib.rs index 247396ca04e..457814abddf 100644 --- a/components/gfx_traits/lib.rs +++ b/components/gfx_traits/lib.rs @@ -4,13 +4,15 @@ #![crate_name = "gfx_traits"] #![crate_type = "rlib"] - #![deny(unsafe_code)] extern crate malloc_size_of; -#[macro_use] extern crate malloc_size_of_derive; -#[macro_use] extern crate range; -#[macro_use] extern crate serde; +#[macro_use] +extern crate malloc_size_of_derive; +#[macro_use] +extern crate range; +#[macro_use] +extern crate serde; pub mod print_tree; @@ -32,7 +34,7 @@ impl Epoch { pub struct StackingContextId( /// The identifier for this StackingContext, derived from the Flow's memory address /// and fragment type. As a space optimization, these are combined into a single word. - pub u64 + pub u64, ); impl StackingContextId { @@ -87,7 +89,7 @@ fn next_special_id() -> usize { SPECIAL_SCROLL_ROOT_ID_MASK } -pub fn combine_id_with_fragment_type(id: usize, fragment_type: FragmentType) -> usize { +pub fn combine_id_with_fragment_type(id: usize, fragment_type: FragmentType) -> usize { debug_assert_eq!(id & (fragment_type as usize), 0); if fragment_type == FragmentType::FragmentBody { id diff --git a/components/hashglobe/src/alloc.rs b/components/hashglobe/src/alloc.rs index b0d622972db..b1c7a6eca5e 100644 --- a/components/hashglobe/src/alloc.rs +++ b/components/hashglobe/src/alloc.rs @@ -1,25 +1,26 @@ // FORK NOTE: Copied from liballoc_system, removed unnecessary APIs, // APIs take size/align directly instead of Layout - - - // The minimum alignment guaranteed by the architecture. This value is used to // add fast paths for low alignment values. In practice, the alignment is a // constant at the call site and the branch will be optimized out. -#[cfg(all(any(target_arch = "x86", - target_arch = "arm", - target_arch = "mips", - target_arch = "powerpc", - target_arch = "powerpc64", - target_arch = "asmjs", - target_arch = "wasm32")))] +#[cfg(all(any( + target_arch = "x86", + target_arch = "arm", + target_arch = "mips", + target_arch = "powerpc", + target_arch = "powerpc64", + target_arch = "asmjs", + target_arch = "wasm32" +)))] const MIN_ALIGN: usize = 8; -#[cfg(all(any(target_arch = "x86_64", - target_arch = "aarch64", - target_arch = "mips64", - target_arch = "s390x", - target_arch = "sparc64")))] +#[cfg(all(any( + target_arch = "x86_64", + target_arch = "aarch64", + target_arch = "mips64", + target_arch = "s390x", + target_arch = "sparc64" +)))] const MIN_ALIGN: usize = 16; pub use self::platform::{alloc, dealloc, realloc}; @@ -100,7 +101,6 @@ mod platform { type DWORD = u32; type BOOL = i32; - extern "system" { fn GetProcessHeap() -> HANDLE; fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T) -> LPVOID; @@ -123,8 +123,7 @@ mod platform { } #[inline] - unsafe fn allocate_with_flags(size: usize, align: usize, flags: DWORD) -> *mut u8 - { + unsafe fn allocate_with_flags(size: usize, align: usize, flags: DWORD) -> *mut u8 { if align <= MIN_ALIGN { HeapAlloc(GetProcessHeap(), flags, size) } else { @@ -147,21 +146,16 @@ mod platform { pub unsafe fn dealloc(ptr: *mut u8, align: usize) { if align <= MIN_ALIGN { let err = HeapFree(GetProcessHeap(), 0, ptr as LPVOID); - debug_assert!(err != 0, "Failed to free heap memory: {}", - GetLastError()); + debug_assert!(err != 0, "Failed to free heap memory: {}", GetLastError()); } else { let header = get_header(ptr); let err = HeapFree(GetProcessHeap(), 0, header.0 as LPVOID); - debug_assert!(err != 0, "Failed to free heap memory: {}", - GetLastError()); + debug_assert!(err != 0, "Failed to free heap memory: {}", GetLastError()); } } #[inline] pub unsafe fn realloc(ptr: *mut u8, new_size: usize) -> *mut u8 { - HeapReAlloc(GetProcessHeap(), - 0, - ptr as LPVOID, - new_size) as *mut u8 + HeapReAlloc(GetProcessHeap(), 0, ptr as LPVOID, new_size) as *mut u8 } } diff --git a/components/hashglobe/src/fake.rs b/components/hashglobe/src/fake.rs index eba21e04148..c5cd9d39bb7 100644 --- a/components/hashglobe/src/fake.rs +++ b/components/hashglobe/src/fake.rs @@ -26,7 +26,6 @@ pub use std::collections::hash_set::{Iter as SetIter, IntoIter as SetIntoIter}; #[derive(Clone)] pub struct HashMap<K, V, S = RandomState>(StdMap<K, V, S>); - use FailedAllocationError; impl<K, V, S> Deref for HashMap<K, V, S> { @@ -43,8 +42,9 @@ impl<K, V, S> DerefMut for HashMap<K, V, S> { } impl<K, V, S> HashMap<K, V, S> - where K: Eq + Hash, - S: BuildHasher +where + K: Eq + Hash, + S: BuildHasher, { #[inline] pub fn try_with_hasher(hash_builder: S) -> Result<HashMap<K, V, S>, FailedAllocationError> { @@ -52,17 +52,20 @@ impl<K, V, S> HashMap<K, V, S> } #[inline] - pub fn try_with_capacity_and_hasher(capacity: usize, - hash_builder: S) - -> Result<HashMap<K, V, S>, FailedAllocationError> { - Ok(HashMap(StdMap::with_capacity_and_hasher(capacity, hash_builder))) + pub fn try_with_capacity_and_hasher( + capacity: usize, + hash_builder: S, + ) -> Result<HashMap<K, V, S>, FailedAllocationError> { + Ok(HashMap(StdMap::with_capacity_and_hasher( + capacity, + hash_builder, + ))) } pub fn with_capacity_and_hasher(capacity: usize, hash_builder: S) -> HashMap<K, V, S> { HashMap(StdMap::with_capacity_and_hasher(capacity, hash_builder)) } - #[inline] pub fn try_reserve(&mut self, additional: usize) -> Result<(), FailedAllocationError> { Ok(self.reserve(additional)) @@ -85,7 +88,6 @@ impl<K, V, S> HashMap<K, V, S> #[derive(Clone)] pub struct HashSet<T, S = RandomState>(StdSet<T, S>); - impl<T, S> Deref for HashSet<T, S> { type Target = StdSet<T, S>; fn deref(&self) -> &Self::Target { @@ -111,17 +113,16 @@ impl<T: Hash + Eq> HashSet<T, RandomState> { } } - impl<T, S> HashSet<T, S> - where T: Eq + Hash, - S: BuildHasher +where + T: Eq + Hash, + S: BuildHasher, { #[inline] pub fn with_hasher(hasher: S) -> HashSet<T, S> { HashSet(StdSet::with_hasher(hasher)) } - #[inline] pub fn with_capacity_and_hasher(capacity: usize, hasher: S) -> HashSet<T, S> { HashSet(StdSet::with_capacity_and_hasher(capacity, hasher)) @@ -153,18 +154,21 @@ impl<K: Hash + Eq, V, S: BuildHasher + Default> Default for HashMap<K, V, S> { } impl<K, V, S> fmt::Debug for HashMap<K, V, S> - where K: Eq + Hash + fmt::Debug, - V: fmt::Debug, - S: BuildHasher { +where + K: Eq + Hash + fmt::Debug, + V: fmt::Debug, + S: BuildHasher, +{ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.0.fmt(f) } } impl<K, V, S> PartialEq for HashMap<K, V, S> - where K: Eq + Hash, - V: PartialEq, - S: BuildHasher +where + K: Eq + Hash, + V: PartialEq, + S: BuildHasher, { fn eq(&self, other: &HashMap<K, V, S>) -> bool { self.0.eq(&other.0) @@ -172,15 +176,17 @@ impl<K, V, S> PartialEq for HashMap<K, V, S> } impl<K, V, S> Eq for HashMap<K, V, S> - where K: Eq + Hash, - V: Eq, - S: BuildHasher +where + K: Eq + Hash, + V: Eq, + S: BuildHasher, { } impl<'a, K, V, S> IntoIterator for &'a HashMap<K, V, S> - where K: Eq + Hash, - S: BuildHasher +where + K: Eq + Hash, + S: BuildHasher, { type Item = (&'a K, &'a V); type IntoIter = MapIter<'a, K, V>; @@ -191,8 +197,9 @@ impl<'a, K, V, S> IntoIterator for &'a HashMap<K, V, S> } impl<'a, K, V, S> IntoIterator for &'a mut HashMap<K, V, S> - where K: Eq + Hash, - S: BuildHasher +where + K: Eq + Hash, + S: BuildHasher, { type Item = (&'a K, &'a mut V); type IntoIter = MapIterMut<'a, K, V>; @@ -209,8 +216,9 @@ impl<T: Eq + Hash, S: BuildHasher + Default> Default for HashSet<T, S> { } impl<T, S> fmt::Debug for HashSet<T, S> - where T: Eq + Hash + fmt::Debug, - S: BuildHasher +where + T: Eq + Hash + fmt::Debug, + S: BuildHasher, { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.0.fmt(f) @@ -218,8 +226,9 @@ impl<T, S> fmt::Debug for HashSet<T, S> } impl<T, S> PartialEq for HashSet<T, S> - where T: Eq + Hash, - S: BuildHasher +where + T: Eq + Hash, + S: BuildHasher, { fn eq(&self, other: &HashSet<T, S>) -> bool { self.0.eq(&other.0) @@ -227,14 +236,16 @@ impl<T, S> PartialEq for HashSet<T, S> } impl<T, S> Eq for HashSet<T, S> - where T: Eq + Hash, - S: BuildHasher +where + T: Eq + Hash, + S: BuildHasher, { } impl<'a, T, S> IntoIterator for &'a HashSet<T, S> - where T: Eq + Hash, - S: BuildHasher +where + T: Eq + Hash, + S: BuildHasher, { type Item = &'a T; type IntoIter = SetIter<'a, T>; @@ -245,16 +256,14 @@ impl<'a, T, S> IntoIterator for &'a HashSet<T, S> } impl<T, S> IntoIterator for HashSet<T, S> - where T: Eq + Hash, - S: BuildHasher +where + T: Eq + Hash, + S: BuildHasher, { type Item = T; type IntoIter = SetIntoIter<T>; - fn into_iter(self) -> SetIntoIter<T> { self.0.into_iter() } } - - diff --git a/components/hashglobe/src/hash_map.rs b/components/hashglobe/src/hash_map.rs index 27077526b3a..57ac9bcc049 100644 --- a/components/hashglobe/src/hash_map.rs +++ b/components/hashglobe/src/hash_map.rs @@ -25,7 +25,7 @@ use super::table::BucketState::{Empty, Full}; use FailedAllocationError; -const MIN_NONZERO_RAW_CAPACITY: usize = 32; // must be a power of two +const MIN_NONZERO_RAW_CAPACITY: usize = 32; // must be a power of two /// The default behavior of HashMap implements a maximum load factor of 90.9%. #[derive(Clone)] @@ -50,7 +50,9 @@ impl DefaultResizePolicy { // 3. Ensure it is at least the minimum size. let mut raw_cap = len * 11 / 10; assert!(raw_cap >= len, "raw_cap overflow"); - raw_cap = raw_cap.checked_next_power_of_two().expect("raw_capacity overflow"); + raw_cap = raw_cap + .checked_next_power_of_two() + .expect("raw_capacity overflow"); raw_cap = max(MIN_NONZERO_RAW_CAPACITY, raw_cap); raw_cap } @@ -398,8 +400,9 @@ pub struct HashMap<K, V, S = RandomState> { /// Search for a pre-hashed key. #[inline] fn search_hashed<K, V, M, F>(table: M, hash: SafeHash, mut is_match: F) -> InternalEntry<K, V, M> - where M: Deref<Target = RawTable<K, V>>, - F: FnMut(&K) -> bool +where + M: Deref<Target = RawTable<K, V>>, + F: FnMut(&K) -> bool, { // This is the only function where capacity can be zero. To avoid // undefined behavior when Bucket::new gets the raw bucket in this @@ -420,7 +423,7 @@ fn search_hashed<K, V, M, F>(table: M, hash: SafeHash, mut is_match: F) -> Inter hash, elem: NoElem(bucket, displacement), }; - } + }, Full(bucket) => bucket, }; @@ -449,9 +452,7 @@ fn search_hashed<K, V, M, F>(table: M, hash: SafeHash, mut is_match: F) -> Inter } } -fn pop_internal<K, V>(starting_bucket: FullBucketMut<K, V>) - -> (K, V, &mut RawTable<K, V>) -{ +fn pop_internal<K, V>(starting_bucket: FullBucketMut<K, V>) -> (K, V, &mut RawTable<K, V>) { let (empty, retkey, retval) = starting_bucket.take(); let mut gap = match empty.gap_peek() { Ok(b) => b, @@ -475,12 +476,13 @@ fn pop_internal<K, V>(starting_bucket: FullBucketMut<K, V>) /// also pass that bucket's displacement so we don't have to recalculate it. /// /// `hash`, `key`, and `val` are the elements to "robin hood" into the hashtable. -fn robin_hood<'a, K: 'a, V: 'a>(bucket: FullBucketMut<'a, K, V>, - mut displacement: usize, - mut hash: SafeHash, - mut key: K, - mut val: V) - -> FullBucketMut<'a, K, V> { +fn robin_hood<'a, K: 'a, V: 'a>( + bucket: FullBucketMut<'a, K, V>, + mut displacement: usize, + mut hash: SafeHash, + mut key: K, + mut val: V, +) -> FullBucketMut<'a, K, V> { let size = bucket.table().size(); let raw_capacity = bucket.table().capacity(); // There can be at most `size - dib` buckets to displace, because @@ -513,7 +515,7 @@ fn robin_hood<'a, K: 'a, V: 'a>(bucket: FullBucketMut<'a, K, V>, // FullBucketMut, into just one FullBucketMut. The "table" // refers to the inner FullBucketMut in this context. return bucket.into_table(); - } + }, Full(bucket) => bucket, }; @@ -531,11 +533,13 @@ fn robin_hood<'a, K: 'a, V: 'a>(bucket: FullBucketMut<'a, K, V>, } impl<K, V, S> HashMap<K, V, S> - where K: Eq + Hash, - S: BuildHasher +where + K: Eq + Hash, + S: BuildHasher, { fn make_hash<X: ?Sized>(&self, x: &X) -> SafeHash - where X: Hash + where + X: Hash, { table::make_hash(&self.hash_builder, x) } @@ -545,8 +549,9 @@ impl<K, V, S> HashMap<K, V, S> /// search_hashed. #[inline] fn search<'a, Q: ?Sized>(&'a self, q: &Q) -> InternalEntry<K, V, &'a RawTable<K, V>> - where K: Borrow<Q>, - Q: Eq + Hash + where + K: Borrow<Q>, + Q: Eq + Hash, { let hash = self.make_hash(q); search_hashed(&self.table, hash, |k| q.eq(k.borrow())) @@ -554,8 +559,9 @@ impl<K, V, S> HashMap<K, V, S> #[inline] fn search_mut<'a, Q: ?Sized>(&'a mut self, q: &Q) -> InternalEntry<K, V, &'a mut RawTable<K, V>> - where K: Borrow<Q>, - Q: Eq + Hash + where + K: Borrow<Q>, + Q: Eq + Hash, { let hash = self.make_hash(q); search_hashed(&mut self.table, hash, |k| q.eq(k.borrow())) @@ -574,7 +580,7 @@ impl<K, V, S> HashMap<K, V, S> Empty(empty) => { empty.put(hash, k, v); return; - } + }, Full(b) => b.into_bucket(), }; buckets.next(); @@ -584,8 +590,9 @@ impl<K, V, S> HashMap<K, V, S> } impl<K, V, S> HashMap<K, V, S> - where K: Eq + Hash, - S: BuildHasher +where + K: Eq + Hash, + S: BuildHasher, { /// Creates an empty `HashMap` which will use the given hash builder to hash /// keys. @@ -643,7 +650,10 @@ impl<K, V, S> HashMap<K, V, S> /// map.insert(1, 2); /// ``` #[inline] - pub fn try_with_capacity_and_hasher(capacity: usize, hash_builder: S) -> Result<HashMap<K, V, S>, FailedAllocationError> { + pub fn try_with_capacity_and_hasher( + capacity: usize, + hash_builder: S, + ) -> Result<HashMap<K, V, S>, FailedAllocationError> { let resize_policy = DefaultResizePolicy::new(); let raw_cap = resize_policy.raw_capacity(capacity); Ok(HashMap { @@ -708,12 +718,14 @@ impl<K, V, S> HashMap<K, V, S> self.try_reserve(additional).unwrap(); } - #[inline] pub fn try_reserve(&mut self, additional: usize) -> Result<(), FailedAllocationError> { let remaining = self.capacity() - self.len(); // this can't overflow if remaining < additional { - let min_cap = self.len().checked_add(additional).expect("reserve overflow"); + let min_cap = self + .len() + .checked_add(additional) + .expect("reserve overflow"); let raw_cap = self.resize_policy.raw_capacity(min_cap); self.try_resize(raw_cap)?; } else if self.table.tag() && remaining <= self.len() { @@ -763,7 +775,7 @@ impl<K, V, S> HashMap<K, V, S> break; } b.into_bucket() - } + }, Empty(b) => b.into_bucket(), }; bucket.next(); @@ -822,7 +834,7 @@ impl<K, V, S> HashMap<K, V, S> Some(Vacant(elem)) => { elem.insert(v); None - } + }, None => unreachable!(), } } @@ -892,7 +904,9 @@ impl<K, V, S> HashMap<K, V, S> /// } /// ``` pub fn values_mut(&mut self) -> ValuesMut<K, V> { - ValuesMut { inner: self.iter_mut() } + ValuesMut { + inner: self.iter_mut(), + } } /// An iterator visiting all key-value pairs in arbitrary order. @@ -913,7 +927,9 @@ impl<K, V, S> HashMap<K, V, S> /// } /// ``` pub fn iter(&self) -> Iter<K, V> { - Iter { inner: self.table.iter() } + Iter { + inner: self.table.iter(), + } } /// An iterator visiting all key-value pairs in arbitrary order, @@ -940,7 +956,9 @@ impl<K, V, S> HashMap<K, V, S> /// } /// ``` pub fn iter_mut(&mut self) -> IterMut<K, V> { - IterMut { inner: self.table.iter_mut() } + IterMut { + inner: self.table.iter_mut(), + } } /// Gets the given key's corresponding entry in the map for in-place manipulation. @@ -972,7 +990,8 @@ impl<K, V, S> HashMap<K, V, S> self.try_reserve(1)?; let hash = self.make_hash(&key); Ok(search_hashed(&mut self.table, hash, |q| q.eq(&key)) - .into_entry(key).expect("unreachable")) + .into_entry(key) + .expect("unreachable")) } /// Returns the number of elements in the map. @@ -1028,8 +1047,14 @@ impl<K, V, S> HashMap<K, V, S> /// assert!(a.is_empty()); /// ``` #[inline] - pub fn drain(&mut self) -> Drain<K, V> where K: 'static, V: 'static { - Drain { inner: self.table.drain() } + pub fn drain(&mut self) -> Drain<K, V> + where + K: 'static, + V: 'static, + { + Drain { + inner: self.table.drain(), + } } /// Clears the map, removing all key-value pairs. Keeps the allocated memory @@ -1046,7 +1071,11 @@ impl<K, V, S> HashMap<K, V, S> /// assert!(a.is_empty()); /// ``` #[inline] - pub fn clear(&mut self) where K: 'static, V: 'static { + pub fn clear(&mut self) + where + K: 'static, + V: 'static, + { self.drain(); } @@ -1070,10 +1099,13 @@ impl<K, V, S> HashMap<K, V, S> /// assert_eq!(map.get(&2), None); /// ``` pub fn get<Q: ?Sized>(&self, k: &Q) -> Option<&V> - where K: Borrow<Q>, - Q: Hash + Eq + where + K: Borrow<Q>, + Q: Hash + Eq, { - self.search(k).into_occupied_bucket().map(|bucket| bucket.into_refs().1) + self.search(k) + .into_occupied_bucket() + .map(|bucket| bucket.into_refs().1) } /// Returns true if the map contains a value for the specified key. @@ -1096,8 +1128,9 @@ impl<K, V, S> HashMap<K, V, S> /// assert_eq!(map.contains_key(&2), false); /// ``` pub fn contains_key<Q: ?Sized>(&self, k: &Q) -> bool - where K: Borrow<Q>, - Q: Hash + Eq + where + K: Borrow<Q>, + Q: Hash + Eq, { self.search(k).into_occupied_bucket().is_some() } @@ -1124,10 +1157,13 @@ impl<K, V, S> HashMap<K, V, S> /// assert_eq!(map[&1], "b"); /// ``` pub fn get_mut<Q: ?Sized>(&mut self, k: &Q) -> Option<&mut V> - where K: Borrow<Q>, - Q: Hash + Eq + where + K: Borrow<Q>, + Q: Hash + Eq, { - self.search_mut(k).into_occupied_bucket().map(|bucket| bucket.into_mut_refs().1) + self.search_mut(k) + .into_occupied_bucket() + .map(|bucket| bucket.into_mut_refs().1) } /// Inserts a key-value pair into the map. @@ -1187,14 +1223,17 @@ impl<K, V, S> HashMap<K, V, S> /// assert_eq!(map.remove(&1), None); /// ``` pub fn remove<Q: ?Sized>(&mut self, k: &Q) -> Option<V> - where K: Borrow<Q>, - Q: Hash + Eq + where + K: Borrow<Q>, + Q: Hash + Eq, { if self.table.size() == 0 { return None; } - self.search_mut(k).into_occupied_bucket().map(|bucket| pop_internal(bucket).1) + self.search_mut(k) + .into_occupied_bucket() + .map(|bucket| pop_internal(bucket).1) } /// Retains only the elements specified by the predicate. @@ -1211,7 +1250,8 @@ impl<K, V, S> HashMap<K, V, S> /// assert_eq!(map.len(), 4); /// ``` pub fn retain<F>(&mut self, mut f: F) - where F: FnMut(&K, &mut V) -> bool + where + F: FnMut(&K, &mut V) -> bool, { if self.table.size() == 0 { return; @@ -1236,41 +1276,43 @@ impl<K, V, S> HashMap<K, V, S> full.into_bucket() } }, - Empty(b) => { - b.into_bucket() - } + Empty(b) => b.into_bucket(), }; - bucket.prev(); // reverse iteration + bucket.prev(); // reverse iteration debug_assert!(elems_left == 0 || bucket.index() != start_index); } } } impl<K, V, S> PartialEq for HashMap<K, V, S> - where K: Eq + Hash, - V: PartialEq, - S: BuildHasher +where + K: Eq + Hash, + V: PartialEq, + S: BuildHasher, { fn eq(&self, other: &HashMap<K, V, S>) -> bool { if self.len() != other.len() { return false; } - self.iter().all(|(key, value)| other.get(key).map_or(false, |v| *value == *v)) + self.iter() + .all(|(key, value)| other.get(key).map_or(false, |v| *value == *v)) } } impl<K, V, S> Eq for HashMap<K, V, S> - where K: Eq + Hash, - V: Eq, - S: BuildHasher +where + K: Eq + Hash, + V: Eq, + S: BuildHasher, { } impl<K, V, S> Debug for HashMap<K, V, S> - where K: Eq + Hash + Debug, - V: Debug, - S: BuildHasher +where + K: Eq + Hash + Debug, + V: Debug, + S: BuildHasher, { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_map().entries(self.iter()).finish() @@ -1278,8 +1320,9 @@ impl<K, V, S> Debug for HashMap<K, V, S> } impl<K, V, S> Default for HashMap<K, V, S> - where K: Eq + Hash, - S: BuildHasher + Default +where + K: Eq + Hash, + S: BuildHasher + Default, { /// Creates an empty `HashMap<K, V, S>`, with the `Default` value for the hasher. fn default() -> HashMap<K, V, S> { @@ -1288,9 +1331,10 @@ impl<K, V, S> Default for HashMap<K, V, S> } impl<'a, K, Q: ?Sized, V, S> Index<&'a Q> for HashMap<K, V, S> - where K: Eq + Hash + Borrow<Q>, - Q: Eq + Hash, - S: BuildHasher +where + K: Eq + Hash + Borrow<Q>, + Q: Eq + Hash, + S: BuildHasher, { type Output = V; @@ -1314,15 +1358,15 @@ pub struct Iter<'a, K: 'a, V: 'a> { // FIXME(#19839) Remove in favor of `#[derive(Clone)]` impl<'a, K, V> Clone for Iter<'a, K, V> { fn clone(&self) -> Iter<'a, K, V> { - Iter { inner: self.inner.clone() } + Iter { + inner: self.inner.clone(), + } } } impl<'a, K: Debug, V: Debug> fmt::Debug for Iter<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_list() - .entries(self.clone()) - .finish() + f.debug_list().entries(self.clone()).finish() } } @@ -1362,15 +1406,15 @@ pub struct Keys<'a, K: 'a, V: 'a> { // FIXME(#19839) Remove in favor of `#[derive(Clone)]` impl<'a, K, V> Clone for Keys<'a, K, V> { fn clone(&self) -> Keys<'a, K, V> { - Keys { inner: self.inner.clone() } + Keys { + inner: self.inner.clone(), + } } } impl<'a, K: Debug, V> fmt::Debug for Keys<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_list() - .entries(self.clone()) - .finish() + f.debug_list().entries(self.clone()).finish() } } @@ -1388,15 +1432,15 @@ pub struct Values<'a, K: 'a, V: 'a> { // FIXME(#19839) Remove in favor of `#[derive(Clone)]` impl<'a, K, V> Clone for Values<'a, K, V> { fn clone(&self) -> Values<'a, K, V> { - Values { inner: self.inner.clone() } + Values { + inner: self.inner.clone(), + } } } impl<'a, K, V: Debug> fmt::Debug for Values<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_list() - .entries(self.clone()) - .finish() + f.debug_list().entries(self.clone()).finish() } } @@ -1423,7 +1467,9 @@ pub struct ValuesMut<'a, K: 'a, V: 'a> { } enum InternalEntry<K, V, M> { - Occupied { elem: FullBucket<K, V, M> }, + Occupied { + elem: FullBucket<K, V, M>, + }, Vacant { hash: SafeHash, elem: VacantEntryState<K, V, M>, @@ -1445,19 +1491,11 @@ impl<'a, K, V> InternalEntry<K, V, &'a mut RawTable<K, V>> { #[inline] fn into_entry(self, key: K) -> Option<Entry<'a, K, V>> { match self { - InternalEntry::Occupied { elem } => { - Some(Occupied(OccupiedEntry { - key: Some(key), - elem, - })) - } - InternalEntry::Vacant { hash, elem } => { - Some(Vacant(VacantEntry { - hash, - key, - elem, - })) - } + InternalEntry::Occupied { elem } => Some(Occupied(OccupiedEntry { + key: Some(key), + elem, + })), + InternalEntry::Vacant { hash, elem } => Some(Vacant(VacantEntry { hash, key, elem })), InternalEntry::TableIsEmpty => None, } } @@ -1471,25 +1509,17 @@ impl<'a, K, V> InternalEntry<K, V, &'a mut RawTable<K, V>> { /// [`entry`]: struct.HashMap.html#method.entry pub enum Entry<'a, K: 'a, V: 'a> { /// An occupied entry. - Occupied( OccupiedEntry<'a, K, V>), + Occupied(OccupiedEntry<'a, K, V>), /// A vacant entry. - Vacant( VacantEntry<'a, K, V>), + Vacant(VacantEntry<'a, K, V>), } impl<'a, K: 'a + Debug, V: 'a + Debug> Debug for Entry<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { - Vacant(ref v) => { - f.debug_tuple("Entry") - .field(v) - .finish() - } - Occupied(ref o) => { - f.debug_tuple("Entry") - .field(o) - .finish() - } + Vacant(ref v) => f.debug_tuple("Entry").field(v).finish(), + Occupied(ref o) => f.debug_tuple("Entry").field(o).finish(), } } } @@ -1524,9 +1554,7 @@ pub struct VacantEntry<'a, K: 'a, V: 'a> { impl<'a, K: 'a + Debug, V: 'a> Debug for VacantEntry<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("VacantEntry") - .field(self.key()) - .finish() + f.debug_tuple("VacantEntry").field(self.key()).finish() } } @@ -1540,8 +1568,9 @@ enum VacantEntryState<K, V, M> { } impl<'a, K, V, S> IntoIterator for &'a HashMap<K, V, S> - where K: Eq + Hash, - S: BuildHasher +where + K: Eq + Hash, + S: BuildHasher, { type Item = (&'a K, &'a V); type IntoIter = Iter<'a, K, V>; @@ -1552,8 +1581,9 @@ impl<'a, K, V, S> IntoIterator for &'a HashMap<K, V, S> } impl<'a, K, V, S> IntoIterator for &'a mut HashMap<K, V, S> - where K: Eq + Hash, - S: BuildHasher +where + K: Eq + Hash, + S: BuildHasher, { type Item = (&'a K, &'a mut V); type IntoIter = IterMut<'a, K, V>; @@ -1564,8 +1594,9 @@ impl<'a, K, V, S> IntoIterator for &'a mut HashMap<K, V, S> } impl<K, V, S> IntoIterator for HashMap<K, V, S> - where K: Eq + Hash, - S: BuildHasher +where + K: Eq + Hash, + S: BuildHasher, { type Item = (K, V); type IntoIter = IntoIter<K, V>; @@ -1588,7 +1619,9 @@ impl<K, V, S> IntoIterator for HashMap<K, V, S> /// let vec: Vec<(&str, isize)> = map.into_iter().collect(); /// ``` fn into_iter(self) -> IntoIter<K, V> { - IntoIter { inner: self.table.into_iter() } + IntoIter { + inner: self.table.into_iter(), + } } } @@ -1611,7 +1644,6 @@ impl<'a, K, V> ExactSizeIterator for Iter<'a, K, V> { } } - impl<'a, K, V> Iterator for IterMut<'a, K, V> { type Item = (&'a K, &'a mut V); @@ -1632,13 +1664,12 @@ impl<'a, K, V> ExactSizeIterator for IterMut<'a, K, V> { } impl<'a, K, V> fmt::Debug for IterMut<'a, K, V> - where K: fmt::Debug, - V: fmt::Debug, +where + K: fmt::Debug, + V: fmt::Debug, { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_list() - .entries(self.inner.iter()) - .finish() + f.debug_list().entries(self.inner.iter()).finish() } } @@ -1663,9 +1694,7 @@ impl<K, V> ExactSizeIterator for IntoIter<K, V> { impl<K: Debug, V: Debug> fmt::Debug for IntoIter<K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_list() - .entries(self.inner.iter()) - .finish() + f.debug_list().entries(self.inner.iter()).finish() } } @@ -1726,13 +1755,12 @@ impl<'a, K, V> ExactSizeIterator for ValuesMut<'a, K, V> { } impl<'a, K, V> fmt::Debug for ValuesMut<'a, K, V> - where K: fmt::Debug, - V: fmt::Debug, +where + K: fmt::Debug, + V: fmt::Debug, { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_list() - .entries(self.inner.inner.iter()) - .finish() + f.debug_list().entries(self.inner.inner.iter()).finish() } } @@ -1756,20 +1784,19 @@ impl<'a, K, V> ExactSizeIterator for Drain<'a, K, V> { } impl<'a, K, V> fmt::Debug for Drain<'a, K, V> - where K: fmt::Debug, - V: fmt::Debug, +where + K: fmt::Debug, + V: fmt::Debug, { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_list() - .entries(self.inner.iter()) - .finish() + f.debug_list().entries(self.inner.iter()).finish() } } // FORK NOTE: Removed Placer impl impl<'a, K, V> Entry<'a, K, V> { - /// Ensures a value is in the entry by inserting the default if empty, and returns + /// Ensures a value is in the entry by inserting the default if empty, and returns /// a mutable reference to the value in the entry. /// /// # Examples @@ -1792,7 +1819,7 @@ impl<'a, K, V> Entry<'a, K, V> { } } - /// Ensures a value is in the entry by inserting the result of the default function if empty, + /// Ensures a value is in the entry by inserting the result of the default function if empty, /// and returns a mutable reference to the value in the entry. /// /// # Examples @@ -1824,7 +1851,7 @@ impl<'a, K, V> Entry<'a, K, V> { /// let mut map: HashMap<&str, u32> = HashMap::new(); /// assert_eq!(map.entry("poneyland").key(), &"poneyland"); /// ``` - pub fn key(&self) -> &K { + pub fn key(&self) -> &K { match *self { Occupied(ref entry) => entry.key(), Vacant(ref entry) => entry.key(), @@ -1844,7 +1871,7 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> { /// map.entry("poneyland").or_insert(12); /// assert_eq!(map.entry("poneyland").key(), &"poneyland"); /// ``` - pub fn key(&self) -> &K { + pub fn key(&self) -> &K { self.elem.read().0 } @@ -1866,7 +1893,7 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> { /// /// assert_eq!(map.contains_key("poneyland"), false); /// ``` - pub fn remove_entry(self) -> (K, V) { + pub fn remove_entry(self) -> (K, V) { let (k, v, _) = pop_internal(self.elem); (k, v) } @@ -1886,7 +1913,7 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> { /// assert_eq!(o.get(), &12); /// } /// ``` - pub fn get(&self) -> &V { + pub fn get(&self) -> &V { self.elem.read().1 } @@ -1908,7 +1935,7 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> { /// /// assert_eq!(map["poneyland"], 22); /// ``` - pub fn get_mut(&mut self) -> &mut V { + pub fn get_mut(&mut self) -> &mut V { self.elem.read_mut().1 } @@ -1931,7 +1958,7 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> { /// /// assert_eq!(map["poneyland"], 22); /// ``` - pub fn into_mut(self) -> &'a mut V { + pub fn into_mut(self) -> &'a mut V { self.elem.into_mut_refs().1 } @@ -1952,7 +1979,7 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> { /// /// assert_eq!(map["poneyland"], 15); /// ``` - pub fn insert(&mut self, mut value: V) -> V { + pub fn insert(&mut self, mut value: V) -> V { let old_value = self.get_mut(); mem::swap(&mut value, old_value); value @@ -1975,7 +2002,7 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> { /// /// assert_eq!(map.contains_key("poneyland"), false); /// ``` - pub fn remove(self) -> V { + pub fn remove(self) -> V { pop_internal(self.elem).1 } @@ -1999,7 +2026,7 @@ impl<'a, K: 'a, V: 'a> VacantEntry<'a, K, V> { /// let mut map: HashMap<&str, u32> = HashMap::new(); /// assert_eq!(map.entry("poneyland").key(), &"poneyland"); /// ``` - pub fn key(&self) -> &K { + pub fn key(&self) -> &K { &self.key } @@ -2017,7 +2044,7 @@ impl<'a, K: 'a, V: 'a> VacantEntry<'a, K, V> { /// v.into_key(); /// } /// ``` - pub fn into_key(self) -> K { + pub fn into_key(self) -> K { self.key } @@ -2037,7 +2064,7 @@ impl<'a, K: 'a, V: 'a> VacantEntry<'a, K, V> { /// } /// assert_eq!(map["poneyland"], 37); /// ``` - pub fn insert(self, value: V) -> &'a mut V { + pub fn insert(self, value: V) -> &'a mut V { let b = match self.elem { NeqElem(mut bucket, disp) => { if disp >= DISPLACEMENT_THRESHOLD { @@ -2057,8 +2084,9 @@ impl<'a, K: 'a, V: 'a> VacantEntry<'a, K, V> { } impl<K, V, S> FromIterator<(K, V)> for HashMap<K, V, S> - where K: Eq + Hash, - S: BuildHasher + Default +where + K: Eq + Hash, + S: BuildHasher + Default, { fn from_iter<T: IntoIterator<Item = (K, V)>>(iter: T) -> HashMap<K, V, S> { let mut map = HashMap::with_hasher(Default::default()); @@ -2068,8 +2096,9 @@ impl<K, V, S> FromIterator<(K, V)> for HashMap<K, V, S> } impl<K, V, S> Extend<(K, V)> for HashMap<K, V, S> - where K: Eq + Hash, - S: BuildHasher +where + K: Eq + Hash, + S: BuildHasher, { fn extend<T: IntoIterator<Item = (K, V)>>(&mut self, iter: T) { // Keys may be already present or show multiple times in the iterator. @@ -2090,9 +2119,10 @@ impl<K, V, S> Extend<(K, V)> for HashMap<K, V, S> } impl<'a, K, V, S> Extend<(&'a K, &'a V)> for HashMap<K, V, S> - where K: Eq + Hash + Copy, - V: Copy, - S: BuildHasher +where + K: Eq + Hash + Copy, + V: Copy, + S: BuildHasher, { fn extend<T: IntoIterator<Item = (&'a K, &'a V)>>(&mut self, iter: T) { self.extend(iter.into_iter().map(|(&key, &value)| (key, value))); @@ -2102,16 +2132,18 @@ impl<'a, K, V, S> Extend<(&'a K, &'a V)> for HashMap<K, V, S> // FORK NOTE: These can be reused pub use std::collections::hash_map::{DefaultHasher, RandomState}; - impl<K, S, Q: ?Sized> super::Recover<Q> for HashMap<K, (), S> - where K: Eq + Hash + Borrow<Q>, - S: BuildHasher, - Q: Eq + Hash +where + K: Eq + Hash + Borrow<Q>, + S: BuildHasher, + Q: Eq + Hash, { type Key = K; fn get(&self, key: &Q) -> Option<&K> { - self.search(key).into_occupied_bucket().map(|bucket| bucket.into_refs().0) + self.search(key) + .into_occupied_bucket() + .map(|bucket| bucket.into_refs().0) } fn take(&mut self, key: &Q) -> Option<K> { @@ -2119,7 +2151,9 @@ impl<K, S, Q: ?Sized> super::Recover<Q> for HashMap<K, (), S> return None; } - self.search_mut(key).into_occupied_bucket().map(|bucket| pop_internal(bucket).0) + self.search_mut(key) + .into_occupied_bucket() + .map(|bucket| pop_internal(bucket).0) } fn replace(&mut self, key: K) -> Option<K> { @@ -2129,11 +2163,11 @@ impl<K, S, Q: ?Sized> super::Recover<Q> for HashMap<K, (), S> Occupied(mut occupied) => { let key = occupied.take_key().unwrap(); Some(mem::replace(occupied.elem.read_mut().0, key)) - } + }, Vacant(vacant) => { vacant.insert(()); None - } + }, } } } @@ -2170,8 +2204,9 @@ fn assert_covariance() { fn values_val<'a, 'new>(v: Values<'a, u8, &'static str>) -> Values<'a, u8, &'new str> { v } - fn drain<'new>(d: Drain<'static, &'static str, &'static str>) - -> Drain<'new, &'new str, &'new str> { + fn drain<'new>( + d: Drain<'static, &'static str, &'static str>, + ) -> Drain<'new, &'new str, &'new str> { d } } @@ -2319,19 +2354,19 @@ mod test_map { DROP_VECTOR.with(|v| { assert_eq!(v.borrow()[i], 1); - assert_eq!(v.borrow()[i+100], 1); + assert_eq!(v.borrow()[i + 100], 1); }); } DROP_VECTOR.with(|v| { for i in 0..50 { assert_eq!(v.borrow()[i], 0); - assert_eq!(v.borrow()[i+100], 0); + assert_eq!(v.borrow()[i + 100], 0); } for i in 50..100 { assert_eq!(v.borrow()[i], 1); - assert_eq!(v.borrow()[i+100], 1); + assert_eq!(v.borrow()[i + 100], 1); } }); } @@ -2388,13 +2423,9 @@ mod test_map { for _ in half.by_ref() {} DROP_VECTOR.with(|v| { - let nk = (0..100) - .filter(|&i| v.borrow()[i] == 1) - .count(); + let nk = (0..100).filter(|&i| v.borrow()[i] == 1).count(); - let nv = (0..100) - .filter(|&i| v.borrow()[i + 100] == 1) - .count(); + let nv = (0..100).filter(|&i| v.borrow()[i + 100] == 1).count(); assert_eq!(nk, 50); assert_eq!(nv, 50); @@ -2419,7 +2450,7 @@ mod test_map { let mut m: HashMap<isize, bool> = HashMap::new(); match m.entry(0) { Occupied(_) => panic!(), - Vacant(_) => {} + Vacant(_) => {}, } assert!(*m.entry(0).or_insert(true)); assert_eq!(m.len(), 1); @@ -2574,7 +2605,7 @@ mod test_map { fn test_iterate() { let mut m = HashMap::with_capacity(4); for i in 0..32 { - assert!(m.insert(i, i*2).is_none()); + assert!(m.insert(i, i * 2).is_none()); } assert_eq!(m.len(), 32); @@ -2662,8 +2693,7 @@ mod test_map { let map_str = format!("{:?}", map); - assert!(map_str == "{1: 2, 3: 4}" || - map_str == "{3: 4, 1: 2}"); + assert!(map_str == "{1: 2, 3: 4}" || map_str == "{3: 4, 1: 2}"); assert_eq!(format!("{:?}", empty), "{}"); } @@ -2876,12 +2906,11 @@ mod test_map { Occupied(mut view) => { assert_eq!(view.get(), &10); assert_eq!(view.insert(100), 10); - } + }, } assert_eq!(map.get(&1).unwrap(), &100); assert_eq!(map.len(), 6); - // Existing key (update) match map.entry(2) { Vacant(_) => unreachable!(), @@ -2889,7 +2918,7 @@ mod test_map { let v = view.get_mut(); let new_v = (*v) * 10; *v = new_v; - } + }, } assert_eq!(map.get(&2).unwrap(), &200); assert_eq!(map.len(), 6); @@ -2899,18 +2928,17 @@ mod test_map { Vacant(_) => unreachable!(), Occupied(view) => { assert_eq!(view.remove(), 30); - } + }, } assert_eq!(map.get(&3), None); assert_eq!(map.len(), 5); - // Inexistent key (insert) match map.entry(10) { Occupied(_) => unreachable!(), Vacant(view) => { assert_eq!(*view.insert(1000), 1000); - } + }, } assert_eq!(map.get(&10).unwrap(), &1000); assert_eq!(map.len(), 6); @@ -2919,11 +2947,10 @@ mod test_map { #[test] fn test_entry_take_doesnt_corrupt() { #![allow(deprecated)] //rand - // Test for #19292 + // Test for #19292 fn check(m: &HashMap<isize, ()>) { for k in m.keys() { - assert!(m.contains_key(k), - "{} is in keys() but not in the map?", k); + assert!(m.contains_key(k), "{} is in keys() but not in the map?", k); } } @@ -2939,11 +2966,11 @@ mod test_map { for i in 0..1000 { let x = rng.gen_range(-10, 10); match m.entry(x) { - Vacant(_) => {} + Vacant(_) => {}, Occupied(e) => { println!("{}: remove {}", i, x); e.remove(); - } + }, } check(&m); @@ -3021,7 +3048,7 @@ mod test_map { Vacant(e) => { assert_eq!(key, *e.key()); e.insert(value.clone()); - } + }, } assert_eq!(a.len(), 1); assert_eq!(a[key], value); @@ -3029,7 +3056,7 @@ mod test_map { #[test] fn test_retain() { - let mut map: HashMap<isize, isize> = (0..100).map(|x|(x, x*10)).collect(); + let mut map: HashMap<isize, isize> = (0..100).map(|x| (x, x * 10)).collect(); map.retain(|&k, _| k % 2 == 0); assert_eq!(map.len(), 50); diff --git a/components/hashglobe/src/hash_set.rs b/components/hashglobe/src/hash_set.rs index 2139b58a601..34e657e44fc 100644 --- a/components/hashglobe/src/hash_set.rs +++ b/components/hashglobe/src/hash_set.rs @@ -122,8 +122,9 @@ pub struct HashSet<T, S = RandomState> { } impl<T, S> HashSet<T, S> - where T: Eq + Hash, - S: BuildHasher +where + T: Eq + Hash, + S: BuildHasher, { /// Creates a new empty hash set which will use the given hasher to hash /// keys. @@ -147,7 +148,9 @@ impl<T, S> HashSet<T, S> /// ``` #[inline] pub fn with_hasher(hasher: S) -> HashSet<T, S> { - HashSet { map: HashMap::with_hasher(hasher) } + HashSet { + map: HashMap::with_hasher(hasher), + } } /// Creates an empty `HashSet` with with the specified capacity, using @@ -173,7 +176,9 @@ impl<T, S> HashSet<T, S> /// ``` #[inline] pub fn with_capacity_and_hasher(capacity: usize, hasher: S) -> HashSet<T, S> { - HashSet { map: HashMap::with_capacity_and_hasher(capacity, hasher) } + HashSet { + map: HashMap::with_capacity_and_hasher(capacity, hasher), + } } /// Returns a reference to the set's [`BuildHasher`]. @@ -265,7 +270,9 @@ impl<T, S> HashSet<T, S> /// } /// ``` pub fn iter(&self) -> Iter<T> { - Iter { iter: self.map.keys() } + Iter { + iter: self.map.keys(), + } } /// Visits the values representing the difference, @@ -319,10 +326,13 @@ impl<T, S> HashSet<T, S> /// assert_eq!(diff1, diff2); /// assert_eq!(diff1, [1, 4].iter().collect()); /// ``` - pub fn symmetric_difference<'a>(&'a self, - other: &'a HashSet<T, S>) - -> SymmetricDifference<'a, T, S> { - SymmetricDifference { iter: self.difference(other).chain(other.difference(self)) } + pub fn symmetric_difference<'a>( + &'a self, + other: &'a HashSet<T, S>, + ) -> SymmetricDifference<'a, T, S> { + SymmetricDifference { + iter: self.difference(other).chain(other.difference(self)), + } } /// Visits the values representing the intersection, @@ -369,7 +379,9 @@ impl<T, S> HashSet<T, S> /// assert_eq!(union, [1, 2, 3, 4].iter().collect()); /// ``` pub fn union<'a>(&'a self, other: &'a HashSet<T, S>) -> Union<'a, T, S> { - Union { iter: self.iter().chain(other.difference(self)) } + Union { + iter: self.iter().chain(other.difference(self)), + } } /// Returns the number of elements in the set. @@ -423,7 +435,9 @@ impl<T, S> HashSet<T, S> /// ``` #[inline] pub fn drain(&mut self) -> Drain<T> { - Drain { iter: self.map.drain() } + Drain { + iter: self.map.drain(), + } } /// Clears the set, removing all values. @@ -438,7 +452,10 @@ impl<T, S> HashSet<T, S> /// v.clear(); /// assert!(v.is_empty()); /// ``` - pub fn clear(&mut self) where T: 'static { + pub fn clear(&mut self) + where + T: 'static, + { self.map.clear() } @@ -461,8 +478,9 @@ impl<T, S> HashSet<T, S> /// [`Eq`]: ../../std/cmp/trait.Eq.html /// [`Hash`]: ../../std/hash/trait.Hash.html pub fn contains<Q: ?Sized>(&self, value: &Q) -> bool - where T: Borrow<Q>, - Q: Hash + Eq + where + T: Borrow<Q>, + Q: Hash + Eq, { self.map.contains_key(value) } @@ -476,8 +494,9 @@ impl<T, S> HashSet<T, S> /// [`Eq`]: ../../std/cmp/trait.Eq.html /// [`Hash`]: ../../std/hash/trait.Hash.html pub fn get<Q: ?Sized>(&self, value: &Q) -> Option<&T> - where T: Borrow<Q>, - Q: Hash + Eq + where + T: Borrow<Q>, + Q: Hash + Eq, { Recover::get(&self.map, value) } @@ -598,8 +617,9 @@ impl<T, S> HashSet<T, S> /// [`Eq`]: ../../std/cmp/trait.Eq.html /// [`Hash`]: ../../std/hash/trait.Hash.html pub fn remove<Q: ?Sized>(&mut self, value: &Q) -> bool - where T: Borrow<Q>, - Q: Hash + Eq + where + T: Borrow<Q>, + Q: Hash + Eq, { self.map.remove(value).is_some() } @@ -613,8 +633,9 @@ impl<T, S> HashSet<T, S> /// [`Eq`]: ../../std/cmp/trait.Eq.html /// [`Hash`]: ../../std/hash/trait.Hash.html pub fn take<Q: ?Sized>(&mut self, value: &Q) -> Option<T> - where T: Borrow<Q>, - Q: Hash + Eq + where + T: Borrow<Q>, + Q: Hash + Eq, { Recover::take(&mut self.map, value) } @@ -634,15 +655,17 @@ impl<T, S> HashSet<T, S> /// assert_eq!(set.len(), 3); /// ``` pub fn retain<F>(&mut self, mut f: F) - where F: FnMut(&T) -> bool + where + F: FnMut(&T) -> bool, { self.map.retain(|k, _| f(k)); } } impl<T, S> PartialEq for HashSet<T, S> - where T: Eq + Hash, - S: BuildHasher +where + T: Eq + Hash, + S: BuildHasher, { fn eq(&self, other: &HashSet<T, S>) -> bool { if self.len() != other.len() { @@ -654,14 +677,16 @@ impl<T, S> PartialEq for HashSet<T, S> } impl<T, S> Eq for HashSet<T, S> - where T: Eq + Hash, - S: BuildHasher +where + T: Eq + Hash, + S: BuildHasher, { } impl<T, S> fmt::Debug for HashSet<T, S> - where T: Eq + Hash + fmt::Debug, - S: BuildHasher +where + T: Eq + Hash + fmt::Debug, + S: BuildHasher, { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_set().entries(self.iter()).finish() @@ -669,8 +694,9 @@ impl<T, S> fmt::Debug for HashSet<T, S> } impl<T, S> FromIterator<T> for HashSet<T, S> - where T: Eq + Hash, - S: BuildHasher + Default +where + T: Eq + Hash, + S: BuildHasher + Default, { fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> HashSet<T, S> { let mut set = HashSet::with_hasher(Default::default()); @@ -680,8 +706,9 @@ impl<T, S> FromIterator<T> for HashSet<T, S> } impl<T, S> Extend<T> for HashSet<T, S> - where T: Eq + Hash, - S: BuildHasher +where + T: Eq + Hash, + S: BuildHasher, { fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I) { self.map.extend(iter.into_iter().map(|k| (k, ()))); @@ -689,8 +716,9 @@ impl<T, S> Extend<T> for HashSet<T, S> } impl<'a, T, S> Extend<&'a T> for HashSet<T, S> - where T: 'a + Eq + Hash + Copy, - S: BuildHasher +where + T: 'a + Eq + Hash + Copy, + S: BuildHasher, { fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I) { self.extend(iter.into_iter().cloned()); @@ -698,18 +726,22 @@ impl<'a, T, S> Extend<&'a T> for HashSet<T, S> } impl<T, S> Default for HashSet<T, S> - where T: Eq + Hash, - S: BuildHasher + Default +where + T: Eq + Hash, + S: BuildHasher + Default, { /// Creates an empty `HashSet<T, S>` with the `Default` value for the hasher. fn default() -> HashSet<T, S> { - HashSet { map: HashMap::default() } + HashSet { + map: HashMap::default(), + } } } impl<'a, 'b, T, S> BitOr<&'b HashSet<T, S>> for &'a HashSet<T, S> - where T: Eq + Hash + Clone, - S: BuildHasher + Default +where + T: Eq + Hash + Clone, + S: BuildHasher + Default, { type Output = HashSet<T, S>; @@ -739,8 +771,9 @@ impl<'a, 'b, T, S> BitOr<&'b HashSet<T, S>> for &'a HashSet<T, S> } impl<'a, 'b, T, S> BitAnd<&'b HashSet<T, S>> for &'a HashSet<T, S> - where T: Eq + Hash + Clone, - S: BuildHasher + Default +where + T: Eq + Hash + Clone, + S: BuildHasher + Default, { type Output = HashSet<T, S>; @@ -770,8 +803,9 @@ impl<'a, 'b, T, S> BitAnd<&'b HashSet<T, S>> for &'a HashSet<T, S> } impl<'a, 'b, T, S> BitXor<&'b HashSet<T, S>> for &'a HashSet<T, S> - where T: Eq + Hash + Clone, - S: BuildHasher + Default +where + T: Eq + Hash + Clone, + S: BuildHasher + Default, { type Output = HashSet<T, S>; @@ -801,8 +835,9 @@ impl<'a, 'b, T, S> BitXor<&'b HashSet<T, S>> for &'a HashSet<T, S> } impl<'a, 'b, T, S> Sub<&'b HashSet<T, S>> for &'a HashSet<T, S> - where T: Eq + Hash + Clone, - S: BuildHasher + Default +where + T: Eq + Hash + Clone, + S: BuildHasher + Default, { type Output = HashSet<T, S>; @@ -915,8 +950,9 @@ pub struct Union<'a, T: 'a, S: 'a> { } impl<'a, T, S> IntoIterator for &'a HashSet<T, S> - where T: Eq + Hash, - S: BuildHasher +where + T: Eq + Hash, + S: BuildHasher, { type Item = &'a T; type IntoIter = Iter<'a, T>; @@ -927,8 +963,9 @@ impl<'a, T, S> IntoIterator for &'a HashSet<T, S> } impl<T, S> IntoIterator for HashSet<T, S> - where T: Eq + Hash, - S: BuildHasher +where + T: Eq + Hash, + S: BuildHasher, { type Item = T; type IntoIter = IntoIter<T>; @@ -954,13 +991,17 @@ impl<T, S> IntoIterator for HashSet<T, S> /// } /// ``` fn into_iter(self) -> IntoIter<T> { - IntoIter { iter: self.map.into_iter() } + IntoIter { + iter: self.map.into_iter(), + } } } impl<'a, K> Clone for Iter<'a, K> { fn clone(&self) -> Iter<'a, K> { - Iter { iter: self.iter.clone() } + Iter { + iter: self.iter.clone(), + } } } impl<'a, K> Iterator for Iter<'a, K> { @@ -1003,10 +1044,7 @@ impl<K> ExactSizeIterator for IntoIter<K> { impl<K: fmt::Debug> fmt::Debug for IntoIter<K> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let entries_iter = self.iter - .inner - .iter() - .map(|(k, _)| k); + let entries_iter = self.iter.inner.iter().map(|(k, _)| k); f.debug_list().entries(entries_iter).finish() } } @@ -1029,23 +1067,24 @@ impl<'a, K> ExactSizeIterator for Drain<'a, K> { impl<'a, K: fmt::Debug> fmt::Debug for Drain<'a, K> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let entries_iter = self.iter - .inner - .iter() - .map(|(k, _)| k); + let entries_iter = self.iter.inner.iter().map(|(k, _)| k); f.debug_list().entries(entries_iter).finish() } } impl<'a, T, S> Clone for Intersection<'a, T, S> { fn clone(&self) -> Intersection<'a, T, S> { - Intersection { iter: self.iter.clone(), ..*self } + Intersection { + iter: self.iter.clone(), + ..*self + } } } impl<'a, T, S> Iterator for Intersection<'a, T, S> - where T: Eq + Hash, - S: BuildHasher +where + T: Eq + Hash, + S: BuildHasher, { type Item = &'a T; @@ -1065,8 +1104,9 @@ impl<'a, T, S> Iterator for Intersection<'a, T, S> } impl<'a, T, S> fmt::Debug for Intersection<'a, T, S> - where T: fmt::Debug + Eq + Hash, - S: BuildHasher +where + T: fmt::Debug + Eq + Hash, + S: BuildHasher, { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_list().entries(self.clone()).finish() @@ -1075,13 +1115,17 @@ impl<'a, T, S> fmt::Debug for Intersection<'a, T, S> impl<'a, T, S> Clone for Difference<'a, T, S> { fn clone(&self) -> Difference<'a, T, S> { - Difference { iter: self.iter.clone(), ..*self } + Difference { + iter: self.iter.clone(), + ..*self + } } } impl<'a, T, S> Iterator for Difference<'a, T, S> - where T: Eq + Hash, - S: BuildHasher +where + T: Eq + Hash, + S: BuildHasher, { type Item = &'a T; @@ -1101,8 +1145,9 @@ impl<'a, T, S> Iterator for Difference<'a, T, S> } impl<'a, T, S> fmt::Debug for Difference<'a, T, S> - where T: fmt::Debug + Eq + Hash, - S: BuildHasher +where + T: fmt::Debug + Eq + Hash, + S: BuildHasher, { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_list().entries(self.clone()).finish() @@ -1111,13 +1156,16 @@ impl<'a, T, S> fmt::Debug for Difference<'a, T, S> impl<'a, T, S> Clone for SymmetricDifference<'a, T, S> { fn clone(&self) -> SymmetricDifference<'a, T, S> { - SymmetricDifference { iter: self.iter.clone() } + SymmetricDifference { + iter: self.iter.clone(), + } } } impl<'a, T, S> Iterator for SymmetricDifference<'a, T, S> - where T: Eq + Hash, - S: BuildHasher +where + T: Eq + Hash, + S: BuildHasher, { type Item = &'a T; @@ -1130,8 +1178,9 @@ impl<'a, T, S> Iterator for SymmetricDifference<'a, T, S> } impl<'a, T, S> fmt::Debug for SymmetricDifference<'a, T, S> - where T: fmt::Debug + Eq + Hash, - S: BuildHasher +where + T: fmt::Debug + Eq + Hash, + S: BuildHasher, { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_list().entries(self.clone()).finish() @@ -1140,13 +1189,16 @@ impl<'a, T, S> fmt::Debug for SymmetricDifference<'a, T, S> impl<'a, T, S> Clone for Union<'a, T, S> { fn clone(&self) -> Union<'a, T, S> { - Union { iter: self.iter.clone() } + Union { + iter: self.iter.clone(), + } } } impl<'a, T, S> fmt::Debug for Union<'a, T, S> - where T: fmt::Debug + Eq + Hash, - S: BuildHasher +where + T: fmt::Debug + Eq + Hash, + S: BuildHasher, { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_list().entries(self.clone()).finish() @@ -1154,8 +1206,9 @@ impl<'a, T, S> fmt::Debug for Union<'a, T, S> } impl<'a, T, S> Iterator for Union<'a, T, S> - where T: Eq + Hash, - S: BuildHasher +where + T: Eq + Hash, + S: BuildHasher, { type Item = &'a T; @@ -1178,20 +1231,24 @@ fn assert_covariance() { fn into_iter<'new>(v: IntoIter<&'static str>) -> IntoIter<&'new str> { v } - fn difference<'a, 'new>(v: Difference<'a, &'static str, RandomState>) - -> Difference<'a, &'new str, RandomState> { + fn difference<'a, 'new>( + v: Difference<'a, &'static str, RandomState>, + ) -> Difference<'a, &'new str, RandomState> { v } - fn symmetric_difference<'a, 'new>(v: SymmetricDifference<'a, &'static str, RandomState>) - -> SymmetricDifference<'a, &'new str, RandomState> { + fn symmetric_difference<'a, 'new>( + v: SymmetricDifference<'a, &'static str, RandomState>, + ) -> SymmetricDifference<'a, &'new str, RandomState> { v } - fn intersection<'a, 'new>(v: Intersection<'a, &'static str, RandomState>) - -> Intersection<'a, &'new str, RandomState> { + fn intersection<'a, 'new>( + v: Intersection<'a, &'static str, RandomState>, + ) -> Intersection<'a, &'new str, RandomState> { v } - fn union<'a, 'new>(v: Union<'a, &'static str, RandomState>) - -> Union<'a, &'new str, RandomState> { + fn union<'a, 'new>( + v: Union<'a, &'static str, RandomState>, + ) -> Union<'a, &'new str, RandomState> { v } fn drain<'new>(d: Drain<'static, &'static str>) -> Drain<'new, &'new str> { diff --git a/components/hashglobe/src/lib.rs b/components/hashglobe/src/lib.rs index 49038a51859..cf6e9710f5f 100644 --- a/components/hashglobe/src/lib.rs +++ b/components/hashglobe/src/lib.rs @@ -44,7 +44,10 @@ pub struct FailedAllocationError { impl FailedAllocationError { #[inline] pub fn new(reason: &'static str) -> Self { - Self { reason, allocation_info: None } + Self { + reason, + allocation_info: None, + } } } @@ -57,9 +60,11 @@ impl error::Error for FailedAllocationError { impl fmt::Display for FailedAllocationError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self.allocation_info { - Some(ref info) => { - write!(f, "{}, allocation: (size: {}, alignment: {})", self.reason, info.size, info.alignment) - }, + Some(ref info) => write!( + f, + "{}, allocation: (size: {}, alignment: {})", + self.reason, info.size, info.alignment + ), None => self.reason.fmt(f), } } diff --git a/components/hashglobe/src/shim.rs b/components/hashglobe/src/shim.rs index 146ff851a0e..855dbdcfa15 100644 --- a/components/hashglobe/src/shim.rs +++ b/components/hashglobe/src/shim.rs @@ -29,11 +29,11 @@ impl<T: 'static> Unique<T> { } } -unsafe impl<T: Send + 'static> Send for Unique<T> { } +unsafe impl<T: Send + 'static> Send for Unique<T> {} -unsafe impl<T: Sync + 'static> Sync for Unique<T> { } +unsafe impl<T: Sync + 'static> Sync for Unique<T> {} -pub struct Shared<T: 'static> { +pub struct Shared<T: 'static> { ptr: NonZeroPtr<T>, _marker: PhantomData<T>, // force it to be !Send/!Sync diff --git a/components/hashglobe/src/table.rs b/components/hashglobe/src/table.rs index bd801b43544..0b8b49001e2 100644 --- a/components/hashglobe/src/table.rs +++ b/components/hashglobe/src/table.rs @@ -203,7 +203,9 @@ impl SafeHash { // // Truncate hash to fit in `HashUint`. let hash_bits = size_of::<HashUint>() * 8; - SafeHash { hash: (1 << (hash_bits - 1)) | (hash as HashUint) } + SafeHash { + hash: (1 << (hash_bits - 1)) | (hash as HashUint), + } } } @@ -211,8 +213,9 @@ impl SafeHash { /// This function wraps up `hash_keyed` to be the only way outside this /// module to generate a SafeHash. pub fn make_hash<T: ?Sized, S>(hash_state: &S, t: &T) -> SafeHash - where T: Hash, - S: BuildHasher +where + T: Hash, + S: BuildHasher, { let mut state = hash_state.build_hasher(); t.hash(&mut state); @@ -294,7 +297,8 @@ impl<K, V, M> Bucket<K, V, M> { } impl<K, V, M> Deref for FullBucket<K, V, M> - where M: Deref<Target = RawTable<K, V>> +where + M: Deref<Target = RawTable<K, V>>, { type Target = RawTable<K, V>; fn deref(&self) -> &RawTable<K, V> { @@ -308,7 +312,6 @@ pub trait Put<K, V> { unsafe fn borrow_table_mut(&mut self) -> &mut RawTable<K, V>; } - impl<'t, K, V> Put<K, V> for &'t mut RawTable<K, V> { unsafe fn borrow_table_mut(&mut self) -> &mut RawTable<K, V> { *self @@ -316,7 +319,8 @@ impl<'t, K, V> Put<K, V> for &'t mut RawTable<K, V> { } impl<K, V, M> Put<K, V> for Bucket<K, V, M> - where M: Put<K, V> +where + M: Put<K, V>, { unsafe fn borrow_table_mut(&mut self) -> &mut RawTable<K, V> { self.table.borrow_table_mut() @@ -324,7 +328,8 @@ impl<K, V, M> Put<K, V> for Bucket<K, V, M> } impl<K, V, M> Put<K, V> for FullBucket<K, V, M> - where M: Put<K, V> +where + M: Put<K, V>, { unsafe fn borrow_table_mut(&mut self) -> &mut RawTable<K, V> { self.table.borrow_table_mut() @@ -336,20 +341,17 @@ impl<K, V, M: Deref<Target = RawTable<K, V>>> Bucket<K, V, M> { Bucket::at_index(table, hash.inspect() as usize) } - pub fn new_from(r: RawBucket<K, V>, t: M) - -> Bucket<K, V, M> - { - Bucket { - raw: r, - table: t, - } + pub fn new_from(r: RawBucket<K, V>, t: M) -> Bucket<K, V, M> { + Bucket { raw: r, table: t } } pub fn at_index(table: M, ib_index: usize) -> Bucket<K, V, M> { // if capacity is 0, then the RawBucket will be populated with bogus pointers. // This is an uncommon case though, so avoid it in release builds. - debug_assert!(table.capacity() > 0, - "Table should have capacity at this point"); + debug_assert!( + table.capacity() > 0, + "Table should have capacity at this point" + ); let ib_index = ib_index & table.capacity_mask; Bucket { raw: table.raw_bucket_at(ib_index), @@ -387,11 +389,11 @@ impl<K, V, M: Deref<Target = RawTable<K, V>>> Bucket<K, V, M> { } // Leaving this bucket in the last cluster for later. full.into_bucket() - } + }, Empty(b) => { // Encountered a hole between clusters. b.into_bucket() - } + }, }; bucket.next(); } @@ -404,18 +406,14 @@ impl<K, V, M: Deref<Target = RawTable<K, V>>> Bucket<K, V, M> { /// this module. pub fn peek(self) -> BucketState<K, V, M> { match unsafe { *self.raw.hash() } { - EMPTY_BUCKET => { - Empty(EmptyBucket { - raw: self.raw, - table: self.table, - }) - } - _ => { - Full(FullBucket { - raw: self.raw, - table: self.table, - }) - } + EMPTY_BUCKET => Empty(EmptyBucket { + raw: self.raw, + table: self.table, + }), + _ => Full(FullBucket { + raw: self.raw, + table: self.table, + }), } } @@ -453,19 +451,15 @@ impl<K, V, M: Deref<Target = RawTable<K, V>>> EmptyBucket<K, V, M> { }; match self.next().peek() { - Full(bucket) => { - Ok(GapThenFull { - gap, - full: bucket, - }) - } + Full(bucket) => Ok(GapThenFull { gap, full: bucket }), Empty(e) => Err(e.into_bucket()), } } } impl<K, V, M> EmptyBucket<K, V, M> - where M: Put<K, V> +where + M: Put<K, V>, { /// Puts given key and value pair, along with the key's hash, /// into this bucket in the hashtable. Note how `self` is 'moved' into @@ -528,7 +522,11 @@ impl<K, V, M: Deref<Target = RawTable<K, V>>> FullBucket<K, V, M> { #[inline] pub fn hash(&self) -> SafeHash { - unsafe { SafeHash { hash: *self.raw.hash() } } + unsafe { + SafeHash { + hash: *self.raw.hash(), + } + } } /// Gets references to the key and value at a given index. @@ -554,12 +552,14 @@ impl<'t, K, V> FullBucket<K, V, &'t mut RawTable<K, V>> { unsafe { *self.raw.hash() = EMPTY_BUCKET; let (k, v) = ptr::read(self.raw.pair()); - (EmptyBucket { - raw: self.raw, - table: self.table, - }, - k, - v) + ( + EmptyBucket { + raw: self.raw, + table: self.table, + }, + k, + v, + ) } } } @@ -567,7 +567,8 @@ impl<'t, K, V> FullBucket<K, V, &'t mut RawTable<K, V>> { // This use of `Put` is misleading and restrictive, but safe and sufficient for our use cases // where `M` is a full bucket or table reference type with mutable access to the table. impl<K, V, M> FullBucket<K, V, M> - where M: Put<K, V> +where + M: Put<K, V>, { pub fn replace(&mut self, h: SafeHash, k: K, v: V) -> (SafeHash, K, V) { unsafe { @@ -580,7 +581,8 @@ impl<K, V, M> FullBucket<K, V, M> } impl<K, V, M> FullBucket<K, V, M> - where M: Deref<Target = RawTable<K, V>> + DerefMut +where + M: Deref<Target = RawTable<K, V>> + DerefMut, { /// Gets mutable references to the key and value at a given index. pub fn read_mut(&mut self) -> (&mut K, &mut V) { @@ -592,7 +594,8 @@ impl<K, V, M> FullBucket<K, V, M> } impl<'t, K, V, M> FullBucket<K, V, M> - where M: Deref<Target = RawTable<K, V>> + 't +where + M: Deref<Target = RawTable<K, V>> + 't, { /// Exchange a bucket state for immutable references into the table. /// Because the underlying reference to the table is also consumed, @@ -608,7 +611,8 @@ impl<'t, K, V, M> FullBucket<K, V, M> } impl<'t, K, V, M> FullBucket<K, V, M> - where M: Deref<Target = RawTable<K, V>> + DerefMut + 't +where + M: Deref<Target = RawTable<K, V>> + DerefMut + 't, { /// This works similarly to `into_refs`, exchanging a bucket state /// for mutable references into the table. @@ -621,7 +625,8 @@ impl<'t, K, V, M> FullBucket<K, V, M> } impl<K, V, M> GapThenFull<K, V, M> - where M: Deref<Target = RawTable<K, V>> +where + M: Deref<Target = RawTable<K, V>>, { #[inline] pub fn full(&self) -> &FullBucket<K, V, M> { @@ -649,13 +654,12 @@ impl<K, V, M> GapThenFull<K, V, M> self.full = bucket; Ok(self) - } + }, Empty(b) => Err(b.into_bucket()), } } } - /// Rounds up to a multiple of a power of two. Returns the closest multiple /// of `target_alignment` that is higher or equal to `unrounded`. /// @@ -681,10 +685,11 @@ fn test_rounding() { // Returns a tuple of (pairs_offset, end_of_pairs_offset), // from the start of a mallocated array. #[inline] -fn calculate_offsets(hashes_size: usize, - pairs_size: usize, - pairs_align: usize) - -> (usize, usize, bool) { +fn calculate_offsets( + hashes_size: usize, + pairs_size: usize, + pairs_align: usize, +) -> (usize, usize, bool) { let pairs_offset = round_up_to_next(hashes_size, pairs_align); let (end_of_pairs, oflo) = pairs_offset.overflowing_add(pairs_size); @@ -693,11 +698,12 @@ fn calculate_offsets(hashes_size: usize, // Returns a tuple of (minimum required malloc alignment, hash_offset, // array_size), from the start of a mallocated array. -fn calculate_allocation(hash_size: usize, - hash_align: usize, - pairs_size: usize, - pairs_align: usize) - -> (usize, usize, usize, bool) { +fn calculate_allocation( + hash_size: usize, + hash_align: usize, + pairs_size: usize, + pairs_align: usize, +) -> (usize, usize, usize, bool) { let hash_offset = 0; let (_, end_of_pairs, oflo) = calculate_offsets(hash_size, pairs_size, pairs_align); @@ -728,7 +734,9 @@ impl<K, V> RawTable<K, V> { /// Does not initialize the buckets. The caller should ensure they, /// at the very least, set every hash to EMPTY_BUCKET. - unsafe fn try_new_uninitialized(capacity: usize) -> Result<RawTable<K, V>, FailedAllocationError> { + unsafe fn try_new_uninitialized( + capacity: usize, + ) -> Result<RawTable<K, V>, FailedAllocationError> { if capacity == 0 { return Ok(RawTable { size: 0, @@ -751,29 +759,38 @@ impl<K, V> RawTable<K, V> { // This is great in theory, but in practice getting the alignment // right is a little subtle. Therefore, calculating offsets has been // factored out into a different function. - let (alignment, hash_offset, size, oflo) = calculate_allocation(hashes_size, - align_of::<HashUint>(), - pairs_size, - align_of::<(K, V)>()); + let (alignment, hash_offset, size, oflo) = calculate_allocation( + hashes_size, + align_of::<HashUint>(), + pairs_size, + align_of::<(K, V)>(), + ); if oflo { - return Err(FailedAllocationError::new("capacity overflow when allocating RawTable" )); + return Err(FailedAllocationError::new( + "capacity overflow when allocating RawTable", + )); } // One check for overflow that covers calculation and rounding of size. - let size_of_bucket = size_of::<HashUint>().checked_add(size_of::<(K, V)>()).unwrap(); + let size_of_bucket = size_of::<HashUint>() + .checked_add(size_of::<(K, V)>()) + .unwrap(); let cap_bytes = capacity.checked_mul(size_of_bucket); if let Some(cap_bytes) = cap_bytes { if size < cap_bytes { - return Err(FailedAllocationError::new("capacity overflow when allocating RawTable")); + return Err(FailedAllocationError::new( + "capacity overflow when allocating RawTable", + )); } } else { - return Err(FailedAllocationError::new("capacity overflow when allocating RawTable")); + return Err(FailedAllocationError::new( + "capacity overflow when allocating RawTable", + )); } - // FORK NOTE: Uses alloc shim instead of Heap.alloc let buffer = alloc(size, alignment); @@ -857,7 +874,9 @@ impl<K, V> RawTable<K, V> { } pub fn into_iter(self) -> IntoIter<K, V> { - let RawBuckets { raw, elems_left, .. } = self.raw_buckets(); + let RawBuckets { + raw, elems_left, .. + } = self.raw_buckets(); // Replace the marker regardless of lifetime bounds on parameters. IntoIter { iter: RawBuckets { @@ -870,7 +889,9 @@ impl<K, V> RawTable<K, V> { } pub fn drain(&mut self) -> Drain<K, V> { - let RawBuckets { raw, elems_left, .. } = self.raw_buckets(); + let RawBuckets { + raw, elems_left, .. + } = self.raw_buckets(); // Replace the marker regardless of lifetime bounds on parameters. Drain { iter: RawBuckets { @@ -937,7 +958,6 @@ impl<'a, K, V> Clone for RawBuckets<'a, K, V> { } } - impl<'a, K, V> Iterator for RawBuckets<'a, K, V> { type Item = RawBucket<K, V>; @@ -1112,12 +1132,16 @@ impl<'a, K, V> Iterator for Drain<'a, K, V> { #[inline] fn next(&mut self) -> Option<(SafeHash, K, V)> { - self.iter.next().map(|raw| { - unsafe { - self.table.as_mut().size -= 1; - let (k, v) = ptr::read(raw.pair()); - (SafeHash { hash: ptr::replace(&mut *raw.hash(), EMPTY_BUCKET) }, k, v) - } + self.iter.next().map(|raw| unsafe { + self.table.as_mut().size -= 1; + let (k, v) = ptr::read(raw.pair()); + ( + SafeHash { + hash: ptr::replace(&mut *raw.hash(), EMPTY_BUCKET), + }, + k, + v, + ) }) } @@ -1181,17 +1205,19 @@ impl<K, V> Drop for RawTable<K, V> { unsafe { // FORK NOTE: Can't needs_drop on stable // if needs_drop::<(K, V)>() { - // avoid linear runtime for types that don't need drop - self.rev_drop_buckets(); + // avoid linear runtime for types that don't need drop + self.rev_drop_buckets(); // } } let hashes_size = self.capacity() * size_of::<HashUint>(); let pairs_size = self.capacity() * size_of::<(K, V)>(); - let (align, _, _, oflo) = calculate_allocation(hashes_size, - align_of::<HashUint>(), - pairs_size, - align_of::<(K, V)>()); + let (align, _, _, oflo) = calculate_allocation( + hashes_size, + align_of::<HashUint>(), + pairs_size, + align_of::<(K, V)>(), + ); debug_assert!(!oflo, "should be impossible"); diff --git a/components/jstraceable_derive/lib.rs b/components/jstraceable_derive/lib.rs index a780a6e2167..ac793f4d85a 100644 --- a/components/jstraceable_derive/lib.rs +++ b/components/jstraceable_derive/lib.rs @@ -3,15 +3,15 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ extern crate quote; -#[macro_use] extern crate syn; -#[macro_use] extern crate synstructure; +#[macro_use] +extern crate syn; +#[macro_use] +extern crate synstructure; decl_derive!([JSTraceable] => js_traceable_derive); fn js_traceable_derive(s: synstructure::Structure) -> quote::Tokens { - let match_body = s.each(|binding| { - Some(quote!(#binding.trace(tracer);)) - }); + let match_body = s.each(|binding| Some(quote!(#binding.trace(tracer);))); let ast = s.ast(); let name = ast.ident; @@ -19,7 +19,9 @@ fn js_traceable_derive(s: synstructure::Structure) -> quote::Tokens { let mut where_clause = where_clause.unwrap_or(&parse_quote!(where)).clone(); for param in ast.generics.type_params() { let ident = param.ident; - where_clause.predicates.push(parse_quote!(#ident: ::dom::bindings::trace::JSTraceable)) + where_clause + .predicates + .push(parse_quote!(#ident: ::dom::bindings::trace::JSTraceable)) } let tokens = quote! { diff --git a/components/profile/heartbeats.rs b/components/profile/heartbeats.rs index 0d474fe3a11..ef95c853fce 100644 --- a/components/profile/heartbeats.rs +++ b/components/profile/heartbeats.rs @@ -14,24 +14,22 @@ use std::path::Path; /// Initialize heartbeats pub fn init() { - lock_and_work(|hbs_opt| + lock_and_work(|hbs_opt| { if hbs_opt.is_none() { let mut hbs: Box<HashMap<ProfilerCategory, Heartbeat>> = Box::new(HashMap::new()); maybe_create_heartbeat(&mut hbs, ProfilerCategory::ApplicationHeartbeat); *hbs_opt = Some(Box::into_raw(hbs)) } - ); + }); } /// Log regmaining buffer data and cleanup heartbeats pub fn cleanup() { - let hbs_opt_box: Option<Box<HashMap<ProfilerCategory, Heartbeat>>> = lock_and_work(|hbs_opt| - hbs_opt.take().map(|hbs_ptr| - unsafe { - Box::from_raw(hbs_ptr) - } - ) - ); + let hbs_opt_box: Option<Box<HashMap<ProfilerCategory, Heartbeat>>> = lock_and_work(|hbs_opt| { + hbs_opt + .take() + .map(|hbs_ptr| unsafe { Box::from_raw(hbs_ptr) }) + }); if let Some(mut hbs) = hbs_opt_box { for (_, v) in hbs.iter_mut() { // log any remaining heartbeat records before dropping @@ -43,23 +41,23 @@ pub fn cleanup() { /// Check if a heartbeat exists for the given category pub fn is_heartbeat_enabled(category: &ProfilerCategory) -> bool { - let is_enabled = lock_and_work(|hbs_opt| - hbs_opt.map_or(false, |hbs_ptr| - unsafe { - (*hbs_ptr).contains_key(category) - } - ) - ); + let is_enabled = lock_and_work(|hbs_opt| { + hbs_opt.map_or(false, |hbs_ptr| unsafe { + (*hbs_ptr).contains_key(category) + }) + }); is_enabled || is_create_heartbeat(category) } /// Issue a heartbeat (if one exists) for the given category -pub fn maybe_heartbeat(category: &ProfilerCategory, - start_time: u64, - end_time: u64, - start_energy: u64, - end_energy: u64) { - lock_and_work(|hbs_opt| +pub fn maybe_heartbeat( + category: &ProfilerCategory, + start_time: u64, + end_time: u64, + start_energy: u64, + end_energy: u64, +) { + lock_and_work(|hbs_opt| { if let Some(hbs_ptr) = *hbs_opt { unsafe { if !(*hbs_ptr).contains_key(category) { @@ -70,13 +68,14 @@ pub fn maybe_heartbeat(category: &ProfilerCategory, } } } - ); + }); } // TODO(cimes): Android doesn't really do environment variables. Need a better way to configure dynamically. fn is_create_heartbeat(category: &ProfilerCategory) -> bool { - opts::get().profile_heartbeats || var_os(format!("SERVO_HEARTBEAT_ENABLE_{:?}", category)).is_some() + opts::get().profile_heartbeats || + var_os(format!("SERVO_HEARTBEAT_ENABLE_{:?}", category)).is_some() } fn open_heartbeat_log<P: AsRef<Path>>(name: P) -> Option<File> { @@ -111,8 +110,10 @@ fn get_heartbeat_window_size(category: &ProfilerCategory) -> usize { } /// Possibly create a heartbeat -fn maybe_create_heartbeat(hbs: &mut HashMap<ProfilerCategory, Heartbeat>, - category: ProfilerCategory) { +fn maybe_create_heartbeat( + hbs: &mut HashMap<ProfilerCategory, Heartbeat>, + category: ProfilerCategory, +) { if is_create_heartbeat(&category) { // get optional log file let logfile: Option<File> = get_heartbeat_log(&category); @@ -151,11 +152,11 @@ mod synchronized_heartbeat { static HBS_SPINLOCK: AtomicBool = ATOMIC_BOOL_INIT; pub fn lock_and_work<F, R>(work: F) -> R - where F: FnOnce(&mut Option<*mut HashMap<ProfilerCategory, Heartbeat>>) -> R { + where + F: FnOnce(&mut Option<*mut HashMap<ProfilerCategory, Heartbeat>>) -> R, + { while HBS_SPINLOCK.compare_and_swap(false, true, Ordering::SeqCst) {} - let result = unsafe { - work(&mut HBS) - }; + let result = unsafe { work(&mut HBS) }; HBS_SPINLOCK.store(false, Ordering::SeqCst); result } @@ -163,7 +164,7 @@ mod synchronized_heartbeat { /// Callback function used to log the window buffer. /// When this is called from native C, the heartbeat is safely locked internally and the global lock is held. /// If calling from this file, you must already hold the global lock! - pub extern fn heartbeat_window_callback(hb: *const HeartbeatContext) { + pub extern "C" fn heartbeat_window_callback(hb: *const HeartbeatContext) { unsafe { if let Some(hbs_ptr) = HBS { for (_, v) in (*hbs_ptr).iter_mut() { diff --git a/components/profile/mem.rs b/components/profile/mem.rs index bb2a3873a91..2f2cda21847 100644 --- a/components/profile/mem.rs +++ b/components/profile/mem.rs @@ -36,22 +36,24 @@ impl Profiler { // Create the timer thread if a period was provided. if let Some(period) = period { let chan = chan.clone(); - thread::Builder::new().name("Memory profiler timer".to_owned()).spawn(move || { - loop { + thread::Builder::new() + .name("Memory profiler timer".to_owned()) + .spawn(move || loop { thread::sleep(duration_from_seconds(period)); if chan.send(ProfilerMsg::Print).is_err() { break; } - } - }).expect("Thread spawning failed"); + }).expect("Thread spawning failed"); } // Always spawn the memory profiler. If there is no timer thread it won't receive regular // `Print` events, but it will still receive the other events. - thread::Builder::new().name("Memory profiler".to_owned()).spawn(move || { - let mut mem_profiler = Profiler::new(port); - mem_profiler.start(); - }).expect("Thread spawning failed"); + thread::Builder::new() + .name("Memory profiler".to_owned()) + .spawn(move || { + let mut mem_profiler = Profiler::new(port); + mem_profiler.start(); + }).expect("Thread spawning failed"); let mem_profiler_chan = ProfilerChan(chan); @@ -59,12 +61,17 @@ impl Profiler { // be unregistered, because as long as the memory profiler is running the system memory // reporter can make measurements. let (system_reporter_sender, system_reporter_receiver) = ipc::channel().unwrap(); - ROUTER.add_route(system_reporter_receiver.to_opaque(), Box::new(|message| { - let request: ReporterRequest = message.to().unwrap(); - system_reporter::collect_reports(request) - })); - mem_profiler_chan.send(ProfilerMsg::RegisterReporter("system".to_owned(), - Reporter(system_reporter_sender))); + ROUTER.add_route( + system_reporter_receiver.to_opaque(), + Box::new(|message| { + let request: ReporterRequest = message.to().unwrap(); + system_reporter::collect_reports(request) + }), + ); + mem_profiler_chan.send(ProfilerMsg::RegisterReporter( + "system".to_owned(), + Reporter(system_reporter_sender), + )); mem_profiler_chan } @@ -79,9 +86,9 @@ impl Profiler { pub fn start(&mut self) { while let Ok(msg) = self.port.recv() { - if !self.handle_msg(msg) { - break - } + if !self.handle_msg(msg) { + break; + } } } @@ -92,8 +99,10 @@ impl Profiler { let name_clone = name.clone(); match self.reporters.insert(name, reporter) { None => true, - Some(_) => panic!(format!("RegisterReporter: '{}' name is already in use", - name_clone)), + Some(_) => panic!(format!( + "RegisterReporter: '{}' name is already in use", + name_clone + )), } }, @@ -101,8 +110,7 @@ impl Profiler { // Panic if it hasn't previously been registered. match self.reporters.remove(&name) { Some(_) => true, - None => - panic!(format!("UnregisterReporter: '{}' name is unknown", &name)), + None => panic!(format!("UnregisterReporter: '{}' name is unknown", &name)), } }, @@ -111,7 +119,7 @@ impl Profiler { true }, - ProfilerMsg::Exit => false + ProfilerMsg::Exit => false, } } @@ -149,17 +157,20 @@ impl Profiler { ReportKind::ExplicitJemallocHeapSize | ReportKind::ExplicitSystemHeapSize | ReportKind::ExplicitNonHeapSize | - ReportKind::ExplicitUnknownLocationSize => - report.path.insert(0, String::from("explicit")), + ReportKind::ExplicitUnknownLocationSize => { + report.path.insert(0, String::from("explicit")) + }, ReportKind::NonExplicitSize => {}, } // Update the reported fractions of the heaps, when appropriate. match report.kind { - ReportKind::ExplicitJemallocHeapSize => - jemalloc_heap_reported_size += report.size, - ReportKind::ExplicitSystemHeapSize => - system_heap_reported_size += report.size, + ReportKind::ExplicitJemallocHeapSize => { + jemalloc_heap_reported_size += report.size + }, + ReportKind::ExplicitSystemHeapSize => { + system_heap_reported_size += report.size + }, _ => {}, } @@ -182,12 +193,16 @@ impl Profiler { // Compute and insert the heap-unclassified values. if let Some(jemalloc_heap_allocated_size) = jemalloc_heap_allocated_size { - forest.insert(&path!["explicit", "jemalloc-heap-unclassified"], - jemalloc_heap_allocated_size - jemalloc_heap_reported_size); + forest.insert( + &path!["explicit", "jemalloc-heap-unclassified"], + jemalloc_heap_allocated_size - jemalloc_heap_reported_size, + ); } if let Some(system_heap_allocated_size) = system_heap_allocated_size { - forest.insert(&path!["explicit", "system-heap-unclassified"], - system_heap_allocated_size - system_heap_reported_size); + forest.insert( + &path!["explicit", "system-heap-unclassified"], + system_heap_allocated_size - system_heap_reported_size, + ); } forest.print(); @@ -222,7 +237,7 @@ impl ReportsTree { size: 0, count: 0, path_seg: path_seg, - children: vec![] + children: vec![], } } @@ -249,7 +264,7 @@ impl ReportsTree { t.children.len() - 1 }, }; - let tmp = t; // this temporary is needed to satisfy the borrow checker + let tmp = t; // this temporary is needed to satisfy the borrow checker t = &mut tmp.children[i]; } @@ -286,9 +301,18 @@ impl ReportsTree { } let mebi = 1024f64 * 1024f64; - let count_str = if self.count > 1 { format!(" [{}]", self.count) } else { "".to_owned() }; - println!("|{}{:8.2} MiB -- {}{}", - indent_str, (self.size as f64) / mebi, self.path_seg, count_str); + let count_str = if self.count > 1 { + format!(" [{}]", self.count) + } else { + "".to_owned() + }; + println!( + "|{}{:8.2} MiB -- {}{}", + indent_str, + (self.size as f64) / mebi, + self.path_seg, + count_str + ); for child in &self.children { child.print(depth + 1); @@ -314,7 +338,8 @@ impl ReportsForest { let (head, tail) = path.split_first().unwrap(); // Get the right tree, creating it if necessary. if !self.trees.contains_key(head) { - self.trees.insert(head.clone(), ReportsTree::new(head.clone())); + self.trees + .insert(head.clone(), ReportsTree::new(head.clone())); } let t = self.trees.get_mut(head).unwrap(); @@ -405,7 +430,10 @@ mod system_reporter { // directly from the jemalloc documentation. // "Total number of bytes allocated by the application." - report(path![JEMALLOC_HEAP_ALLOCATED_STR], jemalloc_stat("stats.allocated")); + report( + path![JEMALLOC_HEAP_ALLOCATED_STR], + jemalloc_stat("stats.allocated"), + ); // "Total number of bytes in active pages allocated by the application. // This is a multiple of the page size, and greater than or equal to @@ -422,20 +450,20 @@ mod system_reporter { } #[cfg(target_os = "linux")] - extern { + extern "C" { fn mallinfo() -> struct_mallinfo; } #[cfg(target_os = "linux")] #[repr(C)] pub struct struct_mallinfo { - arena: c_int, - ordblks: c_int, - smblks: c_int, - hblks: c_int, - hblkhd: c_int, - usmblks: c_int, - fsmblks: c_int, + arena: c_int, + ordblks: c_int, + smblks: c_int, + hblks: c_int, + hblkhd: c_int, + usmblks: c_int, + fsmblks: c_int, uordblks: c_int, fordblks: c_int, keepcost: c_int, @@ -487,15 +515,26 @@ mod system_reporter { // Using the same values for the `old` and `new` parameters is enough // to get the statistics updated. let rv = unsafe { - mallctl(epoch_c_name.as_ptr(), epoch_ptr, &mut epoch_len, epoch_ptr, - epoch_len) + mallctl( + epoch_c_name.as_ptr(), + epoch_ptr, + &mut epoch_len, + epoch_ptr, + epoch_len, + ) }; if rv != 0 { return None; } let rv = unsafe { - mallctl(value_c_name.as_ptr(), value_ptr, &mut value_len, null_mut(), 0) + mallctl( + value_c_name.as_ptr(), + value_ptr, + &mut value_len, + null_mut(), + 0, + ) }; if rv != 0 { return None; @@ -511,9 +550,7 @@ mod system_reporter { #[cfg(target_os = "linux")] fn page_size() -> usize { - unsafe { - ::libc::sysconf(::libc::_SC_PAGESIZE) as usize - } + unsafe { ::libc::sysconf(::libc::_SC_PAGESIZE) as usize } } #[cfg(target_os = "linux")] @@ -585,14 +622,18 @@ mod system_reporter { }; let seg_re = Regex::new( - r"^[:xdigit:]+-[:xdigit:]+ (....) [:xdigit:]+ [:xdigit:]+:[:xdigit:]+ \d+ +(.*)").unwrap(); + r"^[:xdigit:]+-[:xdigit:]+ (....) [:xdigit:]+ [:xdigit:]+:[:xdigit:]+ \d+ +(.*)", + ).unwrap(); let rss_re = Regex::new(r"^Rss: +(\d+) kB").unwrap(); // We record each segment's resident size. let mut seg_map: HashMap<String, usize> = HashMap::new(); #[derive(PartialEq)] - enum LookingFor { Segment, Rss } + enum LookingFor { + Segment, + Rss, + } let mut looking_for = LookingFor::Segment; let mut curr_seg_name = String::new(); @@ -644,7 +685,9 @@ mod system_reporter { curr_seg_name.clone() }; match seg_map.entry(seg_name) { - Entry::Vacant(entry) => { entry.insert(rss); }, + Entry::Vacant(entry) => { + entry.insert(rss); + }, Entry::Occupied(mut entry) => *entry.get_mut() += rss, } } diff --git a/components/profile/time.rs b/components/profile/time.rs index 6c1130345e0..fd09ca8cd8e 100644 --- a/components/profile/time.rs +++ b/components/profile/time.rs @@ -50,11 +50,7 @@ impl Formattable for Option<TimerMetadata> { }, _ => { /* The profiling output is the terminal */ - let url = if url.len() > 30 { - &url[..30] - } else { - url - }; + let url = if url.len() > 30 { &url[..30] } else { url }; let incremental = match meta.incremental { TimerMetadataReflowType::Incremental => " yes", TimerMetadataReflowType::FirstReflow => " no ", @@ -67,16 +63,12 @@ impl Formattable for Option<TimerMetadata> { }, } }, - None => { - match *output { - Some(OutputOptions::FileName(_)) => { - format!(" {}\t{}\t{}", " N/A", " N/A", " N/A") - }, - _ => { - format!(" {:14} {:9} {:30}", " N/A", " N/A", " N/A") - } - } - } + None => match *output { + Some(OutputOptions::FileName(_)) => { + format!(" {}\t{}\t{}", " N/A", " N/A", " N/A") + }, + _ => format!(" {:14} {:9} {:30}", " N/A", " N/A", " N/A"), + }, } } } @@ -102,7 +94,7 @@ impl Formattable for ProfilerCategory { ProfilerCategory::LayoutSelectorMatch | ProfilerCategory::LayoutTreeBuilder | ProfilerCategory::LayoutTextShaping => "| + ", - _ => "" + _ => "", }; let name = match *self { ProfilerCategory::Compositing => "Compositing", @@ -183,27 +175,29 @@ impl Profiler { Some(ref option) => { // Spawn the time profiler thread let outputoption = option.clone(); - thread::Builder::new().name("Time profiler".to_owned()).spawn(move || { - let trace = file_path.as_ref() - .and_then(|p| TraceDump::new(p).ok()); - let mut profiler = Profiler::new(port, trace, Some(outputoption)); - profiler.start(); - }).expect("Thread spawning failed"); + thread::Builder::new() + .name("Time profiler".to_owned()) + .spawn(move || { + let trace = file_path.as_ref().and_then(|p| TraceDump::new(p).ok()); + let mut profiler = Profiler::new(port, trace, Some(outputoption)); + profiler.start(); + }).expect("Thread spawning failed"); // decide if we need to spawn the timer thread match option { - &OutputOptions::FileName(_) | - &OutputOptions::DB(_, _, _, _) => { /* no timer thread needed */ }, + &OutputOptions::FileName(_) | &OutputOptions::DB(_, _, _, _) => { + /* no timer thread needed */ + }, &OutputOptions::Stdout(period) => { // Spawn a timer thread let chan = chan.clone(); - thread::Builder::new().name("Time profiler timer".to_owned()).spawn(move || { - loop { + thread::Builder::new() + .name("Time profiler timer".to_owned()) + .spawn(move || loop { thread::sleep(duration_from_seconds(period)); if chan.send(ProfilerMsg::Print).is_err() { break; } - } - }).expect("Thread spawning failed"); + }).expect("Thread spawning failed"); }, } }, @@ -211,37 +205,37 @@ impl Profiler { // this is when the -p option hasn't been specified if file_path.is_some() { // Spawn the time profiler - thread::Builder::new().name("Time profiler".to_owned()).spawn(move || { - let trace = file_path.as_ref() - .and_then(|p| TraceDump::new(p).ok()); - let mut profiler = Profiler::new(port, trace, None); - profiler.start(); - }).expect("Thread spawning failed"); + thread::Builder::new() + .name("Time profiler".to_owned()) + .spawn(move || { + let trace = file_path.as_ref().and_then(|p| TraceDump::new(p).ok()); + let mut profiler = Profiler::new(port, trace, None); + profiler.start(); + }).expect("Thread spawning failed"); } else { // No-op to handle messages when the time profiler is not printing: - thread::Builder::new().name("Time profiler".to_owned()).spawn(move || { - loop { + thread::Builder::new() + .name("Time profiler".to_owned()) + .spawn(move || loop { match port.recv() { Err(_) => break, Ok(ProfilerMsg::Exit(chan)) => { let _ = chan.send(()); break; }, - _ => {} + _ => {}, } - } - }).expect("Thread spawning failed"); + }).expect("Thread spawning failed"); } - } + }, } heartbeats::init(); let profiler_chan = ProfilerChan(chan); // only spawn the application-level profiler thread if its heartbeat is enabled - let run_ap_thread = || { - heartbeats::is_heartbeat_enabled(&ProfilerCategory::ApplicationHeartbeat) - }; + let run_ap_thread = + || heartbeats::is_heartbeat_enabled(&ProfilerCategory::ApplicationHeartbeat); if run_ap_thread() { let profiler_chan = profiler_chan.clone(); // min of 1 heartbeat/sec, max of 20 should provide accurate enough power/energy readings @@ -249,39 +243,52 @@ impl Profiler { const SLEEP_MS: u32 = 10; const MIN_ENERGY_INTERVAL_MS: u32 = 50; const MAX_ENERGY_INTERVAL_MS: u32 = 1000; - let interval_ms = enforce_range(MIN_ENERGY_INTERVAL_MS, MAX_ENERGY_INTERVAL_MS, energy_interval_ms()); + let interval_ms = enforce_range( + MIN_ENERGY_INTERVAL_MS, + MAX_ENERGY_INTERVAL_MS, + energy_interval_ms(), + ); let loop_count: u32 = (interval_ms as f32 / SLEEP_MS as f32).ceil() as u32; - thread::Builder::new().name("Application heartbeat profiler".to_owned()).spawn(move || { - let mut start_time = precise_time_ns(); - let mut start_energy = read_energy_uj(); - loop { - for _ in 0..loop_count { - if run_ap_thread() { - thread::sleep(Duration::from_millis(SLEEP_MS as u64)) - } else { - return + thread::Builder::new() + .name("Application heartbeat profiler".to_owned()) + .spawn(move || { + let mut start_time = precise_time_ns(); + let mut start_energy = read_energy_uj(); + loop { + for _ in 0..loop_count { + if run_ap_thread() { + thread::sleep(Duration::from_millis(SLEEP_MS as u64)) + } else { + return; + } } + let end_time = precise_time_ns(); + let end_energy = read_energy_uj(); + // send using the inner channel + // (using ProfilerChan.send() forces an unwrap + // and sometimes panics for this background profiler) + let ProfilerChan(ref c) = profiler_chan; + if let Err(_) = c.send(ProfilerMsg::Time( + (ProfilerCategory::ApplicationHeartbeat, None), + (start_time, end_time), + (start_energy, end_energy), + )) { + return; + } + start_time = end_time; + start_energy = end_energy; } - let end_time = precise_time_ns(); - let end_energy = read_energy_uj(); - // send using the inner channel - // (using ProfilerChan.send() forces an unwrap and sometimes panics for this background profiler) - let ProfilerChan(ref c) = profiler_chan; - if let Err(_) = c.send(ProfilerMsg::Time((ProfilerCategory::ApplicationHeartbeat, None), - (start_time, end_time), - (start_energy, end_energy))) { - return; - } - start_time = end_time; - start_energy = end_energy; - } - }).expect("Thread spawning failed"); + }).expect("Thread spawning failed"); } profiler_chan } - pub fn new(port: IpcReceiver<ProfilerMsg>, trace: Option<TraceDump>, output: Option<OutputOptions>) -> Profiler { + pub fn new( + port: IpcReceiver<ProfilerMsg>, + trace: Option<TraceDump>, + output: Option<OutputOptions>, + ) -> Profiler { Profiler { port: port, buckets: BTreeMap::new(), @@ -293,9 +300,9 @@ impl Profiler { pub fn start(&mut self) { while let Ok(msg) = self.port.recv() { - if !self.handle_msg(msg) { - break - } + if !self.handle_msg(msg) { + break; + } } } @@ -320,7 +327,9 @@ impl Profiler { ProfilerMsg::Get(k, sender) => { let vec_option = self.buckets.get(&k); match vec_option { - Some(vec_entry) => sender.send(ProfilerData::Record(vec_entry.to_vec())).unwrap(), + Some(vec_entry) => sender + .send(ProfilerData::Record(vec_entry.to_vec())) + .unwrap(), None => sender.send(ProfilerData::NoRecords).unwrap(), }; }, @@ -344,11 +353,12 @@ impl Profiler { let data_len = data.len(); debug_assert!(data_len > 0); - let (mean, median, min, max) = - (data.iter().sum::<f64>() / (data_len as f64), + let (mean, median, min, max) = ( + data.iter().sum::<f64>() / (data_len as f64), data[data_len / 2], data[0], - data[data_len - 1]); + data[data_len - 1], + ); (mean, median, min, max) } @@ -357,21 +367,34 @@ impl Profiler { Some(OutputOptions::FileName(ref filename)) => { let path = Path::new(&filename); let mut file = match File::create(&path) { - Err(e) => panic!("Couldn't create {}: {}", - path.display(), - Error::description(&e)), + Err(e) => panic!( + "Couldn't create {}: {}", + path.display(), + Error::description(&e) + ), Ok(file) => file, }; - write!(file, "_category_\t_incremental?_\t_iframe?_\t_url_\t_mean (ms)_\t\ - _median (ms)_\t_min (ms)_\t_max (ms)_\t_events_\n").unwrap(); + write!( + file, + "_category_\t_incremental?_\t_iframe?_\t_url_\t_mean (ms)_\t\ + _median (ms)_\t_min (ms)_\t_max (ms)_\t_events_\n" + ).unwrap(); for (&(ref category, ref meta), ref mut data) in &mut self.buckets { data.sort_by(|a, b| a.partial_cmp(b).expect("No NaN values in profiles")); let data_len = data.len(); if data_len > 0 { let (mean, median, min, max) = Self::get_statistics(data); - write!(file, "{}\t{}\t{:15.4}\t{:15.4}\t{:15.4}\t{:15.4}\t{:15}\n", - category.format(&self.output), meta.format(&self.output), - mean, median, min, max, data_len).unwrap(); + write!( + file, + "{}\t{}\t{:15.4}\t{:15.4}\t{:15.4}\t{:15.4}\t{:15}\n", + category.format(&self.output), + meta.format(&self.output), + mean, + median, + min, + max, + data_len + ).unwrap(); } } }, @@ -379,18 +402,35 @@ impl Profiler { let stdout = io::stdout(); let mut lock = stdout.lock(); - writeln!(&mut lock, "{:35} {:14} {:9} {:30} {:15} {:15} {:-15} {:-15} {:-15}", - "_category_", "_incremental?_", "_iframe?_", - " _url_", " _mean (ms)_", " _median (ms)_", - " _min (ms)_", " _max (ms)_", " _events_").unwrap(); + writeln!( + &mut lock, + "{:35} {:14} {:9} {:30} {:15} {:15} {:-15} {:-15} {:-15}", + "_category_", + "_incremental?_", + "_iframe?_", + " _url_", + " _mean (ms)_", + " _median (ms)_", + " _min (ms)_", + " _max (ms)_", + " _events_" + ).unwrap(); for (&(ref category, ref meta), ref mut data) in &mut self.buckets { data.sort_by(|a, b| a.partial_cmp(b).expect("No NaN values in profiles")); let data_len = data.len(); if data_len > 0 { let (mean, median, min, max) = Self::get_statistics(data); - writeln!(&mut lock, "{:-35}{} {:15.4} {:15.4} {:15.4} {:15.4} {:15}", - category.format(&self.output), meta.format(&self.output), mean, median, min, max, - data_len).unwrap(); + writeln!( + &mut lock, + "{:-35}{} {:15.4} {:15.4} {:15.4} {:15.4} {:15}", + category.format(&self.output), + meta.format(&self.output), + mean, + median, + min, + max, + data_len + ).unwrap(); } } writeln!(&mut lock, "").unwrap(); @@ -434,22 +474,22 @@ impl Profiler { } } } - }, None => { /* Do nothing if no output option has been set */ }, }; } } -fn enforce_range<T>(min: T, max: T, value: T) -> T where T: Ord { +fn enforce_range<T>(min: T, max: T, value: T) -> T +where + T: Ord, +{ assert!(min <= max); match value.cmp(&max) { Ordering::Equal | Ordering::Greater => max, - Ordering::Less => { - match value.cmp(&min) { - Ordering::Equal | Ordering::Less => min, - Ordering::Greater => value, - } + Ordering::Less => match value.cmp(&min) { + Ordering::Equal | Ordering::Less => min, + Ordering::Greater => value, }, } } diff --git a/components/profile/trace_dump.rs b/components/profile/trace_dump.rs index b0c8f9d7ef5..4654f4dfb57 100644 --- a/components/profile/trace_dump.rs +++ b/components/profile/trace_dump.rs @@ -38,7 +38,8 @@ impl TraceDump { /// Create a new TraceDump and write the prologue of the HTML file out to /// disk. pub fn new<P>(trace_file_path: P) -> io::Result<TraceDump> - where P: AsRef<path::Path> + where + P: AsRef<path::Path>, { let mut file = fs::File::create(trace_file_path)?; write_prologue(&mut file)?; @@ -46,10 +47,12 @@ impl TraceDump { } /// Write one trace to the trace dump file. - pub fn write_one(&mut self, - category: &(ProfilerCategory, Option<TimerMetadata>), - time: (u64, u64), - energy: (u64, u64)) { + pub fn write_one( + &mut self, + category: &(ProfilerCategory, Option<TimerMetadata>), + time: (u64, u64), + energy: (u64, u64), + ) { let entry = TraceEntry { category: category.0, metadata: category.1.clone(), diff --git a/components/profile_traits/energy.rs b/components/profile_traits/energy.rs index 1e34645b180..bbd427ca834 100644 --- a/components/profile_traits/energy.rs +++ b/components/profile_traits/energy.rs @@ -2,7 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - #[cfg(feature = "energy-profiling")] pub fn read_energy_uj() -> u64 { energymon::read_energy_uj() @@ -33,7 +32,6 @@ mod energymon { use std::mem; use std::sync::{Once, ONCE_INIT}; - static mut EM: Option<*mut EnergyMon> = None; fn init() { @@ -60,9 +58,7 @@ mod energymon { pub fn get_min_interval_ms() -> u32 { init(); - unsafe { - EM.map_or(0, |em| ((*em).interval_us() as f64 / 1000.0).ceil() as u32) - } + unsafe { EM.map_or(0, |em| ((*em).interval_us() as f64 / 1000.0).ceil() as u32) } } } diff --git a/components/profile_traits/ipc.rs b/components/profile_traits/ipc.rs index fe64d54ef07..cd4553ea8bc 100644 --- a/components/profile_traits/ipc.rs +++ b/components/profile_traits/ipc.rs @@ -10,12 +10,18 @@ use time; use time::ProfilerCategory; use time::ProfilerChan; -pub struct IpcReceiver<T> where T: for<'de> Deserialize<'de> + Serialize { +pub struct IpcReceiver<T> +where + T: for<'de> Deserialize<'de> + Serialize, +{ ipc_receiver: ipc::IpcReceiver<T>, time_profile_chan: ProfilerChan, } -impl<T> IpcReceiver<T> where T: for<'de> Deserialize<'de> + Serialize { +impl<T> IpcReceiver<T> +where + T: for<'de> Deserialize<'de> + Serialize, +{ pub fn recv(&self) -> Result<T, bincode::Error> { time::profile( ProfilerCategory::IpcReceiver, @@ -34,8 +40,12 @@ impl<T> IpcReceiver<T> where T: for<'de> Deserialize<'de> + Serialize { } } -pub fn channel<T>(time_profile_chan: ProfilerChan) -> Result<(ipc::IpcSender<T>, IpcReceiver<T>), Error> - where T: for<'de> Deserialize<'de> + Serialize, { +pub fn channel<T>( + time_profile_chan: ProfilerChan, +) -> Result<(ipc::IpcSender<T>, IpcReceiver<T>), Error> +where + T: for<'de> Deserialize<'de> + Serialize, +{ let (ipc_sender, ipc_receiver) = ipc::channel()?; let profiled_ipc_receiver = IpcReceiver { ipc_receiver, diff --git a/components/profile_traits/lib.rs b/components/profile_traits/lib.rs index 029e59a3241..e70d0b7ac40 100644 --- a/components/profile_traits/lib.rs +++ b/components/profile_traits/lib.rs @@ -12,7 +12,8 @@ extern crate bincode; extern crate ipc_channel; #[macro_use] extern crate log; -#[macro_use] extern crate serde; +#[macro_use] +extern crate serde; extern crate servo_config; extern crate signpost; diff --git a/components/profile_traits/mem.rs b/components/profile_traits/mem.rs index b0df9ac7db7..8e4d756884b 100644 --- a/components/profile_traits/mem.rs +++ b/components/profile_traits/mem.rs @@ -21,15 +21,24 @@ pub trait OpaqueSender<T> { impl<T> OpaqueSender<T> for Sender<T> { fn send(&self, message: T) { if let Err(e) = Sender::send(self, message) { - warn!("Error communicating with the target thread from the profiler: {}", e); + warn!( + "Error communicating with the target thread from the profiler: {}", + e + ); } } } -impl<T> OpaqueSender<T> for IpcSender<T> where T: serde::Serialize { +impl<T> OpaqueSender<T> for IpcSender<T> +where + T: serde::Serialize, +{ fn send(&self, message: T) { if let Err(e) = IpcSender::send(self, message) { - warn!("Error communicating with the target thread from the profiler: {}", e); + warn!( + "Error communicating with the target thread from the profiler: {}", + e + ); } } } @@ -50,24 +59,32 @@ impl ProfilerChan { } /// Runs `f()` with memory profiling. - pub fn run_with_memory_reporting<F, M, T, C>(&self, f: F, - reporter_name: String, - channel_for_reporter: C, - msg: M) - where F: FnOnce(), - M: Fn(ReportsChan) -> T + Send + 'static, - T: Send + 'static, - C: OpaqueSender<T> + Send + 'static + pub fn run_with_memory_reporting<F, M, T, C>( + &self, + f: F, + reporter_name: String, + channel_for_reporter: C, + msg: M, + ) where + F: FnOnce(), + M: Fn(ReportsChan) -> T + Send + 'static, + T: Send + 'static, + C: OpaqueSender<T> + Send + 'static, { // Register the memory reporter. let (reporter_sender, reporter_receiver) = ipc::channel().unwrap(); - ROUTER.add_route(reporter_receiver.to_opaque(), Box::new(move |message| { - // Just injects an appropriate event into the paint thread's queue. - let request: ReporterRequest = message.to().unwrap(); - channel_for_reporter.send(msg(request.reports_channel)); - })); - self.send(ProfilerMsg::RegisterReporter(reporter_name.clone(), - Reporter(reporter_sender))); + ROUTER.add_route( + reporter_receiver.to_opaque(), + Box::new(move |message| { + // Just injects an appropriate event into the paint thread's queue. + let request: ReporterRequest = message.to().unwrap(); + channel_for_reporter.send(msg(request.reports_channel)); + }), + ); + self.send(ProfilerMsg::RegisterReporter( + reporter_name.clone(), + Reporter(reporter_sender), + )); f(); @@ -154,9 +171,10 @@ pub struct Reporter(pub IpcSender<ReporterRequest>); impl Reporter { /// Collect one or more memory reports. Returns true on success, and false on failure. pub fn collect_reports(&self, reports_chan: ReportsChan) { - self.0.send(ReporterRequest { - reports_channel: reports_chan, - }).unwrap() + self.0 + .send(ReporterRequest { + reports_channel: reports_chan, + }).unwrap() } } @@ -188,4 +206,3 @@ pub enum ProfilerMsg { /// Tells the memory profiler to shut down. Exit, } - diff --git a/components/profile_traits/time.rs b/components/profile_traits/time.rs index 2c297003b9e..f905348a882 100644 --- a/components/profile_traits/time.rs +++ b/components/profile_traits/time.rs @@ -37,9 +37,16 @@ pub enum ProfilerData { #[derive(Clone, Deserialize, Serialize)] pub enum ProfilerMsg { /// Normal message used for reporting time - Time((ProfilerCategory, Option<TimerMetadata>), (u64, u64), (u64, u64)), + Time( + (ProfilerCategory, Option<TimerMetadata>), + (u64, u64), + (u64, u64), + ), /// Message used to get time spend entries for a particular ProfilerBuckets (in nanoseconds) - Get((ProfilerCategory, Option<TimerMetadata>), IpcSender<ProfilerData>), + Get( + (ProfilerCategory, Option<TimerMetadata>), + IpcSender<ProfilerData>, + ), /// Message used to force print the profiling metrics Print, /// Tells the profiler to shut down. @@ -118,12 +125,14 @@ pub enum TimerMetadataReflowType { FirstReflow, } -pub fn profile<T, F>(category: ProfilerCategory, - meta: Option<TimerMetadata>, - profiler_chan: ProfilerChan, - callback: F) - -> T - where F: FnOnce() -> T, +pub fn profile<T, F>( + category: ProfilerCategory, + meta: Option<TimerMetadata>, + profiler_chan: ProfilerChan, + callback: F, +) -> T +where + F: FnOnce() -> T, { if opts::get().signpost { signpost::start(category as u32, &[0, 0, 0, (category as usize) >> 4]); @@ -139,24 +148,30 @@ pub fn profile<T, F>(category: ProfilerCategory, signpost::end(category as u32, &[0, 0, 0, (category as usize) >> 4]); } - send_profile_data(category, - meta, - &profiler_chan, - start_time, - end_time, - start_energy, - end_energy); + send_profile_data( + category, + meta, + &profiler_chan, + start_time, + end_time, + start_energy, + end_energy, + ); val } -pub fn send_profile_data(category: ProfilerCategory, - meta: Option<TimerMetadata>, - profiler_chan: &ProfilerChan, - start_time: u64, - end_time: u64, - start_energy: u64, - end_energy: u64) { - profiler_chan.send(ProfilerMsg::Time((category, meta), - (start_time, end_time), - (start_energy, end_energy))); +pub fn send_profile_data( + category: ProfilerCategory, + meta: Option<TimerMetadata>, + profiler_chan: &ProfilerChan, + start_time: u64, + end_time: u64, + start_energy: u64, + end_energy: u64, +) { + profiler_chan.send(ProfilerMsg::Time( + (category, meta), + (start_time, end_time), + (start_energy, end_energy), + )); } diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs index 596530058ec..b2429948874 100644 --- a/components/script/dom/globalscope.rs +++ b/components/script/dom/globalscope.rs @@ -59,6 +59,7 @@ use task_source::file_reading::FileReadingTaskSource; use task_source::networking::NetworkingTaskSource; use task_source::performance_timeline::PerformanceTimelineTaskSource; use task_source::remote_event::RemoteEventTaskSource; +use task_source::websocket::WebsocketTaskSource; use time::{Timespec, get_time}; use timers::{IsInterval, OneshotTimerCallback, OneshotTimerHandle}; use timers::{OneshotTimers, TimerCallback}; @@ -430,6 +431,18 @@ impl GlobalScope { unreachable!(); } + /// `ScriptChan` to send messages to the websocket task source of + /// this global scope. + pub fn websocket_task_source(&self) -> WebsocketTaskSource { + if let Some(window) = self.downcast::<Window>() { + return window.websocket_task_source(); + } + if let Some(worker) = self.downcast::<WorkerGlobalScope>() { + return worker.websocket_task_source(); + } + unreachable!(); + } + /// Evaluate JS code on this global scope. pub fn evaluate_js_on_global_with_result( &self, code: &str, rval: MutableHandleValue) -> bool { diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 6c151486f59..d227af7ea1a 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt}; +use byteorder::{ByteOrder, NativeEndian, WriteBytesExt}; use canvas_traits::canvas::{byte_swap, multiply_u8_pixel}; use canvas_traits::webgl::{DOMToTextureCommand, Parameter}; use canvas_traits::webgl::{TexParameter, WebGLCommand, WebGLContextShareMode, WebGLError}; @@ -481,206 +481,6 @@ impl WebGLRenderingContext { } } - // https://en.wikipedia.org/wiki/Relative_luminance - #[inline] - fn luminance(r: u8, g: u8, b: u8) -> u8 { - (0.2126 * (r as f32) + - 0.7152 * (g as f32) + - 0.0722 * (b as f32)) as u8 - } - - /// Translates an image in rgba8 (red in the first byte) format to - /// the format that was requested of TexImage. - /// - /// From the WebGL 1.0 spec, 5.14.8: - /// - /// "The source image data is conceptually first converted to - /// the data type and format specified by the format and type - /// arguments, and then transferred to the WebGL - /// implementation. If a packed pixel format is specified - /// which would imply loss of bits of precision from the image - /// data, this loss of precision must occur." - fn rgba8_image_to_tex_image_data(&self, - format: TexFormat, - data_type: TexDataType, - pixels: Vec<u8>) -> Vec<u8> { - // hint for vector allocation sizing. - let pixel_count = pixels.len() / 4; - - match (format, data_type) { - (TexFormat::RGBA, TexDataType::UnsignedByte) => pixels, - (TexFormat::RGB, TexDataType::UnsignedByte) => { - // Remove alpha channel - let mut rgb8 = Vec::<u8>::with_capacity(pixel_count * 3); - for rgba8 in pixels.chunks(4) { - rgb8.push(rgba8[0]); - rgb8.push(rgba8[1]); - rgb8.push(rgba8[2]); - } - rgb8 - }, - - (TexFormat::Alpha, TexDataType::UnsignedByte) => { - let mut alpha = Vec::<u8>::with_capacity(pixel_count); - for rgba8 in pixels.chunks(4) { - alpha.push(rgba8[3]); - } - alpha - }, - - (TexFormat::Luminance, TexDataType::UnsignedByte) => { - let mut luminance = Vec::<u8>::with_capacity(pixel_count); - for rgba8 in pixels.chunks(4) { - luminance.push(Self::luminance(rgba8[0], rgba8[1], rgba8[2])); - } - luminance - }, - - (TexFormat::LuminanceAlpha, TexDataType::UnsignedByte) => { - let mut data = Vec::<u8>::with_capacity(pixel_count * 2); - for rgba8 in pixels.chunks(4) { - data.push(Self::luminance(rgba8[0], rgba8[1], rgba8[2])); - data.push(rgba8[3]); - } - data - }, - - (TexFormat::RGBA, TexDataType::UnsignedShort4444) => { - let mut rgba4 = Vec::<u8>::with_capacity(pixel_count * 2); - for rgba8 in pixels.chunks(4) { - rgba4.write_u16::<NativeEndian>((rgba8[0] as u16 & 0xf0) << 8 | - (rgba8[1] as u16 & 0xf0) << 4 | - (rgba8[2] as u16 & 0xf0) | - (rgba8[3] as u16 & 0xf0) >> 4).unwrap(); - } - rgba4 - } - - (TexFormat::RGBA, TexDataType::UnsignedShort5551) => { - let mut rgba5551 = Vec::<u8>::with_capacity(pixel_count * 2); - for rgba8 in pixels.chunks(4) { - rgba5551.write_u16::<NativeEndian>((rgba8[0] as u16 & 0xf8) << 8 | - (rgba8[1] as u16 & 0xf8) << 3 | - (rgba8[2] as u16 & 0xf8) >> 2 | - (rgba8[3] as u16) >> 7).unwrap(); - } - rgba5551 - } - - (TexFormat::RGB, TexDataType::UnsignedShort565) => { - let mut rgb565 = Vec::<u8>::with_capacity(pixel_count * 2); - for rgba8 in pixels.chunks(4) { - rgb565.write_u16::<NativeEndian>((rgba8[0] as u16 & 0xf8) << 8 | - (rgba8[1] as u16 & 0xfc) << 3 | - (rgba8[2] as u16 & 0xf8) >> 3).unwrap(); - } - rgb565 - } - - - (TexFormat::RGBA, TexDataType::Float) => { - let mut rgbaf32 = Vec::<u8>::with_capacity(pixel_count * 16); - for rgba8 in pixels.chunks(4) { - rgbaf32.write_f32::<NativeEndian>(rgba8[0] as f32).unwrap(); - rgbaf32.write_f32::<NativeEndian>(rgba8[1] as f32).unwrap(); - rgbaf32.write_f32::<NativeEndian>(rgba8[2] as f32).unwrap(); - rgbaf32.write_f32::<NativeEndian>(rgba8[3] as f32).unwrap(); - } - rgbaf32 - } - - (TexFormat::RGB, TexDataType::Float) => { - let mut rgbf32 = Vec::<u8>::with_capacity(pixel_count * 12); - for rgba8 in pixels.chunks(4) { - rgbf32.write_f32::<NativeEndian>(rgba8[0] as f32).unwrap(); - rgbf32.write_f32::<NativeEndian>(rgba8[1] as f32).unwrap(); - rgbf32.write_f32::<NativeEndian>(rgba8[2] as f32).unwrap(); - } - rgbf32 - } - - (TexFormat::Alpha, TexDataType::Float) => { - let mut alpha = Vec::<u8>::with_capacity(pixel_count * 4); - for rgba8 in pixels.chunks(4) { - alpha.write_f32::<NativeEndian>(rgba8[0] as f32).unwrap(); - } - alpha - }, - - (TexFormat::Luminance, TexDataType::Float) => { - let mut luminance = Vec::<u8>::with_capacity(pixel_count * 4); - for rgba8 in pixels.chunks(4) { - let p = Self::luminance(rgba8[0], rgba8[1], rgba8[2]); - luminance.write_f32::<NativeEndian>(p as f32).unwrap(); - } - luminance - }, - - (TexFormat::LuminanceAlpha, TexDataType::Float) => { - let mut data = Vec::<u8>::with_capacity(pixel_count * 8); - for rgba8 in pixels.chunks(4) { - let p = Self::luminance(rgba8[0], rgba8[1], rgba8[2]); - data.write_f32::<NativeEndian>(p as f32).unwrap(); - data.write_f32::<NativeEndian>(rgba8[3] as f32).unwrap(); - } - data - }, - - (TexFormat::RGBA, TexDataType::HalfFloat) => { - let mut rgbaf16 = Vec::<u8>::with_capacity(pixel_count * 8); - for rgba8 in pixels.chunks(4) { - rgbaf16.write_u16::<NativeEndian>(f16::from_f32(rgba8[0] as f32).as_bits()).unwrap(); - rgbaf16.write_u16::<NativeEndian>(f16::from_f32(rgba8[1] as f32).as_bits()).unwrap(); - rgbaf16.write_u16::<NativeEndian>(f16::from_f32(rgba8[2] as f32).as_bits()).unwrap(); - rgbaf16.write_u16::<NativeEndian>(f16::from_f32(rgba8[3] as f32).as_bits()).unwrap(); - } - rgbaf16 - }, - - (TexFormat::RGB, TexDataType::HalfFloat) => { - let mut rgbf16 = Vec::<u8>::with_capacity(pixel_count * 6); - for rgba8 in pixels.chunks(4) { - rgbf16.write_u16::<NativeEndian>(f16::from_f32(rgba8[0] as f32).as_bits()).unwrap(); - rgbf16.write_u16::<NativeEndian>(f16::from_f32(rgba8[1] as f32).as_bits()).unwrap(); - rgbf16.write_u16::<NativeEndian>(f16::from_f32(rgba8[2] as f32).as_bits()).unwrap(); - } - rgbf16 - }, - - (TexFormat::Alpha, TexDataType::HalfFloat) => { - let mut alpha = Vec::<u8>::with_capacity(pixel_count * 2); - for rgba8 in pixels.chunks(4) { - alpha.write_u16::<NativeEndian>(f16::from_f32(rgba8[3] as f32).as_bits()).unwrap(); - } - alpha - }, - - (TexFormat::Luminance, TexDataType::HalfFloat) => { - let mut luminance = Vec::<u8>::with_capacity(pixel_count * 4); - for rgba8 in pixels.chunks(4) { - let p = Self::luminance(rgba8[0], rgba8[1], rgba8[2]); - luminance.write_u16::<NativeEndian>(f16::from_f32(p as f32).as_bits()).unwrap(); - } - luminance - }, - - (TexFormat::LuminanceAlpha, TexDataType::HalfFloat) => { - let mut data = Vec::<u8>::with_capacity(pixel_count * 8); - for rgba8 in pixels.chunks(4) { - let p = Self::luminance(rgba8[0], rgba8[1], rgba8[2]); - data.write_u16::<NativeEndian>(f16::from_f32(p as f32).as_bits()).unwrap(); - data.write_u16::<NativeEndian>(f16::from_f32(rgba8[3] as f32).as_bits()).unwrap(); - } - data - }, - - // Validation should have ensured that we only hit the - // above cases, but we haven't turned the (format, type) - // into an enum yet so there's a default case here. - _ => unreachable!("Unsupported formats {:?} {:?}", format, data_type) - } - } - fn get_image_pixels( &self, source: ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement, @@ -825,85 +625,53 @@ impl WebGLRenderingContext { /// Performs premultiplication of the pixels if /// UNPACK_PREMULTIPLY_ALPHA_WEBGL is currently enabled. - fn premultiply_pixels(&self, - format: TexFormat, - data_type: TexDataType, - pixels: Vec<u8>) -> Vec<u8> { + fn premultiply_pixels(&self, format: TexFormat, data_type: TexDataType, pixels: &mut [u8]) { if !self.texture_unpacking_settings.get().contains(TextureUnpacking::PREMULTIPLY_ALPHA) { - return pixels; + return; } match (format, data_type) { (TexFormat::RGBA, TexDataType::UnsignedByte) => { - let mut premul = Vec::<u8>::with_capacity(pixels.len()); - for rgba in pixels.chunks(4) { - premul.push(multiply_u8_pixel(rgba[0], rgba[3])); - premul.push(multiply_u8_pixel(rgba[1], rgba[3])); - premul.push(multiply_u8_pixel(rgba[2], rgba[3])); - premul.push(rgba[3]); + for rgba in pixels.chunks_mut(4) { + rgba[0] = multiply_u8_pixel(rgba[0], rgba[3]); + rgba[1] = multiply_u8_pixel(rgba[1], rgba[3]); + rgba[2] = multiply_u8_pixel(rgba[2], rgba[3]); } - premul - } + }, (TexFormat::LuminanceAlpha, TexDataType::UnsignedByte) => { - let mut premul = Vec::<u8>::with_capacity(pixels.len()); - for la in pixels.chunks(2) { - premul.push(multiply_u8_pixel(la[0], la[1])); - premul.push(la[1]); + for la in pixels.chunks_mut(2) { + la[0] = multiply_u8_pixel(la[0], la[1]); } - premul - } - + }, (TexFormat::RGBA, TexDataType::UnsignedShort5551) => { - let mut premul = Vec::<u8>::with_capacity(pixels.len()); - for mut rgba in pixels.chunks(2) { - let pix = rgba.read_u16::<NativeEndian>().unwrap(); - if pix & (1 << 15) != 0 { - premul.write_u16::<NativeEndian>(pix).unwrap(); - } else { - premul.write_u16::<NativeEndian>(0).unwrap(); + for rgba in pixels.chunks_mut(2) { + if NativeEndian::read_u16(rgba) & 1 == 0 { + NativeEndian::write_u16(rgba, 0); } } - premul - } - + }, (TexFormat::RGBA, TexDataType::UnsignedShort4444) => { - let mut premul = Vec::<u8>::with_capacity(pixels.len()); - for mut rgba in pixels.chunks(2) { - let pix = rgba.read_u16::<NativeEndian>().unwrap(); - let extend_to_8_bits = |val| { (val | val << 4) as u8 }; - let r = extend_to_8_bits(pix & 0x000f); - let g = extend_to_8_bits((pix & 0x00f0) >> 4); - let b = extend_to_8_bits((pix & 0x0f00) >> 8); - let a = extend_to_8_bits((pix & 0xf000) >> 12); - - premul.write_u16::<NativeEndian>((multiply_u8_pixel(r, a) & 0xf0) as u16 >> 4 | - (multiply_u8_pixel(g, a) & 0xf0) as u16 | - ((multiply_u8_pixel(b, a) & 0xf0) as u16) << 4 | - pix & 0xf000).unwrap(); + for rgba in pixels.chunks_mut(2) { + let pix = NativeEndian::read_u16(rgba); + let extend_to_8_bits = |val| (val | val << 4) as u8; + let r = extend_to_8_bits(pix >> 12 & 0x0f); + let g = extend_to_8_bits(pix >> 8 & 0x0f); + let b = extend_to_8_bits(pix >> 4 & 0x0f); + let a = extend_to_8_bits(pix & 0x0f); + NativeEndian::write_u16( + rgba, + ((multiply_u8_pixel(r, a) & 0xf0) as u16) << 8 | + ((multiply_u8_pixel(g, a) & 0xf0) as u16) << 4 | + ((multiply_u8_pixel(b, a) & 0xf0) as u16) | + ((a & 0x0f) as u16), + ); } - premul - } - + }, // Other formats don't have alpha, so return their data untouched. - _ => pixels + _ => {}, } } - // Remove premultiplied alpha. - // This is only called when texImage2D is called using a canvas2d source and - // UNPACK_PREMULTIPLY_ALPHA_WEBGL is disabled. Pixels got from a canvas2D source - // are always RGBA8 with premultiplied alpha, so we don't have to worry about - // additional formats as happens in the premultiply_pixels method. - fn remove_premultiplied_alpha(&self, mut pixels: Vec<u8>) -> Vec<u8> { - for rgba in pixels.chunks_mut(4) { - let a = (rgba[3] as f32) / 255.0; - rgba[0] = (rgba[0] as f32 / a) as u8; - rgba[1] = (rgba[1] as f32 / a) as u8; - rgba[2] = (rgba[2] as f32 / a) as u8; - } - pixels - } - fn prepare_pixels(&self, internal_format: TexFormat, data_type: TexDataType, @@ -917,16 +685,16 @@ impl WebGLRenderingContext { if !source_premultiplied && dest_premultiply { if source_from_image_or_canvas { // When the pixels come from image or canvas or imagedata, use RGBA8 format - pixels = self.premultiply_pixels(TexFormat::RGBA, TexDataType::UnsignedByte, pixels); + self.premultiply_pixels(TexFormat::RGBA, TexDataType::UnsignedByte, &mut pixels); } else { - pixels = self.premultiply_pixels(internal_format, data_type, pixels); + self.premultiply_pixels(internal_format, data_type, &mut pixels); } } else if source_premultiplied && !dest_premultiply { - pixels = self.remove_premultiplied_alpha(pixels); + remove_premultiplied_alpha(&mut pixels); } if source_from_image_or_canvas { - pixels = self.rgba8_image_to_tex_image_data(internal_format, data_type, pixels); + pixels = rgba8_image_to_tex_image_data(internal_format, data_type, pixels); } // FINISHME: Consider doing premultiply and flip in a single mutable Vec. @@ -966,17 +734,17 @@ impl WebGLRenderingContext { let internal_format = self.extension_manager.get_effective_tex_internal_format(format, data_type); // TODO(emilio): convert colorspace if requested - let msg = WebGLCommand::TexImage2D( + let (sender, receiver) = ipc::bytes_channel().unwrap(); + self.send_command(WebGLCommand::TexImage2D( target.as_gl_constant(), level as i32, internal_format as i32, width as i32, height as i32, format, data_type, - pixels.into(), - ); - - self.send_command(msg); + receiver, + )); + sender.send(&pixels).unwrap(); if let Some(fb) = self.bound_framebuffer.get() { fb.invalidate_texture(&*texture); @@ -1021,7 +789,8 @@ impl WebGLRenderingContext { self.send_command(WebGLCommand::PixelStorei(constants::UNPACK_ALIGNMENT, unpacking_alignment as i32)); // TODO(emilio): convert colorspace if requested - let msg = WebGLCommand::TexSubImage2D( + let (sender, receiver) = ipc::bytes_channel().unwrap(); + self.send_command(WebGLCommand::TexSubImage2D( target.as_gl_constant(), level as i32, xoffset, @@ -1030,10 +799,9 @@ impl WebGLRenderingContext { height as i32, format.as_gl_constant(), data_type.as_gl_constant(), - pixels.into(), - ); - - self.send_command(msg); + receiver, + )); + sender.send(&pixels).unwrap(); } fn get_gl_extensions(&self) -> String { @@ -1191,18 +959,18 @@ impl WebGLRenderingContext { // can fail and that it is UB what happens in that case. // // https://www.khronos.org/registry/webgl/specs/latest/1.0/#2.2 - pub fn get_image_data(&self, mut width: u32, mut height: u32) -> Option<Vec<u8>> { + pub fn get_image_data(&self, width: u32, height: u32) -> Option<Vec<u8>> { handle_potential_webgl_error!(self, self.validate_framebuffer(), return None); - if let Some((fb_width, fb_height)) = self.get_current_framebuffer_size() { - width = cmp::min(width, fb_width as u32); - height = cmp::min(height, fb_height as u32); - } else { - self.webgl_error(InvalidOperation); - return None; - } + let (fb_width, fb_height) = handle_potential_webgl_error!( + self, + self.get_current_framebuffer_size().ok_or(InvalidOperation), + return None + ); + let width = cmp::min(width, fb_width as u32); + let height = cmp::min(height, fb_height as u32); - let (sender, receiver) = webgl_channel().unwrap(); + let (sender, receiver) = ipc::bytes_channel().unwrap(); self.send_command(WebGLCommand::ReadPixels( 0, 0, @@ -1212,7 +980,7 @@ impl WebGLRenderingContext { constants::UNSIGNED_BYTE, sender, )); - Some(receiver.recv().unwrap().into()) + Some(receiver.recv().unwrap()) } pub fn array_buffer(&self) -> Option<DomRoot<WebGLBuffer>> { @@ -2894,7 +2662,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { _ => return self.webgl_error(InvalidOperation), }; - let (sender, receiver) = webgl_channel().unwrap(); + let (sender, receiver) = ipc::bytes_channel().unwrap(); self.send_command(WebGLCommand::ReadPixels(x, y, width, height, format, pixel_type, sender)); let result = receiver.recv().unwrap(); @@ -3683,7 +3451,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { border: i32, format: u32, data_type: u32, - mut pixels: CustomAutoRooterGuard<Option<ArrayBufferView>>, + pixels: CustomAutoRooterGuard<Option<ArrayBufferView>>, ) -> ErrorResult { if !self.extension_manager.is_tex_type_enabled(data_type) { return Ok(self.webgl_error(InvalidEnum)); @@ -3721,7 +3489,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { // initialized to 0 is passed. let buff = match *pixels { None => vec![0u8; expected_byte_length as usize], - Some(ref mut data) => data.to_vec(), + Some(ref data) => data.to_vec(), }; // From the WebGL spec: @@ -4212,3 +3980,228 @@ impl TextureUnit { None } } + +// Remove premultiplied alpha. +// This is only called when texImage2D is called using a canvas2d source and +// UNPACK_PREMULTIPLY_ALPHA_WEBGL is disabled. Pixels got from a canvas2D source +// are always RGBA8 with premultiplied alpha, so we don't have to worry about +// additional formats as happens in the premultiply_pixels method. +fn remove_premultiplied_alpha(pixels: &mut [u8]) { + for rgba in pixels.chunks_mut(4) { + let a = (rgba[3] as f32) / 255.0; + rgba[0] = (rgba[0] as f32 / a) as u8; + rgba[1] = (rgba[1] as f32 / a) as u8; + rgba[2] = (rgba[2] as f32 / a) as u8; + } +} + +/// Translates an image in rgba8 (red in the first byte) format to +/// the format that was requested of TexImage. +/// +/// From the WebGL 1.0 spec, 5.14.8: +/// +/// "The source image data is conceptually first converted to +/// the data type and format specified by the format and type +/// arguments, and then transferred to the WebGL +/// implementation. If a packed pixel format is specified +/// which would imply loss of bits of precision from the image +/// data, this loss of precision must occur." +fn rgba8_image_to_tex_image_data( + format: TexFormat, + data_type: TexDataType, + mut pixels: Vec<u8>, +) -> Vec<u8> { + // hint for vector allocation sizing. + let pixel_count = pixels.len() / 4; + + match (format, data_type) { + (TexFormat::RGBA, TexDataType::UnsignedByte) => pixels, + (TexFormat::RGB, TexDataType::UnsignedByte) => { + // Remove alpha channel + let mut rgb8 = Vec::<u8>::with_capacity(pixel_count * 3); + for rgba8 in pixels.chunks(4) { + rgb8.push(rgba8[0]); + rgb8.push(rgba8[1]); + rgb8.push(rgba8[2]); + } + rgb8 + }, + (TexFormat::Alpha, TexDataType::UnsignedByte) => { + for i in 0..pixel_count { + let p = pixels[i * 4 + 3]; + pixels[i] = p; + } + pixels.truncate(pixel_count); + pixels + }, + (TexFormat::Luminance, TexDataType::UnsignedByte) => { + for i in 0..pixel_count { + let p = pixels[i * 4]; + pixels[i] = p; + } + pixels.truncate(pixel_count); + pixels + }, + (TexFormat::LuminanceAlpha, TexDataType::UnsignedByte) => { + for i in 0..pixel_count { + let (lum, a) = { + let rgba = &pixels[i * 4..i * 4 + 4]; + (rgba[0], rgba[3]) + }; + pixels[i * 2] = lum; + pixels[i * 2 + 1] = a; + } + pixels.truncate(pixel_count * 2); + pixels + }, + (TexFormat::RGBA, TexDataType::UnsignedShort4444) => { + for i in 0..pixel_count { + let p = { + let rgba = &pixels[i * 4..i * 4 + 4]; + (rgba[0] as u16 & 0xf0) << 8 | + (rgba[1] as u16 & 0xf0) << 4 | + (rgba[2] as u16 & 0xf0) | + (rgba[3] as u16 & 0xf0) >> 4 + }; + NativeEndian::write_u16(&mut pixels[i * 2..i * 2 + 2], p); + } + pixels.truncate(pixel_count * 2); + pixels + }, + (TexFormat::RGBA, TexDataType::UnsignedShort5551) => { + for i in 0..pixel_count { + let p = { + let rgba = &pixels[i * 4..i * 4 + 4]; + (rgba[0] as u16 & 0xf8) << 8 | + (rgba[1] as u16 & 0xf8) << 3 | + (rgba[2] as u16 & 0xf8) >> 2 | + (rgba[3] as u16) >> 7 + }; + NativeEndian::write_u16(&mut pixels[i * 2..i * 2 + 2], p); + } + pixels.truncate(pixel_count * 2); + pixels + }, + (TexFormat::RGB, TexDataType::UnsignedShort565) => { + for i in 0..pixel_count { + let p = { + let rgb = &pixels[i * 4..i * 4 + 3]; + (rgb[0] as u16 & 0xf8) << 8 | + (rgb[1] as u16 & 0xfc) << 3 | + (rgb[2] as u16 & 0xf8) >> 3 + }; + NativeEndian::write_u16(&mut pixels[i * 2..i * 2 + 2], p); + } + pixels.truncate(pixel_count * 2); + pixels + }, + (TexFormat::RGBA, TexDataType::Float) => { + let mut rgbaf32 = Vec::<u8>::with_capacity(pixel_count * 16); + for rgba8 in pixels.chunks(4) { + rgbaf32.write_f32::<NativeEndian>(rgba8[0] as f32).unwrap(); + rgbaf32.write_f32::<NativeEndian>(rgba8[1] as f32).unwrap(); + rgbaf32.write_f32::<NativeEndian>(rgba8[2] as f32).unwrap(); + rgbaf32.write_f32::<NativeEndian>(rgba8[3] as f32).unwrap(); + } + rgbaf32 + } + + (TexFormat::RGB, TexDataType::Float) => { + let mut rgbf32 = Vec::<u8>::with_capacity(pixel_count * 12); + for rgba8 in pixels.chunks(4) { + rgbf32.write_f32::<NativeEndian>(rgba8[0] as f32).unwrap(); + rgbf32.write_f32::<NativeEndian>(rgba8[1] as f32).unwrap(); + rgbf32.write_f32::<NativeEndian>(rgba8[2] as f32).unwrap(); + } + rgbf32 + } + + (TexFormat::Alpha, TexDataType::Float) => { + for rgba8 in pixels.chunks_mut(4) { + let p = rgba8[3] as f32; + NativeEndian::write_f32(rgba8, p); + } + pixels + }, + + (TexFormat::Luminance, TexDataType::Float) => { + for rgba8 in pixels.chunks_mut(4) { + let p = luminance(rgba8[0], rgba8[1], rgba8[2]); + NativeEndian::write_f32(rgba8, p as f32); + } + pixels + }, + + (TexFormat::LuminanceAlpha, TexDataType::Float) => { + let mut data = Vec::<u8>::with_capacity(pixel_count * 8); + for rgba8 in pixels.chunks(4) { + let p = luminance(rgba8[0], rgba8[1], rgba8[2]); + data.write_f32::<NativeEndian>(p as f32).unwrap(); + data.write_f32::<NativeEndian>(rgba8[3] as f32).unwrap(); + } + data + }, + + (TexFormat::RGBA, TexDataType::HalfFloat) => { + let mut rgbaf16 = Vec::<u8>::with_capacity(pixel_count * 8); + for rgba8 in pixels.chunks(4) { + rgbaf16.write_u16::<NativeEndian>(f16::from_f32(rgba8[0] as f32).as_bits()).unwrap(); + rgbaf16.write_u16::<NativeEndian>(f16::from_f32(rgba8[1] as f32).as_bits()).unwrap(); + rgbaf16.write_u16::<NativeEndian>(f16::from_f32(rgba8[2] as f32).as_bits()).unwrap(); + rgbaf16.write_u16::<NativeEndian>(f16::from_f32(rgba8[3] as f32).as_bits()).unwrap(); + } + rgbaf16 + }, + + (TexFormat::RGB, TexDataType::HalfFloat) => { + let mut rgbf16 = Vec::<u8>::with_capacity(pixel_count * 6); + for rgba8 in pixels.chunks(4) { + rgbf16.write_u16::<NativeEndian>(f16::from_f32(rgba8[0] as f32).as_bits()).unwrap(); + rgbf16.write_u16::<NativeEndian>(f16::from_f32(rgba8[1] as f32).as_bits()).unwrap(); + rgbf16.write_u16::<NativeEndian>(f16::from_f32(rgba8[2] as f32).as_bits()).unwrap(); + } + rgbf16 + }, + (TexFormat::Alpha, TexDataType::HalfFloat) => { + for i in 0..pixel_count { + let p = f16::from_f32(pixels[i * 4 + 3] as f32).as_bits(); + NativeEndian::write_u16(&mut pixels[i * 2..i * 2 + 2], p); + } + pixels.truncate(pixel_count * 2); + pixels + }, + (TexFormat::Luminance, TexDataType::HalfFloat) => { + for i in 0..pixel_count { + let p = { + let rgb = &pixels[i * 4..i * 4 + 3]; + f16::from_f32(luminance(rgb[0], rgb[1], rgb[2]) as f32).as_bits() + }; + NativeEndian::write_u16(&mut pixels[i * 2..i * 2 + 2], p); + } + pixels.truncate(pixel_count * 2); + pixels + }, + (TexFormat::LuminanceAlpha, TexDataType::HalfFloat) => { + let mut data = Vec::<u8>::with_capacity(pixel_count * 8); + for rgba8 in pixels.chunks(4) { + let p = luminance(rgba8[0], rgba8[1], rgba8[2]); + data.write_u16::<NativeEndian>(f16::from_f32(p as f32).as_bits()).unwrap(); + data.write_u16::<NativeEndian>(f16::from_f32(rgba8[3] as f32).as_bits()).unwrap(); + } + data + }, + + // Validation should have ensured that we only hit the + // above cases, but we haven't turned the (format, type) + // into an enum yet so there's a default case here. + _ => unreachable!("Unsupported formats {:?} {:?}", format, data_type) + } +} + +// https://en.wikipedia.org/wiki/Relative_luminance +#[inline] +fn luminance(r: u8, g: u8, b: u8) -> u8 { + (0.2126 * (r as f32) + + 0.7152 * (g as f32) + + 0.0722 * (b as f32)) as u8 +} diff --git a/components/script/dom/websocket.rs b/components/script/dom/websocket.rs index 0a319bdc92e..ac0f14ad436 100644 --- a/components/script/dom/websocket.rs +++ b/components/script/dom/websocket.rs @@ -39,8 +39,8 @@ use std::cell::Cell; use std::ptr; use std::thread; use task::{TaskOnce, TaskCanceller}; -use task_source::{TaskSource, TaskSourceName}; -use task_source::networking::NetworkingTaskSource; +use task_source::TaskSource; +use task_source::websocket::WebsocketTaskSource; #[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)] enum WebSocketRequestState { @@ -70,7 +70,7 @@ mod close_code { pub fn close_the_websocket_connection( address: Trusted<WebSocket>, - task_source: &NetworkingTaskSource, + task_source: &WebsocketTaskSource, canceller: &TaskCanceller, code: Option<u16>, reason: String, @@ -86,7 +86,7 @@ pub fn close_the_websocket_connection( pub fn fail_the_websocket_connection( address: Trusted<WebSocket>, - task_source: &NetworkingTaskSource, + task_source: &WebsocketTaskSource, canceller: &TaskCanceller, ) { let close_task = CloseTask { @@ -199,11 +199,8 @@ impl WebSocket { }; let _ = global.core_resource_thread().send(CoreResourceMsg::Fetch(request, channels)); - // TODO: use a dedicated task source, - // https://html.spec.whatwg.org/multipage/#websocket-task-source - // When making the switch, also update the task_canceller call. - let task_source = global.networking_task_source(); - let canceller = global.task_canceller(TaskSourceName::Networking); + let task_source = global.websocket_task_source(); + let canceller = global.task_canceller(WebsocketTaskSource::NAME); thread::spawn(move || { while let Ok(event) = dom_event_receiver.recv() { match event { @@ -273,7 +270,7 @@ impl WebSocket { WebSocketEvent, task, Some(pipeline_id), - TaskSourceName::Networking, + WebsocketTaskSource::NAME, )) .unwrap(); } @@ -407,10 +404,10 @@ impl WebSocketMethods for WebSocket { // TODO: use a dedicated task source, // https://html.spec.whatwg.org/multipage/#websocket-task-source // When making the switch, also update the task_canceller call. - let task_source = self.global().networking_task_source(); + let task_source = self.global().websocket_task_source(); fail_the_websocket_connection(address, &task_source, - &self.global().task_canceller(TaskSourceName::Networking)); + &self.global().task_canceller(WebsocketTaskSource::NAME)); } WebSocketRequestState::Open => { self.ready_state.set(WebSocketRequestState::Closing); diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index c71fea509d3..052f121fb2a 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -128,6 +128,7 @@ use task_source::networking::NetworkingTaskSource; use task_source::performance_timeline::PerformanceTimelineTaskSource; use task_source::remote_event::RemoteEventTaskSource; use task_source::user_interaction::UserInteractionTaskSource; +use task_source::websocket::WebsocketTaskSource; use time; use timers::{IsInterval, TimerCallback}; use url::Position; @@ -186,6 +187,8 @@ pub struct Window { performance_timeline_task_source: PerformanceTimelineTaskSource, #[ignore_malloc_size_of = "task sources are hard"] remote_event_task_source: RemoteEventTaskSource, + #[ignore_malloc_size_of = "task sources are hard"] + websocket_task_source: WebsocketTaskSource, navigator: MutNullableDom<Navigator>, #[ignore_malloc_size_of = "Arc"] image_cache: Arc<ImageCache>, @@ -376,6 +379,10 @@ impl Window { self.remote_event_task_source.clone() } + pub fn websocket_task_source(&self) -> WebsocketTaskSource { + self.websocket_task_source.clone() + } + pub fn main_thread_script_chan(&self) -> &Sender<MainThreadScriptMsg> { &self.script_chan.0 } @@ -1904,6 +1911,7 @@ impl Window { file_reading_task_source: FileReadingTaskSource, performance_timeline_task_source: PerformanceTimelineTaskSource, remote_event_task_source: RemoteEventTaskSource, + websocket_task_source: WebsocketTaskSource, image_cache_chan: Sender<ImageCacheMsg>, image_cache: Arc<ImageCache>, resource_threads: ResourceThreads, @@ -1957,6 +1965,7 @@ impl Window { file_reading_task_source, performance_timeline_task_source, remote_event_task_source, + websocket_task_source, image_cache_chan, image_cache, navigator: Default::default(), diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs index 9418b51759c..ac372c5fe98 100644 --- a/components/script/dom/workerglobalscope.rs +++ b/components/script/dom/workerglobalscope.rs @@ -47,6 +47,7 @@ use task_source::file_reading::FileReadingTaskSource; use task_source::networking::NetworkingTaskSource; use task_source::performance_timeline::PerformanceTimelineTaskSource; use task_source::remote_event::RemoteEventTaskSource; +use task_source::websocket::WebsocketTaskSource; use time::precise_time_ns; use timers::{IsInterval, TimerCallback}; @@ -386,6 +387,10 @@ impl WorkerGlobalScope { RemoteEventTaskSource(self.script_chan(), self.pipeline_id()) } + pub fn websocket_task_source(&self) -> WebsocketTaskSource { + WebsocketTaskSource(self.script_chan(), self.pipeline_id()) + } + pub fn new_script_pair(&self) -> (Box<ScriptChan + Send>, Box<ScriptPort + Send>) { let dedicated = self.downcast::<DedicatedWorkerGlobalScope>(); if let Some(dedicated) = dedicated { diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 090fc743a47..8f9d98a2e93 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -125,6 +125,7 @@ use task_source::networking::NetworkingTaskSource; use task_source::performance_timeline::PerformanceTimelineTaskSource; use task_source::remote_event::RemoteEventTaskSource; use task_source::user_interaction::UserInteractionTaskSource; +use task_source::websocket::WebsocketTaskSource; use time::{get_time, precise_time_ns, Tm}; use url::Position; use url::percent_encoding::percent_decode; @@ -1896,6 +1897,10 @@ impl ScriptThread { RemoteEventTaskSource(self.remote_event_task_sender.clone(), pipeline_id) } + pub fn websocket_task_source(&self, pipeline_id: PipelineId) -> WebsocketTaskSource { + WebsocketTaskSource(self.remote_event_task_sender.clone(), pipeline_id) + } + /// Handles a request for the window title. fn handle_get_title_msg(&self, pipeline_id: PipelineId) { let document = match { self.documents.borrow().find_document(pipeline_id) } { @@ -2220,6 +2225,7 @@ impl ScriptThread { self.file_reading_task_source(incomplete.pipeline_id), self.performance_timeline_task_source(incomplete.pipeline_id).clone(), self.remote_event_task_source(incomplete.pipeline_id), + self.websocket_task_source(incomplete.pipeline_id), self.image_cache_channel.clone(), self.image_cache.clone(), self.resource_threads.clone(), diff --git a/components/script/task_source/mod.rs b/components/script/task_source/mod.rs index b64f4b2b991..4dbf0a61c37 100644 --- a/components/script/task_source/mod.rs +++ b/components/script/task_source/mod.rs @@ -10,6 +10,7 @@ pub mod networking; pub mod performance_timeline; pub mod remote_event; pub mod user_interaction; +pub mod websocket; use dom::globalscope::GlobalScope; use enum_iterator::IntoEnumIterator; @@ -28,7 +29,8 @@ pub enum TaskSourceName { Networking, PerformanceTimeline, UserInteraction, - RemoteEvent + RemoteEvent, + Websocket, } impl TaskSourceName { diff --git a/components/script/task_source/websocket.rs b/components/script/task_source/websocket.rs new file mode 100644 index 00000000000..fbf28aeeb92 --- /dev/null +++ b/components/script/task_source/websocket.rs @@ -0,0 +1,37 @@ +/* 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 http://mozilla.org/MPL/2.0/. */ + +use msg::constellation_msg::PipelineId; +use script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; +use task::{TaskCanceller, TaskOnce}; +use task_source::{TaskSource, TaskSourceName}; + +#[derive(JSTraceable)] +pub struct WebsocketTaskSource(pub Box<ScriptChan + Send + 'static>, pub PipelineId); + +impl Clone for WebsocketTaskSource { + fn clone(&self) -> WebsocketTaskSource { + WebsocketTaskSource(self.0.clone(), self.1.clone()) + } +} + +impl TaskSource for WebsocketTaskSource { + const NAME: TaskSourceName = TaskSourceName::Websocket; + + fn queue_with_canceller<T>( + &self, + task: T, + canceller: &TaskCanceller, + ) -> Result<(), ()> + where + T: TaskOnce + 'static, + { + self.0.send(CommonScriptMsg::Task( + ScriptThreadEventCategory::NetworkEvent, + Box::new(canceller.wrap_task(task)), + Some(self.1), + WebsocketTaskSource::NAME, + )) + } +} diff --git a/components/servo/lib.rs b/components/servo/lib.rs index 278e590bae5..f6edcc45bde 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -66,7 +66,7 @@ fn webdriver(port: u16, constellation: Sender<ConstellationMsg>) { } #[cfg(not(feature = "webdriver"))] -fn webdriver(_port: u16, _constellation: Sender<ConstellationMsg>) { } +fn webdriver(_port: u16, _constellation: Sender<ConstellationMsg>) {} use bluetooth::BluetoothThreadFactory; use bluetooth_traits::BluetoothRequest; @@ -128,7 +128,10 @@ pub struct Servo<Window: WindowMethods + 'static> { embedder_events: Vec<(Option<BrowserId>, EmbedderMsg)>, } -impl<Window> Servo<Window> where Window: WindowMethods + 'static { +impl<Window> Servo<Window> +where + Window: WindowMethods + 'static, +{ pub fn new(window: Rc<Window>) -> Servo<Window> { // Global configuration options, parsed from the command line. let opts = opts::get(); @@ -148,15 +151,13 @@ impl<Window> Servo<Window> where Window: WindowMethods + 'static { let (embedder_proxy, embedder_receiver) = create_embedder_channel(window.create_event_loop_waker()); let supports_clipboard = window.supports_clipboard(); - let time_profiler_chan = profile_time::Profiler::create(&opts.time_profiling, - opts.time_profiler_trace_path.clone()); + let time_profiler_chan = profile_time::Profiler::create( + &opts.time_profiling, + opts.time_profiler_trace_path.clone(), + ); let mem_profiler_chan = profile_mem::Profiler::create(opts.mem_profiler_period); - let debugger_chan = opts.debugger_port.map(|port| { - debugger::start_server(port) - }); - let devtools_chan = opts.devtools_port.map(|port| { - devtools::start_server(port) - }); + let debugger_chan = opts.debugger_port.map(|port| debugger::start_server(port)); + let devtools_chan = opts.devtools_port.map(|port| devtools::start_server(port)); let coordinates = window.get_coordinates(); @@ -180,23 +181,28 @@ impl<Window> Servo<Window> where Window: WindowMethods + 'static { let render_notifier = Box::new(RenderNotifier::new(compositor_proxy.clone())); - webrender::Renderer::new(window.gl(), render_notifier, webrender::RendererOptions { - device_pixel_ratio: coordinates.hidpi_factor.get(), - resource_override_path: opts.shaders_dir.clone(), - enable_aa: opts.enable_text_antialiasing, - debug_flags: debug_flags, - recorder: recorder, - precache_shaders: opts.precache_shaders, - enable_scrollbars: opts.output_file.is_none(), - renderer_kind: renderer_kind, - enable_subpixel_aa: opts.enable_subpixel_text_antialiasing, - ..Default::default() - }).expect("Unable to initialize webrender!") + webrender::Renderer::new( + window.gl(), + render_notifier, + webrender::RendererOptions { + device_pixel_ratio: coordinates.hidpi_factor.get(), + resource_override_path: opts.shaders_dir.clone(), + enable_aa: opts.enable_text_antialiasing, + debug_flags: debug_flags, + recorder: recorder, + precache_shaders: opts.precache_shaders, + enable_scrollbars: opts.output_file.is_none(), + renderer_kind: renderer_kind, + enable_subpixel_aa: opts.enable_subpixel_text_antialiasing, + ..Default::default() + }, + ).expect("Unable to initialize webrender!") }; let webrender_api = webrender_api_sender.create_api(); let wr_document_layer = 0; //TODO - let webrender_document = webrender_api.add_document(coordinates.framebuffer, wr_document_layer); + let webrender_document = + webrender_api.add_document(coordinates.framebuffer, wr_document_layer); // Important that this call is done in a single-threaded fashion, we // can't defer it after `create_constellation` has started. @@ -205,19 +211,21 @@ impl<Window> Servo<Window> where Window: WindowMethods + 'static { // Create the constellation, which maintains the engine // pipelines, including the script and layout threads, as well // as the navigation context. - let (constellation_chan, sw_senders) = create_constellation(opts.user_agent.clone(), - opts.config_dir.clone(), - embedder_proxy.clone(), - compositor_proxy.clone(), - time_profiler_chan.clone(), - mem_profiler_chan.clone(), - debugger_chan, - devtools_chan, - supports_clipboard, - &mut webrender, - webrender_document, - webrender_api_sender, - window.gl()); + let (constellation_chan, sw_senders) = create_constellation( + opts.user_agent.clone(), + opts.config_dir.clone(), + embedder_proxy.clone(), + compositor_proxy.clone(), + time_profiler_chan.clone(), + mem_profiler_chan.clone(), + debugger_chan, + devtools_chan, + supports_clipboard, + &mut webrender, + webrender_document, + webrender_api_sender, + window.gl(), + ); // Send the constellation's swmanager sender to service worker manager thread script::init_service_workers(sw_senders); @@ -230,16 +238,19 @@ impl<Window> Servo<Window> where Window: WindowMethods + 'static { // The compositor coordinates with the client window to create the final // rendered page and display it somewhere. - let compositor = IOCompositor::create(window, InitialCompositorState { - sender: compositor_proxy, - receiver: compositor_receiver, - constellation_chan: constellation_chan.clone(), - time_profiler_chan: time_profiler_chan, - mem_profiler_chan: mem_profiler_chan, - webrender, - webrender_document, - webrender_api, - }); + let compositor = IOCompositor::create( + window, + InitialCompositorState { + sender: compositor_proxy, + receiver: compositor_receiver, + constellation_chan: constellation_chan.clone(), + time_profiler_chan: time_profiler_chan, + mem_profiler_chan: mem_profiler_chan, + webrender, + webrender_document, + webrender_api, + }, + ); Servo { compositor: compositor, @@ -251,127 +262,147 @@ impl<Window> Servo<Window> where Window: WindowMethods + 'static { fn handle_window_event(&mut self, event: WindowEvent) { match event { - WindowEvent::Idle => { - } + WindowEvent::Idle => {}, WindowEvent::Refresh => { self.compositor.composite(); - } + }, WindowEvent::Resize => { self.compositor.on_resize_window_event(); - } + }, WindowEvent::LoadUrl(top_level_browsing_context_id, url) => { let msg = ConstellationMsg::LoadUrl(top_level_browsing_context_id, url); if let Err(e) = self.constellation_chan.send(msg) { warn!("Sending load url to constellation failed ({}).", e); } - } + }, WindowEvent::MouseWindowEventClass(mouse_window_event) => { - self.compositor.on_mouse_window_event_class(mouse_window_event); - } + self.compositor + .on_mouse_window_event_class(mouse_window_event); + }, WindowEvent::MouseWindowMoveEventClass(cursor) => { self.compositor.on_mouse_window_move_event_class(cursor); - } + }, WindowEvent::Touch(event_type, identifier, location) => { - self.compositor.on_touch_event(event_type, identifier, location); - } + self.compositor + .on_touch_event(event_type, identifier, location); + }, WindowEvent::Scroll(delta, cursor, phase) => { self.compositor.on_scroll_event(delta, cursor, phase); - } + }, WindowEvent::Zoom(magnification) => { self.compositor.on_zoom_window_event(magnification); - } + }, WindowEvent::ResetZoom => { self.compositor.on_zoom_reset_window_event(); - } + }, WindowEvent::PinchZoom(magnification) => { self.compositor.on_pinch_zoom_window_event(magnification); - } + }, WindowEvent::Navigation(top_level_browsing_context_id, direction) => { - let msg = ConstellationMsg::TraverseHistory(top_level_browsing_context_id, direction); + let msg = + ConstellationMsg::TraverseHistory(top_level_browsing_context_id, direction); if let Err(e) = self.constellation_chan.send(msg) { warn!("Sending navigation to constellation failed ({}).", e); } - } + }, WindowEvent::KeyEvent(ch, key, state, modifiers) => { let msg = ConstellationMsg::KeyEvent(ch, key, state, modifiers); if let Err(e) = self.constellation_chan.send(msg) { warn!("Sending key event to constellation failed ({}).", e); } - } + }, WindowEvent::Quit => { self.compositor.maybe_start_shutting_down(); - } + }, WindowEvent::Reload(top_level_browsing_context_id) => { let msg = ConstellationMsg::Reload(top_level_browsing_context_id); if let Err(e) = self.constellation_chan.send(msg) { warn!("Sending reload to constellation failed ({}).", e); } - } + }, WindowEvent::ToggleWebRenderDebug(option) => { self.compositor.toggle_webrender_debug(option); - } + }, WindowEvent::CaptureWebRender => { self.compositor.capture_webrender(); - } + }, WindowEvent::NewBrowser(url, browser_id) => { let msg = ConstellationMsg::NewBrowser(url, browser_id); if let Err(e) = self.constellation_chan.send(msg) { - warn!("Sending NewBrowser message to constellation failed ({}).", e); + warn!( + "Sending NewBrowser message to constellation failed ({}).", + e + ); } - } + }, WindowEvent::SelectBrowser(ctx) => { let msg = ConstellationMsg::SelectBrowser(ctx); if let Err(e) = self.constellation_chan.send(msg) { - warn!("Sending SelectBrowser message to constellation failed ({}).", e); + warn!( + "Sending SelectBrowser message to constellation failed ({}).", + e + ); } - } + }, WindowEvent::CloseBrowser(ctx) => { let msg = ConstellationMsg::CloseBrowser(ctx); if let Err(e) = self.constellation_chan.send(msg) { - warn!("Sending CloseBrowser message to constellation failed ({}).", e); + warn!( + "Sending CloseBrowser message to constellation failed ({}).", + e + ); } - } + }, WindowEvent::SendError(ctx, e) => { let msg = ConstellationMsg::SendError(ctx, e); if let Err(e) = self.constellation_chan.send(msg) { warn!("Sending SendError message to constellation failed ({}).", e); } - } + }, } } fn receive_messages(&mut self) { - while let Some((top_level_browsing_context, msg)) = self.embedder_receiver.try_recv_embedder_msg() { + while let Some((top_level_browsing_context, msg)) = + self.embedder_receiver.try_recv_embedder_msg() + { match (msg, self.compositor.shutdown_state) { (_, ShutdownState::FinishedShuttingDown) => { - error!("embedder shouldn't be handling messages after compositor has shut down"); + error!( + "embedder shouldn't be handling messages after compositor has shut down" + ); }, (_, ShutdownState::ShuttingDown) => {}, - (EmbedderMsg::KeyEvent(ch, key, state, modified), - ShutdownState::NotShuttingDown) => { - let event = (top_level_browsing_context, EmbedderMsg::KeyEvent(ch, key, state, modified)); + ( + EmbedderMsg::KeyEvent(ch, key, state, modified), + ShutdownState::NotShuttingDown, + ) => { + let event = ( + top_level_browsing_context, + EmbedderMsg::KeyEvent(ch, key, state, modified), + ); self.embedder_events.push(event); }, @@ -426,55 +457,62 @@ impl<Window> Servo<Window> where Window: WindowMethods + 'static { } } -fn create_embedder_channel(event_loop_waker: Box<EventLoopWaker>) - -> (EmbedderProxy, EmbedderReceiver) { +fn create_embedder_channel( + event_loop_waker: Box<EventLoopWaker>, +) -> (EmbedderProxy, EmbedderReceiver) { let (sender, receiver) = channel(); - (EmbedderProxy { - sender: sender, - event_loop_waker: event_loop_waker, - }, - EmbedderReceiver { - receiver: receiver - }) + ( + EmbedderProxy { + sender: sender, + event_loop_waker: event_loop_waker, + }, + EmbedderReceiver { receiver: receiver }, + ) } -fn create_compositor_channel(event_loop_waker: Box<EventLoopWaker>) - -> (CompositorProxy, CompositorReceiver) { +fn create_compositor_channel( + event_loop_waker: Box<EventLoopWaker>, +) -> (CompositorProxy, CompositorReceiver) { let (sender, receiver) = channel(); - (CompositorProxy { - sender: sender, - event_loop_waker: event_loop_waker, - }, - CompositorReceiver { - receiver: receiver - }) + ( + CompositorProxy { + sender: sender, + event_loop_waker: event_loop_waker, + }, + CompositorReceiver { receiver: receiver }, + ) } -fn create_constellation(user_agent: Cow<'static, str>, - config_dir: Option<PathBuf>, - embedder_proxy: EmbedderProxy, - compositor_proxy: CompositorProxy, - time_profiler_chan: time::ProfilerChan, - mem_profiler_chan: mem::ProfilerChan, - debugger_chan: Option<debugger::Sender>, - devtools_chan: Option<Sender<devtools_traits::DevtoolsControlMsg>>, - supports_clipboard: bool, - webrender: &mut webrender::Renderer, - webrender_document: webrender_api::DocumentId, - webrender_api_sender: webrender_api::RenderApiSender, - window_gl: Rc<gl::Gl>) - -> (Sender<ConstellationMsg>, SWManagerSenders) { - let bluetooth_thread: IpcSender<BluetoothRequest> = BluetoothThreadFactory::new(embedder_proxy.clone()); - - let (public_resource_threads, private_resource_threads) = - new_resource_threads(user_agent, - devtools_chan.clone(), - time_profiler_chan.clone(), - mem_profiler_chan.clone(), - embedder_proxy.clone(), - config_dir); - let font_cache_thread = FontCacheThread::new(public_resource_threads.sender(), - webrender_api_sender.create_api()); +fn create_constellation( + user_agent: Cow<'static, str>, + config_dir: Option<PathBuf>, + embedder_proxy: EmbedderProxy, + compositor_proxy: CompositorProxy, + time_profiler_chan: time::ProfilerChan, + mem_profiler_chan: mem::ProfilerChan, + debugger_chan: Option<debugger::Sender>, + devtools_chan: Option<Sender<devtools_traits::DevtoolsControlMsg>>, + supports_clipboard: bool, + webrender: &mut webrender::Renderer, + webrender_document: webrender_api::DocumentId, + webrender_api_sender: webrender_api::RenderApiSender, + window_gl: Rc<gl::Gl>, +) -> (Sender<ConstellationMsg>, SWManagerSenders) { + let bluetooth_thread: IpcSender<BluetoothRequest> = + BluetoothThreadFactory::new(embedder_proxy.clone()); + + let (public_resource_threads, private_resource_threads) = new_resource_threads( + user_agent, + devtools_chan.clone(), + time_profiler_chan.clone(), + mem_profiler_chan.clone(), + embedder_proxy.clone(), + config_dir, + ); + let font_cache_thread = FontCacheThread::new( + public_resource_threads.sender(), + webrender_api_sender.create_api(), + ); let resource_sender = public_resource_threads.sender(); @@ -483,7 +521,11 @@ fn create_constellation(user_agent: Cow<'static, str>, let (mut handler, sender) = WebVRCompositorHandler::new(); let (webvr_thread, constellation_sender) = WebVRThread::spawn(sender); handler.set_webvr_thread_sender(webvr_thread.clone()); - (Some(webvr_thread), Some(constellation_sender), Some(handler)) + ( + Some(webvr_thread), + Some(constellation_sender), + Some(handler), + ) } else { (None, None, None) }; @@ -497,13 +539,12 @@ fn create_constellation(user_agent: Cow<'static, str>, // Initialize WebGL Thread entry point. let webgl_threads = gl_factory.map(|factory| { - let (webgl_threads, image_handler, output_handler) = - WebGLThreads::new( - factory, - window_gl, - webrender_api_sender.clone(), - webvr_compositor.map(|c| c as Box<_>), - ); + let (webgl_threads, image_handler, output_handler) = WebGLThreads::new( + factory, + window_gl, + webrender_api_sender.clone(), + webvr_compositor.map(|c| c as Box<_>), + ); // Set webrender external image handler for WebGL textures webrender.set_external_image_handler(image_handler); @@ -533,20 +574,23 @@ fn create_constellation(user_agent: Cow<'static, str>, webgl_threads, webvr_chan, }; - let (constellation_chan, from_swmanager_sender) = - Constellation::<script_layout_interface::message::Msg, - layout_thread::LayoutThread, - script::script_thread::ScriptThread>::start(initial_state); + let (constellation_chan, from_swmanager_sender) = Constellation::< + script_layout_interface::message::Msg, + layout_thread::LayoutThread, + script::script_thread::ScriptThread, + >::start(initial_state); if let Some(webvr_constellation_sender) = webvr_constellation_sender { // Set constellation channel used by WebVR thread to broadcast events - webvr_constellation_sender.send(constellation_chan.clone()).unwrap(); + webvr_constellation_sender + .send(constellation_chan.clone()) + .unwrap(); } // channels to communicate with Service Worker Manager let sw_senders = SWManagerSenders { swmanager_sender: from_swmanager_sender, - resource_sender: resource_sender + resource_sender: resource_sender, }; (constellation_chan, sw_senders) @@ -556,7 +600,11 @@ fn create_constellation(user_agent: Cow<'static, str>, // This should probably be in the log crate. struct BothLogger<Log1, Log2>(Log1, Log2); -impl<Log1, Log2> Log for BothLogger<Log1, Log2> where Log1: Log, Log2: Log { +impl<Log1, Log2> Log for BothLogger<Log1, Log2> +where + Log1: Log, + Log2: Log, +{ fn enabled(&self, metadata: &Metadata) -> bool { self.0.enabled(metadata) || self.1.enabled(metadata) } @@ -590,7 +638,9 @@ pub fn run_content_process(token: String) { ipc::channel::<UnprivilegedPipelineContent>().unwrap(); let connection_bootstrap: IpcSender<IpcSender<UnprivilegedPipelineContent>> = IpcSender::connect(token).unwrap(); - connection_bootstrap.send(unprivileged_content_sender).unwrap(); + connection_bootstrap + .send(unprivileged_content_sender) + .unwrap(); let unprivileged_content = unprivileged_content_receiver.recv().unwrap(); opts::set_defaults(unprivileged_content.opts()); @@ -599,7 +649,7 @@ pub fn run_content_process(token: String) { // Enter the sandbox if necessary. if opts::get().sandbox { - create_sandbox(); + create_sandbox(); } // send the required channels to the service worker manager @@ -614,7 +664,8 @@ pub fn run_content_process(token: String) { #[cfg(all(not(target_os = "windows"), not(target_os = "ios")))] fn create_sandbox() { - ChildSandbox::new(content_process_sandbox_profile()).activate() + ChildSandbox::new(content_process_sandbox_profile()) + .activate() .expect("Failed to activate sandbox!"); } diff --git a/components/style/animation.rs b/components/style/animation.rs index 2d421ce06a9..3e501781987 100644 --- a/components/style/animation.rs +++ b/components/style/animation.rs @@ -213,7 +213,12 @@ pub enum Animation { /// node-dependent state (i.e. iteration count, etc.). /// /// TODO(emilio): The animation object could be refcounted. - Keyframes(OpaqueNode, KeyframesAnimation, Atom, KeyframesAnimationState), + Keyframes( + OpaqueNode, + KeyframesAnimation, + Atom, + KeyframesAnimationState, + ), } impl Animation { @@ -304,8 +309,7 @@ impl PropertyAnimation { let duration = box_style.transition_duration_mod(transition_index); match transition_property { - TransitionProperty::Custom(..) | - TransitionProperty::Unsupported(..) => result, + TransitionProperty::Custom(..) | TransitionProperty::Unsupported(..) => result, TransitionProperty::Shorthand(ref shorthand_id) => shorthand_id .longhands() .filter_map(|longhand| { @@ -316,8 +320,7 @@ impl PropertyAnimation { old_style, new_style, ) - }) - .collect(), + }).collect(), TransitionProperty::Longhand(longhand_id) => { let animation = PropertyAnimation::from_longhand( longhand_id, @@ -455,8 +458,7 @@ pub fn start_transitions_if_applicable( property_animation: property_animation, }, /* is_expired = */ false, - )) - .unwrap(); + )).unwrap(); had_animations = true; } @@ -505,7 +507,9 @@ where Some(previous_style), Some(previous_style), font_metrics_provider, - CascadeMode::Unvisited { visited_rules: None }, + CascadeMode::Unvisited { + visited_rules: None, + }, context.quirks_mode(), /* rule_cache = */ None, &mut Default::default(), @@ -596,8 +600,7 @@ where expired: false, cascade_style: new_style.clone(), }, - )) - .unwrap(); + )).unwrap(); had_animations = true; } } @@ -735,8 +738,7 @@ pub fn update_style_for_animation<E>( } else { None } - }) - .unwrap_or(animation.steps.len() - 1); + }).unwrap_or(animation.steps.len() - 1); }, _ => unreachable!(), } diff --git a/components/style/applicable_declarations.rs b/components/style/applicable_declarations.rs index a1476917fcb..986dc04c371 100644 --- a/components/style/applicable_declarations.rs +++ b/components/style/applicable_declarations.rs @@ -38,7 +38,8 @@ const SOURCE_ORDER_MASK: u32 = SOURCE_ORDER_MAX << SOURCE_ORDER_SHIFT; const SHADOW_CASCADE_ORDER_SHIFT: usize = SOURCE_ORDER_BITS; const SHADOW_CASCADE_ORDER_BITS: usize = 4; const SHADOW_CASCADE_ORDER_MAX: u8 = (1 << SHADOW_CASCADE_ORDER_BITS) - 1; -const SHADOW_CASCADE_ORDER_MASK: u32 = (SHADOW_CASCADE_ORDER_MAX as u32) << SHADOW_CASCADE_ORDER_SHIFT; +const SHADOW_CASCADE_ORDER_MASK: u32 = + (SHADOW_CASCADE_ORDER_MAX as u32) << SHADOW_CASCADE_ORDER_SHIFT; const CASCADE_LEVEL_SHIFT: usize = SOURCE_ORDER_BITS + SHADOW_CASCADE_ORDER_BITS; const CASCADE_LEVEL_BITS: usize = 4; @@ -61,7 +62,8 @@ impl ApplicableDeclarationBits { "Gotta find more bits!" ); let mut bits = ::std::cmp::min(source_order, SOURCE_ORDER_MAX); - bits |= ((shadow_cascade_order & SHADOW_CASCADE_ORDER_MAX) as u32) << SHADOW_CASCADE_ORDER_SHIFT; + bits |= ((shadow_cascade_order & SHADOW_CASCADE_ORDER_MAX) as u32) << + SHADOW_CASCADE_ORDER_SHIFT; bits |= (cascade_level as u8 as u32) << CASCADE_LEVEL_SHIFT; ApplicableDeclarationBits(bits) } diff --git a/components/style/attr.rs b/components/style/attr.rs index 5f335472f32..a3b119c3a97 100644 --- a/components/style/attr.rs +++ b/components/style/attr.rs @@ -158,15 +158,15 @@ pub fn parse_double(string: &str) -> Result<f64, ()> { impl AttrValue { pub fn from_serialized_tokenlist(tokens: String) -> AttrValue { - let atoms = split_html_space_chars(&tokens).map(Atom::from).fold( - vec![], - |mut acc, atom| { - if !acc.contains(&atom) { - acc.push(atom) - } - acc - }, - ); + let atoms = + split_html_space_chars(&tokens) + .map(Atom::from) + .fold(vec![], |mut acc, atom| { + if !acc.contains(&atom) { + acc.push(atom) + } + acc + }); AttrValue::TokenList(tokens, atoms) } diff --git a/components/style/author_styles.rs b/components/style/author_styles.rs index e8ec621bd92..837569078c0 100644 --- a/components/style/author_styles.rs +++ b/components/style/author_styles.rs @@ -60,7 +60,8 @@ where E: TElement, S: ToMediaListKey, { - let flusher = self.stylesheets + let flusher = self + .stylesheets .flush::<E>(/* host = */ None, /* snapshot_map = */ None); if flusher.sheets.dirty() { @@ -68,7 +69,8 @@ where } // Ignore OOM. - let _ = self.data + let _ = self + .data .rebuild(device, quirks_mode, flusher.sheets, guard); } } diff --git a/components/style/build_gecko.rs b/components/style/build_gecko.rs index c0655628538..1ecc7ec6fc3 100644 --- a/components/style/build_gecko.rs +++ b/components/style/build_gecko.rs @@ -322,13 +322,11 @@ mod bindings { .expect(&format!( "Unrecognized line in ServoArcTypeList.h: '{}'", line - )) - .get(1) + )).get(1) .unwrap() .as_str() .to_string() - }) - .collect() + }).collect() } struct BuilderWithConfig<'a> { @@ -436,8 +434,7 @@ mod bindings { servo, if generic { "<T>" } else { "" } )) - }) - .get_builder(); + }).get_builder(); write_binding_file(builder, STRUCTS_FILE, &fixups); } @@ -553,8 +550,7 @@ mod bindings { .raw_line(format!( "pub type {0}Strong = ::gecko_bindings::sugar::ownership::Strong<{0}>;", ty - )) - .borrowed_type(ty) + )).borrowed_type(ty) .zero_size_type(ty, &structs_types); } write_binding_file(builder, BINDINGS_FILE, &fixups); diff --git a/components/style/counter_style/mod.rs b/components/style/counter_style/mod.rs index 2542dee3625..653d199545c 100644 --- a/components/style/counter_style/mod.rs +++ b/components/style/counter_style/mod.rs @@ -91,8 +91,7 @@ pub fn parse_counter_style_body<'i, 't>( if let Err((error, slice)) = declaration { let location = error.location; let error = ContextualParseError::UnsupportedCounterStyleDescriptorDeclaration( - slice, - error, + slice, error, ); context.log_css_error(location, error) } @@ -103,7 +102,8 @@ pub fn parse_counter_style_body<'i, 't>( ref system @ System::Fixed { .. } | ref system @ System::Symbolic | ref system @ System::Alphabetic | - ref system @ System::Numeric if rule.symbols.is_none() => + ref system @ System::Numeric + if rule.symbols.is_none() => { let system = system.to_css_string(); Some(ContextualParseError::InvalidCounterStyleWithoutSymbols( @@ -496,12 +496,13 @@ impl Parse for Ranges { (opt_start, opt_end) { if start > end { - return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)); + return Err( + input.new_custom_error(StyleParseErrorKind::UnspecifiedError) + ); } } Ok(opt_start..opt_end) - }) - .map(Ranges) + }).map(Ranges) } } } diff --git a/components/style/custom_properties.rs b/components/style/custom_properties.rs index d79a27c5c4d..985179db025 100644 --- a/components/style/custom_properties.rs +++ b/components/style/custom_properties.rs @@ -243,7 +243,8 @@ impl VariableValue { self.first_token_type.set_if_nothing(css_first_token_type); // If self.first_token_type was nothing, // self.last_token_type is also nothing and this will be false: - if self.last_token_type + if self + .last_token_type .needs_separator_when_before(css_first_token_type) { self.css.push_str("/**/") @@ -569,7 +570,8 @@ impl<'a> CustomPropertiesBuilder<'a> { _ => {}, } - let existing_value = self.custom_properties + let existing_value = self + .custom_properties .as_ref() .and_then(|m| m.get(name)) .or_else(|| self.inherited.and_then(|m| m.get(name))); diff --git a/components/style/data.rs b/components/style/data.rs index 71a0ac23320..4a9b0c53940 100644 --- a/components/style/data.rs +++ b/components/style/data.rs @@ -272,12 +272,8 @@ impl ElementData { return InvalidationResult::empty(); } - let mut processor = StateAndAttrInvalidationProcessor::new( - shared_context, - element, - self, - nth_index_cache, - ); + let mut processor = + StateAndAttrInvalidationProcessor::new(shared_context, element, self, nth_index_cache); let invalidator = TreeStyleInvalidator::new(element, stack_limit_checker, &mut processor); @@ -305,7 +301,8 @@ impl ElementData { /// Returns this element's primary style as a resolved style to use for sharing. pub fn share_primary_style(&self) -> PrimaryStyle { - let reused_via_rule_node = self.flags + let reused_via_rule_node = self + .flags .contains(ElementDataFlags::PRIMARY_STYLE_REUSED_VIA_RULE_NODE); PrimaryStyle { @@ -390,7 +387,8 @@ impl ElementData { guards: &StylesheetGuards, ) -> bool { debug_assert!(self.has_styles()); - let (important_rules, _custom) = self.styles + let (important_rules, _custom) = self + .styles .primary() .rules() .get_properties_overriding_animations(&guards); diff --git a/components/style/dom.rs b/components/style/dom.rs index 2f65a266f01..872a55a54b2 100644 --- a/components/style/dom.rs +++ b/components/style/dom.rs @@ -42,7 +42,10 @@ use traversal_flags::TraversalFlags; /// data structures. Also, layout code tends to be faster when the DOM is not being accessed, for /// locality reasons. Using `OpaqueNode` enforces this invariant. #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] -#[cfg_attr(feature = "servo", derive(MallocSizeOf, Deserialize, Serialize))] +#[cfg_attr( + feature = "servo", + derive(MallocSizeOf, Deserialize, Serialize) +)] pub struct OpaqueNode(pub usize); impl OpaqueNode { @@ -459,7 +462,9 @@ pub trait TElement: fn is_svg_element(&self) -> bool; /// Return whether this element is an element in the XUL namespace. - fn is_xul_element(&self) -> bool { false } + fn is_xul_element(&self) -> bool { + false + } /// Return the list of slotted nodes of this node. fn slotted_nodes(&self) -> &[Self::ConcreteNode] { @@ -892,11 +897,7 @@ pub trait TElement: /// of the `xml:lang=""` or `lang=""` attribute to use in place of /// looking at the element and its ancestors. (This argument is used /// to implement matching of `:lang()` against snapshots.) - fn match_element_lang( - &self, - override_lang: Option<Option<AttrValue>>, - value: &Lang, - ) -> bool; + fn match_element_lang(&self, override_lang: Option<Option<AttrValue>>, value: &Lang) -> bool; /// Returns whether this element is the main body element of the HTML /// document it is on. diff --git a/components/style/dom_apis.rs b/components/style/dom_apis.rs index 393fb6e119e..9d7ab917a91 100644 --- a/components/style/dom_apis.rs +++ b/components/style/dom_apis.rs @@ -426,8 +426,7 @@ where return Ok(()); } - let elements = - fast_connected_elements_with_id(root, id, quirks_mode)?; + let elements = fast_connected_elements_with_id(root, id, quirks_mode)?; if elements.is_empty() { return Ok(()); } diff --git a/components/style/font_face.rs b/components/style/font_face.rs index d7501c1cca7..fde25f08f6f 100644 --- a/components/style/font_face.rs +++ b/components/style/font_face.rs @@ -104,8 +104,9 @@ impl Parse for FontWeight { input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i>> { let first = AbsoluteFontWeight::parse(context, input)?; - let second = - input.try(|input| AbsoluteFontWeight::parse(context, input)).ok(); + let second = input + .try(|input| AbsoluteFontWeight::parse(context, input)) + .ok(); Ok(FontWeight(first, second)) } } @@ -122,8 +123,9 @@ impl Parse for FontStretch { input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i>> { let first = SpecifiedFontStretch::parse(context, input)?; - let second = - input.try(|input| SpecifiedFontStretch::parse(context, input)).ok(); + let second = input + .try(|input| SpecifiedFontStretch::parse(context, input)) + .ok(); Ok(FontStretch(first, second)) } } @@ -149,12 +151,12 @@ impl Parse for FontStyle { GenericFontStyle::Normal => FontStyle::Normal, GenericFontStyle::Italic => FontStyle::Italic, GenericFontStyle::Oblique(angle) => { - let second_angle = input.try(|input| { - SpecifiedFontStyle::parse_angle(context, input) - }).unwrap_or_else(|_| angle.clone()); + let second_angle = input + .try(|input| SpecifiedFontStyle::parse_angle(context, input)) + .unwrap_or_else(|_| angle.clone()); FontStyle::Oblique(angle, second_angle) - } + }, }) } } @@ -178,7 +180,7 @@ impl ToCss for FontStyle { second.to_css(dest)?; } Ok(()) - } + }, } } } @@ -235,15 +237,13 @@ impl<'a> FontFace<'a> { // We support only opentype fonts and truetype is an alias for // that format. Sources without format hints need to be // downloaded in case we support them. - hints.is_empty() || - hints.iter().any(|hint| { - hint == "truetype" || hint == "opentype" || hint == "woff" - }) + hints.is_empty() || hints + .iter() + .any(|hint| hint == "truetype" || hint == "opentype" || hint == "woff") } else { true } - }) - .cloned() + }).cloned() .collect(), ) } diff --git a/components/style/gecko/conversions.rs b/components/style/gecko/conversions.rs index 3c1d334f4a8..c6009c96dee 100644 --- a/components/style/gecko/conversions.rs +++ b/components/style/gecko/conversions.rs @@ -140,10 +140,7 @@ impl Angle { } } -fn line_direction( - horizontal: LengthOrPercentage, - vertical: LengthOrPercentage, -) -> LineDirection { +fn line_direction(horizontal: LengthOrPercentage, vertical: LengthOrPercentage) -> LineDirection { use values::computed::position::Position; use values::specified::position::{X, Y}; @@ -178,18 +175,18 @@ fn line_direction( }); if let (Some(hc), Some(vc)) = (horizontal_as_corner, vertical_as_corner) { - return LineDirection::Corner(hc, vc) + return LineDirection::Corner(hc, vc); } if let Some(hc) = horizontal_as_corner { if vertical_percentage == Some(0.5) { - return LineDirection::Horizontal(hc) + return LineDirection::Horizontal(hc); } } if let Some(vc) = vertical_as_corner { if horizontal_percentage == Some(0.5) { - return LineDirection::Vertical(vc) + return LineDirection::Vertical(vc); } } @@ -212,7 +209,10 @@ impl nsStyleImage { }, GenericImage::Rect(ref image_rect) => { unsafe { - bindings::Gecko_SetLayerImageImageValue(self, image_rect.url.0.image_value.get()); + bindings::Gecko_SetLayerImageImageValue( + self, + image_rect.url.0.image_value.get(), + ); bindings::Gecko_InitializeImageCropRect(self); // Set CropRect @@ -491,7 +491,8 @@ impl nsStyleImage { unsafe fn get_image_url(&self) -> ComputedImageUrl { let image_request = bindings::Gecko_GetImageRequest(self) - .as_ref().expect("Null image request?"); + .as_ref() + .expect("Null image request?"); ComputedImageUrl::from_image_request(image_request) } @@ -555,9 +556,9 @@ impl nsStyleImage { structs::NS_STYLE_GRADIENT_SHAPE_CIRCULAR => { let circle = match gecko_gradient.mSize as u32 { structs::NS_STYLE_GRADIENT_SIZE_EXPLICIT_SIZE => { - let radius = Length::from_gecko_style_coord( - &gecko_gradient.mRadiusX, - ).expect("mRadiusX could not convert to Length"); + let radius = + Length::from_gecko_style_coord(&gecko_gradient.mRadiusX) + .expect("mRadiusX could not convert to Length"); debug_assert_eq!( radius, Length::from_gecko_style_coord(&gecko_gradient.mRadiusY) @@ -632,8 +633,7 @@ impl nsStyleImage { position: LengthOrPercentage::from_gecko_style_coord(&stop.mLocation), }) } - }) - .collect(); + }).collect(); let compat_mode = if gecko_gradient.mMozLegacySyntax { CompatMode::Moz @@ -719,8 +719,10 @@ pub mod basic_shape { match self.mType { StyleShapeSourceType::Path => { let gecko_path = unsafe { &*self.__bindgen_anon_1.mSVGPath.as_ref().mPtr }; - let result: Vec<PathCommand> = - gecko_path.mPath.iter().map(|gecko: &StylePathCommand| { + let result: Vec<PathCommand> = gecko_path + .mPath + .iter() + .map(|gecko: &StylePathCommand| { // unsafe: cbindgen ensures the representation is the same. unsafe { ::std::mem::transmute(*gecko) } }).collect(); @@ -822,11 +824,15 @@ pub mod basic_shape { let y = x + 1; coords.push(PolygonCoord( LengthOrPercentage::from_gecko_style_coord(&other.mCoordinates[x]) - .expect("polygon() coordinate should be a length, percentage, \ - or calc value"), + .expect( + "polygon() coordinate should be a length, percentage, \ + or calc value", + ), LengthOrPercentage::from_gecko_style_coord(&other.mCoordinates[y]) - .expect("polygon() coordinate should be a length, percentage, \ - or calc value") + .expect( + "polygon() coordinate should be a length, percentage, \ + or calc value", + ), )) } GenericBasicShape::Polygon(Polygon { diff --git a/components/style/gecko/data.rs b/components/style/gecko/data.rs index 0bd938c67e8..d737167c28a 100644 --- a/components/style/gecko/data.rs +++ b/components/style/gecko/data.rs @@ -29,7 +29,8 @@ pub struct GeckoStyleSheet(*const DomStyleSheet); impl fmt::Debug for GeckoStyleSheet { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { let contents = self.contents(); - formatter.debug_struct("GeckoStyleSheet") + formatter + .debug_struct("GeckoStyleSheet") .field("origin", &contents.origin) .field("url_data", &*contents.url_data.read()) .finish() @@ -66,9 +67,7 @@ impl GeckoStyleSheet { } fn inner(&self) -> &StyleSheetInfo { - unsafe { - &*(self.raw().mInner as *const StyleSheetInfo) - } + unsafe { &*(self.raw().mInner as *const StyleSheetInfo) } } /// Gets the StylesheetContents for this stylesheet. @@ -193,7 +192,8 @@ impl PerDocumentStyleDataImpl { /// Returns whether visited styles are enabled. #[inline] pub fn visited_styles_enabled(&self) -> bool { - let doc = self.stylist + let doc = self + .stylist .device() .pres_context() .mDocument diff --git a/components/style/gecko/media_features.rs b/components/style/gecko/media_features.rs index 386d0ad5b43..85f0ba27d43 100644 --- a/components/style/gecko/media_features.rs +++ b/components/style/gecko/media_features.rs @@ -21,7 +21,7 @@ fn viewport_size(device: &Device) -> Size2D<Au> { // We want the page size, including unprintable areas and margins. // FIXME(emilio, bug 1414600): Not quite! let area = &pc.mPageSize; - return Size2D::new(Au(area.width), Au(area.height)) + return Size2D::new(Au(area.width), Au(area.height)); } device.au_viewport_size() } @@ -30,11 +30,7 @@ fn device_size(device: &Device) -> Size2D<Au> { let mut width = 0; let mut height = 0; unsafe { - bindings::Gecko_MediaFeatures_GetDeviceSize( - device.document(), - &mut width, - &mut height, - ); + bindings::Gecko_MediaFeatures_GetDeviceSize(device.document(), &mut width, &mut height); } Size2D::new(Au(width), Au(height)) } @@ -152,11 +148,7 @@ enum Orientation { Portrait, } -fn eval_orientation_for<F>( - device: &Device, - value: Option<Orientation>, - get_size: F, -) -> bool +fn eval_orientation_for<F>(device: &Device, value: Option<Orientation>, get_size: F) -> bool where F: FnOnce(&Device) -> Size2D<Au>, { @@ -176,18 +168,12 @@ where } /// https://drafts.csswg.org/mediaqueries-4/#orientation -fn eval_orientation( - device: &Device, - value: Option<Orientation>, -) -> bool { +fn eval_orientation(device: &Device, value: Option<Orientation>) -> bool { eval_orientation_for(device, value, viewport_size) } /// FIXME: There's no spec for `-moz-device-orientation`. -fn eval_device_orientation( - device: &Device, - value: Option<Orientation>, -) -> bool { +fn eval_device_orientation(device: &Device, value: Option<Orientation>) -> bool { eval_orientation_for(device, value, device_size) } @@ -196,25 +182,21 @@ fn eval_device_orientation( #[repr(u8)] #[allow(missing_docs)] pub enum DisplayMode { - Browser = 0, - MinimalUi, - Standalone, - Fullscreen, + Browser = 0, + MinimalUi, + Standalone, + Fullscreen, } /// https://w3c.github.io/manifest/#the-display-mode-media-feature -fn eval_display_mode( - device: &Device, - query_value: Option<DisplayMode>, -) -> bool { +fn eval_display_mode(device: &Device, query_value: Option<DisplayMode>) -> bool { let query_value = match query_value { Some(v) => v, None => return true, }; - let gecko_display_mode = unsafe { - bindings::Gecko_MediaFeatures_GetDisplayMode(device.document()) - }; + let gecko_display_mode = + unsafe { bindings::Gecko_MediaFeatures_GetDisplayMode(device.document()) }; // NOTE: cbindgen guarantees the same representation. gecko_display_mode as u8 == query_value as u8 @@ -229,11 +211,7 @@ fn eval_grid(_: &Device, query_value: Option<bool>, _: Option<RangeOrOperator>) } /// https://compat.spec.whatwg.org/#css-media-queries-webkit-transform-3d -fn eval_transform_3d( - _: &Device, - query_value: Option<bool>, - _: Option<RangeOrOperator>, -) -> bool { +fn eval_transform_3d(_: &Device, query_value: Option<bool>, _: Option<RangeOrOperator>) -> bool { let supports_transforms = true; query_value.map_or(supports_transforms, |v| v == supports_transforms) } @@ -260,11 +238,7 @@ fn eval_color( ) -> bool { let color_bits_per_channel = unsafe { bindings::Gecko_MediaFeatures_GetColorDepth(device.document()) }; - RangeOrOperator::evaluate( - range_or_operator, - query_value, - color_bits_per_channel, - ) + RangeOrOperator::evaluate(range_or_operator, query_value, color_bits_per_channel) } /// https://drafts.csswg.org/mediaqueries-4/#color-index @@ -275,11 +249,7 @@ fn eval_color_index( ) -> bool { // We should return zero if the device does not use a color lookup table. let index = 0; - RangeOrOperator::evaluate( - range_or_operator, - query_value, - index, - ) + RangeOrOperator::evaluate(range_or_operator, query_value, index) } /// https://drafts.csswg.org/mediaqueries-4/#monochrome @@ -291,11 +261,7 @@ fn eval_monochrome( // For color devices we should return 0. // FIXME: On a monochrome device, return the actual color depth, not 0! let depth = 0; - RangeOrOperator::evaluate( - range_or_operator, - query_value, - depth, - ) + RangeOrOperator::evaluate(range_or_operator, query_value, depth) } /// https://drafts.csswg.org/mediaqueries-4/#resolution @@ -304,8 +270,7 @@ fn eval_resolution( query_value: Option<Resolution>, range_or_operator: Option<RangeOrOperator>, ) -> bool { - let resolution_dppx = - unsafe { bindings::Gecko_MediaFeatures_GetResolution(device.document()) }; + let resolution_dppx = unsafe { bindings::Gecko_MediaFeatures_GetResolution(device.document()) }; RangeOrOperator::evaluate( range_or_operator, query_value.map(|r| r.dppx()), @@ -321,10 +286,7 @@ enum PrefersReducedMotion { } /// https://drafts.csswg.org/mediaqueries-5/#prefers-reduced-motion -fn eval_prefers_reduced_motion( - device: &Device, - query_value: Option<PrefersReducedMotion>, -) -> bool { +fn eval_prefers_reduced_motion(device: &Device, query_value: Option<PrefersReducedMotion>) -> bool { let prefers_reduced = unsafe { bindings::Gecko_MediaFeatures_PrefersReducedMotion(device.document()) }; let query_value = match query_value { @@ -352,9 +314,8 @@ fn eval_moz_is_resource_document( query_value: Option<bool>, _: Option<RangeOrOperator>, ) -> bool { - let is_resource_doc = unsafe { - bindings::Gecko_MediaFeatures_IsResourceDocument(device.document()) - }; + let is_resource_doc = + unsafe { bindings::Gecko_MediaFeatures_IsResourceDocument(device.document()) }; query_value.map_or(is_resource_doc, |v| v == is_resource_doc) } @@ -397,37 +358,30 @@ fn eval_moz_os_version( None => return false, }; - let os_version = unsafe { - bindings::Gecko_MediaFeatures_GetOperatingSystemVersion(device.document()) - }; + let os_version = + unsafe { bindings::Gecko_MediaFeatures_GetOperatingSystemVersion(device.document()) }; query_value.as_ptr() == os_version } macro_rules! system_metric_feature { - ($feature_name:expr) => { - { - fn __eval( - device: &Device, - query_value: Option<bool>, - _: Option<RangeOrOperator>, - ) -> bool { - eval_system_metric( - device, - query_value, - $feature_name, - /* accessible_from_content = */ false, - ) - } - - feature!( + ($feature_name:expr) => {{ + fn __eval(device: &Device, query_value: Option<bool>, _: Option<RangeOrOperator>) -> bool { + eval_system_metric( + device, + query_value, $feature_name, - AllowsRanges::No, - Evaluator::BoolInteger(__eval), - ParsingRequirements::CHROME_AND_UA_ONLY, + /* accessible_from_content = */ false, ) } - } + + feature!( + $feature_name, + AllowsRanges::No, + Evaluator::BoolInteger(__eval), + ParsingRequirements::CHROME_AND_UA_ONLY, + ) + }}; } lazy_static! { diff --git a/components/style/gecko/media_queries.rs b/components/style/gecko/media_queries.rs index c41bc4ffd73..ccf5b7a5180 100644 --- a/components/style/gecko/media_queries.rs +++ b/components/style/gecko/media_queries.rs @@ -126,7 +126,8 @@ impl Device { /// Set the font size of the root element (for rem) pub fn set_root_font_size(&self, size: Au) { - self.root_font_size.store(size.0 as isize, Ordering::Relaxed) + self.root_font_size + .store(size.0 as isize, Ordering::Relaxed) } /// Sets the body text color for the "inherit color from body" quirk. diff --git a/components/style/gecko/pseudo_element.rs b/components/style/gecko/pseudo_element.rs index b30d7764d17..70b0e112cee 100644 --- a/components/style/gecko/pseudo_element.rs +++ b/components/style/gecko/pseudo_element.rs @@ -62,7 +62,9 @@ impl PseudoElement { /// /// This is used in Servo for anonymous boxes, though it's likely broken. #[inline] - pub fn inherits_all(&self) -> bool { false } + pub fn inherits_all(&self) -> bool { + false + } /// Whether the pseudo-element should inherit from the default computed /// values instead of from the parent element. diff --git a/components/style/gecko/rules.rs b/components/style/gecko/rules.rs index a57314a418c..233b1757ef5 100644 --- a/components/style/gecko/rules.rs +++ b/components/style/gecko/rules.rs @@ -88,7 +88,7 @@ macro_rules! descriptor_range_conversion { None => { nscssvalue.set_from(first); return; - } + }, Some(ref second) => second, }; @@ -101,7 +101,7 @@ macro_rules! descriptor_range_conversion { nscssvalue.set_pair(&a, &b); } } - } + }; } descriptor_range_conversion!(FontWeight); @@ -120,7 +120,7 @@ impl<'a> ToNsCssValue for &'a FontStyle { b.set_font_style(SpecifiedFontStyle::compute_angle(second).degrees()); nscssvalue.set_pair(&a, &b); - } + }, } } } diff --git a/components/style/gecko/selector_parser.rs b/components/style/gecko/selector_parser.rs index 3f6fee3c30e..2365356f2f8 100644 --- a/components/style/gecko/selector_parser.rs +++ b/components/style/gecko/selector_parser.rs @@ -181,9 +181,8 @@ impl NonTSPseudoClass { }, // Otherwise, a pseudo-class is enabled in content when it // doesn't have any enabled flag. - _ => !self.has_any_flag( - NonTSPseudoClassFlag::PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, - ), + _ => !self + .has_any_flag(NonTSPseudoClassFlag::PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME), } } @@ -233,8 +232,7 @@ impl NonTSPseudoClass { /// Returns true if the given pseudoclass should trigger style sharing cache /// revalidation. pub fn needs_cache_revalidation(&self) -> bool { - self.state_flag().is_empty() && - !matches!(*self, + self.state_flag().is_empty() && !matches!(*self, // :-moz-any is handled by the revalidation visitor walking // the things inside it; it does not need to cause // revalidation on its own. @@ -268,7 +266,8 @@ impl NonTSPseudoClass { pub fn is_attr_based(&self) -> bool { matches!( *self, - NonTSPseudoClass::MozTableBorderNonzero | NonTSPseudoClass::MozBrowserFrame | + NonTSPseudoClass::MozTableBorderNonzero | + NonTSPseudoClass::MozBrowserFrame | NonTSPseudoClass::Lang(..) ) } diff --git a/components/style/gecko/snapshot_helpers.rs b/components/style/gecko/snapshot_helpers.rs index 6c40f242d5f..371a2b78da1 100644 --- a/components/style/gecko/snapshot_helpers.rs +++ b/components/style/gecko/snapshot_helpers.rs @@ -41,15 +41,26 @@ unsafe fn get_class_from_attr(attr: &structs::nsAttrValue) -> Class { debug_assert_eq!(base_type, structs::nsAttrValue_ValueBaseType_eOtherBase); let container = ptr::<structs::MiscContainer>(attr); - debug_assert_eq!((*container).mType, structs::nsAttrValue_ValueType_eAtomArray); - let array = - (*container).__bindgen_anon_1.mValue.as_ref().__bindgen_anon_1.mAtomArray.as_ref(); + debug_assert_eq!( + (*container).mType, + structs::nsAttrValue_ValueType_eAtomArray + ); + let array = (*container) + .__bindgen_anon_1 + .mValue + .as_ref() + .__bindgen_anon_1 + .mAtomArray + .as_ref(); Class::More(&***array) } #[inline(always)] unsafe fn get_id_from_attr(attr: &structs::nsAttrValue) -> &WeakAtom { - debug_assert_eq!(base_type(attr), structs::nsAttrValue_ValueBaseType_eAtomBase); + debug_assert_eq!( + base_type(attr), + structs::nsAttrValue_ValueBaseType_eAtomBase + ); WeakAtom::new(ptr::<nsAtom>(attr)) } @@ -59,7 +70,8 @@ pub fn find_attr<'a>( attrs: &'a [structs::AttrArray_InternalAttr], name: &Atom, ) -> Option<&'a structs::nsAttrValue> { - attrs.iter() + attrs + .iter() .find(|attr| attr.mName.mBits == name.as_ptr() as usize) .map(|attr| &attr.mValue) } @@ -80,19 +92,17 @@ pub fn has_class( ) -> bool { match unsafe { get_class_from_attr(attr) } { Class::None => false, - Class::One(atom) => unsafe { - case_sensitivity.eq_atom(name, WeakAtom::new(atom)) + Class::One(atom) => unsafe { case_sensitivity.eq_atom(name, WeakAtom::new(atom)) }, + Class::More(atoms) => match case_sensitivity { + CaseSensitivity::CaseSensitive => { + atoms.iter().any(|atom| atom.mRawPtr == name.as_ptr()) + }, + CaseSensitivity::AsciiCaseInsensitive => unsafe { + atoms + .iter() + .any(|atom| WeakAtom::new(atom.mRawPtr).eq_ignore_ascii_case(name)) + }, }, - Class::More(atoms) => { - match case_sensitivity { - CaseSensitivity::CaseSensitive => { - atoms.iter().any(|atom| atom.mRawPtr == name.as_ptr()) - } - CaseSensitivity::AsciiCaseInsensitive => unsafe { - atoms.iter().any(|atom| WeakAtom::new(atom.mRawPtr).eq_ignore_ascii_case(name)) - } - } - } } } @@ -111,7 +121,7 @@ where for atom in atoms { Atom::with(atom.mRawPtr, &mut callback) } - } + }, } } } diff --git a/components/style/gecko/url.rs b/components/style/gecko/url.rs index b94d2139764..8d785cae679 100644 --- a/components/style/gecko/url.rs +++ b/components/style/gecko/url.rs @@ -55,8 +55,7 @@ impl CssUrl { /// Convert from URLValueData to SpecifiedUrl. unsafe fn from_url_value_data(url: &URLValueData) -> Self { - let arc_type = - &url.mString as *const _ as *const RawOffsetArc<String>; + let arc_type = &url.mString as *const _ as *const RawOffsetArc<String>; CssUrl { serialization: Arc::from_raw_offset((*arc_type).clone()), extra_data: UrlExtraData(url.mExtraData.to_safe()), @@ -140,7 +139,6 @@ impl SpecifiedUrl { } } - impl PartialEq for SpecifiedUrl { fn eq(&self, other: &Self) -> bool { self.url.eq(&other.url) @@ -255,10 +253,7 @@ impl ToComputedValue for SpecifiedImageUrl { } } -fn serialize_computed_url<W>( - url_value_data: &URLValueData, - dest: &mut CssWriter<W>, -) -> fmt::Result +fn serialize_computed_url<W>(url_value_data: &URLValueData, dest: &mut CssWriter<W>) -> fmt::Result where W: Write, { @@ -281,7 +276,7 @@ pub struct ComputedUrl(pub SpecifiedUrl); impl ToCss for ComputedUrl { fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where - W: Write + W: Write, { serialize_computed_url(&self.0.url_value._base, dest) } @@ -302,7 +297,7 @@ pub struct ComputedImageUrl(pub SpecifiedImageUrl); impl ToCss for ComputedImageUrl { fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where - W: Write + W: Write, { serialize_computed_url(&self.0.image_value._base, dest) } diff --git a/components/style/gecko/values.rs b/components/style/gecko/values.rs index 3bb22947211..fed9dc161c0 100644 --- a/components/style/gecko/values.rs +++ b/components/style/gecko/values.rs @@ -488,7 +488,9 @@ where /// Convert a given RGBA value to `nscolor`. pub fn convert_rgba_to_nscolor(rgba: &RGBA) -> u32 { - ((rgba.alpha as u32) << 24) | ((rgba.blue as u32) << 16) | ((rgba.green as u32) << 8) | + ((rgba.alpha as u32) << 24) | + ((rgba.blue as u32) << 16) | + ((rgba.green as u32) << 8) | (rgba.red as u32) } @@ -537,8 +539,7 @@ impl CounterStyleOrNone { .map(|symbol| match *symbol { Symbol::String(ref s) => nsCStr::from(s), Symbol::Ident(_) => unreachable!("Should not have identifier in symbols()"), - }) - .collect(); + }).collect(); let symbols: Vec<_> = symbols .iter() .map(|symbol| symbol as &nsACString as *const _) diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index ff5ae599fcb..efe37e647c5 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -86,7 +86,6 @@ use std::ptr; use string_cache::{Atom, Namespace, WeakAtom, WeakNamespace}; use stylist::CascadeData; - #[inline] fn elements_with_id<'a, 'le>( array: *const structs::nsTArray<*mut RawGeckoElement>, @@ -172,12 +171,11 @@ impl<'lr> TShadowRoot for GeckoShadowRoot<'lr> { Self: 'a, { let author_styles = unsafe { - (self.0.mServoStyles.mPtr - as *const structs::RawServoAuthorStyles - as *const bindings::RawServoAuthorStyles).as_ref()? + (self.0.mServoStyles.mPtr as *const structs::RawServoAuthorStyles + as *const bindings::RawServoAuthorStyles) + .as_ref()? }; - let author_styles = AuthorStyles::<GeckoStyleSheet>::from_ffi(author_styles); debug_assert!( @@ -375,7 +373,8 @@ impl<'ln> TNode for GeckoNode<'ln> { fn first_child(&self) -> Option<Self> { unsafe { self.0 - .mFirstChild.raw::<nsIContent>() + .mFirstChild + .raw::<nsIContent>() .as_ref() .map(GeckoNode::from_content) } @@ -395,7 +394,8 @@ impl<'ln> TNode for GeckoNode<'ln> { fn next_sibling(&self) -> Option<Self> { unsafe { self.0 - .mNextSibling.raw::<nsIContent>() + .mNextSibling + .raw::<nsIContent>() .as_ref() .map(GeckoNode::from_content) } @@ -600,7 +600,7 @@ impl<'le> GeckoElement<'le> { if self.is_svg_element() { let svg_class = unsafe { bindings::Gecko_GetSVGAnimatedClass(self.0).as_ref() }; if let Some(c) = svg_class { - return Some(c) + return Some(c); } } @@ -672,8 +672,7 @@ impl<'le> GeckoElement<'le> { // For the bit usage, see nsContentSlots::GetExtendedSlots. let e_slots = s._base.mExtendedSlots & !structs::nsIContent_nsContentSlots_sNonOwningExtendedSlotsFlag; - (e_slots as *const structs::FragmentOrElement_nsExtendedDOMSlots) - .as_ref() + (e_slots as *const structs::FragmentOrElement_nsExtendedDOMSlots).as_ref() }) } @@ -719,9 +718,8 @@ impl<'le> GeckoElement<'le> { .and_then(|n| n.as_element()); debug_assert!( - binding_parent == unsafe { - bindings::Gecko_GetBindingParent(self.0).map(GeckoElement) - } + binding_parent == + unsafe { bindings::Gecko_GetBindingParent(self.0).map(GeckoElement) } ); binding_parent } @@ -730,8 +728,9 @@ impl<'le> GeckoElement<'le> { #[inline] fn non_xul_xbl_binding_parent_raw_content(&self) -> *mut nsIContent { debug_assert!(!self.is_xul_element()); - self.extended_slots() - .map_or(ptr::null_mut(), |slots| slots._base.mBindingParent.raw::<nsIContent>()) + self.extended_slots().map_or(ptr::null_mut(), |slots| { + slots._base.mBindingParent.raw::<nsIContent>() + }) } #[inline] @@ -747,7 +746,8 @@ impl<'le> GeckoElement<'le> { #[inline] fn state_internal(&self) -> u64 { - if !self.as_node() + if !self + .as_node() .get_bool_flag(nsINode_BooleanFlag::ElementHasLockedStyleStates) { return self.0.mState.mStates; @@ -878,9 +878,7 @@ impl<'le> GeckoElement<'le> { return false; } match self.containing_shadow_host() { - Some(e) => { - e.is_svg_element() && e.local_name() == &*local_name!("use") - }, + Some(e) => e.is_svg_element() && e.local_name() == &*local_name!("use"), None => false, } } @@ -934,13 +932,12 @@ impl<'le> GeckoElement<'le> { debug_assert_eq!(to.is_some(), from.is_some()); - combined_duration > 0.0f32 && from != to && - from.unwrap() - .animate( - to.as_ref().unwrap(), - Procedure::Interpolate { progress: 0.5 }, - ) - .is_ok() + combined_duration > 0.0f32 && from != to && from + .unwrap() + .animate( + to.as_ref().unwrap(), + Procedure::Interpolate { progress: 0.5 }, + ).is_ok() } } @@ -980,7 +977,9 @@ fn get_animation_rule( let effect_count = unsafe { Gecko_GetAnimationEffectCount(element.0) }; // Also, we should try to reuse the PDB, to avoid creating extra rule nodes. let mut animation_values = AnimationValueMap::with_capacity_and_hasher( - effect_count.min(ANIMATABLE_PROPERTY_COUNT), Default::default()); + effect_count.min(ANIMATABLE_PROPERTY_COUNT), + Default::default(), + ); if unsafe { Gecko_GetAnimationRule( element.0, @@ -1084,10 +1083,12 @@ impl<'le> TElement for GeckoElement<'le> { fn inheritance_parent(&self) -> Option<Self> { if self.implemented_pseudo_element().is_some() { - return self.pseudo_element_originating_element() + return self.pseudo_element_originating_element(); } - self.as_node().flattened_tree_parent().and_then(|n| n.as_element()) + self.as_node() + .flattened_tree_parent() + .and_then(|n| n.as_element()) } fn traversal_children(&self) -> LayoutIterator<GeckoChildrenIterator<'le>> { @@ -1095,8 +1096,10 @@ impl<'le> TElement for GeckoElement<'le> { // StyleChildrenIterator::IsNeeded does, except that it might return // true if we used to (but no longer) have anonymous content from // ::before/::after, XBL bindings, or nsIAnonymousContentCreators. - if self.is_in_anonymous_subtree() || self.has_xbl_binding_with_content() || - self.is_html_slot_element() || self.shadow_root().is_some() || + if self.is_in_anonymous_subtree() || + self.has_xbl_binding_with_content() || + self.is_html_slot_element() || + self.shadow_root().is_some() || self.may_have_anonymous_children() { unsafe { @@ -1157,17 +1160,16 @@ impl<'le> TElement for GeckoElement<'le> { // Bug 1466580 tracks running the Android layout tests on automation. // // The actual bindgen bug still needs reduction. - let assigned_nodes: &[structs::RefPtr<structs::nsINode>] = - if !cfg!(target_os = "android") { - debug_assert_eq!( - unsafe { bindings::Gecko_GetAssignedNodes(self.0) }, - &slot.mAssignedNodes as *const _, - ); + let assigned_nodes: &[structs::RefPtr<structs::nsINode>] = if !cfg!(target_os = "android") { + debug_assert_eq!( + unsafe { bindings::Gecko_GetAssignedNodes(self.0) }, + &slot.mAssignedNodes as *const _, + ); - &*slot.mAssignedNodes - } else { - unsafe { &**bindings::Gecko_GetAssignedNodes(self.0) } - }; + &*slot.mAssignedNodes + } else { + unsafe { &**bindings::Gecko_GetAssignedNodes(self.0) } + }; debug_assert_eq!( mem::size_of::<structs::RefPtr<structs::nsINode>>(), @@ -1239,11 +1241,10 @@ impl<'le> TElement for GeckoElement<'le> { } fn owner_doc_matches_for_testing(&self, device: &Device) -> bool { - self.as_node().owner_doc().0 as *const structs::nsIDocument == - device - .pres_context() - .mDocument - .raw::<structs::nsIDocument>() + self.as_node().owner_doc().0 as *const structs::nsIDocument == device + .pres_context() + .mDocument + .raw::<structs::nsIDocument>() } fn style_attribute(&self) -> Option<ArcBorrow<Locked<PropertyDeclarationBlock>>> { @@ -1378,7 +1379,8 @@ impl<'le> TElement for GeckoElement<'le> { self.unset_flags( ELEMENT_HAS_DIRTY_DESCENDANTS_FOR_SERVO as u32 | ELEMENT_HAS_ANIMATION_ONLY_DIRTY_DESCENDANTS_FOR_SERVO as u32 | - NODE_DESCENDANTS_NEED_FRAMES as u32 | NODE_NEEDS_FRAME as u32, + NODE_DESCENDANTS_NEED_FRAMES as u32 | + NODE_NEEDS_FRAME as u32, ) } @@ -1438,8 +1440,10 @@ impl<'le> TElement for GeckoElement<'le> { unsafe fn clear_data(&self) { let ptr = self.0.mServoData.get(); self.unset_flags( - ELEMENT_HAS_SNAPSHOT as u32 | ELEMENT_HANDLED_SNAPSHOT as u32 | - structs::Element_kAllServoDescendantBits | NODE_NEEDS_FRAME as u32, + ELEMENT_HAS_SNAPSHOT as u32 | + ELEMENT_HANDLED_SNAPSHOT as u32 | + structs::Element_kAllServoDescendantBits | + NODE_NEEDS_FRAME as u32, ); if !ptr.is_null() { debug!("Dropping ElementData for {:?}", self); @@ -1668,8 +1672,7 @@ impl<'le> TElement for GeckoElement<'le> { let transition_property: TransitionProperty = property.into(); let mut property_check_helper = |property: LonghandId| -> bool { - let property = - property.to_physical(after_change_style.writing_mode); + let property = property.to_physical(after_change_style.writing_mode); transitions_to_keep.insert(property); self.needs_transitions_update_per_property( property, @@ -1681,8 +1684,7 @@ impl<'le> TElement for GeckoElement<'le> { }; match transition_property { - TransitionProperty::Custom(..) | - TransitionProperty::Unsupported(..) => {}, + TransitionProperty::Custom(..) | TransitionProperty::Unsupported(..) => {}, TransitionProperty::Shorthand(ref shorthand) => { if shorthand.longhands().any(property_check_helper) { return true; @@ -1713,11 +1715,7 @@ impl<'le> TElement for GeckoElement<'le> { } } - fn match_element_lang( - &self, - override_lang: Option<Option<AttrValue>>, - value: &Lang, - ) -> bool { + fn match_element_lang(&self, override_lang: Option<Option<AttrValue>>, value: &Lang) -> bool { // Gecko supports :lang() from CSS Selectors 3, which only accepts a // single language tag, and which performs simple dash-prefix matching // on it. @@ -1860,7 +1858,8 @@ impl<'le> TElement for GeckoElement<'le> { )); } - let active = self.state() + let active = self + .state() .intersects(NonTSPseudoClass::Active.state_flag()); if active { let declarations = unsafe { Gecko_GetActiveLinkAttrDeclarationBlock(self.0) }; @@ -2070,7 +2069,10 @@ impl<'le> ::selectors::Element for GeckoElement<'le> { #[inline] fn is_root(&self) -> bool { - if self.as_node().get_bool_flag(nsINode_BooleanFlag::ParentIsContent) { + if self + .as_node() + .get_bool_flag(nsINode_BooleanFlag::ParentIsContent) + { return false; } @@ -2078,12 +2080,17 @@ impl<'le> ::selectors::Element for GeckoElement<'le> { return false; } - debug_assert!(self.as_node().parent_node().map_or(false, |p| p.is_document())); + debug_assert!( + self.as_node() + .parent_node() + .map_or(false, |p| p.is_document()) + ); unsafe { bindings::Gecko_IsRootElement(self.0) } } fn is_empty(&self) -> bool { - !self.as_node() + !self + .as_node() .dom_children() .any(|child| unsafe { Gecko_IsSignificantChild(child.0, true) }) } @@ -2194,7 +2201,8 @@ impl<'le> ::selectors::Element for GeckoElement<'le> { }, NonTSPseudoClass::MozOnlyWhitespace => { flags_setter(self, ElementSelectorFlags::HAS_EMPTY_SELECTOR); - if self.as_node() + if self + .as_node() .dom_children() .any(|c| c.contains_non_whitespace_content()) { @@ -2246,9 +2254,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> { None => false, } }, - NonTSPseudoClass::Dir(ref dir) => { - self.state().intersects(dir.element_state()) - } + NonTSPseudoClass::Dir(ref dir) => self.state().intersects(dir.element_state()), } } diff --git a/components/style/gecko_bindings/mod.rs b/components/style/gecko_bindings/mod.rs index eb3f0d220bf..166e2f66fd5 100644 --- a/components/style/gecko_bindings/mod.rs +++ b/components/style/gecko_bindings/mod.rs @@ -4,7 +4,12 @@ //! Gecko's C++ bindings, along with some rust helpers to ease its use. -#[allow(dead_code, improper_ctypes, non_camel_case_types, missing_docs)] +#[allow( + dead_code, + improper_ctypes, + non_camel_case_types, + missing_docs +)] pub mod bindings { include!(concat!(env!("OUT_DIR"), "/gecko/bindings.rs")); } @@ -13,8 +18,14 @@ pub mod bindings { // foreign structs to have `PhantomData`. We should remove this once the lint // ignores this case. -#[allow(dead_code, improper_ctypes, non_camel_case_types, non_snake_case, non_upper_case_globals, - missing_docs)] +#[allow( + dead_code, + improper_ctypes, + non_camel_case_types, + non_snake_case, + non_upper_case_globals, + missing_docs +)] pub mod structs { include!(concat!(env!("OUT_DIR"), "/gecko/structs.rs")); } diff --git a/components/style/gecko_bindings/sugar/ns_style_coord.rs b/components/style/gecko_bindings/sugar/ns_style_coord.rs index 3825c5520ec..bc3b195524d 100644 --- a/components/style/gecko_bindings/sugar/ns_style_coord.rs +++ b/components/style/gecko_bindings/sugar/ns_style_coord.rs @@ -52,7 +52,8 @@ impl nsStyleCoord_CalcValue { impl PartialEq for nsStyleCoord_CalcValue { fn eq(&self, other: &Self) -> bool { - self.mLength == other.mLength && self.mPercent == other.mPercent && + self.mLength == other.mLength && + self.mPercent == other.mPercent && self.mHasPercent == other.mHasPercent } } @@ -409,9 +410,12 @@ pub unsafe trait CoordData { unsafe fn get_float(&self) -> f32 { use gecko_bindings::structs::nsStyleUnit::*; debug_assert!( - self.unit() == eStyleUnit_Percent || self.unit() == eStyleUnit_Factor || - self.unit() == eStyleUnit_Degree || self.unit() == eStyleUnit_Grad || - self.unit() == eStyleUnit_Radian || self.unit() == eStyleUnit_Turn || + self.unit() == eStyleUnit_Percent || + self.unit() == eStyleUnit_Factor || + self.unit() == eStyleUnit_Degree || + self.unit() == eStyleUnit_Grad || + self.unit() == eStyleUnit_Radian || + self.unit() == eStyleUnit_Turn || self.unit() == eStyleUnit_FlexFraction ); *self.union().mFloat.as_ref() @@ -422,7 +426,8 @@ pub unsafe trait CoordData { unsafe fn get_integer(&self) -> i32 { use gecko_bindings::structs::nsStyleUnit::*; debug_assert!( - self.unit() == eStyleUnit_Coord || self.unit() == eStyleUnit_Integer || + self.unit() == eStyleUnit_Coord || + self.unit() == eStyleUnit_Integer || self.unit() == eStyleUnit_Enumerated ); *self.union().mInt.as_ref() diff --git a/components/style/gecko_bindings/sugar/refptr.rs b/components/style/gecko_bindings/sugar/refptr.rs index 6a32b81430e..835e77098c9 100644 --- a/components/style/gecko_bindings/sugar/refptr.rs +++ b/components/style/gecko_bindings/sugar/refptr.rs @@ -321,8 +321,4 @@ unsafe fn addref_atom(atom: *mut structs::nsAtom) { unsafe fn release_atom(atom: *mut structs::nsAtom) { let _ = Atom::from_addrefed(atom); } -impl_threadsafe_refcount!( - structs::nsAtom, - addref_atom, - release_atom -); +impl_threadsafe_refcount!(structs::nsAtom, addref_atom, release_atom); diff --git a/components/style/gecko_bindings/sugar/style_complex_color.rs b/components/style/gecko_bindings/sugar/style_complex_color.rs index 90e93b72fd0..c2b3b1c6270 100644 --- a/components/style/gecko_bindings/sugar/style_complex_color.rs +++ b/components/style/gecko_bindings/sugar/style_complex_color.rs @@ -59,7 +59,7 @@ impl From<ComputedColor> for StyleComplexColor { mFgRatio: ratios.fg, mTag: Tag::eComplex, } - } + }, } } } @@ -70,11 +70,11 @@ impl From<StyleComplexColor> for ComputedColor { Tag::eNumeric => { debug_assert!(other.mBgRatio == 1. && other.mFgRatio == 0.); GenericColor::Numeric(convert_nscolor_to_rgba(other.mColor)) - } + }, Tag::eForeground => { debug_assert!(other.mBgRatio == 0. && other.mFgRatio == 1.); GenericColor::Foreground - } + }, Tag::eComplex => { debug_assert!(other.mBgRatio != 1. || other.mFgRatio != 0.); debug_assert!(other.mBgRatio != 0. || other.mFgRatio != 1.); @@ -85,7 +85,7 @@ impl From<StyleComplexColor> for ComputedColor { fg: other.mFgRatio, }, ) - } + }, Tag::eAuto => unreachable!("Unsupport StyleComplexColor with tag eAuto"), } } diff --git a/components/style/invalidation/element/element_wrapper.rs b/components/style/invalidation/element/element_wrapper.rs index e788d2dd876..cd1b1d13a25 100644 --- a/components/style/invalidation/element/element_wrapper.rs +++ b/components/style/invalidation/element/element_wrapper.rs @@ -46,7 +46,9 @@ pub trait ElementSnapshot: Sized { /// Gets the attribute information of the snapshot as a string. /// /// Only for debugging purposes. - fn debug_list_attributes(&self) -> String { String::new() } + fn debug_list_attributes(&self) -> String { + String::new() + } /// The ID attribute per this snapshot. Should only be called if /// `has_attrs()` returns true. @@ -233,7 +235,8 @@ where // :lang() needs to match using the closest ancestor xml:lang="" or // lang="" attribtue from snapshots. NonTSPseudoClass::Lang(ref lang_arg) => { - return self.element + return self + .element .match_element_lang(Some(self.get_lang()), lang_arg); }, @@ -242,12 +245,14 @@ where let flag = pseudo_class.state_flag(); if flag.is_empty() { - return self.element + return self + .element .match_non_ts_pseudo_class(pseudo_class, context, &mut |_, _| {}); } match self.snapshot().and_then(|s| s.state()) { Some(snapshot_state) => snapshot_state.intersects(flag), - None => self.element + None => self + .element .match_non_ts_pseudo_class(pseudo_class, context, &mut |_, _| {}), } } diff --git a/components/style/invalidation/element/invalidation_map.rs b/components/style/invalidation/element/invalidation_map.rs index 26a4609760f..038852a6dd4 100644 --- a/components/style/invalidation/element/invalidation_map.rs +++ b/components/style/invalidation/element/invalidation_map.rs @@ -38,8 +38,10 @@ use smallvec::SmallVec; #[derive(Clone, Debug, MallocSizeOf)] pub struct Dependency { /// The dependency selector. - #[cfg_attr(feature = "gecko", - ignore_malloc_size_of = "CssRules have primary refs, we measure there")] + #[cfg_attr( + feature = "gecko", + ignore_malloc_size_of = "CssRules have primary refs, we measure there" + )] #[cfg_attr(feature = "servo", ignore_malloc_size_of = "Arc")] pub selector: Selector<SelectorImpl>, @@ -127,8 +129,10 @@ impl SelectorMapEntry for StateDependency { pub struct DocumentStateDependency { /// The selector that is affected. We don't need to track an offset, since /// when it changes it changes for the whole document anyway. - #[cfg_attr(feature = "gecko", - ignore_malloc_size_of = "CssRules have primary refs, we measure there")] + #[cfg_attr( + feature = "gecko", + ignore_malloc_size_of = "CssRules have primary refs, we measure there" + )] #[cfg_attr(feature = "servo", ignore_malloc_size_of = "Arc")] pub selector: Selector<SelectorImpl>, /// The state this dependency is affected by. @@ -185,7 +189,8 @@ impl InvalidationMap { /// Returns the number of dependencies stored in the invalidation map. pub fn len(&self) -> usize { - self.state_affecting_selectors.len() + self.document_state_selectors.len() + + self.state_affecting_selectors.len() + + self.document_state_selectors.len() + self.other_attribute_affecting_selectors.len() + self.id_to_selector .iter() diff --git a/components/style/invalidation/element/restyle_hints.rs b/components/style/invalidation/element/restyle_hints.rs index 4ac06c8b163..18e2f96470a 100644 --- a/components/style/invalidation/element/restyle_hints.rs +++ b/components/style/invalidation/element/restyle_hints.rs @@ -67,7 +67,8 @@ impl RestyleHint { /// Returns whether we need to restyle this element. pub fn has_non_animation_invalidations(&self) -> bool { self.intersects( - RestyleHint::RESTYLE_SELF | RestyleHint::RECASCADE_SELF | + RestyleHint::RESTYLE_SELF | + RestyleHint::RECASCADE_SELF | (Self::replacements() & !Self::for_animations()), ) } @@ -119,7 +120,8 @@ impl RestyleHint { /// The replacements for the animation cascade levels. #[inline] pub fn for_animations() -> Self { - RestyleHint::RESTYLE_SMIL | RestyleHint::RESTYLE_CSS_ANIMATIONS | + RestyleHint::RESTYLE_SMIL | + RestyleHint::RESTYLE_CSS_ANIMATIONS | RestyleHint::RESTYLE_CSS_TRANSITIONS } diff --git a/components/style/invalidation/element/state_and_attributes.rs b/components/style/invalidation/element/state_and_attributes.rs index d13da58a89b..bf259bb6f02 100644 --- a/components/style/invalidation/element/state_and_attributes.rs +++ b/components/style/invalidation/element/state_and_attributes.rs @@ -200,17 +200,12 @@ where debug!(" > state: {:?}", state_changes); } if snapshot.id_changed() { - debug!( - " > id changed: +{:?} -{:?}", - id_added, - id_removed - ); + debug!(" > id changed: +{:?} -{:?}", id_added, id_removed); } if snapshot.class_changed() { debug!( " > class changed: +{:?} -{:?}", - classes_added, - classes_removed + classes_added, classes_removed ); } if snapshot.other_attr_changed() { @@ -233,7 +228,6 @@ where shadow_rule_datas.push((data, quirks_mode, host.map(|h| h.opaque()))) }); - let invalidated_self = { let mut collector = Collector { wrapper, @@ -410,10 +404,7 @@ where } /// Check whether a dependency should be taken into account. - fn check_dependency( - &mut self, - dependency: &Dependency, - ) -> bool { + fn check_dependency(&mut self, dependency: &Dependency) -> bool { let element = &self.element; let wrapper = &self.wrapper; let matches_now = matches_selector( diff --git a/components/style/lib.rs b/components/style/lib.rs index 03caab33e19..57d507a4ab4 100644 --- a/components/style/lib.rs +++ b/components/style/lib.rs @@ -200,7 +200,6 @@ pub mod gecko; #[allow(unsafe_code)] pub mod servo; - #[cfg(feature = "gecko")] #[allow(unsafe_code, missing_docs)] pub mod gecko_properties { diff --git a/components/style/logical_geometry.rs b/components/style/logical_geometry.rs index b345c2ad375..8c677c210bf 100644 --- a/components/style/logical_geometry.rs +++ b/components/style/logical_geometry.rs @@ -957,8 +957,10 @@ impl<T: Copy> LogicalMargin<T> { impl<T: PartialEq + Zero> LogicalMargin<T> { #[inline] pub fn is_zero(&self) -> bool { - self.block_start == Zero::zero() && self.inline_end == Zero::zero() && - self.block_end == Zero::zero() && self.inline_start == Zero::zero() + self.block_start == Zero::zero() && + self.inline_end == Zero::zero() && + self.block_end == Zero::zero() && + self.inline_start == Zero::zero() } } diff --git a/components/style/macros.rs b/components/style/macros.rs index 671ba35b8bc..58889389336 100644 --- a/components/style/macros.rs +++ b/components/style/macros.rs @@ -68,9 +68,19 @@ macro_rules! try_match_ident_ignore_ascii_case { macro_rules! define_keyword_type { ($name:ident, $css:expr) => { #[allow(missing_docs)] - #[derive(Animate, Clone, ComputeSquaredDistance, Copy, MallocSizeOf, - PartialEq, SpecifiedValueInfo, ToAnimatedValue, ToAnimatedZero, - ToComputedValue, ToCss)] + #[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedValue, + ToAnimatedZero, + ToComputedValue, + ToCss, + )] pub struct $name; impl fmt::Debug for $name { diff --git a/components/style/matching.rs b/components/style/matching.rs index 6f239d361d8..922ecad9eb4 100644 --- a/components/style/matching.rs +++ b/components/style/matching.rs @@ -356,10 +356,9 @@ trait PrivateMatchMethods: TElement { tasks.insert(UpdateAnimationsTasks::CSS_ANIMATIONS); } - let before_change_style = if self.might_need_transitions_update( - old_values.as_ref().map(|s| &**s), - new_values, - ) { + let before_change_style = if self + .might_need_transitions_update(old_values.as_ref().map(|s| &**s), new_values) + { let after_change_style = if self.has_css_transitions() { self.after_change_style(context, new_values) } else { @@ -469,9 +468,11 @@ trait PrivateMatchMethods: TElement { pseudo: Option<&PseudoElement>, ) -> ChildCascadeRequirement { debug!("accumulate_damage_for: {:?}", self); - debug_assert!(!shared_context - .traversal_flags - .contains(TraversalFlags::Forgetful)); + debug_assert!( + !shared_context + .traversal_flags + .contains(TraversalFlags::Forgetful) + ); let difference = self.compute_style_difference(old_values, new_values, pseudo); diff --git a/components/style/media_queries/media_condition.rs b/components/style/media_queries/media_condition.rs index dbd677d0aee..78252db8c0b 100644 --- a/components/style/media_queries/media_condition.rs +++ b/components/style/media_queries/media_condition.rs @@ -53,12 +53,12 @@ impl ToCss for MediaCondition { MediaCondition::Not(ref c) => { dest.write_str("not ")?; c.to_css(dest) - } + }, MediaCondition::InParens(ref c) => { dest.write_char('(')?; c.to_css(dest)?; dest.write_char(')') - } + }, MediaCondition::Operation(ref list, op) => { let mut iter = list.iter(); iter.next().unwrap().to_css(dest)?; @@ -69,7 +69,7 @@ impl ToCss for MediaCondition { item.to_css(dest)?; } Ok(()) - } + }, } } } @@ -104,14 +104,12 @@ impl MediaCondition { let is_negation = match *input.next()? { Token::ParenthesisBlock => false, Token::Ident(ref ident) if ident.eq_ignore_ascii_case("not") => true, - ref t => { - return Err(location.new_unexpected_token_error(t.clone())) - } + ref t => return Err(location.new_unexpected_token_error(t.clone())), }; if is_negation { let inner_condition = Self::parse_in_parens(context, input)?; - return Ok(MediaCondition::Not(Box::new(inner_condition))) + return Ok(MediaCondition::Not(Box::new(inner_condition))); } // ParenthesisBlock. @@ -162,7 +160,7 @@ impl MediaCondition { input.parse_nested_block(|input| { // Base case. if let Ok(inner) = input.try(|i| Self::parse(context, i)) { - return Ok(MediaCondition::InParens(Box::new(inner))) + return Ok(MediaCondition::InParens(Box::new(inner))); } let expr = MediaFeatureExpression::parse_in_parenthesis_block(context, input)?; Ok(MediaCondition::Feature(expr)) @@ -178,14 +176,10 @@ impl MediaCondition { MediaCondition::Operation(ref conditions, op) => { let mut iter = conditions.iter(); match op { - Operator::And => { - iter.all(|c| c.matches(device, quirks_mode)) - } - Operator::Or => { - iter.any(|c| c.matches(device, quirks_mode)) - } + Operator::And => iter.all(|c| c.matches(device, quirks_mode)), + Operator::Or => iter.any(|c| c.matches(device, quirks_mode)), } - } + }, } } } diff --git a/components/style/media_queries/media_feature.rs b/components/style/media_queries/media_feature.rs index 5a5bc88863e..771a11e8fbb 100644 --- a/components/style/media_queries/media_feature.rs +++ b/components/style/media_queries/media_feature.rs @@ -30,10 +30,9 @@ type MediaFeatureEvaluator<T> = fn( pub type KeywordSerializer = fn(KeywordDiscriminant) -> String; /// Parses a given identifier. -pub type KeywordParser = for <'a, 'i, 't> fn( - context: &'a ParserContext, - input: &'a mut Parser<'i, 't>, -) -> Result<KeywordDiscriminant, ParseError<'i>>; +pub type KeywordParser = + for<'a, 'i, 't> fn(context: &'a ParserContext, input: &'a mut Parser<'i, 't>) + -> Result<KeywordDiscriminant, ParseError<'i>>; /// An evaluator for a given media feature. /// @@ -70,50 +69,49 @@ pub enum Evaluator { /// asserts if that's not true. As of today there's nothing like that (does that /// even make sense?). macro_rules! keyword_evaluator { - ($actual_evaluator:ident, $keyword_type:ty) => { - { - fn __parse<'i, 't>( - context: &$crate::parser::ParserContext, - input: &mut $crate::cssparser::Parser<'i, 't>, - ) -> Result< - $crate::media_queries::media_feature::KeywordDiscriminant, - ::style_traits::ParseError<'i>, - > { - let kw = <$keyword_type as $crate::parser::Parse>::parse(context, input)?; - Ok(kw as $crate::media_queries::media_feature::KeywordDiscriminant) - } - - fn __serialize(kw: $crate::media_queries::media_feature::KeywordDiscriminant) -> String { - // This unwrap is ok because the only discriminants that get - // back to us is the ones that `parse` produces. - let value: $keyword_type = - ::num_traits::cast::FromPrimitive::from_u8(kw).unwrap(); - <$keyword_type as ::style_traits::ToCss>::to_css_string(&value) - } - - fn __evaluate( - device: &$crate::media_queries::Device, - value: Option<$crate::media_queries::media_feature::KeywordDiscriminant>, - range_or_operator: Option<$crate::media_queries::media_feature_expression::RangeOrOperator>, - ) -> bool { - debug_assert!( - range_or_operator.is_none(), - "Since when do keywords accept ranges?" - ); - // This unwrap is ok because the only discriminants that get - // back to us is the ones that `parse` produces. - let value: Option<$keyword_type> = - value.map(|kw| ::num_traits::cast::FromPrimitive::from_u8(kw).unwrap()); - $actual_evaluator(device, value) - } - - $crate::media_queries::media_feature::Evaluator::Enumerated { - parser: __parse, - serializer: __serialize, - evaluator: __evaluate, - } + ($actual_evaluator:ident, $keyword_type:ty) => {{ + fn __parse<'i, 't>( + context: &$crate::parser::ParserContext, + input: &mut $crate::cssparser::Parser<'i, 't>, + ) -> Result< + $crate::media_queries::media_feature::KeywordDiscriminant, + ::style_traits::ParseError<'i>, + > { + let kw = <$keyword_type as $crate::parser::Parse>::parse(context, input)?; + Ok(kw as $crate::media_queries::media_feature::KeywordDiscriminant) } - } + + fn __serialize(kw: $crate::media_queries::media_feature::KeywordDiscriminant) -> String { + // This unwrap is ok because the only discriminants that get + // back to us is the ones that `parse` produces. + let value: $keyword_type = ::num_traits::cast::FromPrimitive::from_u8(kw).unwrap(); + <$keyword_type as ::style_traits::ToCss>::to_css_string(&value) + } + + fn __evaluate( + device: &$crate::media_queries::Device, + value: Option<$crate::media_queries::media_feature::KeywordDiscriminant>, + range_or_operator: Option< + $crate::media_queries::media_feature_expression::RangeOrOperator, + >, + ) -> bool { + debug_assert!( + range_or_operator.is_none(), + "Since when do keywords accept ranges?" + ); + // This unwrap is ok because the only discriminants that get + // back to us is the ones that `parse` produces. + let value: Option<$keyword_type> = + value.map(|kw| ::num_traits::cast::FromPrimitive::from_u8(kw).unwrap()); + $actual_evaluator(device, value) + } + + $crate::media_queries::media_feature::Evaluator::Enumerated { + parser: __parse, + serializer: __serialize, + evaluator: __evaluate, + } + }}; } bitflags! { @@ -169,7 +167,7 @@ macro_rules! feature { evaluator: $evaluator, requirements: $reqs, } - } + }; } impl fmt::Debug for MediaFeatureDescription { diff --git a/components/style/media_queries/media_feature_expression.rs b/components/style/media_queries/media_feature_expression.rs index f07b8cc27e4..64406218e88 100644 --- a/components/style/media_queries/media_feature_expression.rs +++ b/components/style/media_queries/media_feature_expression.rs @@ -102,13 +102,9 @@ pub enum RangeOrOperator { impl RangeOrOperator { /// Evaluate a given range given an optional query value and a value from /// the browser. - pub fn evaluate<T>( - range_or_op: Option<Self>, - query_value: Option<T>, - value: T, - ) -> bool + pub fn evaluate<T>(range_or_op: Option<Self>, query_value: Option<T>, value: T) -> bool where - T: PartialOrd + Zero + T: PartialOrd + Zero, { match query_value { Some(v) => Self::evaluate_with_query_value(range_or_op, v, value), @@ -118,11 +114,7 @@ impl RangeOrOperator { /// Evaluate a given range given a non-optional query value and a value from /// the browser. - pub fn evaluate_with_query_value<T>( - range_or_op: Option<Self>, - query_value: T, - value: T, - ) -> bool + pub fn evaluate_with_query_value<T>(range_or_op: Option<Self>, query_value: T, value: T) -> bool where T: PartialOrd, { @@ -142,20 +134,14 @@ impl RangeOrOperator { Range::Min => cmp == Ordering::Greater, Range::Max => cmp == Ordering::Less, } - } - RangeOrOperator::Operator(op) => { - match op { - Operator::Equal => cmp == Ordering::Equal, - Operator::GreaterThan => cmp == Ordering::Greater, - Operator::GreaterThanEqual => { - cmp == Ordering::Equal || cmp == Ordering::Greater - } - Operator::LessThan => cmp == Ordering::Less, - Operator::LessThanEqual => { - cmp == Ordering::Equal || cmp == Ordering::Less - } - } - } + }, + RangeOrOperator::Operator(op) => match op { + Operator::Equal => cmp == Ordering::Equal, + Operator::GreaterThan => cmp == Ordering::Greater, + Operator::GreaterThanEqual => cmp == Ordering::Equal || cmp == Ordering::Greater, + Operator::LessThan => cmp == Ordering::Less, + Operator::LessThanEqual => cmp == Ordering::Equal || cmp == Ordering::Less, + }, } } } @@ -172,8 +158,8 @@ pub struct MediaFeatureExpression { impl PartialEq for MediaFeatureExpression { fn eq(&self, other: &Self) -> bool { self.feature as *const _ == other.feature as *const _ && - self.value == other.value && - self.range_or_operator == other.range_or_operator + self.value == other.value && + self.range_or_operator == other.range_or_operator } } @@ -184,7 +170,11 @@ impl ToCss for MediaFeatureExpression { { dest.write_str("(")?; - if self.feature.requirements.contains(ParsingRequirements::WEBKIT_PREFIX) { + if self + .feature + .requirements + .contains(ParsingRequirements::WEBKIT_PREFIX) + { dest.write_str("-webkit-")?; } @@ -215,9 +205,7 @@ impl ToCss for MediaFeatureExpression { } /// Consumes an operation or a colon, or returns an error. -fn consume_operation_or_colon( - input: &mut Parser, -) -> Result<Option<Operator>, ()> { +fn consume_operation_or_colon(input: &mut Parser) -> Result<Option<Operator>, ()> { let first_delim = { let next_token = match input.next() { Ok(t) => t, @@ -238,14 +226,14 @@ fn consume_operation_or_colon( } else { Operator::GreaterThan } - } + }, '<' => { if input.try(|i| i.expect_delim('=')).is_ok() { Operator::LessThanEqual } else { Operator::LessThan } - } + }, _ => return Err(()), })) } @@ -256,7 +244,11 @@ impl MediaFeatureExpression { value: Option<MediaExpressionValue>, range_or_operator: Option<RangeOrOperator>, ) -> Self { - Self { feature, value, range_or_operator } + Self { + feature, + value, + range_or_operator, + } } /// Parse a media expression of the form: @@ -269,9 +261,7 @@ impl MediaFeatureExpression { input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i>> { input.expect_parenthesis_block()?; - input.parse_nested_block(|input| { - Self::parse_in_parenthesis_block(context, input) - }) + input.parse_nested_block(|input| Self::parse_in_parenthesis_block(context, input)) } /// Parse a media feature expression where we've already consumed the @@ -294,9 +284,7 @@ impl MediaFeatureExpression { let mut requirements = ParsingRequirements::empty(); - if context.chrome_rules_enabled() || - context.stylesheet_origin == Origin::UserAgent - { + if context.chrome_rules_enabled() || context.stylesheet_origin == Origin::UserAgent { requirements.insert(ParsingRequirements::CHROME_AND_UA_ONLY); } @@ -313,7 +301,9 @@ impl MediaFeatureExpression { if unsafe { structs::StaticPrefs_sVarCache_layout_css_prefixes_device_pixel_ratio_webkit } { - requirements.insert(ParsingRequirements::WEBKIT_DEVICE_PIXEL_RATIO_PREF_ENABLED); + requirements.insert( + ParsingRequirements::WEBKIT_DEVICE_PIXEL_RATIO_PREF_ENABLED, + ); } } } @@ -370,45 +360,41 @@ impl MediaFeatureExpression { // Gecko doesn't allow ranged expressions without a // value, so just reject them here too. if range.is_some() { - return Err(input.new_custom_error( - StyleParseErrorKind::RangedExpressionWithNoValue - )); + return Err( + input.new_custom_error(StyleParseErrorKind::RangedExpressionWithNoValue) + ); } return Ok(Self::new(feature, None, None)); - } + }, Ok(operator) => operator, }; let range_or_operator = match range { Some(range) => { if operator.is_some() { - return Err(input.new_custom_error( - StyleParseErrorKind::MediaQueryUnexpectedOperator - )); + return Err( + input.new_custom_error(StyleParseErrorKind::MediaQueryUnexpectedOperator) + ); } Some(RangeOrOperator::Range(range)) - } - None => { - match operator { - Some(operator) => { - if !feature.allows_ranges() { - return Err(input.new_custom_error( - StyleParseErrorKind::MediaQueryUnexpectedOperator - )); - } - Some(RangeOrOperator::Operator(operator)) + }, + None => match operator { + Some(operator) => { + if !feature.allows_ranges() { + return Err(input + .new_custom_error(StyleParseErrorKind::MediaQueryUnexpectedOperator)); } - None => None, - } - } + Some(RangeOrOperator::Operator(operator)) + }, + None => None, + }, }; - let value = - MediaExpressionValue::parse(feature, context, input).map_err(|err| { - err.location - .new_custom_error(StyleParseErrorKind::MediaQueryExpectedFeatureValue) - })?; + let value = MediaExpressionValue::parse(feature, context, input).map_err(|err| { + err.location + .new_custom_error(StyleParseErrorKind::MediaQueryExpectedFeatureValue) + })?; Ok(Self::new(feature, Some(value), range_or_operator)) } @@ -419,13 +405,11 @@ impl MediaFeatureExpression { macro_rules! expect { ($variant:ident) => { - value.map(|value| { - match *value { - MediaExpressionValue::$variant(ref v) => v, - _ => unreachable!("Unexpected MediaExpressionValue"), - } + value.map(|value| match *value { + MediaExpressionValue::$variant(ref v) => v, + _ => unreachable!("Unexpected MediaExpressionValue"), }) - } + }; } match self.feature.evaluator { @@ -436,13 +420,11 @@ impl MediaFeatureExpression { }) }); eval(device, computed, self.range_or_operator) - } + }, Evaluator::Integer(eval) => { eval(device, expect!(Integer).cloned(), self.range_or_operator) - } - Evaluator::Float(eval) => { - eval(device, expect!(Float).cloned(), self.range_or_operator) - } + }, + Evaluator::Float(eval) => eval(device, expect!(Float).cloned(), self.range_or_operator), Evaluator::IntRatio(eval) => { eval(device, expect!(IntRatio).cloned(), self.range_or_operator) }, @@ -453,20 +435,16 @@ impl MediaFeatureExpression { }) }); eval(device, computed, self.range_or_operator) - } + }, Evaluator::Enumerated { evaluator, .. } => { - evaluator( - device, - expect!(Enumerated).cloned(), - self.range_or_operator, - ) - } - Evaluator::Ident(eval) => { - eval(device, expect!(Ident).cloned(), self.range_or_operator) - } - Evaluator::BoolInteger(eval) => { - eval(device, expect!(BoolInteger).cloned(), self.range_or_operator) - } + evaluator(device, expect!(Enumerated).cloned(), self.range_or_operator) + }, + Evaluator::Ident(eval) => eval(device, expect!(Ident).cloned(), self.range_or_operator), + Evaluator::BoolInteger(eval) => eval( + device, + expect!(BoolInteger).cloned(), + self.range_or_operator, + ), } } } @@ -502,11 +480,7 @@ pub enum MediaExpressionValue { } impl MediaExpressionValue { - fn to_css<W>( - &self, - dest: &mut CssWriter<W>, - for_expr: &MediaFeatureExpression, - ) -> fmt::Result + fn to_css<W>(&self, dest: &mut CssWriter<W>, for_expr: &MediaFeatureExpression) -> fmt::Result where W: fmt::Write, { @@ -515,18 +489,12 @@ impl MediaExpressionValue { MediaExpressionValue::Integer(v) => v.to_css(dest), MediaExpressionValue::Float(v) => v.to_css(dest), MediaExpressionValue::BoolInteger(v) => dest.write_str(if v { "1" } else { "0" }), - MediaExpressionValue::IntRatio(ratio) => { - ratio.to_css(dest) - }, + MediaExpressionValue::IntRatio(ratio) => ratio.to_css(dest), MediaExpressionValue::Resolution(ref r) => r.to_css(dest), MediaExpressionValue::Ident(ref ident) => serialize_atom_identifier(ident, dest), - MediaExpressionValue::Enumerated(value) => { - match for_expr.feature.evaluator { - Evaluator::Enumerated { serializer, .. } => { - dest.write_str(&*serializer(value)) - } - _ => unreachable!(), - } + MediaExpressionValue::Enumerated(value) => match for_expr.feature.evaluator { + Evaluator::Enumerated { serializer, .. } => dest.write_str(&*serializer(value)), + _ => unreachable!(), }, } } @@ -540,11 +508,11 @@ impl MediaExpressionValue { Evaluator::Length(..) => { let length = Length::parse_non_negative(context, input)?; MediaExpressionValue::Length(length) - } + }, Evaluator::Integer(..) => { let integer = Integer::parse_non_negative(context, input)?; MediaExpressionValue::Integer(integer.value() as u32) - } + }, Evaluator::BoolInteger(..) => { let integer = Integer::parse_non_negative(context, input)?; let value = integer.value(); @@ -552,29 +520,26 @@ impl MediaExpressionValue { return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)); } MediaExpressionValue::BoolInteger(value == 1) - } + }, Evaluator::Float(..) => { let number = Number::parse(context, input)?; MediaExpressionValue::Float(number.get()) - } + }, Evaluator::IntRatio(..) => { let a = Integer::parse_positive(context, input)?; input.expect_delim('/')?; let b = Integer::parse_positive(context, input)?; - MediaExpressionValue::IntRatio(AspectRatio( - a.value() as u32, - b.value() as u32 - )) - } + MediaExpressionValue::IntRatio(AspectRatio(a.value() as u32, b.value() as u32)) + }, Evaluator::Resolution(..) => { MediaExpressionValue::Resolution(Resolution::parse(context, input)?) - } + }, Evaluator::Enumerated { parser, .. } => { MediaExpressionValue::Enumerated(parser(context, input)?) - } + }, Evaluator::Ident(..) => { MediaExpressionValue::Ident(Atom::from(input.expect_ident()?.as_ref())) - } + }, }) } } diff --git a/components/style/media_queries/media_list.rs b/components/style/media_queries/media_list.rs index f8d15df7257..168671288cf 100644 --- a/components/style/media_queries/media_list.rs +++ b/components/style/media_queries/media_list.rs @@ -30,10 +30,7 @@ impl MediaList { /// "not all", see: /// /// <https://drafts.csswg.org/mediaqueries/#error-handling> - pub fn parse( - context: &ParserContext, - input: &mut Parser, - ) -> Self { + pub fn parse(context: &ParserContext, input: &mut Parser) -> Self { if input.is_exhausted() { return Self::empty(); } @@ -48,8 +45,10 @@ impl MediaList { Err(err) => { media_queries.push(MediaQuery::never_matching()); let location = err.location; - let error = - ContextualParseError::InvalidMediaRule(input.slice_from(start_position), err); + let error = ContextualParseError::InvalidMediaRule( + input.slice_from(start_position), + err, + ); context.log_css_error(location, error); }, } @@ -79,8 +78,10 @@ impl MediaList { let media_match = mq.media_type.matches(device.media_type()); // Check if the media condition match. - let query_match = media_match && - mq.condition.as_ref().map_or(true, |c| c.matches(device, quirks_mode)); + let query_match = media_match && mq + .condition + .as_ref() + .map_or(true, |c| c.matches(device, quirks_mode)); // Apply the logical NOT qualifier to the result match mq.qualifier { diff --git a/components/style/media_queries/media_query.rs b/components/style/media_queries/media_query.rs index 089fc9412b2..46c35618b22 100644 --- a/components/style/media_queries/media_query.rs +++ b/components/style/media_queries/media_query.rs @@ -15,7 +15,6 @@ use style_traits::{CssWriter, ParseError, ToCss}; use super::media_condition::MediaCondition; use values::CustomIdent; - /// <https://drafts.csswg.org/mediaqueries/#mq-prefix> #[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToCss)] pub enum Qualifier { @@ -125,12 +124,13 @@ impl MediaQuery { context: &ParserContext, input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i>> { - let (qualifier, explicit_media_type) = input.try(|input| -> Result<_, ()> { - let qualifier = input.try(Qualifier::parse).ok(); - let ident = input.expect_ident().map_err(|_| ())?; - let media_type = MediaQueryType::parse(&ident)?; - Ok((qualifier, Some(media_type))) - }).unwrap_or_default(); + let (qualifier, explicit_media_type) = input + .try(|input| -> Result<_, ()> { + let qualifier = input.try(Qualifier::parse).ok(); + let ident = input.expect_ident().map_err(|_| ())?; + let media_type = MediaQueryType::parse(&ident)?; + Ok((qualifier, Some(media_type))) + }).unwrap_or_default(); let condition = if explicit_media_type.is_none() { Some(MediaCondition::parse(context, input)?) @@ -141,7 +141,11 @@ impl MediaQuery { }; let media_type = explicit_media_type.unwrap_or(MediaQueryType::All); - Ok(Self { qualifier, media_type, condition }) + Ok(Self { + qualifier, + media_type, + condition, + }) } } diff --git a/components/style/parser.rs b/components/style/parser.rs index db5b8f1e7f9..2d667f3f343 100644 --- a/components/style/parser.rs +++ b/components/style/parser.rs @@ -137,11 +137,7 @@ impl<'a> ParserContext<'a> { } /// Record a CSS parse error with this context’s error reporting. - pub fn log_css_error( - &self, - location: SourceLocation, - error: ContextualParseError, - ) { + pub fn log_css_error(&self, location: SourceLocation, error: ContextualParseError) { let error_reporter = match self.error_reporter { Some(r) => r, None => return, diff --git a/components/style/properties/longhands/box.mako.rs b/components/style/properties/longhands/box.mako.rs index 7dfc15cd14e..ed7839360d9 100644 --- a/components/style/properties/longhands/box.mako.rs +++ b/components/style/properties/longhands/box.mako.rs @@ -379,7 +379,7 @@ ${helpers.predefined_type( "OffsetPath", "computed::OffsetPath::none()", products="gecko", - animation_value_type="none", + animation_value_type="ComputedValue", gecko_pref="layout.css.motion-path.enabled", flags="CREATES_STACKING_CONTEXT FIXPOS_CB", spec="https://drafts.fxtf.org/motion-1/#offset-path-property", diff --git a/components/style/rule_tree/mod.rs b/components/style/rule_tree/mod.rs index 5414b254aae..d4fb0d00925 100644 --- a/components/style/rule_tree/mod.rs +++ b/components/style/rule_tree/mod.rs @@ -488,7 +488,8 @@ impl RuleTree { return path.clone(); } - let iter = path.self_and_ancestors() + let iter = path + .self_and_ancestors() .take_while(|node| node.cascade_level() >= CascadeLevel::SMILOverride); let mut last = path; let mut children = SmallVec::<[_; 10]>::new(); @@ -1452,7 +1453,8 @@ impl StrongRuleNode { // transitions and animations are present for a given element and // property, transitions are suppressed so that they don't actually // override animations. - let iter = self.self_and_ancestors() + let iter = self + .self_and_ancestors() .skip_while(|node| node.cascade_level() == CascadeLevel::Transitions) .take_while(|node| node.cascade_level() > CascadeLevel::Animations); let mut result = (LonghandIdSet::new(), false); diff --git a/components/style/selector_map.rs b/components/style/selector_map.rs index 3ab78ce2d87..1e35f748917 100644 --- a/components/style/selector_map.rs +++ b/components/style/selector_map.rs @@ -287,7 +287,9 @@ impl SelectorMap<Rule> { context, flags_setter, ) { - matching_rules.push(rule.to_applicable_declaration_block(cascade_level, shadow_cascade_order)); + matching_rules.push( + rule.to_applicable_declaration_block(cascade_level, shadow_cascade_order), + ); } } } @@ -305,10 +307,12 @@ impl<T: SelectorMapEntry> SelectorMap<T> { let vector = match find_bucket(entry.selector()) { Bucket::Root => &mut self.root, - Bucket::ID(id) => self.id_hash + Bucket::ID(id) => self + .id_hash .try_entry(id.clone(), quirks_mode)? .or_insert_with(SmallVec::new), - Bucket::Class(class) => self.class_hash + Bucket::Class(class) => self + .class_hash .try_entry(class.clone(), quirks_mode)? .or_insert_with(SmallVec::new), Bucket::LocalName { name, lower_name } => { @@ -333,7 +337,8 @@ impl<T: SelectorMapEntry> SelectorMap<T> { .try_entry(name.clone())? .or_insert_with(SmallVec::new) }, - Bucket::Namespace(url) => self.namespace_hash + Bucket::Namespace(url) => self + .namespace_hash .try_entry(url.clone())? .or_insert_with(SmallVec::new), Bucket::Universal => &mut self.other, @@ -490,8 +495,9 @@ fn specific_bucket_for<'a>(component: &'a Component<SelectorImpl>) -> Bucket<'a> name: &selector.name, lower_name: &selector.lower_name, }, - Component::Namespace(_, ref url) | - Component::DefaultNamespace(ref url) => Bucket::Namespace(url), + Component::Namespace(_, ref url) | Component::DefaultNamespace(ref url) => { + Bucket::Namespace(url) + }, // ::slotted(..) isn't a normal pseudo-element, so we can insert it on // the rule hash normally without much problem. For example, in a // selector like: @@ -534,7 +540,7 @@ fn find_bucket<'a>(mut iter: SelectorIter<'a, SelectorImpl>) -> Bucket<'a> { Bucket::Root => return new_bucket, Bucket::ID(..) => { current_bucket = new_bucket; - } + }, Bucket::Class(..) => { if !matches!(current_bucket, Bucket::ID(..)) { current_bucket = new_bucket; @@ -549,7 +555,7 @@ fn find_bucket<'a>(mut iter: SelectorIter<'a, SelectorImpl>) -> Bucket<'a> { if matches!(current_bucket, Bucket::Universal) { current_bucket = new_bucket; } - } + }, Bucket::Universal => {}, } } diff --git a/components/style/servo/restyle_damage.rs b/components/style/servo/restyle_damage.rs index 5cde20c9658..7b49a592751 100644 --- a/components/style/servo/restyle_damage.rs +++ b/components/style/servo/restyle_damage.rs @@ -80,9 +80,12 @@ impl ServoRestyleDamage { /// FIXME(bholley): Do we ever actually need this? Shouldn't /// RECONSTRUCT_FLOW imply everything else? pub fn rebuild_and_reflow() -> ServoRestyleDamage { - ServoRestyleDamage::REPAINT | ServoRestyleDamage::REPOSITION | - ServoRestyleDamage::STORE_OVERFLOW | ServoRestyleDamage::BUBBLE_ISIZES | - ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW | + ServoRestyleDamage::REPAINT | + ServoRestyleDamage::REPOSITION | + ServoRestyleDamage::STORE_OVERFLOW | + ServoRestyleDamage::BUBBLE_ISIZES | + ServoRestyleDamage::REFLOW_OUT_OF_FLOW | + ServoRestyleDamage::REFLOW | ServoRestyleDamage::RECONSTRUCT_FLOW } @@ -95,12 +98,14 @@ impl ServoRestyleDamage { /// returns the damage that we should add to the *parent* of this flow. pub fn damage_for_parent(self, child_is_absolutely_positioned: bool) -> ServoRestyleDamage { if child_is_absolutely_positioned { - self & (ServoRestyleDamage::REPAINT | ServoRestyleDamage::REPOSITION | + self & (ServoRestyleDamage::REPAINT | + ServoRestyleDamage::REPOSITION | ServoRestyleDamage::STORE_OVERFLOW | ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::RESOLVE_GENERATED_CONTENT) } else { - self & (ServoRestyleDamage::REPAINT | ServoRestyleDamage::REPOSITION | + self & (ServoRestyleDamage::REPAINT | + ServoRestyleDamage::REPOSITION | ServoRestyleDamage::STORE_OVERFLOW | ServoRestyleDamage::REFLOW | ServoRestyleDamage::REFLOW_OUT_OF_FLOW | @@ -136,7 +141,8 @@ impl ServoRestyleDamage { }, _ => { // TODO(pcwalton): Take floatedness into account. - self & (ServoRestyleDamage::REPAINT | ServoRestyleDamage::REPOSITION | + self & (ServoRestyleDamage::REPAINT | + ServoRestyleDamage::REPOSITION | ServoRestyleDamage::REFLOW) }, } @@ -205,22 +211,21 @@ fn compute_damage(old: &ComputedValues, new: &ComputedValues) -> ServoRestyleDam ServoRestyleDamage::REFLOW, ServoRestyleDamage::RECONSTRUCT_FLOW ] - ) || - (new.get_box().display == Display::Inline && - restyle_damage_rebuild_and_reflow_inline!( - old, - new, - damage, - [ - ServoRestyleDamage::REPAINT, - ServoRestyleDamage::REPOSITION, - ServoRestyleDamage::STORE_OVERFLOW, - ServoRestyleDamage::BUBBLE_ISIZES, - ServoRestyleDamage::REFLOW_OUT_OF_FLOW, - ServoRestyleDamage::REFLOW, - ServoRestyleDamage::RECONSTRUCT_FLOW - ] - )) || + ) || (new.get_box().display == Display::Inline && + restyle_damage_rebuild_and_reflow_inline!( + old, + new, + damage, + [ + ServoRestyleDamage::REPAINT, + ServoRestyleDamage::REPOSITION, + ServoRestyleDamage::STORE_OVERFLOW, + ServoRestyleDamage::BUBBLE_ISIZES, + ServoRestyleDamage::REFLOW_OUT_OF_FLOW, + ServoRestyleDamage::REFLOW, + ServoRestyleDamage::RECONSTRUCT_FLOW + ] + )) || restyle_damage_reflow!( old, new, @@ -244,7 +249,8 @@ fn compute_damage(old: &ComputedValues, new: &ComputedValues) -> ServoRestyleDam ServoRestyleDamage::STORE_OVERFLOW, ServoRestyleDamage::REFLOW_OUT_OF_FLOW ] - ) || restyle_damage_repaint!(old, new, damage, [ServoRestyleDamage::REPAINT]); + ) || + restyle_damage_repaint!(old, new, damage, [ServoRestyleDamage::REPAINT]); // Paint worklets may depend on custom properties, // so if they have changed we should repaint. diff --git a/components/style/servo/selector_parser.rs b/components/style/servo/selector_parser.rs index c608cd8488d..7c1e082022d 100644 --- a/components/style/servo/selector_parser.rs +++ b/components/style/servo/selector_parser.rs @@ -137,7 +137,9 @@ impl PseudoElement { /// Whether this is an unknown ::-webkit- pseudo-element. #[inline] - pub fn is_unknown_webkit_pseudo_element(&self) -> bool { false } + pub fn is_unknown_webkit_pseudo_element(&self) -> bool { + false + } /// Whether this pseudo-element is the ::before pseudo. #[inline] @@ -766,7 +768,8 @@ impl ServoElementSnapshot { operation: &AttrSelectorOperation<&String>, ) -> bool { match *ns { - NamespaceConstraint::Specific(ref ns) => self.get_attr(ns, local_name) + NamespaceConstraint::Specific(ref ns) => self + .get_attr(ns, local_name) .map_or(false, |value| value.eval_selector(operation)), NamespaceConstraint::Any => { self.any_attr_ignore_ns(local_name, |value| value.eval_selector(operation)) diff --git a/components/style/sharing/mod.rs b/components/style/sharing/mod.rs index d6148d16b49..b3177216f64 100644 --- a/components/style/sharing/mod.rs +++ b/components/style/sharing/mod.rs @@ -197,8 +197,7 @@ impl ValidationData { let values = OpaqueComputedValues::from(parent.borrow_data().unwrap().styles.primary()); values - }) - .clone() + }).clone() } /// Computes the revalidation results if needed, and returns it. diff --git a/components/style/style_adjuster.rs b/components/style/style_adjuster.rs index 704c875a932..7c65798286e 100644 --- a/components/style/style_adjuster.rs +++ b/components/style/style_adjuster.rs @@ -64,10 +64,21 @@ where // FIXME(emilio): This should be an actual static. lazy_static! { static ref SPECIAL_HTML_ELEMENTS: [Atom; 16] = [ - atom!("br"), atom!("wbr"), atom!("meter"), atom!("progress"), - atom!("canvas"), atom!("embed"), atom!("object"), atom!("audio"), - atom!("iframe"), atom!("img"), atom!("video"), atom!("frame"), - atom!("frameset"), atom!("input"), atom!("textarea"), + atom!("br"), + atom!("wbr"), + atom!("meter"), + atom!("progress"), + atom!("canvas"), + atom!("embed"), + atom!("object"), + atom!("audio"), + atom!("iframe"), + atom!("img"), + atom!("video"), + atom!("frame"), + atom!("frameset"), + atom!("input"), + atom!("textarea"), atom!("select"), ]; } @@ -79,15 +90,21 @@ where // UA implements this either. lazy_static! { static ref SPECIAL_SVG_ELEMENTS: [Atom; 6] = [ - atom!("svg"), atom!("a"), atom!("g"), atom!("use"), - atom!("tspan"), atom!("textPath"), + atom!("svg"), + atom!("a"), + atom!("g"), + atom!("use"), + atom!("tspan"), + atom!("textPath"), ]; } // https://drafts.csswg.org/css-display/#unbox-html if element.is_html_element() { let local_name = element.local_name(); - return SPECIAL_HTML_ELEMENTS.iter().any(|name| &**name == local_name); + return SPECIAL_HTML_ELEMENTS + .iter() + .any(|name| &**name == local_name); } // https://drafts.csswg.org/css-display/#unbox-svg @@ -96,7 +113,9 @@ where return true; } let local_name = element.local_name(); - return !SPECIAL_SVG_ELEMENTS.iter().any(|name| &**name == local_name); + return !SPECIAL_SVG_ELEMENTS + .iter() + .any(|name| &**name == local_name); } // https://drafts.csswg.org/css-display/#unbox-mathml @@ -201,11 +220,11 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { pub fn set_bits(&mut self) { let display = self.style.get_box().clone_display(); - if !display.is_contents() && - !self.style - .get_text() - .clone_text_decoration_line() - .is_empty() + if !display.is_contents() && !self + .style + .get_text() + .clone_text_decoration_line() + .is_empty() { self.style .flags @@ -280,10 +299,10 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { #[cfg(feature = "gecko")] fn adjust_for_text_in_ruby(&mut self) { let parent_display = self.style.get_parent_box().clone_display(); - if parent_display.is_ruby_type() || - self.style - .get_parent_flags() - .contains(ComputedValueFlags::SHOULD_SUPPRESS_LINEBREAK) + if parent_display.is_ruby_type() || self + .style + .get_parent_flags() + .contains(ComputedValueFlags::SHOULD_SUPPRESS_LINEBREAK) { self.style .flags @@ -370,10 +389,12 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { /// The initial value of outline-width may be changed at computed value time. fn adjust_for_outline(&mut self) { - if self.style + if self + .style .get_outline() .clone_outline_style() - .none_or_hidden() && self.style.get_outline().outline_has_nonzero_width() + .none_or_hidden() && + self.style.get_outline().outline_has_nonzero_width() { self.style.mutate_outline().set_outline_width(Au(0).into()); } @@ -517,7 +538,9 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { let decorations_in_effect = TextDecorationsInEffect::from_style(&self.style); if self.style.get_inherited_text().text_decorations_in_effect != decorations_in_effect { - self.style.mutate_inherited_text().text_decorations_in_effect = decorations_in_effect; + self.style + .mutate_inherited_text() + .text_decorations_in_effect = decorations_in_effect; } } @@ -677,11 +700,8 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { /// When comparing to Gecko, this is similar to the work done by /// `ComputedStyle::ApplyStyleFixups`, plus some parts of /// `nsStyleSet::GetContext`. - pub fn adjust<E>( - &mut self, - layout_parent_style: &ComputedValues, - element: Option<E>, - ) where + pub fn adjust<E>(&mut self, layout_parent_style: &ComputedValues, element: Option<E>) + where E: TElement, { if cfg!(debug_assertions) { diff --git a/components/style/style_resolver.rs b/components/style/style_resolver.rs index b31beff7460..0899faa9ce7 100644 --- a/components/style/style_resolver.rs +++ b/components/style/style_resolver.rs @@ -190,8 +190,7 @@ where ) -> PrimaryStyle { // Before doing the cascade, check the sharing cache and see if we can // reuse the style via rule node identity. - let may_reuse = - !self.element.is_in_native_anonymous_subtree() && + let may_reuse = !self.element.is_in_native_anonymous_subtree() && parent_style.is_some() && inputs.rules.is_some(); @@ -485,7 +484,8 @@ where let stylist = &self.context.shared.stylist; - if !self.element + if !self + .element .may_generate_pseudo(pseudo_element, originating_element_style) { return None; diff --git a/components/style/stylesheet_set.rs b/components/style/stylesheet_set.rs index a3b6e5cdc17..19790aba957 100644 --- a/components/style/stylesheet_set.rs +++ b/components/style/stylesheet_set.rs @@ -324,7 +324,8 @@ where fn insert_before(&mut self, sheet: S, before_sheet: &S) { debug_assert!(!self.contains(&sheet)); - let index = self.entries + let index = self + .entries .iter() .position(|entry| entry.sheet == *before_sheet) .expect("`before_sheet` stylesheet not found"); diff --git a/components/style/stylesheets/document_rule.rs b/components/style/stylesheets/document_rule.rs index 56750ae7b66..9598763e438 100644 --- a/components/style/stylesheets/document_rule.rs +++ b/components/style/stylesheets/document_rule.rs @@ -109,7 +109,7 @@ pub enum DocumentMatchingFunction { Regexp(String), /// Matching function for a media document. #[css(function)] - MediaDocument(MediaDocumentKind) + MediaDocument(MediaDocumentKind), } macro_rules! parse_quoted_or_unquoted_string { @@ -120,8 +120,7 @@ macro_rules! parse_quoted_or_unquoted_string { .parse_entirely(|input| { let string = input.expect_string()?; Ok($url_matching_function(string.as_ref().to_owned())) - }) - .or_else(|_: ParseError| { + }).or_else(|_: ParseError| { while let Ok(_) = input.next() {} Ok($url_matching_function(input.slice_from(start).to_string())) }) @@ -136,7 +135,7 @@ impl DocumentMatchingFunction { input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i>> { if let Ok(url) = input.try(|input| CssUrl::parse(context, input)) { - return Ok(DocumentMatchingFunction::Url(url)) + return Ok(DocumentMatchingFunction::Url(url)); } let location = input.current_source_location(); @@ -181,7 +180,9 @@ impl DocumentMatchingFunction { DocumentMatchingFunction::UrlPrefix(_) => GeckoDocumentMatchingFunction::URLPrefix, DocumentMatchingFunction::Domain(_) => GeckoDocumentMatchingFunction::Domain, DocumentMatchingFunction::Regexp(_) => GeckoDocumentMatchingFunction::RegExp, - DocumentMatchingFunction::MediaDocument(_) => GeckoDocumentMatchingFunction::MediaDocument, + DocumentMatchingFunction::MediaDocument(_) => { + GeckoDocumentMatchingFunction::MediaDocument + }, }; let pattern = nsCStr::from(match *self { @@ -189,14 +190,12 @@ impl DocumentMatchingFunction { DocumentMatchingFunction::UrlPrefix(ref pat) | DocumentMatchingFunction::Domain(ref pat) | DocumentMatchingFunction::Regexp(ref pat) => pat, - DocumentMatchingFunction::MediaDocument(kind) => { - match kind { - MediaDocumentKind::All => "all", - MediaDocumentKind::Image => "image", - MediaDocumentKind::Plugin => "plugin", - MediaDocumentKind::Video => "video", - } - } + DocumentMatchingFunction::MediaDocument(kind) => match kind { + MediaDocumentKind::All => "all", + MediaDocumentKind::Image => "image", + MediaDocumentKind::Plugin => "plugin", + MediaDocumentKind::Video => "video", + }, }); unsafe { Gecko_DocumentRule_UseForPresentation(device.pres_context(), &*pattern, func) } } diff --git a/components/style/stylesheets/font_feature_values_rule.rs b/components/style/stylesheets/font_feature_values_rule.rs index c70a46c1c9d..76170151c67 100644 --- a/components/style/stylesheets/font_feature_values_rule.rs +++ b/components/style/stylesheets/font_feature_values_rule.rs @@ -70,7 +70,8 @@ impl Parse for SingleValue { match *input.next()? { Token::Number { int_value: Some(v), .. - } if v >= 0 => + } + if v >= 0 => { Ok(SingleValue(v as u32)) }, @@ -102,7 +103,8 @@ impl Parse for PairValues { let first = match *input.next()? { Token::Number { int_value: Some(a), .. - } if a >= 0 => + } + if a >= 0 => { a as u32 }, @@ -112,7 +114,8 @@ impl Parse for PairValues { match input.next() { Ok(&Token::Number { int_value: Some(b), .. - }) if b >= 0 => + }) + if b >= 0 => { Ok(PairValues(first, Some(b as u32))) }, @@ -154,7 +157,8 @@ impl Parse for VectorValues { match input.next() { Ok(&Token::Number { int_value: Some(a), .. - }) if a >= 0 => + }) + if a >= 0 => { vec.push(a as u32); } diff --git a/components/style/stylesheets/keyframes_rule.rs b/components/style/stylesheets/keyframes_rule.rs index 0246efa6780..50c61047e52 100644 --- a/components/style/stylesheets/keyframes_rule.rs +++ b/components/style/stylesheets/keyframes_rule.rs @@ -82,16 +82,14 @@ impl DeepCloneWithLock for KeyframesRule { ) -> Self { KeyframesRule { name: self.name.clone(), - keyframes: self.keyframes + keyframes: self + .keyframes .iter() .map(|x| { - Arc::new(lock.wrap(x.read_with(guard).deep_clone_with_lock( - lock, - guard, - params, - ))) - }) - .collect(), + Arc::new( + lock.wrap(x.read_with(guard).deep_clone_with_lock(lock, guard, params)), + ) + }).collect(), vendor_prefix: self.vendor_prefix.clone(), source_location: self.source_location.clone(), } @@ -142,7 +140,8 @@ impl KeyframePercentage { Token::Percentage { unit_value: percentage, .. - } if percentage >= 0. && percentage <= 1. => + } + if percentage >= 0. && percentage <= 1. => { Ok(KeyframePercentage::new(percentage)) }, @@ -261,8 +260,10 @@ pub enum KeyframesStepValue { /// A step formed by a declaration block specified by the CSS. Declarations { /// The declaration block per se. - #[cfg_attr(feature = "gecko", - ignore_malloc_size_of = "XXX: Primary ref, measure if DMD says it's worthwhile")] + #[cfg_attr( + feature = "gecko", + ignore_malloc_size_of = "XXX: Primary ref, measure if DMD says it's worthwhile" + )] #[cfg_attr(feature = "servo", ignore_malloc_size_of = "Arc")] block: Arc<Locked<PropertyDeclarationBlock>>, }, @@ -326,8 +327,7 @@ impl KeyframesStep { let (declaration, _) = guard .get(PropertyDeclarationId::Longhand( LonghandId::AnimationTimingFunction, - )) - .unwrap(); + )).unwrap(); match *declaration { PropertyDeclaration::AnimationTimingFunction(ref value) => { // Use the first value. @@ -500,7 +500,7 @@ pub fn parse_keyframe_list( declarations: &mut declarations, }, ).filter_map(Result::ok) - .collect() + .collect() } impl<'a, 'i> AtRuleParser<'i> for KeyframeListParser<'a> { @@ -525,7 +525,7 @@ impl<'a, 'i> QualifiedRuleParser<'i> for KeyframeListParser<'a> { let error = ContextualParseError::InvalidKeyframeRule( input.slice_from(start_position), e.clone(), - ); + ); self.context.log_css_error(location, error); e }) @@ -552,10 +552,7 @@ impl<'a, 'i> QualifiedRuleParser<'i> for KeyframeListParser<'a> { while let Some(declaration) = iter.next() { match declaration { Ok(()) => { - block.extend( - iter.parser.declarations.drain(), - Importance::Normal, - ); + block.extend(iter.parser.declarations.drain(), Importance::Normal); }, Err((error, slice)) => { iter.parser.declarations.clear(); @@ -599,9 +596,9 @@ impl<'a, 'b, 'i> DeclarationParser<'i> for KeyframeDeclarationParser<'a, 'b> { ) -> Result<(), ParseError<'i>> { let id = match PropertyId::parse(&name, self.context) { Ok(id) => id, - Err(()) => return Err(input.new_custom_error( - StyleParseErrorKind::UnknownProperty(name) - )), + Err(()) => { + return Err(input.new_custom_error(StyleParseErrorKind::UnknownProperty(name))) + }, }; // TODO(emilio): Shouldn't this use parse_entirely? diff --git a/components/style/stylesheets/mod.rs b/components/style/stylesheets/mod.rs index 80766c289f8..5058ad94e80 100644 --- a/components/style/stylesheets/mod.rs +++ b/components/style/stylesheets/mod.rs @@ -63,7 +63,7 @@ pub type UrlExtraData = ::servo_url::ServoUrl; #[cfg(feature = "gecko")] #[derive(Clone, PartialEq)] pub struct UrlExtraData( - pub ::gecko_bindings::sugar::refptr::RefPtr<::gecko_bindings::structs::URLExtraData> + pub ::gecko_bindings::sugar::refptr::RefPtr<::gecko_bindings::structs::URLExtraData>, ); #[cfg(feature = "gecko")] @@ -102,11 +102,14 @@ impl fmt::Debug for UrlExtraData { } } - formatter.debug_struct("URLExtraData") + formatter + .debug_struct("URLExtraData") .field("is_chrome", &self.is_chrome()) .field("base", &DebugURI(self.0.mBaseURI.raw::<structs::nsIURI>())) - .field("referrer", &DebugURI(self.0.mReferrer.raw::<structs::nsIURI>())) - .finish() + .field( + "referrer", + &DebugURI(self.0.mReferrer.raw::<structs::nsIURI>()), + ).finish() } } @@ -285,9 +288,7 @@ impl CssRule { }; parse_one_rule(&mut input, &mut rule_parser) - .map_err(|_| { - rule_parser.dom_error.unwrap_or(RulesMutateError::Syntax) - }) + .map_err(|_| rule_parser.dom_error.unwrap_or(RulesMutateError::Syntax)) } } @@ -305,25 +306,22 @@ impl DeepCloneWithLock for CssRule { CssRule::Namespace(Arc::new(lock.wrap(rule.clone()))) }, CssRule::Import(ref arc) => { - let rule = arc.read_with(guard) + let rule = arc + .read_with(guard) .deep_clone_with_lock(lock, guard, params); CssRule::Import(Arc::new(lock.wrap(rule))) }, CssRule::Style(ref arc) => { let rule = arc.read_with(guard); - CssRule::Style(Arc::new(lock.wrap(rule.deep_clone_with_lock( - lock, - guard, - params, - )))) + CssRule::Style(Arc::new( + lock.wrap(rule.deep_clone_with_lock(lock, guard, params)), + )) }, CssRule::Media(ref arc) => { let rule = arc.read_with(guard); - CssRule::Media(Arc::new(lock.wrap(rule.deep_clone_with_lock( - lock, - guard, - params, - )))) + CssRule::Media(Arc::new( + lock.wrap(rule.deep_clone_with_lock(lock, guard, params)), + )) }, CssRule::FontFace(ref arc) => { let rule = arc.read_with(guard); @@ -343,35 +341,27 @@ impl DeepCloneWithLock for CssRule { }, CssRule::Keyframes(ref arc) => { let rule = arc.read_with(guard); - CssRule::Keyframes(Arc::new(lock.wrap(rule.deep_clone_with_lock( - lock, - guard, - params, - )))) + CssRule::Keyframes(Arc::new( + lock.wrap(rule.deep_clone_with_lock(lock, guard, params)), + )) }, CssRule::Supports(ref arc) => { let rule = arc.read_with(guard); - CssRule::Supports(Arc::new(lock.wrap(rule.deep_clone_with_lock( - lock, - guard, - params, - )))) + CssRule::Supports(Arc::new( + lock.wrap(rule.deep_clone_with_lock(lock, guard, params)), + )) }, CssRule::Page(ref arc) => { let rule = arc.read_with(guard); - CssRule::Page(Arc::new(lock.wrap(rule.deep_clone_with_lock( - lock, - guard, - params, - )))) + CssRule::Page(Arc::new( + lock.wrap(rule.deep_clone_with_lock(lock, guard, params)), + )) }, CssRule::Document(ref arc) => { let rule = arc.read_with(guard); - CssRule::Document(Arc::new(lock.wrap(rule.deep_clone_with_lock( - lock, - guard, - params, - )))) + CssRule::Document(Arc::new( + lock.wrap(rule.deep_clone_with_lock(lock, guard, params)), + )) }, } } diff --git a/components/style/stylesheets/rule_list.rs b/components/style/stylesheets/rule_list.rs index 35edc22b3da..cfbf62ea721 100644 --- a/components/style/stylesheets/rule_list.rs +++ b/components/style/stylesheets/rule_list.rs @@ -156,7 +156,11 @@ impl CssRulesHelpers for RawOffsetArc<Locked<CssRules>> { } else if index == 0 { State::Start } else { - rules.0.get(index - 1).map(CssRule::rule_state).unwrap_or(State::Body) + rules + .0 + .get(index - 1) + .map(CssRule::rule_state) + .unwrap_or(State::Body) }; let insert_rule_context = InsertRuleContext { diff --git a/components/style/stylesheets/rule_parser.rs b/components/style/stylesheets/rule_parser.rs index d2f9b691ad4..683378b9b96 100644 --- a/components/style/stylesheets/rule_parser.rs +++ b/components/style/stylesheets/rule_parser.rs @@ -110,8 +110,9 @@ impl<'b> TopLevelRuleParser<'b> { // If there's anything that isn't a namespace rule (or import rule, but // we checked that already at the beginning), reject with a // StateError. - if new_state == State::Namespaces && - ctx.rule_list[ctx.index..].iter().any(|r| !matches!(*r, CssRule::Namespace(..))) + if new_state == State::Namespaces && ctx.rule_list[ctx.index..] + .iter() + .any(|r| !matches!(*r, CssRule::Namespace(..))) { self.dom_error = Some(RulesMutateError::InvalidState); return false; @@ -227,7 +228,7 @@ impl<'a, 'i> AtRuleParser<'i> for TopLevelRuleParser<'a> { } if !self.check_state(State::Body) { - return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)) + return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)); } AtRuleParser::parse_prelude(&mut self.nested(), name, input) @@ -254,7 +255,8 @@ impl<'a, 'i> AtRuleParser<'i> for TopLevelRuleParser<'a> { ) -> CssRule { match prelude { AtRuleNonBlockPrelude::Import(url, media) => { - let loader = self.loader + let loader = self + .loader .expect("Expected a stylesheet loader for @import"); let import_rule = loader.request_stylesheet( @@ -299,7 +301,7 @@ impl<'a, 'i> QualifiedRuleParser<'i> for TopLevelRuleParser<'a> { input: &mut Parser<'i, 't>, ) -> Result<Self::Prelude, ParseError<'i>> { if !self.check_state(State::Body) { - return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)) + return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)); } QualifiedRuleParser::parse_prelude(&mut self.nested(), input) @@ -312,15 +314,12 @@ impl<'a, 'i> QualifiedRuleParser<'i> for TopLevelRuleParser<'a> { location: SourceLocation, input: &mut Parser<'i, 't>, ) -> Result<CssRule, ParseError<'i>> { - QualifiedRuleParser::parse_block( - &mut self.nested(), - prelude, - location, - input, - ).map(|result| { - self.state = State::Body; - result - }) + QualifiedRuleParser::parse_block(&mut self.nested(), prelude, location, input).map( + |result| { + self.state = State::Body; + result + }, + ) } } @@ -338,11 +337,7 @@ impl<'a, 'b> NestedRuleParser<'a, 'b> { input: &mut Parser, rule_type: CssRuleType, ) -> Arc<Locked<CssRules>> { - let context = ParserContext::new_with_rule_type( - self.context, - rule_type, - self.namespaces, - ); + let context = ParserContext::new_with_rule_type(self.context, rule_type, self.namespaces); let nested_parser = NestedRuleParser { stylesheet_origin: self.stylesheet_origin, @@ -478,12 +473,7 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> { ); Ok(CssRule::FontFeatureValues(Arc::new(self.shared_lock.wrap( - FontFeatureValuesRule::parse( - &context, - input, - family_names, - source_location, - ), + FontFeatureValuesRule::parse(&context, input, family_names, source_location), )))) }, AtRuleBlockPrelude::CounterStyle(name) => { @@ -493,16 +483,9 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> { self.namespaces, ); - Ok(CssRule::CounterStyle(Arc::new( - self.shared_lock.wrap( - parse_counter_style_body( - name, - &context, - input, - source_location, - )?.into(), - ), - ))) + Ok(CssRule::CounterStyle(Arc::new(self.shared_lock.wrap( + parse_counter_style_body(name, &context, input, source_location)?.into(), + )))) }, AtRuleBlockPrelude::Media(media_queries) => { Ok(CssRule::Media(Arc::new(self.shared_lock.wrap(MediaRule { @@ -535,9 +518,9 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> { self.namespaces, ); - Ok(CssRule::Viewport(Arc::new(self.shared_lock.wrap( - ViewportRule::parse(&context, input)?, - )))) + Ok(CssRule::Viewport(Arc::new( + self.shared_lock.wrap(ViewportRule::parse(&context, input)?), + ))) }, AtRuleBlockPrelude::Keyframes(name, vendor_prefix) => { let context = ParserContext::new_with_rule_type( @@ -549,11 +532,7 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> { Ok(CssRule::Keyframes(Arc::new(self.shared_lock.wrap( KeyframesRule { name, - keyframes: parse_keyframe_list( - &context, - input, - self.shared_lock, - ), + keyframes: parse_keyframe_list(&context, input, self.shared_lock), vendor_prefix, source_location, }, @@ -566,8 +545,7 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> { self.namespaces, ); - let declarations = - parse_property_declaration_list(&context, input); + let declarations = parse_property_declaration_list(&context, input); Ok(CssRule::Page(Arc::new(self.shared_lock.wrap(PageRule { block: Arc::new(self.shared_lock.wrap(declarations)), source_location, diff --git a/components/style/stylesheets/rules_iterator.rs b/components/style/stylesheets/rules_iterator.rs index b46e24c22c7..eac6d2084e2 100644 --- a/components/style/stylesheets/rules_iterator.rs +++ b/components/style/stylesheets/rules_iterator.rs @@ -100,10 +100,7 @@ where ) { continue; } - import_rule - .stylesheet - .rules(self.guard) - .iter() + import_rule.stylesheet.rules(self.guard).iter() }, CssRule::Document(ref doc_rule) => { let doc_rule = doc_rule.read_with(self.guard); diff --git a/components/style/stylesheets/stylesheet.rs b/components/style/stylesheets/stylesheet.rs index 1403a1d2547..e1359cb3722 100644 --- a/components/style/stylesheets/stylesheet.rs +++ b/components/style/stylesheets/stylesheet.rs @@ -129,7 +129,8 @@ impl DeepCloneWithLock for StylesheetContents { params: &DeepCloneParams, ) -> Self { // Make a deep clone of the rules, using the new lock. - let rules = self.rules + let rules = self + .rules .read_with(guard) .deep_clone_with_lock(lock, guard, params); @@ -179,7 +180,7 @@ macro_rules! rule_filter { } /// A trait to represent a given stylesheet in a document. -pub trait StylesheetInDocument : ::std::fmt::Debug { +pub trait StylesheetInDocument: ::std::fmt::Debug { /// Get the stylesheet origin. fn origin(&self, guard: &SharedRwLockReadGuard) -> Origin; @@ -399,10 +400,7 @@ impl Stylesheet { Err((error, slice)) => { let location = error.location; let error = ContextualParseError::InvalidRule(slice, error); - iter.parser.context.log_css_error( - location, - error, - ); + iter.parser.context.log_css_error(location, error); }, } } @@ -478,7 +476,8 @@ impl Clone for Stylesheet { // Make a deep clone of the media, using the new lock. let media = self.media.read_with(&guard).clone(); let media = Arc::new(lock.wrap(media)); - let contents = self.contents + let contents = self + .contents .deep_clone_with_lock(&lock, &guard, &DeepCloneParams); Stylesheet { diff --git a/components/style/stylesheets/supports_rule.rs b/components/style/stylesheets/supports_rule.rs index f8c3235f295..2851d8914dd 100644 --- a/components/style/stylesheets/supports_rule.rs +++ b/components/style/stylesheets/supports_rule.rs @@ -168,9 +168,7 @@ impl SupportsCondition { i.expect_string() .map(|s| s.to_string()) .map_err(CssParseError::<()>::from) - }).and_then(|s| { - CString::new(s).map_err(|_| location.new_custom_error(())) - }) + }).and_then(|s| CString::new(s).map_err(|_| location.new_custom_error(()))) }) { return Ok(SupportsCondition::MozBoolPref(name)); } @@ -315,24 +313,21 @@ impl Declaration { let mut input = ParserInput::new(&self.0); let mut input = Parser::new(&mut input); - input.parse_entirely(|input| -> Result<(), CssParseError<()>> { - let prop = input.expect_ident_cloned().unwrap(); - input.expect_colon().unwrap(); + input + .parse_entirely(|input| -> Result<(), CssParseError<()>> { + let prop = input.expect_ident_cloned().unwrap(); + input.expect_colon().unwrap(); - let id = PropertyId::parse(&prop, context) - .map_err(|_| input.new_custom_error(()))?; + let id = + PropertyId::parse(&prop, context).map_err(|_| input.new_custom_error(()))?; - let mut declarations = SourcePropertyDeclaration::new(); - input.parse_until_before(Delimiter::Bang, |input| { - PropertyDeclaration::parse_into( - &mut declarations, - id, - &context, - input, - ).map_err(|_| input.new_custom_error(())) - })?; - let _ = input.try(parse_important); - Ok(()) - }).is_ok() + let mut declarations = SourcePropertyDeclaration::new(); + input.parse_until_before(Delimiter::Bang, |input| { + PropertyDeclaration::parse_into(&mut declarations, id, &context, input) + .map_err(|_| input.new_custom_error(())) + })?; + let _ = input.try(parse_important); + Ok(()) + }).is_ok() } } diff --git a/components/style/stylesheets/viewport_rule.rs b/components/style/stylesheets/viewport_rule.rs index 1fc6a988c7c..16bffd14ab2 100644 --- a/components/style/stylesheets/viewport_rule.rs +++ b/components/style/stylesheets/viewport_rule.rs @@ -375,8 +375,7 @@ impl ViewportRule { Err((error, slice)) => { let location = error.location; let error = ContextualParseError::UnsupportedViewportDescriptorDeclaration( - slice, - error, + slice, error, ); context.log_css_error(location, error); }, @@ -760,9 +759,9 @@ impl MaybeNew for ViewportConstraints { Some(initial_viewport.$dimension.scale_by(value.0)) }, LengthOrPercentageOrAuto::Auto => None, - LengthOrPercentageOrAuto::Calc(ref calc) => calc.to_computed_value( - &context, - ).to_used_value(Some(initial_viewport.$dimension)), + LengthOrPercentageOrAuto::Calc(ref calc) => calc + .to_computed_value(&context) + .to_used_value(Some(initial_viewport.$dimension)), }, ViewportLength::ExtendToZoom => { // $extend_to will be 'None' if 'extend-to-zoom' is 'auto' diff --git a/components/style/stylist.rs b/components/style/stylist.rs index e9cd63e738a..c933897f858 100644 --- a/components/style/stylist.rs +++ b/components/style/stylist.rs @@ -184,8 +184,10 @@ impl UserAgentCascadeData { #[derive(Default)] #[cfg_attr(feature = "servo", derive(MallocSizeOf))] struct DocumentCascadeData { - #[cfg_attr(feature = "servo", - ignore_malloc_size_of = "Arc, owned by UserAgentCascadeDataCache")] + #[cfg_attr( + feature = "servo", + ignore_malloc_size_of = "Arc, owned by UserAgentCascadeDataCache" + )] user_agent: Arc<UserAgentCascadeData>, user: CascadeData, author: CascadeData, @@ -350,7 +352,10 @@ pub struct Stylist { stylesheets: StylistStylesheetSet, /// If true, the quirks-mode stylesheet is applied. - #[cfg_attr(feature = "servo", ignore_malloc_size_of = "defined in selectors")] + #[cfg_attr( + feature = "servo", + ignore_malloc_size_of = "defined in selectors" + )] quirks_mode: QuirksMode, /// Selector maps for all of the style sheets in the stylist, after @@ -681,7 +686,8 @@ impl Stylist { extra_declarations: Option<Vec<ApplicableDeclarationBlock>>, ) -> StrongRuleNode { let mut decl; - let declarations = match self.cascade_data + let declarations = match self + .cascade_data .user_agent .precomputed_pseudo_element_decls .get(pseudo) @@ -852,7 +858,7 @@ impl Stylist { } else { None } - } + }, }; // Read the comment on `precomputed_values_for_pseudo` to see why it's @@ -1131,7 +1137,8 @@ impl Stylist { let matches_user_rules = rule_hash_target.matches_user_and_author_rules(); // Normal user-agent rules. - if let Some(map) = self.cascade_data + if let Some(map) = self + .cascade_data .user_agent .cascade_data .normal_rules(pseudo_element) @@ -1207,7 +1214,10 @@ impl Stylist { // for !important it should be the other way around. So probably we need // to add some sort of AuthorScoped cascade level or something. if let Some(shadow) = rule_hash_target.shadow_root() { - if let Some(map) = shadow.style_data().and_then(|data| data.host_rules(pseudo_element)) { + if let Some(map) = shadow + .style_data() + .and_then(|data| data.host_rules(pseudo_element)) + { context.with_shadow_host(Some(rule_hash_target), |context| { map.get_all_matching_rules( element, @@ -1234,7 +1244,10 @@ impl Stylist { for slot in slots.iter().rev() { let shadow = slot.containing_shadow().unwrap(); - if let Some(map) = shadow.style_data().and_then(|data| data.slotted_rules(pseudo_element)) { + if let Some(map) = shadow + .style_data() + .and_then(|data| data.slotted_rules(pseudo_element)) + { context.with_shadow_host(Some(shadow.host()), |context| { map.get_all_matching_rules( element, @@ -1270,8 +1283,7 @@ impl Stylist { } let host_is_svg_use_element = - host.is_svg_element() && - host.local_name() == &*local_name!("use"); + host.is_svg_element() && host.local_name() == &*local_name!("use"); if !host_is_svg_use_element { match_document_author_rules = false; @@ -1406,11 +1418,7 @@ impl Stylist { /// Returns the registered `@keyframes` animation for the specified name. #[inline] - pub fn get_animation<'a, E>( - &'a self, - name: &Atom, - element: E, - ) -> Option<&'a KeyframesAnimation> + pub fn get_animation<'a, E>(&'a self, name: &Atom, element: E) -> Option<&'a KeyframesAnimation> where E: TElement + 'a, { @@ -1419,7 +1427,7 @@ impl Stylist { if let Some(animation) = $data.animations.get(name) { return Some(animation); } - } + }; } // NOTE(emilio): We implement basically what Blink does for this case, @@ -1547,10 +1555,12 @@ impl Stylist { let block = declarations.read_with(guards.author); let iter_declarations = || { - block.declaration_importance_iter().map(|(declaration, importance)| { - debug_assert!(!importance.important()); - (declaration, CascadeLevel::StyleAttributeNormal) - }) + block + .declaration_importance_iter() + .map(|(declaration, importance)| { + debug_assert!(!importance.important()); + (declaration, CascadeLevel::StyleAttributeNormal) + }) }; let metrics = get_metrics_provider_for_product(); @@ -1567,7 +1577,9 @@ impl Stylist { Some(parent_style), Some(parent_style), &metrics, - CascadeMode::Unvisited { visited_rules: None }, + CascadeMode::Unvisited { + visited_rules: None, + }, self.quirks_mode, /* rule_cache = */ None, &mut Default::default(), @@ -1703,8 +1715,10 @@ impl MallocSizeOf for ExtraStyleData { #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(Clone, Debug)] struct RevalidationSelectorAndHashes { - #[cfg_attr(feature = "gecko", - ignore_malloc_size_of = "CssRules have primary refs, we measure there")] + #[cfg_attr( + feature = "gecko", + ignore_malloc_size_of = "CssRules have primary refs, we measure there" + )] selector: Selector<SelectorImpl>, selector_offset: usize, hashes: AncestorHashes, @@ -1812,8 +1826,9 @@ impl<'a> SelectorVisitor for StylistSelectorVisitor<'a> { // Also, note that this call happens before we visit any of the simple // selectors in the next ComplexSelector, so we can use this to skip // looking at them. - self.passed_rightmost_selector = self.passed_rightmost_selector || - !matches!(combinator, None | Some(Combinator::PseudoElement)); + self.passed_rightmost_selector = + self.passed_rightmost_selector || + !matches!(combinator, None | Some(Combinator::PseudoElement)); true } @@ -1830,8 +1845,9 @@ impl<'a> SelectorVisitor for StylistSelectorVisitor<'a> { } fn visit_simple_selector(&mut self, s: &Component<SelectorImpl>) -> bool { - self.needs_revalidation = self.needs_revalidation || - component_needs_revalidation(s, self.passed_rightmost_selector); + self.needs_revalidation = + self.needs_revalidation || + component_needs_revalidation(s, self.passed_rightmost_selector); match *s { Component::NonTSPseudoClass(ref p) => { @@ -1883,13 +1899,15 @@ impl ElementAndPseudoRules { pseudo_element: Option<&PseudoElement>, quirks_mode: QuirksMode, ) -> Result<(), FailedAllocationError> { - debug_assert!(pseudo_element.map_or(true, |pseudo| { - !pseudo.is_precomputed() && !pseudo.is_unknown_webkit_pseudo_element() - })); + debug_assert!( + pseudo_element.map_or(true, |pseudo| !pseudo.is_precomputed() && + !pseudo.is_unknown_webkit_pseudo_element()) + ); let map = match pseudo_element { None => &mut self.element_map, - Some(pseudo) => self.pseudos_map + Some(pseudo) => self + .pseudos_map .get_or_insert_with(pseudo, || Box::new(SelectorMap::new())), }; @@ -2259,10 +2277,10 @@ impl CascadeData { debug!("Found valid keyframes rule: {:?}", *keyframes_rule); // Don't let a prefixed keyframes animation override a non-prefixed one. - let needs_insertion = keyframes_rule.vendor_prefix.is_none() || - self.animations - .get(keyframes_rule.name.as_atom()) - .map_or(true, |rule| rule.vendor_prefix.is_some()); + let needs_insertion = keyframes_rule.vendor_prefix.is_none() || self + .animations + .get(keyframes_rule.name.as_atom()) + .map_or(true, |rule| rule.vendor_prefix.is_some()); if needs_insertion { let animation = KeyframesAnimation::from_keyframes( &keyframes_rule.keyframes, @@ -2352,7 +2370,8 @@ impl CascadeData { let effective_now = import_rule .stylesheet .is_effective_for_device(&device, guard); - let effective_then = self.effective_media_query_results + let effective_then = self + .effective_media_query_results .was_effective(import_rule); if effective_now != effective_then { debug!( @@ -2378,9 +2397,7 @@ impl CascadeData { if effective_now != effective_then { debug!( " > @media rule {:?} changed {} -> {}", - mq, - effective_then, - effective_now + mq, effective_then, effective_now ); return false; } @@ -2460,8 +2477,10 @@ pub struct Rule { pub source_order: u32, /// The actual style rule. - #[cfg_attr(feature = "gecko", - ignore_malloc_size_of = "Secondary ref. Primary ref is in StyleRule under Stylesheet.")] + #[cfg_attr( + feature = "gecko", + ignore_malloc_size_of = "Secondary ref. Primary ref is in StyleRule under Stylesheet." + )] #[cfg_attr(feature = "servo", ignore_malloc_size_of = "Arc")] pub style_rule: Arc<Locked<StyleRule>>, } @@ -2486,7 +2505,13 @@ impl Rule { shadow_cascade_order: ShadowCascadeOrder, ) -> ApplicableDeclarationBlock { let source = StyleSource::from_rule(self.style_rule.clone()); - ApplicableDeclarationBlock::new(source, self.source_order, level, self.specificity(), shadow_cascade_order) + ApplicableDeclarationBlock::new( + source, + self.source_order, + level, + self.specificity(), + shadow_cascade_order, + ) } /// Creates a new Rule. diff --git a/components/style/traversal.rs b/components/style/traversal.rs index 0bffd39819c..5f81f3544a9 100644 --- a/components/style/traversal.rs +++ b/components/style/traversal.rs @@ -208,11 +208,11 @@ pub trait DomTraversal<E: TElement>: Sync { // animation-only restyle hint or recascade. if traversal_flags.for_animation_only() { return data.map_or(false, |d| d.has_styles()) && - (el.has_animation_only_dirty_descendants() || - data.as_ref() - .unwrap() - .hint - .has_animation_hint_or_recascade()); + (el.has_animation_only_dirty_descendants() || data + .as_ref() + .unwrap() + .hint + .has_animation_hint_or_recascade()); } // Non-incremental layout visits every node. @@ -279,7 +279,8 @@ pub trait DomTraversal<E: TElement>: Sync { // likely to load valid bindings, we avoid wasted work here, which may // be a very big perf hit when elements with bindings are nested // heavily. - if cfg!(feature = "gecko") && is_initial_style && + if cfg!(feature = "gecko") && + is_initial_style && parent_data.styles.primary().has_moz_binding() { debug!("Parent {:?} has XBL binding, deferring traversal", parent); @@ -384,8 +385,7 @@ where ).resolve_style( style.as_ref().map(|s| &**s), layout_parent_style.as_ref().map(|s| &**s), - ) - .into() + ).into() } /// Calculates the style for a single node. @@ -411,7 +411,8 @@ pub fn recalc_style_at<E, D, F>( context.thread_local.statistics.elements_traversed += 1; debug_assert!( - flags.intersects(TraversalFlags::AnimationOnly) || !element.has_snapshot() || + flags.intersects(TraversalFlags::AnimationOnly) || + !element.has_snapshot() || element.handled_snapshot(), "Should've handled snapshots here already" ); @@ -512,8 +513,9 @@ pub fn recalc_style_at<E, D, F>( !child_cascade_requirement.can_skip_cascade() || is_servo_nonincremental_layout(); - traverse_children = traverse_children && - !traversal.should_cull_subtree(context, element, &data, is_initial_style); + traverse_children = + traverse_children && + !traversal.should_cull_subtree(context, element, &data, is_initial_style); // Examine our children, and enqueue the appropriate ones for traversal. if traverse_children { @@ -535,7 +537,8 @@ pub fn recalc_style_at<E, D, F>( } debug_assert!( - flags.for_animation_only() || !flags.contains(TraversalFlags::ClearDirtyBits) || + flags.for_animation_only() || + !flags.contains(TraversalFlags::ClearDirtyBits) || !element.has_animation_only_dirty_descendants(), "Should have cleared animation bits already" ); diff --git a/components/style/use_counters/mod.rs b/components/style/use_counters/mod.rs index 92bc6adb01a..49c77ae714d 100644 --- a/components/style/use_counters/mod.rs +++ b/components/style/use_counters/mod.rs @@ -71,7 +71,8 @@ impl UseCounters { /// Used for parallel parsing, where we parse off-main-thread. #[inline] pub fn merge(&self, other: &Self) { - self.non_custom_properties.merge(&other.non_custom_properties) + self.non_custom_properties + .merge(&other.non_custom_properties) } } diff --git a/components/style/values/animated/color.rs b/components/style/values/animated/color.rs index 4356c5a3d9b..afffce1c767 100644 --- a/components/style/values/animated/color.rs +++ b/components/style/values/animated/color.rs @@ -61,7 +61,8 @@ impl Animate for RGBA { let red = (self.red * self.alpha).animate(&(other.red * other.alpha), procedure)? * 1. / alpha; let green = (self.green * self.alpha).animate(&(other.green * other.alpha), procedure)? * - 1. / alpha; + 1. / + alpha; let blue = (self.blue * self.alpha).animate(&(other.blue * other.alpha), procedure)? * 1. / alpha; @@ -223,7 +224,7 @@ impl Animate for Color { let fg = fg1.animate(&fg2, procedure)?; Self::with_ratios(bg_color, ComplexColorRatios { bg: 1., fg }) - } + }, }) } } @@ -239,19 +240,19 @@ impl ComputeSquaredDistance for Color { (Numeric(c1), Numeric(c2)) => c1.compute_squared_distance(&c2)?, (Foreground, Numeric(color)) | (Numeric(color), Foreground) => { // `computed_squared_distance` is symmetric. - color.compute_squared_distance(&RGBA::transparent())? - + SquaredDistance::from_sqrt(1.) - } + color.compute_squared_distance(&RGBA::transparent())? + + SquaredDistance::from_sqrt(1.) + }, (_, _) => { let self_color = self.effective_intermediate_rgba(); let other_color = other.effective_intermediate_rgba(); let self_ratios = self.effective_ratios(); let other_ratios = other.effective_ratios(); - self_color.compute_squared_distance(&other_color)? - + self_ratios.bg.compute_squared_distance(&other_ratios.bg)? - + self_ratios.fg.compute_squared_distance(&other_ratios.fg)? - } + self_color.compute_squared_distance(&other_color)? + + self_ratios.bg.compute_squared_distance(&other_ratios.bg)? + + self_ratios.fg.compute_squared_distance(&other_ratios.fg)? + }, }) } } diff --git a/components/style/values/animated/mod.rs b/components/style/values/animated/mod.rs index 53d3719b021..b70ef7d6639 100644 --- a/components/style/values/animated/mod.rs +++ b/components/style/values/animated/mod.rs @@ -392,3 +392,17 @@ where )) } } + +impl<T> ToAnimatedZero for Box<[T]> +where + T: ToAnimatedZero, +{ + #[inline] + fn to_animated_zero(&self) -> Result<Self, ()> { + let v = self + .iter() + .map(|v| v.to_animated_zero()) + .collect::<Result<Vec<_>, _>>()?; + Ok(v.into_boxed_slice()) + } +} diff --git a/components/style/values/computed/angle.rs b/components/style/values/computed/angle.rs index 67ea5d1231b..e162b7a2499 100644 --- a/components/style/values/computed/angle.rs +++ b/components/style/values/computed/angle.rs @@ -15,7 +15,9 @@ use values::distance::{ComputeSquaredDistance, SquaredDistance}; /// A computed angle. #[animate(fallback = "Self::animate_fallback")] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Animate, Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd, ToAnimatedZero, ToCss)] +#[derive( + Animate, Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd, ToAnimatedZero, ToCss, +)] pub enum Angle { /// An angle with degree unit. #[css(dimension)] @@ -73,7 +75,9 @@ impl Angle { /// <https://drafts.csswg.org/css-transitions/#animtype-number> #[inline] fn animate_fallback(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> { - Ok(Angle::from_radians(self.radians().animate(&other.radians(), procedure)?)) + Ok(Angle::from_radians( + self.radians().animate(&other.radians(), procedure)?, + )) } } diff --git a/components/style/values/computed/box.rs b/components/style/values/computed/box.rs index 15e447ea415..002583b2c21 100644 --- a/components/style/values/computed/box.rs +++ b/components/style/values/computed/box.rs @@ -34,13 +34,14 @@ pub type Perspective = GenericPerspective<NonNegativeLength>; #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, - SpecifiedValueInfo, ToCss)] +#[derive( + Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, +)] /// A computed value for the `float` property. pub enum Float { Left, Right, - None + None, } impl ToComputedValue for SpecifiedFloat { @@ -52,7 +53,9 @@ impl ToComputedValue for SpecifiedFloat { // https://drafts.csswg.org/css-logical-props/#float-clear match *self { SpecifiedFloat::InlineStart => { - context.rule_cache_conditions.borrow_mut() + context + .rule_cache_conditions + .borrow_mut() .set_writing_mode_dependency(context.builder.writing_mode); if ltr { Float::Left @@ -61,7 +64,9 @@ impl ToComputedValue for SpecifiedFloat { } }, SpecifiedFloat::InlineEnd => { - context.rule_cache_conditions.borrow_mut() + context + .rule_cache_conditions + .borrow_mut() .set_writing_mode_dependency(context.builder.writing_mode); if ltr { Float::Right @@ -71,7 +76,7 @@ impl ToComputedValue for SpecifiedFloat { }, SpecifiedFloat::Left => Float::Left, SpecifiedFloat::Right => Float::Right, - SpecifiedFloat::None => Float::None + SpecifiedFloat::None => Float::None, } } @@ -80,21 +85,22 @@ impl ToComputedValue for SpecifiedFloat { match *computed { Float::Left => SpecifiedFloat::Left, Float::Right => SpecifiedFloat::Right, - Float::None => SpecifiedFloat::None + Float::None => SpecifiedFloat::None, } } } #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, -SpecifiedValueInfo, ToCss)] +#[derive( + Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, +)] /// A computed value for the `clear` property. pub enum Clear { None, Left, Right, - Both + Both, } impl ToComputedValue for SpecifiedClear { @@ -106,7 +112,9 @@ impl ToComputedValue for SpecifiedClear { // https://drafts.csswg.org/css-logical-props/#float-clear match *self { SpecifiedClear::InlineStart => { - context.rule_cache_conditions.borrow_mut() + context + .rule_cache_conditions + .borrow_mut() .set_writing_mode_dependency(context.builder.writing_mode); if ltr { Clear::Left @@ -115,7 +123,9 @@ impl ToComputedValue for SpecifiedClear { } }, SpecifiedClear::InlineEnd => { - context.rule_cache_conditions.borrow_mut() + context + .rule_cache_conditions + .borrow_mut() .set_writing_mode_dependency(context.builder.writing_mode); if ltr { Clear::Right @@ -126,7 +136,7 @@ impl ToComputedValue for SpecifiedClear { SpecifiedClear::None => Clear::None, SpecifiedClear::Left => Clear::Left, SpecifiedClear::Right => Clear::Right, - SpecifiedClear::Both => Clear::Both + SpecifiedClear::Both => Clear::Both, } } @@ -160,23 +170,27 @@ impl ToComputedValue for specified::Resize { let is_vertical = context.style().writing_mode.is_vertical(); match self { specified::Resize::Inline => { - context.rule_cache_conditions.borrow_mut() + context + .rule_cache_conditions + .borrow_mut() .set_writing_mode_dependency(context.builder.writing_mode); if is_vertical { Resize::Vertical } else { Resize::Horizontal } - } + }, specified::Resize::Block => { - context.rule_cache_conditions.borrow_mut() + context + .rule_cache_conditions + .borrow_mut() .set_writing_mode_dependency(context.builder.writing_mode); if is_vertical { Resize::Horizontal } else { Resize::Vertical } - } + }, specified::Resize::None => Resize::None, specified::Resize::Both => Resize::Both, specified::Resize::Horizontal => Resize::Horizontal, diff --git a/components/style/values/computed/counters.rs b/components/style/values/computed/counters.rs index fd8d7763f1c..211ca6753e7 100644 --- a/components/style/values/computed/counters.rs +++ b/components/style/values/computed/counters.rs @@ -20,4 +20,3 @@ pub type Content = generics::Content<ComputedImageUrl>; /// A computed content item. pub type ContentItem = generics::ContentItem<ComputedImageUrl>; - diff --git a/components/style/values/computed/effects.rs b/components/style/values/computed/effects.rs index 07ac6441b6c..b7e8315a6ac 100644 --- a/components/style/values/computed/effects.rs +++ b/components/style/values/computed/effects.rs @@ -20,11 +20,13 @@ pub type BoxShadow = GenericBoxShadow<Color, Length, NonNegativeLength, Length>; /// A computed value for a single `filter`. #[cfg(feature = "gecko")] -pub type Filter = GenericFilter<Angle, NonNegativeNumber, NonNegativeLength, SimpleShadow, ComputedUrl>; +pub type Filter = + GenericFilter<Angle, NonNegativeNumber, NonNegativeLength, SimpleShadow, ComputedUrl>; /// A computed value for a single `filter`. #[cfg(not(feature = "gecko"))] -pub type Filter = GenericFilter<Angle, NonNegativeNumber, NonNegativeLength, Impossible, Impossible>; +pub type Filter = + GenericFilter<Angle, NonNegativeNumber, NonNegativeLength, Impossible, Impossible>; /// A computed value for the `drop-shadow()` filter. pub type SimpleShadow = GenericSimpleShadow<Color, Length, NonNegativeLength>; diff --git a/components/style/values/computed/font.rs b/components/style/values/computed/font.rs index 8db4bd7e917..2c3d2853e5c 100644 --- a/components/style/values/computed/font.rs +++ b/components/style/values/computed/font.rs @@ -35,8 +35,7 @@ pub use values::specified::font::{FontSynthesis, MozScriptSizeMultiplier, XLang, /// https://drafts.csswg.org/css-fonts-4/#propdef-font-weight /// /// This is effectively just a `Number`. -#[derive(Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, - ToCss)] +#[derive(Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, ToCss)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] pub struct FontWeight(pub Number); @@ -60,8 +59,17 @@ impl ToAnimatedValue for FontWeight { } } -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, - ToAnimatedZero, ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + ToAnimatedZero, + ToCss, +)] /// The computed value of font-size pub struct FontSize { /// The size. @@ -217,9 +225,9 @@ impl FontFamily { #[inline] /// Get default font family as `serif` which is a generic font-family pub fn serif() -> Self { - FontFamily(FontFamilyList::new(Box::new([ - SingleFontFamily::Generic(atom!("serif")), - ]))) + FontFamily(FontFamilyList::new(Box::new([SingleFontFamily::Generic( + atom!("serif"), + )]))) } } @@ -473,9 +481,7 @@ impl SingleFontFamily { FontFamilyType::eFamily_monospace => SingleFontFamily::Generic(atom!("monospace")), FontFamilyType::eFamily_cursive => SingleFontFamily::Generic(atom!("cursive")), FontFamilyType::eFamily_fantasy => SingleFontFamily::Generic(atom!("fantasy")), - FontFamilyType::eFamily_moz_fixed => { - SingleFontFamily::Generic(atom!("-moz-fixed")) - }, + FontFamilyType::eFamily_moz_fixed => SingleFontFamily::Generic(atom!("-moz-fixed")), FontFamilyType::eFamily_named => { let name = Atom::from(&*family.mName); SingleFontFamily::FamilyName(FamilyName { @@ -851,9 +857,10 @@ impl ToAnimatedValue for FontStyleAngle { #[inline] fn from_animated_value(animated: Self::AnimatedValue) -> Self { FontStyleAngle(Angle::Deg( - animated.degrees() + animated + .degrees() .min(specified::FONT_STYLE_OBLIQUE_MAX_ANGLE_DEGREES) - .max(specified::FONT_STYLE_OBLIQUE_MIN_ANGLE_DEGREES) + .max(specified::FONT_STYLE_OBLIQUE_MIN_ANGLE_DEGREES), )) } } @@ -882,10 +889,11 @@ impl FontStyle { /// https://drafts.csswg.org/css-fonts-4/#valdef-font-style-oblique-angle #[inline] pub fn default_angle() -> FontStyleAngle { - FontStyleAngle(Angle::Deg(specified::DEFAULT_FONT_STYLE_OBLIQUE_ANGLE_DEGREES)) + FontStyleAngle(Angle::Deg( + specified::DEFAULT_FONT_STYLE_OBLIQUE_ANGLE_DEGREES, + )) } - /// Get the font style from Gecko's nsFont struct. #[cfg(feature = "gecko")] pub fn from_gecko(style: structs::FontSlantStyle) -> Self { @@ -923,7 +931,7 @@ impl ToCss for FontStyle { angle.to_css(dest)?; } Ok(()) - } + }, } } } diff --git a/components/style/values/computed/length.rs b/components/style/values/computed/length.rs index 0ff99a08a3f..f2d43e2ada9 100644 --- a/components/style/values/computed/length.rs +++ b/components/style/values/computed/length.rs @@ -80,7 +80,8 @@ impl ComputeSquaredDistance for CalcLengthOrPercentage { fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> { // FIXME(nox): This looks incorrect to me, to add a distance between lengths // with a distance between percentages. - Ok(self.unclamped_length() + Ok(self + .unclamped_length() .compute_squared_distance(&other.unclamped_length())? + self.percentage() .compute_squared_distance(&other.percentage())?) @@ -285,9 +286,15 @@ impl specified::CalcLengthOrPercentage { /// Compute the value into pixel length as CSSFloat without context, /// so it returns Err(()) if there is any non-absolute unit. pub fn to_computed_pixel_length_without_context(&self) -> Result<CSSFloat, ()> { - if self.vw.is_some() || self.vh.is_some() || self.vmin.is_some() || self.vmax.is_some() || - self.em.is_some() || self.ex.is_some() || self.ch.is_some() || - self.rem.is_some() || self.percentage.is_some() + if self.vw.is_some() || + self.vh.is_some() || + self.vmin.is_some() || + self.vmax.is_some() || + self.em.is_some() || + self.ex.is_some() || + self.ch.is_some() || + self.rem.is_some() || + self.percentage.is_some() { return Err(()); } @@ -324,8 +331,17 @@ impl ToComputedValue for specified::CalcLengthOrPercentage { #[allow(missing_docs)] #[animate(fallback = "Self::animate_fallback")] #[css(derive_debug)] -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, MallocSizeOf, PartialEq, - ToAnimatedValue, ToAnimatedZero, ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + MallocSizeOf, + PartialEq, + ToAnimatedValue, + ToAnimatedZero, + ToCss, +)] #[distance(fallback = "Self::compute_squared_distance_fallback")] pub enum LengthOrPercentage { Length(Length), @@ -483,11 +499,9 @@ impl LengthOrPercentageOrAuto { fn animate_fallback(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> { let this = <Option<CalcLengthOrPercentage>>::from(*self); let other = <Option<CalcLengthOrPercentage>>::from(*other); - Ok(LengthOrPercentageOrAuto::Calc(this.animate( - &other, - procedure, - )? - .ok_or(())?)) + Ok(LengthOrPercentageOrAuto::Calc( + this.animate(&other, procedure)?.ok_or(())?, + )) } #[inline] @@ -602,11 +616,9 @@ impl LengthOrPercentageOrNone { fn animate_fallback(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> { let this = <Option<CalcLengthOrPercentage>>::from(*self); let other = <Option<CalcLengthOrPercentage>>::from(*other); - Ok(LengthOrPercentageOrNone::Calc(this.animate( - &other, - procedure, - )? - .ok_or(())?)) + Ok(LengthOrPercentageOrNone::Calc( + this.animate(&other, procedure)?.ok_or(())?, + )) } fn compute_squared_distance_fallback(&self, other: &Self) -> Result<SquaredDistance, ()> { @@ -727,8 +739,18 @@ impl NonNegativeLengthOrPercentage { /// The computed `<length>` value. #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, - PartialOrd, ToAnimatedValue, ToAnimatedZero)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + PartialOrd, + ToAnimatedValue, + ToAnimatedZero, +)] pub struct CSSPixelLength(CSSFloat); impl CSSPixelLength { @@ -916,8 +938,7 @@ pub type NonNegativeLengthOrPercentageOrNormal = Either<NonNegativeLengthOrPerce /// block-size, and inline-size. #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, - SpecifiedValueInfo, ToCss)] +#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss)] pub enum ExtremumLength { MozMaxContent, MozMinContent, diff --git a/components/style/values/computed/motion.rs b/components/style/values/computed/motion.rs index 935ba57f845..352363ab491 100644 --- a/components/style/values/computed/motion.rs +++ b/components/style/values/computed/motion.rs @@ -7,4 +7,4 @@ /// A computed offset-path. The computed value is as specified value. /// /// https://drafts.fxtf.org/motion-1/#offset-path-property -pub use values::specified::motion::OffsetPath as OffsetPath; +pub use values::specified::motion::OffsetPath; diff --git a/components/style/values/computed/percentage.rs b/components/style/values/computed/percentage.rs index 718d74335b7..4e9ae6172a9 100644 --- a/components/style/values/computed/percentage.rs +++ b/components/style/values/computed/percentage.rs @@ -12,9 +12,21 @@ use values::generics::NonNegative; /// A computed percentage. #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, Default, - MallocSizeOf, PartialEq, PartialOrd, SpecifiedValueInfo, - ToAnimatedValue, ToAnimatedZero, ToComputedValue)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + Default, + MallocSizeOf, + PartialEq, + PartialOrd, + SpecifiedValueInfo, + ToAnimatedValue, + ToAnimatedZero, + ToComputedValue, +)] pub struct Percentage(pub CSSFloat); impl Percentage { diff --git a/components/style/values/computed/transform.rs b/components/style/values/computed/transform.rs index a2849a0d4b3..a83495a09b5 100644 --- a/components/style/values/computed/transform.rs +++ b/components/style/values/computed/transform.rs @@ -162,13 +162,13 @@ impl TransformOperation { generic::TransformOperation::RotateZ(ref angle) | generic::TransformOperation::Rotate(ref angle) => { generic::TransformOperation::Rotate3D(0., 0., 1., angle.clone()) - } + }, generic::TransformOperation::RotateX(ref angle) => { generic::TransformOperation::Rotate3D(1., 0., 0., angle.clone()) - } + }, generic::TransformOperation::RotateY(ref angle) => { generic::TransformOperation::Rotate3D(0., 1., 0., angle.clone()) - } + }, _ => unreachable!(), } } @@ -273,9 +273,9 @@ impl ToAnimatedZero for TransformOperation { generic::TransformOperation::Rotate(_) => { Ok(generic::TransformOperation::Rotate(Angle::zero())) }, - generic::TransformOperation::Perspective(ref l) => { - Ok(generic::TransformOperation::Perspective(l.to_animated_zero()?)) - }, + generic::TransformOperation::Perspective(ref l) => Ok( + generic::TransformOperation::Perspective(l.to_animated_zero()?), + ), generic::TransformOperation::AccumulateMatrix { .. } | generic::TransformOperation::InterpolateMatrix { .. } => { // AccumulateMatrix/InterpolateMatrix: We do interpolation on @@ -293,10 +293,12 @@ impl ToAnimatedZero for TransformOperation { impl ToAnimatedZero for Transform { #[inline] fn to_animated_zero(&self) -> Result<Self, ()> { - Ok(generic::Transform(self.0 - .iter() - .map(|op| op.to_animated_zero()) - .collect::<Result<Vec<_>, _>>()?)) + Ok(generic::Transform( + self.0 + .iter() + .map(|op| op.to_animated_zero()) + .collect::<Result<Vec<_>, _>>()?, + )) } } diff --git a/components/style/values/generics/background.rs b/components/style/values/generics/background.rs index b25b00514d0..a4f4c58d8cd 100644 --- a/components/style/values/generics/background.rs +++ b/components/style/values/generics/background.rs @@ -5,9 +5,20 @@ //! Generic types for CSS values related to backgrounds. /// A generic value for the `background-size` property. -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, - PartialEq, SpecifiedValueInfo, ToAnimatedValue, ToAnimatedZero, - ToComputedValue, ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedValue, + ToAnimatedZero, + ToComputedValue, + ToCss, +)] pub enum BackgroundSize<LengthOrPercentageOrAuto> { /// `<width> <height>` Explicit { diff --git a/components/style/values/generics/basic_shape.rs b/components/style/values/generics/basic_shape.rs index 0eccf011c71..513e5de0e2b 100644 --- a/components/style/values/generics/basic_shape.rs +++ b/components/style/values/generics/basic_shape.rs @@ -19,8 +19,9 @@ pub type ClippingShape<BasicShape, Url> = ShapeSource<BasicShape, GeometryBox, U /// <https://drafts.fxtf.org/css-masking-1/#typedef-geometry-box> #[allow(missing_docs)] -#[derive(Animate, Clone, Copy, Debug, MallocSizeOf, PartialEq, - SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Animate, Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, +)] pub enum GeometryBox { FillBox, StrokeBox, @@ -34,8 +35,19 @@ pub type FloatAreaShape<BasicShape, Image> = ShapeSource<BasicShape, ShapeBox, I /// https://drafts.csswg.org/css-shapes-1/#typedef-shape-box #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Animate, Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, - SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Animate, + Clone, + Copy, + Debug, + Eq, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, +)] pub enum ShapeBox { MarginBox, BorderBox, @@ -46,15 +58,15 @@ pub enum ShapeBox { /// A shape source, for some reference box. #[allow(missing_docs)] #[animation(no_bound(ImageOrUrl))] -#[derive(Animate, Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive( + Animate, Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, +)] pub enum ShapeSource<BasicShape, ReferenceBox, ImageOrUrl> { #[animation(error)] ImageOrUrl(ImageOrUrl), Shape(BasicShape, Option<ReferenceBox>), #[animation(error)] Box(ReferenceBox), - #[animation(error)] #[css(function)] Path(Path), #[animation(error)] @@ -62,8 +74,17 @@ pub enum ShapeSource<BasicShape, ReferenceBox, ImageOrUrl> { } #[allow(missing_docs)] -#[derive(Animate, Clone, ComputeSquaredDistance, Debug, MallocSizeOf, PartialEq, - SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, +)] pub enum BasicShape<H, V, LengthOrPercentage> { Inset(#[css(field_bound)] InsetRect<LengthOrPercentage>), Circle(#[css(field_bound)] Circle<H, V, LengthOrPercentage>), @@ -74,8 +95,16 @@ pub enum BasicShape<H, V, LengthOrPercentage> { /// <https://drafts.csswg.org/css-shapes/#funcdef-inset> #[allow(missing_docs)] #[css(function = "inset")] -#[derive(Animate, Clone, ComputeSquaredDistance, Debug, MallocSizeOf, PartialEq, - SpecifiedValueInfo, ToComputedValue)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, +)] pub struct InsetRect<LengthOrPercentage> { pub rect: Rect<LengthOrPercentage>, pub round: Option<BorderRadius<LengthOrPercentage>>, @@ -84,8 +113,17 @@ pub struct InsetRect<LengthOrPercentage> { /// <https://drafts.csswg.org/css-shapes/#funcdef-circle> #[allow(missing_docs)] #[css(function)] -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, - PartialEq, SpecifiedValueInfo, ToComputedValue)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, +)] pub struct Circle<H, V, LengthOrPercentage> { pub position: Position<H, V>, pub radius: ShapeRadius<LengthOrPercentage>, @@ -94,8 +132,17 @@ pub struct Circle<H, V, LengthOrPercentage> { /// <https://drafts.csswg.org/css-shapes/#funcdef-ellipse> #[allow(missing_docs)] #[css(function)] -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, - PartialEq, SpecifiedValueInfo, ToComputedValue)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, +)] pub struct Ellipse<H, V, LengthOrPercentage> { pub position: Position<H, V>, pub semiaxis_x: ShapeRadius<LengthOrPercentage>, @@ -104,8 +151,18 @@ pub struct Ellipse<H, V, LengthOrPercentage> { /// <https://drafts.csswg.org/css-shapes/#typedef-shape-radius> #[allow(missing_docs)] -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, - PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, +)] pub enum ShapeRadius<LengthOrPercentage> { Length(LengthOrPercentage), #[animation(error)] @@ -118,8 +175,7 @@ pub enum ShapeRadius<LengthOrPercentage> { /// /// <https://drafts.csswg.org/css-shapes/#funcdef-polygon> #[css(comma, function)] -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] pub struct Polygon<LengthOrPercentage> { /// The filling rule for a polygon. #[css(skip_if = "fill_is_default")] @@ -130,8 +186,7 @@ pub struct Polygon<LengthOrPercentage> { } /// Coordinates for Polygon. -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] pub struct PolygonCoord<LengthOrPercentage>(pub LengthOrPercentage, pub LengthOrPercentage); // https://drafts.csswg.org/css-shapes/#typedef-fill-rule @@ -140,8 +195,18 @@ pub struct PolygonCoord<LengthOrPercentage>(pub LengthOrPercentage, pub LengthOr // says that it can also be `inherit` #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, - SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, + Copy, + Debug, + Eq, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, +)] #[repr(u8)] pub enum FillRule { Nonzero, @@ -152,10 +217,13 @@ pub enum FillRule { /// /// https://drafts.csswg.org/css-shapes-2/#funcdef-path #[css(comma)] -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Animate, Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, +)] pub struct Path { /// The filling rule for the svg path. #[css(skip_if = "fill_is_default")] + #[animation(constant)] pub fill: FillRule, /// The svg path data. pub path: SVGPathData, @@ -173,10 +241,16 @@ where ( &ShapeSource::Shape(ref this, ref this_box), &ShapeSource::Shape(ref other, ref other_box), - ) if this_box == other_box => + ) + if this_box == other_box => { this.compute_squared_distance(other) }, + (&ShapeSource::Path(ref this), &ShapeSource::Path(ref other)) + if this.fill == other.fill => + { + this.path.compute_squared_distance(&other.path) + }, _ => Err(()), } } @@ -224,7 +298,8 @@ where if self.coordinates.len() != other.coordinates.len() { return Err(()); } - let coordinates = self.coordinates + let coordinates = self + .coordinates .iter() .zip(other.coordinates.iter()) .map(|(this, other)| { @@ -232,8 +307,7 @@ where this.0.animate(&other.0, procedure)?, this.1.animate(&other.1, procedure)?, )) - }) - .collect::<Result<Vec<_>, _>>()?; + }).collect::<Result<Vec<_>, _>>()?; Ok(Polygon { fill: self.fill, coordinates, @@ -259,8 +333,7 @@ where let d1 = this.0.compute_squared_distance(&other.0)?; let d2 = this.1.compute_squared_distance(&other.1)?; Ok(d1 + d2) - }) - .sum() + }).sum() } } diff --git a/components/style/values/generics/border.rs b/components/style/values/generics/border.rs index c25560ed0f1..4f40409843a 100644 --- a/components/style/values/generics/border.rs +++ b/components/style/values/generics/border.rs @@ -10,8 +10,9 @@ use values::generics::rect::Rect; use values::generics::size::Size; /// A generic value for a single side of a `border-image-width` property. -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive( + Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, +)] pub enum BorderImageSideWidth<LengthOrPercentage, Number> { /// `<length-or-percentage>` Length(LengthOrPercentage), @@ -22,8 +23,9 @@ pub enum BorderImageSideWidth<LengthOrPercentage, Number> { } /// A generic value for the `border-image-slice` property. -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive( + Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, +)] pub struct BorderImageSlice<NumberOrPercentage> { /// The offsets. #[css(field_bound)] @@ -34,8 +36,18 @@ pub struct BorderImageSlice<NumberOrPercentage> { } /// A generic value for the `border-*-radius` longhand properties. -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, - PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, +)] pub struct BorderCornerRadius<L>(#[css(field_bound)] pub Size<L>); impl<L> BorderCornerRadius<L> { @@ -46,9 +58,20 @@ impl<L> BorderCornerRadius<L> { } /// A generic value for the `border-spacing` property. -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, - PartialEq, SpecifiedValueInfo, ToAnimatedValue, ToAnimatedZero, - ToComputedValue, ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedValue, + ToAnimatedZero, + ToComputedValue, + ToCss, +)] pub struct BorderSpacing<L>(#[css(field_bound)] pub Size<L>); impl<L> BorderSpacing<L> { @@ -61,8 +84,17 @@ impl<L> BorderSpacing<L> { /// A generic value for `border-radius`, `outline-radius` and `inset()`. /// /// <https://drafts.csswg.org/css-backgrounds-3/#border-radius> -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, - PartialEq, SpecifiedValueInfo, ToComputedValue)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, +)] pub struct BorderRadius<LengthOrPercentage> { /// The top left radius. pub top_left: BorderCornerRadius<LengthOrPercentage>, @@ -120,7 +152,9 @@ where W: Write, { widths.to_css(dest)?; - if widths.0 != heights.0 || widths.1 != heights.1 || widths.2 != heights.2 || + if widths.0 != heights.0 || + widths.1 != heights.1 || + widths.2 != heights.2 || widths.3 != heights.3 { dest.write_str(" / ")?; diff --git a/components/style/values/generics/box.rs b/components/style/values/generics/box.rs index ea79e98eefb..0b525974288 100644 --- a/components/style/values/generics/box.rs +++ b/components/style/values/generics/box.rs @@ -7,8 +7,18 @@ use values::animated::ToAnimatedZero; /// A generic value for the `vertical-align` property. -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, - PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, +)] pub enum VerticalAlign<LengthOrPercentage> { /// `baseline` Baseline, @@ -48,8 +58,7 @@ impl<L> ToAnimatedZero for VerticalAlign<L> { } /// https://drafts.csswg.org/css-animations/#animation-iteration-count -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] pub enum AnimationIterationCount<Number> { /// A `<number>` value. Number(Number), @@ -58,9 +67,20 @@ pub enum AnimationIterationCount<Number> { } /// A generic value for the `perspective` property. -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, - PartialEq, SpecifiedValueInfo, ToAnimatedValue, ToAnimatedZero, - ToComputedValue, ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedValue, + ToAnimatedZero, + ToComputedValue, + ToCss, +)] pub enum Perspective<NonNegativeLength> { /// A non-negative length. Length(NonNegativeLength), diff --git a/components/style/values/generics/column.rs b/components/style/values/generics/column.rs index 1d76f6cb552..5f96650d3e8 100644 --- a/components/style/values/generics/column.rs +++ b/components/style/values/generics/column.rs @@ -5,9 +5,20 @@ //! Generic types for the column properties. /// A generic type for `column-count` values. -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, - PartialEq, SpecifiedValueInfo, ToAnimatedValue, ToAnimatedZero, - ToComputedValue, ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedValue, + ToAnimatedZero, + ToComputedValue, + ToCss, +)] pub enum ColumnCount<PositiveInteger> { /// A positive integer. Integer(PositiveInteger), diff --git a/components/style/values/generics/counters.rs b/components/style/values/generics/counters.rs index 779d56d65ee..4bbf728d457 100644 --- a/components/style/values/generics/counters.rs +++ b/components/style/values/generics/counters.rs @@ -14,8 +14,7 @@ use values::generics::CounterStyleOrNone; use values::specified::Attr; /// A name / value pair for counters. -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] pub struct CounterPair<Integer> { /// The name of the counter. pub name: CustomIdent, @@ -24,8 +23,9 @@ pub struct CounterPair<Integer> { } /// A generic value for the `counter-increment` property. -#[derive(Clone, Debug, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive( + Clone, Debug, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, +)] pub struct CounterIncrement<I>(Counters<I>); impl<I> CounterIncrement<I> { @@ -46,8 +46,9 @@ impl<I> Deref for CounterIncrement<I> { } /// A generic value for the `counter-reset` property. -#[derive(Clone, Debug, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive( + Clone, Debug, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, +)] pub struct CounterReset<I>(Counters<I>); impl<I> CounterReset<I> { @@ -70,8 +71,7 @@ impl<I> Deref for CounterReset<I> { /// A generic value for lists of counters. /// /// Keyword `none` is represented by an empty vector. -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] pub struct Counters<I>(#[css(iterable, if_empty = "none")] Box<[CounterPair<I>]>); impl<I> Default for Counters<I> { @@ -102,8 +102,7 @@ fn is_decimal(counter_type: &CounterStyleType) -> bool { /// The specified value for the `content` property. /// /// https://drafts.csswg.org/css-content/#propdef-content -#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] pub enum Content<ImageUrl> { /// `normal` reserved keyword. Normal, @@ -125,8 +124,7 @@ impl<ImageUrl> Content<ImageUrl> { } /// Items for the `content` property. -#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] pub enum ContentItem<ImageUrl> { /// Literal string content. String(Box<str>), diff --git a/components/style/values/generics/effects.rs b/components/style/values/generics/effects.rs index f05dfe82d66..7c7e3f4bef3 100644 --- a/components/style/values/generics/effects.rs +++ b/components/style/values/generics/effects.rs @@ -5,8 +5,17 @@ //! Generic types for CSS values related to effects. /// A generic value for a single `box-shadow`. -#[derive(Animate, Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToAnimatedValue, ToAnimatedZero, ToCss)] +#[derive( + Animate, + Clone, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedValue, + ToAnimatedZero, + ToCss, +)] pub struct BoxShadow<Color, SizeLength, BlurShapeLength, ShapeLength> { /// The base shadow. pub base: SimpleShadow<Color, SizeLength, BlurShapeLength>, @@ -21,8 +30,17 @@ pub struct BoxShadow<Color, SizeLength, BlurShapeLength, ShapeLength> { /// A generic value for a single `filter`. #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[animation(no_bound(Url))] -#[derive(Clone, ComputeSquaredDistance, Debug, MallocSizeOf, PartialEq, - SpecifiedValueInfo, ToAnimatedValue, ToComputedValue, ToCss)] +#[derive( + Clone, + ComputeSquaredDistance, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedValue, + ToComputedValue, + ToCss, +)] pub enum Filter<Angle, Factor, Length, DropShadow, Url> { /// `blur(<length>)` #[css(function)] @@ -63,8 +81,18 @@ pub enum Filter<Angle, Factor, Length, DropShadow, Url> { /// /// Contrary to the canonical order from the spec, the color is serialised /// first, like in Gecko and Webkit. -#[derive(Animate, Clone, ComputeSquaredDistance, Debug, MallocSizeOf, PartialEq, - SpecifiedValueInfo, ToAnimatedValue, ToAnimatedZero, ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedValue, + ToAnimatedZero, + ToCss, +)] pub struct SimpleShadow<Color, SizeLength, ShapeLength> { /// Color. pub color: Color, diff --git a/components/style/values/generics/flex.rs b/components/style/values/generics/flex.rs index 1ab53233c44..9cbece2e1bc 100644 --- a/components/style/values/generics/flex.rs +++ b/components/style/values/generics/flex.rs @@ -6,9 +6,19 @@ /// A generic value for the `flex-basis` property. #[cfg_attr(feature = "servo", derive(MallocSizeOf))] -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, PartialEq, - SpecifiedValueInfo, ToAnimatedValue, ToAnimatedZero, ToComputedValue, - ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + PartialEq, + SpecifiedValueInfo, + ToAnimatedValue, + ToAnimatedZero, + ToComputedValue, + ToCss, +)] pub enum FlexBasis<Width> { /// `content` Content, diff --git a/components/style/values/generics/font.rs b/components/style/values/generics/font.rs index 02df291065f..03a76c5a32d 100644 --- a/components/style/values/generics/font.rs +++ b/components/style/values/generics/font.rs @@ -16,8 +16,7 @@ use style_traits::{SpecifiedValueInfo, StyleParseErrorKind, ToCss}; use values::distance::{ComputeSquaredDistance, SquaredDistance}; /// https://drafts.csswg.org/css-fonts-4/#feature-tag-value -#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue)] +#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] pub struct FeatureTagValue<Integer> { /// A four-character tag, packed into a u32 (one byte per character). pub tag: FontTag, @@ -47,8 +46,9 @@ where /// Variation setting for a single feature, see: /// /// https://drafts.csswg.org/css-fonts-4/#font-variation-settings-def -#[derive(Animate, Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive( + Animate, Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, +)] pub struct VariationValue<Number> { /// A four-character tag, packed into a u32 (one byte per character). #[animation(constant)] @@ -72,8 +72,7 @@ where /// A value both for font-variation-settings and font-feature-settings. #[css(comma)] -#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] pub struct FontSettings<T>(#[css(if_empty = "normal", iterable)] pub Box<[T]>); impl<T> FontSettings<T> { @@ -109,8 +108,7 @@ impl<T: Parse> Parse for FontSettings<T> { /// https://drafts.csswg.org/css-fonts-4/#font-variation-settings-def /// https://drafts.csswg.org/css-fonts-4/#descdef-font-face-font-feature-settings /// -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue)] +#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] pub struct FontTag(pub u32); impl ToCss for FontTag { @@ -145,8 +143,18 @@ impl Parse for FontTag { } } -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, - ToAnimatedValue, ToAnimatedZero, ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + ToAnimatedValue, + ToAnimatedZero, + ToCss, +)] /// Additional information for keyword-derived font sizes. pub struct KeywordInfo<Length> { /// The keyword used @@ -189,9 +197,20 @@ impl<L> SpecifiedValueInfo for KeywordInfo<L> { } /// CSS font keywords -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, - Parse, PartialEq, SpecifiedValueInfo, ToAnimatedValue, ToAnimatedZero, - ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToAnimatedValue, + ToAnimatedZero, + ToCss, +)] #[allow(missing_docs)] pub enum KeywordSize { #[css(keyword = "xx-small")] @@ -228,8 +247,19 @@ impl Default for KeywordSize { /// https://drafts.csswg.org/css-fonts-4/#font-style-prop #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, Hash, MallocSizeOf, - PartialEq, SpecifiedValueInfo, ToAnimatedValue, ToAnimatedZero)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + Hash, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedValue, + ToAnimatedZero, +)] pub enum FontStyle<Angle> { #[animation(error)] Normal, diff --git a/components/style/values/generics/gecko.rs b/components/style/values/generics/gecko.rs index 72a8b71d073..d56158750b6 100644 --- a/components/style/values/generics/gecko.rs +++ b/components/style/values/generics/gecko.rs @@ -7,8 +7,7 @@ /// A generic value for scroll snap points. #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] -#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToComputedValue, - ToCss)] +#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] pub enum ScrollSnapPoint<LengthOrPercentage> { /// `none` None, diff --git a/components/style/values/generics/grid.rs b/components/style/values/generics/grid.rs index b9ec85ace22..56b6f463691 100644 --- a/components/style/values/generics/grid.rs +++ b/components/style/values/generics/grid.rs @@ -18,8 +18,7 @@ use values::specified::grid::parse_line_names; /// A `<grid-line>` type. /// /// <https://drafts.csswg.org/css-grid/#typedef-grid-row-start-grid-line> -#[derive(Clone, Debug, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue)] +#[derive(Clone, Debug, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] pub struct GridLine<Integer> { /// Flag to check whether it's a `span` keyword. pub is_span: bool, @@ -149,8 +148,18 @@ impl Parse for GridLine<specified::Integer> { #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, - SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, + Copy, + Debug, + Eq, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, +)] pub enum TrackKeyword { Auto, MaxContent, @@ -161,8 +170,7 @@ pub enum TrackKeyword { /// avoid re-implementing it for the computed type. /// /// <https://drafts.csswg.org/css-grid/#typedef-track-breadth> -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] pub enum TrackBreadth<L> { /// The generic type is almost always a non-negative `<length-percentage>` Breadth(L), @@ -383,8 +391,7 @@ impl Parse for RepeatCount<specified::Integer> { /// /// It can also hold `repeat()` function parameters, which expands into the respective /// values in its computed form. -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] #[css(function = "repeat")] pub struct TrackRepeat<L, I> { /// The number of times for the value to be repeated (could also be `auto-fit` or `auto-fill`) @@ -409,7 +416,8 @@ impl<L: ToCss, I: ToCss> ToCss for TrackRepeat<L, I> { dest.write_str(", ")?; let mut line_names_iter = self.line_names.iter(); - for (i, (ref size, ref names)) in self.track_sizes + for (i, (ref size, ref names)) in self + .track_sizes .iter() .zip(&mut line_names_iter) .enumerate() @@ -471,8 +479,7 @@ impl<L: Clone> TrackRepeat<L, specified::Integer> { } /// Track list values. Can be <track-size> or <track-repeat> -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] pub enum TrackListValue<LengthOrPercentage, Integer> { /// A <track-size> value. TrackSize(TrackSize<LengthOrPercentage>), @@ -578,8 +585,7 @@ impl<L: ToCss, I: ToCss> ToCss for TrackList<L, I> { /// /// `subgrid [ <line-names> | repeat(<positive-integer> | auto-fill, <line-names>+) ]+` /// Old spec: https://www.w3.org/TR/2015/WD-css-grid-1-20150917/#typedef-line-name-list -#[derive(Clone, Debug, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue)] +#[derive(Clone, Debug, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] pub struct LineNameList { /// The optional `<line-name-list>` pub names: Box<[Box<[CustomIdent]>]>, @@ -624,7 +630,9 @@ impl Parse for LineNameList { RepeatCount::AutoFill if fill_idx.is_none() => { // `repeat(autof-fill, ..)` should have just one line name. if names_list.len() != 1 { - return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)); + return Err( + input.new_custom_error(StyleParseErrorKind::UnspecifiedError) + ); } let names = names_list.pop().unwrap(); @@ -682,8 +690,7 @@ impl ToCss for LineNameList { /// Variants for `<grid-template-rows> | <grid-template-columns>` /// Subgrid deferred to Level 2 spec due to lack of implementation. /// But it's implemented in gecko, so we have to as well. -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] pub enum GridTemplateComponent<L, I> { /// `none` value. None, diff --git a/components/style/values/generics/image.rs b/components/style/values/generics/image.rs index 2da4d290039..16d348ac47e 100644 --- a/components/style/values/generics/image.rs +++ b/components/style/values/generics/image.rs @@ -145,7 +145,7 @@ pub struct PaintWorklet { pub arguments: Vec<Arc<custom_properties::SpecifiedValue>>, } -impl ::style_traits::SpecifiedValueInfo for PaintWorklet { } +impl ::style_traits::SpecifiedValueInfo for PaintWorklet {} impl ToCss for PaintWorklet { fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result @@ -167,8 +167,7 @@ impl ToCss for PaintWorklet { /// `-moz-image-rect(<uri>, top, right, bottom, left);` #[allow(missing_docs)] #[css(comma, function)] -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] pub struct MozImageRect<NumberOrPercentage, MozImageRectUrl> { pub url: MozImageRectUrl, pub top: NumberOrPercentage, diff --git a/components/style/values/generics/mod.rs b/components/style/values/generics/mod.rs index e6c1befea9f..32ea771cf15 100644 --- a/components/style/values/generics/mod.rs +++ b/components/style/values/generics/mod.rs @@ -157,14 +157,37 @@ impl SpecifiedValueInfo for CounterStyleOrNone { /// A wrapper of Non-negative values. #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, Hash, MallocSizeOf, - PartialEq, PartialOrd, SpecifiedValueInfo, ToAnimatedZero, - ToComputedValue, ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + Hash, + MallocSizeOf, + PartialEq, + PartialOrd, + SpecifiedValueInfo, + ToAnimatedZero, + ToComputedValue, + ToCss, +)] pub struct NonNegative<T>(pub T); /// A wrapper of greater-than-or-equal-to-one values. #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, - PartialEq, PartialOrd, SpecifiedValueInfo, ToAnimatedZero, - ToComputedValue, ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + PartialOrd, + SpecifiedValueInfo, + ToAnimatedZero, + ToComputedValue, + ToCss, +)] pub struct GreaterThanOrEqualToOne<T>(pub T); diff --git a/components/style/values/generics/position.rs b/components/style/values/generics/position.rs index 67c167c41ab..83dc48d0905 100644 --- a/components/style/values/generics/position.rs +++ b/components/style/values/generics/position.rs @@ -6,8 +6,18 @@ //! [`position`](https://drafts.csswg.org/css-backgrounds-3/#position) /// A generic type for representing a CSS [position](https://drafts.csswg.org/css-values/#position). -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, - PartialEq, SpecifiedValueInfo, ToAnimatedZero, ToComputedValue)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedZero, + ToComputedValue, +)] pub struct Position<H, V> { /// The horizontal component of position. pub horizontal: H, @@ -26,8 +36,19 @@ impl<H, V> Position<H, V> { } /// A generic value for the `z-index` property. -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, - PartialEq, SpecifiedValueInfo, ToAnimatedZero, ToComputedValue, ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedZero, + ToComputedValue, + ToCss, +)] pub enum ZIndex<Integer> { /// An integer value. Integer(Integer), diff --git a/components/style/values/generics/rect.rs b/components/style/values/generics/rect.rs index fb67e48a395..510cb75a6f8 100644 --- a/components/style/values/generics/rect.rs +++ b/components/style/values/generics/rect.rs @@ -11,8 +11,17 @@ use style_traits::{CssWriter, ParseError, ToCss}; /// A CSS value made of four components, where its `ToCss` impl will try to /// serialize as few components as possible, like for example in `border-width`. -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, - PartialEq, SpecifiedValueInfo, ToComputedValue)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, +)] pub struct Rect<T>(pub T, pub T, pub T, pub T); impl<T> Rect<T> { diff --git a/components/style/values/generics/size.rs b/components/style/values/generics/size.rs index ad93b94e65e..d7ef5810f05 100644 --- a/components/style/values/generics/size.rs +++ b/components/style/values/generics/size.rs @@ -13,8 +13,17 @@ use values::animated::ToAnimatedValue; /// A generic size, for `border-*-radius` longhand properties, or /// `border-spacing`. -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, - ToAnimatedZero, ToComputedValue)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + ToAnimatedZero, + ToComputedValue, +)] pub struct Size<L>(pub Size2D<L>); impl<L> Size<L> { diff --git a/components/style/values/generics/svg.rs b/components/style/values/generics/svg.rs index 0fbaacf2283..8b8fa786e8f 100644 --- a/components/style/values/generics/svg.rs +++ b/components/style/values/generics/svg.rs @@ -16,8 +16,18 @@ use values::distance::{ComputeSquaredDistance, SquaredDistance}; /// /// <https://www.w3.org/TR/SVG2/painting.html#SpecifyingPaint> #[animation(no_bound(UrlPaintServer))] -#[derive(Animate, Clone, ComputeSquaredDistance, Debug, MallocSizeOf, PartialEq, - SpecifiedValueInfo, ToAnimatedValue, ToComputedValue, ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedValue, + ToComputedValue, + ToCss, +)] pub struct SVGPaint<ColorType, UrlPaintServer> { /// The paint source pub kind: SVGPaintKind<ColorType, UrlPaintServer>, @@ -31,9 +41,19 @@ pub struct SVGPaint<ColorType, UrlPaintServer> { /// to have a fallback, Gecko lets the context /// properties have a fallback as well. #[animation(no_bound(UrlPaintServer))] -#[derive(Animate, Clone, ComputeSquaredDistance, Debug, MallocSizeOf, PartialEq, - SpecifiedValueInfo, ToAnimatedValue, ToAnimatedZero, ToComputedValue, - ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedValue, + ToAnimatedZero, + ToComputedValue, + ToCss, +)] pub enum SVGPaintKind<ColorType, UrlPaintServer> { /// `none` #[animation(error)] @@ -113,8 +133,18 @@ impl<ColorType: Parse, UrlPaintServer: Parse> Parse for SVGPaint<ColorType, UrlP /// A value of <length> | <percentage> | <number> for svg which allow unitless length. /// <https://www.w3.org/TR/SVG11/painting.html#StrokeProperties> -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToAnimatedValue, ToAnimatedZero, ToComputedValue, ToCss)] +#[derive( + Clone, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedValue, + ToAnimatedZero, + ToComputedValue, + ToCss, +)] pub enum SvgLengthOrPercentageOrNumber<LengthOrPercentage, Number> { /// <length> | <percentage> LengthOrPercentage(LengthOrPercentage), @@ -191,9 +221,19 @@ impl<LengthOrPercentageType: Parse, NumberType: Parse> Parse } /// An SVG length value supports `context-value` in addition to length. -#[derive(Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, - SpecifiedValueInfo, ToAnimatedValue, ToAnimatedZero, ToComputedValue, - ToCss)] +#[derive( + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedValue, + ToAnimatedZero, + ToComputedValue, + ToCss, +)] pub enum SVGLength<LengthType> { /// `<length> | <percentage> | <number>` Length(LengthType), @@ -202,23 +242,38 @@ pub enum SVGLength<LengthType> { } /// Generic value for stroke-dasharray. -#[derive(Clone, Debug, MallocSizeOf, PartialEq, - SpecifiedValueInfo, ToAnimatedValue, ToComputedValue, ToCss)] +#[derive( + Clone, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedValue, + ToComputedValue, + ToCss, +)] pub enum SVGStrokeDashArray<LengthType> { /// `[ <length> | <percentage> | <number> ]#` #[css(comma)] - Values( - #[css(if_empty = "none", iterable)] - Vec<LengthType>, - ), + Values(#[css(if_empty = "none", iterable)] Vec<LengthType>), /// `context-value` ContextValue, } /// An SVG opacity value accepts `context-{fill,stroke}-opacity` in /// addition to opacity value. -#[derive(Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, - SpecifiedValueInfo, ToAnimatedZero, ToComputedValue, ToCss)] +#[derive( + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedZero, + ToComputedValue, + ToCss, +)] pub enum SVGOpacity<OpacityType> { /// `<opacity-value>` Opacity(OpacityType), diff --git a/components/style/values/generics/text.rs b/components/style/values/generics/text.rs index 6cc5caaac77..e85c444a695 100644 --- a/components/style/values/generics/text.rs +++ b/components/style/values/generics/text.rs @@ -12,8 +12,9 @@ use values::animated::{Animate, Procedure, ToAnimatedZero}; use values::distance::{ComputeSquaredDistance, SquaredDistance}; /// A generic value for the `initial-letter` property. -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive( + Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, +)] pub enum InitialLetter<Number, Integer> { /// `normal` Normal, @@ -30,8 +31,9 @@ impl<N, I> InitialLetter<N, I> { } /// A generic spacing value for the `letter-spacing` and `word-spacing` properties. -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive( + Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, +)] pub enum Spacing<Value> { /// `normal` Normal, @@ -112,8 +114,18 @@ where } /// A generic value for the `line-height` property. -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, - PartialEq, SpecifiedValueInfo, ToAnimatedValue, ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedValue, + ToCss, +)] pub enum LineHeight<Number, LengthOrPercentage> { /// `normal` Normal, @@ -142,9 +154,20 @@ impl<N, L> LineHeight<N, L> { } /// A generic value for the `-moz-tab-size` property. -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, - PartialEq, SpecifiedValueInfo, ToAnimatedValue, ToAnimatedZero, - ToComputedValue, ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedValue, + ToAnimatedZero, + ToComputedValue, + ToCss, +)] pub enum MozTabSize<Number, Length> { /// A number. Number(Number), diff --git a/components/style/values/generics/transform.rs b/components/style/values/generics/transform.rs index a0cbc57d6b4..cce0464d2ac 100644 --- a/components/style/values/generics/transform.rs +++ b/components/style/values/generics/transform.rs @@ -15,8 +15,9 @@ use values::specified::length::LengthOrPercentage as SpecifiedLengthOrPercentage /// A generic 2D transformation matrix. #[allow(missing_docs)] -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive( + Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, +)] #[css(comma, function)] pub struct Matrix<T> { pub a: T, @@ -66,8 +67,19 @@ impl<T: Into<f64>> From<Matrix3D<T>> for Transform3D<f64> { } /// A generic transform origin. -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, - PartialEq, SpecifiedValueInfo, ToAnimatedZero, ToComputedValue, ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedZero, + ToComputedValue, + ToCss, +)] pub struct TransformOrigin<H, V, Depth> { /// The horizontal origin. pub horizontal: H, @@ -80,8 +92,7 @@ pub struct TransformOrigin<H, V, Depth> { /// A generic timing function. /// /// <https://drafts.csswg.org/css-timing-1/#single-timing-function-production> -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] #[value_info(ty = "TIMING_FUNCTION")] pub enum TimingFunction<Integer, Number> { /// `linear | ease | ease-in | ease-out | ease-in-out` @@ -106,8 +117,18 @@ pub enum TimingFunction<Integer, Number> { #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, - SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, + Copy, + Debug, + Eq, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, +)] pub enum TimingKeyword { Linear, Ease, @@ -163,8 +184,7 @@ impl TimingKeyword { } } -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] /// A single operation in the list of a `transform` value pub enum TransformOperation<Angle, Number, Length, Integer, LengthOrPercentage> { /// Represents a 2D 2x3 matrix. @@ -268,8 +288,7 @@ pub enum TransformOperation<Angle, Number, Length, Integer, LengthOrPercentage> }, } -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] /// A value of the `transform` property pub struct Transform<T>(#[css(if_empty = "none", iterable)] pub Vec<T>); @@ -281,11 +300,7 @@ impl<Angle, Number, Length, Integer, LengthOrPercentage> use self::TransformOperation::*; matches!( *self, - Rotate(..) | - Rotate3D(..) | - RotateX(..) | - RotateY(..) | - RotateZ(..) + Rotate(..) | Rotate3D(..) | RotateX(..) | RotateY(..) | RotateZ(..) ) } @@ -574,8 +589,18 @@ pub fn get_normalized_vector_and_angle<T: Zero>( } } -#[derive(Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, - SpecifiedValueInfo, ToAnimatedZero, ToComputedValue, ToCss)] +#[derive( + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedZero, + ToComputedValue, + ToCss, +)] /// A value of the `Rotate` property /// /// <https://drafts.csswg.org/css-transforms-2/#individual-transforms> @@ -588,8 +613,18 @@ pub enum Rotate<Number, Angle> { Rotate3D(Number, Number, Number, Angle), } -#[derive(Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, - SpecifiedValueInfo, ToAnimatedZero, ToComputedValue, ToCss)] +#[derive( + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedZero, + ToComputedValue, + ToCss, +)] /// A value of the `Scale` property /// /// <https://drafts.csswg.org/css-transforms-2/#individual-transforms> @@ -604,8 +639,17 @@ pub enum Scale<Number> { Scale3D(Number, Number, Number), } -#[derive(Clone, ComputeSquaredDistance, Debug, MallocSizeOf, PartialEq, - SpecifiedValueInfo, ToAnimatedZero, ToComputedValue, ToCss)] +#[derive( + Clone, + ComputeSquaredDistance, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedZero, + ToComputedValue, + ToCss, +)] /// A value of the `Translate` property /// /// <https://drafts.csswg.org/css-transforms-2/#individual-transforms> @@ -621,8 +665,9 @@ pub enum Translate<LengthOrPercentage, Length> { } #[allow(missing_docs)] -#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive( + Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, +)] pub enum TransformStyle { #[cfg(feature = "servo")] Auto, diff --git a/components/style/values/generics/ui.rs b/components/style/values/generics/ui.rs index 9ccf1f80d53..bef1926bc90 100644 --- a/components/style/values/generics/ui.rs +++ b/components/style/values/generics/ui.rs @@ -11,8 +11,7 @@ use style_traits::cursor::CursorKind; /// A generic value for the `cursor` property. /// /// https://drafts.csswg.org/css-ui/#cursor -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] pub struct Cursor<Image> { /// The parsed images for the cursor. pub images: Box<[Image]>, @@ -45,8 +44,7 @@ impl<Image: ToCss> ToCss for Cursor<Image> { } /// A generic value for item of `image cursors`. -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] pub struct CursorImage<ImageUrl, Number> { /// The url to parse images from. pub url: ImageUrl, diff --git a/components/style/values/generics/url.rs b/components/style/values/generics/url.rs index 5da74a7b087..ff9fa16d665 100644 --- a/components/style/values/generics/url.rs +++ b/components/style/values/generics/url.rs @@ -9,9 +9,19 @@ use parser::{Parse, ParserContext}; use style_traits::ParseError; /// An image url or none, used for example in list-style-image -#[derive(Animate, Clone, ComputeSquaredDistance, Debug, MallocSizeOf, PartialEq, - SpecifiedValueInfo, ToAnimatedValue, ToAnimatedZero, ToComputedValue, - ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedValue, + ToAnimatedZero, + ToComputedValue, + ToCss, +)] pub enum UrlOrNone<Url> { /// `none` None, diff --git a/components/style/values/mod.rs b/components/style/values/mod.rs index a5f8d0abd32..d3ae6a83971 100644 --- a/components/style/values/mod.rs +++ b/components/style/values/mod.rs @@ -92,8 +92,13 @@ where } /// Convenience void type to disable some properties and values through types. -#[cfg_attr(feature = "servo", derive(Deserialize, MallocSizeOf, Serialize))] -#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToAnimatedValue, ToComputedValue, ToCss)] +#[cfg_attr( + feature = "servo", + derive(Deserialize, MallocSizeOf, Serialize) +)] +#[derive( + Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToAnimatedValue, ToComputedValue, ToCss, +)] pub enum Impossible {} // FIXME(nox): This should be derived but the derive code cannot cope @@ -115,9 +120,19 @@ impl Parse for Impossible { } /// A struct representing one of two kinds of values. -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, MallocSizeOf, PartialEq, - SpecifiedValueInfo, ToAnimatedValue, ToAnimatedZero, ToComputedValue, - ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedValue, + ToAnimatedZero, + ToComputedValue, + ToCss, +)] pub enum Either<A, B> { /// The first value. First(A), @@ -148,8 +163,7 @@ impl<A: Parse, B: Parse> Parse for Either<A, B> { } /// <https://drafts.csswg.org/css-values-4/#custom-idents> -#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue)] +#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] pub struct CustomIdent(pub Atom); impl CustomIdent { @@ -164,7 +178,9 @@ impl CustomIdent { _ => true }; if !valid { - return Err(location.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(ident.clone()))); + return Err( + location.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(ident.clone())) + ); } if excluding.iter().any(|s| ident.eq_ignore_ascii_case(s)) { Err(location.new_custom_error(StyleParseErrorKind::UnspecifiedError)) diff --git a/components/style/values/specified/align.rs b/components/style/values/specified/align.rs index 731844bcb52..858ecce065d 100644 --- a/components/style/values/specified/align.rs +++ b/components/style/values/specified/align.rs @@ -683,8 +683,13 @@ fn parse_self_position<'i, 't>( fn list_self_position_keywords(f: KeywordsCollectFn, axis: AxisDirection) { f(&[ - "start", "end", "flex-start", "flex-end", - "center", "self-start", "self-end", + "start", + "end", + "flex-start", + "flex-end", + "center", + "self-start", + "self-end", ]); if axis == AxisDirection::Inline { f(&["left", "right"]); diff --git a/components/style/values/specified/background.rs b/components/style/values/specified/background.rs index d7c4ec629ca..6c85d6ec5a6 100644 --- a/components/style/values/specified/background.rs +++ b/components/style/values/specified/background.rs @@ -43,8 +43,18 @@ impl BackgroundSize { } /// One of the keywords for `background-repeat`. -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, - SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, + Copy, + Debug, + Eq, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, +)] #[allow(missing_docs)] pub enum BackgroundRepeatKeyword { Repeat, @@ -56,8 +66,7 @@ pub enum BackgroundRepeatKeyword { /// The specified value for the `background-repeat` property. /// /// https://drafts.csswg.org/css-backgrounds/#the-background-repeat -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] pub enum BackgroundRepeat { /// `repeat-x` RepeatX, @@ -91,7 +100,9 @@ impl Parse for BackgroundRepeat { let horizontal = match BackgroundRepeatKeyword::from_ident(&ident) { Ok(h) => h, Err(()) => { - return Err(input.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(ident.clone()))); + return Err( + input.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(ident.clone())) + ); }, }; diff --git a/components/style/values/specified/basic_shape.rs b/components/style/values/specified/basic_shape.rs index 18541b8dbce..cdafbf14b37 100644 --- a/components/style/values/specified/basic_shape.rs +++ b/components/style/values/specified/basic_shape.rs @@ -268,8 +268,7 @@ impl Ellipse { ShapeRadius::parse(context, i)?, ShapeRadius::parse(context, i)?, )) - }) - .unwrap_or_default(); + }).unwrap_or_default(); let position = if input.try(|i| i.expect_ident_matching("at")).is_ok() { Position::parse(context, input)? } else { @@ -416,8 +415,7 @@ impl Polygon { let fill = FillRule::parse(i)?; i.expect_comma()?; // only eat the comma if there is something before it Ok(fill) - }) - .unwrap_or_default(); + }).unwrap_or_default(); let buf = input.parse_comma_separated(|i| { Ok(PolygonCoord( @@ -449,11 +447,12 @@ impl Path { context: &ParserContext, input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i>> { - let fill = input.try(|i| -> Result<_, ParseError> { - let fill = FillRule::parse(i)?; - i.expect_comma()?; - Ok(fill) - }).unwrap_or_default(); + let fill = input + .try(|i| -> Result<_, ParseError> { + let fill = FillRule::parse(i)?; + i.expect_comma()?; + Ok(fill) + }).unwrap_or_default(); let path = SVGPathData::parse(context, input)?; Ok(Path { fill, path }) } diff --git a/components/style/values/specified/border.rs b/components/style/values/specified/border.rs index 0713ed99eb9..7a681c2ef2c 100644 --- a/components/style/values/specified/border.rs +++ b/components/style/values/specified/border.rs @@ -189,8 +189,7 @@ impl Parse for BorderSpacing { /// A single border-image-repeat keyword. #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, - SpecifiedValueInfo, ToCss)] +#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss)] pub enum BorderImageRepeatKeyword { Stretch, Repeat, @@ -201,8 +200,7 @@ pub enum BorderImageRepeatKeyword { /// The specified value for the `border-image-repeat` property. /// /// https://drafts.csswg.org/css-backgrounds/#the-border-image-repeat -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] pub struct BorderImageRepeat(pub BorderImageRepeatKeyword, pub BorderImageRepeatKeyword); impl ToCss for BorderImageRepeat { diff --git a/components/style/values/specified/box.rs b/components/style/values/specified/box.rs index 9554d76890c..e23ec4a745a 100644 --- a/components/style/values/specified/box.rs +++ b/components/style/values/specified/box.rs @@ -21,26 +21,23 @@ use values::specified::length::{LengthOrPercentage, NonNegativeLength}; fn in_ua_or_chrome_sheet(context: &ParserContext) -> bool { use stylesheets::Origin; - context.stylesheet_origin == Origin::UserAgent || - context.chrome_rules_enabled() + context.stylesheet_origin == Origin::UserAgent || context.chrome_rules_enabled() } #[cfg(feature = "gecko")] fn moz_display_values_enabled(context: &ParserContext) -> bool { use gecko_bindings::structs; in_ua_or_chrome_sheet(context) || - unsafe { - structs::StaticPrefs_sVarCache_layout_css_xul_display_values_content_enabled - } + unsafe { structs::StaticPrefs_sVarCache_layout_css_xul_display_values_content_enabled } } #[cfg(feature = "gecko")] fn moz_box_display_values_enabled(context: &ParserContext) -> bool { use gecko_bindings::structs; in_ua_or_chrome_sheet(context) || - unsafe { - structs::StaticPrefs_sVarCache_layout_css_xul_box_display_values_content_enabled - } + unsafe { + structs::StaticPrefs_sVarCache_layout_css_xul_box_display_values_content_enabled + } } /// Defines an element’s display type, which consists of @@ -57,8 +54,20 @@ fn moz_box_display_values_enabled(context: &ParserContext) -> bool { /// Also, when you change this from Gecko you may need to regenerate the /// C++-side bindings (see components/style/cbindgen.toml). #[allow(missing_docs)] -#[derive(Clone, Copy, Debug, Eq, FromPrimitive, Hash, MallocSizeOf, Parse, - PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, + Copy, + Debug, + Eq, + FromPrimitive, + Hash, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, +)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[repr(u8)] pub enum Display { @@ -200,7 +209,10 @@ impl Display { pub fn is_ruby_type(&self) -> bool { matches!( *self, - Display::Ruby | Display::RubyBase | Display::RubyText | Display::RubyBaseContainer | + Display::Ruby | + Display::RubyBase | + Display::RubyText | + Display::RubyBaseContainer | Display::RubyTextContainer ) } @@ -346,8 +358,7 @@ impl AnimationIterationCount { } /// A value for the `animation-name` property. -#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue)] +#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] #[value_info(other_values = "none")] pub struct AnimationName(pub Option<KeyframesName>); @@ -391,8 +402,18 @@ impl Parse for AnimationName { #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, - SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, + Copy, + Debug, + Eq, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, +)] pub enum ScrollSnapType { None, Mandatory, @@ -401,8 +422,18 @@ pub enum ScrollSnapType { #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, - SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, + Copy, + Debug, + Eq, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, +)] pub enum OverscrollBehavior { Auto, Contain, @@ -411,15 +442,24 @@ pub enum OverscrollBehavior { #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, - SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, + Copy, + Debug, + Eq, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, +)] pub enum OverflowClipBox { PaddingBox, ContentBox, } -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] /// Provides a rendering hint to the user agent, /// stating what kinds of changes the author expects /// to perform on the element @@ -497,11 +537,11 @@ fn change_bits_for_maybe_property(ident: &str, context: &ParserContext) -> WillC }; match id.as_shorthand() { - Ok(shorthand) => { - shorthand.longhands().fold(WillChangeBits::empty(), |flags, p| { + Ok(shorthand) => shorthand + .longhands() + .fold(WillChangeBits::empty(), |flags, p| { flags | change_bits_for_longhand(p) - }) - } + }), Err(PropertyDeclarationId::Longhand(longhand)) => change_bits_for_longhand(longhand), Err(PropertyDeclarationId::Custom(..)) => WillChangeBits::empty(), } @@ -581,9 +621,8 @@ impl ToCss for TouchAction { TouchAction::TOUCH_ACTION_NONE => dest.write_str("none"), TouchAction::TOUCH_ACTION_AUTO => dest.write_str("auto"), TouchAction::TOUCH_ACTION_MANIPULATION => dest.write_str("manipulation"), - _ if self.contains( - TouchAction::TOUCH_ACTION_PAN_X | TouchAction::TOUCH_ACTION_PAN_Y, - ) => + _ if self + .contains(TouchAction::TOUCH_ACTION_PAN_X | TouchAction::TOUCH_ACTION_PAN_Y) => { dest.write_str("pan-x pan-y") }, @@ -756,8 +795,7 @@ impl Parse for Perspective { return Ok(GenericPerspective::None); } Ok(GenericPerspective::Length(NonNegativeLength::parse( - context, - input, + context, input, )?)) } } @@ -789,7 +827,7 @@ impl ToCss for TransitionProperty { TransitionProperty::Custom(ref name) => { dest.write_str("--")?; serialize_atom_name(name, dest) - } + }, TransitionProperty::Unsupported(ref i) => i.to_css(dest), } } @@ -805,21 +843,21 @@ impl Parse for TransitionProperty { let id = match PropertyId::parse_ignoring_rule_type(&ident, context) { Ok(id) => id, - Err(..) => return Ok(TransitionProperty::Unsupported( - CustomIdent::from_ident(location, ident, &["none"])?, - )), + Err(..) => { + return Ok(TransitionProperty::Unsupported(CustomIdent::from_ident( + location, + ident, + &["none"], + )?)) + }, }; Ok(match id.as_shorthand() { Ok(s) => TransitionProperty::Shorthand(s), - Err(longhand_or_custom) => { - match longhand_or_custom { - PropertyDeclarationId::Longhand(id) => TransitionProperty::Longhand(id), - PropertyDeclarationId::Custom(custom) => { - TransitionProperty::Custom(custom.clone()) - } - } - } + Err(longhand_or_custom) => match longhand_or_custom { + PropertyDeclarationId::Longhand(id) => TransitionProperty::Longhand(id), + PropertyDeclarationId::Custom(custom) => TransitionProperty::Custom(custom.clone()), + }, }) } } @@ -846,19 +884,19 @@ impl TransitionProperty { Ok(match *self { TransitionProperty::Shorthand(ShorthandId::All) => { ::gecko_bindings::structs::nsCSSPropertyID::eCSSPropertyExtra_all_properties - } + }, TransitionProperty::Shorthand(ref id) => id.to_nscsspropertyid(), TransitionProperty::Longhand(ref id) => id.to_nscsspropertyid(), - TransitionProperty::Custom(..) | - TransitionProperty::Unsupported(..) => return Err(()), + TransitionProperty::Custom(..) | TransitionProperty::Unsupported(..) => return Err(()), }) } } #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, - SpecifiedValueInfo, ToCss)] +#[derive( + Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, +)] /// https://drafts.csswg.org/css-box/#propdef-float pub enum Float { Left, @@ -866,13 +904,14 @@ pub enum Float { None, // https://drafts.csswg.org/css-logical-props/#float-clear InlineStart, - InlineEnd + InlineEnd, } #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, - SpecifiedValueInfo, ToCss)] +#[derive( + Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, +)] /// https://drafts.csswg.org/css-box/#propdef-clear pub enum Clear { None, @@ -881,14 +920,15 @@ pub enum Clear { Both, // https://drafts.csswg.org/css-logical-props/#float-clear InlineStart, - InlineEnd + InlineEnd, } /// https://drafts.csswg.org/css-ui/#propdef-resize #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, - SpecifiedValueInfo, ToCss)] +#[derive( + Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, +)] pub enum Resize { None, Both, @@ -906,8 +946,19 @@ pub enum Resize { /// NOTE(emilio): When changing this you may want to regenerate the C++ bindings /// (see components/style/cbindgen.toml) #[allow(missing_docs)] -#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, - SpecifiedValueInfo, ToCss, ToComputedValue)] +#[derive( + Clone, + Copy, + Debug, + Eq, + Hash, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToCss, + ToComputedValue, +)] #[repr(u8)] pub enum Appearance { /// No appearance at all. diff --git a/components/style/values/specified/color.rs b/components/style/values/specified/color.rs index c05f0ddce0e..cce8f381806 100644 --- a/components/style/values/specified/color.rs +++ b/components/style/values/specified/color.rs @@ -89,11 +89,11 @@ impl<'a, 'b: 'a, 'i: 'a> ::cssparser::ColorComponentParser<'i> for ColorComponen }; Ok(AngleOrNumber::Angle { degrees }) - } + }, Token::Number { value, .. } => Ok(AngleOrNumber::Number { value }), Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => { input.parse_nested_block(|i| CalcNode::parse_angle_or_number(self.0, i)) - } + }, t => return Err(location.new_unexpected_token_error(t)), } } @@ -120,10 +120,10 @@ impl<'a, 'b: 'a, 'i: 'a> ::cssparser::ColorComponentParser<'i> for ColorComponen Token::Number { value, .. } => Ok(NumberOrPercentage::Number { value }), Token::Percentage { unit_value, .. } => { Ok(NumberOrPercentage::Percentage { unit_value }) - } + }, Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => { input.parse_nested_block(|i| CalcNode::parse_number_or_percentage(self.0, i)) - } + }, t => return Err(location.new_unexpected_token_error(t)), } } @@ -169,10 +169,10 @@ impl Parse for Color { Err(e.location.new_custom_error(StyleParseErrorKind::ValueError( ValueParseErrorKind::InvalidColor(t), ))) - } + }, _ => Err(e), } - } + }, } } } @@ -276,10 +276,10 @@ impl Color { } return parse_hash_color(ident.as_bytes()) .map_err(|()| location.new_custom_error(StyleParseErrorKind::UnspecifiedError)); - } + }, ref t => { return Err(location.new_unexpected_token_error(t.clone())); - } + }, }; if value < 0 { return Err(location.new_custom_error(StyleParseErrorKind::UnspecifiedError)); @@ -359,11 +359,11 @@ impl Color { Keyword::MozVisitedhyperlinktext => pres_context.mVisitedLinkColor, }) }) - } + }, #[cfg(feature = "gecko")] Color::InheritFromBodyQuirk => { _context.map(|context| ComputedColor::rgba(context.device().body_text_color())) - } + }, } } } diff --git a/components/style/values/specified/column.rs b/components/style/values/specified/column.rs index d065835423d..4cd8ad0777f 100644 --- a/components/style/values/specified/column.rs +++ b/components/style/values/specified/column.rs @@ -22,8 +22,7 @@ impl Parse for ColumnCount { return Ok(GenericColumnCount::Auto); } Ok(GenericColumnCount::Integer(PositiveInteger::parse( - context, - input, + context, input, )?)) } } diff --git a/components/style/values/specified/counters.rs b/components/style/values/specified/counters.rs index ea369f9dec7..ce7e3991227 100644 --- a/components/style/values/specified/counters.rs +++ b/components/style/values/specified/counters.rs @@ -93,8 +93,7 @@ impl Content { .try(|input| { input.expect_comma()?; ListStyleType::parse(input) - }) - .unwrap_or(ListStyleType::Decimal) + }).unwrap_or(ListStyleType::Decimal) } #[cfg(feature = "gecko")] @@ -103,8 +102,7 @@ impl Content { .try(|input| { input.expect_comma()?; CounterStyleOrNone::parse(context, input) - }) - .unwrap_or(CounterStyleOrNone::decimal()) + }).unwrap_or(CounterStyleOrNone::decimal()) } } diff --git a/components/style/values/specified/effects.rs b/components/style/values/specified/effects.rs index c3304b05af0..861414ca756 100644 --- a/components/style/values/specified/effects.rs +++ b/components/style/values/specified/effects.rs @@ -118,9 +118,9 @@ impl Parse for BoxShadow { let value = input.try::<_, _, ParseError>(|i| { let horizontal = Length::parse(context, i)?; let vertical = Length::parse(context, i)?; - let (blur, spread) = match i.try::<_, _, ParseError>(|i| { - Length::parse_non_negative(context, i) - }) { + let (blur, spread) = match i + .try::<_, _, ParseError>(|i| Length::parse_non_negative(context, i)) + { Ok(blur) => { let spread = i.try(|i| Length::parse(context, i)).ok(); (Some(blur.into()), spread) @@ -143,7 +143,8 @@ impl Parse for BoxShadow { break; } - let lengths = lengths.ok_or(input.new_custom_error(StyleParseErrorKind::UnspecifiedError))?; + let lengths = + lengths.ok_or(input.new_custom_error(StyleParseErrorKind::UnspecifiedError))?; Ok(BoxShadow { base: SimpleShadow { color: color, @@ -164,7 +165,8 @@ impl ToComputedValue for BoxShadow { fn to_computed_value(&self, context: &Context) -> Self::ComputedValue { ComputedBoxShadow { base: self.base.to_computed_value(context), - spread: self.spread + spread: self + .spread .as_ref() .unwrap_or(&Length::zero()) .to_computed_value(context), @@ -271,13 +273,15 @@ impl ToComputedValue for SimpleShadow { #[inline] fn to_computed_value(&self, context: &Context) -> Self::ComputedValue { ComputedSimpleShadow { - color: self.color + color: self + .color .as_ref() .unwrap_or(&Color::currentcolor()) .to_computed_value(context), horizontal: self.horizontal.to_computed_value(context), vertical: self.vertical.to_computed_value(context), - blur: self.blur + blur: self + .blur .as_ref() .unwrap_or(&NonNegativeLength::zero()) .to_computed_value(context), diff --git a/components/style/values/specified/font.rs b/components/style/values/specified/font.rs index 8d8355821e8..d9cf921bca5 100644 --- a/components/style/values/specified/font.rs +++ b/components/style/values/specified/font.rs @@ -148,9 +148,9 @@ impl ToComputedValue for FontWeight { #[inline] fn from_computed_value(computed: &computed::FontWeight) -> Self { - FontWeight::Absolute(AbsoluteFontWeight::Weight( - Number::from_computed_value(&computed.0) - )) + FontWeight::Absolute(AbsoluteFontWeight::Weight(Number::from_computed_value( + &computed.0, + ))) } } @@ -174,9 +174,7 @@ impl AbsoluteFontWeight { pub fn compute(&self) -> computed::FontWeight { match *self { AbsoluteFontWeight::Weight(weight) => { - computed::FontWeight( - weight.get().max(MIN_FONT_WEIGHT).min(MAX_FONT_WEIGHT) - ) + computed::FontWeight(weight.get().max(MIN_FONT_WEIGHT).min(MAX_FONT_WEIGHT)) }, AbsoluteFontWeight::Normal => computed::FontWeight::normal(), AbsoluteFontWeight::Bold => computed::FontWeight::bold(), @@ -194,12 +192,11 @@ impl Parse for AbsoluteFontWeight { // seem worth it just for a single property with such a weird range, // so we do the clamping here manually. if !number.was_calc() && - (number.get() < MIN_FONT_WEIGHT || number.get() > MAX_FONT_WEIGHT) { - return Err(input.new_custom_error( - StyleParseErrorKind::UnspecifiedError - )) + (number.get() < MIN_FONT_WEIGHT || number.get() > MAX_FONT_WEIGHT) + { + return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)); } - return Ok(AbsoluteFontWeight::Weight(number)) + return Ok(AbsoluteFontWeight::Weight(number)); } Ok(try_match_ident_ignore_ascii_case! { input, @@ -228,7 +225,7 @@ impl ToCss for SpecifiedFontStyle { angle.to_css(dest)?; } Ok(()) - } + }, } } } @@ -260,7 +257,7 @@ impl ToComputedValue for SpecifiedFontStyle { generics::FontStyle::Italic => generics::FontStyle::Italic, generics::FontStyle::Oblique(ref angle) => { generics::FontStyle::Oblique(FontStyleAngle(Self::compute_angle(angle))) - } + }, } } @@ -270,12 +267,11 @@ impl ToComputedValue for SpecifiedFontStyle { generics::FontStyle::Italic => generics::FontStyle::Italic, generics::FontStyle::Oblique(ref angle) => { generics::FontStyle::Oblique(Angle::from_computed_value(&angle.0)) - } + }, } } } - /// The default angle for `font-style: oblique`. /// /// NOTE(emilio): As of right now this diverges from the spec, which specifies @@ -299,9 +295,10 @@ impl SpecifiedFontStyle { /// Gets a clamped angle from a specified Angle. pub fn compute_angle(angle: &Angle) -> ComputedAngle { ComputedAngle::Deg( - angle.degrees() + angle + .degrees() .max(FONT_STYLE_OBLIQUE_MIN_ANGLE_DEGREES) - .min(FONT_STYLE_OBLIQUE_MAX_ANGLE_DEGREES) + .min(FONT_STYLE_OBLIQUE_MAX_ANGLE_DEGREES), ) } @@ -319,11 +316,9 @@ impl SpecifiedFontStyle { if degrees < FONT_STYLE_OBLIQUE_MIN_ANGLE_DEGREES || degrees > FONT_STYLE_OBLIQUE_MAX_ANGLE_DEGREES { - return Err(input.new_custom_error( - StyleParseErrorKind::UnspecifiedError - )); + return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)); } - return Ok(angle) + return Ok(angle); } /// The default angle for `font-style: oblique`. @@ -336,8 +331,7 @@ impl SpecifiedFontStyle { } /// The specified value of the `font-style` property. -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] #[allow(missing_docs)] pub enum FontStyle { Specified(SpecifiedFontStyle), @@ -375,7 +369,9 @@ impl Parse for FontStyle { context: &ParserContext, input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i>> { - Ok(FontStyle::Specified(SpecifiedFontStyle::parse(context, input)?)) + Ok(FontStyle::Specified(SpecifiedFontStyle::parse( + context, input, + )?)) } } @@ -383,8 +379,7 @@ impl Parse for FontStyle { /// /// https://drafts.csswg.org/css-fonts-4/#font-stretch-prop #[allow(missing_docs)] -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] pub enum FontStretch { Stretch(Percentage), Keyword(FontStretchKeyword), @@ -393,8 +388,7 @@ pub enum FontStretch { } /// A keyword value for `font-stretch`. -#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, - ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss)] #[allow(missing_docs)] pub enum FontStretchKeyword { Normal, @@ -497,9 +491,7 @@ impl ToComputedValue for FontStretch { FontStretch::Stretch(ref percentage) => { computed::FontStretch(NonNegative(percentage.to_computed_value(context))) }, - FontStretch::Keyword(ref kw) => { - computed::FontStretch(NonNegative(kw.compute())) - }, + FontStretch::Keyword(ref kw) => computed::FontStretch(NonNegative(kw.compute())), FontStretch::System(_) => self.compute_system(context), } } @@ -690,8 +682,7 @@ impl Parse for FontSizeAdjust { } Ok(FontSizeAdjust::Number(Number::parse_non_negative( - context, - input, + context, input, )?)) } } @@ -906,10 +897,11 @@ impl FontSize { // new ones. // // This is enough of an edge case to not really matter. - let abs = calc.to_computed_value_zoomed( - context, - FontBaseSize::InheritedStyleButStripEmUnits, - ).length_component(); + let abs = calc + .to_computed_value_zoomed( + context, + FontBaseSize::InheritedStyleButStripEmUnits, + ).length_component(); info = parent.keyword_info.map(|i| i.compose(ratio, abs.into())); } @@ -1939,8 +1931,7 @@ impl Parse for FontFeatureSettings { } } -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] /// Whether user agents are allowed to synthesize bold or oblique font faces /// when a font family lacks bold or italic faces pub struct FontSynthesis { @@ -2217,8 +2208,9 @@ impl Parse for VariationValue<Number> { } } -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive( + Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, +)] /// text-zoom. Enable if true, disable if false pub struct XTextZoom(#[css(skip)] pub bool); @@ -2235,8 +2227,7 @@ impl Parse for XTextZoom { } } -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] /// Internal property that reflects the lang attribute pub struct XLang(#[css(skip)] pub Atom); @@ -2324,8 +2315,7 @@ impl Parse for MozScriptLevel { } #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] -#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToComputedValue, - ToCss)] +#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] /// Specifies the multiplier to be used to adjust font size /// due to changes in scriptlevel. /// diff --git a/components/style/values/specified/grid.rs b/components/style/values/specified/grid.rs index 830cccaf2e2..ad95264c595 100644 --- a/components/style/values/specified/grid.rs +++ b/components/style/values/specified/grid.rs @@ -22,7 +22,8 @@ pub fn parse_flex<'i, 't>(input: &mut Parser<'i, 't>) -> Result<CSSFloat, ParseE match *input.next()? { Token::Dimension { value, ref unit, .. - } if unit.eq_ignore_ascii_case("fr") && value.is_sign_positive() => + } + if unit.eq_ignore_ascii_case("fr") && value.is_sign_positive() => { Ok(value) }, @@ -76,7 +77,8 @@ impl Parse for TrackSize<LengthOrPercentage> { } input.expect_function_matching("fit-content")?; - let lop = input.parse_nested_block(|i| LengthOrPercentage::parse_non_negative(context, i))?; + let lop = + input.parse_nested_block(|i| LengthOrPercentage::parse_non_negative(context, i))?; Ok(TrackSize::FitContent(lop)) } } @@ -175,7 +177,9 @@ impl TrackRepeat<LengthOrPercentage, Integer> { } else { if values.is_empty() { // expecting at least one <track-size> - return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)); + return Err( + input.new_custom_error(StyleParseErrorKind::UnspecifiedError) + ); } names.push(current_names); // final `<line-names>` @@ -217,9 +221,11 @@ impl Parse for TrackList<LengthOrPercentage, Integer> { // assume that everything is <fixed-size>. This flag is useful when we encounter <auto-repeat> let mut atleast_one_not_fixed = false; loop { - current_names.extend_from_slice(&mut input - .try(parse_line_names) - .unwrap_or(vec![].into_boxed_slice())); + current_names.extend_from_slice( + &mut input + .try(parse_line_names) + .unwrap_or(vec![].into_boxed_slice()), + ); if let Ok(track_size) = input.try(|i| TrackSize::parse(context, i)) { if !track_size.is_fixed() { atleast_one_not_fixed = true; @@ -244,13 +250,17 @@ impl Parse for TrackList<LengthOrPercentage, Integer> { atleast_one_not_fixed = true; if auto_repeat.is_some() { // only <fixed-repeat> - return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)); + return Err( + input.new_custom_error(StyleParseErrorKind::UnspecifiedError) + ); } }, RepeatType::Auto => { if auto_repeat.is_some() || atleast_one_not_fixed { // We've either seen <auto-repeat> earlier, or there's at least one non-fixed value - return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)); + return Err( + input.new_custom_error(StyleParseErrorKind::UnspecifiedError) + ); } list_type = TrackListType::Auto(values.len() as u16 + auto_offset); @@ -342,7 +352,8 @@ impl ToComputedValue for TrackList<LengthOrPercentage, Integer> { list_type: self.list_type.to_computed_value(context), values: values, line_names: line_names.into_boxed_slice(), - auto_repeat: self.auto_repeat + auto_repeat: self + .auto_repeat .clone() .map(|repeat| repeat.to_computed_value(context)), } diff --git a/components/style/values/specified/image.rs b/components/style/values/specified/image.rs index 64d24573f4a..1c0a613e488 100644 --- a/components/style/values/specified/image.rs +++ b/components/style/values/specified/image.rs @@ -55,19 +55,19 @@ impl SpecifiedValueInfo for Gradient { fn collect_completion_keywords(f: KeywordsCollectFn) { // This list here should keep sync with that in Gradient::parse. f(&[ - "linear-gradient", - "-webkit-linear-gradient", - "-moz-linear-gradient", - "repeating-linear-gradient", - "-webkit-repeating-linear-gradient", - "-moz-repeating-linear-gradient", - "radial-gradient", - "-webkit-radial-gradient", - "-moz-radial-gradient", - "repeating-radial-gradient", - "-webkit-repeating-radial-gradient", - "-moz-repeating-radial-gradient", - "-webkit-gradient", + "linear-gradient", + "-webkit-linear-gradient", + "-moz-linear-gradient", + "repeating-linear-gradient", + "-webkit-repeating-linear-gradient", + "-moz-repeating-linear-gradient", + "radial-gradient", + "-webkit-radial-gradient", + "-moz-radial-gradient", + "repeating-radial-gradient", + "-webkit-repeating-radial-gradient", + "-moz-repeating-radial-gradient", + "-webkit-gradient", ]); } } @@ -239,9 +239,9 @@ impl Parse for Gradient { #[cfg(feature = "gecko")] { use gecko_bindings::structs; - if compat_mode == CompatMode::Moz && !unsafe { - structs::StaticPrefs_sVarCache_layout_css_prefixes_gradients - } { + if compat_mode == CompatMode::Moz && + !unsafe { structs::StaticPrefs_sVarCache_layout_css_prefixes_gradients } + { return Err(input.new_custom_error(StyleParseErrorKind::UnexpectedFunction(func))); } } @@ -760,9 +760,9 @@ impl LineDirection { // There is no `to` keyword in webkit prefixed syntax. If it's consumed, // parsing should throw an error. CompatMode::WebKit if to_ident.is_ok() => { - return Err(i.new_custom_error(SelectorParseErrorKind::UnexpectedIdent( - "to".into(), - ))) + return Err( + i.new_custom_error(SelectorParseErrorKind::UnexpectedIdent("to".into())) + ) }, _ => {}, } @@ -969,8 +969,7 @@ impl Parse for PaintWorklet { .try(|input| { input.expect_comma()?; input.parse_comma_separated(|input| SpecifiedValue::parse(input)) - }) - .unwrap_or(vec![]); + }).unwrap_or(vec![]); Ok(PaintWorklet { name, arguments }) }) } diff --git a/components/style/values/specified/length.rs b/components/style/values/specified/length.rs index b6fe9bc2346..1b4efc4f00d 100644 --- a/components/style/values/specified/length.rs +++ b/components/style/values/specified/length.rs @@ -566,14 +566,16 @@ impl Length { match *token { Token::Dimension { value, ref unit, .. - } if num_context.is_ok(context.parsing_mode, value) => + } + if num_context.is_ok(context.parsing_mode, value) => { return NoCalcLength::parse_dimension(context, value, unit) .map(Length::NoCalc) .map_err(|()| location.new_unexpected_token_error(token.clone())) }, Token::Number { value, .. } if num_context.is_ok(context.parsing_mode, value) => { - if value != 0. && !context.parsing_mode.allows_unitless_lengths() && + if value != 0. && + !context.parsing_mode.allows_unitless_lengths() && !allow_quirks.allowed(context.quirks_mode) { return Err(location.new_custom_error(StyleParseErrorKind::UnspecifiedError)); @@ -753,7 +755,8 @@ impl LengthOrPercentage { match *token { Token::Dimension { value, ref unit, .. - } if num_context.is_ok(context.parsing_mode, value) => + } + if num_context.is_ok(context.parsing_mode, value) => { return NoCalcLength::parse_dimension(context, value, unit) .map(LengthOrPercentage::Length) @@ -767,7 +770,8 @@ impl LengthOrPercentage { ))) }, Token::Number { value, .. } if num_context.is_ok(context.parsing_mode, value) => { - if value != 0. && !context.parsing_mode.allows_unitless_lengths() && + if value != 0. && + !context.parsing_mode.allows_unitless_lengths() && !allow_quirks.allowed(context.quirks_mode) { return Err(location.new_unexpected_token_error(token.clone())); @@ -780,8 +784,9 @@ impl LengthOrPercentage { } } - let calc = input - .parse_nested_block(|i| CalcNode::parse_length_or_percentage(context, i, num_context))?; + let calc = input.parse_nested_block(|i| { + CalcNode::parse_length_or_percentage(context, i, num_context) + })?; Ok(LengthOrPercentage::Calc(Box::new(calc))) } @@ -871,7 +876,8 @@ impl LengthOrPercentageOrAuto { match *token { Token::Dimension { value, ref unit, .. - } if num_context.is_ok(context.parsing_mode, value) => + } + if num_context.is_ok(context.parsing_mode, value) => { return NoCalcLength::parse_dimension(context, value, unit) .map(LengthOrPercentageOrAuto::Length) @@ -885,7 +891,8 @@ impl LengthOrPercentageOrAuto { ))) }, Token::Number { value, .. } if num_context.is_ok(context.parsing_mode, value) => { - if value != 0. && !context.parsing_mode.allows_unitless_lengths() && + if value != 0. && + !context.parsing_mode.allows_unitless_lengths() && !allow_quirks.allowed(context.quirks_mode) { return Err(location.new_custom_error(StyleParseErrorKind::UnspecifiedError)); @@ -902,8 +909,9 @@ impl LengthOrPercentageOrAuto { } } - let calc = input - .parse_nested_block(|i| CalcNode::parse_length_or_percentage(context, i, num_context))?; + let calc = input.parse_nested_block(|i| { + CalcNode::parse_length_or_percentage(context, i, num_context) + })?; Ok(LengthOrPercentageOrAuto::Calc(Box::new(calc))) } @@ -998,8 +1006,7 @@ impl Parse for NonNegativeLengthOrPercentageOrAuto { input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i>> { Ok(NonNegative(LengthOrPercentageOrAuto::parse_non_negative( - context, - input, + context, input, )?)) } } @@ -1028,7 +1035,8 @@ impl LengthOrPercentageOrNone { match *token { Token::Dimension { value, ref unit, .. - } if num_context.is_ok(context.parsing_mode, value) => + } + if num_context.is_ok(context.parsing_mode, value) => { return NoCalcLength::parse_dimension(context, value, unit) .map(LengthOrPercentageOrNone::Length) @@ -1042,7 +1050,8 @@ impl LengthOrPercentageOrNone { ))) }, Token::Number { value, .. } if num_context.is_ok(context.parsing_mode, value) => { - if value != 0. && !context.parsing_mode.allows_unitless_lengths() && + if value != 0. && + !context.parsing_mode.allows_unitless_lengths() && !allow_quirks.allowed(context.quirks_mode) { return Err(location.new_custom_error(StyleParseErrorKind::UnspecifiedError)); @@ -1059,8 +1068,9 @@ impl LengthOrPercentageOrNone { } } - let calc = input - .parse_nested_block(|i| CalcNode::parse_length_or_percentage(context, i, num_context))?; + let calc = input.parse_nested_block(|i| { + CalcNode::parse_length_or_percentage(context, i, num_context) + })?; Ok(LengthOrPercentageOrNone::Calc(Box::new(calc))) } diff --git a/components/style/values/specified/list.rs b/components/style/values/specified/list.rs index ae61bb1ae9c..f1fba44b080 100644 --- a/components/style/values/specified/list.rs +++ b/components/style/values/specified/list.rs @@ -15,8 +15,7 @@ use values::generics::CounterStyleOrNone; /// Specified and computed `list-style-type` property. #[cfg(feature = "gecko")] -#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] pub enum ListStyleType { /// <counter-style> | none CounterStyle(CounterStyleOrNone), @@ -79,8 +78,7 @@ impl Parse for ListStyleType { /// FIXME(emilio): It's a shame that this allocates all the time it's computed, /// probably should just be refcounted. /// FIXME This can probably derive ToCss. -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] pub struct Quotes(#[css(if_empty = "none")] pub Box<[(Box<str>, Box<str>)]>); impl ToCss for Quotes { diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs index 6a395c21e58..b8c2cd01fe9 100644 --- a/components/style/values/specified/mod.rs +++ b/components/style/values/specified/mod.rs @@ -151,8 +151,20 @@ fn parse_number_with_clamping_mode<'i, 't>( // FIXME(emilio): Should move to border.rs #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Ord, Parse, PartialEq, - PartialOrd, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, + Copy, + Debug, + Eq, + MallocSizeOf, + Ord, + Parse, + PartialEq, + PartialOrd, + SpecifiedValueInfo, + ToComputedValue, + ToCss, +)] pub enum BorderStyle { None = -1, Solid = 6, @@ -330,8 +342,7 @@ impl Parse for GreaterThanOrEqualToOneNumber { /// /// FIXME(emilio): Should probably use Either. #[allow(missing_docs)] -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] pub enum NumberOrPercentage { Percentage(Percentage), Number(Number), @@ -369,8 +380,7 @@ impl Parse for NumberOrPercentage { } #[allow(missing_docs)] -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd, - SpecifiedValueInfo, ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd, SpecifiedValueInfo, ToCss)] pub struct Opacity(Number); impl Parse for Opacity { @@ -630,13 +640,16 @@ impl ToComputedValue for ClipRect { fn to_computed_value(&self, context: &Context) -> super::computed::ClipRect { super::computed::ClipRect { top: self.top.as_ref().map(|top| top.to_computed_value(context)), - right: self.right + right: self + .right .as_ref() .map(|right| right.to_computed_value(context)), - bottom: self.bottom + bottom: self + .bottom .as_ref() .map(|bottom| bottom.to_computed_value(context)), - left: self.left + left: self + .left .as_ref() .map(|left| left.to_computed_value(context)), } @@ -760,8 +773,7 @@ impl AllowQuirks { /// An attr(...) rule /// /// `[namespace? `|`]? ident` -#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue)] +#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] #[css(function)] pub struct Attr { /// Optional namespace prefix and URL. @@ -814,7 +826,10 @@ impl Attr { let prefix = Prefix::from(ns.as_ref()); let ns = match get_namespace_for_prefix(&prefix, context) { Some(ns) => ns, - None => return Err(location.new_custom_error(StyleParseErrorKind::UnspecifiedError)), + None => { + return Err(location + .new_custom_error(StyleParseErrorKind::UnspecifiedError)) + }, }; Some((prefix, ns)) } else { diff --git a/components/style/values/specified/motion.rs b/components/style/values/specified/motion.rs index 87ff39d9a3a..b591d43a2bb 100644 --- a/components/style/values/specified/motion.rs +++ b/components/style/values/specified/motion.rs @@ -12,7 +12,18 @@ use values::specified::SVGPathData; /// The offset-path value. /// /// https://drafts.fxtf.org/motion-1/#offset-path-property -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedZero, + ToComputedValue, + ToCss, +)] pub enum OffsetPath { // We could merge SVGPathData into ShapeSource, so we could reuse them. However, // we don't want to support other value for offset-path, so use SVGPathData only for now. @@ -20,6 +31,7 @@ pub enum OffsetPath { #[css(function)] Path(SVGPathData), /// None value. + #[animation(error)] None, // Bug 1186329: Implement ray(), <basic-shape>, <geometry-box>, and <url>. } @@ -35,7 +47,7 @@ impl OffsetPath { impl Parse for OffsetPath { fn parse<'i, 't>( context: &ParserContext, - input: &mut Parser<'i, 't> + input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i>> { // Parse none. if input.try(|i| i.expect_ident_matching("none")).is_ok() { diff --git a/components/style/values/specified/outline.rs b/components/style/values/specified/outline.rs index c3357f87ec2..afe74dc39f3 100644 --- a/components/style/values/specified/outline.rs +++ b/components/style/values/specified/outline.rs @@ -10,8 +10,19 @@ use selectors::parser::SelectorParseErrorKind; use style_traits::ParseError; use values::specified::BorderStyle; -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Ord, PartialEq, PartialOrd, - SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, + Copy, + Debug, + Eq, + MallocSizeOf, + Ord, + PartialEq, + PartialOrd, + SpecifiedValueInfo, + ToComputedValue, + ToCss, +)] /// <https://drafts.csswg.org/css-ui/#propdef-outline-style> pub enum OutlineStyle { /// auto diff --git a/components/style/values/specified/position.rs b/components/style/values/specified/position.rs index fcfa07ae1d8..6117436695f 100644 --- a/components/style/values/specified/position.rs +++ b/components/style/values/specified/position.rs @@ -45,8 +45,19 @@ pub enum PositionComponent<S> { } /// A keyword for the X direction. -#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, - SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, + Copy, + Debug, + Eq, + Hash, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, +)] #[allow(missing_docs)] pub enum X { Left, @@ -54,8 +65,19 @@ pub enum X { } /// A keyword for the Y direction. -#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, - SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, + Copy, + Debug, + Eq, + Hash, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, +)] #[allow(missing_docs)] pub enum Y { Top, @@ -128,10 +150,12 @@ impl Position { } let y_keyword = Y::parse(input)?; let lop_and_x_pos: Result<_, ParseError> = input.try(|i| { - let y_lop = i.try(|i| LengthOrPercentage::parse_quirky(context, i, allow_quirks)) + let y_lop = i + .try(|i| LengthOrPercentage::parse_quirky(context, i, allow_quirks)) .ok(); if let Ok(x_keyword) = i.try(X::parse) { - let x_lop = i.try(|i| LengthOrPercentage::parse_quirky(context, i, allow_quirks)) + let x_lop = i + .try(|i| LengthOrPercentage::parse_quirky(context, i, allow_quirks)) .ok(); let x_pos = PositionComponent::Side(x_keyword, x_lop); return Ok((y_lop, x_pos)); @@ -411,8 +435,9 @@ impl ToCss for LegacyPosition { } } -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive( + Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, +)] /// Auto-placement algorithm Option pub enum AutoFlow { /// The auto-placement algorithm places items by filling each row in turn, @@ -423,8 +448,9 @@ pub enum AutoFlow { Column, } -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive( + Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, +)] /// Controls how the auto-placement algorithm works /// specifying exactly how auto-placed items get flowed into the grid pub struct GridAutoFlow { @@ -630,8 +656,7 @@ impl Parse for TemplateAreas { } /// Arc type for `Arc<TemplateAreas>` -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] pub struct TemplateAreasArc(#[ignore_malloc_size_of = "Arc"] pub Arc<TemplateAreas>); impl Parse for TemplateAreasArc { @@ -685,8 +710,12 @@ impl<'a> Iterator for TemplateAreasTokenizer<'a> { } fn is_name_code_point(c: char) -> bool { - c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z' || c >= '\u{80}' || c == '_' || - c >= '0' && c <= '9' || c == '-' + c >= 'A' && c <= 'Z' || + c >= 'a' && c <= 'z' || + c >= '\u{80}' || + c == '_' || + c >= '0' && c <= '9' || + c == '-' } /// This property specifies named grid areas. diff --git a/components/style/values/specified/resolution.rs b/components/style/values/specified/resolution.rs index 77a269c251b..0878c776272 100644 --- a/components/style/values/specified/resolution.rs +++ b/components/style/values/specified/resolution.rs @@ -32,8 +32,7 @@ impl Resolution { /// Convert this resolution value to dppx units. pub fn to_dppx(&self) -> CSSFloat { match *self { - Resolution::X(f) | - Resolution::Dppx(f) => f, + Resolution::X(f) | Resolution::Dppx(f) => f, _ => self.to_dpi() / 96.0, } } @@ -42,8 +41,7 @@ impl Resolution { pub fn to_dpi(&self) -> CSSFloat { match *self { Resolution::Dpi(f) => f, - Resolution::X(f) | - Resolution::Dppx(f) => f * 96.0, + Resolution::X(f) | Resolution::Dppx(f) => f * 96.0, Resolution::Dpcm(f) => f * 2.54, } } diff --git a/components/style/values/specified/source_size_list.rs b/components/style/values/specified/source_size_list.rs index 33078c06484..2d86d5a058f 100644 --- a/components/style/values/specified/source_size_list.rs +++ b/components/style/values/specified/source_size_list.rs @@ -61,7 +61,8 @@ impl SourceSizeList { /// Evaluate this <source-size-list> to get the final viewport length. pub fn evaluate(&self, device: &Device, quirks_mode: QuirksMode) -> Au { - let matching_source_size = self.source_sizes + let matching_source_size = self + .source_sizes .iter() .find(|source_size| source_size.condition.matches(device, quirks_mode)); diff --git a/components/style/values/specified/svg.rs b/components/style/values/specified/svg.rs index e55442d7da8..f91ac511af1 100644 --- a/components/style/values/specified/svg.rs +++ b/components/style/values/specified/svg.rs @@ -173,8 +173,7 @@ const PAINT_ORDER_MASK: u8 = 0b11; /// /// Higher priority values, i.e. the values specified first, /// will be painted first (and may be covered by paintings of lower priority) -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] pub struct SVGPaintOrder(pub u8); impl SVGPaintOrder { @@ -281,8 +280,7 @@ impl ToCss for SVGPaintOrder { /// Specified MozContextProperties value. /// Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-context-properties) -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] pub struct MozContextProperties(pub CustomIdent); impl Parse for MozContextProperties { diff --git a/components/style/values/specified/svg_path.rs b/components/style/values/specified/svg_path.rs index 48ae185477d..f0973b545a5 100644 --- a/components/style/values/specified/svg_path.rs +++ b/components/style/values/specified/svg_path.rs @@ -8,16 +8,20 @@ use cssparser::Parser; use parser::{Parse, ParserContext}; use std::fmt::{self, Write}; use std::iter::{Cloned, Peekable}; +use std::ops::AddAssign; use std::slice; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; use style_traits::values::SequenceWriter; use values::CSSFloat; - +use values::animated::{Animate, Procedure}; +use values::distance::{ComputeSquaredDistance, SquaredDistance}; /// The SVG path data. /// /// https://www.w3.org/TR/SVG11/paths.html#PathData -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] +#[derive( + Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToAnimatedZero, ToComputedValue, +)] pub struct SVGPathData(Box<[PathCommand]>); impl SVGPathData { @@ -34,13 +38,28 @@ impl SVGPathData { debug_assert!(!self.0.is_empty()); &self.0 } + + /// Create a normalized copy of this path by converting each relative command to an absolute + /// command. + fn normalize(&self) -> Self { + let mut state = PathTraversalState { + subpath_start: CoordPair::new(0.0, 0.0), + pos: CoordPair::new(0.0, 0.0), + }; + let result = self + .0 + .iter() + .map(|seg| seg.normalize(&mut state)) + .collect::<Vec<_>>(); + SVGPathData(result.into_boxed_slice()) + } } impl ToCss for SVGPathData { #[inline] fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where - W: fmt::Write + W: fmt::Write, { dest.write_char('"')?; { @@ -61,7 +80,7 @@ impl Parse for SVGPathData { // str::Char iterator to check each character. fn parse<'i, 't>( _context: &ParserContext, - input: &mut Parser<'i, 't> + input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i>> { let location = input.current_source_location(); let path_string = input.expect_string()?.as_ref(); @@ -82,6 +101,36 @@ impl Parse for SVGPathData { } } +impl Animate for SVGPathData { + fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> { + if self.0.len() != other.0.len() { + return Err(()); + } + + let result = self + .normalize() + .0 + .iter() + .zip(other.normalize().0.iter()) + .map(|(a, b)| a.animate(&b, procedure)) + .collect::<Result<Vec<_>, _>>()?; + Ok(SVGPathData::new(result.into_boxed_slice())) + } +} + +impl ComputeSquaredDistance for SVGPathData { + fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> { + if self.0.len() != other.0.len() { + return Err(()); + } + self.normalize() + .0 + .iter() + .zip(other.normalize().0.iter()) + .map(|(this, other)| this.compute_squared_distance(&other)) + .sum() + } +} /// The SVG path command. /// The fields of these commands are self-explanatory, so we skip the documents. @@ -89,7 +138,17 @@ impl Parse for SVGPathData { /// points of the Bézier curve in the spec. /// /// https://www.w3.org/TR/SVG11/paths.html#PathData -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedZero, +)] #[allow(missing_docs)] #[repr(C, u8)] pub enum PathCommand { @@ -97,56 +156,243 @@ pub enum PathCommand { /// https://www.w3.org/TR/SVG/paths.html#__svg__SVGPathSeg__PATHSEG_UNKNOWN Unknown, /// The "moveto" command. - MoveTo { point: CoordPair, absolute: bool }, + MoveTo { + point: CoordPair, + absolute: IsAbsolute, + }, /// The "lineto" command. - LineTo { point: CoordPair, absolute: bool }, + LineTo { + point: CoordPair, + absolute: IsAbsolute, + }, /// The horizontal "lineto" command. - HorizontalLineTo { x: CSSFloat, absolute: bool }, + HorizontalLineTo { x: CSSFloat, absolute: IsAbsolute }, /// The vertical "lineto" command. - VerticalLineTo { y: CSSFloat, absolute: bool }, + VerticalLineTo { y: CSSFloat, absolute: IsAbsolute }, /// The cubic Bézier curve command. - CurveTo { control1: CoordPair, control2: CoordPair, point: CoordPair, absolute: bool }, + CurveTo { + control1: CoordPair, + control2: CoordPair, + point: CoordPair, + absolute: IsAbsolute, + }, /// The smooth curve command. - SmoothCurveTo { control2: CoordPair, point: CoordPair, absolute: bool }, + SmoothCurveTo { + control2: CoordPair, + point: CoordPair, + absolute: IsAbsolute, + }, /// The quadratic Bézier curve command. - QuadBezierCurveTo { control1: CoordPair, point: CoordPair, absolute: bool }, + QuadBezierCurveTo { + control1: CoordPair, + point: CoordPair, + absolute: IsAbsolute, + }, /// The smooth quadratic Bézier curve command. - SmoothQuadBezierCurveTo { point: CoordPair, absolute: bool }, + SmoothQuadBezierCurveTo { + point: CoordPair, + absolute: IsAbsolute, + }, /// The elliptical arc curve command. EllipticalArc { rx: CSSFloat, ry: CSSFloat, angle: CSSFloat, - large_arc_flag: bool, - sweep_flag: bool, + #[animation(constant)] + large_arc_flag: ArcFlag, + #[animation(constant)] + sweep_flag: ArcFlag, point: CoordPair, - absolute: bool + absolute: IsAbsolute, }, /// The "closepath" command. ClosePath, } +/// For internal SVGPath normalization. +#[allow(missing_docs)] +struct PathTraversalState { + subpath_start: CoordPair, + pos: CoordPair, +} + +impl PathCommand { + /// Create a normalized copy of this PathCommand. Absolute commands will be copied as-is while + /// for relative commands an equivalent absolute command will be returned. + /// + /// See discussion: https://github.com/w3c/svgwg/issues/321 + fn normalize(&self, state: &mut PathTraversalState) -> Self { + use self::PathCommand::*; + match *self { + Unknown => Unknown, + ClosePath => { + state.pos = state.subpath_start; + ClosePath + }, + MoveTo { + mut point, + absolute, + } => { + if !absolute.is_yes() { + point += state.pos; + } + state.pos = point; + state.subpath_start = point; + MoveTo { + point, + absolute: IsAbsolute::Yes, + } + }, + LineTo { + mut point, + absolute, + } => { + if !absolute.is_yes() { + point += state.pos; + } + state.pos = point; + LineTo { + point, + absolute: IsAbsolute::Yes, + } + }, + HorizontalLineTo { mut x, absolute } => { + if !absolute.is_yes() { + x += state.pos.0; + } + state.pos.0 = x; + HorizontalLineTo { + x, + absolute: IsAbsolute::Yes, + } + }, + VerticalLineTo { mut y, absolute } => { + if !absolute.is_yes() { + y += state.pos.1; + } + state.pos.1 = y; + VerticalLineTo { + y, + absolute: IsAbsolute::Yes, + } + }, + CurveTo { + mut control1, + mut control2, + mut point, + absolute, + } => { + if !absolute.is_yes() { + control1 += state.pos; + control2 += state.pos; + point += state.pos; + } + state.pos = point; + CurveTo { + control1, + control2, + point, + absolute: IsAbsolute::Yes, + } + }, + SmoothCurveTo { + mut control2, + mut point, + absolute, + } => { + if !absolute.is_yes() { + control2 += state.pos; + point += state.pos; + } + state.pos = point; + SmoothCurveTo { + control2, + point, + absolute: IsAbsolute::Yes, + } + }, + QuadBezierCurveTo { + mut control1, + mut point, + absolute, + } => { + if !absolute.is_yes() { + control1 += state.pos; + point += state.pos; + } + state.pos = point; + QuadBezierCurveTo { + control1, + point, + absolute: IsAbsolute::Yes, + } + }, + SmoothQuadBezierCurveTo { + mut point, + absolute, + } => { + if !absolute.is_yes() { + point += state.pos; + } + state.pos = point; + SmoothQuadBezierCurveTo { + point, + absolute: IsAbsolute::Yes, + } + }, + EllipticalArc { + rx, + ry, + angle, + large_arc_flag, + sweep_flag, + mut point, + absolute, + } => { + if !absolute.is_yes() { + point += state.pos; + } + state.pos = point; + EllipticalArc { + rx, + ry, + angle, + large_arc_flag, + sweep_flag, + point, + absolute: IsAbsolute::Yes, + } + }, + } + } +} + impl ToCss for PathCommand { fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where - W: fmt::Write + W: fmt::Write, { use self::PathCommand::*; match *self { Unknown => dest.write_char('X'), ClosePath => dest.write_char('Z'), MoveTo { point, absolute } => { - dest.write_char(if absolute { 'M' } else { 'm' })?; + dest.write_char(if absolute.is_yes() { 'M' } else { 'm' })?; dest.write_char(' ')?; point.to_css(dest) - } + }, LineTo { point, absolute } => { - dest.write_char(if absolute { 'L' } else { 'l' })?; + dest.write_char(if absolute.is_yes() { 'L' } else { 'l' })?; dest.write_char(' ')?; point.to_css(dest) - } - CurveTo { control1, control2, point, absolute } => { - dest.write_char(if absolute { 'C' } else { 'c' })?; + }, + CurveTo { + control1, + control2, + point, + absolute, + } => { + dest.write_char(if absolute.is_yes() { 'C' } else { 'c' })?; dest.write_char(' ')?; control1.to_css(dest)?; dest.write_char(' ')?; @@ -154,15 +400,27 @@ impl ToCss for PathCommand { dest.write_char(' ')?; point.to_css(dest) }, - QuadBezierCurveTo { control1, point, absolute } => { - dest.write_char(if absolute { 'Q' } else { 'q' })?; + QuadBezierCurveTo { + control1, + point, + absolute, + } => { + dest.write_char(if absolute.is_yes() { 'Q' } else { 'q' })?; dest.write_char(' ')?; control1.to_css(dest)?; dest.write_char(' ')?; point.to_css(dest) }, - EllipticalArc { rx, ry, angle, large_arc_flag, sweep_flag, point, absolute } => { - dest.write_char(if absolute { 'A' } else { 'a' })?; + EllipticalArc { + rx, + ry, + angle, + large_arc_flag, + sweep_flag, + point, + absolute, + } => { + dest.write_char(if absolute.is_yes() { 'A' } else { 'a' })?; dest.write_char(' ')?; rx.to_css(dest)?; dest.write_char(' ')?; @@ -170,31 +428,35 @@ impl ToCss for PathCommand { dest.write_char(' ')?; angle.to_css(dest)?; dest.write_char(' ')?; - (large_arc_flag as i32).to_css(dest)?; + large_arc_flag.to_css(dest)?; dest.write_char(' ')?; - (sweep_flag as i32).to_css(dest)?; + sweep_flag.to_css(dest)?; dest.write_char(' ')?; point.to_css(dest) }, HorizontalLineTo { x, absolute } => { - dest.write_char(if absolute { 'H' } else { 'h' })?; + dest.write_char(if absolute.is_yes() { 'H' } else { 'h' })?; dest.write_char(' ')?; x.to_css(dest) }, VerticalLineTo { y, absolute } => { - dest.write_char(if absolute { 'V' } else { 'v' })?; + dest.write_char(if absolute.is_yes() { 'V' } else { 'v' })?; dest.write_char(' ')?; y.to_css(dest) }, - SmoothCurveTo { control2, point, absolute } => { - dest.write_char(if absolute { 'S' } else { 's' })?; + SmoothCurveTo { + control2, + point, + absolute, + } => { + dest.write_char(if absolute.is_yes() { 'S' } else { 's' })?; dest.write_char(' ')?; control2.to_css(dest)?; dest.write_char(' ')?; point.to_css(dest) }, SmoothQuadBezierCurveTo { point, absolute } => { - dest.write_char(if absolute { 'T' } else { 't' })?; + dest.write_char(if absolute.is_yes() { 'T' } else { 't' })?; dest.write_char(' ')?; point.to_css(dest) }, @@ -202,9 +464,46 @@ impl ToCss for PathCommand { } } +/// The path command absolute type. +#[allow(missing_docs)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedZero, +)] +#[repr(u8)] +pub enum IsAbsolute { + Yes, + No, +} + +impl IsAbsolute { + /// Return true if this is IsAbsolute::Yes. + #[inline] + pub fn is_yes(&self) -> bool { + *self == IsAbsolute::Yes + } +} /// The path coord type. -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedZero, + ToCss, +)] #[repr(C)] pub struct CoordPair(CSSFloat, CSSFloat); @@ -216,6 +515,35 @@ impl CoordPair { } } +impl AddAssign for CoordPair { + #[inline] + fn add_assign(&mut self, other: Self) { + self.0 += other.0; + self.1 += other.1; + } +} + +/// The EllipticalArc flag type. +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo)] +#[repr(C)] +pub struct ArcFlag(bool); + +impl ToCss for ArcFlag { + #[inline] + fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result + where + W: fmt::Write, + { + (self.0 as i32).to_css(dest) + } +} + +impl ComputeSquaredDistance for ArcFlag { + #[inline] + fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> { + (self.0 as i32).compute_squared_distance(&(other.0 as i32)) + } +} /// SVG Path parser. struct PathParser<'a> { @@ -276,7 +604,11 @@ impl<'a> PathParser<'a> { match self.chars.next() { Some(command) => { - let abs = command.is_ascii_uppercase(); + let abs = if command.is_ascii_uppercase() { + IsAbsolute::Yes + } else { + IsAbsolute::No + }; macro_rules! parse_command { ( $($($p:pat)|+ => $parse_func:ident,)* ) => { match command { @@ -299,7 +631,7 @@ impl<'a> PathParser<'a> { b'S' | b's' => parse_smooth_curveto, b'Q' | b'q' => parse_quadratic_bezier_curveto, b'T' | b't' => parse_smooth_quadratic_bezier_curveto, - b'A' | b'a' => parse_elliprical_arc, + b'A' | b'a' => parse_elliptical_arc, ); }, _ => break, // no more commands. @@ -317,12 +649,16 @@ impl<'a> PathParser<'a> { skip_wsp(&mut self.chars); let point = parse_coord(&mut self.chars)?; - let absolute = command == b'M'; - self.path.push(PathCommand::MoveTo { point, absolute } ); + let absolute = if command == b'M' { + IsAbsolute::Yes + } else { + IsAbsolute::No + }; + self.path.push(PathCommand::MoveTo { point, absolute }); // End of string or the next character is a possible new command. - if !skip_wsp(&mut self.chars) || - self.chars.peek().map_or(true, |c| c.is_ascii_alphabetic()) { + if !skip_wsp(&mut self.chars) || self.chars.peek().map_or(true, |c| c.is_ascii_alphabetic()) + { return Ok(()); } skip_comma_wsp(&mut self.chars); @@ -333,60 +669,58 @@ impl<'a> PathParser<'a> { } /// Parse "closepath" command. - fn parse_closepath(&mut self, _absolute: bool) -> Result<(), ()> { + fn parse_closepath(&mut self, _absolute: IsAbsolute) -> Result<(), ()> { self.path.push(PathCommand::ClosePath); Ok(()) } /// Parse "lineto" command. - fn parse_lineto(&mut self, absolute: bool) -> Result<(), ()> { + fn parse_lineto(&mut self, absolute: IsAbsolute) -> Result<(), ()> { parse_arguments!(self, absolute, LineTo, [ point => parse_coord ]) } /// Parse horizontal "lineto" command. - fn parse_h_lineto(&mut self, absolute: bool) -> Result<(), ()> { + fn parse_h_lineto(&mut self, absolute: IsAbsolute) -> Result<(), ()> { parse_arguments!(self, absolute, HorizontalLineTo, [ x => parse_number ]) } /// Parse vertical "lineto" command. - fn parse_v_lineto(&mut self, absolute: bool) -> Result<(), ()> { + fn parse_v_lineto(&mut self, absolute: IsAbsolute) -> Result<(), ()> { parse_arguments!(self, absolute, VerticalLineTo, [ y => parse_number ]) } /// Parse cubic Bézier curve command. - fn parse_curveto(&mut self, absolute: bool) -> Result<(), ()> { + fn parse_curveto(&mut self, absolute: IsAbsolute) -> Result<(), ()> { parse_arguments!(self, absolute, CurveTo, [ control1 => parse_coord, control2 => parse_coord, point => parse_coord ]) } /// Parse smooth "curveto" command. - fn parse_smooth_curveto(&mut self, absolute: bool) -> Result<(), ()> { + fn parse_smooth_curveto(&mut self, absolute: IsAbsolute) -> Result<(), ()> { parse_arguments!(self, absolute, SmoothCurveTo, [ control2 => parse_coord, point => parse_coord ]) } /// Parse quadratic Bézier curve command. - fn parse_quadratic_bezier_curveto(&mut self, absolute: bool) -> Result<(), ()> { + fn parse_quadratic_bezier_curveto(&mut self, absolute: IsAbsolute) -> Result<(), ()> { parse_arguments!(self, absolute, QuadBezierCurveTo, [ control1 => parse_coord, point => parse_coord ]) } /// Parse smooth quadratic Bézier curveto command. - fn parse_smooth_quadratic_bezier_curveto(&mut self, absolute: bool) -> Result<(), ()> { + fn parse_smooth_quadratic_bezier_curveto(&mut self, absolute: IsAbsolute) -> Result<(), ()> { parse_arguments!(self, absolute, SmoothQuadBezierCurveTo, [ point => parse_coord ]) } /// Parse elliptical arc curve command. - fn parse_elliprical_arc(&mut self, absolute: bool) -> Result<(), ()> { + fn parse_elliptical_arc(&mut self, absolute: IsAbsolute) -> Result<(), ()> { // Parse a flag whose value is '0' or '1'; otherwise, return Err(()). - let parse_flag = |iter: &mut Peekable<Cloned<slice::Iter<u8>>>| -> Result<bool, ()> { - match iter.next() { - Some(c) if c == b'0' || c == b'1' => Ok(c == b'1'), - _ => Err(()), - } + let parse_flag = |iter: &mut Peekable<Cloned<slice::Iter<u8>>>| match iter.next() { + Some(c) if c == b'0' || c == b'1' => Ok(ArcFlag(c == b'1')), + _ => Err(()), }; parse_arguments!(self, absolute, EllipticalArc, [ rx => parse_number, @@ -399,7 +733,6 @@ impl<'a> PathParser<'a> { } } - /// Parse a pair of numbers into CoordPair. fn parse_coord(iter: &mut Peekable<Cloned<slice::Iter<u8>>>) -> Result<CoordPair, ()> { let x = parse_number(iter)?; @@ -417,8 +750,15 @@ fn parse_coord(iter: &mut Peekable<Cloned<slice::Iter<u8>>>) -> Result<CoordPair /// The "number" syntax in https://www.w3.org/TR/SVG/paths.html#PathDataBNF fn parse_number(iter: &mut Peekable<Cloned<slice::Iter<u8>>>) -> Result<CSSFloat, ()> { // 1. Check optional sign. - let sign = if iter.peek().map_or(false, |&sign| sign == b'+' || sign == b'-') { - if iter.next().unwrap() == b'-' { -1. } else { 1. } + let sign = if iter + .peek() + .map_or(false, |&sign| sign == b'+' || sign == b'-') + { + if iter.next().unwrap() == b'-' { + -1. + } else { + 1. + } } else { 1. }; @@ -432,8 +772,7 @@ fn parse_number(iter: &mut Peekable<Cloned<slice::Iter<u8>>>) -> Result<CSSFloat } while iter.peek().map_or(false, |n| n.is_ascii_digit()) { - integral_part = - integral_part * 10. + (iter.next().unwrap() - b'0') as f64; + integral_part = integral_part * 10. + (iter.next().unwrap() - b'0') as f64; } iter.peek().map_or(false, |&n| n == b'.') @@ -465,8 +804,15 @@ fn parse_number(iter: &mut Peekable<Cloned<slice::Iter<u8>>>) -> Result<CSSFloat if iter.peek().map_or(false, |&exp| exp == b'E' || exp == b'e') { // Consume 'E' or 'e'. iter.next(); - let exp_sign = if iter.peek().map_or(false, |&sign| sign == b'+' || sign == b'-') { - if iter.next().unwrap() == b'-' { -1. } else { 1. } + let exp_sign = if iter + .peek() + .map_or(false, |&sign| sign == b'+' || sign == b'-') + { + if iter.next().unwrap() == b'-' { + -1. + } else { + 1. + } } else { 1. }; @@ -480,7 +826,9 @@ fn parse_number(iter: &mut Peekable<Cloned<slice::Iter<u8>>>) -> Result<CSSFloat } if value.is_finite() { - Ok(value.min(::std::f32::MAX as f64).max(::std::f32::MIN as f64) as CSSFloat) + Ok(value + .min(::std::f32::MAX as f64) + .max(::std::f32::MIN as f64) as CSSFloat) } else { Err(()) } diff --git a/components/style/values/specified/table.rs b/components/style/values/specified/table.rs index 085c9adc9d8..0dd0755f95a 100644 --- a/components/style/values/specified/table.rs +++ b/components/style/values/specified/table.rs @@ -8,8 +8,9 @@ use cssparser::Parser; use parser::{Parse, ParserContext}; use style_traits::{ParseError, StyleParseErrorKind}; -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive( + Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, +)] /// span. for `<col span>` pres attr pub struct XSpan(#[css(skip)] pub i32); diff --git a/components/style/values/specified/text.rs b/components/style/values/specified/text.rs index ae01040e45f..adeab96c984 100644 --- a/components/style/values/specified/text.rs +++ b/components/style/values/specified/text.rs @@ -94,7 +94,10 @@ impl Parse for LineHeight { { Ok(GenericLineHeight::MozBlockHeight) }, - ident => Err(location.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(ident.clone()))), + ident => { + Err(location + .new_custom_error(SelectorParseErrorKind::UnexpectedIdent(ident.clone()))) + }, } } } @@ -587,8 +590,7 @@ impl TextEmphasisKeywordValue { } /// Fill mode for the text-emphasis-style property -#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, - ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss)] pub enum TextEmphasisFillMode { /// `filled` Filled, @@ -597,8 +599,7 @@ pub enum TextEmphasisFillMode { } /// Shape keyword for the text-emphasis-style property -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, - SpecifiedValueInfo, ToCss)] +#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss)] pub enum TextEmphasisShapeKeyword { /// `dot` Dot, @@ -724,8 +725,18 @@ impl Parse for TextEmphasisStyle { } /// The allowed horizontal values for the `text-emphasis-position` property. -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, - SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, + Copy, + Debug, + Eq, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, +)] pub enum TextEmphasisHorizontalWritingModeValue { /// Draw marks over the text in horizontal writing mode. Over, @@ -734,8 +745,18 @@ pub enum TextEmphasisHorizontalWritingModeValue { } /// The allowed vertical values for the `text-emphasis-position` property. -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, - SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, + Copy, + Debug, + Eq, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, +)] pub enum TextEmphasisVerticalWritingModeValue { /// Draws marks to the right of the text in vertical writing mode. Right, @@ -744,8 +765,9 @@ pub enum TextEmphasisVerticalWritingModeValue { } /// Specified value of `text-emphasis-position` property. -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] +#[derive( + Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, +)] pub struct TextEmphasisPosition( pub TextEmphasisHorizontalWritingModeValue, pub TextEmphasisVerticalWritingModeValue, @@ -846,8 +868,7 @@ impl Parse for MozTabSize { return Ok(GenericMozTabSize::Number(number)); } Ok(GenericMozTabSize::Length(NonNegativeLength::parse( - context, - input, + context, input, )?)) } } diff --git a/components/style/values/specified/time.rs b/components/style/values/specified/time.rs index 107c45b2d48..6895a918346 100644 --- a/components/style/values/specified/time.rs +++ b/components/style/values/specified/time.rs @@ -92,7 +92,8 @@ impl Time { // ParsingMode::DEFAULT directly. Ok(&Token::Dimension { value, ref unit, .. - }) if clamping_mode.is_ok(ParsingMode::DEFAULT, value) => + }) + if clamping_mode.is_ok(ParsingMode::DEFAULT, value) => { return Time::parse_dimension(value, unit, /* from_calc = */ false) .map_err(|()| location.new_custom_error(StyleParseErrorKind::UnspecifiedError)); diff --git a/components/style/values/specified/ui.rs b/components/style/values/specified/ui.rs index e912c24b808..7dc1e0fe1d3 100644 --- a/components/style/values/specified/ui.rs +++ b/components/style/values/specified/ui.rs @@ -52,9 +52,8 @@ impl Parse for CursorKind { ) -> Result<Self, ParseError<'i>> { let location = input.current_source_location(); let ident = input.expect_ident()?; - CursorKind::from_css_keyword(&ident).map_err(|_| { - location.new_custom_error(StyleParseErrorKind::UnspecifiedError) - }) + CursorKind::from_css_keyword(&ident) + .map_err(|_| location.new_custom_error(StyleParseErrorKind::UnspecifiedError)) } } @@ -74,8 +73,7 @@ impl Parse for CursorImage { } /// Specified value of `-moz-force-broken-image-icon` -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] pub struct MozForceBrokenImageIcon(pub bool); impl MozForceBrokenImageIcon { diff --git a/components/style_traits/lib.rs b/components/style_traits/lib.rs index 737450b5e05..fd80c648b31 100644 --- a/components/style_traits/lib.rs +++ b/components/style_traits/lib.rs @@ -8,27 +8,35 @@ #![crate_name = "style_traits"] #![crate_type = "rlib"] - #![deny(unsafe_code, missing_docs)] extern crate app_units; -#[macro_use] extern crate bitflags; -#[macro_use] extern crate cssparser; +#[macro_use] +extern crate bitflags; +#[macro_use] +extern crate cssparser; extern crate euclid; extern crate malloc_size_of; -#[macro_use] extern crate malloc_size_of_derive; +#[macro_use] +extern crate malloc_size_of_derive; extern crate selectors; -#[cfg(feature = "servo")] #[macro_use] extern crate serde; -#[cfg(feature = "servo")] extern crate webrender_api; +#[cfg(feature = "servo")] +#[macro_use] +extern crate serde; extern crate servo_arc; -#[cfg(feature = "servo")] extern crate servo_atoms; -#[cfg(feature = "servo")] extern crate servo_url; - -#[cfg(feature = "servo")] pub use webrender_api::DevicePixel; +#[cfg(feature = "servo")] +extern crate servo_atoms; +#[cfg(feature = "servo")] +extern crate servo_url; +#[cfg(feature = "servo")] +extern crate webrender_api; +#[cfg(feature = "servo")] +pub use webrender_api::DevicePixel; use cssparser::{CowRcStr, Token}; use selectors::parser::SelectorParseErrorKind; -#[cfg(feature = "servo")] use servo_atoms::Atom; +#[cfg(feature = "servo")] +use servo_atoms::Atom; /// One hardware pixel. /// @@ -40,7 +48,10 @@ pub enum DevicePixel {} /// Represents a mobile style pinch zoom factor. /// TODO(gw): Once WR supports pinch zoom, use a type directly from webrender_api. #[derive(Clone, Copy, Debug, PartialEq)] -#[cfg_attr(feature = "servo", derive(Deserialize, Serialize, MallocSizeOf))] +#[cfg_attr( + feature = "servo", + derive(Deserialize, Serialize, MallocSizeOf) +)] pub struct PinchZoomFactor(f32); impl PinchZoomFactor { @@ -183,16 +194,14 @@ impl<'i> StyleParseErrorKind<'i> { { let name = name.into(); let variant = match value_error.kind { - cssparser::ParseErrorKind::Custom(StyleParseErrorKind::ValueError(e)) => { - match e { - ValueParseErrorKind::InvalidColor(token) => { - StyleParseErrorKind::InvalidColor(name, token) - } - ValueParseErrorKind::InvalidFilter(token) => { - StyleParseErrorKind::InvalidFilter(name, token) - } - } - } + cssparser::ParseErrorKind::Custom(StyleParseErrorKind::ValueError(e)) => match e { + ValueParseErrorKind::InvalidColor(token) => { + StyleParseErrorKind::InvalidColor(name, token) + }, + ValueParseErrorKind::InvalidFilter(token) => { + StyleParseErrorKind::InvalidFilter(name, token) + }, + }, _ => StyleParseErrorKind::OtherInvalidValue(name), }; cssparser::ParseError { @@ -236,5 +245,9 @@ impl ParsingMode { /// Speculatively execute paint code in the worklet thread pool. pub trait SpeculativePainter: Send + Sync { /// <https://drafts.css-houdini.org/css-paint-api/#draw-a-paint-image> - fn speculatively_draw_a_paint_image(&self, properties: Vec<(Atom, String)>, arguments: Vec<String>); + fn speculatively_draw_a_paint_image( + &self, + properties: Vec<(Atom, String)>, + arguments: Vec<String>, + ); } diff --git a/components/style_traits/specified_value_info.rs b/components/style_traits/specified_value_info.rs index e0dd5544d0a..d16d183a132 100644 --- a/components/style_traits/specified_value_info.rs +++ b/components/style_traits/specified_value_info.rs @@ -110,7 +110,7 @@ macro_rules! impl_generic_specified_value_info { $param::collect_completion_keywords(f); } } - } + }; } impl_generic_specified_value_info!(Option<T>); impl_generic_specified_value_info!(Vec<T>); diff --git a/components/style_traits/values.rs b/components/style_traits/values.rs index 8b3bd13dc20..e101dd41c3f 100644 --- a/components/style_traits/values.rs +++ b/components/style_traits/values.rs @@ -44,7 +44,9 @@ use std::fmt::{self, Write}; /// implement `Debug` by a single call to `ToCss::to_css`. pub trait ToCss { /// Serialize `self` in CSS syntax, writing to `dest`. - fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: Write; + fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result + where + W: Write; /// Serialize `self` in CSS syntax and return a string. /// @@ -57,22 +59,34 @@ pub trait ToCss { } } -impl<'a, T> ToCss for &'a T where T: ToCss + ?Sized { - fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: Write { +impl<'a, T> ToCss for &'a T +where + T: ToCss + ?Sized, +{ + fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result + where + W: Write, + { (*self).to_css(dest) } } impl ToCss for str { #[inline] - fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: Write { + fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result + where + W: Write, + { serialize_string(self, dest) } } impl ToCss for String { #[inline] - fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: Write { + fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result + where + W: Write, + { serialize_string(self, dest) } } @@ -82,7 +96,10 @@ where T: ToCss, { #[inline] - fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: Write { + fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result + where + W: Write, + { self.as_ref().map_or(Ok(()), |value| value.to_css(dest)) } } @@ -103,7 +120,10 @@ where /// Creates a new `CssWriter`. #[inline] pub fn new(inner: &'w mut W) -> Self { - Self { inner, prefix: Some("") } + Self { + inner, + prefix: Some(""), + } } } @@ -179,7 +199,7 @@ where #[inline] fn write_item<F>(&mut self, f: F) -> fmt::Result where - F: FnOnce(&mut CssWriter<'b, W>) -> fmt::Result + F: FnOnce(&mut CssWriter<'b, W>) -> fmt::Result, { let old_prefix = self.inner.prefix; if old_prefix.is_none() { @@ -192,7 +212,7 @@ where match (old_prefix, self.inner.prefix) { (_, None) => { // This call produced output and cleaned up after itself. - } + }, (None, Some(p)) => { // Some previous call to `item` produced output, // but this one did not, prefix should be the same as @@ -201,12 +221,12 @@ where // We clean up here even though it's not necessary just // to be able to do all these assertion checks. self.inner.prefix = None; - } + }, (Some(old), Some(new)) => { // No previous call to `item` produced output, and this one // either. debug_assert_eq!(old, new); - } + }, } Ok(()) } @@ -282,7 +302,7 @@ impl Separator for Comma { parse_one: F, ) -> Result<Vec<T>, ParseError<'i, E>> where - F: for<'tt> FnMut(&mut Parser<'i, 'tt>) -> Result<T, ParseError<'i, E>> + F: for<'tt> FnMut(&mut Parser<'i, 'tt>) -> Result<T, ParseError<'i, E>>, { input.parse_comma_separated(parse_one) } @@ -298,16 +318,16 @@ impl Separator for Space { mut parse_one: F, ) -> Result<Vec<T>, ParseError<'i, E>> where - F: for<'tt> FnMut(&mut Parser<'i, 'tt>) -> Result<T, ParseError<'i, E>> + F: for<'tt> FnMut(&mut Parser<'i, 'tt>) -> Result<T, ParseError<'i, E>>, { - input.skip_whitespace(); // Unnecessary for correctness, but may help try() rewind less. + input.skip_whitespace(); // Unnecessary for correctness, but may help try() rewind less. let mut results = vec![parse_one(input)?]; loop { - input.skip_whitespace(); // Unnecessary for correctness, but may help try() rewind less. + input.skip_whitespace(); // Unnecessary for correctness, but may help try() rewind less. if let Ok(item) = input.try(&mut parse_one) { results.push(item); } else { - return Ok(results) + return Ok(results); } } } @@ -323,15 +343,15 @@ impl Separator for CommaWithSpace { mut parse_one: F, ) -> Result<Vec<T>, ParseError<'i, E>> where - F: for<'tt> FnMut(&mut Parser<'i, 'tt>) -> Result<T, ParseError<'i, E>> + F: for<'tt> FnMut(&mut Parser<'i, 'tt>) -> Result<T, ParseError<'i, E>>, { - input.skip_whitespace(); // Unnecessary for correctness, but may help try() rewind less. + input.skip_whitespace(); // Unnecessary for correctness, but may help try() rewind less. let mut results = vec![parse_one(input)?]; loop { - input.skip_whitespace(); // Unnecessary for correctness, but may help try() rewind less. + input.skip_whitespace(); // Unnecessary for correctness, but may help try() rewind less. let comma_location = input.current_source_location(); let comma = input.try(|i| i.expect_comma()).is_ok(); - input.skip_whitespace(); // Unnecessary for correctness, but may help try() rewind less. + input.skip_whitespace(); // Unnecessary for correctness, but may help try() rewind less. if let Ok(item) = input.try(&mut parse_one) { results.push(item); } else if comma { @@ -355,8 +375,14 @@ impl OneOrMoreSeparated for UnicodeRange { type S = Comma; } -impl<T> ToCss for Vec<T> where T: ToCss + OneOrMoreSeparated { - fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: Write { +impl<T> ToCss for Vec<T> +where + T: ToCss + OneOrMoreSeparated, +{ + fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result + where + W: Write, + { let mut iter = self.iter(); iter.next().unwrap().to_css(dest)?; for item in iter { @@ -367,24 +393,35 @@ impl<T> ToCss for Vec<T> where T: ToCss + OneOrMoreSeparated { } } -impl<T> ToCss for Box<T> where T: ?Sized + ToCss { +impl<T> ToCss for Box<T> +where + T: ?Sized + ToCss, +{ fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result - where W: Write, + where + W: Write, { (**self).to_css(dest) } } -impl<T> ToCss for Arc<T> where T: ?Sized + ToCss { +impl<T> ToCss for Arc<T> +where + T: ?Sized + ToCss, +{ fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result - where W: Write, + where + W: Write, { (**self).to_css(dest) } } impl ToCss for Au { - fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: Write { + fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result + where + W: Write, + { self.to_f64_px().to_css(dest)?; dest.write_str("px") } @@ -393,7 +430,10 @@ impl ToCss for Au { macro_rules! impl_to_css_for_predefined_type { ($name: ty) => { impl<'a> ToCss for $name { - fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: Write { + fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result + where + W: Write, + { ::cssparser::ToCss::to_css(self, dest) } } diff --git a/components/style_traits/viewport.rs b/components/style_traits/viewport.rs index d961fa9e62e..5cf7bc95667 100644 --- a/components/style_traits/viewport.rs +++ b/components/style_traits/viewport.rs @@ -28,7 +28,10 @@ define_css_keyword_enum! { /// /// <https://drafts.csswg.org/css-device-adapt/#viewport-desc> #[derive(Clone, Debug, PartialEq)] -#[cfg_attr(feature = "servo", derive(Deserialize, Serialize, MallocSizeOf))] +#[cfg_attr( + feature = "servo", + derive(Deserialize, Serialize, MallocSizeOf) +)] pub struct ViewportConstraints { /// Width and height: /// * https://drafts.csswg.org/css-device-adapt/#width-desc @@ -43,7 +46,7 @@ pub struct ViewportConstraints { /// <https://drafts.csswg.org/css-device-adapt/#user-zoom-desc> pub user_zoom: UserZoom, /// <https://drafts.csswg.org/css-device-adapt/#orientation-desc> - pub orientation: Orientation + pub orientation: Orientation, } impl ToCss for ViewportConstraints { @@ -93,7 +96,8 @@ pub enum Zoom { impl ToCss for Zoom { fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result - where W: fmt::Write, + where + W: fmt::Write, { match *self { Zoom::Number(number) => number.to_css(dest), @@ -101,7 +105,7 @@ impl ToCss for Zoom { Zoom::Percentage(percentage) => { (percentage * 100.).to_css(dest)?; dest.write_char('%') - } + }, } } } @@ -121,16 +125,16 @@ impl Zoom { // argument, and pass ParsingMode owned by the ParserContext to // is_ok() instead of using ParsingMode::DEFAULT directly. // In order to do so, we might want to move these stuff into style::stylesheets::viewport_rule. - Token::Percentage { unit_value, .. } if NonNegative.is_ok(ParsingMode::DEFAULT, unit_value) => { + Token::Percentage { unit_value, .. } + if NonNegative.is_ok(ParsingMode::DEFAULT, unit_value) => + { Ok(Zoom::Percentage(unit_value)) - } + }, Token::Number { value, .. } if NonNegative.is_ok(ParsingMode::DEFAULT, value) => { Ok(Zoom::Number(value)) - } - Token::Ident(ref value) if value.eq_ignore_ascii_case("auto") => { - Ok(Zoom::Auto) - } - ref t => Err(location.new_unexpected_token_error(t.clone())) + }, + Token::Ident(ref value) if value.eq_ignore_ascii_case("auto") => Ok(Zoom::Auto), + ref t => Err(location.new_unexpected_token_error(t.clone())), } } @@ -141,7 +145,7 @@ impl Zoom { match *self { Zoom::Number(number) => Some(number as f32), Zoom::Percentage(percentage) => Some(percentage as f32), - Zoom::Auto => None + Zoom::Auto => None, } } } diff --git a/support/android/apk/servoview/src/main/java/com/mozilla/servoview/ServoSurface.java b/support/android/apk/servoview/src/main/java/com/mozilla/servoview/ServoSurface.java index b2848e764fc..305dbb7a885 100644 --- a/support/android/apk/servoview/src/main/java/com/mozilla/servoview/ServoSurface.java +++ b/support/android/apk/servoview/src/main/java/com/mozilla/servoview/ServoSurface.java @@ -38,7 +38,7 @@ public class ServoSurface { private Servo mServo; private Client mClient = null; private String mServoArgs = ""; - private Uri mInitialUri = null; + private String mInitialUri = null; private Activity mActivity; public ServoSurface(Surface surface, int width, int height) { @@ -82,7 +82,15 @@ public class ServoSurface { } public void loadUri(String uri) { - mServo.loadUri(uri); + if (mServo != null) { + mServo.loadUri(uri); + } else { + mInitialUri = uri; + } + } + + public void loadUri(Uri uri) { + loadUri(uri.toString()); } public void scrollStart(int dx, int dy, int x, int y) { @@ -105,14 +113,6 @@ public class ServoSurface { mServo.resize(width, height); } - public void loadUri(Uri uri) { - if (mServo != null) { - mServo.loadUri(uri.toString()); - } else { - mInitialUri = uri; - } - } - static class GLSurface implements GfxCallbacks { private EGLConfig[] mEGLConfigs; private EGLDisplay mEglDisplay; @@ -196,15 +196,14 @@ public class ServoSurface { GLSurface surface = new GLSurface(mASurface); - final boolean showLogs = true; - String uri = mInitialUri == null ? null : mInitialUri.toString(); - mGLLooperHandler = new Handler() { public void handleMessage(Message msg) { } }; inUIThread(() -> { + final boolean showLogs = true; + String uri = mInitialUri == null ? null : mInitialUri; mServo = new Servo(this, surface, mClient, mActivity, mServoArgs, uri, mWidth, mHeight, showLogs); }); diff --git a/tests/wpt/metadata/FileAPI/url/url-with-fetch.any.js.ini b/tests/wpt/metadata/FileAPI/url/url-with-fetch.any.js.ini index 20de0f22e82..3a3d15b8406 100644 --- a/tests/wpt/metadata/FileAPI/url/url-with-fetch.any.js.ini +++ b/tests/wpt/metadata/FileAPI/url/url-with-fetch.any.js.ini @@ -1,14 +1,19 @@ [url-with-fetch.any.worker.html] [url-with-fetch] expected: FAIL + [Only exact matches should revoke URLs, using fetch] expected: FAIL + [Appending a query string should cause fetch to fail] expected: FAIL + [Appending a path should cause fetch to fail] expected: FAIL + [Revoke blob URL after creating Request, will fetch] expected: FAIL + [Revoke blob URL after calling fetch, fetch should succeed] expected: FAIL @@ -19,14 +24,19 @@ [url-with-fetch] expected: FAIL + [Only exact matches should revoke URLs, using fetch] expected: FAIL + [Appending a query string should cause fetch to fail] expected: FAIL + [Appending a path should cause fetch to fail] expected: FAIL + [Revoke blob URL after creating Request, will fetch] expected: FAIL + [Revoke blob URL after calling fetch, fetch should succeed] expected: FAIL diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index ccd51186286..c281a65c1ff 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -13009,6 +13009,54 @@ {} ] ], + "html/semantics/interactive-elements/commands/legend/first-input-after-legend-manual.html": [ + [ + "/html/semantics/interactive-elements/commands/legend/first-input-after-legend-manual.html", + {} + ] + ], + "html/semantics/interactive-elements/commands/legend/first-input-before-legend-manual.html": [ + [ + "/html/semantics/interactive-elements/commands/legend/first-input-before-legend-manual.html", + {} + ] + ], + "html/semantics/interactive-elements/commands/legend/first-input-inside-legend-manual.html": [ + [ + "/html/semantics/interactive-elements/commands/legend/first-input-inside-legend-manual.html", + {} + ] + ], + "html/semantics/interactive-elements/commands/legend/focusable-legend-manual.html": [ + [ + "/html/semantics/interactive-elements/commands/legend/focusable-legend-manual.html", + {} + ] + ], + "html/semantics/interactive-elements/commands/legend/focusable-legend-sibling-manual.html": [ + [ + "/html/semantics/interactive-elements/commands/legend/focusable-legend-sibling-manual.html", + {} + ] + ], + "html/semantics/interactive-elements/commands/legend/input-outside-fieldset-manual.html": [ + [ + "/html/semantics/interactive-elements/commands/legend/input-outside-fieldset-manual.html", + {} + ] + ], + "html/semantics/interactive-elements/commands/legend/label-sibling-manual.html": [ + [ + "/html/semantics/interactive-elements/commands/legend/label-sibling-manual.html", + {} + ] + ], + "html/semantics/interactive-elements/commands/legend/no-fieldset-parent-manual.html": [ + [ + "/html/semantics/interactive-elements/commands/legend/no-fieldset-parent-manual.html", + {} + ] + ], "html/semantics/selectors/pseudo-classes/checked-001-manual.html": [ [ "/html/semantics/selectors/pseudo-classes/checked-001-manual.html", @@ -39819,6 +39867,30 @@ {} ] ], + "css/CSS2/borders/groove-default.html": [ + [ + "/css/CSS2/borders/groove-default.html", + [ + [ + "/css/CSS2/borders/groove-ridge-default-notref.html", + "!=" + ] + ], + {} + ] + ], + "css/CSS2/borders/ridge-default.html": [ + [ + "/css/CSS2/borders/ridge-default.html", + [ + [ + "/css/CSS2/borders/groove-ridge-default-notref.html", + "!=" + ] + ], + {} + ] + ], "css/CSS2/borders/shand-border-000.xht": [ [ "/css/CSS2/borders/shand-border-000.xht", @@ -109363,6 +109435,18 @@ {} ] ], + "css/css-contain/contain-animation-001.html": [ + [ + "/css/css-contain/contain-animation-001.html", + [ + [ + "/css/reference/ref-filled-green-100px-square.xht", + "==" + ] + ], + {} + ] + ], "css/css-contain/contain-layout-001.html": [ [ "/css/css-contain/contain-layout-001.html", @@ -109579,6 +109663,18 @@ {} ] ], + "css/css-contain/contain-layout-baseline-001.html": [ + [ + "/css/css-contain/contain-layout-baseline-001.html", + [ + [ + "/css/reference/ref-filled-green-100px-square.xht", + "==" + ] + ], + {} + ] + ], "css/css-contain/contain-layout-breaks-001.html": [ [ "/css/css-contain/contain-layout-breaks-001.html", @@ -110059,6 +110155,18 @@ {} ] ], + "css/css-contain/contain-paint-baseline-001.html": [ + [ + "/css/css-contain/contain-paint-baseline-001.html", + [ + [ + "/css/css-contain/reference/contain-baseline-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-contain/contain-paint-cell-001.html": [ [ "/css/css-contain/contain-paint-cell-001.html", @@ -110515,6 +110623,18 @@ {} ] ], + "css/css-contain/contain-size-baseline-001.html": [ + [ + "/css/css-contain/contain-size-baseline-001.html", + [ + [ + "/css/css-contain/reference/contain-baseline-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-contain/contain-size-borders.html": [ [ "/css/css-contain/contain-size-borders.html", @@ -110659,6 +110779,18 @@ {} ] ], + "css/css-contain/contain-style-baseline-001.html": [ + [ + "/css/css-contain/contain-style-baseline-001.html", + [ + [ + "/css/css-contain/reference/contain-baseline-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-contain/contain-style-breaks-001.html": [ [ "/css/css-contain/contain-style-breaks-001.html", @@ -128283,9 +128415,9 @@ {} ] ], - "css/css-paint-api/registered-properties-in-custom-paint.https.html": [ + "css/css-paint-api/registered-property-type.https.html": [ [ - "/css/css-paint-api/registered-properties-in-custom-paint.https.html", + "/css/css-paint-api/registered-property-type.https.html", [ [ "/css/css-paint-api/parse-input-arguments-ref.html", @@ -131935,6 +132067,18 @@ {} ] ], + "css/css-scrollbars/textarea-scrollbar-width-none.html": [ + [ + "/css/css-scrollbars/textarea-scrollbar-width-none.html", + [ + [ + "/css/css-scrollbars/textarea-scrollbar-width-none-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-scrollbars/viewport-scrollbar-body.html": [ [ "/css/css-scrollbars/viewport-scrollbar-body.html", @@ -226592,6 +226736,11 @@ {} ] ], + "css/CSS2/borders/groove-ridge-default-notref.html": [ + [ + {} + ] + ], "css/CSS2/borders/shand-border-000-ref.xht": [ [ {} @@ -247322,6 +247471,11 @@ {} ] ], + "css/css-contain/reference/contain-baseline-ref.html": [ + [ + {} + ] + ], "css/css-contain/reference/contain-layout-breaks-002-ref.html": [ [ {} @@ -261362,6 +261516,11 @@ {} ] ], + "css/css-scrollbars/textarea-scrollbar-width-none-ref.html": [ + [ + {} + ] + ], "css/css-scrollbars/viewport-scrollbar-body-ref.html": [ [ {} @@ -287592,16 +287751,6 @@ {} ] ], - "html/editing/focus/document-level-focus-apis/test.html": [ - [ - {} - ] - ], - "html/editing/focus/processing-model/support/preventScroll-helper.html": [ - [ - {} - ] - ], "html/editing/the-hidden-attribute/hidden-1-ref.html": [ [ {} @@ -287812,6 +287961,16 @@ {} ] ], + "html/interaction/focus/document-level-focus-apis/test.html": [ + [ + {} + ] + ], + "html/interaction/focus/processing-model/support/preventScroll-helper.html": [ + [ + {} + ] + ], "html/obsolete/META.yml": [ [ {} @@ -289722,6 +289881,11 @@ {} ] ], + "html/semantics/interactive-elements/commands/common/accesskey.js": [ + [ + {} + ] + ], "html/semantics/interactive-elements/commands/contains.json": [ [ {} @@ -292587,6 +292751,11 @@ {} ] ], + "interfaces/webrtc-dscp.idl": [ + [ + {} + ] + ], "interfaces/webrtc-stats.idl": [ [ {} @@ -309852,11 +310021,21 @@ {} ] ], + "tools/wptrunner/wptrunner/browsers/chrome_webdriver.py": [ + [ + {} + ] + ], "tools/wptrunner/wptrunner/browsers/edge.py": [ [ {} ] ], + "tools/wptrunner/wptrunner/browsers/edge_webdriver.py": [ + [ + {} + ] + ], "tools/wptrunner/wptrunner/browsers/fennec.py": [ [ {} @@ -309882,6 +310061,11 @@ {} ] ], + "tools/wptrunner/wptrunner/browsers/safari_webdriver.py": [ + [ + {} + ] + ], "tools/wptrunner/wptrunner/browsers/sauce.py": [ [ {} @@ -309977,6 +310161,11 @@ {} ] ], + "tools/wptrunner/wptrunner/executors/executorwebdriver.py": [ + [ + {} + ] + ], "tools/wptrunner/wptrunner/executors/executorwebkit.py": [ [ {} @@ -330232,6 +330421,102 @@ {} ] ], + "css/css-animations/parsing/animation-delay-invalid.html": [ + [ + "/css/css-animations/parsing/animation-delay-invalid.html", + {} + ] + ], + "css/css-animations/parsing/animation-delay-valid.html": [ + [ + "/css/css-animations/parsing/animation-delay-valid.html", + {} + ] + ], + "css/css-animations/parsing/animation-direction-invalid.html": [ + [ + "/css/css-animations/parsing/animation-direction-invalid.html", + {} + ] + ], + "css/css-animations/parsing/animation-direction-valid.html": [ + [ + "/css/css-animations/parsing/animation-direction-valid.html", + {} + ] + ], + "css/css-animations/parsing/animation-duration-invalid.html": [ + [ + "/css/css-animations/parsing/animation-duration-invalid.html", + {} + ] + ], + "css/css-animations/parsing/animation-duration-valid.html": [ + [ + "/css/css-animations/parsing/animation-duration-valid.html", + {} + ] + ], + "css/css-animations/parsing/animation-fill-mode-invalid.html": [ + [ + "/css/css-animations/parsing/animation-fill-mode-invalid.html", + {} + ] + ], + "css/css-animations/parsing/animation-fill-mode-valid.html": [ + [ + "/css/css-animations/parsing/animation-fill-mode-valid.html", + {} + ] + ], + "css/css-animations/parsing/animation-iteration-count-invalid.html": [ + [ + "/css/css-animations/parsing/animation-iteration-count-invalid.html", + {} + ] + ], + "css/css-animations/parsing/animation-iteration-count-valid.html": [ + [ + "/css/css-animations/parsing/animation-iteration-count-valid.html", + {} + ] + ], + "css/css-animations/parsing/animation-name-invalid.html": [ + [ + "/css/css-animations/parsing/animation-name-invalid.html", + {} + ] + ], + "css/css-animations/parsing/animation-name-valid.html": [ + [ + "/css/css-animations/parsing/animation-name-valid.html", + {} + ] + ], + "css/css-animations/parsing/animation-play-state-invalid.html": [ + [ + "/css/css-animations/parsing/animation-play-state-invalid.html", + {} + ] + ], + "css/css-animations/parsing/animation-play-state-valid.html": [ + [ + "/css/css-animations/parsing/animation-play-state-valid.html", + {} + ] + ], + "css/css-animations/parsing/animation-timing-function-invalid.html": [ + [ + "/css/css-animations/parsing/animation-timing-function-invalid.html", + {} + ] + ], + "css/css-animations/parsing/animation-timing-function-valid.html": [ + [ + "/css/css-animations/parsing/animation-timing-function-valid.html", + {} + ] + ], "css/css-animations/pending-style-changes-001.html": [ [ "/css/css-animations/pending-style-changes-001.html", @@ -336524,6 +336809,54 @@ {} ] ], + "css/css-transitions/parsing/transition-delay-invalid.html": [ + [ + "/css/css-transitions/parsing/transition-delay-invalid.html", + {} + ] + ], + "css/css-transitions/parsing/transition-delay-valid.html": [ + [ + "/css/css-transitions/parsing/transition-delay-valid.html", + {} + ] + ], + "css/css-transitions/parsing/transition-duration-invalid.html": [ + [ + "/css/css-transitions/parsing/transition-duration-invalid.html", + {} + ] + ], + "css/css-transitions/parsing/transition-duration-valid.html": [ + [ + "/css/css-transitions/parsing/transition-duration-valid.html", + {} + ] + ], + "css/css-transitions/parsing/transition-property-invalid.html": [ + [ + "/css/css-transitions/parsing/transition-property-invalid.html", + {} + ] + ], + "css/css-transitions/parsing/transition-property-valid.html": [ + [ + "/css/css-transitions/parsing/transition-property-valid.html", + {} + ] + ], + "css/css-transitions/parsing/transition-timing-function-invalid.html": [ + [ + "/css/css-transitions/parsing/transition-timing-function-invalid.html", + {} + ] + ], + "css/css-transitions/parsing/transition-timing-function-valid.html": [ + [ + "/css/css-transitions/parsing/transition-timing-function-valid.html", + {} + ] + ], "css/css-transitions/properties-value-001.html": [ [ "/css/css-transitions/properties-value-001.html", @@ -357890,102 +358223,6 @@ {} ] ], - "html/editing/focus/composed.window.js": [ - [ - "/html/editing/focus/composed.window.html", - {} - ] - ], - "html/editing/focus/document-level-focus-apis/document-level-apis.html": [ - [ - "/html/editing/focus/document-level-focus-apis/document-level-apis.html", - {} - ] - ], - "html/editing/focus/focus-01.html": [ - [ - "/html/editing/focus/focus-01.html", - { - "testdriver": true - } - ] - ], - "html/editing/focus/focus-02.html": [ - [ - "/html/editing/focus/focus-02.html", - { - "testdriver": true - } - ] - ], - "html/editing/focus/focus-management/focus-event-targets-simple.html": [ - [ - "/html/editing/focus/focus-management/focus-event-targets-simple.html", - {} - ] - ], - "html/editing/focus/focus-management/focus-events.html": [ - [ - "/html/editing/focus/focus-management/focus-events.html", - {} - ] - ], - "html/editing/focus/processing-model/focus-fixup-rule-one-no-dialogs.html": [ - [ - "/html/editing/focus/processing-model/focus-fixup-rule-one-no-dialogs.html", - {} - ] - ], - "html/editing/focus/processing-model/preventScroll.html": [ - [ - "/html/editing/focus/processing-model/preventScroll.html", - {} - ] - ], - "html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-default-value.html": [ - [ - "/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-default-value.html", - {} - ] - ], - "html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-negative.html": [ - [ - "/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-negative.html", - { - "testdriver": true - } - ] - ], - "html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-order.html": [ - [ - "/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-order.html", - { - "testdriver": true - } - ] - ], - "html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-positive.html": [ - [ - "/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-positive.html", - { - "testdriver": true - } - ] - ], - "html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-zero.html": [ - [ - "/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-zero.html", - { - "testdriver": true - } - ] - ], - "html/editing/focus/tabindex-focus-flag.html": [ - [ - "/html/editing/focus/tabindex-focus-flag.html", - {} - ] - ], "html/infrastructure/common-dom-interfaces/collections/domstringlist-interface.html": [ [ "/html/infrastructure/common-dom-interfaces/collections/domstringlist-interface.html", @@ -358266,6 +358503,114 @@ {} ] ], + "html/interaction/focus/composed.window.js": [ + [ + "/html/interaction/focus/composed.window.html", + {} + ] + ], + "html/interaction/focus/document-level-focus-apis/document-level-apis.html": [ + [ + "/html/interaction/focus/document-level-focus-apis/document-level-apis.html", + {} + ] + ], + "html/interaction/focus/focus-01.html": [ + [ + "/html/interaction/focus/focus-01.html", + { + "testdriver": true + } + ] + ], + "html/interaction/focus/focus-02.html": [ + [ + "/html/interaction/focus/focus-02.html", + { + "testdriver": true + } + ] + ], + "html/interaction/focus/focus-management/focus-event-targets-simple.html": [ + [ + "/html/interaction/focus/focus-management/focus-event-targets-simple.html", + {} + ] + ], + "html/interaction/focus/focus-management/focus-events.html": [ + [ + "/html/interaction/focus/focus-management/focus-events.html", + {} + ] + ], + "html/interaction/focus/processing-model/focus-fixup-rule-one-no-dialogs.html": [ + [ + "/html/interaction/focus/processing-model/focus-fixup-rule-one-no-dialogs.html", + {} + ] + ], + "html/interaction/focus/processing-model/legend-focusable.html": [ + [ + "/html/interaction/focus/processing-model/legend-focusable.html", + {} + ] + ], + "html/interaction/focus/processing-model/legend.html": [ + [ + "/html/interaction/focus/processing-model/legend.html", + {} + ] + ], + "html/interaction/focus/processing-model/preventScroll.html": [ + [ + "/html/interaction/focus/processing-model/preventScroll.html", + {} + ] + ], + "html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-default-value.html": [ + [ + "/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-default-value.html", + {} + ] + ], + "html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-negative.html": [ + [ + "/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-negative.html", + { + "testdriver": true + } + ] + ], + "html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-order.html": [ + [ + "/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-order.html", + { + "testdriver": true + } + ] + ], + "html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-positive.html": [ + [ + "/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-positive.html", + { + "testdriver": true + } + ] + ], + "html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-zero.html": [ + [ + "/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-zero.html", + { + "testdriver": true + } + ] + ], + "html/interaction/focus/tabindex-focus-flag.html": [ + [ + "/html/interaction/focus/tabindex-focus-flag.html", + {} + ] + ], "html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-all.html": [ [ "/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-all.html", @@ -358452,6 +358797,12 @@ {} ] ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align-text-align.html": [ + [ + "/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align-text-align.html", + {} + ] + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align.html": [ [ "/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align.html", @@ -397036,6 +397387,22 @@ {} ] ], + "wasm/jsapi/constructor/compile.any.js": [ + [ + "/wasm/jsapi/constructor/compile.any.html", + {} + ], + [ + "/wasm/jsapi/constructor/compile.any.js", + { + "jsshell": true + } + ], + [ + "/wasm/jsapi/constructor/compile.any.worker.html", + {} + ] + ], "wasm/jsapi/constructor/instantiate-bad-imports.any.js": [ [ "/wasm/jsapi/constructor/instantiate-bad-imports.any.html", @@ -397052,6 +397419,38 @@ {} ] ], + "wasm/jsapi/constructor/instantiate.any.js": [ + [ + "/wasm/jsapi/constructor/instantiate.any.html", + {} + ], + [ + "/wasm/jsapi/constructor/instantiate.any.js", + { + "jsshell": true + } + ], + [ + "/wasm/jsapi/constructor/instantiate.any.worker.html", + {} + ] + ], + "wasm/jsapi/constructor/validate.any.js": [ + [ + "/wasm/jsapi/constructor/validate.any.html", + {} + ], + [ + "/wasm/jsapi/constructor/validate.any.js", + { + "jsshell": true + } + ], + [ + "/wasm/jsapi/constructor/validate.any.worker.html", + {} + ] + ], "wasm/jsapi/global/constructor.any.js": [ [ "/wasm/jsapi/global/constructor.any.html", @@ -398320,6 +398719,12 @@ {} ] ], + "webaudio/the-audio-api/the-audiobuffersourcenode-interface/buffer-resampling.html": [ + [ + "/webaudio/the-audio-api/the-audiobuffersourcenode-interface/buffer-resampling.html", + {} + ] + ], "webaudio/the-audio-api/the-audiobuffersourcenode-interface/ctor-audiobuffersource.html": [ [ "/webaudio/the-audio-api/the-audiobuffersourcenode-interface/ctor-audiobuffersource.html", @@ -405800,6 +406205,12 @@ {} ] ], + "xhr/open-after-stop.window.js": [ + [ + "/xhr/open-after-stop.window.html", + {} + ] + ], "xhr/open-during-abort-event.htm": [ [ "/xhr/open-during-abort-event.htm", @@ -473799,10 +474210,22 @@ "31d6fe104d7a41e1bdd3ce9e396bd02f6edef726", "visual" ], + "css/CSS2/borders/groove-default.html": [ + "c9028b9a2f4ce57857335862e1f81a30f8f1e535", + "reftest" + ], + "css/CSS2/borders/groove-ridge-default-notref.html": [ + "5ead6432ccd2cbbfa412dd562faac03d4711c2c8", + "support" + ], "css/CSS2/borders/ltr-borders-001.xht": [ "e46f42fd96ba305f9699fa6f270a70289d16c50d", "visual" ], + "css/CSS2/borders/ridge-default.html": [ + "4bd0bdf3aef8137b2a14e16ea2461c85b61fe4a6", + "reftest" + ], "css/CSS2/borders/rtl-borders-001.xht": [ "3139fef544276525bd46f07f6c321e15eabec24b", "visual" @@ -521955,6 +522378,70 @@ "1d3ed2b9b806792c7efaeeee9ab264101dd222bc", "testharness" ], + "css/css-animations/parsing/animation-delay-invalid.html": [ + "a58d2cd11bc572d3a7899fb70b8b04adbd76a713", + "testharness" + ], + "css/css-animations/parsing/animation-delay-valid.html": [ + "5ff0416cc64241f81025f39af20d186042d49a30", + "testharness" + ], + "css/css-animations/parsing/animation-direction-invalid.html": [ + "0b48d97f0a1bb670daec7335049aa486810a2cde", + "testharness" + ], + "css/css-animations/parsing/animation-direction-valid.html": [ + "bcc9acc3428cfcdadc6d48fc0fa01d51eb747452", + "testharness" + ], + "css/css-animations/parsing/animation-duration-invalid.html": [ + "5edacd3735e4f3ac0c0724415b3ca0052f10d33b", + "testharness" + ], + "css/css-animations/parsing/animation-duration-valid.html": [ + "e65a1a707246eb2c1773da17c355d71118fd0db4", + "testharness" + ], + "css/css-animations/parsing/animation-fill-mode-invalid.html": [ + "dda2221f4746a64778ea4c5a82fa42c35243a342", + "testharness" + ], + "css/css-animations/parsing/animation-fill-mode-valid.html": [ + "1f73a821d15119d6a8fc2720d53f6cefdd29fb5d", + "testharness" + ], + "css/css-animations/parsing/animation-iteration-count-invalid.html": [ + "ff1e8e23a08cf58c08922eb40145e916852c0562", + "testharness" + ], + "css/css-animations/parsing/animation-iteration-count-valid.html": [ + "be8a83798908a6771b935e38fe7a8608be9821ed", + "testharness" + ], + "css/css-animations/parsing/animation-name-invalid.html": [ + "77d53f990b1607c07a07648b5f0283f9fb5e4fbf", + "testharness" + ], + "css/css-animations/parsing/animation-name-valid.html": [ + "9ed73d4d15ff615c4318719bc8802796a88149c8", + "testharness" + ], + "css/css-animations/parsing/animation-play-state-invalid.html": [ + "f47a2f75ddfc35a279037ada8df34077bd1308ab", + "testharness" + ], + "css/css-animations/parsing/animation-play-state-valid.html": [ + "ce6d053ec2736ec8d5e8420b3d1a1e4f07fd04ed", + "testharness" + ], + "css/css-animations/parsing/animation-timing-function-invalid.html": [ + "adc1cc10e39d09df78c4398ffca008739d751076", + "testharness" + ], + "css/css-animations/parsing/animation-timing-function-valid.html": [ + "63e2805485bfb1f8db9dfe3ad70979ade7e11cd4", + "testharness" + ], "css/css-animations/pending-style-changes-001.html": [ "fb74d7fa7d062d60153d47913df9eb2b0c7267c8", "testharness" @@ -526607,6 +527094,10 @@ "259c00b2a587c9aa2d07de97fb547b32f9772b92", "support" ], + "css/css-contain/contain-animation-001.html": [ + "449221428c3d76d31ff84a5792c7578c36cbebed", + "reftest" + ], "css/css-contain/contain-layout-001.html": [ "85b959da2b9a151c13be3dc83485646341752915", "reftest" @@ -526679,6 +527170,10 @@ "5d7ebc0195cbbb7bc303784ab05296885c323f40", "reftest" ], + "css/css-contain/contain-layout-baseline-001.html": [ + "ed2471a62614bf961cf2cd9441256ac02d3d6f6b", + "reftest" + ], "css/css-contain/contain-layout-breaks-001.html": [ "a85cf2c6c8e00f1d21fa5a63da81eff8148f3d71", "reftest" @@ -526839,6 +527334,10 @@ "e48fcb64a4acbb8683730c58577ba530487a5ad9", "reftest" ], + "css/css-contain/contain-paint-baseline-001.html": [ + "3f84a3003a2a991a745198e2ad97938754462ef7", + "reftest" + ], "css/css-contain/contain-paint-cell-001.html": [ "d66a16944ecadca57a585a4514024b198c19478f", "reftest" @@ -526991,6 +527490,10 @@ "60cb194242894b540aaa50c6990e7cbcb491e27e", "reftest" ], + "css/css-contain/contain-size-baseline-001.html": [ + "0ffed1b3b6a08831792b0a5ac40d1340c142c48d", + "reftest" + ], "css/css-contain/contain-size-borders.html": [ "16b5b06295fcc0b44944b1b92afa3ee42271b68f", "reftest" @@ -527039,6 +527542,10 @@ "792710cd87d8ee0813838dd39847f9dd2db2e2a9", "reftest" ], + "css/css-contain/contain-style-baseline-001.html": [ + "f05d20982833077d53ecad3340065aee7e0ca8cd", + "reftest" + ], "css/css-contain/contain-style-breaks-001.html": [ "9e5c27a075eddb80dfd9305abcba50aeefec5088", "reftest" @@ -527107,6 +527614,10 @@ "d86382be08532323baad174808181e338adbc932", "reftest" ], + "css/css-contain/reference/contain-baseline-ref.html": [ + "1fdecb1c33149af52c48c105bce8ad91904bad44", + "support" + ], "css/css-contain/reference/contain-layout-breaks-002-ref.html": [ "c68bee1d0aa4f9201fb6e48cc25199f373128ca8", "support" @@ -539904,7 +540415,7 @@ "support" ], "css/css-fonts/variations/at-font-face-descriptors.html": [ - "ece5b4be9b93622346e43fc79915f8f9cc8c48c1", + "942686c4a1fd0f3d3807f5fdb114e3e154b1577e", "testharness" ], "css/css-fonts/variations/at-font-face-font-matching.html": [ @@ -544368,7 +544879,7 @@ "reftest" ], "css/css-masking/mask-image/mask-image-url-remote-mask.html": [ - "cfa3a6166cdcb41b2feaab2ffd5c087a568771f5", + "f3f2eefaa92df83296379efd861b39e2ab65f78e", "reftest" ], "css/css-masking/mask-image/reference/mask-image-ref.html": [ @@ -544384,7 +544895,7 @@ "support" ], "css/css-masking/mask-image/support/mask.svg": [ - "30e601c87c32a08912e261dab22734033df1ef8e", + "cab55923d32ddb9525cb81a12d8035b1bf51bb4c", "support" ], "css/css-masking/parsing/clip-invalid.html": [ @@ -546327,8 +546838,8 @@ "086bc7b27ee79caab2c2e433da4ff00ba1bace9b", "support" ], - "css/css-paint-api/registered-properties-in-custom-paint.https.html": [ - "d9a63da144d9c08b3912064b78b86a16d44f6918", + "css/css-paint-api/registered-property-type.https.html": [ + "6ff7ce4e0af6b290ea269573c596caa364a5c1c8", "reftest" ], "css/css-paint-api/resources/html5.png": [ @@ -549463,6 +549974,14 @@ "95101024b4f27e93eb2c61c52df70845ae5842bf", "support" ], + "css/css-scrollbars/textarea-scrollbar-width-none-ref.html": [ + "9f505dd7f1d121c0bd0af0131b51f536225326b1", + "support" + ], + "css/css-scrollbars/textarea-scrollbar-width-none.html": [ + "dcfaf5b6270ee0e0092dc795d33bb01af0b9a695", + "reftest" + ], "css/css-scrollbars/viewport-scrollbar-body-ref.html": [ "4e07903e2ca1e5d0378845c8cc4754dc82b1ebf8", "support" @@ -561639,6 +562158,38 @@ "4cc7ee50eb4915fcf95843f7eeee266abfa7b81a", "testharness" ], + "css/css-transitions/parsing/transition-delay-invalid.html": [ + "b34d50551ce433ebe672c7fddb4a549582c754db", + "testharness" + ], + "css/css-transitions/parsing/transition-delay-valid.html": [ + "d6b42b9c059456f10c425f7217ade6b2cd84c1f4", + "testharness" + ], + "css/css-transitions/parsing/transition-duration-invalid.html": [ + "fd0f341f4071b53561cf8b072bb105d3bd1a4563", + "testharness" + ], + "css/css-transitions/parsing/transition-duration-valid.html": [ + "311ca086695151747559a0995b61c7fe4c755592", + "testharness" + ], + "css/css-transitions/parsing/transition-property-invalid.html": [ + "903a206eac13688a51ff2ba88552de67efa2e9cb", + "testharness" + ], + "css/css-transitions/parsing/transition-property-valid.html": [ + "4e3894f5aa94e00aa59406ee1aab92b9226483af", + "testharness" + ], + "css/css-transitions/parsing/transition-timing-function-invalid.html": [ + "936defa6cce5dd7b69bf9344c60add178de6589a", + "testharness" + ], + "css/css-transitions/parsing/transition-timing-function-valid.html": [ + "e11ef0002e43b65e06c8aec7dffab2fe7d48377f", + "testharness" + ], "css/css-transitions/properties-value-001.html": [ "9182930ed78f9ff2adbc4754a8613fc0316b868a", "testharness" @@ -562772,7 +563323,7 @@ "testharness" ], "css/css-typed-om/the-stylepropertymap/properties/color-interpolation.html": [ - "4713d90621d35ce990ddb18ea217e6a467effd0c", + "d8324db22e217d0805c847b83b4b841bbcbe84b1", "testharness" ], "css/css-typed-om/the-stylepropertymap/properties/color-rendering.html": [ @@ -575204,7 +575755,7 @@ "testharness" ], "css/motion/parsing/offset-parsing-valid.html": [ - "75c93e5475fc050f462a3c93c6e6e27912e82559", + "b93091b2088987cb402c364e0d3794d847522a16", "testharness" ], "css/motion/parsing/offset-path-parsing-invalid.html": [ @@ -586944,7 +587495,7 @@ "support" ], "docs/_writing-tests/testharness-api.md": [ - "bb5524532915a58e4fab3c3bb89a41bbe2a46b4a", + "952c8365fb7028c00eeca7ee5949310ecce95913", "support" ], "docs/_writing-tests/testharness.md": [ @@ -602427,70 +602978,6 @@ "c8bdaafdb89555c6708f0d84c3d41e437840be5b", "testharness" ], - "html/editing/focus/composed.window.js": [ - "8951afc4e0ce643752754e67243532ae8e0fa9ae", - "testharness" - ], - "html/editing/focus/document-level-focus-apis/document-level-apis.html": [ - "2d8c49c7f6127fdca7e29800dde3c3096be44aca", - "testharness" - ], - "html/editing/focus/document-level-focus-apis/test.html": [ - "90d63e51e931b147b23e8e1941324f8fb4237c94", - "support" - ], - "html/editing/focus/focus-01.html": [ - "9d1bf1b6c7d3f3b714b72cb3371f35c222fe5a74", - "testharness" - ], - "html/editing/focus/focus-02.html": [ - "1858d6a21d2c97b2bd8706592c08fad748a37330", - "testharness" - ], - "html/editing/focus/focus-management/focus-event-targets-simple.html": [ - "ab7bcfe6d0e636552746def160715bc47e63fb85", - "testharness" - ], - "html/editing/focus/focus-management/focus-events.html": [ - "d63362aaa1828f35de410b56c1ccc2d7869a111e", - "testharness" - ], - "html/editing/focus/processing-model/focus-fixup-rule-one-no-dialogs.html": [ - "d8171abc715990a9e752c2d974acdfd7ecd34fc2", - "testharness" - ], - "html/editing/focus/processing-model/preventScroll.html": [ - "97d341b30ec849fefc13adb8b3376307fea58b69", - "testharness" - ], - "html/editing/focus/processing-model/support/preventScroll-helper.html": [ - "43c6d86a578bedaaf52027d9131bee82bf16fe42", - "support" - ], - "html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-default-value.html": [ - "25e359c2a25826aae29f88c834d2965e6ae81516", - "testharness" - ], - "html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-negative.html": [ - "92bf1743142a906fe1d8092527517cd238e02c2e", - "testharness" - ], - "html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-order.html": [ - "45429cc1a72c65198c46d400d68be6636b5e36a4", - "testharness" - ], - "html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-positive.html": [ - "9a131847703970aff25163a8c78c39e5d1a3a1a3", - "testharness" - ], - "html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-zero.html": [ - "c46acd0a41358e4a0b61e3abde4bb9b39ab6a422", - "testharness" - ], - "html/editing/focus/tabindex-focus-flag.html": [ - "e40bc077594351019591de8cbfae8fb0d6af13fe", - "testharness" - ], "html/editing/the-hidden-attribute/hidden-1-ref.html": [ "7346ce919d210a740104ca5e82264bed8377c2d0", "support" @@ -602879,6 +603366,78 @@ "2d7102bd4acd6a29a650f6e11479d7226f4c4327", "reftest" ], + "html/interaction/focus/composed.window.js": [ + "8951afc4e0ce643752754e67243532ae8e0fa9ae", + "testharness" + ], + "html/interaction/focus/document-level-focus-apis/document-level-apis.html": [ + "2d8c49c7f6127fdca7e29800dde3c3096be44aca", + "testharness" + ], + "html/interaction/focus/document-level-focus-apis/test.html": [ + "90d63e51e931b147b23e8e1941324f8fb4237c94", + "support" + ], + "html/interaction/focus/focus-01.html": [ + "9d1bf1b6c7d3f3b714b72cb3371f35c222fe5a74", + "testharness" + ], + "html/interaction/focus/focus-02.html": [ + "1858d6a21d2c97b2bd8706592c08fad748a37330", + "testharness" + ], + "html/interaction/focus/focus-management/focus-event-targets-simple.html": [ + "ab7bcfe6d0e636552746def160715bc47e63fb85", + "testharness" + ], + "html/interaction/focus/focus-management/focus-events.html": [ + "d63362aaa1828f35de410b56c1ccc2d7869a111e", + "testharness" + ], + "html/interaction/focus/processing-model/focus-fixup-rule-one-no-dialogs.html": [ + "d8171abc715990a9e752c2d974acdfd7ecd34fc2", + "testharness" + ], + "html/interaction/focus/processing-model/legend-focusable.html": [ + "c9209d3cf62d467ad1eb7a13c51fa45d55c19fb3", + "testharness" + ], + "html/interaction/focus/processing-model/legend.html": [ + "b53839374dfd17a4121124f54b6ae9f840808530", + "testharness" + ], + "html/interaction/focus/processing-model/preventScroll.html": [ + "97d341b30ec849fefc13adb8b3376307fea58b69", + "testharness" + ], + "html/interaction/focus/processing-model/support/preventScroll-helper.html": [ + "43c6d86a578bedaaf52027d9131bee82bf16fe42", + "support" + ], + "html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-default-value.html": [ + "25e359c2a25826aae29f88c834d2965e6ae81516", + "testharness" + ], + "html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-negative.html": [ + "92bf1743142a906fe1d8092527517cd238e02c2e", + "testharness" + ], + "html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-order.html": [ + "45429cc1a72c65198c46d400d68be6636b5e36a4", + "testharness" + ], + "html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-positive.html": [ + "9a131847703970aff25163a8c78c39e5d1a3a1a3", + "testharness" + ], + "html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-zero.html": [ + "c46acd0a41358e4a0b61e3abde4bb9b39ab6a422", + "testharness" + ], + "html/interaction/focus/tabindex-focus-flag.html": [ + "e40bc077594351019591de8cbfae8fb0d6af13fe", + "testharness" + ], "html/obsolete/META.yml": [ "c1dd8dddf9eec3ab3fb58df01c549c251f3a3fdf", "support" @@ -603443,8 +604002,12 @@ "c11b466669665a29fc4f33b4bbc14c6b5598d545", "reftest" ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align-text-align.html": [ + "01483bf8ad3cee01272ba36bc0ffaf73c1b12cad", + "testharness" + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align.html": [ - "f7511c9e4c91dbd2cb11db502789d8792f038a29", + "e7745998194730d11840664b61afc6efe0c8039d", "testharness" ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-auto-margins-ref.html": [ @@ -608531,10 +609094,46 @@ "c1dd8dddf9eec3ab3fb58df01c549c251f3a3fdf", "support" ], + "html/semantics/interactive-elements/commands/common/accesskey.js": [ + "f08761be8c1fc618e42369a3358c0dbf8a848bea", + "support" + ], "html/semantics/interactive-elements/commands/contains.json": [ "b2ca2e771bd9f7c82c2e955a88ac6fc6010c48a7", "support" ], + "html/semantics/interactive-elements/commands/legend/first-input-after-legend-manual.html": [ + "521b4bb975530880caac863d96b167cd08abc7a0", + "manual" + ], + "html/semantics/interactive-elements/commands/legend/first-input-before-legend-manual.html": [ + "1c40cc7b81e9a866df97f7d386c688de8f1b3bc7", + "manual" + ], + "html/semantics/interactive-elements/commands/legend/first-input-inside-legend-manual.html": [ + "abd3a3b2dfe36cab4b267273b6616d60eab07046", + "manual" + ], + "html/semantics/interactive-elements/commands/legend/focusable-legend-manual.html": [ + "e2880a77bf9592776ce58bb0fbbfcd1df2581b5a", + "manual" + ], + "html/semantics/interactive-elements/commands/legend/focusable-legend-sibling-manual.html": [ + "49dcaaf7d54e15ee6e2d6e893e5f4be55d4d96e5", + "manual" + ], + "html/semantics/interactive-elements/commands/legend/input-outside-fieldset-manual.html": [ + "dc6af48323e49c85b9f09d335f9d8dd19979d17c", + "manual" + ], + "html/semantics/interactive-elements/commands/legend/label-sibling-manual.html": [ + "8a7b20565f77e3e55600b698ef0780d762fa7ebb", + "manual" + ], + "html/semantics/interactive-elements/commands/legend/no-fieldset-parent-manual.html": [ + "e7abb71454a43ce226b2cc5da496889635b33ab8", + "manual" + ], "html/semantics/interactive-elements/contextmenu-historical.html": [ "f723d3a92aab226fd82295a81209c3e25882bcb1", "testharness" @@ -613684,7 +614283,7 @@ "support" ], "interfaces/background-fetch.idl": [ - "92b6026f8b6dbbc4a79c1b3cdfdf73a0253aeaa6", + "130d5d825a5bef49fd651c0cb326b9b40a7fa2c7", "support" ], "interfaces/battery-status.idl": [ @@ -613708,7 +614307,7 @@ "support" ], "interfaces/cookie-store.idl": [ - "454da38b18240e6e5e98a92cd2c9d129ee71d4a0", + "d872b7aadb25b4720e78d98f3bf04c0c15151084", "support" ], "interfaces/cors-rfc1918.idl": [ @@ -613864,7 +614463,7 @@ "support" ], "interfaces/intersection-observer.idl": [ - "b48e1cbab37fef9b9c8dd5efb03fc6c222a3e856", + "ffda8f5c64dba8d225cc7126371b73980f4ce48e", "support" ], "interfaces/keyboard-lock.idl": [ @@ -613944,7 +614543,7 @@ "support" ], "interfaces/payment-handler.idl": [ - "9f10d7e70194cb83dc59055006d96426f5669536", + "b19a7302dbacaf8ef425e568d5d5409b4b2811d5", "support" ], "interfaces/payment-method-basic-card.idl": [ @@ -613952,7 +614551,7 @@ "support" ], "interfaces/payment-request.idl": [ - "d844f7cc788c5be1c882fe510bc85f25dd250659", + "05790c7d76d6e5f36b47fbf23615822b4a68c18a", "support" ], "interfaces/performance-timeline.idl": [ @@ -613972,7 +614571,7 @@ "support" ], "interfaces/pointerevents.idl": [ - "63d39a285232b0319c24ff907871fe92bd70d167", + "da822bba0e58e36ea0a892b008075120282d8a85", "support" ], "interfaces/pointerlock.idl": [ @@ -614084,7 +614683,7 @@ "support" ], "interfaces/wasm-js-api.idl": [ - "04c817dcb11ad906d61c5576e43df1fcdf168860", + "6de14fb8f0895a72b69f37b9dd8b72e2ab1604e0", "support" ], "interfaces/web-animations.idl": [ @@ -614127,6 +614726,10 @@ "769433b19b31e5c534f19d82810635e2e22d38e9", "support" ], + "interfaces/webrtc-dscp.idl": [ + "718447bbf4a3ed92ac853ba2075a24ba41d3049d", + "support" + ], "interfaces/webrtc-stats.idl": [ "ee5cce403f8d325b73661f45b65bd09f5faae861", "support" @@ -634776,7 +635379,7 @@ "support" ], "resources/test/tests/functional/promise.html": [ - "bdf6dc3ec2af07a9799243cbc7b15da939961363", + "9db1dec0f9e3e973e57d08f2ebed256b82bbd0ab", "support" ], "resources/test/tests/functional/queue.html": [ @@ -634932,7 +635535,7 @@ "support" ], "resources/testharness.js": [ - "f0c24635017dad6275c99dc149ab1739470eeb36", + "85e211ff60ae559d7ff39994c33a2f05056e1ef2", "support" ], "resources/testharness.js.headers": [ @@ -637400,7 +638003,7 @@ "testharness" ], "service-workers/service-worker/fetch-event-referrer-policy.https.html": [ - "9b67faccac8baff81bbffd95e3c335d02ccdf216", + "73ae123ae4e73b46cd63b3bb199b3d8758264fc5", "testharness" ], "service-workers/service-worker/fetch-event-respond-with-argument.https.html": [ @@ -639380,7 +639983,7 @@ "testharness" ], "shadow-dom/Extensions-to-Event-Interface.html": [ - "52cda0b6bb863cf5f09d9752874165656bfc3fe3", + "806d539cad45d55d635ee55637be2c8b5c014b55", "testharness" ], "shadow-dom/HTMLSlotElement-interface.html": [ @@ -639476,7 +640079,7 @@ "reftest" ], "shadow-dom/leaktests/get-elements.html": [ - "2ce916a650ed3749e18b6fd1abe488a562b0faaf", + "40fa9b69314a9cd9f1eee777ce4120440d7801df", "testharness" ], "shadow-dom/leaktests/html-collection.html": [ @@ -643884,19 +644487,19 @@ "testharness" ], "svg/path/property/d-interpolation-discrete.svg": [ - "aa9087395fb5f00083630f859c0049247f71a530", + "5b20a589bb54e0ed985b91e11258e10ff44ef66c", "testharness" ], "svg/path/property/d-interpolation-relative-absolute.svg": [ - "65d2f3b2eb6e54253166a29754338b930267953d", + "09d4c70712f8f4cbb37e8dd6d075529500a68179", "testharness" ], "svg/path/property/d-interpolation-single.svg": [ - "25c523168a7a274511f490eac8831798c19f9798", + "107b607beca6056bf7fc21f0b0e954bb37da5c03", "testharness" ], "svg/path/property/getComputedStyle.svg": [ - "af30862781a59ad64e51264ccaac989856f5a8a7", + "5830191931fb4f7dd0d4e929333248b8d3019e79", "testharness" ], "svg/path/property/priority-ref.svg": [ @@ -644552,7 +645155,7 @@ "support" ], "tools/ci/ci_taskcluster.sh": [ - "546055293d750a66f713d3942582299a0063492f", + "901ae520c7fe932f9dacf6a5234034b130659ea0", "support" ], "tools/ci/ci_tools_unittest.sh": [ @@ -644564,7 +645167,7 @@ "support" ], "tools/ci/ci_wptrunner_infrastructure.sh": [ - "d6d6803974fb058e11aebb65f12752e4824a571d", + "c32c943870366223ca42cf76b11853946e847b6a", "support" ], "tools/ci/commands.json": [ @@ -649296,7 +649899,7 @@ "support" ], "tools/webdriver/webdriver/error.py": [ - "e148e8fe800700c0c0b96abb48444063c4af6572", + "23ffc40b31ffc97439ee02b240df5b47ca685b3d", "support" ], "tools/webdriver/webdriver/protocol.py": [ @@ -649312,7 +649915,7 @@ "support" ], "tools/wpt/browser.py": [ - "65752a25f12864ff70300c2016937d9dd7d7827c", + "7b943c2e73ccbb57f55304a167904efe089b4713", "support" ], "tools/wpt/commands.json": [ @@ -649336,7 +649939,7 @@ "support" ], "tools/wpt/run.py": [ - "036c38f25869bc22f84dfdb67178ccdbcd0bcc7b", + "a1e5637bf1dede2abc0d46814746281b0bbea35e", "support" ], "tools/wpt/testfiles.py": [ @@ -649372,7 +649975,7 @@ "support" ], "tools/wpt/wpt.py": [ - "f4eecce22cf915049f481049903a7c53a2a8eff7", + "55802461553abe63655a359393cfac2fbf174df1", "support" ], "tools/wptrunner/.gitignore": [ @@ -649592,11 +650195,11 @@ "support" ], "tools/wptrunner/wptrunner/browsers/__init__.py": [ - "d8682e16a551e5ecb409a5f2d3df444d1cab4b7c", + "08949f794834fd9e163a6b60bdcef6b9722316b5", "support" ], "tools/wptrunner/wptrunner/browsers/base.py": [ - "dc03ef711b6014e7f3d8a45ef7c9098890bb0505", + "70324bec31f23da78b1c5d04168d29778e0bf5bc", "support" ], "tools/wptrunner/wptrunner/browsers/chrome.py": [ @@ -649607,10 +650210,18 @@ "c96cf5634f3d76a79b4cfd20429f6622e496d6a0", "support" ], + "tools/wptrunner/wptrunner/browsers/chrome_webdriver.py": [ + "a63460f4544af67ccef3800ddfb64bc654868832", + "support" + ], "tools/wptrunner/wptrunner/browsers/edge.py": [ "ad2bb513a6a801b29a791a6d65b7b730b86e9a64", "support" ], + "tools/wptrunner/wptrunner/browsers/edge_webdriver.py": [ + "c2545de46f0b5def00c273ecfb5a57f0d4029531", + "support" + ], "tools/wptrunner/wptrunner/browsers/fennec.py": [ "db271acc50ea08e61efd09848a9ff78b53b8ed1e", "support" @@ -649631,6 +650242,10 @@ "670098ea22216b3558ec2d50fc6f190b0b2dfe97", "support" ], + "tools/wptrunner/wptrunner/browsers/safari_webdriver.py": [ + "12735c141b3ad82551730dcbfa865f5b83085409", + "support" + ], "tools/wptrunner/wptrunner/browsers/sauce.py": [ "02cc322aa35efb8db6c7a29ce5b95080f482124e", "support" @@ -649696,7 +650311,7 @@ "support" ], "tools/wptrunner/wptrunner/executors/executorselenium.py": [ - "d9b67968ddf66e044fce5b976b8e8d664c076889", + "0675461d5d8758260a02a20b40698255a7dcd048", "support" ], "tools/wptrunner/wptrunner/executors/executorservo.py": [ @@ -649707,6 +650322,10 @@ "d015e77b8c72b4f7d1dcc32f6d1c5613f90b959b", "support" ], + "tools/wptrunner/wptrunner/executors/executorwebdriver.py": [ + "127c909e810a26f5d16b268061981c63ee837bb6", + "support" + ], "tools/wptrunner/wptrunner/executors/executorwebkit.py": [ "c728ae18e03b09f6c690be82efc78bd0c2ff7347", "support" @@ -649784,7 +650403,7 @@ "support" ], "tools/wptrunner/wptrunner/stability.py": [ - "ed2a4ec39dd02a8e0f82943e997601786b8a0274", + "e684bf68076752d50b3271c1d4c74ef45aad4242", "support" ], "tools/wptrunner/wptrunner/testdriver-extra.js": [ @@ -649824,7 +650443,7 @@ "support" ], "tools/wptrunner/wptrunner/tests/base.py": [ - "b5173f3b513ea4f0a37db2ccdc0a948893c4fe45", + "84dc4f2e7f82ee2e3a2aa6f4d8bdda76b1581da1", "support" ], "tools/wptrunner/wptrunner/tests/browsers/__init__.py": [ @@ -649848,7 +650467,7 @@ "support" ], "tools/wptrunner/wptrunner/tests/test_stability.py": [ - "80c964455edc003b4c7dc001af6ebc9a29bb7c51", + "5a051b6c8998682e69d9c74bd4e5458986731b1f", "support" ], "tools/wptrunner/wptrunner/tests/test_testloader.py": [ @@ -649888,7 +650507,7 @@ "support" ], "tools/wptrunner/wptrunner/update/update.py": [ - "5685f840670cdb82d04e5c4a97985ac33fc87aa9", + "e5678be4f5467be2c542af5160b512a574fd7a36", "support" ], "tools/wptrunner/wptrunner/vcs.py": [ @@ -649900,7 +650519,7 @@ "support" ], "tools/wptrunner/wptrunner/wptcommandline.py": [ - "e6c624994d91a9c8f70a564d756e01bbcfaef406", + "0075ad9096201a04c5342ad92aab59ab8dcf434e", "support" ], "tools/wptrunner/wptrunner/wptlogging.py": [ @@ -652448,17 +653067,29 @@ "support" ], "wasm/jsapi/assertions.js": [ - "151a406655cb5094625122bdbd359d1ff91d8fbd", + "bda3ae7bc3c8dc5020a50c645b8dba2aaeb44591", "support" ], "wasm/jsapi/bad-imports.js": [ "f076baacca8b3e6addf49f6841874d11bfcfe5a2", "support" ], + "wasm/jsapi/constructor/compile.any.js": [ + "0139a18fda3f928dc0eed0bef86098dcbabf5979", + "testharness" + ], "wasm/jsapi/constructor/instantiate-bad-imports.any.js": [ "86700298dfae66de6f4d026baa29e6e3584320f7", "testharness" ], + "wasm/jsapi/constructor/instantiate.any.js": [ + "e90f21e28ebf478c7af7d40c8744fba9e5f48720", + "testharness" + ], + "wasm/jsapi/constructor/validate.any.js": [ + "70bd9f7022ad616c2d5e0be636f6935923e19173", + "testharness" + ], "wasm/jsapi/global/constructor.any.js": [ "7a45cc4191c55684cde187fc73fb9741d6f5c2c5", "testharness" @@ -652480,7 +653111,7 @@ "testharness" ], "wasm/jsapi/instance/constructor.any.js": [ - "61a8f53a014c192f28a0c25252cf3702561e7191", + "f9bd06ac8e95e0f4dc2ce96560529fad9bf2095b", "testharness" ], "wasm/jsapi/instance/exports.any.js": [ @@ -652732,7 +653363,7 @@ "testharness" ], "web-animations/animation-model/animation-types/property-list.js": [ - "8d02717835175c186e96779949af2f6d892125ca", + "e2f3adcd7affcdc382fb038eb4e9a5ca80d5b1ee", "support" ], "web-animations/animation-model/animation-types/property-types.js": [ @@ -653507,6 +654138,10 @@ "3ac9c05938c2cac600f548ee796aedc48d470e63", "testharness" ], + "webaudio/the-audio-api/the-audiobuffersourcenode-interface/buffer-resampling.html": [ + "c181ceb8e0fad83067e11ec8aefe70f79ccf071c", + "testharness" + ], "webaudio/the-audio-api/the-audiobuffersourcenode-interface/ctor-audiobuffersource.html": [ "c1c3203451e62587b1aa864e85c63617c36c2a3d", "testharness" @@ -661996,7 +662631,7 @@ "testharness" ], "xhr/abort-after-stop.htm": [ - "7c5060fa4c60978d6ef850b99153b78176e002b6", + "d28d046fa9896ca50a98efc39a4b70a05ae586ff", "testharness" ], "xhr/abort-after-timeout.htm": [ @@ -662420,13 +663055,17 @@ "testharness" ], "xhr/open-after-abort.htm": [ - "c9c6304422805fc3a137d0a05701af46e6884b5e", + "c9ef6e7ac94ec536d08fc021091f6facf7fb71b5", "testharness" ], "xhr/open-after-setrequestheader.htm": [ "ca1ae25946f0ef00074d7884cdbe28bf753bc2a2", "testharness" ], + "xhr/open-after-stop.window.js": [ + "e836a523f86e56e37fc83e5c357392581fb31d20", + "testharness" + ], "xhr/open-during-abort-event.htm": [ "22c3be9bc44c59fb297581bee3cac390d9a68b3d", "testharness" diff --git a/tests/wpt/metadata/css/CSS2/borders/groove-default.html.ini b/tests/wpt/metadata/css/CSS2/borders/groove-default.html.ini new file mode 100644 index 00000000000..4fad9155e45 --- /dev/null +++ b/tests/wpt/metadata/css/CSS2/borders/groove-default.html.ini @@ -0,0 +1,2 @@ +[groove-default.html] + expected: FAIL diff --git a/tests/wpt/metadata/css/CSS2/borders/ridge-default.html.ini b/tests/wpt/metadata/css/CSS2/borders/ridge-default.html.ini new file mode 100644 index 00000000000..706fdcd9585 --- /dev/null +++ b/tests/wpt/metadata/css/CSS2/borders/ridge-default.html.ini @@ -0,0 +1,2 @@ +[ridge-default.html] + expected: FAIL diff --git a/tests/wpt/metadata/css/css-animations/parsing/animation-timing-function-valid.html.ini b/tests/wpt/metadata/css/css-animations/parsing/animation-timing-function-valid.html.ini new file mode 100644 index 00000000000..5b628b31463 --- /dev/null +++ b/tests/wpt/metadata/css/css-animations/parsing/animation-timing-function-valid.html.ini @@ -0,0 +1,4 @@ +[animation-timing-function-valid.html] + [e.style['animation-timing-function'\] = "steps(2, end)" should set the property value] + expected: FAIL + diff --git a/tests/wpt/metadata/css/css-fonts/variations/at-font-face-descriptors.html.ini b/tests/wpt/metadata/css/css-fonts/variations/at-font-face-descriptors.html.ini index 9e3503f9bb5..2b3a4401d40 100644 --- a/tests/wpt/metadata/css/css-fonts/variations/at-font-face-descriptors.html.ini +++ b/tests/wpt/metadata/css/css-fonts/variations/at-font-face-descriptors.html.ini @@ -251,3 +251,9 @@ [font-stretch(valid): Negative calc expression (to be clamped): calc(50% - 50%*2)] expected: FAIL + [font-weight(valid): Valid calc expression with out-of-range value (should be clamped): calc(100.5*3 + 800)] + expected: FAIL + + [font-weight(valid): Out-of-range simple calc value (should be clamped): calc(1001)] + expected: FAIL + diff --git a/tests/wpt/metadata/css/css-paint-api/registered-property-type.https.html.ini b/tests/wpt/metadata/css/css-paint-api/registered-property-type.https.html.ini new file mode 100644 index 00000000000..f1625f98a22 --- /dev/null +++ b/tests/wpt/metadata/css/css-paint-api/registered-property-type.https.html.ini @@ -0,0 +1,2 @@ +[registered-property-type.https.html] + expected: FAIL diff --git a/tests/wpt/metadata/css/css-transitions/parsing/transition-timing-function-valid.html.ini b/tests/wpt/metadata/css/css-transitions/parsing/transition-timing-function-valid.html.ini new file mode 100644 index 00000000000..8ee362d5563 --- /dev/null +++ b/tests/wpt/metadata/css/css-transitions/parsing/transition-timing-function-valid.html.ini @@ -0,0 +1,4 @@ +[transition-timing-function-valid.html] + [e.style['transition-timing-function'\] = "steps(2, end)" should set the property value] + expected: FAIL + diff --git a/tests/wpt/metadata/css/css-transitions/properties-value-inherit-002.html.ini b/tests/wpt/metadata/css/css-transitions/properties-value-inherit-002.html.ini index 1bdd2d71581..d53af6b3960 100644 --- a/tests/wpt/metadata/css/css-transitions/properties-value-inherit-002.html.ini +++ b/tests/wpt/metadata/css/css-transitions/properties-value-inherit-002.html.ini @@ -23,9 +23,6 @@ [word-spacing length(mm) / values] expected: FAIL - [text-indent length(pc) / values] - expected: FAIL - [opacity number[0,1\](zero-to-one) / values] expected: FAIL @@ -95,9 +92,6 @@ [font-size length(in) / values] expected: FAIL - [text-indent length(ex) / values] - expected: FAIL - [font-size length(em) / values] expected: FAIL @@ -107,9 +101,6 @@ [vertical-align length(em) / values] expected: FAIL - [text-indent length(px) / values] - expected: FAIL - [clip rectangle(rectangle) / values] expected: FAIL @@ -257,9 +248,6 @@ [max-width length(px) / values] expected: FAIL - [text-indent length(mm) / values] - expected: FAIL - [font-size length(mm) / values] expected: FAIL @@ -284,9 +272,6 @@ [outline-offset length(in) / values] expected: FAIL - [word-spacing length(in) / values] - expected: FAIL - [outline-width length(pt) / values] expected: FAIL @@ -311,9 +296,6 @@ [word-spacing length(pt) / values] expected: FAIL - [text-indent length(cm) / values] - expected: FAIL - [border-right-width length(mm) / values] expected: FAIL @@ -326,9 +308,6 @@ [background-position length(ex) / events] expected: FAIL - [text-indent length(pt) / values] - expected: FAIL - [border-right-width length(pt) / values] expected: FAIL @@ -383,9 +362,6 @@ [outline-width length(pc) / values] expected: FAIL - [word-spacing percentage(%) / values] - expected: FAIL - [font-weight font-weight(numeric) / values] expected: FAIL @@ -401,12 +377,6 @@ [line-height percentage(%) / values] expected: FAIL - [text-indent length(in) / values] - expected: FAIL - - [text-indent length(em) / values] - expected: FAIL - [border-top-width length(pt) / values] expected: FAIL @@ -503,9 +473,39 @@ [min-width length(ex) / values] expected: FAIL + [text-indent length(pc) / values] + expected: FAIL + + [text-indent length(ex) / values] + expected: FAIL + + [text-indent length(px) / values] + expected: FAIL + + [text-indent length(mm) / values] + expected: FAIL + + [word-spacing length(in) / values] + expected: FAIL + + [text-indent length(cm) / values] + expected: FAIL + + [text-indent length(pt) / values] + expected: FAIL + [text-shadow shadow(shadow) / values] expected: FAIL + [word-spacing percentage(%) / values] + expected: FAIL + + [text-indent length(in) / values] + expected: FAIL + + [text-indent length(em) / values] + expected: FAIL + [text-indent percentage(%) / values] expected: FAIL diff --git a/tests/wpt/metadata/css/css-transitions/transitions-animatable-properties-01.html.ini b/tests/wpt/metadata/css/css-transitions/transitions-animatable-properties-01.html.ini index 7ccf6daaa75..39892257bb0 100644 --- a/tests/wpt/metadata/css/css-transitions/transitions-animatable-properties-01.html.ini +++ b/tests/wpt/metadata/css/css-transitions/transitions-animatable-properties-01.html.ini @@ -14,9 +14,6 @@ [word-spacing intermediate] expected: FAIL - [outline-width intermediate] - expected: FAIL - [vertical-align intermediate] expected: FAIL @@ -68,6 +65,12 @@ [left intermediate] expected: FAIL - [bottom intermediate] + [outline-width intermediate] + expected: FAIL + + [padding-right end] + expected: FAIL + + [border-top-width end] expected: FAIL diff --git a/tests/wpt/metadata/fetch/cross-origin-resource-policy/fetch-in-iframe.html.ini b/tests/wpt/metadata/fetch/cross-origin-resource-policy/fetch-in-iframe.html.ini index 0d630fb814a..3951cd266d5 100644 --- a/tests/wpt/metadata/fetch/cross-origin-resource-policy/fetch-in-iframe.html.ini +++ b/tests/wpt/metadata/fetch/cross-origin-resource-policy/fetch-in-iframe.html.ini @@ -1,5 +1,4 @@ [fetch-in-iframe.html] - expected: CRASH [Untitled] expected: FAIL diff --git a/tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_1.html.ini b/tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_1.html.ini new file mode 100644 index 00000000000..87b07c3e670 --- /dev/null +++ b/tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_1.html.ini @@ -0,0 +1,4 @@ +[traverse_the_history_1.html] + [Multiple history traversals from the same task] + expected: FAIL + diff --git a/tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_2.html.ini b/tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_2.html.ini new file mode 100644 index 00000000000..75d75b4cda2 --- /dev/null +++ b/tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_2.html.ini @@ -0,0 +1,4 @@ +[traverse_the_history_2.html] + [Multiple history traversals, last would be aborted] + expected: FAIL + diff --git a/tests/wpt/metadata/html/interaction/focus/composed.window.js.ini b/tests/wpt/metadata/html/interaction/focus/composed.window.js.ini new file mode 100644 index 00000000000..3700bdbc7dd --- /dev/null +++ b/tests/wpt/metadata/html/interaction/focus/composed.window.js.ini @@ -0,0 +1,4 @@ +[composed.window.html] + [Focus events are composed] + expected: FAIL + diff --git a/tests/wpt/metadata/html/interaction/focus/document-level-focus-apis/document-level-apis.html.ini b/tests/wpt/metadata/html/interaction/focus/document-level-focus-apis/document-level-apis.html.ini new file mode 100644 index 00000000000..81f3ef81927 --- /dev/null +++ b/tests/wpt/metadata/html/interaction/focus/document-level-focus-apis/document-level-apis.html.ini @@ -0,0 +1,4 @@ +[document-level-apis.html] + [When a child browsing context is focused, its browsing context container is also focused] + expected: FAIL + diff --git a/tests/wpt/metadata/html/interaction/focus/processing-model/focus-fixup-rule-one-no-dialogs.html.ini b/tests/wpt/metadata/html/interaction/focus/processing-model/focus-fixup-rule-one-no-dialogs.html.ini new file mode 100644 index 00000000000..19b1435fd03 --- /dev/null +++ b/tests/wpt/metadata/html/interaction/focus/processing-model/focus-fixup-rule-one-no-dialogs.html.ini @@ -0,0 +1,22 @@ +[focus-fixup-rule-one-no-dialogs.html] + [Disabling contenteditable] + expected: FAIL + + [Hiding the active element] + expected: FAIL + + [Disabling the active element (making it expressly inert)] + expected: FAIL + + [Changing the first legend element in disabled <fieldset>] + expected: FAIL + + [Disabling <fieldset> affects its descendants] + expected: FAIL + + [Removing the tabindex attribute from a div] + expected: FAIL + + [Removing the active element from the DOM] + expected: FAIL + diff --git a/tests/wpt/metadata/html/interaction/focus/processing-model/preventScroll.html.ini b/tests/wpt/metadata/html/interaction/focus/processing-model/preventScroll.html.ini new file mode 100644 index 00000000000..177bed89beb --- /dev/null +++ b/tests/wpt/metadata/html/interaction/focus/processing-model/preventScroll.html.ini @@ -0,0 +1,19 @@ +[preventScroll.html] + [Sanity test] + expected: FAIL + + [elm.focus({preventScroll: false})] + expected: FAIL + + [elm.focus(null)] + expected: FAIL + + [elm.focus(undefined)] + expected: FAIL + + [elm.focus({})] + expected: FAIL + + [elm.focus() without arguments] + expected: FAIL + diff --git a/tests/wpt/metadata/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-default-value.html.ini b/tests/wpt/metadata/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-default-value.html.ini new file mode 100644 index 00000000000..1d9a4456142 --- /dev/null +++ b/tests/wpt/metadata/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-default-value.html.ini @@ -0,0 +1,7 @@ +[focus-tabindex-default-value.html] + [The default value of tabIndex attribute must be 0 for elements that are focusable] + expected: FAIL + + [The default value of tabIndex attribute must be -1 for elements that are not focusable] + expected: FAIL + diff --git a/tests/wpt/metadata/html/interaction/focus/tabindex-focus-flag.html.ini b/tests/wpt/metadata/html/interaction/focus/tabindex-focus-flag.html.ini new file mode 100644 index 00000000000..5af0d13df14 --- /dev/null +++ b/tests/wpt/metadata/html/interaction/focus/tabindex-focus-flag.html.ini @@ -0,0 +1,13 @@ +[tabindex-focus-flag.html] + [a should not be focusable by default.] + expected: FAIL + + [#summary-first should be focusable by default.] + expected: FAIL + + [input[type="hidden"\] should not be focusable by default.] + expected: FAIL + + [[contenteditable\] should be focusable by default.] + expected: FAIL + diff --git a/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/script-onerror-insertion-point-2.html.ini b/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/script-onerror-insertion-point-2.html.ini new file mode 100644 index 00000000000..178680e5d14 --- /dev/null +++ b/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/script-onerror-insertion-point-2.html.ini @@ -0,0 +1,2 @@ +[script-onerror-insertion-point-2.html] + expected: TIMEOUT diff --git a/tests/wpt/metadata/url/urlencoded-parser.any.js.ini b/tests/wpt/metadata/url/urlencoded-parser.any.js.ini index e6444e2e79d..e3e13ec3d62 100644 --- a/tests/wpt/metadata/url/urlencoded-parser.any.js.ini +++ b/tests/wpt/metadata/url/urlencoded-parser.any.js.ini @@ -2,13 +2,10 @@ [request.formData() with input: a&b&c] expected: FAIL - [response.formData() with input: _charset_=windows-1252&test=%C2x] - expected: FAIL - - [request.formData() with input: a=b&c=d&] + [response.formData() with input: a&b&c] expected: FAIL - [request.formData() with input: a=b&c=d] + [response.formData() with input: a=b&c=d] expected: FAIL @@ -16,21 +13,15 @@ [response.formData() with input: a&b&c] expected: FAIL - [request.formData() with input: a&b&c] - expected: FAIL - - [request.formData() with input: &&&a=b&&&&c=d&] - expected: FAIL - - [response.formData() with input: a=b&c=d&] + [request.formData() with input: _charset_=windows-1252&test=%C2x] expected: FAIL - [request.formData() with input: a=b&c=d] + [response.formData() with input: &&&a=b&&&&c=d&] expected: FAIL - [request.formData() with input: _charset_=windows-1252&test=%C2x] + [response.formData() with input: a=b&c=d] expected: FAIL - [response.formData() with input: _charset_=windows-1252&test=%C2x] + [request.formData() with input: a=b&c=d&] expected: FAIL diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/buffer-resampling.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/buffer-resampling.html.ini new file mode 100644 index 00000000000..331dfa600d8 --- /dev/null +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/buffer-resampling.html.ini @@ -0,0 +1,13 @@ +[buffer-resampling.html] + [< [interpolate\] 2 out of 2 assertions were failed.] + expected: FAIL + + [# AUDIT TASK RUNNER FINISHED: 1 out of 1 tasks were failed.] + expected: FAIL + + [X SNR (0.000 dB) is not greater than or equal to 37.17. Got 0.] + expected: FAIL + + [X Interpolated sine wave does not equal [0,0.05756402388215065,0.11493714898824692,0.17192909121513367,0.22835086286067963,0.28401535749435425,0.3387379050254822,0.3923371136188507,0.44463518261909485,0.4954586327075958,0.5446390509605408,0.5920131802558899,0.6374239921569824,0.680720865726471,0.7217602133750916,0.760405957698822...\] with an element-wise tolerance of {"absoluteThreshold":0.090348,"relativeThreshold":0}.\n\tIndex\tActual\t\t\tExpected\t\tAbsError\t\tRelError\t\tTest threshold\n\t[2\]\t0.0000000000000000e+0\t1.1493714898824692e-1\t1.1493714898824692e-1\t1.0000000000000000e+0\t9.0347999999999998e-2\n\t[3\]\t0.0000000000000000e+0\t1.7192909121513367e-1\t1.7192909121513367e-1\t1.0000000000000000e+0\t9.0347999999999998e-2\n\t[4\]\t0.0000000000000000e+0\t2.2835086286067963e-1\t2.2835086286067963e-1\t1.0000000000000000e+0\t9.0347999999999998e-2\n\t[5\]\t0.0000000000000000e+0\t2.8401535749435425e-1\t2.8401535749435425e-1\t1.0000000000000000e+0\t9.0347999999999998e-2\n\t[6\]\t0.0000000000000000e+0\t3.3873790502548218e-1\t3.3873790502548218e-1\t1.0000000000000000e+0\t9.0347999999999998e-2\n\t...and 476 more errors.\n\tMax AbsError of 1.0000000000000000e+0 at index of 300.\n\t[300\]\t0.0000000000000000e+0\t-1.0000000000000000e+0\t1.0000000000000000e+0\t1.0000000000000000e+0\t9.0347999999999998e-2\n\tMax RelError of 1.0000000000000000e+0 at index of 2.\n] + expected: FAIL + diff --git a/tests/wpt/metadata/workers/semantics/multiple-workers/005.html.ini b/tests/wpt/metadata/workers/semantics/multiple-workers/005.html.ini index f806a845a2a..9d72f08e38e 100644 --- a/tests/wpt/metadata/workers/semantics/multiple-workers/005.html.ini +++ b/tests/wpt/metadata/workers/semantics/multiple-workers/005.html.ini @@ -1,6 +1,5 @@ [005.html] type: testharness - expected: ERROR [dedicated worker in shared worker in dedicated worker] expected: FAIL diff --git a/tests/wpt/web-platform-tests/css/CSS2/borders/groove-default.html b/tests/wpt/web-platform-tests/css/CSS2/borders/groove-default.html new file mode 100644 index 00000000000..c9028b9a2f4 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/CSS2/borders/groove-default.html @@ -0,0 +1,15 @@ +<!doctype html> +<title>CSS Test: Groove border with default color should actually show a groove border</title> +<link rel="help" href="https://drafts.csswg.org/css2/box.html#border-style-properties"> +<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1488294"> +<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez"> +<link rel="author" href="https://www.mozilla.org" title="Mozilla"> +<link rel="mismatch" href="groove-ridge-default-notref.html"> +<style> + div { + width: 100px; + height: 100px; + border: 10px groove; + } +</style> +<div></div> diff --git a/tests/wpt/web-platform-tests/css/CSS2/borders/groove-ridge-default-notref.html b/tests/wpt/web-platform-tests/css/CSS2/borders/groove-ridge-default-notref.html new file mode 100644 index 00000000000..5ead6432ccd --- /dev/null +++ b/tests/wpt/web-platform-tests/css/CSS2/borders/groove-ridge-default-notref.html @@ -0,0 +1,12 @@ +<!doctype html> +<title>CSS Test Reference</title> +<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez"> +<link rel="author" href="https://www.mozilla.org" title="Mozilla"> +<style> + div { + width: 100px; + height: 100px; + border: 10px solid; + } +</style> +<div></div> diff --git a/tests/wpt/web-platform-tests/css/CSS2/borders/ridge-default.html b/tests/wpt/web-platform-tests/css/CSS2/borders/ridge-default.html new file mode 100644 index 00000000000..4bd0bdf3aef --- /dev/null +++ b/tests/wpt/web-platform-tests/css/CSS2/borders/ridge-default.html @@ -0,0 +1,15 @@ +<!doctype html> +<title>CSS Test: ridge border with default color should actually show a ridge border</title> +<link rel="help" href="https://drafts.csswg.org/css2/box.html#border-style-properties"> +<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1488294"> +<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez"> +<link rel="author" href="https://www.mozilla.org" title="Mozilla"> +<link rel="mismatch" href="groove-ridge-default-notref.html"> +<style> + div { + width: 100px; + height: 100px; + border: 10px ridge; + } +</style> +<div></div> diff --git a/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-delay-invalid.html b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-delay-invalid.html new file mode 100644 index 00000000000..a58d2cd11bc --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-delay-invalid.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Animations: parsing animation-delay with invalid values</title> +<link rel="help" href="https://drafts.csswg.org/css-animations/#propdef-animation-delay"> +<meta name="assert" content="animation-delay supports only the grammar '<single-animation-play-state> #'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_invalid_value("animation-delay", "infinite"); +test_invalid_value("animation-delay", "0"); +test_invalid_value("animation-delay", "1s 2s"); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-delay-valid.html b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-delay-valid.html new file mode 100644 index 00000000000..5ff0416cc64 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-delay-valid.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Animations: parsing animation-delay with valid values</title> +<link rel="help" href="https://drafts.csswg.org/css-animations/#propdef-animation-delay"> +<meta name="assert" content="animation-delay supports the full grammar '<single-animation-play-state> #'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_valid_value("animation-delay", "-5ms"); +test_valid_value("animation-delay", "0s"); +test_valid_value("animation-delay", "10s"); +test_valid_value("animation-delay", "20s, 10s"); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-direction-invalid.html b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-direction-invalid.html new file mode 100644 index 00000000000..0b48d97f0a1 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-direction-invalid.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Animations: parsing animation-direction with invalid values</title> +<link rel="help" href="https://drafts.csswg.org/css-animations/#propdef-animation-direction"> +<meta name="assert" content="animation-direction supports only the grammar '<single-animation-direction> #'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_invalid_value("animation-direction", "auto"); +test_invalid_value("animation-direction", "normal reverse"); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-direction-valid.html b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-direction-valid.html new file mode 100644 index 00000000000..bcc9acc3428 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-direction-valid.html @@ -0,0 +1,21 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Animations: parsing animation-direction with valid values</title> +<link rel="help" href="https://drafts.csswg.org/css-animations/#propdef-animation-direction"> +<meta name="assert" content="animation-direction supports the full grammar '<single-animation-direction> #'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_valid_value("animation-direction", "normal"); +test_valid_value("animation-direction", "reverse"); +test_valid_value("animation-direction", "alternate"); +test_valid_value("animation-direction", "alternate-reverse"); +test_valid_value("animation-direction", "normal, reverse, alternate, alternate-reverse"); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-duration-invalid.html b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-duration-invalid.html new file mode 100644 index 00000000000..5edacd3735e --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-duration-invalid.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Animations: parsing animation-duration with invalid values</title> +<link rel="help" href="https://drafts.csswg.org/css-animations/#propdef-animation-duration"> +<meta name="assert" content="animation-duration supports only the grammar '<time> #'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_invalid_value("animation-duration", '-3s'); +test_invalid_value("animation-duration", '0'); +test_invalid_value("animation-duration", 'infinite'); +test_invalid_value("animation-duration", '1s 2s'); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-duration-valid.html b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-duration-valid.html new file mode 100644 index 00000000000..e65a1a70724 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-duration-valid.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Animations: parsing animation-duration with valid values</title> +<link rel="help" href="https://drafts.csswg.org/css-animations/#propdef-animation-duration"> +<meta name="assert" content="animation-duration supports the full grammar '<time> #'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_valid_value("animation-duration", '3s'); +test_valid_value("animation-duration", '500ms'); +test_valid_value("animation-duration", '1s, 2s, 3s'); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-fill-mode-invalid.html b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-fill-mode-invalid.html new file mode 100644 index 00000000000..dda2221f474 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-fill-mode-invalid.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Animations: parsing animation-fill-mode with invalid values</title> +<link rel="help" href="https://drafts.csswg.org/css-animations/#propdef-animation-fill-mode"> +<meta name="assert" content="animation-fill-mode supports only the grammar '<single-animation-fill-mode> #'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_invalid_value("animation-fill-mode", "auto"); +test_invalid_value("animation-fill-mode", "forwards backwards"); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-fill-mode-valid.html b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-fill-mode-valid.html new file mode 100644 index 00000000000..1f73a821d15 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-fill-mode-valid.html @@ -0,0 +1,21 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Animations: parsing animation-fill-mode with valid values</title> +<link rel="help" href="https://drafts.csswg.org/css-animations/#propdef-animation-fill-mode"> +<meta name="assert" content="animation-fill-mode supports the full grammar '<single-animation-fill-mode> #'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_valid_value("animation-fill-mode", "none"); +test_valid_value("animation-fill-mode", "forwards"); +test_valid_value("animation-fill-mode", "backwards"); +test_valid_value("animation-fill-mode", "both"); +test_valid_value("animation-fill-mode", "none, forwards, backwards, both"); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-iteration-count-invalid.html b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-iteration-count-invalid.html new file mode 100644 index 00000000000..ff1e8e23a08 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-iteration-count-invalid.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Animations: parsing animation-iteration-count with invalid values</title> +<link rel="help" href="https://drafts.csswg.org/css-animations/#propdef-animation-iteration-count"> +<meta name="assert" content="animation-iteration-count supports only the grammar '<single-animation-iteration-count> #'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_invalid_value("animation-iteration-count", "auto"); +test_invalid_value("animation-iteration-count", "-2"); +test_invalid_value("animation-iteration-count", "3 4"); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-iteration-count-valid.html b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-iteration-count-valid.html new file mode 100644 index 00000000000..be8a8379890 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-iteration-count-valid.html @@ -0,0 +1,22 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Animations: parsing animation-iteration-count with valid values</title> +<link rel="help" href="https://drafts.csswg.org/css-animations/#propdef-animation-iteration-count"> +<meta name="assert" content="animation-iteration-count supports the full grammar '<single-animation-iteration-count> #'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_valid_value("animation-iteration-count", "0"); +test_valid_value("animation-iteration-count", "3"); +test_valid_value("animation-iteration-count", "4.5"); +test_valid_value("animation-iteration-count", "infinite"); + +test_valid_value("animation-iteration-count", "0, infinite, 3"); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-name-invalid.html b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-name-invalid.html new file mode 100644 index 00000000000..77d53f990b1 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-name-invalid.html @@ -0,0 +1,23 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Animations: parsing animation-name with invalid values</title> +<link rel="help" href="https://drafts.csswg.org/css-animations/#propdef-animation-name"> +<meta name="assert" content="animation-name supports only the grammar '[ none | <keyframes-name> ]#'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_invalid_value("animation-name", '12'); +test_invalid_value("animation-name", 'one two'); + +test_invalid_value("animation-name", 'one, initial'); +test_invalid_value("animation-name", 'one, inherit'); +test_invalid_value("animation-name", 'one, unset'); +test_invalid_value("animation-name", 'default, two'); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-name-valid.html b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-name-valid.html new file mode 100644 index 00000000000..9ed73d4d15f --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-name-valid.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Animations: parsing animation-name with valid values</title> +<link rel="help" href="https://drafts.csswg.org/css-animations/#propdef-animation-name"> +<meta name="assert" content="animation-name supports the full grammar '[ none | <keyframes-name> ]#'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_valid_value("animation-name", 'NONE', 'none'); + +test_valid_value("animation-name", 'foo'); +test_valid_value("animation-name", 'Both'); +test_valid_value("animation-name", 'ease-in'); +test_valid_value("animation-name", 'infinite'); +test_valid_value("animation-name", 'paused'); +test_valid_value("animation-name", 'first, second, third'); + +test_valid_value("animation-name", '"string"'); +test_valid_value("animation-name", '"multi word string"'); +test_valid_value("animation-name", '"initial"'); +test_valid_value("animation-name", '"---\\22---"', '\"---\\\"---\"'); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-play-state-invalid.html b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-play-state-invalid.html new file mode 100644 index 00000000000..f47a2f75ddf --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-play-state-invalid.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Animations: parsing animation-play-state with invalid values</title> +<link rel="help" href="https://drafts.csswg.org/css-animations/#propdef-animation-play-state"> +<meta name="assert" content="animation-play-state supports only the grammar '<single-animation-play-state> #'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_invalid_value("animation-play-state", "auto"); +test_invalid_value("animation-play-state", "paused running"); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-play-state-valid.html b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-play-state-valid.html new file mode 100644 index 00000000000..ce6d053ec27 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-play-state-valid.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Animations: parsing animation-play-state with valid values</title> +<link rel="help" href="https://drafts.csswg.org/css-animations/#propdef-animation-play-state"> +<meta name="assert" content="animation-play-state supports the full grammar '<single-animation-play-state> #'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_valid_value("animation-play-state", "running"); +test_valid_value("animation-play-state", "paused"); +test_valid_value("animation-play-state", "running, paused"); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-timing-function-invalid.html b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-timing-function-invalid.html new file mode 100644 index 00000000000..adc1cc10e39 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-timing-function-invalid.html @@ -0,0 +1,23 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Animations: parsing animation-timing-function with invalid values</title> +<link rel="help" href="https://drafts.csswg.org/css-animations/#propdef-animation-timing-function"> +<meta name="assert" content="animation-timing-function supports only the grammar '<timing-function> #'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_invalid_value("animation-timing-function", "auto"); +test_invalid_value("animation-timing-function", "ease-in ease-out"); +test_invalid_value("animation-timing-function", "cubic-bezier(1, 2, 3)"); +test_invalid_value("animation-timing-function", "cubic-bezier(1, 2, 3, infinite)"); +test_invalid_value("animation-timing-function", "cubic-bezier(1, 2, 3, 4, 5)"); +test_invalid_value("animation-timing-function", "cubic-bezier(-0.1, 0.1, 0.5, 0.9)"); +test_invalid_value("animation-timing-function", "cubic-bezier(0.5, 0.1, 1.1, 0.9)"); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-timing-function-valid.html b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-timing-function-valid.html new file mode 100644 index 00000000000..63e2805485b --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-animations/parsing/animation-timing-function-valid.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Animations: parsing animation-timing-function with valid values</title> +<link rel="help" href="https://drafts.csswg.org/css-animations/#propdef-animation-timing-function"> +<meta name="assert" content="animation-timing-function supports the full grammar '<timing-function> #'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_valid_value("animation-timing-function", "linear"); + +test_valid_value("animation-timing-function", "ease"); +test_valid_value("animation-timing-function", "ease-in"); +test_valid_value("animation-timing-function", "ease-out"); +test_valid_value("animation-timing-function", "ease-in-out"); +test_valid_value("animation-timing-function", "cubic-bezier(0.1, 0.2, 0.8, 0.9)"); +test_valid_value("animation-timing-function", "cubic-bezier(0, -2, 1, 3)"); +test_valid_value("animation-timing-function", "cubic-bezier(0, 0.7, 1, 1.3)"); + + +test_valid_value("animation-timing-function", "steps(4, start)"); +test_valid_value("animation-timing-function", "steps(2, end)"); + +test_valid_value("animation-timing-function", "linear, ease, linear"); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-contain/contain-animation-001.html b/tests/wpt/web-platform-tests/css/css-contain/contain-animation-001.html new file mode 100644 index 00000000000..449221428c3 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-contain/contain-animation-001.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Containment Test: contain is not animatable</title> +<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/"> +<link rel="help" href="https://drafts.csswg.org/css-contain/#contain-property"> +<link rel="match" href="../reference/ref-filled-green-100px-square.xht"> +<meta name=assert content="the contain property is not animatable"> +<style> +div { + border: 50px solid green; + background: red; + position: absolute; /* for shrinkwrap */ + contain: strict; + + animation-duration: 1s; + animation-name: bad; + animation-play-state: paused; + + font-size: 100px; +} + +@keyframes bad { + from { + contain: none; + } +} +</style> + +<p>Test passes if there is a filled green square and <strong>no red</strong>.</p> +<div> </div> + diff --git a/tests/wpt/web-platform-tests/css/css-contain/contain-layout-baseline-001.html b/tests/wpt/web-platform-tests/css/css-contain/contain-layout-baseline-001.html new file mode 100644 index 00000000000..ed2471a6261 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-contain/contain-layout-baseline-001.html @@ -0,0 +1,31 @@ +<!doctype html> +<html lang=en> + <meta charset=utf-8> + <title>CSS-contain test: layout containment and baselines</title> + <link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net"> + <meta name=assert content="With contain:layout, for the purpose of the vertical-align property, the containing element is treated as having no baseline."> + <link rel="match" href="../reference/ref-filled-green-100px-square.xht"> + <link rel=help href="https://drafts.csswg.org/css-contain-1/#containment-layout"> + <meta name="flags" content=""> + +<style> +#red { + position: absolute; + background: red; + width: 100px; + height: 100px; + z-index: -1; +} +.green { + display: inline-block; + height: 100px; + background: green; + width: 50px; + contain: layout; + color: transparent; +} +</style> + +<p>Test passes if there is a filled green square and <strong>no red</strong>.</p> +<div id=red></div> +<div class=green></div><div class=green>a</div> diff --git a/tests/wpt/web-platform-tests/css/css-contain/contain-paint-baseline-001.html b/tests/wpt/web-platform-tests/css/css-contain/contain-paint-baseline-001.html new file mode 100644 index 00000000000..3f84a3003a2 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-contain/contain-paint-baseline-001.html @@ -0,0 +1,24 @@ +<!doctype html> +<html lang=en> + <meta charset=utf-8> + <title>CSS-contain test: paint containment and baselines</title> + <link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net"> + <meta name=assert content="contain:paint does not suppress baseline alignment"> + <link rel="match" href="reference/contain-baseline-ref.html"> + <link rel=help href="https://drafts.csswg.org/css-contain-1/#containment-paint"> + <meta name="flags" content=""> + +<style> +div { + display: inline-block; + height: 5px; + background: blue; + width: 50px; + contain: paint; + color: transparent; + font-size: 100px; +} +</style> + +<p>Test passes if there are two, not one, blue lines below.</p> +<div></div><div>a</div> diff --git a/tests/wpt/web-platform-tests/css/css-contain/contain-size-baseline-001.html b/tests/wpt/web-platform-tests/css/css-contain/contain-size-baseline-001.html new file mode 100644 index 00000000000..0ffed1b3b6a --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-contain/contain-size-baseline-001.html @@ -0,0 +1,24 @@ +<!doctype html> +<html lang=en> + <meta charset=utf-8> + <title>CSS-contain test: size containment and baselines</title> + <link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net"> + <meta name=assert content="contain:size does not suppress baseline alignment"> + <link rel="match" href="reference/contain-baseline-ref.html"> + <link rel=help href="https://drafts.csswg.org/css-contain-1/#containment-size"> + <meta name="flags" content=""> + +<style> +div { + display: inline-block; + height: 5px; + background: blue; + width: 50px; + contain: size; + color: transparent; + font-size: 100px; +} +</style> + +<p>Test passes if there are two, not one, blue lines below.</p> +<div></div><div>a</div> diff --git a/tests/wpt/web-platform-tests/css/css-contain/contain-style-baseline-001.html b/tests/wpt/web-platform-tests/css/css-contain/contain-style-baseline-001.html new file mode 100644 index 00000000000..f05d2098283 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-contain/contain-style-baseline-001.html @@ -0,0 +1,24 @@ +<!doctype html> +<html lang=en> + <meta charset=utf-8> + <title>CSS-contain test: style containment and baselines</title> + <link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net"> + <meta name=assert content="contain:style does not suppress baseline alignment"> + <link rel="match" href="reference/contain-baseline-ref.html"> + <link rel=help href="https://drafts.csswg.org/css-contain-1/#containment-style"> + <meta name="flags" content=""> + +<style> +div { + display: inline-block; + height: 5px; + background: blue; + width: 50px; + contain: style; + color: transparent; + font-size: 100px; +} +</style> + +<p>Test passes if there are two, not one, blue lines below.</p> +<div></div><div>a</div> diff --git a/tests/wpt/web-platform-tests/css/css-contain/reference/contain-baseline-ref.html b/tests/wpt/web-platform-tests/css/css-contain/reference/contain-baseline-ref.html new file mode 100644 index 00000000000..1fdecb1c331 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-contain/reference/contain-baseline-ref.html @@ -0,0 +1,18 @@ +<!doctype html> +<html lang=en> +<meta charset=utf-8> +<title>CSS test reference</title> +<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net"> +<style> +div { + display: inline-block; + height: 5px; + background: blue; + width: 50px; + color: transparent; + font-size: 100px; +} +</style> + +<p>Test passes if there are two, not one, blue lines below.</p> +<div></div><div>a</div> diff --git a/tests/wpt/web-platform-tests/css/css-fonts/variations/at-font-face-descriptors.html b/tests/wpt/web-platform-tests/css/css-fonts/variations/at-font-face-descriptors.html index ece5b4be9b9..942686c4a1f 100644 --- a/tests/wpt/web-platform-tests/css/css-fonts/variations/at-font-face-descriptors.html +++ b/tests/wpt/web-platform-tests/css/css-fonts/variations/at-font-face-descriptors.html @@ -75,9 +75,9 @@ // Single value, calc { value: "calc(100.5)", isValid: true, expectedValue: "100.5", description: "Simple calc value" }, - { value: "calc(1001)", isValid: false, description: "Out-of-range simple calc value" }, + { value: "calc(1001)", isValid: true, description: "Out-of-range simple calc value (should be clamped)" }, { value: "calc(100.5*3 + 50.5)", isValid: true, expectedValue: "352", description: "Valid calc expression" }, - { value: "calc(100.5*3 + 800)", isValid: false, description: "Valid calc expression with out-of-range value" }, + { value: "calc(100.5*3 + 800)", isValid: true, description: "Valid calc expression with out-of-range value (should be clamped)" }, { value: "calc(100.5px + 50.5px)", isValid: false, description: "Valid calc expression with units" }, // Value range diff --git a/tests/wpt/web-platform-tests/css/css-masking/mask-image/mask-image-url-remote-mask.html b/tests/wpt/web-platform-tests/css/css-masking/mask-image/mask-image-url-remote-mask.html index cfa3a6166cd..f3f2eefaa92 100644 --- a/tests/wpt/web-platform-tests/css/css-masking/mask-image/mask-image-url-remote-mask.html +++ b/tests/wpt/web-platform-tests/css/css-masking/mask-image/mask-image-url-remote-mask.html @@ -26,8 +26,3 @@ </style> <p>The test passes if there is a green square and no red below.</p> <div id="back"></div><div id="front"></div> -<svg> - <!-- mask-image doesn't block onload, so we use an empty g here to - force mask.svg to load before onload. --> - <use href="support/mask.svg#empty"/> -</svg> diff --git a/tests/wpt/web-platform-tests/css/css-masking/mask-image/support/mask.svg b/tests/wpt/web-platform-tests/css/css-masking/mask-image/support/mask.svg index 30e601c87c3..cab55923d32 100644 --- a/tests/wpt/web-platform-tests/css/css-masking/mask-image/support/mask.svg +++ b/tests/wpt/web-platform-tests/css/css-masking/mask-image/support/mask.svg @@ -2,5 +2,4 @@ <mask id="mask"> <rect x="50" y="50" width="100" height="100" fill="white"/> </mask> - <g id="empty"/> </svg> diff --git a/tests/wpt/web-platform-tests/css/css-paint-api/registered-properties-in-custom-paint.https.html b/tests/wpt/web-platform-tests/css/css-paint-api/registered-properties-in-custom-paint.https.html deleted file mode 100644 index d9a63da144d..00000000000 --- a/tests/wpt/web-platform-tests/css/css-paint-api/registered-properties-in-custom-paint.https.html +++ /dev/null @@ -1,67 +0,0 @@ -<!DOCTYPE html> -<html class="reftest-wait"> -<link rel="match" href="parse-input-arguments-ref.html"> -<style> -.container { - width: 100px; - height: 100px; - --length: 10px; - --number: 10; -} - -#canvas-geometry { - background-image: paint(geometry); -} -</style> -<script src="/common/reftest-wait.js"></script> -<script src="/common/worklet-reftest.js"></script> -<body> -<div id="canvas-geometry" class="container"></div> - -<script id="code" type="text/worklet"> -registerPaint('geometry', class { - static get inputProperties() { - return [ - '--length', - '--length-initial', - '--number', - ]; - } - paint(ctx, geom, styleMap) { - const properties = [...styleMap.keys()].sort(); - var serializedStrings = []; - for (let i = 0; i < properties.length; i++) { - const value = styleMap.get(properties[i]); - let serialized; - if (value) - serialized = properties[i].toString() + ': [' + value.constructor.name + '=' + value.toString() + ']'; - else - serialized = properties[i].toString() + ': [null]'; - serializedStrings.push(serialized); - } - ctx.strokeStyle = 'green'; - if (serializedStrings[0] != "--length: [CSSUnitValue=10px]") - ctx.strokeStyle = 'red'; - if (serializedStrings[1] != "--length-initial: [CSSUnitValue=20px]") - ctx.strokeStyle = 'blue'; - if (serializedStrings[2] != "--number: [CSSUnitValue=10]") - ctx.strokeStyle = 'yellow'; - ctx.lineWidth = 4; - ctx.strokeRect(0, 0, geom.width, geom.height); - } -}); -</script> - -<script> - try { - CSS.registerProperty({name: '--length', syntax: '<length>', initialValue: '0px', inherits: false}); - CSS.registerProperty({name: '--length-initial', syntax: '<length>', initialValue: '20px', inherits: false}); - CSS.registerProperty({name: '--number', syntax: '<number>', initialValue: '0', inherits: false}); - importWorkletAndTerminateTestAfterAsyncPaint(CSS.paintWorklet, document.getElementById('code').textContent); - } catch(e) { - document.body.textContent = e; - takeScreenshot(); - } -</script> -</body> -</html> diff --git a/tests/wpt/web-platform-tests/css/css-paint-api/registered-property-type.https.html b/tests/wpt/web-platform-tests/css/css-paint-api/registered-property-type.https.html new file mode 100644 index 00000000000..6ff7ce4e0af --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-paint-api/registered-property-type.https.html @@ -0,0 +1,148 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<link rel="help" href="https://www.w3.org/TR/css-paint-api-1/#examples"> +<link rel="match" href="parse-input-arguments-ref.html"> +<style> +.container { + width: 100px; + height: 100px; +} + +#canvas-geometry { + background-image: paint(geometry); +} +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/worklet-reftest.js"></script> +<body> +<div id="canvas-geometry" class="container"></div> +<script id="code" type="text/worklet"> + // Globals that must be prepended to this script: + // - debugLog: A function that logs errors. + // - props: Test data. + + registerPaint('geometry', class { + static get inputProperties() { return props.map(p => p.name); } + + paint(ctx, geom, styleMap) { + ctx.strokeStyle = 'green'; + for (let prop of props) { + let first = styleMap.get(prop.name); + let all = styleMap.getAll(prop.name); + let serialize = v => v.constructor.name + '=' + v.toString() + let actual = all.map(serialize).join(','); + let expected = prop.expected.join(','); + let pass = actual === expected + && serialize(first) === prop.expected[0]; + if (!pass) + ctx.strokeStyle = 'red'; + debugLog(pass ? 'PASS' : 'FAIL', prop.syntax, actual, expected); + } + ctx.lineWidth = 4; + ctx.strokeRect(0, 0, geom.width, geom.height); + } + }); +</script> +<script> + // A copy of this array (automatically enriched with 'name' and 'expected') + // is also available in the worklet. + let props = [ + // Initial values. + { syntax: '*', initialValue: 'if(){}' }, + { syntax: '<angle>', initialValue: '42deg' }, + { syntax: '<color>', initialValue: '#fefefe' }, + { syntax: '<custom-ident>', initialValue: 'none' }, + { syntax: '<image>', initialValue: 'linear-gradient(red, red)' }, + { syntax: '<image>', initialValue: 'url(http://a.com/a)' }, + { syntax: '<integer>', initialValue: '42' }, + { syntax: '<length-percentage>', initialValue: '10%' }, + { syntax: '<length-percentage>', initialValue: '10px' }, + { syntax: '<length-percentage>', initialValue: 'calc(10px + 10%)' }, + { syntax: '<length>', initialValue: '1337px' }, + { syntax: '<number>', initialValue: '42.5' }, + { syntax: '<percentage>', initialValue: '42%' }, + { syntax: '<resolution>', initialValue: '300dpi' }, + { syntax: '<time>', initialValue: '3600s' }, + { syntax: '<url>', initialValue: 'url(http://a.com/a)' }, + { syntax: 'thing', initialValue: 'thing' }, + { syntax: '<length> | <angle>', initialValue: '1337px' }, + { syntax: '<angle> | <image>', initialValue: '1turn' }, + { syntax: '<length>+', initialValue: '1337px' }, + { syntax: '<length>+', initialValue: '1337px 1338px', count: 2 }, + { syntax: '<length>#', initialValue: '1337px' }, + { syntax: '<length>#', initialValue: '1337px, 1338px', count: 2 }, + + // Non-initial values: + { syntax: '*', initialValue: 'fail', value: 'if(){}' }, + { syntax: '<angle> | fail', initialValue: 'fail', value: '42deg' }, + { syntax: '<color> | fail', initialValue: 'fail', value: '#fefefe' }, + { syntax: '<custom-ident> | fail', initialValue: 'fail', value: 'none' }, + { syntax: '<image> | fail', initialValue: 'fail', value: 'linear-gradient(red, red)' }, + { syntax: '<image> | fail', initialValue: 'fail', value: 'url(http://a.com/a)' }, + { syntax: '<integer> | fail', initialValue: 'fail', value: '42' }, + { syntax: '<length-percentage> | fail', initialValue: 'fail', value: '10%' }, + { syntax: '<length-percentage> | fail', initialValue: 'fail', value: '10px' }, + { syntax: '<length-percentage> | fail', initialValue: 'fail', value: 'calc(10px + 10%)' }, + { syntax: '<length> | fail', initialValue: 'fail', value: '1337px' }, + { syntax: '<number> | fail', initialValue: 'fail', value: '42.5' }, + { syntax: '<percentage> | fail', initialValue: 'fail', value: '42%' }, + { syntax: '<resolution> | fail', initialValue: 'fail', value: '300dpi' }, + { syntax: '<time> | fail', initialValue: 'fail', value: '3600s' }, + { syntax: '<url> | fail', initialValue: 'fail', value: 'url(http://a.com/a)' }, + { syntax: 'thing | fail', initialValue: 'fail', value: 'thing' }, + { syntax: '<length>+ | fail', initialValue: 'fail', value: '1337px' }, + { syntax: '<length>+ | fail', initialValue: 'fail', value: '1337px 1338px', count: 2 }, + { syntax: '<length># | fail', initialValue: 'fail', value: '1337px' }, + { syntax: '<length># | fail', initialValue: 'fail', value: '1337px, 1338px', count: 2 }, + ]; + + try { + let target = document.getElementById('canvas-geometry'); + let pid = 1; + + for (let p of props) { + p.name = `--prop-${++pid}`; + + CSS.registerProperty({ + name: p.name, + syntax: p.syntax, + initialValue: p.initialValue, + inherits: (typeof p.inherits !== 'undefined') ? p.inherits : false + }); + + if (typeof p.value !== 'undefined') + target.style.setProperty(p.name, p.value); + if (typeof p.count === 'undefined') + p.count = 1; + + let getValue = p => (typeof p.value !== 'undefined') ? p.value : p.initialValue; + let serialize = v => v.constructor.name + '=' + v.toString(); + + let parse = function (p) { + if (p.count == 1) + return [CSSStyleValue.parse(p.name, getValue(p))]; + return CSSStyleValue.parseAll(p.name, getValue(p)); + }; + + // Generate expected value. We assume that CSSStyleValue.parse/All + // returns the correct CSSStyleValue subclass and value. + p.expected = parse(p).map(serialize); + } + + // Adding '?debug' to the URL will cause this test to emit + // test results to console.log. + let debugMode = document.location.href.endsWith('?debug'); + let code = [ + `const props = ${JSON.stringify(props)};`, + `const debugLog = ${debugMode ? 'console.log' : 'function(){}'};`, + document.getElementById('code').textContent + ].join('\n'); + + importWorkletAndTerminateTestAfterAsyncPaint(CSS.paintWorklet, code); + } catch(e) { + document.body.textContent = e; + takeScreenshot(); + } +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-scrollbars/textarea-scrollbar-width-none-ref.html b/tests/wpt/web-platform-tests/css/css-scrollbars/textarea-scrollbar-width-none-ref.html new file mode 100644 index 00000000000..9f505dd7f1d --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-scrollbars/textarea-scrollbar-width-none-ref.html @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>CSS Reference</title> +<link rel="author" title="Xidorn Quan" href="https://www.upsuper.org"> +<link rel="author" title="Mozilla" href="https://www.mozilla.org"> +<style> + textarea { + overflow: hidden; + white-space: pre; + } +</style> +<textarea cols="10" rows="10"></textarea> +<script> + let textarea = document.querySelector("textarea"); + textarea.value = ('X'.repeat(100) + '\n').repeat(100); +</script> diff --git a/tests/wpt/web-platform-tests/css/css-scrollbars/textarea-scrollbar-width-none.html b/tests/wpt/web-platform-tests/css/css-scrollbars/textarea-scrollbar-width-none.html new file mode 100644 index 00000000000..dcfaf5b6270 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-scrollbars/textarea-scrollbar-width-none.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>CSS Test: scrollbar-width should apply on <textarea></title> +<link rel="author" title="Xidorn Quan" href="https://www.upsuper.org"> +<link rel="author" title="Mozilla" href="https://www.mozilla.org"> +<link rel="help" href="https://drafts.csswg.org/css-scrollbars-1/#scrollbar-width"> +<link rel="match" href="textarea-scrollbar-width-none-ref.html"> +<style> + textarea { + scrollbar-width: none; + white-space: pre; + } +</style> +<textarea cols="10" rows="10"></textarea> +<script> + let textarea = document.querySelector("textarea"); + textarea.value = ('X'.repeat(100) + '\n').repeat(100); +</script> diff --git a/tests/wpt/web-platform-tests/css/css-transitions/parsing/transition-delay-invalid.html b/tests/wpt/web-platform-tests/css/css-transitions/parsing/transition-delay-invalid.html new file mode 100644 index 00000000000..b34d50551ce --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-transitions/parsing/transition-delay-invalid.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Transitions: parsing transition-delay with invalid values</title> +<link rel="help" href="https://drafts.csswg.org/css-transitions/#propdef-transition-delay"> +<meta name="assert" content="transition-delay supports only the grammar '<time> #'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_invalid_value("transition-delay", 'infinite'); +test_invalid_value("transition-delay", '0'); +test_invalid_value("transition-delay", '500ms 0.5s'); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-transitions/parsing/transition-delay-valid.html b/tests/wpt/web-platform-tests/css/css-transitions/parsing/transition-delay-valid.html new file mode 100644 index 00000000000..d6b42b9c059 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-transitions/parsing/transition-delay-valid.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Transitions: parsing transition-delay with valid values</title> +<link rel="help" href="https://drafts.csswg.org/css-transitions/#propdef-transition-delay"> +<meta name="assert" content="transition-delay supports the full grammar '<time> #'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_valid_value("transition-delay", '0s'); +test_valid_value("transition-delay", '500ms'); +test_valid_value("transition-delay", '1s, 2s'); +test_valid_value("transition-delay", '-1s, -2s'); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-transitions/parsing/transition-duration-invalid.html b/tests/wpt/web-platform-tests/css/css-transitions/parsing/transition-duration-invalid.html new file mode 100644 index 00000000000..fd0f341f407 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-transitions/parsing/transition-duration-invalid.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Transitions: parsing transition-duration with invalid values</title> +<link rel="help" href="https://drafts.csswg.org/css-transitions/#propdef-transition-duration"> +<meta name="assert" content="transition-duration supports only the grammar '<time> #'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_invalid_value("transition-duration", 'infinite'); +test_invalid_value("transition-duration", '-500ms'); +test_invalid_value("transition-duration", '1s 2s'); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-transitions/parsing/transition-duration-valid.html b/tests/wpt/web-platform-tests/css/css-transitions/parsing/transition-duration-valid.html new file mode 100644 index 00000000000..311ca086695 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-transitions/parsing/transition-duration-valid.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Transitions: parsing transition-duration with valid values</title> +<link rel="help" href="https://drafts.csswg.org/css-transitions/#propdef-transition-duration"> +<meta name="assert" content="transition-duration supports the full grammar '<time> #'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_valid_value("transition-duration", '0s'); +test_valid_value("transition-duration", '500ms'); +test_valid_value("transition-duration", '1s, 2s'); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-transitions/parsing/transition-property-invalid.html b/tests/wpt/web-platform-tests/css/css-transitions/parsing/transition-property-invalid.html new file mode 100644 index 00000000000..903a206eac1 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-transitions/parsing/transition-property-invalid.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Transitions: parsing transition-property with invalid values</title> +<link rel="help" href="https://drafts.csswg.org/css-transitions/#propdef-transition-property"> +<meta name="assert" content="transition-property supports only the grammar 'none | <single-transition-property> #'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_invalid_value("transition-property", 'one two three'); +test_invalid_value("transition-property", '1, 2, 3'); +test_invalid_value("transition-property", 'none, one'); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-transitions/parsing/transition-property-valid.html b/tests/wpt/web-platform-tests/css/css-transitions/parsing/transition-property-valid.html new file mode 100644 index 00000000000..4e3894f5aa9 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-transitions/parsing/transition-property-valid.html @@ -0,0 +1,22 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Transitions: parsing transition-property with valid values</title> +<link rel="help" href="https://drafts.csswg.org/css-transitions/#propdef-transition-property"> +<meta name="assert" content="transition-property supports the full grammar 'none | <single-transition-property> #'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_valid_value("transition-property", 'none'); +test_valid_value("transition-property", 'all'); +test_valid_value("transition-property", 'one'); +test_valid_value("transition-property", 'one-two-three'); +test_valid_value("transition-property", 'one, two, three'); +test_valid_value("transition-property", 'width, all'); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-transitions/parsing/transition-timing-function-invalid.html b/tests/wpt/web-platform-tests/css/css-transitions/parsing/transition-timing-function-invalid.html new file mode 100644 index 00000000000..936defa6cce --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-transitions/parsing/transition-timing-function-invalid.html @@ -0,0 +1,24 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Animations: parsing transition-timing-function with invalid values</title> +<link rel="help" href="https://drafts.csswg.org/css-transitions/#propdef-transition-timing-function"> +<link rel="help" href="https://drafts.csswg.org/css-timing-1/#typedef-timing-function"> +<meta name="assert" content="transition-timing-function supports only the grammar '<timing-function> #'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_invalid_value("transition-timing-function", "auto"); +test_invalid_value("transition-timing-function", "ease-in ease-out"); +test_invalid_value("transition-timing-function", "cubic-bezier(1, 2, 3)"); +test_invalid_value("transition-timing-function", "cubic-bezier(1, 2, 3, infinite)"); +test_invalid_value("transition-timing-function", "cubic-bezier(1, 2, 3, 4, 5)"); +test_invalid_value("transition-timing-function", "cubic-bezier(-0.1, 0.1, 0.5, 0.9)"); +test_invalid_value("transition-timing-function", "cubic-bezier(0.5, 0.1, 1.1, 0.9)"); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-transitions/parsing/transition-timing-function-valid.html b/tests/wpt/web-platform-tests/css/css-transitions/parsing/transition-timing-function-valid.html new file mode 100644 index 00000000000..e11ef0002e4 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-transitions/parsing/transition-timing-function-valid.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Transitions: parsing transition-timing-function with valid values</title> +<link rel="help" href="https://drafts.csswg.org/css-transitions/#propdef-transition-timing-function"> +<link rel="help" href="https://drafts.csswg.org/css-timing-1/#typedef-timing-function"> +<meta name="assert" content="transition-timing-function supports the full grammar '<timing-function> #'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_valid_value("transition-timing-function", "linear"); + +test_valid_value("transition-timing-function", "ease"); +test_valid_value("transition-timing-function", "ease-in"); +test_valid_value("transition-timing-function", "ease-out"); +test_valid_value("transition-timing-function", "ease-in-out"); +test_valid_value("transition-timing-function", "cubic-bezier(0.1, 0.2, 0.8, 0.9)"); +test_valid_value("transition-timing-function", "cubic-bezier(0, -2, 1, 3)"); +test_valid_value("transition-timing-function", "cubic-bezier(0, 0.7, 1, 1.3)"); + +test_valid_value("transition-timing-function", "steps(4, start)"); +test_valid_value("transition-timing-function", "steps(2, end)"); + +test_valid_value("transition-timing-function", "linear, ease, linear"); +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/color-interpolation.html b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/color-interpolation.html index 4713d90621d..d8324db22e2 100644 --- a/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/color-interpolation.html +++ b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/color-interpolation.html @@ -15,8 +15,8 @@ runPropertyTests('color-interpolation', [ { syntax: 'auto' }, - { syntax: 'sRGB' }, - { syntax: 'linearRGB' }, + { syntax: 'srgb' }, + { syntax: 'linearrgb' }, ]); </script> diff --git a/tests/wpt/web-platform-tests/css/motion/parsing/offset-parsing-valid.html b/tests/wpt/web-platform-tests/css/motion/parsing/offset-parsing-valid.html index 75c93e5475f..b93091b2088 100644 --- a/tests/wpt/web-platform-tests/css/motion/parsing/offset-parsing-valid.html +++ b/tests/wpt/web-platform-tests/css/motion/parsing/offset-parsing-valid.html @@ -16,25 +16,25 @@ test_valid_value("offset", "100px none auto 90deg", "100px center none auto 90de test_valid_value("offset", "100px", "100px center"); test_valid_value("offset", "auto none reverse"); test_valid_value("offset", "auto"); -test_valid_value("offset", "center bottom path('M 1 2 V 3 Z')"); -test_valid_value("offset", "center center path('M 0 0 L 100 100 M 100 200 L 200 200 Z L 300 300 Z') 100% 90deg / left bottom"); +test_valid_value("offset", "center bottom path(\"M 1 2 V 3 Z\")"); +test_valid_value("offset", "center center path(\"M 0 0 L 100 100 M 100 200 L 200 200 Z L 300 300 Z\") 100% 90deg / left bottom"); test_valid_value("offset", "left bottom ray(0rad closest-side) 10px auto 30deg / right bottom"); test_valid_value("offset", "left top"); test_valid_value("offset", "none 30deg reverse", "none reverse 30deg"); test_valid_value("offset", "none 50px reverse 30deg"); test_valid_value("offset", "none calc(10px + 20%) auto"); test_valid_value("offset", "none reverse"); -test_valid_value("offset", "path('M 0 0 H 1') -200% auto"); -test_valid_value("offset", "path('M 0 0 H 1') -200%"); -test_valid_value("offset", "path('M 0 0 H 1') 50px"); -test_valid_value("offset", "path('M 0 0 H 1') auto"); -test_valid_value("offset", "path('M 0 0 H 1') reverse 30deg 50px", "path('M 0 0 H 1') 50px reverse 30deg"); -test_valid_value("offset", "path('M 0 0 H 1')"); -test_valid_value("offset", "path('m 0 0 h 100') -7rad 8px / auto", "path('m 0 0 h 100') 8px -7rad / auto"); -test_valid_value("offset", "path('m 0 0 h 100') -7rad 8px / left top", "path('m 0 0 h 100') 8px -7rad / left top"); -test_valid_value("offset", "path('m 0 0 h 100') -7rad 8px", "path('m 0 0 h 100') 8px -7rad"); -test_valid_value("offset", "path('m 0 0 h 100') 100px 0deg"); -test_valid_value("offset", "path('m 1 2 v 3 Z')"); +test_valid_value("offset", "path(\"M 0 0 H 1\") -200% auto"); +test_valid_value("offset", "path(\"M 0 0 H 1\") -200%"); +test_valid_value("offset", "path('M 0 0 H 1') 50px", "path(\"M 0 0 H 1\") 50px"); +test_valid_value("offset", "path(\"M 0 0 H 1\") auto"); +test_valid_value("offset", "path('M 0 0 H 1') reverse 30deg 50px", "path(\"M 0 0 H 1\") 50px reverse 30deg"); +test_valid_value("offset", "path(\"M 0 0 H 1\")"); +test_valid_value("offset", "path('m 0 0 h 100') -7rad 8px / auto", "path(\"m 0 0 h 100\") 8px -7rad / auto"); +test_valid_value("offset", "path('m 0 0 h 100') -7rad 8px / left top", "path(\"m 0 0 h 100\") 8px -7rad / left top"); +test_valid_value("offset", "path('m 0 0 h 100') -7rad 8px", "path(\"m 0 0 h 100\") 8px -7rad"); +test_valid_value("offset", "path(\"m 0 0 h 100\") 100px 0deg"); +test_valid_value("offset", "path('m 1 2 v 3 Z')", "path(\"m 1 2 v 3 Z\")"); test_valid_value("offset", "ray(farthest-corner 90deg) 1%", "ray(90deg farthest-corner) 1%"); test_valid_value("offset", "ray(sides 0deg) 50% 90deg auto", "ray(0deg sides) 50% auto 90deg"); test_valid_value("offset", "right bottom / left top"); diff --git a/tests/wpt/web-platform-tests/docs/_writing-tests/testharness-api.md b/tests/wpt/web-platform-tests/docs/_writing-tests/testharness-api.md index bb552453291..952c8365fb7 100644 --- a/tests/wpt/web-platform-tests/docs/_writing-tests/testharness-api.md +++ b/tests/wpt/web-platform-tests/docs/_writing-tests/testharness-api.md @@ -161,9 +161,9 @@ Test is finished. promise_test(test_function, name, properties) ``` -`test_function` is a function that receives a test as an argument and returns a -promise. The test completes when the returned promise resolves. The test fails -if the returned promise rejects. +`test_function` is a function that receives a test as an argument. It must +return a promise. The test completes when the returned promise resolves. The +test fails if the returned promise rejects. E.g.: diff --git a/tests/wpt/web-platform-tests/html/editing/focus/composed.window.js b/tests/wpt/web-platform-tests/html/interaction/focus/composed.window.js index 8951afc4e0c..8951afc4e0c 100644 --- a/tests/wpt/web-platform-tests/html/editing/focus/composed.window.js +++ b/tests/wpt/web-platform-tests/html/interaction/focus/composed.window.js diff --git a/tests/wpt/web-platform-tests/html/editing/focus/document-level-focus-apis/document-level-apis.html b/tests/wpt/web-platform-tests/html/interaction/focus/document-level-focus-apis/document-level-apis.html index 2d8c49c7f61..2d8c49c7f61 100644 --- a/tests/wpt/web-platform-tests/html/editing/focus/document-level-focus-apis/document-level-apis.html +++ b/tests/wpt/web-platform-tests/html/interaction/focus/document-level-focus-apis/document-level-apis.html diff --git a/tests/wpt/web-platform-tests/html/editing/focus/document-level-focus-apis/test.html b/tests/wpt/web-platform-tests/html/interaction/focus/document-level-focus-apis/test.html index 90d63e51e93..90d63e51e93 100644 --- a/tests/wpt/web-platform-tests/html/editing/focus/document-level-focus-apis/test.html +++ b/tests/wpt/web-platform-tests/html/interaction/focus/document-level-focus-apis/test.html diff --git a/tests/wpt/web-platform-tests/html/editing/focus/focus-01.html b/tests/wpt/web-platform-tests/html/interaction/focus/focus-01.html index 9d1bf1b6c7d..9d1bf1b6c7d 100644 --- a/tests/wpt/web-platform-tests/html/editing/focus/focus-01.html +++ b/tests/wpt/web-platform-tests/html/interaction/focus/focus-01.html diff --git a/tests/wpt/web-platform-tests/html/editing/focus/focus-02.html b/tests/wpt/web-platform-tests/html/interaction/focus/focus-02.html index 1858d6a21d2..1858d6a21d2 100644 --- a/tests/wpt/web-platform-tests/html/editing/focus/focus-02.html +++ b/tests/wpt/web-platform-tests/html/interaction/focus/focus-02.html diff --git a/tests/wpt/web-platform-tests/html/editing/focus/focus-management/focus-event-targets-simple.html b/tests/wpt/web-platform-tests/html/interaction/focus/focus-management/focus-event-targets-simple.html index ab7bcfe6d0e..ab7bcfe6d0e 100644 --- a/tests/wpt/web-platform-tests/html/editing/focus/focus-management/focus-event-targets-simple.html +++ b/tests/wpt/web-platform-tests/html/interaction/focus/focus-management/focus-event-targets-simple.html diff --git a/tests/wpt/web-platform-tests/html/editing/focus/focus-management/focus-events.html b/tests/wpt/web-platform-tests/html/interaction/focus/focus-management/focus-events.html index d63362aaa18..d63362aaa18 100644 --- a/tests/wpt/web-platform-tests/html/editing/focus/focus-management/focus-events.html +++ b/tests/wpt/web-platform-tests/html/interaction/focus/focus-management/focus-events.html diff --git a/tests/wpt/web-platform-tests/html/editing/focus/processing-model/focus-fixup-rule-one-no-dialogs.html b/tests/wpt/web-platform-tests/html/interaction/focus/processing-model/focus-fixup-rule-one-no-dialogs.html index d8171abc715..d8171abc715 100644 --- a/tests/wpt/web-platform-tests/html/editing/focus/processing-model/focus-fixup-rule-one-no-dialogs.html +++ b/tests/wpt/web-platform-tests/html/interaction/focus/processing-model/focus-fixup-rule-one-no-dialogs.html diff --git a/tests/wpt/web-platform-tests/html/interaction/focus/processing-model/legend-focusable.html b/tests/wpt/web-platform-tests/html/interaction/focus/processing-model/legend-focusable.html new file mode 100644 index 00000000000..c9209d3cf62 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/interaction/focus/processing-model/legend-focusable.html @@ -0,0 +1,17 @@ +<!doctype html> +<title>legend focusable</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script> + const t = async_test(); +</script> +<fieldset> + <legend tabindex=0 onfocus="t.step(() => { t.done(); })"> + legend + <input onfocus="t.unreached_func('input in legend was focused')();"> + </legend> + <input onfocus="t.unreached_func('input after legend was focused')();"> +</fieldset> +<script> + document.querySelector('legend').focus(); +</script> diff --git a/tests/wpt/web-platform-tests/html/interaction/focus/processing-model/legend.html b/tests/wpt/web-platform-tests/html/interaction/focus/processing-model/legend.html new file mode 100644 index 00000000000..b53839374df --- /dev/null +++ b/tests/wpt/web-platform-tests/html/interaction/focus/processing-model/legend.html @@ -0,0 +1,20 @@ +<!doctype html> +<title>legend</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script> + const t = async_test(); +</script> +<fieldset> + <legend onfocus="t.unreached_func('legend was focused')()"> + legend + <input onfocus="t.unreached_func('input in legend was focused')();"> + </legend> + <input onfocus="t.unreached_func('input after legend was focused')();"> +</fieldset> +<script> + document.querySelector('legend').focus(); + t.step_timeout(() => { + t.done(); + }, 500); +</script> diff --git a/tests/wpt/web-platform-tests/html/editing/focus/processing-model/preventScroll.html b/tests/wpt/web-platform-tests/html/interaction/focus/processing-model/preventScroll.html index 97d341b30ec..97d341b30ec 100644 --- a/tests/wpt/web-platform-tests/html/editing/focus/processing-model/preventScroll.html +++ b/tests/wpt/web-platform-tests/html/interaction/focus/processing-model/preventScroll.html diff --git a/tests/wpt/web-platform-tests/html/editing/focus/processing-model/support/preventScroll-helper.html b/tests/wpt/web-platform-tests/html/interaction/focus/processing-model/support/preventScroll-helper.html index 43c6d86a578..43c6d86a578 100644 --- a/tests/wpt/web-platform-tests/html/editing/focus/processing-model/support/preventScroll-helper.html +++ b/tests/wpt/web-platform-tests/html/interaction/focus/processing-model/support/preventScroll-helper.html diff --git a/tests/wpt/web-platform-tests/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-default-value.html b/tests/wpt/web-platform-tests/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-default-value.html index 25e359c2a25..25e359c2a25 100644 --- a/tests/wpt/web-platform-tests/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-default-value.html +++ b/tests/wpt/web-platform-tests/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-default-value.html diff --git a/tests/wpt/web-platform-tests/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-negative.html b/tests/wpt/web-platform-tests/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-negative.html index 92bf1743142..92bf1743142 100644 --- a/tests/wpt/web-platform-tests/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-negative.html +++ b/tests/wpt/web-platform-tests/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-negative.html diff --git a/tests/wpt/web-platform-tests/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-order.html b/tests/wpt/web-platform-tests/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-order.html index 45429cc1a72..45429cc1a72 100644 --- a/tests/wpt/web-platform-tests/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-order.html +++ b/tests/wpt/web-platform-tests/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-order.html diff --git a/tests/wpt/web-platform-tests/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-positive.html b/tests/wpt/web-platform-tests/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-positive.html index 9a131847703..9a131847703 100644 --- a/tests/wpt/web-platform-tests/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-positive.html +++ b/tests/wpt/web-platform-tests/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-positive.html diff --git a/tests/wpt/web-platform-tests/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-zero.html b/tests/wpt/web-platform-tests/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-zero.html index c46acd0a413..c46acd0a413 100644 --- a/tests/wpt/web-platform-tests/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-zero.html +++ b/tests/wpt/web-platform-tests/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-zero.html diff --git a/tests/wpt/web-platform-tests/html/editing/focus/tabindex-focus-flag.html b/tests/wpt/web-platform-tests/html/interaction/focus/tabindex-focus-flag.html index e40bc077594..e40bc077594 100644 --- a/tests/wpt/web-platform-tests/html/editing/focus/tabindex-focus-flag.html +++ b/tests/wpt/web-platform-tests/html/interaction/focus/tabindex-focus-flag.html diff --git a/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align-text-align.html b/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align-text-align.html new file mode 100644 index 00000000000..01483bf8ad3 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align-text-align.html @@ -0,0 +1,27 @@ +<!doctype html> +<title>legend align does not map to text-align</title> +<!-- See discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1488228 --> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<style> + legend { width: 13em } +</style> +<fieldset><legend>foo bar abcdefghijklmnopqrstuvwxyz</legend></fieldset> +<fieldset><legend align=left>foo bar abcdefghijklmnopqrstuvwxyz</legend></fieldset> +<fieldset><legend align=center>foo bar abcdefghijklmnopqrstuvwxyz</legend></fieldset> +<fieldset><legend align=right>foo bar abcdefghijklmnopqrstuvwxyz</legend></fieldset> +<fieldset><legend align=justify>foo bar abcdefghijklmnopqrstuvwxyz</legend></fieldset> +<script> +function test_align(selectorTest, expectedAlign) { + const testElm = document.querySelector(selectorTest); + test(() => { + assert_equals(getComputedStyle(testElm).textAlign, expectedAlign); + }, selectorTest); +} + +test_align('legend', 'start'); + +for (const val of ['left', 'center', 'right', 'justify']) { + test_align(`legend[align=${val}]`, 'start'); +} +</script> diff --git a/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align.html b/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align.html index f7511c9e4c9..e7745998194 100644 --- a/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align.html +++ b/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align.html @@ -5,6 +5,7 @@ <fieldset><legend align=left>x</legend></fieldset> <fieldset><legend align=center>x</legend></fieldset> <fieldset><legend align=right>x</legend></fieldset> +<fieldset><legend align=justify>x</legend></fieldset> <div align=left> <fieldset><legend>x</legend></fieldset> </div> @@ -14,6 +15,9 @@ <div align=right> <fieldset><legend>x</legend></fieldset> </div> +<div align=justify> + <fieldset><legend>x</legend></fieldset> +</div> <div style="text-align: center"> <fieldset><legend>x</legend></fieldset> </div> @@ -33,12 +37,12 @@ function test_align(selectorTest, selectorRef) { }, selectorTest); } -for (const val of ['left', 'center', 'right']) { - test_align(`div[align=${val}] legend`, `legend[align=${val}]`); +for (const val of ['left', 'center', 'right', 'justify']) { + test_align(`div[align=${val}] legend`, `legend[align=left]`); } test_align(`div[style="text-align: center"] legend`, `legend[align=left]`); -test_align(`div[style="text-align: center"][align=center] legend`, `legend[align=center]`); +test_align(`div[style="text-align: center"][align=center] legend`, `legend[align=left]`); test_align(`legend[style="margin: 0 auto"]`, `legend[align=center]`); test_align(`legend[style="margin: 0 0 0 auto"]`, `legend[align=right]`); test_align(`fieldset[dir=rtl] legend`, `legend[align=right]`); diff --git a/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/common/accesskey.js b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/common/accesskey.js new file mode 100644 index 00000000000..f08761be8c1 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/common/accesskey.js @@ -0,0 +1,36 @@ +setup({explicit_done: true, explicit_timeout: true}); + +const NOTRUN = 3; +let status = NOTRUN; +function notrun() { + return status === NOTRUN; +} +add_completion_callback(tests => { + status = tests[0].status; +}); + +function pass() { + // Wait a couple of frames in case fail() is also called. + requestAnimationFrame(() => { + requestAnimationFrame(() => { + if (notrun()) { + test(() => {}); + done(); + } + }); + }); +} + +function fail(msg) { + if (notrun()) { + test(() => { assert_unreached(msg); }); + done(); + } +} + +document.addEventListener('DOMContentLoaded', () => { + const accessKeyElement = document.querySelector('[accesskey]'); + if (accessKeyElement.accessKeyLabel) { + document.querySelector('kbd').textContent = accessKeyElement.accessKeyLabel; + } +}); diff --git a/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/legend/first-input-after-legend-manual.html b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/legend/first-input-after-legend-manual.html new file mode 100644 index 00000000000..521b4bb9755 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/legend/first-input-after-legend-manual.html @@ -0,0 +1,10 @@ +<!doctype html> +<title>First input after the legend</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script src=../common/accesskey.js></script> +<p>Press the access key combination for "a". <kbd></kbd></p> +<fieldset> + <legend accesskey=a>legend</legend> + <input onfocus="pass()"> +</fieldset> diff --git a/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/legend/first-input-before-legend-manual.html b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/legend/first-input-before-legend-manual.html new file mode 100644 index 00000000000..1c40cc7b81e --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/legend/first-input-before-legend-manual.html @@ -0,0 +1,13 @@ +<!doctype html> +<title>First input before the legend</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script src=../common/accesskey.js></script> +<p>Press the access key combination for "a". <kbd></kbd></p> +<fieldset> + <input onfocus="pass()"> + <legend accesskey=a>legend + <input onfocus="fail('input in legend was focused')"> + </legend> + <input onfocus="fail('input after legend was focused')"> +</fieldset> diff --git a/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/legend/first-input-inside-legend-manual.html b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/legend/first-input-inside-legend-manual.html new file mode 100644 index 00000000000..abd3a3b2dfe --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/legend/first-input-inside-legend-manual.html @@ -0,0 +1,12 @@ +<!doctype html> +<title>First input inside the legend</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script src=../common/accesskey.js></script> +<p>Press the access key combination for "a". <kbd></kbd></p> +<fieldset> + <legend accesskey=a>legend + <input onfocus="pass()"> + </legend> + <input onfocus="fail('input after legend was focused')"> +</fieldset> diff --git a/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/legend/focusable-legend-manual.html b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/legend/focusable-legend-manual.html new file mode 100644 index 00000000000..e2880a77bf9 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/legend/focusable-legend-manual.html @@ -0,0 +1,14 @@ +<!doctype html> +<title>Focusable legend</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script src=../common/accesskey.js></script> +<p>Press the access key combination for "a". <kbd></kbd></p> +<fieldset> + <legend tabindex=0 onclick="fail('unexpected click event on legend')" + onfocus="fail('legend was focused')" accesskey=a> + legend + <input onfocus="pass()"> + </legend> + <input onfocus="fail('input after legend was focused')"> +</fieldset> diff --git a/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/legend/focusable-legend-sibling-manual.html b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/legend/focusable-legend-sibling-manual.html new file mode 100644 index 00000000000..49dcaaf7d54 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/legend/focusable-legend-sibling-manual.html @@ -0,0 +1,17 @@ +<!doctype html> +<title>Focusable legend sibling</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script src=../common/accesskey.js></script> +<p>Press the access key combination for "a". <kbd></kbd></p> +<fieldset> + <legend accesskey=a>first legend</legend> + <legend tabindex=0 onfocus="fail('sibling legend was focused')">second legend</legend> +</fieldset> +<script> + onkeyup = e => { + if (e.keyCode === 65) { + pass(); + } + } +</script> diff --git a/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/legend/input-outside-fieldset-manual.html b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/legend/input-outside-fieldset-manual.html new file mode 100644 index 00000000000..dc6af48323e --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/legend/input-outside-fieldset-manual.html @@ -0,0 +1,17 @@ +<!doctype html> +<title>Input outside fieldset</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script src=../common/accesskey.js></script> +<p>Press the access key combination for "a". <kbd></kbd></p> +<fieldset> + <legend accesskey=a>legend</legend> +</fieldset> +<input onfocus="fail('input outside fieldset was focused')"> +<script> + onkeyup = e => { + if (e.keyCode === 65) { + pass(); + } + } +</script> diff --git a/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/legend/label-sibling-manual.html b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/legend/label-sibling-manual.html new file mode 100644 index 00000000000..8a7b20565f7 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/legend/label-sibling-manual.html @@ -0,0 +1,18 @@ +<!doctype html> +<title>Label sibling</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script src=../common/accesskey.js></script> +<p>Press the access key combination for "a". <kbd></kbd></p> +<input id=x onfocus="fail('input associated with the label was focused')"> +<fieldset> + <legend accesskey=a>legend</legend> + <label for=x onclick="fail('label received a click event')">label</label> +</fieldset> +<script> + onkeyup = e => { + if (e.keyCode === 65) { + pass(); + } + } +</script> diff --git a/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/legend/no-fieldset-parent-manual.html b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/legend/no-fieldset-parent-manual.html new file mode 100644 index 00000000000..e7abb71454a --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/interactive-elements/commands/legend/no-fieldset-parent-manual.html @@ -0,0 +1,18 @@ +<!doctype html> +<title>No fieldset parent</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script src=../common/accesskey.js></script> +<p>Press the access key combination for "a". <kbd></kbd></p> +<legend accesskey=a> + legend + <input onfocus="fail('input in legend was focused')"> +</legend> +<input onfocus="fail('input after legend was focused')"> +<script> + onkeyup = e => { + if (e.keyCode === 65) { + pass(); + } + } +</script> diff --git a/tests/wpt/web-platform-tests/interfaces/background-fetch.idl b/tests/wpt/web-platform-tests/interfaces/background-fetch.idl index 92b6026f8b6..130d5d825a5 100644 --- a/tests/wpt/web-platform-tests/interfaces/background-fetch.idl +++ b/tests/wpt/web-platform-tests/interfaces/background-fetch.idl @@ -37,8 +37,9 @@ interface BackgroundFetchRegistration : EventTarget { readonly attribute unsigned long long uploaded; readonly attribute unsigned long long downloadTotal; readonly attribute unsigned long long downloaded; - readonly attribute BackgroundFetchState state; + readonly attribute BackgroundFetchResult result; readonly attribute BackgroundFetchFailureReason failureReason; + readonly attribute boolean recordsAvailable; attribute EventHandler onprogress; @@ -47,9 +48,10 @@ interface BackgroundFetchRegistration : EventTarget { Promise<sequence<BackgroundFetchRecord>> matchAll(optional RequestInfo request, optional CacheQueryOptions options); }; -enum BackgroundFetchState { "pending", "success", "failure" }; +enum BackgroundFetchResult { "", "success", "failure" }; enum BackgroundFetchFailureReason { + // The background fetch has not completed yet, or was successful. "", // The operation was aborted by the user, or abort() was called. "aborted", @@ -61,7 +63,7 @@ enum BackgroundFetchFailureReason { // Storage quota was reached during the operation. "quota-exceeded", // The provided downloadTotal was exceeded. - "total-download-exceeded" + "download-total-exceeded" }; [Exposed=(Window,Worker)] diff --git a/tests/wpt/web-platform-tests/interfaces/cookie-store.idl b/tests/wpt/web-platform-tests/interfaces/cookie-store.idl index 454da38b182..d872b7aadb2 100644 --- a/tests/wpt/web-platform-tests/interfaces/cookie-store.idl +++ b/tests/wpt/web-platform-tests/interfaces/cookie-store.idl @@ -1,48 +1,31 @@ -// https://github.com/WICG/cookie-store/blob/gh-pages/explainer.md - -enum CookieSameSite { - "strict", - "lax", - "unrestricted" -}; +// GENERATED CONTENT - DO NOT EDIT +// Content was automatically extracted by Reffy into reffy-reports +// (https://github.com/tidoust/reffy-reports) +// Source: Cookie Store API (https://wicg.github.io/cookie-store/) + +[Exposed=(ServiceWorker,Window), + SecureContext] +interface CookieStore : EventTarget { + Promise<CookieListItem?> get(USVString name); + Promise<CookieListItem?> get(optional CookieStoreGetOptions options); -dictionary CookieListItem { - required USVString name; - USVString value; - USVString? domain = null; - USVString path = "/"; - DOMTimeStamp? expires = null; - boolean secure = true; - CookieSameSite sameSite = "strict"; -}; + Promise<CookieList> getAll(USVString name); + Promise<CookieList> getAll(optional CookieStoreGetOptions options); -typedef sequence<CookieListItem> CookieList; + Promise<void> set(USVString name, USVString value, + optional CookieStoreSetOptions options); + Promise<void> set(CookieStoreSetExtraOptions options); -dictionary CookieChangeEventInit : EventInit { - CookieList changed; - CookieList deleted; -}; + Promise<void> delete(USVString name); + Promise<void> delete(CookieStoreDeleteOptions options); -[ - Exposed=Window, - SecureContext, - Constructor(DOMString type, optional CookieChangeEventInit eventInitDict) -] interface CookieChangeEvent : Event { - readonly attribute CookieList changed; - readonly attribute CookieList deleted; -}; + [Exposed=ServiceWorker] + Promise<void> subscribeToChanges(sequence<CookieStoreGetOptions> subscriptions); -dictionary ExtendableCookieChangeEventInit : ExtendableEventInit { - CookieList changed; - CookieList deleted; -}; + [Exposed=ServiceWorker] + Promise<sequence<CookieStoreGetOptions>> getChangeSubscriptions(); -[ - Exposed=ServiceWorker, - Constructor(DOMString type, optional ExtendableCookieChangeEventInit eventInitDict) -] interface ExtendableCookieChangeEvent : ExtendableEvent { - readonly attribute CookieList changed; - readonly attribute CookieList deleted; + attribute EventHandler onchange; }; enum CookieMatchType { @@ -50,20 +33,18 @@ enum CookieMatchType { "starts-with" }; -dictionary CookieStoreDeleteOptions { - required USVString name; - USVString? domain = null; - USVString path = "/"; - boolean secure = true; - CookieSameSite sameSite = "strict"; -}; - dictionary CookieStoreGetOptions { USVString name; USVString url; CookieMatchType matchType = "equals"; }; +enum CookieSameSite { + "strict", + "lax", + "unrestricted" +}; + dictionary CookieStoreSetOptions { DOMTimeStamp? expires = null; USVString? domain = null; @@ -77,27 +58,35 @@ dictionary CookieStoreSetExtraOptions : CookieStoreSetOptions { required USVString value; }; -[ - Exposed=(ServiceWorker,Window), - SecureContext -] interface CookieStore : EventTarget { - Promise<CookieListItem?> get(USVString name); - Promise<CookieListItem?> get(optional CookieStoreGetOptions options); - - Promise<CookieList> getAll(USVString name); - Promise<CookieList> getAll(optional CookieStoreGetOptions options); - - Promise<void> set(USVString name, USVString value, optional CookieStoreSetOptions options); - Promise<void> set(CookieStoreSetExtraOptions options); +dictionary CookieStoreDeleteOptions { + required USVString name; + USVString? domain = null; + USVString path = "/"; +}; - Promise<void> delete(USVString name); - Promise<void> delete(CookieStoreDeleteOptions options); +dictionary CookieListItem { + required USVString name; + USVString value; + USVString? domain = null; + USVString path = "/"; + DOMTimeStamp? expires = null; + boolean secure = true; + CookieSameSite sameSite = "strict"; +}; - [Exposed=ServiceWorker] Promise<void> subscribeToChanges(sequence<CookieStoreGetOptions> subscriptions); +typedef sequence<CookieListItem> CookieList; - [Exposed=ServiceWorker] Promise<sequence<CookieStoreGetOptions>> getChangeSubscriptions(); +[Exposed=(ServiceWorker,Window), + SecureContext, + Constructor(DOMString type, optional CookieChangeEventInit eventInitDict)] +interface CookieChangeEvent : Event { + readonly attribute CookieList changed; + readonly attribute CookieList deleted; +}; - [Exposed=Window] attribute EventHandler onchange; +dictionary CookieChangeEventInit : EventInit { + CookieList changed; + CookieList deleted; }; [SecureContext] @@ -107,5 +96,6 @@ partial interface Window { partial interface ServiceWorkerGlobalScope { [Replaceable, SameObject] readonly attribute CookieStore cookieStore; + attribute EventHandler oncookiechange; }; diff --git a/tests/wpt/web-platform-tests/interfaces/intersection-observer.idl b/tests/wpt/web-platform-tests/interfaces/intersection-observer.idl index b48e1cbab37..ffda8f5c64d 100644 --- a/tests/wpt/web-platform-tests/interfaces/intersection-observer.idl +++ b/tests/wpt/web-platform-tests/interfaces/intersection-observer.idl @@ -20,7 +20,7 @@ interface IntersectionObserver { [Constructor(IntersectionObserverEntryInit intersectionObserverEntryInit)] interface IntersectionObserverEntry { readonly attribute DOMHighResTimeStamp time; - readonly attribute DOMRectReadOnly rootBounds; + readonly attribute DOMRectReadOnly? rootBounds; readonly attribute DOMRectReadOnly boundingClientRect; readonly attribute DOMRectReadOnly intersectionRect; readonly attribute boolean isIntersecting; @@ -30,7 +30,7 @@ interface IntersectionObserverEntry { dictionary IntersectionObserverEntryInit { required DOMHighResTimeStamp time; - required DOMRectInit rootBounds; + required DOMRectInit? rootBounds; required DOMRectInit boundingClientRect; required DOMRectInit intersectionRect; required boolean isIntersecting; diff --git a/tests/wpt/web-platform-tests/interfaces/payment-handler.idl b/tests/wpt/web-platform-tests/interfaces/payment-handler.idl index 9f10d7e7019..b19a7302dba 100644 --- a/tests/wpt/web-platform-tests/interfaces/payment-handler.idl +++ b/tests/wpt/web-platform-tests/interfaces/payment-handler.idl @@ -46,7 +46,6 @@ interface CanMakePaymentEvent : ExtendableEvent { readonly attribute USVString topOrigin; readonly attribute USVString paymentRequestOrigin; readonly attribute FrozenArray<PaymentMethodData> methodData; - readonly attribute FrozenArray<PaymentDetailsModifier> modifiers; void respondWith(Promise<boolean> canMakePaymentResponse); }; @@ -54,7 +53,6 @@ dictionary CanMakePaymentEventInit : ExtendableEventInit { USVString topOrigin; USVString paymentRequestOrigin; sequence<PaymentMethodData> methodData; - sequence<PaymentDetailsModifier> modifiers; }; partial interface ServiceWorkerGlobalScope { diff --git a/tests/wpt/web-platform-tests/interfaces/payment-request.idl b/tests/wpt/web-platform-tests/interfaces/payment-request.idl index d844f7cc788..05790c7d76d 100644 --- a/tests/wpt/web-platform-tests/interfaces/payment-request.idl +++ b/tests/wpt/web-platform-tests/interfaces/payment-request.idl @@ -197,8 +197,8 @@ interface PaymentMethodChangeEvent : PaymentRequestUpdateEvent { }; dictionary PaymentMethodChangeEventInit : PaymentRequestUpdateEventInit { - required DOMString methodName; - object? methodDetails; + DOMString methodName = ""; + object? methodDetails = null; }; [Constructor(DOMString type, optional PaymentRequestUpdateEventInit eventInitDict), SecureContext, Exposed=Window] diff --git a/tests/wpt/web-platform-tests/interfaces/pointerevents.idl b/tests/wpt/web-platform-tests/interfaces/pointerevents.idl index 63d39a28523..da822bba0e5 100644 --- a/tests/wpt/web-platform-tests/interfaces/pointerevents.idl +++ b/tests/wpt/web-platform-tests/interfaces/pointerevents.idl @@ -41,7 +41,6 @@ partial interface GlobalEventHandlers { attribute EventHandler onlostpointercapture; attribute EventHandler onpointerdown; attribute EventHandler onpointermove; - [RuntimeEnabled=PointerRawMove] attribute EventHandler onpointerrawmove; attribute EventHandler onpointerup; attribute EventHandler onpointercancel; attribute EventHandler onpointerover; diff --git a/tests/wpt/web-platform-tests/interfaces/wasm-js-api.idl b/tests/wpt/web-platform-tests/interfaces/wasm-js-api.idl index 04c817dcb11..6de14fb8f08 100644 --- a/tests/wpt/web-platform-tests/interfaces/wasm-js-api.idl +++ b/tests/wpt/web-platform-tests/interfaces/wasm-js-api.idl @@ -41,9 +41,9 @@ dictionary ModuleImportDescriptor { [LegacyNamespace=WebAssembly, Constructor(BufferSource bytes), Exposed=(Window,Worker,Worklet)] interface Module { - static sequence<ModuleExportDescriptor> exports(Module module); - static sequence<ModuleImportDescriptor> imports(Module module); - static sequence<ArrayBuffer> customSections(Module module, USVString sectionName); + static sequence<ModuleExportDescriptor> exports(Module moduleObject); + static sequence<ModuleImportDescriptor> imports(Module moduleObject); + static sequence<ArrayBuffer> customSections(Module moduleObject, USVString sectionName); }; [LegacyNamespace=WebAssembly, Constructor(Module module, optional object importObject), Exposed=(Window,Worker,Worklet)] @@ -87,7 +87,7 @@ dictionary GlobalDescriptor { boolean mutable = false; }; -[LegacyNamespace=WebAssembly, Constructor(GlobalDescriptor descriptor, optional any value), Exposed=(Window,Worker,Worklet)] +[LegacyNamespace=WebAssembly, Constructor(GlobalDescriptor descriptor, optional any v), Exposed=(Window,Worker,Worklet)] interface Global { any valueOf(); attribute any value; diff --git a/tests/wpt/web-platform-tests/interfaces/webrtc-dscp.idl b/tests/wpt/web-platform-tests/interfaces/webrtc-dscp.idl new file mode 100644 index 00000000000..718447bbf4a --- /dev/null +++ b/tests/wpt/web-platform-tests/interfaces/webrtc-dscp.idl @@ -0,0 +1,8 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content was automatically extracted by Reffy into reffy-reports +// (https://github.com/tidoust/reffy-reports) +// Source: DSCP Control API (https://w3c.github.io/webrtc-dscp-exp/) + +partial dictionary RTCRtpEncodingParameters { + RTCPriorityType networkPriority; // Note: No default +}; diff --git a/tests/wpt/web-platform-tests/resources/test/tests/functional/promise.html b/tests/wpt/web-platform-tests/resources/test/tests/functional/promise.html index bdf6dc3ec2a..9db1dec0f9e 100644 --- a/tests/wpt/web-platform-tests/resources/test/tests/functional/promise.html +++ b/tests/wpt/web-platform-tests/resources/test/tests/functional/promise.html @@ -100,12 +100,16 @@ promise_test( function() { return true; }, - "promise_test with function that doesn't return a Promise"); + "promise_test with function that doesn't return a Promise (should FAIL)"); promise_test(function(){}, "promise_test with function that doesn't return anything"); promise_test( + function() { return { then: 23 }; }, + "promise_test that returns a non-thenable (should FAIL)"); + +promise_test( function() { return Promise.reject("Expected rejection"); }, @@ -170,15 +174,21 @@ promise_test( "properties": {} }, { - "status_string": "PASS", - "name": "promise_test with function that doesn't return a Promise", - "message": null, + "status_string": "FAIL", + "name": "promise_test with function that doesn't return a Promise (should FAIL)", + "message": "promise_test: test body must return a 'thenable' object (received an object with no `then` method)", "properties": {} }, { "status_string": "FAIL", "name": "promise_test with function that doesn't return anything", - "message": "assert_not_equals: got disallowed value undefined", + "message": "promise_test: test body must return a 'thenable' object (received undefined)", + "properties": {} + }, + { + "status_string": "FAIL", + "name": "promise_test that returns a non-thenable (should FAIL)", + "message": "promise_test: test body must return a 'thenable' object (received an object with no `then` method)", "properties": {} }, { diff --git a/tests/wpt/web-platform-tests/resources/testharness.js b/tests/wpt/web-platform-tests/resources/testharness.js index f0c24635017..85e211ff60a 100644 --- a/tests/wpt/web-platform-tests/resources/testharness.js +++ b/tests/wpt/web-platform-tests/resources/testharness.js @@ -576,7 +576,12 @@ policies and contribution forms [3]. var promise = test.step(func, test, test); test.step(function() { - assert_not_equals(promise, undefined); + assert(!!promise, "promise_test", null, + "test body must return a 'thenable' object (received ${value})", + {value:promise}); + assert(typeof promise.then === "function", "promise_test", null, + "test body must return a 'thenable' object (received an object with no `then` method)", + null); }); // Test authors may use the `step` method within a diff --git a/tests/wpt/web-platform-tests/service-workers/service-worker/fetch-event-referrer-policy.https.html b/tests/wpt/web-platform-tests/service-workers/service-worker/fetch-event-referrer-policy.https.html index 9b67faccac8..73ae123ae4e 100644 --- a/tests/wpt/web-platform-tests/service-workers/service-worker/fetch-event-referrer-policy.https.html +++ b/tests/wpt/web-platform-tests/service-workers/service-worker/fetch-event-referrer-policy.https.html @@ -7,12 +7,19 @@ <script> var worker = 'resources/fetch-event-test-worker.js'; +function do_test(referrer, value, expected, name) +{ + test(() => { + assert_equals(value, expected); + }, name + (referrer ? " - Custom Referrer" : " - Default Referrer")); +} + function run_referrer_policy_tests(frame, referrer, href, origin) { return frame.contentWindow.fetch('resources/simple.html?referrerFull', {method: "GET", referrer: referrer}) .then(function(response) { return response.text(); }) .then(function(response_text) { - assert_equals( + do_test(referrer, response_text, 'Referrer: ' + href + '\n' + 'ReferrerPolicy: no-referrer-when-downgrade', @@ -24,7 +31,7 @@ function run_referrer_policy_tests(frame, referrer, href, origin) { }) .then(function(response) { return response.text(); }) .then(function(response_text) { - assert_equals( + do_test(referrer, response_text, 'Referrer: \n' + 'ReferrerPolicy: no-referrer-when-downgrade', @@ -34,7 +41,7 @@ function run_referrer_policy_tests(frame, referrer, href, origin) { }) .then(function(response) { return response.text(); }) .then(function(response_text) { - assert_equals( + do_test(referrer, response_text, 'Referrer: ' + href + '\n' + 'ReferrerPolicy: no-referrer-when-downgrade', @@ -46,7 +53,7 @@ function run_referrer_policy_tests(frame, referrer, href, origin) { }) .then(function(response) { return response.text(); }) .then(function(response_text) { - assert_equals( + do_test(referrer, response_text, 'Referrer: \n' + 'ReferrerPolicy: no-referrer-when-downgrade', @@ -56,7 +63,7 @@ function run_referrer_policy_tests(frame, referrer, href, origin) { }) .then(function(response) { return response.text(); }) .then(function(response_text) { - assert_equals( + do_test(referrer, response_text, 'Referrer: ' + origin + '/' + '\n' + 'ReferrerPolicy: origin', @@ -68,7 +75,7 @@ function run_referrer_policy_tests(frame, referrer, href, origin) { }) .then(function(response) { return response.text(); }) .then(function(response_text) { - assert_equals( + do_test(referrer, response_text, 'Referrer: ' + origin + '/' + '\n' + 'ReferrerPolicy: origin', @@ -78,7 +85,7 @@ function run_referrer_policy_tests(frame, referrer, href, origin) { }) .then(function(response) { return response.text(); }) .then(function(response_text) { - assert_equals( + do_test(referrer, response_text, 'Referrer: ' + href + '\n' + 'ReferrerPolicy: origin-when-cross-origin', @@ -90,7 +97,7 @@ function run_referrer_policy_tests(frame, referrer, href, origin) { }) .then(function(response) { return response.text(); }) .then(function(response_text) { - assert_equals( + do_test(referrer, response_text, 'Referrer: ' + origin + '/' + '\n' + 'ReferrerPolicy: origin-when-cross-origin', @@ -100,7 +107,7 @@ function run_referrer_policy_tests(frame, referrer, href, origin) { }) .then(function(response) { return response.text(); }) .then(function(response_text) { - assert_equals( + do_test(referrer, response_text, 'Referrer: ' + href + '\n' + 'ReferrerPolicy: no-referrer-when-downgrade', @@ -112,7 +119,7 @@ function run_referrer_policy_tests(frame, referrer, href, origin) { }) .then(function(response) { return response.text(); }) .then(function(response_text) { - assert_equals( + do_test(referrer, response_text, 'Referrer: \n' + 'ReferrerPolicy: no-referrer-when-downgrade', @@ -123,7 +130,7 @@ function run_referrer_policy_tests(frame, referrer, href, origin) { }) .then(function(response) { return response.text(); }) .then(function(response_text) { - assert_equals( + do_test(referrer, response_text, 'Referrer: ' + href + '\n' + 'ReferrerPolicy: unsafe-url', @@ -133,7 +140,7 @@ function run_referrer_policy_tests(frame, referrer, href, origin) { }) .then(function(response) { return response.text(); }) .then(function(response_text) { - assert_equals( + do_test(referrer, response_text, 'Referrer: \n' + 'ReferrerPolicy: no-referrer', @@ -143,7 +150,7 @@ function run_referrer_policy_tests(frame, referrer, href, origin) { }) .then(function(response) { return response.text(); }) .then(function(response_text) { - assert_equals( + do_test(referrer, response_text, 'Referrer: ' + href + '\n' + 'ReferrerPolicy: same-origin', @@ -155,7 +162,7 @@ function run_referrer_policy_tests(frame, referrer, href, origin) { }) .then(function(response) { return response.text(); }) .then(function(response_text) { - assert_equals( + do_test(referrer, response_text, 'Referrer: \n' + 'ReferrerPolicy: same-origin', @@ -167,7 +174,7 @@ function run_referrer_policy_tests(frame, referrer, href, origin) { }) .then(function(response) { return response.text(); }) .then(function(response_text) { - assert_equals( + do_test(referrer, response_text, 'Referrer: ' + origin + '/' + '\n' + 'ReferrerPolicy: strict-origin', @@ -177,7 +184,7 @@ function run_referrer_policy_tests(frame, referrer, href, origin) { }) .then(function(response) { return response.text(); }) .then(function(response_text) { - assert_equals( + do_test(referrer, response_text, 'Referrer: ' + origin + '/' + '\n' + 'ReferrerPolicy: strict-origin', @@ -189,7 +196,7 @@ function run_referrer_policy_tests(frame, referrer, href, origin) { }) .then(function(response) { return response.text(); }) .then(function(response_text) { - assert_equals( + do_test(referrer, response_text, 'Referrer: \n' + 'ReferrerPolicy: strict-origin', @@ -199,7 +206,7 @@ function run_referrer_policy_tests(frame, referrer, href, origin) { }) .then(function(response) { return response.text(); }) .then(function(response_text) { - assert_equals( + do_test(referrer, response_text, 'Referrer: ' + href + '\n' + 'ReferrerPolicy: strict-origin-when-cross-origin', @@ -211,7 +218,7 @@ function run_referrer_policy_tests(frame, referrer, href, origin) { }) .then(function(response) { return response.text(); }) .then(function(response_text) { - assert_equals( + do_test(referrer, response_text, 'Referrer: ' + origin + '/' + '\n' + 'ReferrerPolicy: strict-origin-when-cross-origin', @@ -223,7 +230,7 @@ function run_referrer_policy_tests(frame, referrer, href, origin) { }) .then(function(response) { return response.text(); }) .then(function(response_text) { - assert_equals( + do_test(referrer, response_text, 'Referrer: \n' + 'ReferrerPolicy: strict-origin-when-cross-origin', @@ -241,17 +248,16 @@ async_test(function(t) { .then(function() { return with_iframe(scope); }) .then(function(f) { frame = f; - assert_equals( - frame.contentDocument.body.textContent, - 'ReferrerPolicy: no-referrer-when-downgrade', - 'Service Worker should respond to fetch with the default referrer policy'); + test(() => { + assert_equals(frame.contentDocument.body.textContent, 'ReferrerPolicy: no-referrer-when-downgrade'); + }, 'Service Worker should respond to fetch with the default referrer policy'); // First, run the referrer policy tests without passing a referrer in RequestInit. return run_referrer_policy_tests(frame, undefined, frame.contentDocument.location.href, frame.contentDocument.location.origin); }) .then(function() { // Now, run the referrer policy tests while passing a referrer in RequestInit. - var referrer = get_host_info()['HTTPS_ORIGIN'] + base_path() + 'fake-referrer'; + var referrer = get_host_info()['HTTPS_ORIGIN'] + base_path() + 'resources/fake-referrer'; return run_referrer_policy_tests(frame, 'fake-referrer', referrer, frame.contentDocument.location.origin); }) diff --git a/tests/wpt/web-platform-tests/shadow-dom/Extensions-to-Event-Interface.html b/tests/wpt/web-platform-tests/shadow-dom/Extensions-to-Event-Interface.html index 52cda0b6bb8..806d539cad4 100644 --- a/tests/wpt/web-platform-tests/shadow-dom/Extensions-to-Event-Interface.html +++ b/tests/wpt/web-platform-tests/shadow-dom/Extensions-to-Event-Interface.html @@ -54,7 +54,7 @@ function testComposedEvent(mode) { var expectedPath = ['A1a', 'A1-SR', 'A1', 'A-SR', 'A']; assert_array_equals(log.eventPath, expectedPath); - assert_array_equals(log.eventPath.length, log.pathAtTargets.length); + assert_equals(log.eventPath.length, log.pathAtTargets.length); assert_array_equals(log.pathAtTargets[0], expectedPath); assert_array_equals(log.pathAtTargets[1], expectedPath); assert_array_equals(log.pathAtTargets[2], mode == 'open' ? expectedPath : ['A1', 'A-SR', 'A'], @@ -82,7 +82,7 @@ function testNonComposedEvent(mode) { var expectedPath = ['A1a', 'A1-SR']; assert_array_equals(log.eventPath, expectedPath); - assert_array_equals(log.eventPath.length, log.pathAtTargets.length); + assert_equals(log.eventPath.length, log.pathAtTargets.length); assert_array_equals(log.pathAtTargets[0], expectedPath); assert_array_equals(log.pathAtTargets[1], expectedPath); }, 'The event must not propagate out of ' + mode + ' mode shadow boundaries when the composed flag is unset'); @@ -108,7 +108,7 @@ function testNonComposedEventWithRelatedTarget(mode) { var expectedPath = ['A1a', 'A1-SR']; assert_array_equals(log.eventPath, expectedPath); - assert_array_equals(log.eventPath.length, log.pathAtTargets.length); + assert_equals(log.eventPath.length, log.pathAtTargets.length); assert_array_equals(log.pathAtTargets[0], expectedPath); assert_array_equals(log.pathAtTargets[1], expectedPath); assert_array_equals(log.relatedTargets, ['A2-S', 'A2-S']); @@ -136,7 +136,7 @@ function testScopedEventWithUnscopedRelatedTargetThroughSlot(mode) { var expectedPath = ['B1a', 'B1c-S', 'B1-SR', 'B1', 'B-SR']; var pathExposedToB1a = ['B1a', 'B1', 'B-SR']; assert_array_equals(log.eventPath, expectedPath); - assert_array_equals(log.eventPath.length, log.pathAtTargets.length); + assert_equals(log.eventPath.length, log.pathAtTargets.length); assert_array_equals(log.pathAtTargets[0], mode == 'open' ? expectedPath : pathExposedToB1a); assert_array_equals(log.pathAtTargets[1], expectedPath); assert_array_equals(log.pathAtTargets[2], expectedPath); @@ -167,7 +167,7 @@ function testComposedEventWithRelatedTarget(mode) { var expectedPath = ['A1a', 'A1-SR', 'A1', 'A-SR']; var pathExposedToA1 = ['A1', 'A-SR']; assert_array_equals(log.eventPath, expectedPath); - assert_array_equals(log.eventPath.length, log.pathAtTargets.length); + assert_equals(log.eventPath.length, log.pathAtTargets.length); assert_array_equals(log.pathAtTargets[0], expectedPath); assert_array_equals(log.pathAtTargets[1], expectedPath); assert_array_equals(log.pathAtTargets[2], mode == 'open' ? expectedPath : pathExposedToA1); @@ -202,7 +202,7 @@ function testComposedEventThroughSlot(mode) { var pathExposedToA1 = [ 'B', 'A2-S', 'A-SR', 'A']; assert_array_equals(log.eventPath, expectedPath); - assert_array_equals(log.eventPath.length, log.pathAtTargets.length); + assert_equals(log.eventPath.length, log.pathAtTargets.length); assert_array_equals(log.pathAtTargets[0], mode == 'open' ? expectedPath : pathExposedToB1a); assert_array_equals(log.pathAtTargets[1], mode == 'open' ? expectedPath : pathExposedToB1cS); assert_array_equals(log.pathAtTargets[2], mode == 'open' ? expectedPath : pathExposedToB1cS); diff --git a/tests/wpt/web-platform-tests/shadow-dom/leaktests/get-elements.html b/tests/wpt/web-platform-tests/shadow-dom/leaktests/get-elements.html index 2ce916a650e..40fa9b69314 100644 --- a/tests/wpt/web-platform-tests/shadow-dom/leaktests/get-elements.html +++ b/tests/wpt/web-platform-tests/shadow-dom/leaktests/get-elements.html @@ -85,12 +85,12 @@ test(function() { assert_equals(doc.querySelectorAll('.bar').length, 1); assert_equals(doc.getElementsByClassName('bar')[0].getAttribute('label'), 'doc-div'); - assert_array_equals(hostOpen.querySelectorAll('.bar').length, 0); + assert_equals(hostOpen.querySelectorAll('.bar').length, 0); assert_equals(shadowOpen.querySelectorAll('.bar').length, 1); assert_equals(shadowOpen.querySelectorAll('.bar')[0].getAttribute('label'), 'shadow-open-div'); - assert_array_equals(hostClosed.querySelectorAll('.bar').length, 0); + assert_equals(hostClosed.querySelectorAll('.bar').length, 0); assert_equals(shadowClosed.querySelectorAll('.bar').length, 1); assert_equals(shadowClosed.querySelectorAll('.bar')[0].getAttribute('label'), 'shadow-closed-div'); @@ -106,11 +106,11 @@ test(function() { assert_equals(doc.querySelectorAll('[name=baz]').length, 1); - assert_array_equals(hostOpen.querySelectorAll('[name=baz]').length, 0); + assert_equals(hostOpen.querySelectorAll('[name=baz]').length, 0); assert_equals(shadowOpen.querySelectorAll('[name=baz]').length, 1); assert_equals(shadowOpen.querySelectorAll('[name=baz]')[0].getAttribute('label'), 'shadow-open-form'); - assert_array_equals(hostClosed.querySelectorAll('[name=baz]').length, 0); + assert_equals(hostClosed.querySelectorAll('[name=baz]').length, 0); assert_equals(shadowClosed.querySelectorAll('[name=baz]').length, 1); assert_equals(shadowClosed.querySelectorAll('[name=baz]')[0].getAttribute('label'), 'shadow-closed-form'); }, 'getElementsByName() should not leak nodes in shadow tree'); @@ -126,12 +126,12 @@ test(function() { assert_equals(doc.querySelectorAll('my-element').length, 1); assert_equals(doc.getElementsByTagName('my-element')[0].getAttribute('label'), 'doc-my-element'); - assert_array_equals(hostOpen.querySelectorAll('my-element').length, 0); + assert_equals(hostOpen.querySelectorAll('my-element').length, 0); // ShadowRoot isn't an Element, does not have getElementsByTagName(). assert_equals(shadowOpen.querySelectorAll('my-element').length, 1); assert_equals(shadowOpen.querySelectorAll('my-element')[0].getAttribute('label'), 'shadow-open-my-element'); - assert_array_equals(hostClosed.querySelectorAll('my-element').length, 0); + assert_equals(hostClosed.querySelectorAll('my-element').length, 0); assert_equals(shadowClosed.querySelectorAll('my-element').length, 1); assert_equals(shadowClosed.querySelectorAll('my-element')[0].getAttribute('label'), 'shadow-closed-my-element'); }, 'getElementsByTagName() should not leak nodes in shadow tree'); diff --git a/tests/wpt/web-platform-tests/svg/path/property/d-interpolation-discrete.svg b/tests/wpt/web-platform-tests/svg/path/property/d-interpolation-discrete.svg index aa9087395fb..5b20a589bb5 100644 --- a/tests/wpt/web-platform-tests/svg/path/property/d-interpolation-discrete.svg +++ b/tests/wpt/web-platform-tests/svg/path/property/d-interpolation-discrete.svg @@ -17,27 +17,27 @@ // Distinct number of path segments test_no_interpolation({ property: 'd', - from: "path('M 0 0 H 1 H 2')", - to: "path('M 0 0 H 3')" + from: 'path("M 0 0 H 1 H 2")', + to: 'path("M 0 0 H 3")' }); test_no_interpolation({ property: 'd', - from: "path('M 1 2 L 3 4 Z')", + from: 'path("M 1 2 L 3 4 Z")', to: "none" }); // Distinct segment types test_no_interpolation({ property: 'd', - from: "path('M 10 0 H 11')", - to: "path('M 20 0 V 2')" + from: 'path("M 10 0 H 11")', + to: 'path("M 20 0 V 2")' }); test_no_interpolation({ property: 'd', - from: "path('M 1 2 L 4 6 Z')", - to: "path('M 1 2 H 4 V 6')" + from: 'path("M 1 2 L 4 6 Z")', + to: 'path("M 1 2 H 4 V 6")' }); ]]></script> </svg> diff --git a/tests/wpt/web-platform-tests/svg/path/property/d-interpolation-relative-absolute.svg b/tests/wpt/web-platform-tests/svg/path/property/d-interpolation-relative-absolute.svg index 65d2f3b2eb6..09d4c70712f 100644 --- a/tests/wpt/web-platform-tests/svg/path/property/d-interpolation-relative-absolute.svg +++ b/tests/wpt/web-platform-tests/svg/path/property/d-interpolation-relative-absolute.svg @@ -17,106 +17,106 @@ // Mix relative and non-relative test_interpolation({ property: 'd', - from: "path('M 0 0 L 100 100 M 100 200 L 200 200 Z L 200 100 Z')", - to: "path('M 0 0 L 100 100 m 0 100 l 100 0 z l 300 100 z')" + from: 'path("M 0 0 L 100 100 M 100 200 L 200 200 Z L 200 100 Z")', + to: 'path("M 0 0 L 100 100 m 0 100 l 100 0 z l 300 100 z")' }, [ - {at: -1, expect: "path('M 0 0 L 100 100 M 100 200 L 200 200 Z L 0 -100 Z')"}, - {at: 0, expect: "path('M 0 0 L 100 100 M 100 200 L 200 200 Z L 200 100 Z')"}, - {at: 0.125, expect: "path('M 0 0 L 100 100 M 100 200 L 200 200 Z L 225 125 Z')"}, - {at: 0.875, expect: "path('M 0 0 L 100 100 M 100 200 L 200 200 Z L 375 275 Z')"}, - {at: 1, expect: "path('M 0 0 L 100 100 M 100 200 L 200 200 Z L 400 300 Z')"}, - {at: 2, expect: "path('M 0 0 L 100 100 M 100 200 L 200 200 Z L 600 500 Z')"}, + {at: -1, expect: 'path("M 0 0 L 100 100 M 100 200 L 200 200 Z L 0 -100 Z")'}, + {at: 0, expect: 'path("M 0 0 L 100 100 M 100 200 L 200 200 Z L 200 100 Z")'}, + {at: 0.125, expect: 'path("M 0 0 L 100 100 M 100 200 L 200 200 Z L 225 125 Z")'}, + {at: 0.875, expect: 'path("M 0 0 L 100 100 M 100 200 L 200 200 Z L 375 275 Z")'}, + {at: 1, expect: 'path("M 0 0 L 100 100 M 100 200 L 200 200 Z L 400 300 Z")'}, + {at: 2, expect: 'path("M 0 0 L 100 100 M 100 200 L 200 200 Z L 600 500 Z")'}, ]); test_interpolation({ property: 'd', - from: "path('M 0 0 L 100 100 M 100 200 L 200 200 Z L 200 100 Z')", - to: "path('M 0 0 L 100 100 m 0 100 l 100 0 z l 100 -100 z')" + from: 'path("M 0 0 L 100 100 M 100 200 L 200 200 Z L 200 100 Z")', + to: 'path("M 0 0 L 100 100 m 0 100 l 100 0 z l 100 -100 z")' }, [ - {at: -1, expect: "path('M 0 0 L 100 100 M 100 200 L 200 200 Z L 200 100 Z')"}, - {at: 0, expect: "path('M 0 0 L 100 100 M 100 200 L 200 200 Z L 200 100 Z')"}, - {at: 0.125, expect: "path('M 0 0 L 100 100 M 100 200 L 200 200 Z L 200 100 Z')"}, - {at: 0.875, expect: "path('M 0 0 L 100 100 M 100 200 L 200 200 Z L 200 100 Z')"}, - {at: 1, expect: "path('M 0 0 L 100 100 M 100 200 L 200 200 Z L 200 100 Z')"}, - {at: 2, expect: "path('M 0 0 L 100 100 M 100 200 L 200 200 Z L 200 100 Z')"}, + {at: -1, expect: 'path("M 0 0 L 100 100 M 100 200 L 200 200 Z L 200 100 Z")'}, + {at: 0, expect: 'path("M 0 0 L 100 100 M 100 200 L 200 200 Z L 200 100 Z")'}, + {at: 0.125, expect: 'path("M 0 0 L 100 100 M 100 200 L 200 200 Z L 200 100 Z")'}, + {at: 0.875, expect: 'path("M 0 0 L 100 100 M 100 200 L 200 200 Z L 200 100 Z")'}, + {at: 1, expect: 'path("M 0 0 L 100 100 M 100 200 L 200 200 Z L 200 100 Z")'}, + {at: 2, expect: 'path("M 0 0 L 100 100 M 100 200 L 200 200 Z L 200 100 Z")'}, ]); test_interpolation({ property: 'd', - from: "path('m 10 20 l 40 50 z l 40 60 z m 60 70 l 90 60 z t 70 130')", - to: "path('M 210 220 L 170 190 Z L 90 120 Z M 110 130 L 200 230 Z T 220 220')" + from: 'path("m 10 20 l 40 50 z l 40 60 z m 60 70 l 90 60 z t 70 130")', + to: 'path("M 210 220 L 170 190 Z L 90 120 Z M 110 130 L 200 230 Z T 220 220")' }, [ - {at: -1, expect: "path('M -190 -180 L -70 -50 Z L 10 40 Z M 30 50 L 120 70 Z T 60 220')"}, - {at: 0, expect: "path('M 10 20 L 50 70 Z L 50 80 Z M 70 90 L 160 150 Z T 140 220')"}, - {at: 0.125, expect: "path('M 35 45 L 65 85 Z L 55 85 Z M 75 95 L 165 160 Z T 150 220')"}, - {at: 0.875, expect: "path('M 185 195 L 155 175 Z L 85 115 Z M 105 125 L 195 220 Z T 210 220')"}, - {at: 1, expect: "path('M 210 220 L 170 190 Z L 90 120 Z M 110 130 L 200 230 Z T 220 220')"}, - {at: 2, expect: "path('M 410 420 L 290 310 Z L 130 160 Z M 150 170 L 240 310 Z T 300 220')"} + {at: -1, expect: 'path("M -190 -180 L -70 -50 Z L 10 40 Z M 30 50 L 120 70 Z T 60 220")'}, + {at: 0, expect: 'path("M 10 20 L 50 70 Z L 50 80 Z M 70 90 L 160 150 Z T 140 220")'}, + {at: 0.125, expect: 'path("M 35 45 L 65 85 Z L 55 85 Z M 75 95 L 165 160 Z T 150 220")'}, + {at: 0.875, expect: 'path("M 185 195 L 155 175 Z L 85 115 Z M 105 125 L 195 220 Z T 210 220")'}, + {at: 1, expect: 'path("M 210 220 L 170 190 Z L 90 120 Z M 110 130 L 200 230 Z T 220 220")'}, + {at: 2, expect: 'path("M 410 420 L 290 310 Z L 130 160 Z M 150 170 L 240 310 Z T 300 220")'} ]); test_interpolation({ property: 'd', - from: "path('m 10 20 c 40 50 30 60 80 70 c 120 130 170 140 110 160')", - to: "path('M 130 100 C 130 150 120 160 210 170 C 290 300 340 310 320 330')" + from: 'path("m 10 20 c 40 50 30 60 80 70 c 120 130 170 140 110 160")', + to: 'path("M 130 100 C 130 150 120 160 210 170 C 290 300 340 310 320 330")' }, [ - {at: -1, expect: "path('M -110 -60 C -30 -10 -40 0 -30 10 C 130 140 180 150 80 170')"}, - {at: 0, expect: "path('M 10 20 C 50 70 40 80 90 90 C 210 220 260 230 200 250')"}, - {at: 0.125, expect: "path('M 25 30 C 60 80 50 90 105 100 C 220 230 270 240 215 260')"}, - {at: 0.875, expect: "path('M 115 90 C 120 140 110 150 195 160 C 280 290 330 300 305 320')"}, - {at: 1, expect: "path('M 130 100 C 130 150 120 160 210 170 C 290 300 340 310 320 330')"}, - {at: 2, expect: "path('M 250 180 C 210 230 200 240 330 250 C 370 380 420 390 440 410')"} + {at: -1, expect: 'path("M -110 -60 C -30 -10 -40 0 -30 10 C 130 140 180 150 80 170")'}, + {at: 0, expect: 'path("M 10 20 C 50 70 40 80 90 90 C 210 220 260 230 200 250")'}, + {at: 0.125, expect: 'path("M 25 30 C 60 80 50 90 105 100 C 220 230 270 240 215 260")'}, + {at: 0.875, expect: 'path("M 115 90 C 120 140 110 150 195 160 C 280 290 330 300 305 320")'}, + {at: 1, expect: 'path("M 130 100 C 130 150 120 160 210 170 C 290 300 340 310 320 330")'}, + {at: 2, expect: 'path("M 250 180 C 210 230 200 240 330 250 C 370 380 420 390 440 410")'} ]); test_interpolation({ property: 'd', - from: "path('m 10 20 q 30 60 40 50 q 110 80 90 80')", - to: "path('M 130 100 Q 120 160 130 150 Q 200 150 180 190')" + from: 'path("m 10 20 q 30 60 40 50 q 110 80 90 80")', + to: 'path("M 130 100 Q 120 160 130 150 Q 200 150 180 190")' }, [ - {at: -1, expect: "path('M -110 -60 Q -40 0 -30 -10 Q 120 150 100 110')"}, - {at: 0, expect: "path('M 10 20 Q 40 80 50 70 Q 160 150 140 150')"}, - {at: 0.125, expect: "path('M 25 30 Q 50 90 60 80 Q 165 150 145 155')"}, - {at: 0.875, expect: "path('M 115 90 Q 110 150 120 140 Q 195 150 175 185')"}, - {at: 1, expect: "path('M 130 100 Q 120 160 130 150 Q 200 150 180 190')"}, - {at: 2, expect: "path('M 250 180 Q 200 240 210 230 Q 240 150 220 230')"} + {at: -1, expect: 'path("M -110 -60 Q -40 0 -30 -10 Q 120 150 100 110")'}, + {at: 0, expect: 'path("M 10 20 Q 40 80 50 70 Q 160 150 140 150")'}, + {at: 0.125, expect: 'path("M 25 30 Q 50 90 60 80 Q 165 150 145 155")'}, + {at: 0.875, expect: 'path("M 115 90 Q 110 150 120 140 Q 195 150 175 185")'}, + {at: 1, expect: 'path("M 130 100 Q 120 160 130 150 Q 200 150 180 190")'}, + {at: 2, expect: 'path("M 250 180 Q 200 240 210 230 Q 240 150 220 230")'} ]); test_interpolation({ property: 'd', - from: "path('m 10 20 s 30 60 40 50 s 110 60 90 70')", - to: "path('M 130 140 S 120 160 130 150 S 200 170 140 180')" + from: 'path("m 10 20 s 30 60 40 50 s 110 60 90 70")', + to: 'path("M 130 140 S 120 160 130 150 S 200 170 140 180")' }, [ - {at: -1, expect: "path('M -110 -100 S -40 0 -30 -10 S 120 90 140 100')"}, - {at: 0, expect: "path('M 10 20 S 40 80 50 70 S 160 130 140 140')"}, - {at: 0.125, expect: "path('M 25 35 S 50 90 60 80 S 165 135 140 145')"}, - {at: 0.875, expect: "path('M 115 125 S 110 150 120 140 S 195 165 140 175')"}, - {at: 1, expect: "path('M 130 140 S 120 160 130 150 S 200 170 140 180')"}, - {at: 2, expect: "path('M 250 260 S 200 240 210 230 S 240 210 140 220')"} + {at: -1, expect: 'path("M -110 -100 S -40 0 -30 -10 S 120 90 140 100")'}, + {at: 0, expect: 'path("M 10 20 S 40 80 50 70 S 160 130 140 140")'}, + {at: 0.125, expect: 'path("M 25 35 S 50 90 60 80 S 165 135 140 145")'}, + {at: 0.875, expect: 'path("M 115 125 S 110 150 120 140 S 195 165 140 175")'}, + {at: 1, expect: 'path("M 130 140 S 120 160 130 150 S 200 170 140 180")'}, + {at: 2, expect: 'path("M 250 260 S 200 240 210 230 S 240 210 140 220")'} ]); test_interpolation({ property: 'd', - from: "path('m 10 20 h 30 v 60 h 10 v -10 l 110 60 Z')", - to: "path('M 130 140 H 120 V 160 H 130 V 150 L 200 170 Z')" + from: 'path("m 10 20 h 30 v 60 h 10 v -10 l 110 60 Z")', + to: 'path("M 130 140 H 120 V 160 H 130 V 150 L 200 170 Z")' }, [ - {at: -1, expect: "path('M -110 -100 H -40 V 0 H -30 V -10 L 120 90 Z')"}, - {at: 0, expect: "path('M 10 20 H 40 V 80 H 50 V 70 L 160 130 Z')"}, - {at: 0.125, expect: "path('M 25 35 H 50 V 90 H 60 V 80 L 165 135 Z')"}, - {at: 0.875, expect: "path('M 115 125 H 110 V 150 H 120 V 140 L 195 165 Z')"}, - {at: 1, expect: "path('M 130 140 H 120 V 160 H 130 V 150 L 200 170 Z')"}, - {at: 2, expect: "path('M 250 260 H 200 V 240 H 210 V 230 L 240 210 Z')"} + {at: -1, expect: 'path("M -110 -100 H -40 V 0 H -30 V -10 L 120 90 Z")'}, + {at: 0, expect: 'path("M 10 20 H 40 V 80 H 50 V 70 L 160 130 Z")'}, + {at: 0.125, expect: 'path("M 25 35 H 50 V 90 H 60 V 80 L 165 135 Z")'}, + {at: 0.875, expect: 'path("M 115 125 H 110 V 150 H 120 V 140 L 195 165 Z")'}, + {at: 1, expect: 'path("M 130 140 H 120 V 160 H 130 V 150 L 200 170 Z")'}, + {at: 2, expect: 'path("M 250 260 H 200 V 240 H 210 V 230 L 240 210 Z")'} ]); test_interpolation({ property: 'd', - from: "path('m 10 20 a 10 20 30 1 0 40 50 a 110 120 30 1 1 140 50')", - to: "path('M 18 12 A 50 100 70 0 1 90 110 A 150 160 70 0 1 70 80')" + from: 'path("m 10 20 a 10 20 30 1 0 40 50 a 110 120 30 1 1 140 50")', + to: 'path("M 18 12 A 50 100 70 0 1 90 110 A 150 160 70 0 1 70 80")' }, [ - {at: -1, expect: "path('M 2 28 A -30 -60 -10 1 0 10 30 A 70 80 -10 1 1 310 160')"}, - {at: 0, expect: "path('M 10 20 A 10 20 30 1 0 50 70 A 110 120 30 1 1 190 120')"}, - {at: 0.125, expect: "path('M 11 19 A 15 30 35 1 0 55 75 A 115 125 35 1 1 175 115')"}, - {at: 0.875, expect: "path('M 17 13 A 45 90 65 0 1 85 105 A 145 155 65 0 1 85 85')"}, - {at: 1, expect: "path('M 18 12 A 50 100 70 0 1 90 110 A 150 160 70 0 1 70 80')"}, - {at: 2, expect: "path('M 26 4 A 90 180 110 0 1 130 150 A 190 200 110 0 1 -50 40')"} + {at: -1, expect: 'path("M 2 28 A -30 -60 -10 1 0 10 30 A 70 80 -10 1 1 310 160")'}, + {at: 0, expect: 'path("M 10 20 A 10 20 30 1 0 50 70 A 110 120 30 1 1 190 120")'}, + {at: 0.125, expect: 'path("M 11 19 A 15 30 35 1 0 55 75 A 115 125 35 1 1 175 115")'}, + {at: 0.875, expect: 'path("M 17 13 A 45 90 65 0 1 85 105 A 145 155 65 0 1 85 85")'}, + {at: 1, expect: 'path("M 18 12 A 50 100 70 0 1 90 110 A 150 160 70 0 1 70 80")'}, + {at: 2, expect: 'path("M 26 4 A 90 180 110 0 1 130 150 A 190 200 110 0 1 -50 40")'} ]); ]]></script> </svg> diff --git a/tests/wpt/web-platform-tests/svg/path/property/d-interpolation-single.svg b/tests/wpt/web-platform-tests/svg/path/property/d-interpolation-single.svg index 25c523168a7..107b607beca 100644 --- a/tests/wpt/web-platform-tests/svg/path/property/d-interpolation-single.svg +++ b/tests/wpt/web-platform-tests/svg/path/property/d-interpolation-single.svg @@ -17,229 +17,229 @@ // Exercise each segment type test_interpolation({ property: 'd', - from: "path('M 20 70')", - to: "path('M 100 30')" + from: 'path("M 20 70")', + to: 'path("M 100 30")' }, [ - {at: -1, expect: "path('M -60 110')"}, - {at: 0, expect: "path('M 20 70')"}, - {at: 0.125, expect: "path('M 30 65')"}, - {at: 0.875, expect: "path('M 90 35')"}, - {at: 1, expect: "path('M 100 30')"}, - {at: 2, expect: "path('M 180 -10')"} + {at: -1, expect: 'path("M -60 110")'}, + {at: 0, expect: 'path("M 20 70")'}, + {at: 0.125, expect: 'path("M 30 65")'}, + {at: 0.875, expect: 'path("M 90 35")'}, + {at: 1, expect: 'path("M 100 30")'}, + {at: 2, expect: 'path("M 180 -10")'} ]); test_interpolation({ property: 'd', - from: "path('m 20 70')", - to: "path('m 100 30')" + from: 'path("m 20 70")', + to: 'path("m 100 30")' }, [ - {at: -1, expect: "path('M -60 110')"}, - {at: 0, expect: "path('M 20 70')"}, - {at: 0.125, expect: "path('M 30 65')"}, - {at: 0.875, expect: "path('M 90 35')"}, - {at: 1, expect: "path('M 100 30')"}, - {at: 2, expect: "path('M 180 -10')"} + {at: -1, expect: 'path("M -60 110")'}, + {at: 0, expect: 'path("M 20 70")'}, + {at: 0.125, expect: 'path("M 30 65")'}, + {at: 0.875, expect: 'path("M 90 35")'}, + {at: 1, expect: 'path("M 100 30")'}, + {at: 2, expect: 'path("M 180 -10")'} ]); test_interpolation({ property: 'd', - from: "path('m 100 200 L 120 270')", - to: "path('m 100 200 L 200 230')" + from: 'path("m 100 200 L 120 270")', + to: 'path("m 100 200 L 200 230")' }, [ - {at: -1, expect: "path('M 100 200 L 40 310')"}, - {at: 0, expect: "path('M 100 200 L 120 270')"}, - {at: 0.125, expect: "path('M 100 200 L 130 265')"}, - {at: 0.875, expect: "path('M 100 200 L 190 235')"}, - {at: 1, expect: "path('M 100 200 L 200 230')"}, - {at: 2, expect: "path('M 100 200 L 280 190')"} + {at: -1, expect: 'path("M 100 200 L 40 310")'}, + {at: 0, expect: 'path("M 100 200 L 120 270")'}, + {at: 0.125, expect: 'path("M 100 200 L 130 265")'}, + {at: 0.875, expect: 'path("M 100 200 L 190 235")'}, + {at: 1, expect: 'path("M 100 200 L 200 230")'}, + {at: 2, expect: 'path("M 100 200 L 280 190")'} ]); test_interpolation({ property: 'd', - from: "path('m 100 200 l 20 70')", - to: "path('m 100 200 l 100 30')" + from: 'path("m 100 200 l 20 70")', + to: 'path("m 100 200 l 100 30")' }, [ - {at: -1, expect: "path('M 100 200 L 40 310')"}, - {at: 0, expect: "path('M 100 200 L 120 270')"}, - {at: 0.125, expect: "path('M 100 200 L 130 265')"}, - {at: 0.875, expect: "path('M 100 200 L 190 235')"}, - {at: 1, expect: "path('M 100 200 L 200 230')"}, - {at: 2, expect: "path('M 100 200 L 280 190')"} + {at: -1, expect: 'path("M 100 200 L 40 310")'}, + {at: 0, expect: 'path("M 100 200 L 120 270")'}, + {at: 0.125, expect: 'path("M 100 200 L 130 265")'}, + {at: 0.875, expect: 'path("M 100 200 L 190 235")'}, + {at: 1, expect: 'path("M 100 200 L 200 230")'}, + {at: 2, expect: 'path("M 100 200 L 280 190")'} ]); test_interpolation({ property: 'd', - from: "path('M 20 10 C 32 42 52 62 120 2200')", - to: "path('M 20 10 C 40 50 60 70 200 3000')", + from: 'path("M 20 10 C 32 42 52 62 120 2200")', + to: 'path("M 20 10 C 40 50 60 70 200 3000")', }, [ - {at: -1, expect: "path('M 20 10 C 24 34 44 54 40 1400')"}, - {at: 0, expect: "path('M 20 10 C 32 42 52 62 120 2200')"}, - {at: 0.125, expect: "path('M 20 10 C 33 43 53 63 130 2300')"}, - {at: 0.875, expect: "path('M 20 10 C 39 49 59 69 190 2900')"}, - {at: 1, expect: "path('M 20 10 C 40 50 60 70 200 3000')"}, - {at: 2, expect: "path('M 20 10 C 48 58 68 78 280 3800')"} + {at: -1, expect: 'path("M 20 10 C 24 34 44 54 40 1400")'}, + {at: 0, expect: 'path("M 20 10 C 32 42 52 62 120 2200")'}, + {at: 0.125, expect: 'path("M 20 10 C 33 43 53 63 130 2300")'}, + {at: 0.875, expect: 'path("M 20 10 C 39 49 59 69 190 2900")'}, + {at: 1, expect: 'path("M 20 10 C 40 50 60 70 200 3000")'}, + {at: 2, expect: 'path("M 20 10 C 48 58 68 78 280 3800")'} ]); test_interpolation({ property: 'd', - from: "path('m 20 10 c 12 32 32 52 100 2190')", - to: "path('m 20 10 c 20 40 40 60 180 2990')" + from: 'path("m 20 10 c 12 32 32 52 100 2190")', + to: 'path("m 20 10 c 20 40 40 60 180 2990")' }, [ - {at: -1, expect: "path('M 20 10 C 24 34 44 54 40 1400')"}, - {at: 0, expect: "path('M 20 10 C 32 42 52 62 120 2200')"}, - {at: 0.125, expect: "path('M 20 10 C 33 43 53 63 130 2300')"}, - {at: 0.875, expect: "path('M 20 10 C 39 49 59 69 190 2900')"}, - {at: 1, expect: "path('M 20 10 C 40 50 60 70 200 3000')"}, - {at: 2, expect: "path('M 20 10 C 48 58 68 78 280 3800')"} + {at: -1, expect: 'path("M 20 10 C 24 34 44 54 40 1400")'}, + {at: 0, expect: 'path("M 20 10 C 32 42 52 62 120 2200")'}, + {at: 0.125, expect: 'path("M 20 10 C 33 43 53 63 130 2300")'}, + {at: 0.875, expect: 'path("M 20 10 C 39 49 59 69 190 2900")'}, + {at: 1, expect: 'path("M 20 10 C 40 50 60 70 200 3000")'}, + {at: 2, expect: 'path("M 20 10 C 48 58 68 78 280 3800")'} ]); test_interpolation({ property: 'd', - from: "path('M 20 10 Q 32 42 120 2200')", - to: "path('M 20 10 Q 40 50 200 3000')" + from: 'path("M 20 10 Q 32 42 120 2200")', + to: 'path("M 20 10 Q 40 50 200 3000")' }, [ - {at: -1, expect: "path('M 20 10 Q 24 34 40 1400')"}, - {at: 0, expect: "path('M 20 10 Q 32 42 120 2200')"}, - {at: 0.125, expect: "path('M 20 10 Q 33 43 130 2300')"}, - {at: 0.875, expect: "path('M 20 10 Q 39 49 190 2900')"}, - {at: 1, expect: "path('M 20 10 Q 40 50 200 3000')"}, - {at: 2, expect: "path('M 20 10 Q 48 58 280 3800')"} + {at: -1, expect: 'path("M 20 10 Q 24 34 40 1400")'}, + {at: 0, expect: 'path("M 20 10 Q 32 42 120 2200")'}, + {at: 0.125, expect: 'path("M 20 10 Q 33 43 130 2300")'}, + {at: 0.875, expect: 'path("M 20 10 Q 39 49 190 2900")'}, + {at: 1, expect: 'path("M 20 10 Q 40 50 200 3000")'}, + {at: 2, expect: 'path("M 20 10 Q 48 58 280 3800")'} ]); test_interpolation({ property: 'd', - from: "path('m 20 10 q 12 32 100 2190')", - to: "path('m 20 10 q 20 40 180 2990')" + from: 'path("m 20 10 q 12 32 100 2190")', + to: 'path("m 20 10 q 20 40 180 2990")' }, [ - {at: -1, expect: "path('M 20 10 Q 24 34 40 1400')"}, - {at: 0, expect: "path('M 20 10 Q 32 42 120 2200')"}, - {at: 0.125, expect: "path('M 20 10 Q 33 43 130 2300')"}, - {at: 0.875, expect: "path('M 20 10 Q 39 49 190 2900')"}, - {at: 1, expect: "path('M 20 10 Q 40 50 200 3000')"}, - {at: 2, expect: "path('M 20 10 Q 48 58 280 3800')"} + {at: -1, expect: 'path("M 20 10 Q 24 34 40 1400")'}, + {at: 0, expect: 'path("M 20 10 Q 32 42 120 2200")'}, + {at: 0.125, expect: 'path("M 20 10 Q 33 43 130 2300")'}, + {at: 0.875, expect: 'path("M 20 10 Q 39 49 190 2900")'}, + {at: 1, expect: 'path("M 20 10 Q 40 50 200 3000")'}, + {at: 2, expect: 'path("M 20 10 Q 48 58 280 3800")'} ]); test_interpolation({ property: 'd', - from: "path('M 100 400 A 10 20 30 1 0 140 450')", - to: "path('M 300 200 A 50 60 70 0 1 380 290')" + from: 'path("M 100 400 A 10 20 30 1 0 140 450")', + to: 'path("M 300 200 A 50 60 70 0 1 380 290")' }, [ - {at: -1, expect: "path('M -100 600 A -30 -20 -10 1 0 -100 610')"}, - {at: 0, expect: "path('M 100 400 A 10 20 30 1 0 140 450')"}, - {at: 0.125, expect: "path('M 125 375 A 15 25 35 1 0 170 430')"}, - {at: 0.875, expect: "path('M 275 225 A 45 55 65 0 1 350 310')"}, - {at: 1, expect: "path('M 300 200 A 50 60 70 0 1 380 290')"}, - {at: 2, expect: "path('M 500 0 A 90 100 110 0 1 620 130')"} + {at: -1, expect: 'path("M -100 600 A -30 -20 -10 1 0 -100 610")'}, + {at: 0, expect: 'path("M 100 400 A 10 20 30 1 0 140 450")'}, + {at: 0.125, expect: 'path("M 125 375 A 15 25 35 1 0 170 430")'}, + {at: 0.875, expect: 'path("M 275 225 A 45 55 65 0 1 350 310")'}, + {at: 1, expect: 'path("M 300 200 A 50 60 70 0 1 380 290")'}, + {at: 2, expect: 'path("M 500 0 A 90 100 110 0 1 620 130")'} ]); test_interpolation({ property: 'd', - from: "path('m 100 400 a 10 20 30 1 0 40 50')", - to: "path('m 300 200 a 50 60 70 0 1 80 90')" + from: 'path("m 100 400 a 10 20 30 1 0 40 50")', + to: 'path("m 300 200 a 50 60 70 0 1 80 90")' }, [ - {at: -1, expect: "path('M -100 600 A -30 -20 -10 1 0 -100 610')"}, - {at: 0, expect: "path('M 100 400 A 10 20 30 1 0 140 450')"}, - {at: 0.125, expect: "path('M 125 375 A 15 25 35 1 0 170 430')"}, - {at: 0.875, expect: "path('M 275 225 A 45 55 65 0 1 350 310')"}, - {at: 1, expect: "path('M 300 200 A 50 60 70 0 1 380 290')"}, - {at: 2, expect: "path('M 500 0 A 90 100 110 0 1 620 130')"} + {at: -1, expect: 'path("M -100 600 A -30 -20 -10 1 0 -100 610")'}, + {at: 0, expect: 'path("M 100 400 A 10 20 30 1 0 140 450")'}, + {at: 0.125, expect: 'path("M 125 375 A 15 25 35 1 0 170 430")'}, + {at: 0.875, expect: 'path("M 275 225 A 45 55 65 0 1 350 310")'}, + {at: 1, expect: 'path("M 300 200 A 50 60 70 0 1 380 290")'}, + {at: 2, expect: 'path("M 500 0 A 90 100 110 0 1 620 130")'} ]); test_interpolation({ property: 'd', - from: "path('M 50 60 H 70')", - to: "path('M 10 140 H 270')" + from: 'path("M 50 60 H 70")', + to: 'path("M 10 140 H 270")' }, [ - {at: -1, expect: "path('M 90 -20 H -130')"}, - {at: 0, expect: "path('M 50 60 H 70')"}, - {at: 0.125, expect: "path('M 45 70 H 95')"}, - {at: 0.875, expect: "path('M 15 130 H 245')"}, - {at: 1, expect: "path('M 10 140 H 270')"}, - {at: 2, expect: "path('M -30 220 H 470')"} + {at: -1, expect: 'path("M 90 -20 H -130")'}, + {at: 0, expect: 'path("M 50 60 H 70")'}, + {at: 0.125, expect: 'path("M 45 70 H 95")'}, + {at: 0.875, expect: 'path("M 15 130 H 245")'}, + {at: 1, expect: 'path("M 10 140 H 270")'}, + {at: 2, expect: 'path("M -30 220 H 470")'} ]); test_interpolation({ property: 'd', - from: "path('m 50 60 h 20')", - to: "path('m 10 140 h 260')" + from: 'path("m 50 60 h 20")', + to: 'path("m 10 140 h 260")' }, [ - {at: -1, expect: "path('M 90 -20 H -130')"}, - {at: 0, expect: "path('M 50 60 H 70')"}, - {at: 0.125, expect: "path('M 45 70 H 95')"}, - {at: 0.875, expect: "path('M 15 130 H 245')"}, - {at: 1, expect: "path('M 10 140 H 270')"}, - {at: 2, expect: "path('M -30 220 H 470')"} + {at: -1, expect: 'path("M 90 -20 H -130")'}, + {at: 0, expect: 'path("M 50 60 H 70")'}, + {at: 0.125, expect: 'path("M 45 70 H 95")'}, + {at: 0.875, expect: 'path("M 15 130 H 245")'}, + {at: 1, expect: 'path("M 10 140 H 270")'}, + {at: 2, expect: 'path("M -30 220 H 470")'} ]); test_interpolation({ property: 'd', - from: "path('M 50 60 V 70')", - to: "path('M 10 140 V 270')" + from: 'path("M 50 60 V 70")', + to: 'path("M 10 140 V 270")' }, [ - {at: -1, expect: "path('M 90 -20 V -130')"}, - {at: 0, expect: "path('M 50 60 V 70')"}, - {at: 0.125, expect: "path('M 45 70 V 95')"}, - {at: 0.875, expect: "path('M 15 130 V 245')"}, - {at: 1, expect: "path('M 10 140 V 270')"}, - {at: 2, expect: "path('M -30 220 V 470')"} + {at: -1, expect: 'path("M 90 -20 V -130")'}, + {at: 0, expect: 'path("M 50 60 V 70")'}, + {at: 0.125, expect: 'path("M 45 70 V 95")'}, + {at: 0.875, expect: 'path("M 15 130 V 245")'}, + {at: 1, expect: 'path("M 10 140 V 270")'}, + {at: 2, expect: 'path("M -30 220 V 470")'} ]); test_interpolation({ property: 'd', - from: "path('m 50 60 v 10')", - to: "path('m 10 140 v 130')" + from: 'path("m 50 60 v 10")', + to: 'path("m 10 140 v 130")' }, [ - {at: -1, expect: "path('M 90 -20 V -130')"}, - {at: 0, expect: "path('M 50 60 V 70')"}, - {at: 0.125, expect: "path('M 45 70 V 95')"}, - {at: 0.875, expect: "path('M 15 130 V 245')"}, - {at: 1, expect: "path('M 10 140 V 270')"}, - {at: 2, expect: "path('M -30 220 V 470')"} + {at: -1, expect: 'path("M 90 -20 V -130")'}, + {at: 0, expect: 'path("M 50 60 V 70")'}, + {at: 0.125, expect: 'path("M 45 70 V 95")'}, + {at: 0.875, expect: 'path("M 15 130 V 245")'}, + {at: 1, expect: 'path("M 10 140 V 270")'}, + {at: 2, expect: 'path("M -30 220 V 470")'} ]); test_interpolation({ property: 'd', - from: "path('M 12 34 S 45 67 89 123')", - to: "path('M 20 26 S 61 51 113 99')" + from: 'path("M 12 34 S 45 67 89 123")', + to: 'path("M 20 26 S 61 51 113 99")' }, [ - {at: -1, expect: "path('M 4 42 S 29 83 65 147')"}, - {at: 0, expect: "path('M 12 34 S 45 67 89 123')"}, - {at: 0.125, expect: "path('M 13 33 S 47 65 92 120')"}, - {at: 0.875, expect: "path('M 19 27 S 59 53 110 102')"}, - {at: 1, expect: "path('M 20 26 S 61 51 113 99')"}, - {at: 2, expect: "path('M 28 18 S 77 35 137 75')"}, + {at: -1, expect: 'path("M 4 42 S 29 83 65 147")'}, + {at: 0, expect: 'path("M 12 34 S 45 67 89 123")'}, + {at: 0.125, expect: 'path("M 13 33 S 47 65 92 120")'}, + {at: 0.875, expect: 'path("M 19 27 S 59 53 110 102")'}, + {at: 1, expect: 'path("M 20 26 S 61 51 113 99")'}, + {at: 2, expect: 'path("M 28 18 S 77 35 137 75")'}, ]); test_interpolation({ property: 'd', - from: "path('m 12 34 s 33 33 77 89')", - to: "path('m 20 26 s 41 25 93 73')" + from: 'path("m 12 34 s 33 33 77 89")', + to: 'path("m 20 26 s 41 25 93 73")' }, [ - {at: -1, expect: "path('M 4 42 S 29 83 65 147')"}, - {at: 0, expect: "path('M 12 34 S 45 67 89 123')"}, - {at: 0.125, expect: "path('M 13 33 S 47 65 92 120')"}, - {at: 0.875, expect: "path('M 19 27 S 59 53 110 102')"}, - {at: 1, expect: "path('M 20 26 S 61 51 113 99')"}, - {at: 2, expect: "path('M 28 18 S 77 35 137 75')"}, + {at: -1, expect: 'path("M 4 42 S 29 83 65 147")'}, + {at: 0, expect: 'path("M 12 34 S 45 67 89 123")'}, + {at: 0.125, expect: 'path("M 13 33 S 47 65 92 120")'}, + {at: 0.875, expect: 'path("M 19 27 S 59 53 110 102")'}, + {at: 1, expect: 'path("M 20 26 S 61 51 113 99")'}, + {at: 2, expect: 'path("M 28 18 S 77 35 137 75")'}, ]); test_interpolation({ property: 'd', - from: "path('M 12 34 T 45 67')", - to: "path('M 20 26 T 61 51')" + from: 'path("M 12 34 T 45 67")', + to: 'path("M 20 26 T 61 51")' }, [ - {at: -1, expect: "path('M 4 42 T 29 83')"}, - {at: 0, expect: "path('M 12 34 T 45 67')"}, - {at: 0.125, expect: "path('M 13 33 T 47 65')"}, - {at: 0.875, expect: "path('M 19 27 T 59 53')"}, - {at: 1, expect: "path('M 20 26 T 61 51')"}, - {at: 2, expect: "path('M 28 18 T 77 35')"}, + {at: -1, expect: 'path("M 4 42 T 29 83")'}, + {at: 0, expect: 'path("M 12 34 T 45 67")'}, + {at: 0.125, expect: 'path("M 13 33 T 47 65")'}, + {at: 0.875, expect: 'path("M 19 27 T 59 53")'}, + {at: 1, expect: 'path("M 20 26 T 61 51")'}, + {at: 2, expect: 'path("M 28 18 T 77 35")'}, ]); test_interpolation({ property: 'd', - from: "path('m 12 34 t 33 33')", - to: "path('m 20 26 t 41 25')" + from: 'path("m 12 34 t 33 33")', + to: 'path("m 20 26 t 41 25")' }, [ - {at: -1, expect: "path('M 4 42 T 29 83')"}, - {at: 0, expect: "path('M 12 34 T 45 67')"}, - {at: 0.125, expect: "path('M 13 33 T 47 65')"}, - {at: 0.875, expect: "path('M 19 27 T 59 53')"}, - {at: 1, expect: "path('M 20 26 T 61 51')"}, - {at: 2, expect: "path('M 28 18 T 77 35')"}, + {at: -1, expect: 'path("M 4 42 T 29 83")'}, + {at: 0, expect: 'path("M 12 34 T 45 67")'}, + {at: 0.125, expect: 'path("M 13 33 T 47 65")'}, + {at: 0.875, expect: 'path("M 19 27 T 59 53")'}, + {at: 1, expect: 'path("M 20 26 T 61 51")'}, + {at: 2, expect: 'path("M 28 18 T 77 35")'}, ]); ]]></script> </svg> diff --git a/tests/wpt/web-platform-tests/svg/path/property/getComputedStyle.svg b/tests/wpt/web-platform-tests/svg/path/property/getComputedStyle.svg index af30862781a..5830191931f 100644 --- a/tests/wpt/web-platform-tests/svg/path/property/getComputedStyle.svg +++ b/tests/wpt/web-platform-tests/svg/path/property/getComputedStyle.svg @@ -39,14 +39,14 @@ var p6 = document.getElementById('p6'); var p7 = document.getElementById('p7'); - assert_equals(getComputedStyle(g0).d, "none"); - assert_equals(getComputedStyle(p1).d, "none"); - assert_equals(getComputedStyle(p2).d, "path('M 10 2 H 20')"); - assert_equals(getComputedStyle(p3).d, "path('M 10 3 H 30')"); - assert_equals(getComputedStyle(p4).d, "path('M 10 4 H 40')"); - assert_equals(getComputedStyle(g5).d, "path('M 10 5 H 50')"); - assert_equals(getComputedStyle(p6).d, "path('M 10 5 H 50')"); - assert_equals(getComputedStyle(p7).d, "none"); + assert_equals(getComputedStyle(g0).d, 'none'); + assert_equals(getComputedStyle(p1).d, 'none'); + assert_equals(getComputedStyle(p2).d, 'path("M 10 2 H 20")'); + assert_equals(getComputedStyle(p3).d, 'path("M 10 3 H 30")'); + assert_equals(getComputedStyle(p4).d, 'path("M 10 4 H 40")'); + assert_equals(getComputedStyle(g5).d, 'path("M 10 5 H 50")'); + assert_equals(getComputedStyle(p6).d, 'path("M 10 5 H 50")'); + assert_equals(getComputedStyle(p7).d, 'none'); }); ]]></script> </svg> diff --git a/tests/wpt/web-platform-tests/tools/ci/ci_taskcluster.sh b/tests/wpt/web-platform-tests/tools/ci/ci_taskcluster.sh index 546055293d7..901ae520c7f 100755 --- a/tests/wpt/web-platform-tests/tools/ci/ci_taskcluster.sh +++ b/tests/wpt/web-platform-tests/tools/ci/ci_taskcluster.sh @@ -1,6 +1,8 @@ #!/bin/bash +set -ex -./wpt manifest-download +# This is allowed to fail +./wpt manifest-download || echo if [ $1 == "firefox" ]; then ./wpt run firefox --log-tbpl=../artifacts/log_tbpl.log --log-tbpl-level=info --log-wptreport=../artifacts/wpt_report.json --log-mach=- --this-chunk=$4 --total-chunks=$5 --test-type=$3 -y --install-browser --channel=$2 --no-pause --no-restart-on-unexpected --reftest-internal --install-fonts --no-fail-on-unexpected diff --git a/tests/wpt/web-platform-tests/tools/ci/ci_wptrunner_infrastructure.sh b/tests/wpt/web-platform-tests/tools/ci/ci_wptrunner_infrastructure.sh index d6d6803974f..c32c9438703 100755 --- a/tests/wpt/web-platform-tests/tools/ci/ci_wptrunner_infrastructure.sh +++ b/tests/wpt/web-platform-tests/tools/ci/ci_wptrunner_infrastructure.sh @@ -18,14 +18,14 @@ test_infrastructure() { } main() { - PRODUCTS=( "firefox" "chrome" ) + PRODUCTS=( "firefox" "chrome" "chrome_webdriver" ) for PRODUCT in "${PRODUCTS[@]}"; do if [ "$PRODUCT" != "firefox" ]; then # Firefox is expected to work using pref settings for DNS # Don't adjust the hostnames in that case to ensure this keeps working hosts_fixup fi - if [ "$PRODUCT" == "chrome" ]; then + if [[ "$PRODUCT" == "chrome"* ]]; then install_chrome unstable test_infrastructure "--binary=$(which google-chrome-unstable)" else diff --git a/tests/wpt/web-platform-tests/tools/webdriver/webdriver/error.py b/tests/wpt/web-platform-tests/tools/webdriver/webdriver/error.py index e148e8fe800..23ffc40b31f 100644 --- a/tests/wpt/web-platform-tests/tools/webdriver/webdriver/error.py +++ b/tests/wpt/web-platform-tests/tools/webdriver/webdriver/error.py @@ -6,8 +6,10 @@ class WebDriverException(Exception): http_status = None status_code = None - def __init__(self, message=None, stacktrace=None): + def __init__(self, http_status=None, status_code=None, message=None, stacktrace=None): super(WebDriverException, self) + self.http_status = http_status + self.status_code = status_code self.message = message self.stacktrace = stacktrace @@ -171,6 +173,8 @@ def from_response(response): """ if response.status == 200: raise UnknownErrorException( + response.status, + None, "Response is not an error:\n" "%s" % json.dumps(response.body)) @@ -178,6 +182,8 @@ def from_response(response): value = response.body["value"] else: raise UnknownErrorException( + response.status, + None, "Expected 'value' key in response body:\n" "%s" % json.dumps(response.body)) @@ -187,7 +193,7 @@ def from_response(response): stack = value["stacktrace"] or None cls = get(code) - return cls(message, stacktrace=stack) + return cls(response.status, code, message, stacktrace=stack) def get(error_code): diff --git a/tests/wpt/web-platform-tests/tools/wpt/browser.py b/tests/wpt/web-platform-tests/tools/wpt/browser.py index 65752a25f12..7b943c2e73c 100644 --- a/tests/wpt/web-platform-tests/tools/wpt/browser.py +++ b/tests/wpt/web-platform-tests/tools/wpt/browser.py @@ -486,6 +486,12 @@ class ChromeAndroid(Browser): def version(self, binary): return None +class ChromeWebDriver(Chrome): + """Chrome-specific interface for chrome without using selenium. + + Includes webdriver installation. + """ + product = "chrome_webdriver" class Opera(Browser): """Opera-specific interface. @@ -582,6 +588,10 @@ class Edge(Browser): return None +class EdgeWebDriver(Edge): + product = "edge_webdriver" + + class InternetExplorer(Browser): """Internet Explorer-specific interface.""" @@ -629,6 +639,10 @@ class Safari(Browser): return None +class SafariWebDriver(Safari): + product = "safari_webdriver" + + class Servo(Browser): """Servo-specific interface.""" diff --git a/tests/wpt/web-platform-tests/tools/wpt/run.py b/tests/wpt/web-platform-tests/tools/wpt/run.py index 036c38f2586..a1e5637bf1d 100644 --- a/tests/wpt/web-platform-tests/tools/wpt/run.py +++ b/tests/wpt/web-platform-tests/tools/wpt/run.py @@ -273,6 +273,10 @@ class ChromeAndroid(BrowserSetup): else: raise WptrunError("Unable to locate or install chromedriver binary") +class ChromeWebDriver(Chrome): + name = "chrome_webdriver" + browser_cls = browser.ChromeWebDriver + class Opera(BrowserSetup): name = "opera" @@ -318,6 +322,11 @@ https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ kwargs["webdriver_binary"] = webdriver_binary +class EdgeWebDriver(Edge): + name = "edge_webdriver" + browser_cls = browser.EdgeWebDriver + + class InternetExplorer(BrowserSetup): name = "ie" browser_cls = browser.InternetExplorer @@ -356,6 +365,11 @@ class Safari(BrowserSetup): kwargs["webdriver_binary"] = webdriver_binary +class SafariWebDriver(Safari): + name = "safari_webdriver" + browser_cls = browser.SafariWebDriver + + class Sauce(BrowserSetup): name = "sauce" browser_cls = browser.Sauce @@ -402,9 +416,12 @@ product_setup = { "firefox": Firefox, "chrome": Chrome, "chrome_android": ChromeAndroid, + "chrome_webdriver": ChromeWebDriver, "edge": Edge, + "edge_webdriver": EdgeWebDriver, "ie": InternetExplorer, "safari": Safari, + "safari_webdriver": SafariWebDriver, "servo": Servo, "sauce": Sauce, "opera": Opera, diff --git a/tests/wpt/web-platform-tests/tools/wpt/wpt.py b/tests/wpt/web-platform-tests/tools/wpt/wpt.py index f4eecce22cf..55802461553 100644 --- a/tests/wpt/web-platform-tests/tools/wpt/wpt.py +++ b/tests/wpt/web-platform-tests/tools/wpt/wpt.py @@ -101,9 +101,6 @@ def main(prog=None, argv=None): main_args, command_args = parse_args(argv, commands) - if not(len(argv) and argv[0] in commands): - sys.exit(1) - command = main_args.command props = commands[command] venv = None diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/__init__.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/__init__.py index d8682e16a55..08949f79483 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/__init__.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/__init__.py @@ -24,11 +24,14 @@ module global scope. product_list = ["chrome", "chrome_android", + "chrome_webdriver", "edge", + "edge_webdriver", "fennec", "firefox", "ie", "safari", + "safari_webdriver", "sauce", "servo", "servodriver", diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/base.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/base.py index dc03ef711b6..70324bec31f 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/base.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/base.py @@ -2,12 +2,32 @@ import os import platform import socket from abc import ABCMeta, abstractmethod +from copy import deepcopy from ..wptcommandline import require_arg # noqa: F401 here = os.path.split(__file__)[0] +def inherit(super_module, child_globals, product_name): + super_wptrunner = super_module.__wptrunner__ + child_globals["__wptrunner__"] = child_wptrunner = deepcopy(super_wptrunner) + + child_wptrunner["product"] = product_name + + for k in ("check_args", "browser", "browser_kwargs", "executor_kwargs", + "env_extras", "env_options"): + attr = super_wptrunner[k] + child_globals[attr] = getattr(super_module, attr) + + for v in super_module.__wptrunner__["executor"].values(): + child_globals[v] = getattr(super_module, v) + + if "run_info_extras" in super_wptrunner: + attr = super_wptrunner["run_info_extras"] + child_globals[attr] = getattr(super_module, attr) + + def cmd_arg(name, value=None): prefix = "-" if platform.system() == "Windows" else "--" rv = prefix + name diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/chrome_webdriver.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/chrome_webdriver.py new file mode 100644 index 00000000000..a63460f4544 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/chrome_webdriver.py @@ -0,0 +1,50 @@ +from .base import inherit +from . import chrome + +from ..executors import executor_kwargs as base_executor_kwargs +from ..executors.executorwebdriver import (WebDriverTestharnessExecutor, # noqa: F401 + WebDriverRefTestExecutor) # noqa: F401 + + +inherit(chrome, globals(), "chrome_webdriver") + +# __wptrunner__ magically appears from inherit, F821 is undefined name +__wptrunner__["executor_kwargs"] = "executor_kwargs" # noqa: F821 +__wptrunner__["executor"]["testharness"] = "WebDriverTestharnessExecutor" # noqa: F821 +__wptrunner__["executor"]["reftest"] = "WebDriverRefTestExecutor" # noqa: F821 + + +def executor_kwargs(test_type, server_config, cache_manager, run_info_data, + **kwargs): + executor_kwargs = base_executor_kwargs(test_type, server_config, + cache_manager, run_info_data, + **kwargs) + executor_kwargs["close_after_done"] = True + + capabilities = { + "browserName": "chrome", + "platform": "ANY", + "version": "", + "goog:chromeOptions": { + "prefs": { + "profile": { + "default_content_setting_values": { + "popups": 1 + } + } + }, + "w3c": True + } + } + + for (kwarg, capability) in [("binary", "binary"), ("binary_args", "args")]: + if kwargs[kwarg] is not None: + capabilities["goog:chromeOptions"][capability] = kwargs[kwarg] + + if test_type == "testharness": + capabilities["goog:chromeOptions"]["useAutomationExtension"] = False + capabilities["goog:chromeOptions"]["excludeSwitches"] = ["enable-automation"] + + executor_kwargs["capabilities"] = capabilities + + return executor_kwargs diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/edge_webdriver.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/edge_webdriver.py new file mode 100644 index 00000000000..c2545de46f0 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/edge_webdriver.py @@ -0,0 +1,12 @@ +from .base import inherit +from . import edge + +from ..executors.executorwebdriver import (WebDriverTestharnessExecutor, # noqa: F401 + WebDriverRefTestExecutor) # noqa: F401 + + +inherit(edge, globals(), "edge_webdriver") + +# __wptrunner__ magically appears from inherit, F821 is undefined name +__wptrunner__["executor"]["testharness"] = "WebDriverTestharnessExecutor" # noqa: F821 +__wptrunner__["executor"]["reftest"] = "WebDriverRefTestExecutor" # noqa: F821 diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/safari_webdriver.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/safari_webdriver.py new file mode 100644 index 00000000000..12735c141b3 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/safari_webdriver.py @@ -0,0 +1,12 @@ +from .base import inherit +from . import safari + +from ..executors.executorwebdriver import (WebDriverTestharnessExecutor, # noqa: F401 + WebDriverRefTestExecutor) # noqa: F401 + + +inherit(safari, globals(), "safari_webdriver") + +# __wptrunner__ magically appears from inherit, F821 is undefined name +__wptrunner__["executor"]["testharness"] = "WebDriverTestharnessExecutor" # noqa: F821 +__wptrunner__["executor"]["reftest"] = "WebDriverRefTestExecutor" # noqa: F821 diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/executorselenium.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/executorselenium.py index d9b67968ddf..0675461d5d8 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/executorselenium.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/executorselenium.py @@ -95,14 +95,14 @@ class SeleniumTestharnessProtocolPart(TestharnessProtocolPart): def get_test_window(self, window_id, parent): test_window = None - if window_id: - try: - # Try this, it's in Level 1 but nothing supports it yet - win_s = self.webdriver.execute_script("return window['%s'];" % self.window_id) - win_obj = json.loads(win_s) - test_window = win_obj["window-fcc6-11e5-b4f8-330a88ab9d7f"] - except Exception: - pass + try: + # Try using the JSON serialization of the WindowProxy object, + # it's in Level 1 but nothing supports it yet + win_s = self.webdriver.execute_script("return window['%s'];" % window_id) + win_obj = json.loads(win_s) + test_window = win_obj["window-fcc6-11e5-b4f8-330a88ab9d7f"] + except Exception: + pass if test_window is None: after = self.webdriver.window_handles @@ -296,7 +296,7 @@ class SeleniumTestharnessExecutor(TestharnessExecutor): parent_window = protocol.testharness.close_old_windows() # Now start the test harness protocol.base.execute_script(self.script % format_map) - test_window = protocol.testharness.get_test_window(webdriver, parent_window) + test_window = protocol.testharness.get_test_window(self.window_id, parent_window) handler = CallbackHandler(self.logger, protocol, test_window) while True: diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/executorwebdriver.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/executorwebdriver.py new file mode 100644 index 00000000000..127c909e810 --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/executorwebdriver.py @@ -0,0 +1,373 @@ +import json +import os +import socket +import threading +import traceback +import urlparse +import uuid + +from .base import (CallbackHandler, + RefTestExecutor, + RefTestImplementation, + TestharnessExecutor, + extra_timeout, + strip_server) +from .protocol import (BaseProtocolPart, + TestharnessProtocolPart, + Protocol, + SelectorProtocolPart, + ClickProtocolPart, + SendKeysProtocolPart, + TestDriverProtocolPart) +from ..testrunner import Stop + +import webdriver as client + +here = os.path.join(os.path.split(__file__)[0]) + +class WebDriverBaseProtocolPart(BaseProtocolPart): + def setup(self): + self.webdriver = self.parent.webdriver + + def execute_script(self, script, async=False): + method = self.webdriver.execute_async_script if async else self.webdriver.execute_script + return method(script) + + def set_timeout(self, timeout): + try: + self.webdriver.timeouts.script = timeout + except client.WebDriverException: + # workaround https://bugs.chromium.org/p/chromedriver/issues/detail?id=2057 + body = {"type": "script", "ms": timeout * 1000} + self.webdriver.send_session_command("POST", "timeouts", body) + + @property + def current_window(self): + return self.webdriver.window_handle + + def set_window(self, handle): + self.webdriver.window_handle = handle + + def wait(self): + while True: + try: + self.webdriver.execute_async_script("") + except client.TimeoutException: + pass + except (socket.timeout, client.NoSuchWindowException, + client.UnknownErrorException, IOError): + break + except Exception as e: + self.logger.error(traceback.format_exc(e)) + break + + +class WebDriverTestharnessProtocolPart(TestharnessProtocolPart): + def setup(self): + self.webdriver = self.parent.webdriver + + def load_runner(self, url_protocol): + url = urlparse.urljoin(self.parent.executor.server_url(url_protocol), + "/testharness_runner.html") + self.logger.debug("Loading %s" % url) + + self.webdriver.url = url + self.webdriver.execute_script("document.title = '%s'" % + threading.current_thread().name.replace("'", '"')) + + def close_old_windows(self): + exclude = self.webdriver.window_handle + handles = [item for item in self.webdriver.handles if item != exclude] + for handle in handles: + try: + self.webdriver.window_handle = handle + self.webdriver.close() + except client.NoSuchWindowException: + pass + self.webdriver.window_handle = exclude + return exclude + + def get_test_window(self, window_id, parent): + test_window = None + try: + # Try using the JSON serialization of the WindowProxy object, + # it's in Level 1 but nothing supports it yet + win_s = self.webdriver.execute_script("return window['%s'];" % window_id) + win_obj = json.loads(win_s) + test_window = win_obj["window-fcc6-11e5-b4f8-330a88ab9d7f"] + except Exception: + pass + + if test_window is None: + after = self.webdriver.handles + if len(after) == 2: + test_window = next(iter(set(after) - set([parent]))) + elif after[0] == parent and len(after) > 2: + # Hope the first one here is the test window + test_window = after[1] + else: + raise Exception("unable to find test window") + + assert test_window != parent + return test_window + + +class WebDriverSelectorProtocolPart(SelectorProtocolPart): + def setup(self): + self.webdriver = self.parent.webdriver + + def elements_by_selector(self, selector): + return self.webdriver.find.css(selector) + + +class WebDriverClickProtocolPart(ClickProtocolPart): + def setup(self): + self.webdriver = self.parent.webdriver + + def element(self, element): + return element.click() + + +class WebDriverSendKeysProtocolPart(SendKeysProtocolPart): + def setup(self): + self.webdriver = self.parent.webdriver + + def send_keys(self, element, keys): + try: + return element.send_keys(keys) + except client.UnknownErrorException as e: + # workaround https://bugs.chromium.org/p/chromedriver/issues/detail?id=1999 + if (e.http_status != 500 or + e.status_code != "unknown error"): + raise + return element.send_element_command("POST", "value", {"value": list(keys)}) + + +class WebDriverTestDriverProtocolPart(TestDriverProtocolPart): + def setup(self): + self.webdriver = self.parent.webdriver + + def send_message(self, message_type, status, message=None): + obj = { + "type": "testdriver-%s" % str(message_type), + "status": str(status) + } + if message: + obj["message"] = str(message) + self.webdriver.execute_script("window.postMessage(%s, '*')" % json.dumps(obj)) + + +class WebDriverProtocol(Protocol): + implements = [WebDriverBaseProtocolPart, + WebDriverTestharnessProtocolPart, + WebDriverSelectorProtocolPart, + WebDriverClickProtocolPart, + WebDriverSendKeysProtocolPart, + WebDriverTestDriverProtocolPart] + + def __init__(self, executor, browser, capabilities, **kwargs): + super(WebDriverProtocol, self).__init__(executor, browser) + self.capabilities = capabilities + self.url = browser.webdriver_url + self.webdriver = None + + def connect(self): + """Connect to browser via WebDriver.""" + self.logger.debug("Connecting to WebDriver on URL: %s" % self.url) + + host, port = self.url.split(":")[1].strip("/"), self.url.split(':')[-1].strip("/") + + capabilities = {"alwaysMatch": self.capabilities} + self.webdriver = client.Session(host, port, capabilities=capabilities) + self.webdriver.start() + + + def after_conect(self): + pass + + def teardown(self): + self.logger.debug("Hanging up on WebDriver session") + try: + self.webdriver.quit() + except Exception: + pass + del self.webdriver + + def is_alive(self): + try: + # Get a simple property over the connection + self.webdriver.window_handle + except (socket.timeout, client.UnknownErrorException): + return False + return True + + def after_connect(self): + self.testharness.load_runner(self.executor.last_environment["protocol"]) + + +class WebDriverRun(object): + def __init__(self, func, protocol, url, timeout): + self.func = func + self.result = None + self.protocol = protocol + self.url = url + self.timeout = timeout + self.result_flag = threading.Event() + + def run(self): + timeout = self.timeout + + try: + self.protocol.base.set_timeout((timeout + extra_timeout)) + except client.UnknownErrorException: + self.logger.error("Lost WebDriver connection") + return Stop + + executor = threading.Thread(target=self._run) + executor.start() + + flag = self.result_flag.wait(timeout + 2 * extra_timeout) + if self.result is None: + assert not flag + self.result = False, ("EXTERNAL-TIMEOUT", None) + + return self.result + + def _run(self): + try: + self.result = True, self.func(self.protocol, self.url, self.timeout) + except client.TimeoutException: + self.result = False, ("EXTERNAL-TIMEOUT", None) + except (socket.timeout, client.UnknownErrorException): + self.result = False, ("CRASH", None) + except Exception as e: + if (isinstance(e, client.WebDriverException) and + e.http_status == 408 and + e.status_code == "asynchronous script timeout"): + # workaround for https://bugs.chromium.org/p/chromedriver/issues/detail?id=2001 + self.result = False, ("EXTERNAL-TIMEOUT", None) + else: + message = getattr(e, "message", "") + if message: + message += "\n" + message += traceback.format_exc(e) + self.result = False, ("ERROR", message) + finally: + self.result_flag.set() + + +class WebDriverTestharnessExecutor(TestharnessExecutor): + supports_testdriver = True + + def __init__(self, browser, server_config, timeout_multiplier=1, + close_after_done=True, capabilities=None, debug_info=None, + **kwargs): + """WebDriver-based executor for testharness.js tests""" + TestharnessExecutor.__init__(self, browser, server_config, + timeout_multiplier=timeout_multiplier, + debug_info=debug_info) + self.protocol = WebDriverProtocol(self, browser, capabilities) + with open(os.path.join(here, "testharness_webdriver.js")) as f: + self.script = f.read() + with open(os.path.join(here, "testharness_webdriver_resume.js")) as f: + self.script_resume = f.read() + self.close_after_done = close_after_done + self.window_id = str(uuid.uuid4()) + + def is_alive(self): + return self.protocol.is_alive() + + def on_environment_change(self, new_environment): + if new_environment["protocol"] != self.last_environment["protocol"]: + self.protocol.testharness.load_runner(new_environment["protocol"]) + + def do_test(self, test): + url = self.test_url(test) + + success, data = WebDriverRun(self.do_testharness, + self.protocol, + url, + test.timeout * self.timeout_multiplier).run() + + if success: + return self.convert_result(test, data) + + return (test.result_cls(*data), []) + + def do_testharness(self, protocol, url, timeout): + format_map = {"abs_url": url, + "url": strip_server(url), + "window_id": self.window_id, + "timeout_multiplier": self.timeout_multiplier, + "timeout": timeout * 1000} + + parent_window = protocol.testharness.close_old_windows() + # Now start the test harness + protocol.base.execute_script(self.script % format_map) + test_window = protocol.testharness.get_test_window(self.window_id, parent_window) + + handler = CallbackHandler(self.logger, protocol, test_window) + while True: + result = protocol.base.execute_script( + self.script_resume % format_map, async=True) + done, rv = handler(result) + if done: + break + return rv + + +class WebDriverRefTestExecutor(RefTestExecutor): + def __init__(self, browser, server_config, timeout_multiplier=1, + screenshot_cache=None, close_after_done=True, + debug_info=None, capabilities=None, **kwargs): + """WebDriver-based executor for reftests""" + RefTestExecutor.__init__(self, + browser, + server_config, + screenshot_cache=screenshot_cache, + timeout_multiplier=timeout_multiplier, + debug_info=debug_info) + self.protocol = WebDriverProtocol(self, browser, + capabilities=capabilities) + self.implementation = RefTestImplementation(self) + self.close_after_done = close_after_done + self.has_window = False + + with open(os.path.join(here, "reftest.js")) as f: + self.script = f.read() + with open(os.path.join(here, "reftest-wait_webdriver.js")) as f: + self.wait_script = f.read() + + def is_alive(self): + return self.protocol.is_alive() + + def do_test(self, test): + self.protocol.webdriver.window.size = (600, 600) + + result = self.implementation.run_test(test) + + return self.convert_result(test, result) + + def screenshot(self, test, viewport_size, dpi): + # https://github.com/w3c/wptrunner/issues/166 + assert viewport_size is None + assert dpi is None + + return WebDriverRun(self._screenshot, + self.protocol, + self.test_url(test), + test.timeout).run() + + def _screenshot(self, protocol, url, timeout): + webdriver = protocol.webdriver + webdriver.url = url + + webdriver.execute_async_script(self.wait_script) + + screenshot = webdriver.screenshot() + + # strip off the data:img/png, part of the url + if screenshot.startswith("data:image/png;base64,"): + screenshot = screenshot.split(",", 1)[1] + + return screenshot diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/stability.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/stability.py index ed2a4ec39dd..e684bf68076 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/stability.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/stability.py @@ -96,8 +96,12 @@ class LogHandler(reader.LogHandler): duration = data["time"] - test.pop("start_time") test["longest_duration"][data["status"]] = max( duration, test["longest_duration"][data["status"]]) - # test_timeout is in seconds; convert it to ms. - test["timeout"] = data["extra"]["test_timeout"] * 1000 + try: + # test_timeout is in seconds; convert it to ms. + test["timeout"] = data["extra"]["test_timeout"] * 1000 + except KeyError: + # If a test is skipped, it won't have extra info. + pass def is_inconsistent(results_dict, iterations): @@ -118,6 +122,8 @@ def find_slow_status(test): A result status produced by a run that almost times out; None, if no runs almost time out. """ + if "timeout" not in test: + return None threshold = test["timeout"] * FLAKY_THRESHOLD for status in ['PASS', 'FAIL', 'OK', 'ERROR']: if (status in test["longest_duration"] and diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/tests/base.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/tests/base.py index b5173f3b513..84dc4f2e7f8 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/tests/base.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/tests/base.py @@ -17,7 +17,9 @@ if "CURRENT_TOX_ENV" in os.environ: current_tox_env_split = os.environ["CURRENT_TOX_ENV"].split("-") tox_env_extra_browsers = { - "chrome": {"chrome_android"}, + "chrome": {"chrome_android", "chrome_webdriver"}, + "edge": {"edge_webdriver"}, + "safari": {"safari_webdriver"}, "servo": {"servodriver"}, } diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/tests/test_stability.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/tests/test_stability.py index 80c964455ed..5a051b6c899 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/tests/test_stability.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/tests/test_stability.py @@ -29,3 +29,5 @@ def test_find_slow_status(): assert stability.find_slow_status({ "longest_duration": {"TIMEOUT": 10, "FAIL": 81}, "timeout": 100}) == "FAIL" + assert stability.find_slow_status({ + "longest_duration": {"SKIP": 0}}) is None diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/update/update.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/update/update.py index 5685f840670..e5678be4f54 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/update/update.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/update/update.py @@ -96,11 +96,38 @@ class UpdateMetadata(Step): runner.run() +class RemoveObsolete(Step): + """Remove metadata files that don't corespond to an existing test file""" + + def create(self, state): + if not state.kwargs["remove_obsolete"]: + return + + paths = state.kwargs["test_paths"] + state.tests_path = state.paths["/"]["tests_path"] + state.metadata_path = state.paths["/"]["metadata_path"] + + for url_paths in paths.itervalues(): + tests_path = url_paths["tests_path"] + metadata_path = url_paths["metadata_path"] + for dirpath, dirnames, filenames in os.walk(metadata_path): + for filename in filenames: + if filename == "__dir__.ini": + continue + if filename.endswith(".ini"): + full_path = os.path.join(dirpath, filename) + rel_path = os.path.relpath(full_path, metadata_path) + test_path = os.path.join(tests_path, rel_path[:-4]) + if not os.path.exists(test_path): + os.unlink(full_path) + + class UpdateRunner(StepRunner): """Runner for doing an overall update.""" steps = [LoadConfig, LoadTrees, SyncFromUpstream, + RemoveObsolete, UpdateMetadata] diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptcommandline.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptcommandline.py index e6c624994d9..0075ad90962 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptcommandline.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptcommandline.py @@ -565,8 +565,14 @@ def create_parser_update(product_choices=None): parser.add_argument("--stability", nargs="?", action="store", const="unstable", default=None, help=("Reason for disabling tests. When updating test results, disable tests that have " "inconsistent results across many runs with the given reason.")) - parser.add_argument("--continue", action="store_true", help="Continue a previously started run of the update script") - parser.add_argument("--abort", action="store_true", help="Clear state from a previous incomplete run of the update script") + parser.add_argument("--no-remove-obsolete", action="store_false", dest="remove_obsolete", default=True, + help=("Don't remove metadata files that no longer correspond to a test file")) + parser.add_argument("--no-store-state", action="store_false", dest="store_state", + help="Store state so that steps can be resumed after failure") + parser.add_argument("--continue", action="store_true", + help="Continue a previously started run of the update script") + parser.add_argument("--abort", action="store_true", + help="Clear state from a previous incomplete run of the update script") parser.add_argument("--exclude", action="store", nargs="*", help="List of glob-style paths to exclude when syncing tests") parser.add_argument("--include", action="store", nargs="*", diff --git a/tests/wpt/web-platform-tests/wasm/jsapi/assertions.js b/tests/wpt/web-platform-tests/wasm/jsapi/assertions.js index 151a406655c..bda3ae7bc3c 100644 --- a/tests/wpt/web-platform-tests/wasm/jsapi/assertions.js +++ b/tests/wpt/web-platform-tests/wasm/jsapi/assertions.js @@ -15,3 +15,59 @@ function assert_function_length(fn, length, description) { assert_true(propdesc.configurable, "configurable", `${description} length should be configurable`); assert_equals(propdesc.value, length, `${description} length should be ${length}`); } + +function assert_exported_function(fn, { name, length }, description) { + assert_equals(Object.getPrototypeOf(fn), Function.prototype, + `${description}: prototype`); + + assert_function_name(fn, name, description); + assert_function_length(fn, length, description); +} + +function assert_Instance(instance, expected_exports) { + assert_equals(Object.getPrototypeOf(instance), WebAssembly.Instance.prototype, + "prototype"); + assert_true(Object.isExtensible(instance), "extensible"); + + assert_equals(instance.exports, instance.exports, "exports should be idempotent"); + const exports = instance.exports; + + assert_equals(Object.getPrototypeOf(exports), null, "exports prototype"); + assert_false(Object.isExtensible(exports), "extensible exports"); + for (const [key, expected] of Object.entries(expected_exports)) { + const property = Object.getOwnPropertyDescriptor(exports, key); + assert_equals(typeof property, "object", `${key} should be present`); + assert_false(property.writable, `${key}: writable`); + assert_true(property.enumerable, `${key}: enumerable`); + assert_false(property.configurable, `${key}: configurable`); + const actual = property.value; + assert_true(Object.isExtensible(actual), `${key}: extensible`); + + switch (expected.kind) { + case "function": + assert_exported_function(actual, expected, `value of ${key}`); + break; + case "global": + assert_equals(Object.getPrototypeOf(actual), WebAssembly.Global.prototype, + `value of ${key}: prototype`); + assert_equals(actual.value, expected.value, `value of ${key}: value`); + assert_equals(actual.valueOf(), expected.value, `value of ${key}: valueOf()`); + break; + case "memory": + assert_equals(Object.getPrototypeOf(actual), WebAssembly.Memory.prototype, + `value of ${key}: prototype`); + assert_equals(Object.getPrototypeOf(actual.buffer), ArrayBuffer.prototype, + `value of ${key}: prototype of buffer`); + assert_equals(actual.buffer.byteLength, 0x10000 * expected.size, `value of ${key}: size of buffer`); + const array = new Uint8Array(actual.buffer); + assert_equals(array[0], 0, `value of ${key}: first element of buffer`); + assert_equals(array[array.byteLength - 1], 0, `value of ${key}: last element of buffer`); + break; + case "table": + assert_equals(Object.getPrototypeOf(actual), WebAssembly.Table.prototype, + `value of ${key}: prototype`); + assert_equals(actual.length, expected.length, `value of ${key}: length of table`); + break; + } + } +} diff --git a/tests/wpt/web-platform-tests/wasm/jsapi/constructor/compile.any.js b/tests/wpt/web-platform-tests/wasm/jsapi/constructor/compile.any.js new file mode 100644 index 00000000000..0139a18fda3 --- /dev/null +++ b/tests/wpt/web-platform-tests/wasm/jsapi/constructor/compile.any.js @@ -0,0 +1,77 @@ +// META: global=jsshell +// META: script=/wasm/jsapi/wasm-constants.js +// META: script=/wasm/jsapi/wasm-module-builder.js + +function assert_Module(module) { + assert_equals(Object.getPrototypeOf(module), WebAssembly.Module.prototype, + "Prototype"); + assert_true(Object.isExtensible(module), "Extensibility"); +} + +let emptyModuleBinary; +setup(() => { + emptyModuleBinary = new WasmModuleBuilder().toBuffer(); +}); + +promise_test(t => { + return promise_rejects(t, new TypeError(), WebAssembly.compile()); +}, "Missing argument"); + +promise_test(t => { + const invalidArguments = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + ArrayBuffer, + ArrayBuffer.prototype, + Array.from(emptyModuleBinary), + ]; + return Promise.all(invalidArguments.map(argument => { + return promise_rejects(t, new TypeError(), WebAssembly.compile(argument), + `compile(${format_value(argument)})`); + })); +}, "Invalid arguments"); + +promise_test(() => { + const fn = WebAssembly.compile; + const thisValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + WebAssembly, + ]; + return Promise.all(thisValues.map(thisValue => { + return fn.call(thisValue, emptyModuleBinary).then(assert_Module); + })); +}, "Branding"); + +test(() => { + const promise = WebAssembly.compile(emptyModuleBinary); + assert_equals(Object.getPrototypeOf(promise), Promise.prototype, "prototype"); + assert_true(Object.isExtensible(promise), "extensibility"); +}, "Promise type"); + +promise_test(t => { + const buffer = new Uint8Array(); + return promise_rejects(t, new WebAssembly.CompileError(), WebAssembly.compile(buffer)); +}, "Invalid code"); + +promise_test(() => { + return WebAssembly.compile(emptyModuleBinary).then(assert_Module); +}, "Result type"); + +promise_test(() => { + const buffer = new WasmModuleBuilder().toBuffer(); + assert_equals(buffer[0], 0); + const promise = WebAssembly.compile(buffer); + buffer[0] = 1; + return promise.then(assert_Module); +}, "Changing the buffer"); diff --git a/tests/wpt/web-platform-tests/wasm/jsapi/constructor/instantiate.any.js b/tests/wpt/web-platform-tests/wasm/jsapi/constructor/instantiate.any.js new file mode 100644 index 00000000000..e90f21e28eb --- /dev/null +++ b/tests/wpt/web-platform-tests/wasm/jsapi/constructor/instantiate.any.js @@ -0,0 +1,196 @@ +// META: global=jsshell +// META: script=/wasm/jsapi/wasm-constants.js +// META: script=/wasm/jsapi/wasm-module-builder.js +// META: script=/wasm/jsapi/assertions.js + +function assert_WebAssemblyInstantiatedSource(actual, expected_exports={}) { + assert_equals(Object.getPrototypeOf(actual), Object.prototype, + "Prototype"); + assert_true(Object.isExtensible(actual), "Extensibility"); + + const module = Object.getOwnPropertyDescriptor(actual, "module"); + assert_equals(typeof module, "object", "module: type of descriptor"); + assert_true(module.writable, "module: writable"); + assert_true(module.enumerable, "module: enumerable"); + assert_true(module.configurable, "module: configurable"); + assert_equals(Object.getPrototypeOf(module.value), WebAssembly.Module.prototype, + "module: prototype"); + + const instance = Object.getOwnPropertyDescriptor(actual, "instance"); + assert_equals(typeof instance, "object", "instance: type of descriptor"); + assert_true(instance.writable, "instance: writable"); + assert_true(instance.enumerable, "instance: enumerable"); + assert_true(instance.configurable, "instance: configurable"); + assert_Instance(instance.value, expected_exports); +} + +let emptyModuleBinary; +setup(() => { + emptyModuleBinary = new WasmModuleBuilder().toBuffer(); +}); + +promise_test(t => { + return promise_rejects(t, new TypeError(), WebAssembly.instantiate()); +}, "Missing arguments"); + +promise_test(() => { + const fn = WebAssembly.instantiate; + const thisValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + WebAssembly, + ]; + return Promise.all(thisValues.map(thisValue => { + return fn.call(thisValue, emptyModuleBinary).then(assert_WebAssemblyInstantiatedSource); + })); +}, "Branding"); + +promise_test(t => { + const invalidArguments = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + WebAssembly.Module, + WebAssembly.Module.prototype, + ArrayBuffer, + ArrayBuffer.prototype, + Array.from(emptyModuleBinary), + ]; + return Promise.all(invalidArguments.map(argument => { + return promise_rejects(t, new TypeError(), WebAssembly.instantiate(argument), + `instantiate(${format_value(argument)})`); + })); +}, "Invalid arguments"); + +test(() => { + const promise = WebAssembly.instantiate(emptyModuleBinary); + assert_equals(Object.getPrototypeOf(promise), Promise.prototype, "prototype"); + assert_true(Object.isExtensible(promise), "extensibility"); +}, "Promise type"); + +const createModule = () => { + const builder = new WasmModuleBuilder(); + + builder + .addFunction("fn", kSig_v_d) + .addBody([ + kExprEnd + ]) + .exportFunc(); + builder + .addFunction("fn2", kSig_v_v) + .addBody([ + kExprEnd + ]) + .exportFunc(); + + builder.setFunctionTableLength(1); + builder.addExportOfKind("table", kExternalTable, 0); + + builder.addGlobal(kWasmI32, true) + .exportAs("global") + .init = 7; + builder.addGlobal(kWasmF64, true) + .exportAs("global2") + .init = 1.2; + + builder.addMemory(4, 8, true); + + const buffer = builder.toBuffer(); + + const exports = { + "fn": { "kind": "function", "name": "0", "length": 1 }, + "fn2": { "kind": "function", "name": "1", "length": 0 }, + "table": { "kind": "table", "length": 1 }, + "global": { "kind": "global", "value": 7 }, + "global2": { "kind": "global", "value": 1.2 }, + "memory": { "kind": "memory", "size": 4 }, + }; + + return [buffer, exports]; +} + +promise_test(() => { + const [buffer, expected] = createModule(); + return WebAssembly.instantiate(buffer).then(result => assert_WebAssemblyInstantiatedSource(result, expected)); +}, "BufferSource argument"); + +promise_test(() => { + const [buffer, expected] = createModule(); + const module = new WebAssembly.Module(buffer); + return WebAssembly.instantiate(module).then(instance => assert_Instance(instance, expected)); +}, "Module argument"); + +const createModuleWithImports = () => { + const builder = new WasmModuleBuilder(); + + const index = builder.addImportedGlobal("module", "global", kWasmI32); + builder + .addFunction("fn", kSig_i_v) + .addBody([ + kExprGetGlobal, + index, + kExprReturn, + kExprEnd, + ]) + .exportFunc(); + + const buffer = builder.toBuffer(); + + const expected = { + "fn": { "kind": "function", "name": "0", "length": 0 }, + }; + + return [buffer, expected]; +}; + +promise_test(() => { + const [buffer, expected] = createModuleWithImports(); + + const value = 102; + return WebAssembly.instantiate(buffer, { + "module": { + "global": value, + }, + }).then(result => { + assert_WebAssemblyInstantiatedSource(result, expected) + assert_equals(result.instance.exports.fn(), value); + }); +}, "exports and imports: buffer argument"); + +promise_test(() => { + const [buffer, expected] = createModuleWithImports(); + const module = new WebAssembly.Module(buffer); + + const value = 102; + return WebAssembly.instantiate(module, { + "module": { + "global": value, + }, + }).then(instance => { + assert_Instance(instance, expected) + assert_equals(instance.exports.fn(), value); + }); +}, "exports and imports: Module argument"); + +promise_test(t => { + const buffer = new Uint8Array(); + return promise_rejects(t, new WebAssembly.CompileError(), WebAssembly.instantiate(buffer)); +}, "Invalid code"); + +promise_test(() => { + const buffer = new WasmModuleBuilder().toBuffer(); + assert_equals(buffer[0], 0); + const promise = WebAssembly.instantiate(buffer); + buffer[0] = 1; + return promise.then(assert_WebAssemblyInstantiatedSource); +}, "Changing the buffer"); diff --git a/tests/wpt/web-platform-tests/wasm/jsapi/constructor/validate.any.js b/tests/wpt/web-platform-tests/wasm/jsapi/constructor/validate.any.js new file mode 100644 index 00000000000..70bd9f7022a --- /dev/null +++ b/tests/wpt/web-platform-tests/wasm/jsapi/constructor/validate.any.js @@ -0,0 +1,96 @@ +// META: global=jsshell +// META: script=/wasm/jsapi/wasm-constants.js +// META: script=/wasm/jsapi/wasm-module-builder.js + +let emptyModuleBinary; +setup(() => { + emptyModuleBinary = new WasmModuleBuilder().toBuffer(); +}); + +test(() => { + assert_throws(new TypeError(), () => WebAssembly.validate()); +}, "Missing argument"); + +test(() => { + const invalidArguments = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + ArrayBuffer, + ArrayBuffer.prototype, + Array.from(emptyModuleBinary), + ]; + for (const argument of invalidArguments) { + assert_throws(new TypeError(), () => WebAssembly.validate(argument), + `validate(${format_value(argument)})`); + } +}, "Invalid arguments"); + +test(() => { + const fn = WebAssembly.validate; + const thisValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + WebAssembly, + ]; + for (const thisValue of thisValues) { + assert_true(fn.call(thisValue, emptyModuleBinary), `this=${format_value(thisValue)}`); + } +}, "Branding"); + +const modules = [ + // Incomplete header. + [[], false], + [[0x00], false], + [[0x00, 0x61], false], + [[0x00, 0x61, 0x73], false], + [[0x00, 0x61, 0x73, 0x6d], false], + [[0x00, 0x61, 0x73, 0x6d, 0x01], false], + [[0x00, 0x61, 0x73, 0x6d, 0x01, 0x00], false], + [[0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00], false], + + // Complete header. + [[0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00], true], + + // Invalid version. + [[0x00, 0x61, 0x73, 0x6d, 0x00, 0x00, 0x00, 0x00], false], + [[0x00, 0x61, 0x73, 0x6d, 0x02, 0x00, 0x00, 0x00], false], + + // Nameless custom section. + [[0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00], false], + + // Custom section with empty name. + [[0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00], true], + + // Custom section with name "a". + [[0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x01, 0x61], true], +]; +const bufferTypes = [ + Uint8Array, + Int8Array, + Uint16Array, + Int16Array, + Uint32Array, + Int32Array, +]; +for (const [module, expected] of modules) { + const name = module.map(n => n.toString(16)).join(" "); + for (const bufferType of bufferTypes) { + if (module.length % bufferType.BYTES_PER_ELEMENT === 0) { + test(() => { + const bytes = new Uint8Array(module); + const moduleBuffer = new bufferType(bytes.buffer); + assert_equals(WebAssembly.validate(moduleBuffer), expected); + }, `Validating module [${name}] in ${bufferType.name}`); + } + } +} diff --git a/tests/wpt/web-platform-tests/wasm/jsapi/instance/constructor.any.js b/tests/wpt/web-platform-tests/wasm/jsapi/instance/constructor.any.js index 61a8f53a014..f9bd06ac8e9 100644 --- a/tests/wpt/web-platform-tests/wasm/jsapi/instance/constructor.any.js +++ b/tests/wpt/web-platform-tests/wasm/jsapi/instance/constructor.any.js @@ -3,62 +3,6 @@ // META: script=/wasm/jsapi/wasm-module-builder.js // META: script=/wasm/jsapi/assertions.js -function assert_exported_function(fn, { name, length }, description) { - assert_equals(Object.getPrototypeOf(fn), Function.prototype, - `${description}: prototype`); - - assert_function_name(fn, name, description); - assert_function_length(fn, length, description); -} - -function assert_Instance(instance, expected_exports) { - assert_equals(Object.getPrototypeOf(instance), WebAssembly.Instance.prototype, - "prototype"); - assert_true(Object.isExtensible(instance), "extensible"); - - assert_equals(instance.exports, instance.exports, "exports should be idempotent"); - const exports = instance.exports; - - assert_equals(Object.getPrototypeOf(exports), null, "exports prototype"); - assert_false(Object.isExtensible(exports), "extensible exports"); - for (const [key, expected] of Object.entries(expected_exports)) { - const property = Object.getOwnPropertyDescriptor(exports, key); - assert_equals(typeof property, "object", `${key} should be present`); - assert_false(property.writable, `${key}: writable`); - assert_true(property.enumerable, `${key}: enumerable`); - assert_false(property.configurable, `${key}: configurable`); - const actual = property.value; - assert_true(Object.isExtensible(actual), `${key}: extensible`); - - switch (expected.kind) { - case "function": - assert_exported_function(actual, expected, `value of ${key}`); - break; - case "global": - assert_equals(Object.getPrototypeOf(actual), WebAssembly.Global.prototype, - `value of ${key}: prototype`); - assert_equals(actual.value, expected.value, `value of ${key}: value`); - assert_equals(actual.valueOf(), expected.value, `value of ${key}: valueOf()`); - break; - case "memory": - assert_equals(Object.getPrototypeOf(actual), WebAssembly.Memory.prototype, - `value of ${key}: prototype`); - assert_equals(Object.getPrototypeOf(actual.buffer), ArrayBuffer.prototype, - `value of ${key}: prototype of buffer`); - assert_equals(actual.buffer.byteLength, 0x10000 * expected.size, `value of ${key}: size of buffer`); - const array = new Uint8Array(actual.buffer); - assert_equals(array[0], 0, `value of ${key}: first element of buffer`); - assert_equals(array[array.byteLength - 1], 0, `value of ${key}: last element of buffer`); - break; - case "table": - assert_equals(Object.getPrototypeOf(actual), WebAssembly.Table.prototype, - `value of ${key}: prototype`); - assert_equals(actual.length, expected.length, `value of ${key}: length of table`); - break; - } - } -} - let emptyModuleBinary; setup(() => { emptyModuleBinary = new WasmModuleBuilder().toBuffer(); @@ -130,6 +74,8 @@ test(() => { test(() => { const builder = new WasmModuleBuilder(); builder.addImportedGlobal("module", "global1", kWasmI32); + builder.addImportedGlobal("module2", "global3", kWasmI32); + builder.addImportedMemory("module", "memory", 0, 128); builder.addImportedGlobal("module", "global2", kWasmI32); const buffer = builder.toBuffer(); const module = new WebAssembly.Module(buffer); @@ -146,6 +92,19 @@ test(() => { order.push("global2 getter"); return 0; }, + get memory() { + order.push("memory getter"); + return new WebAssembly.Memory({ "initial": 64, maximum: 128 }); + }, + } + }, + get module2() { + order.push("module2 getter"); + return { + get global3() { + order.push("global3 getter"); + return 0; + }, } }, }; @@ -153,6 +112,10 @@ test(() => { const expected = [ "module getter", "global1 getter", + "module2 getter", + "global3 getter", + "module getter", + "memory getter", "module getter", "global2 getter", ]; @@ -225,3 +188,34 @@ test(() => { }; assert_Instance(instance, expected); }, "exports"); + +test(() => { + const value = 102; + + const builder = new WasmModuleBuilder(); + + builder.addImportedGlobal("module", "global", kWasmI32); + builder + .addFunction("fn", kSig_i_v) + .addBody([ + kExprGetGlobal, + 0, + kExprReturn, + kExprEnd, + ]) + .exportFunc(); + + const buffer = builder.toBuffer(); + const module = new WebAssembly.Module(buffer); + const instance = new WebAssembly.Instance(module, { + "module": { + "global": value, + }, + }); + const expected = { + "fn": { "kind": "function", "name": "0", "length": 0 }, + }; + assert_Instance(instance, expected); + + assert_equals(instance.exports.fn(), value); +}, "exports and imports"); diff --git a/tests/wpt/web-platform-tests/web-animations/animation-model/animation-types/property-list.js b/tests/wpt/web-platform-tests/web-animations/animation-model/animation-types/property-list.js index 8d027178351..e2f3adcd7af 100644 --- a/tests/wpt/web-platform-tests/web-animations/animation-model/animation-types/property-list.js +++ b/tests/wpt/web-platform-tests/web-animations/animation-model/animation-types/property-list.js @@ -361,13 +361,13 @@ const gCSSProperties = { 'color-interpolation': { // https://svgwg.org/svg2-draft/painting.html#ColorInterpolationProperty types: [ - { type: 'discrete', options: [ [ 'linearRGB', 'auto' ] ] } + { type: 'discrete', options: [ [ 'linearrgb', 'auto' ] ] } ] }, 'color-interpolation-filters': { // https://drafts.fxtf.org/filters-1/#propdef-color-interpolation-filters types: [ - { type: 'discrete', options: [ [ 'sRGB', 'linearRGB' ] ] } + { type: 'discrete', options: [ [ 'srgb', 'linearrgb' ] ] } ] }, 'column-count': { diff --git a/tests/wpt/web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/buffer-resampling.html b/tests/wpt/web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/buffer-resampling.html new file mode 100644 index 00000000000..c181ceb8e0f --- /dev/null +++ b/tests/wpt/web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/buffer-resampling.html @@ -0,0 +1,101 @@ +<!doctype html> +<html> + <head> + <title>Test Extrapolation at end of AudibBuffer in an AudioBufferSourceNode</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/webaudio/resources/audit-util.js"></script> + <script src="/webaudio/resources/audit.js"></script> + </head> + <body> + <script> + let audit = Audit.createTaskRunner(); + + const sampleRate = 48000; + + // For testing we only need a few render quanta. + const renderSamples = 512 + + // Sample rate for our buffers. This is the lowest sample rate that is + // required to be supported. + const bufferRate = 8000; + + // Number of samples in each AudioBuffer; this is fairly arbitrary but + // should be less than a render quantum. + const bufferLength = 30; + + // Frequency of the sine wave for testing. + const frequency = 440; + + audit.define( + { + label: 'interpolate', + description: 'Interpolation of AudioBuffers to context sample rate' + }, + (task, should) => { + // The first channel is for the interpolated signal, and the second + // channel is for the reference signal from an oscillator. + let context = new OfflineAudioContext({ + numberOfChannels: 2, + length: renderSamples, + sampleRate: sampleRate + }); + + let merger = new ChannelMergerNode( + context, {numberOfChannels: context.destination.channelCount}); + merger.connect(context.destination); + + // Create a set of AudioBuffers which are samples from a pure sine + // wave with frequency |frequency|. + const nBuffers = Math.floor(context.length / bufferLength); + const omega = 2 * Math.PI * frequency / bufferRate; + + let frameNumber = 0; + let startTime = 0; + + for (let k = 0; k < nBuffers; ++k) { + // let buffer = context.createBuffer(1, bufferLength, + // bufferRate); + let buffer = new AudioBuffer( + {length: bufferLength, sampleRate: bufferRate}); + let data = buffer.getChannelData(0); + for (let n = 0; n < bufferLength; ++n) { + data[n] = Math.sin(omega * frameNumber); + ++frameNumber; + } + // Create a source using this buffer and start it at the end of + // the previous buffer. + let src = new AudioBufferSourceNode(context, {buffer: buffer}); + + src.connect(merger, 0, 0); + src.start(startTime); + startTime += buffer.duration; + } + + // Create the reference sine signal using an oscillator. + let osc = new OscillatorNode( + context, {type: 'sine', frequency: frequency}); + osc.connect(merger, 0, 1); + osc.start(0); + + context.startRendering() + .then(audioBuffer => { + let actual = audioBuffer.getChannelData(0); + let expected = audioBuffer.getChannelData(1); + + should(actual, 'Interpolated sine wave') + .beCloseToArray(expected, {absoluteThreshold: 9.0348e-2}); + + // Compute SNR between them. + let snr = 10 * Math.log10(computeSNR(actual, expected)); + + should(snr, `SNR (${snr.toPrecision(4)} dB)`) + .beGreaterThanOrEqualTo(37.17); + }) + .then(() => task.done()); + }); + + audit.run(); + </script> + </body> +</html> diff --git a/tests/wpt/web-platform-tests/xhr/abort-after-stop.htm b/tests/wpt/web-platform-tests/xhr/abort-after-stop.htm index 7c5060fa4c6..d28d046fa98 100644 --- a/tests/wpt/web-platform-tests/xhr/abort-after-stop.htm +++ b/tests/wpt/web-platform-tests/xhr/abort-after-stop.htm @@ -13,7 +13,9 @@ window.onload = test.step_func(function() { var client = new XMLHttpRequest(); var abortFired = false; + var sync = true; client.onabort = test.step_func(function (e) { + assert_false(sync); assert_equals(e.type, 'abort'); abortFired = true; }); @@ -24,6 +26,7 @@ test.done(); }, 200); window.stop(); + sync = false; }); </script> </body> diff --git a/tests/wpt/web-platform-tests/xhr/open-after-abort.htm b/tests/wpt/web-platform-tests/xhr/open-after-abort.htm index c9c63044228..c9ef6e7ac94 100644 --- a/tests/wpt/web-platform-tests/xhr/open-after-abort.htm +++ b/tests/wpt/web-platform-tests/xhr/open-after-abort.htm @@ -9,27 +9,69 @@ <body> <div id="log"></div> <script> - var test = async_test() - test.step(function() { + test(function(t) { var client = new XMLHttpRequest(), result = [], - expected = [1, 4, 1] // open() -> 1, - // abort() -> 4, open() -> 1 - client.onreadystatechange = function() { - test.step(function() { - result.push(client.readyState) - }) - } + expected = [ + 'readystatechange', 0, 1, // open() + 'readystatechange', 2, 4, // abort() + 'abort', 2, 4, // abort() + 'loadend', 2, 4, // abort() + 'readystatechange', 3, 1, // open() + ] + + var state = 0 + + client.onreadystatechange = t.step_func(function() { + result.push('readystatechange', state, client.readyState) + }) + client.onabort = t.step_func(function() { + // abort event must be fired synchronously from abort(). + assert_equals(state, 2) + + // readystatechange should be fired before abort. + assert_array_equals(result, [ + 'readystatechange', 0, 1, // open() + 'readystatechange', 2, 4, // abort() + ]) + + // readyState should be set to unsent (0) at the very end of abort(), + // after this (and onloadend) is called. + assert_equals(client.readyState, 4) + + result.push('abort', state, client.readyState) + }) + client.onloadend = t.step_func(function() { + // abort event must be fired synchronously from abort(). + assert_equals(state, 2) + + // readystatechange should be fired before abort. + assert_array_equals(result, [ + 'readystatechange', 0, 1, // open() + 'readystatechange', 2, 4, // abort() + 'abort', 2, 4, // abort() + ]) + + // readyState should be set to unsent (0) at the very end of abort(), + // after this is called. + assert_equals(client.readyState, 4) + + result.push('loadend', state, client.readyState) + }) + client.open("GET", "resources/well-formed.xml") assert_equals(client.readyState, 1) + + state = 1 client.send(null) + state = 2 client.abort() assert_equals(client.readyState, 0) + state = 3 client.open("GET", "resources/well-formed.xml") assert_equals(client.readyState, 1) assert_array_equals(result, expected) }) - test.done() </script> </body> </html> diff --git a/tests/wpt/web-platform-tests/xhr/open-after-stop.window.js b/tests/wpt/web-platform-tests/xhr/open-after-stop.window.js new file mode 100644 index 00000000000..e836a523f86 --- /dev/null +++ b/tests/wpt/web-platform-tests/xhr/open-after-stop.window.js @@ -0,0 +1,43 @@ +// window.stop() below prevents the load event from firing, so wait until it is +// fired to start the test. +setup({explicit_done: true }); + +onload = () => { + async_test(function(t) { + const client = new XMLHttpRequest(); + + const result = []; + const expected = [ + 'readystatechange', 0, 1, // open() + ]; + + let state = 0; + + client.onreadystatechange = t.step_func(() => { + result.push('readystatechange', state, client.readyState); + }); + client.onabort = t.unreached_func("abort should not be fired after window.stop() and open()"); + client.onloadend = t.unreached_func("loadend should not be fired after window.stop() and open()"); + + client.open("GET", "resources/well-formed.xml"); + assert_equals(client.readyState, 1); + + state = 1; + client.send(null); + state = 2; + window.stop(); + // Unlike client.abort(), window.stop() does not change readyState + // immediately, rather through a task... + assert_equals(client.readyState, 1); + state = 3; + // ... which is then canceled when we open a new request anyway. + client.open("GET", "resources/well-formed.xml"); + assert_equals(client.readyState, 1); + assert_array_equals(result, expected); + + // Give the abort and loadend events a chance to fire (erroneously) before + // calling this a success. + t.step_timeout(t.step_func_done(), 1000); + }, "open() after window.stop()"); + done(); +}; diff --git a/tests/wpt/webgl/meta/conformance/textures/canvas/tex-2d-luminance-luminance-unsigned_byte.html.ini b/tests/wpt/webgl/meta/conformance/textures/canvas/tex-2d-luminance-luminance-unsigned_byte.html.ini index 4925e297653..53ce1411a40 100644 --- a/tests/wpt/webgl/meta/conformance/textures/canvas/tex-2d-luminance-luminance-unsigned_byte.html.ini +++ b/tests/wpt/webgl/meta/conformance/textures/canvas/tex-2d-luminance-luminance-unsigned_byte.html.ini @@ -1,583 +1,61 @@ [tex-2d-luminance-luminance-unsigned_byte.html] bug: https://github.com/servo/servo/issues/11681 prefs: [dom.canvas-text.enabled:true] - [WebGL test #241: font missing] - expected: FAIL - - [WebGL test #121: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #21: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #157: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #257: font missing] - expected: FAIL - - [WebGL test #63: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #4: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - [WebGL test #33: font missing] expected: FAIL - [WebGL test #76: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #222: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - [WebGL test #245: font missing] expected: FAIL - [WebGL test #155: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #191: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #127: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #20: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #175: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #218: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #132: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #50: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #196: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #189: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #192: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #137: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #210: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #162: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #172: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #43: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #30: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #154: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #80: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #203: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #97: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #68: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #153: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #61: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #72: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #184: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #243: font missing] - expected: FAIL - - [WebGL test #92: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #122: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - [WebGL test #39: font missing] expected: FAIL - [WebGL test #31: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #227: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #53: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #181: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #156: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #107: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #206: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #271: font missing] - expected: FAIL - - [WebGL test #188: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #265: font missing] - expected: FAIL - - [WebGL test #213: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #51: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] + [WebGL test #251: font missing] expected: FAIL [WebGL test #275: font missing] expected: FAIL - [WebGL test #112: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #223: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #237: font missing] - expected: FAIL - - [WebGL test #168: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #56: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #134: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #166: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #55: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #129: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #239: font missing] - expected: FAIL - - [WebGL test #160: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #267: font missing] - expected: FAIL - - [WebGL test #167: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #173: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #93: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #221: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #207: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - [WebGL test #273: font missing] expected: FAIL - [WebGL test #60: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #179: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #199: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #90: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #49: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #28: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #263: font missing] - expected: FAIL - - [WebGL test #84: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #7: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #226: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #13: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #91: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #100: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #180: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #117: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #139: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #171: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #144: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #215: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #85: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #159: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #195: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #251: font missing] - expected: FAIL - - [WebGL test #71: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #124: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #148: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #14: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #5: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #143: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #261: font missing] - expected: FAIL - - [WebGL test #269: font missing] - expected: FAIL - - [WebGL test #24: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #141: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #135: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #133: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #25: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #108: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #65: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #2: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] + [WebGL test #237: font missing] expected: FAIL [WebGL test #233: font missing] expected: FAIL - [WebGL test #104: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #66: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #177: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #52: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #18: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #209: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #6: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #211: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #201: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #3: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #11: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #109: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #98: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #87: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #202: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #26: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #110: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #114: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #105: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #79: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #99: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #123: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] + [WebGL test #249: font missing] expected: FAIL - [WebGL test #220: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] + [WebGL test #265: font missing] expected: FAIL - [WebGL test #212: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] + [WebGL test #269: font missing] expected: FAIL [WebGL test #255: font missing] expected: FAIL - [WebGL test #64: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #170: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #174: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #169: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - [WebGL test #277: font missing] expected: FAIL - [WebGL test #142: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #130: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #47: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #194: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #70: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #22: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #86: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #187: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #208: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #113: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #185: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #116: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #200: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #164: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #204: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #186: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #249: font missing] - expected: FAIL - - [WebGL test #101: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #46: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #15: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #178: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #118: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #17: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #205: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #59: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #81: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #95: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #94: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #214: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #119: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #1: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #8: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #190: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #219: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #40: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #151: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #224: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #217: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #163: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #75: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] + [WebGL test #259: font missing] expected: FAIL - [WebGL test #19: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] + [WebGL test #253: font missing] expected: FAIL - [WebGL test #228: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] + [WebGL test #271: font missing] expected: FAIL [WebGL test #247: font missing] expected: FAIL - [WebGL test #102: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #74: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #67: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #77: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #176: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #82: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #259: font missing] + [WebGL test #263: font missing] expected: FAIL - [WebGL test #96: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] + [WebGL test #235: font missing] expected: FAIL [WebGL test #37: font missing] @@ -586,174 +64,24 @@ [WebGL test #35: font missing] expected: FAIL - [WebGL test #152: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #9: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #136: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #42: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #73: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #231: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #12: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #29: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #198: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #140: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #146: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #182: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #62: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #78: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #225: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #89: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #57: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #44: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #69: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #88: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #183: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #106: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #138: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #58: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #149: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #83: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #0: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #103: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #158: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #197: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #115: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #128: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #145: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] + [WebGL test #241: font missing] expected: FAIL - [WebGL test #229: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] + [WebGL test #267: font missing] expected: FAIL - [WebGL test #111: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] + [WebGL test #261: font missing] expected: FAIL [WebGL test #279: font missing] expected: FAIL - [WebGL test #126: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #27: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #10: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #253: font missing] - expected: FAIL - - [WebGL test #161: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #230: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #54: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #235: font missing] - expected: FAIL - - [WebGL test #23: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #45: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #125: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #147: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #16: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #131: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #120: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #193: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255] - expected: FAIL - - [WebGL test #41: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #216: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255] - expected: FAIL - - [WebGL test #165: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] + [WebGL test #257: font missing] expected: FAIL - [WebGL test #150: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] + [WebGL test #243: font missing] expected: FAIL - [WebGL test #48: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] + [WebGL test #239: font missing] expected: FAIL diff --git a/tests/wpt/webgl/meta/conformance/textures/canvas/tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html.ini b/tests/wpt/webgl/meta/conformance/textures/canvas/tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html.ini index d96cf39be4c..c50401634ea 100644 --- a/tests/wpt/webgl/meta/conformance/textures/canvas/tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html.ini +++ b/tests/wpt/webgl/meta/conformance/textures/canvas/tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html.ini @@ -1,759 +1,87 @@ [tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html] bug: https://github.com/servo/servo/issues/11681 prefs: [dom.canvas-text.enabled:true] - [WebGL test #227: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #231: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #114: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #21: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #118: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #197: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #110: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #63: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #205: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #127: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #4: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #33: font missing] - expected: FAIL - - [WebGL test #76: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - [WebGL test #245: font missing] expected: FAIL - [WebGL test #9: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #271: font missing] - expected: FAIL - - [WebGL test #187: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #20: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - [WebGL test #251: font missing] expected: FAIL - [WebGL test #134: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #50: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #157: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #213: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #10: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #123: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #162: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #172: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #221: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #182: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #154: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #80: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #132: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #211: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #112: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #68: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #153: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #61: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #72: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #89: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - [WebGL test #265: font missing] expected: FAIL - [WebGL test #229: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #228: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #138: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - [WebGL test #39: font missing] expected: FAIL - [WebGL test #119: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #161: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #203: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #24: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #53: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #181: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #156: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #225: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #217: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #116: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #92: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #29: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #207: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] + [WebGL test #33: font missing] expected: FAIL [WebGL test #275: font missing] expected: FAIL - [WebGL test #141: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - [WebGL test #237: font missing] expected: FAIL - [WebGL test #212: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #56: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #133: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #55: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #117: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #239: font missing] - expected: FAIL - - [WebGL test #160: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #267: font missing] - expected: FAIL - - [WebGL test #167: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #173: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #131: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #137: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - [WebGL test #273: font missing] expected: FAIL - [WebGL test #91: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #60: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #98: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #111: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #189: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #49: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #204: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #263: font missing] - expected: FAIL - - [WebGL test #130: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #84: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #99: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #8: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #185: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #183: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #180: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #158: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #139: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #105: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #210: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #171: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #144: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #108: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #85: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #159: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #11: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #166: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #88: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #71: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #115: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #13: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #125: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #220: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #124: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #121: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #5: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #143: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #184: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #192: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #219: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #12: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #27: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #26: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #2: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #233: font missing] - expected: FAIL - - [WebGL test #109: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #95: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #66: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #177: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #52: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #18: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #6: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #218: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #96: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #188: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #3: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #87: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #201: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #269: font missing] - expected: FAIL - - [WebGL test #202: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #155: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #79: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #15: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #179: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #255: font missing] - expected: FAIL - - [WebGL test #102: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #223: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #64: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #170: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #174: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #169: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - [WebGL test #277: font missing] expected: FAIL - [WebGL test #142: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #148: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #200: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #47: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #70: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #22: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #86: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #65: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #199: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #100: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #90: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #164: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #113: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #222: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] + [WebGL test #239: font missing] expected: FAIL [WebGL test #249: font missing] expected: FAIL - [WebGL test #46: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #178: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #17: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #122: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #94: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #14: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #194: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #214: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #59: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #81: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #186: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #107: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #28: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #209: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #104: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #120: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #1: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #43: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] + [WebGL test #267: font missing] expected: FAIL - [WebGL test #40: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] + [WebGL test #241: font missing] expected: FAIL - [WebGL test #151: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] + [WebGL test #255: font missing] expected: FAIL - [WebGL test #163: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] + [WebGL test #233: font missing] expected: FAIL - [WebGL test #75: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] + [WebGL test #37: font missing] expected: FAIL - [WebGL test #128: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] + [WebGL test #253: font missing] expected: FAIL - [WebGL test #19: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] + [WebGL test #271: font missing] expected: FAIL [WebGL test #247: font missing] expected: FAIL - [WebGL test #74: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #67: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #77: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #176: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #82: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #31: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #230: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] + [WebGL test #263: font missing] expected: FAIL [WebGL test #259: font missing] expected: FAIL - [WebGL test #140: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #37: font missing] - expected: FAIL - [WebGL test #35: font missing] expected: FAIL - [WebGL test #152: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #193: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #136: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #42: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #73: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #7: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #146: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #145: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #241: font missing] - expected: FAIL - - [WebGL test #97: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #198: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #62: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #78: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #135: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #208: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #57: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #44: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #196: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #226: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #69: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #175: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #168: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #58: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #149: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #83: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #0: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #206: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #30: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #224: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #25: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #129: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #216: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #106: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] + [WebGL test #261: font missing] expected: FAIL [WebGL test #279: font missing] expected: FAIL - [WebGL test #215: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - [WebGL test #257: font missing] expected: FAIL - [WebGL test #51: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #126: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - [WebGL test #243: font missing] expected: FAIL - [WebGL test #190: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128] - expected: FAIL - - [WebGL test #253: font missing] - expected: FAIL - - [WebGL test #103: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #54: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - [WebGL test #235: font missing] expected: FAIL - [WebGL test #23: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #45: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #191: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #93: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #101: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #195: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128] - expected: FAIL - - [WebGL test #147: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #16: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #261: font missing] - expected: FAIL - - [WebGL test #41: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #165: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255] - expected: FAIL - - [WebGL test #150: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255] - expected: FAIL - - [WebGL test #48: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255] + [WebGL test #269: font missing] expected: FAIL diff --git a/tests/wpt/webgl/meta/conformance/textures/image/tex-2d-luminance-luminance-unsigned_byte.html.ini b/tests/wpt/webgl/meta/conformance/textures/image/tex-2d-luminance-luminance-unsigned_byte.html.ini deleted file mode 100644 index f3a2412525e..00000000000 --- a/tests/wpt/webgl/meta/conformance/textures/image/tex-2d-luminance-luminance-unsigned_byte.html.ini +++ /dev/null @@ -1,25 +0,0 @@ -[tex-2d-luminance-luminance-unsigned_byte.html] - [WebGL test #3: shouldBe 0,0,0\nat (4, 24) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #1: shouldBe 255,255,255\nat (4, 24) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #7: shouldBe 0,0,0\nat (4, 24) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #2: shouldBe 255,255,255\nat (4, 4) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #0: shouldBe 0,0,0\nat (4, 4) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #6: shouldBe 255,255,255\nat (4, 4) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #4: shouldBe 0,0,0\nat (4, 4) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #5: shouldBe 255,255,255\nat (4, 24) expected: 255,255,255 was 54,54,54] - expected: FAIL - diff --git a/tests/wpt/webgl/meta/conformance/textures/image/tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html.ini b/tests/wpt/webgl/meta/conformance/textures/image/tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html.ini deleted file mode 100644 index 4a319cad454..00000000000 --- a/tests/wpt/webgl/meta/conformance/textures/image/tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html.ini +++ /dev/null @@ -1,25 +0,0 @@ -[tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html] - [WebGL test #3: shouldBe 0,0,0\nat (4, 24) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #1: shouldBe 255,255,255\nat (4, 24) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #7: shouldBe 0,0,0\nat (4, 24) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #2: shouldBe 255,255,255\nat (4, 4) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #0: shouldBe 0,0,0\nat (4, 4) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #6: shouldBe 255,255,255\nat (4, 4) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #4: shouldBe 0,0,0\nat (4, 4) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #5: shouldBe 255,255,255\nat (4, 24) expected: 255,255,255 was 54,54,54] - expected: FAIL - diff --git a/tests/wpt/webgl/meta/conformance/textures/image_data/tex-2d-luminance-luminance-unsigned_byte.html.ini b/tests/wpt/webgl/meta/conformance/textures/image_data/tex-2d-luminance-luminance-unsigned_byte.html.ini deleted file mode 100644 index e4b4939efdc..00000000000 --- a/tests/wpt/webgl/meta/conformance/textures/image_data/tex-2d-luminance-luminance-unsigned_byte.html.ini +++ /dev/null @@ -1,505 +0,0 @@ -[tex-2d-luminance-luminance-unsigned_byte.html] - [WebGL test #137: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #92: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #1: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #102: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #206: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #184: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #96: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #64: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #69: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #176: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #159: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #143: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #33: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #41: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #106: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #167: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #124: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #108: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #162: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #26: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #73: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #37: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #139: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #10: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #43: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #210: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #70: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #84: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #22: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #58: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #190: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #188: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #144: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #130: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #146: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #65: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #170: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #21: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #75: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #142: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #0: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #67: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #79: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #28: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #90: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #71: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #212: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #19: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #76: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #145: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #35: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #47: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #49: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #120: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #18: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #68: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #178: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #157: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #12: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #72: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #151: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #45: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #3: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #6: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #62: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #198: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #155: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #82: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #98: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #222: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #141: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #192: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #156: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #168: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #53: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #46: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #54: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #172: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #166: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #147: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #78: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #194: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #59: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #140: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #182: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #110: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #132: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #30: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #44: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #174: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #216: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #63: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #5: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #42: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #133: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #134: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #171: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #24: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #131: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #116: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #165: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #163: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #128: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #23: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #161: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #94: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #34: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #136: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #122: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #52: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #148: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #8: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #20: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #158: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #36: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #39: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #186: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #129: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #175: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #173: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #169: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #150: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #160: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #60: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #208: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #48: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #196: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #14: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #164: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #218: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #2: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #7: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #61: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #86: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #202: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #16: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #88: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #66: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #100: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #38: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #149: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #104: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #135: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #50: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #154: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #77: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #200: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #4: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #17: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #214: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #138: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #80: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #55: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #152: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #153: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #74: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #220: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #118: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #114: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #57: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #180: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #40: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #112: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #204: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #126: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #51: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #32: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #56: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - diff --git a/tests/wpt/webgl/meta/conformance/textures/image_data/tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html.ini b/tests/wpt/webgl/meta/conformance/textures/image_data/tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html.ini deleted file mode 100644 index a8b5b7d25a4..00000000000 --- a/tests/wpt/webgl/meta/conformance/textures/image_data/tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html.ini +++ /dev/null @@ -1,505 +0,0 @@ -[tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html] - [WebGL test #137: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #92: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #1: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #102: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #206: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #184: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #96: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #64: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #69: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #176: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #159: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #143: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #33: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #41: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #106: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #167: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #124: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #108: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #162: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #26: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #73: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #37: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #139: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #10: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #43: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #210: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #70: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #84: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #22: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #58: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #190: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #188: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #144: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #130: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #146: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #65: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #170: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #21: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #75: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #142: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #0: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #67: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #79: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #28: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #90: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #71: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #212: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #19: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #76: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #145: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #35: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #47: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #49: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #120: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #18: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #68: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #178: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #157: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #12: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #72: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #151: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #45: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #3: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #6: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #62: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #198: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #155: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #82: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #98: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #222: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #141: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #192: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #156: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #168: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #53: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #46: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #54: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #172: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #166: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #147: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #78: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #194: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #59: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #140: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #182: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #110: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #132: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #30: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #44: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #174: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #216: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #63: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #5: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #42: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #133: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #134: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #171: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #24: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #131: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #116: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #165: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #163: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #128: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #23: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #161: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #94: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #34: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #136: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #122: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #52: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #148: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #8: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #20: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #158: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #36: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #39: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #186: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #129: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #175: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #173: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #169: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #150: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #160: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #60: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #208: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #48: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #196: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #14: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #164: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #218: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #2: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #7: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #61: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #86: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #202: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #16: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #88: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #66: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #100: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #38: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #149: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #104: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #135: shouldBe 255,255,255\nat (16, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #50: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #154: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #77: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #200: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #4: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #17: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #214: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #138: shouldBe 255,255,255\nat (0, 16) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #80: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #55: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #152: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #153: shouldBe 0,0,0\nat (16, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #74: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #220: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #118: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #114: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #57: shouldBe 255,255,255\nat (16, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #180: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #40: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #112: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #204: shouldBe 0,0,0\nat (0, 0) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #126: shouldBe 0,0,0\nat (0, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #51: shouldBe 0,0,0\nat (16, 16) expected: 0,0,0 was 182,182,182] - expected: FAIL - - [WebGL test #32: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - - [WebGL test #56: shouldBe 255,255,255\nat (0, 0) expected: 255,255,255 was 54,54,54] - expected: FAIL - diff --git a/tests/wpt/webgl/meta/conformance/textures/misc/tex-image-with-format-and-type.html.ini b/tests/wpt/webgl/meta/conformance/textures/misc/tex-image-with-format-and-type.html.ini deleted file mode 100644 index 3394dfafb19..00000000000 --- a/tests/wpt/webgl/meta/conformance/textures/misc/tex-image-with-format-and-type.html.ini +++ /dev/null @@ -1,37 +0,0 @@ -[tex-image-with-format-and-type.html] - [WebGL test #31: LUMINANCE_ALPHA/UNSIGNED_BYTE should maintain full precision of data] - expected: FAIL - - [WebGL test #6: LUMINANCE/UNSIGNED_BYTE should maintain full precision of data] - expected: FAIL - - [WebGL test #65: UNPACK_PREMULTIPLY_ALPHA_WEBGL with RGBA/UNSIGNED_SHORT_4_4_4_4] - expected: FAIL - - [WebGL test #15: LUMINANCE_ALPHA/UNSIGNED_BYTE should maintain full precision of data] - expected: FAIL - - [WebGL test #66: UNPACK_PREMULTIPLY_ALPHA_WEBGL with RGBA/UNSIGNED_SHORT_5_5_5_1] - expected: FAIL - - [WebGL test #69: UNPACK_PREMULTIPLY_ALPHA_WEBGL with RGBA/UNSIGNED_SHORT_4_4_4_4] - expected: FAIL - - [WebGL test #7: LUMINANCE_ALPHA/UNSIGNED_BYTE should maintain full precision of data] - expected: FAIL - - [WebGL test #70: UNPACK_PREMULTIPLY_ALPHA_WEBGL with RGBA/UNSIGNED_SHORT_5_5_5_1] - expected: FAIL - - [WebGL test #22: LUMINANCE/UNSIGNED_BYTE should maintain full precision of data] - expected: FAIL - - [WebGL test #14: LUMINANCE/UNSIGNED_BYTE should maintain full precision of data] - expected: FAIL - - [WebGL test #30: LUMINANCE/UNSIGNED_BYTE should maintain full precision of data] - expected: FAIL - - [WebGL test #23: LUMINANCE_ALPHA/UNSIGNED_BYTE should maintain full precision of data] - expected: FAIL - |