diff options
141 files changed, 1162 insertions, 498 deletions
diff --git a/components/canvas/canvas_paint_task.rs b/components/canvas/canvas_paint_task.rs index 07860fe93cc..2804ecd07bd 100644 --- a/components/canvas/canvas_paint_task.rs +++ b/components/canvas/canvas_paint_task.rs @@ -213,7 +213,8 @@ impl<'a> CanvasPaintTask<'a> { Canvas2dMsg::Fill => painter.fill(), Canvas2dMsg::Stroke => painter.stroke(), Canvas2dMsg::Clip => painter.clip(), - Canvas2dMsg::DrawImage(imagedata, image_size, dest_rect, source_rect, smoothing_enabled) => { + Canvas2dMsg::DrawImage(imagedata, image_size, dest_rect, source_rect, + smoothing_enabled) => { painter.draw_image(imagedata, image_size, dest_rect, source_rect, smoothing_enabled) } Canvas2dMsg::DrawImageSelf(image_size, dest_rect, source_rect, smoothing_enabled) => { @@ -245,7 +246,8 @@ impl<'a> CanvasPaintTask<'a> { Canvas2dMsg::SetTransform(ref matrix) => painter.set_transform(matrix), Canvas2dMsg::SetGlobalAlpha(alpha) => painter.set_global_alpha(alpha), Canvas2dMsg::SetGlobalComposition(op) => painter.set_global_composition(op), - Canvas2dMsg::GetImageData(dest_rect, canvas_size, chan) => painter.get_image_data(dest_rect, canvas_size, chan), + Canvas2dMsg::GetImageData(dest_rect, canvas_size, chan) + => painter.get_image_data(dest_rect, canvas_size, chan), Canvas2dMsg::PutImageData(imagedata, image_data_rect, dirty_rect) => painter.put_image_data(imagedata, image_data_rect, dirty_rect), } diff --git a/components/canvas/webgl_paint_task.rs b/components/canvas/webgl_paint_task.rs index c98f30ebbad..99fd350ff32 100644 --- a/components/canvas/webgl_paint_task.rs +++ b/components/canvas/webgl_paint_task.rs @@ -30,9 +30,9 @@ unsafe impl Send for WebGLPaintTask {} impl WebGLPaintTask { fn new(size: Size2D<i32>) -> Result<WebGLPaintTask, &'static str> { // TODO(ecoal95): Get the GLContextAttributes from the `GetContext` call - let context = try!(GLContext::create_offscreen_with_color_attachment(size, - GLContextAttributes::default(), - ColorAttachmentType::TextureWithSurface)); + let context = try!( + GLContext::create_offscreen_with_color_attachment( + size, GLContextAttributes::default(), ColorAttachmentType::TextureWithSurface)); Ok(WebGLPaintTask { size: size, original_context_size: size, @@ -50,10 +50,13 @@ impl WebGLPaintTask { CanvasWebGLMsg::CreateBuffer(chan) => self.create_buffer(chan), CanvasWebGLMsg::DrawArrays(mode, first, count) => self.draw_arrays(mode, first, count), CanvasWebGLMsg::EnableVertexAttribArray(attrib_id) => self.enable_vertex_attrib_array(attrib_id), - CanvasWebGLMsg::GetAttribLocation(program_id, name, chan) => self.get_attrib_location(program_id, name, chan), + CanvasWebGLMsg::GetAttribLocation(program_id, name, chan) => + self.get_attrib_location(program_id, name, chan), CanvasWebGLMsg::GetShaderInfoLog(shader_id, chan) => self.get_shader_info_log(shader_id, chan), - CanvasWebGLMsg::GetShaderParameter(shader_id, param_id, chan) => self.get_shader_parameter(shader_id, param_id, chan), - CanvasWebGLMsg::GetUniformLocation(program_id, name, chan) => self.get_uniform_location(program_id, name, chan), + CanvasWebGLMsg::GetShaderParameter(shader_id, param_id, chan) => + self.get_shader_parameter(shader_id, param_id, chan), + CanvasWebGLMsg::GetUniformLocation(program_id, name, chan) => + self.get_uniform_location(program_id, name, chan), CanvasWebGLMsg::CompileShader(shader_id) => self.compile_shader(shader_id), CanvasWebGLMsg::CreateProgram(chan) => self.create_program(chan), CanvasWebGLMsg::CreateShader(shader_type, chan) => self.create_shader(shader_type, chan), diff --git a/components/devtools/actors/console.rs b/components/devtools/actors/console.rs index bef7e456a49..1e0623d1061 100644 --- a/components/devtools/actors/console.rs +++ b/components/devtools/actors/console.rs @@ -151,7 +151,9 @@ impl Actor for ConsoleActor { timeStamp: 0, errorMessage: "page error test".to_string(), }; - messages.push(json::from_str(json::encode(&message).as_slice()).unwrap().as_object().unwrap().clone());*/ + messages.push( + json::from_str( + json::encode(&message).as_slice()).unwrap().as_object().unwrap().clone());*/ } "LogMessage" => { @@ -161,7 +163,9 @@ impl Actor for ConsoleActor { timeStamp: 0, message: "log message test".to_string(), }; - messages.push(json::from_str(json::encode(&message).as_slice()).unwrap().as_object().unwrap().clone());*/ + messages.push( + json::from_str( + json::encode(&message).as_slice()).unwrap().as_object().unwrap().clone());*/ } s => println!("unrecognized message type requested: \"{}\"", s), diff --git a/components/devtools/actors/root.rs b/components/devtools/actors/root.rs index c4f7b396f11..bd01889bce5 100644 --- a/components/devtools/actors/root.rs +++ b/components/devtools/actors/root.rs @@ -2,7 +2,8 @@ * 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/. */ -/// Liberally derived from the [Firefox JS implementation](http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/root.js). +/// Liberally derived from the [Firefox JS implementation] +/// (http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/root.js). /// Connection point for all new remote devtools interactions, providing lists of know actors /// that perform more specific actions (tabs, addons, browser chrome, etc.) diff --git a/components/gfx/paint_context.rs b/components/gfx/paint_context.rs index 490e3ae3f6a..b4084b6d579 100644 --- a/components/gfx/paint_context.rs +++ b/components/gfx/paint_context.rs @@ -914,15 +914,17 @@ impl<'a> PaintContext<'a> { if accum_blur > Au(0) { // Set the correct size. let side_inflation = accum_blur * BLUR_INFLATION_FACTOR; - size = Size2D(size.width + (side_inflation.to_nearest_px() * 2) as i32, size.height + (side_inflation.to_nearest_px() * 2) as i32); + size = Size2D(size.width + (side_inflation.to_nearest_px() * 2) as i32, + size.height + (side_inflation.to_nearest_px() * 2) as i32); // Calculate the transform matrix. let old_transform = self.draw_target.get_transform(); let inflated_size = Rect(Point2D(0.0, 0.0), Size2D(size.width as AzFloat, size.height as AzFloat)); let temporary_draw_target_bounds = old_transform.transform_rect(&inflated_size); - matrix = Matrix2D::identity().translate(-temporary_draw_target_bounds.origin.x as AzFloat, - -temporary_draw_target_bounds.origin.y as AzFloat).mul(&old_transform); + matrix = Matrix2D::identity().translate( + -temporary_draw_target_bounds.origin.x as AzFloat, + -temporary_draw_target_bounds.origin.y as AzFloat).mul(&old_transform); } let temporary_draw_target = diff --git a/components/gfx/paint_task.rs b/components/gfx/paint_task.rs index 007668ad709..29869f33c14 100644 --- a/components/gfx/paint_task.rs +++ b/components/gfx/paint_task.rs @@ -481,7 +481,8 @@ impl WorkerThreadProxy { layer_buffer: Option<Box<LayerBuffer>>, stacking_context: Arc<StackingContext>, scale: f32) { - self.sender.send(MsgToWorkerThread::PaintTile(thread_id, tile, layer_buffer, stacking_context, scale)).unwrap() + let msg = MsgToWorkerThread::PaintTile(thread_id, tile, layer_buffer, stacking_context, scale); + self.sender.send(msg).unwrap() } fn get_painted_tile_buffer(&mut self) -> Box<LayerBuffer> { diff --git a/components/gfx/platform/freetype/font_list.rs b/components/gfx/platform/freetype/font_list.rs index ea9a0cbcb48..4084087fc54 100644 --- a/components/gfx/platform/freetype/font_list.rs +++ b/components/gfx/platform/freetype/font_list.rs @@ -91,13 +91,15 @@ pub fn get_variations_for_family<F>(family_name: &str, mut callback: F) for i in 0..((*matches).nfont as isize) { let font = (*matches).fonts.offset(i); let mut file: *mut FcChar8 = ptr::null_mut(); - let file = if FcPatternGetString(*font, FC_FILE.as_ptr() as *mut c_char, 0, &mut file) == FcResultMatch { + let result = FcPatternGetString(*font, FC_FILE.as_ptr() as *mut c_char, 0, &mut file); + let file = if result == FcResultMatch { c_str_to_string(file as *const c_char) } else { panic!(); }; let mut index: libc::c_int = 0; - let index = if FcPatternGetInteger(*font, FC_INDEX.as_ptr() as *mut c_char, 0, &mut index) == FcResultMatch { + let result = FcPatternGetInteger(*font, FC_INDEX.as_ptr() as *mut c_char, 0, &mut index); + let index = if result == FcResultMatch { index } else { panic!(); diff --git a/components/gfx/text/shaping/harfbuzz.rs b/components/gfx/text/shaping/harfbuzz.rs index 6ff6987e752..9781fd76926 100644 --- a/components/gfx/text/shaping/harfbuzz.rs +++ b/components/gfx/text/shaping/harfbuzz.rs @@ -198,7 +198,8 @@ impl Shaper { let hb_funcs: *mut hb_font_funcs_t = RUST_hb_font_funcs_create(); RUST_hb_font_funcs_set_glyph_func(hb_funcs, glyph_func, ptr::null_mut(), None); RUST_hb_font_funcs_set_glyph_h_advance_func(hb_funcs, glyph_h_advance_func, ptr::null_mut(), None); - RUST_hb_font_funcs_set_glyph_h_kerning_func(hb_funcs, glyph_h_kerning_func, ptr::null_mut(), ptr::null_mut()); + RUST_hb_font_funcs_set_glyph_h_kerning_func( + hb_funcs, glyph_h_kerning_func, ptr::null_mut(), ptr::null_mut()); RUST_hb_font_set_funcs(hb_font, hb_funcs, font as *mut Font as *mut c_void, None); Shaper { diff --git a/components/layout/construct.rs b/components/layout/construct.rs index dfce640c19c..25296e9c89b 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -1344,7 +1344,8 @@ impl<'a> PostorderNodeMutTraversal for FlowConstructor<'a> { }; (munged_display, style.get_box().float, style.get_box().position) } - Some(NodeTypeId::CharacterData(CharacterDataTypeId::Text)) => (display::T::inline, float::T::none, position::T::static_), + Some(NodeTypeId::CharacterData(CharacterDataTypeId::Text)) => + (display::T::inline, float::T::none, position::T::static_), Some(NodeTypeId::CharacterData(CharacterDataTypeId::Comment)) | Some(NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction)) | Some(NodeTypeId::DocumentType) | diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index 7a0f4242ac2..1be5d3121a4 100644 --- a/components/layout/display_list_builder.rs +++ b/components/layout/display_list_builder.rs @@ -42,7 +42,8 @@ use std::iter::repeat; use std::sync::Arc; use style::computed_values::filter::Filter; use style::computed_values::transform::ComputedMatrix; -use style::computed_values::{background_attachment, background_clip, background_origin, background_repeat, background_size}; +use style::computed_values::{background_attachment, background_clip, background_origin, + background_repeat, background_size}; use style::computed_values::{border_style, image_rendering, overflow_x, position, visibility}; use style::properties::ComputedValues; use style::properties::style_structs::Border; @@ -477,7 +478,8 @@ impl FragmentDisplayListBuilding for Fragment { (absolute_bounds.origin.x, absolute_bounds.origin.y) } background_attachment::T::fixed => { - // If the ‘background-attachment’ value for this image is ‘fixed’, then 'background-origin' has no effect. + // If the ‘background-attachment’ value for this image is ‘fixed’, then + // 'background-origin' has no effect. origin_x = Au(0); origin_y = Au(0); (Au(0), Au(0)) diff --git a/components/layout/model.rs b/components/layout/model.rs index 8b4da87cd45..10c02e9964e 100644 --- a/components/layout/model.rs +++ b/components/layout/model.rs @@ -131,7 +131,8 @@ impl MarginCollapseInfo { let state = match self.state { MarginCollapseState::AccumulatingCollapsibleTopMargin => { match fragment.style().content_block_size() { - LengthOrPercentageOrAuto::Auto | LengthOrPercentageOrAuto::Length(Au(0)) | LengthOrPercentageOrAuto::Percentage(0.) => { + LengthOrPercentageOrAuto::Auto | LengthOrPercentageOrAuto::Length(Au(0)) | + LengthOrPercentageOrAuto::Percentage(0.) => { match fragment.style().min_block_size() { LengthOrPercentage::Length(Au(0)) | LengthOrPercentage::Percentage(0.) => { FinalMarginState::MarginsCollapseThrough diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index 6106456876b..5ec9f490ada 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -50,7 +50,8 @@ type Generation = u32; /// Since a work-stealing queue is used for styling, sometimes, the bloom filter /// will no longer be the for the parent of the node we're currently on. When /// this happens, the task local bloom filter will be thrown away and rebuilt. -thread_local!(static STYLE_BLOOM: RefCell<Option<(Box<BloomFilter>, UnsafeLayoutNode, Generation)>> = RefCell::new(None)); +thread_local!( + static STYLE_BLOOM: RefCell<Option<(Box<BloomFilter>, UnsafeLayoutNode, Generation)>> = RefCell::new(None)); /// Returns the task local bloom filter. /// diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index cf65ec3c6c0..5cdc9e9a16a 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -125,21 +125,24 @@ pub trait TLayoutNode { fn get_renderer(&self) -> Option<Sender<CanvasMsg>> { unsafe { - let canvas_element: Option<LayoutJS<HTMLCanvasElement>> = HTMLCanvasElementCast::to_layout_js(self.get_jsmanaged()); + let canvas_element: Option<LayoutJS<HTMLCanvasElement>> = + HTMLCanvasElementCast::to_layout_js(self.get_jsmanaged()); canvas_element.and_then(|elem| elem.get_renderer()) } } fn get_canvas_width(&self) -> u32 { unsafe { - let canvas_element: Option<LayoutJS<HTMLCanvasElement>> = HTMLCanvasElementCast::to_layout_js(self.get_jsmanaged()); + let canvas_element: Option<LayoutJS<HTMLCanvasElement>> = + HTMLCanvasElementCast::to_layout_js(self.get_jsmanaged()); canvas_element.unwrap().get_canvas_width() } } fn get_canvas_height(&self) -> u32 { unsafe { - let canvas_element: Option<LayoutJS<HTMLCanvasElement>> = HTMLCanvasElementCast::to_layout_js(self.get_jsmanaged()); + let canvas_element: Option<LayoutJS<HTMLCanvasElement>> = + HTMLCanvasElementCast::to_layout_js(self.get_jsmanaged()); canvas_element.unwrap().get_canvas_height() } } diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs index 09bf676405b..623f801ddb4 100644 --- a/components/msg/constellation_msg.rs +++ b/components/msg/constellation_msg.rs @@ -311,7 +311,8 @@ impl MozBrowserEvent { MozBrowserEvent::AsyncScroll | MozBrowserEvent::Close | MozBrowserEvent::ContextMenu | MozBrowserEvent::Error | MozBrowserEvent::IconChange | MozBrowserEvent::LoadEnd | MozBrowserEvent::LoadStart | MozBrowserEvent::OpenWindow | MozBrowserEvent::SecurityChange | - MozBrowserEvent::ShowModalPrompt | MozBrowserEvent::UsernameAndPasswordRequired | MozBrowserEvent::OpenSearch => None, + MozBrowserEvent::ShowModalPrompt | MozBrowserEvent::UsernameAndPasswordRequired | + MozBrowserEvent::OpenSearch => None, MozBrowserEvent::LocationChange(ref new_location) => Some(new_location.clone()), MozBrowserEvent::TitleChange(ref new_title) => Some(new_title.clone()), } diff --git a/components/net/cookie_storage.rs b/components/net/cookie_storage.rs index 80c69a45809..cf28e25ab27 100644 --- a/components/net/cookie_storage.rs +++ b/components/net/cookie_storage.rs @@ -86,7 +86,8 @@ impl CookieStorage { // http://tools.ietf.org/html/rfc6265#section-5.4 pub fn cookies_for_url(&mut self, url: &Url, source: CookieSource) -> Option<String> { let filterer = |c: &&mut Cookie| -> bool { - info!(" === SENT COOKIE : {} {} {:?} {:?}", c.cookie.name, c.cookie.value, c.cookie.domain, c.cookie.path); + info!(" === SENT COOKIE : {} {} {:?} {:?}", + c.cookie.name, c.cookie.value, c.cookie.domain, c.cookie.path); info!(" === SENT COOKIE RESULT {}", c.appropriate_for_url(url, source)); // Step 1 c.appropriate_for_url(url, source) diff --git a/components/net/fetch/cors_cache.rs b/components/net/fetch/cors_cache.rs index 565271a340a..e88bfc26e40 100644 --- a/components/net/fetch/cors_cache.rs +++ b/components/net/fetch/cors_cache.rs @@ -53,7 +53,8 @@ pub struct CORSCacheEntry { } impl CORSCacheEntry { - fn new (origin:Url, url: Url, max_age: u32, credentials: bool, header_or_method: HeaderOrMethod) -> CORSCacheEntry { + fn new(origin:Url, url: Url, max_age: u32, credentials: bool, + header_or_method: HeaderOrMethod) -> CORSCacheEntry { CORSCacheEntry { origin: origin, url: url, @@ -80,18 +81,22 @@ pub trait CORSCache { /// Remove old entries fn cleanup(&mut self); - /// Returns true if an entry with a [matching header](https://fetch.spec.whatwg.org/#concept-cache-match-header) is found + /// Returns true if an entry with a + /// [matching header](https://fetch.spec.whatwg.org/#concept-cache-match-header) is found fn match_header(&mut self, request: CacheRequestDetails, header_name: &str) -> bool; - /// Updates max age if an entry for a [matching header](https://fetch.spec.whatwg.org/#concept-cache-match-header) is found. + /// Updates max age if an entry for a + /// [matching header](https://fetch.spec.whatwg.org/#concept-cache-match-header) is found. /// /// If not, it will insert an equivalent entry fn match_header_and_update(&mut self, request: CacheRequestDetails, header_name: &str, new_max_age: u32) -> bool; - /// Returns true if an entry with a [matching method](https://fetch.spec.whatwg.org/#concept-cache-match-method) is found + /// Returns true if an entry with a + /// [matching method](https://fetch.spec.whatwg.org/#concept-cache-match-method) is found fn match_method(&mut self, request: CacheRequestDetails, method: Method) -> bool; - /// Updates max age if an entry for [a matching method](https://fetch.spec.whatwg.org/#concept-cache-match-method) is found. + /// Updates max age if an entry for + /// [a matching method](https://fetch.spec.whatwg.org/#concept-cache-match-method) is found. /// /// If not, it will insert an equivalent entry fn match_method_and_update(&mut self, request: CacheRequestDetails, method: Method, new_max_age: u32) -> bool; @@ -104,7 +109,8 @@ pub trait CORSCache { pub struct BasicCORSCache(Vec<CORSCacheEntry>); impl BasicCORSCache { - fn find_entry_by_header<'a>(&'a mut self, request: &CacheRequestDetails, header_name: &str) -> Option<&'a mut CORSCacheEntry> { + fn find_entry_by_header<'a>(&'a mut self, request: &CacheRequestDetails, + header_name: &str) -> Option<&'a mut CORSCacheEntry> { self.cleanup(); let BasicCORSCache(ref mut buf) = *self; let entry = buf.iter_mut().find(|e| e.origin.scheme == request.origin.scheme && @@ -116,7 +122,8 @@ impl BasicCORSCache { entry } - fn find_entry_by_method<'a>(&'a mut self, request: &CacheRequestDetails, method: Method) -> Option<&'a mut CORSCacheEntry> { + fn find_entry_by_method<'a>(&'a mut self, request: &CacheRequestDetails, + method: Method) -> Option<&'a mut CORSCacheEntry> { // we can take the method from CORSRequest itself self.cleanup(); let BasicCORSCache(ref mut buf) = *self; @@ -135,7 +142,8 @@ impl CORSCache for BasicCORSCache { #[allow(dead_code)] fn clear (&mut self, request: CacheRequestDetails) { let BasicCORSCache(buf) = self.clone(); - let new_buf: Vec<CORSCacheEntry> = buf.into_iter().filter(|e| e.origin == request.origin && request.destination == e.url).collect(); + let new_buf: Vec<CORSCacheEntry> = + buf.into_iter().filter(|e| e.origin == request.origin && request.destination == e.url).collect(); *self = BasicCORSCache(new_buf); } @@ -143,7 +151,9 @@ impl CORSCache for BasicCORSCache { fn cleanup(&mut self) { let BasicCORSCache(buf) = self.clone(); let now = time::now().to_timespec(); - let new_buf: Vec<CORSCacheEntry> = buf.into_iter().filter(|e| now.sec > e.created.sec + e.max_age as i64).collect(); + let new_buf: Vec<CORSCacheEntry> = buf.into_iter() + .filter(|e| now.sec > e.created.sec + e.max_age as i64) + .collect(); *self = BasicCORSCache(new_buf); } @@ -156,7 +166,8 @@ impl CORSCache for BasicCORSCache { Some(_) => true, None => { self.insert(CORSCacheEntry::new(request.origin, request.destination, new_max_age, - request.credentials, HeaderOrMethod::HeaderData(header_name.to_string()))); + request.credentials, + HeaderOrMethod::HeaderData(header_name.to_string()))); false } } diff --git a/components/net/fetch/request.rs b/components/net/fetch/request.rs index c5e1a4a5f59..2e1c53a8c77 100644 --- a/components/net/fetch/request.rs +++ b/components/net/fetch/request.rs @@ -224,7 +224,8 @@ impl Request { } /// [HTTP fetch](https://fetch.spec.whatwg.org#http-fetch) - pub fn http_fetch(&mut self, cors_flag: bool, cors_preflight_flag: bool, authentication_fetch_flag: bool) -> Response { + pub fn http_fetch(&mut self, cors_flag: bool, cors_preflight_flag: bool, + authentication_fetch_flag: bool) -> Response { // Step 1 let mut response: Option<Response> = None; // Step 2 @@ -333,7 +334,9 @@ impl Request { self.same_origin_data = false; // Step 10 if self.redirect_mode == RedirectMode::Follow { - // FIXME: Origin method of the Url crate hasn't been implemented (https://github.com/servo/rust-url/issues/54) + // FIXME: Origin method of the Url crate hasn't been implemented + // https://github.com/servo/rust-url/issues/54 + // Substep 1 // if cors_flag && location_url.origin() != self.url.origin() { self.origin = None; } // Substep 2 @@ -387,7 +390,9 @@ impl Request { } /// [HTTP network or cache fetch](https://fetch.spec.whatwg.org#http-network-or-cache-fetch) - pub fn http_network_or_cache_fetch(&mut self, _credentials_flag: bool, _authentication_fetch_flag: bool) -> Response { + pub fn http_network_or_cache_fetch(&mut self, + _credentials_flag: bool, + _authentication_fetch_flag: bool) -> Response { // TODO: Implement HTTP network or cache fetch spec Response::network_error() } diff --git a/components/net/fetch/response.rs b/components/net/fetch/response.rs index fc33c123010..f63ac5e98bf 100644 --- a/components/net/fetch/response.rs +++ b/components/net/fetch/response.rs @@ -56,7 +56,8 @@ pub struct Response { pub status: Option<StatusCode>, pub headers: Headers, pub body: ResponseBody, - /// [Internal response](https://fetch.spec.whatwg.org/#concept-internal-response), only used if the Response is a filtered response + /// [Internal response](https://fetch.spec.whatwg.org/#concept-internal-response), only used if the Response + /// is a filtered response pub internal_response: Option<Box<Response>>, } diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs index b1b89de38f1..9024ff3989f 100644 --- a/components/net/http_loader.rs +++ b/components/net/http_loader.rs @@ -36,7 +36,8 @@ use std::boxed::FnBox; pub fn factory(cookies_chan: Sender<ControlMsg>, devtools_chan: Option<Sender<DevtoolsControlMsg>>) -> Box<FnBox(LoadData, LoadConsumer, Arc<MIMEClassifier>) + Send> { box move |load_data, senders, classifier| { - spawn_named("http_loader".to_owned(), move || load(load_data, senders, classifier, cookies_chan, devtools_chan)) + spawn_named("http_loader".to_owned(), + move || load(load_data, senders, classifier, cookies_chan, devtools_chan)) } } @@ -280,7 +281,9 @@ reason: \"certificate verify failed\" }]))"; Some(ref c) => { if c.preflight { // The preflight lied - send_error(url, "Preflight fetch inconsistent with main fetch".to_string(), start_chan); + send_error(url, + "Preflight fetch inconsistent with main fetch".to_string(), + start_chan); return; } else { // XXXManishearth There are some CORS-related steps here, @@ -347,7 +350,8 @@ reason: \"certificate verify failed\" }]))"; // Send an HttpResponse message to devtools with the corresponding request_id // TODO: Send this message only if load_data has a pipeline_id that is not None if let Some(ref chan) = devtools_chan { - let net_event_response = NetworkEvent::HttpResponse(metadata.headers.clone(), metadata.status.clone(), None); + let net_event_response = NetworkEvent::HttpResponse( + metadata.headers.clone(), metadata.status.clone(), None); chan.send(DevtoolsControlMsg::NetworkEventMessage(request_id, net_event_response)).unwrap(); } diff --git a/components/net/image_cache_task.rs b/components/net/image_cache_task.rs index 7b322f85b40..c16f5e9597b 100644 --- a/components/net/image_cache_task.rs +++ b/components/net/image_cache_task.rs @@ -332,7 +332,8 @@ impl ImageCache { url: url, sender: self.progress_sender.clone(), }; - self.resource_task.send(ControlMsg::Load(load_data, LoadConsumer::Listener(listener))).unwrap(); + let msg = ControlMsg::Load(load_data, LoadConsumer::Listener(listener)); + self.resource_task.send(msg).unwrap(); } } } diff --git a/components/net/resource_task.rs b/components/net/resource_task.rs index ac463503a1b..59880aefe00 100644 --- a/components/net/resource_task.rs +++ b/components/net/resource_task.rs @@ -105,7 +105,8 @@ pub fn start_sending_sniffed_opt(start_chan: LoadConsumer, mut metadata: Metadat let supplied_type = metadata.content_type.map(|ContentType(Mime(toplevel, sublevel, _))| { (format!("{}", toplevel), format!("{}", sublevel)) }); - metadata.content_type = classifier.classify(nosniff, check_for_apache_bug, &supplied_type, &partial_body).map(|(toplevel, sublevel)| { + metadata.content_type = classifier.classify(nosniff, check_for_apache_bug, &supplied_type, + &partial_body).map(|(toplevel, sublevel)| { let mime_tp: TopLevel = FromStr::from_str(&toplevel).unwrap(); let mime_sb: SubLevel = FromStr::from_str(&sublevel).unwrap(); ContentType(Mime(mime_tp, mime_sb, vec!())) @@ -138,7 +139,8 @@ pub fn start_sending_opt(start_chan: LoadConsumer, metadata: Metadata) -> Result } /// Create a ResourceTask -pub fn new_resource_task(user_agent: Option<String>, devtools_chan: Option<Sender<DevtoolsControlMsg>>) -> ResourceTask { +pub fn new_resource_task(user_agent: Option<String>, + devtools_chan: Option<Sender<DevtoolsControlMsg>>) -> ResourceTask { let (setup_chan, setup_port) = channel(); let setup_chan_clone = setup_chan.clone(); spawn_named("ResourceManager".to_owned(), move || { @@ -148,7 +150,8 @@ pub fn new_resource_task(user_agent: Option<String>, devtools_chan: Option<Sende } pub fn parse_hostsfile(hostsfile_content: &str) -> Box<HashMap<String, String>> { - let ipv4_regex = regex!(r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"); + let ipv4_regex = regex!( + r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"); let ipv6_regex = regex!(r"^([a-fA-F0-9]{0,4}[:]?){1,8}(/\d{1,3})?$"); let mut host_table = HashMap::new(); let lines: Vec<&str> = hostsfile_content.split('\n').collect(); @@ -191,8 +194,10 @@ struct ResourceManager { } impl ResourceManager { - fn new(from_client: Receiver<ControlMsg>, user_agent: Option<String>, - resource_task: Sender<ControlMsg>, devtools_channel: Option<Sender<DevtoolsControlMsg>>) -> ResourceManager { + fn new(from_client: Receiver<ControlMsg>, + user_agent: Option<String>, + resource_task: Sender<ControlMsg>, + devtools_channel: Option<Sender<DevtoolsControlMsg>>) -> ResourceManager { ResourceManager { from_client: from_client, user_agent: user_agent, @@ -250,7 +255,8 @@ impl ResourceManager { let loader = match &*load_data.url.scheme { "file" => from_factory(file_loader::factory), - "http" | "https" | "view-source" => http_loader::factory(self.resource_task.clone(), self.devtools_chan.clone()), + "http" | "https" | "view-source" => + http_loader::factory(self.resource_task.clone(), self.devtools_chan.clone()), "data" => from_factory(data_loader::factory), "about" => from_factory(about_loader::factory), _ => { diff --git a/components/net/storage_task.rs b/components/net/storage_task.rs index 4d24fad200e..82300a31722 100644 --- a/components/net/storage_task.rs +++ b/components/net/storage_task.rs @@ -102,7 +102,8 @@ impl StorageManager { /// Sends Some(old_value) in case there was a previous value with the same key name but with different /// value name, otherwise sends None - fn set_item(&mut self, sender: Sender<(bool, Option<DOMString>)>, url: Url, storage_type: StorageType, name: DOMString, value: DOMString) { + fn set_item(&mut self, sender: Sender<(bool, Option<DOMString>)>, url: Url, storage_type: StorageType, + name: DOMString, value: DOMString) { let origin = self.get_origin_as_string(url); let data = self.select_data_mut(storage_type); if !data.contains_key(&origin) { @@ -130,7 +131,8 @@ impl StorageManager { } /// Sends Some(old_value) in case there was a previous value with the key name, otherwise sends None - fn remove_item(&mut self, sender: Sender<Option<DOMString>>, url: Url, storage_type: StorageType, name: DOMString) { + fn remove_item(&mut self, sender: Sender<Option<DOMString>>, url: Url, storage_type: StorageType, + name: DOMString) { let origin = self.get_origin_as_string(url); let data = self.select_data_mut(storage_type); let old_value = data.get_mut(&origin).and_then(|entry| { diff --git a/components/plugins/jstraceable.rs b/components/plugins/jstraceable.rs index d11b0956bae..d0b55d65140 100644 --- a/components/plugins/jstraceable.rs +++ b/components/plugins/jstraceable.rs @@ -8,7 +8,8 @@ use syntax::ptr::P; use syntax::ast::{MetaItem, Expr}; use syntax::ast; use syntax::ext::build::AstBuilder; -use syntax::ext::deriving::generic::{combine_substructure, EnumMatching, FieldInfo, MethodDef, Struct, Substructure, TraitDef, ty}; +use syntax::ext::deriving::generic::{combine_substructure, EnumMatching, FieldInfo, MethodDef, Struct, + Substructure, TraitDef, ty}; pub fn expand_dom_struct(cx: &mut ExtCtxt, sp: Span, _: &MetaItem, anno: Annotatable) -> Annotatable { if let Annotatable::Item(item) = anno { @@ -31,8 +32,10 @@ pub fn expand_dom_struct(cx: &mut ExtCtxt, sp: Span, _: &MetaItem, anno: Annotat /// Provides the hook to expand `#[jstraceable]` into an implementation of `JSTraceable` /// -/// The expansion basically calls `trace()` on all of the fields of the struct/enum, erroring if they do not implement the method. -pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item: Annotatable, push: &mut FnMut(Annotatable)) { +/// The expansion basically calls `trace()` on all of the fields of the struct/enum, erroring if they do not +/// implement the method. +pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item: Annotatable, + push: &mut FnMut(Annotatable)) { let trait_def = TraitDef { span: span, attributes: Vec::new(), @@ -44,7 +47,8 @@ pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item: name: "trace", generics: ty::LifetimeBounds::empty(), explicit_self: ty::borrowed_explicit_self(), - args: vec!(ty::Ptr(box ty::Literal(ty::Path::new(vec!("js","jsapi","JSTracer"))), ty::Raw(ast::MutMutable))), + args: vec!(ty::Ptr(box ty::Literal(ty::Path::new(vec!("js","jsapi","JSTracer"))), + ty::Raw(ast::MutMutable))), ret_ty: ty::nil_ty(), attributes: vec![quote_attr!(cx, #[inline(always)])], is_unsafe: false, diff --git a/components/plugins/lib.rs b/components/plugins/lib.rs index a74cbe83f30..614cce94ab3 100644 --- a/components/plugins/lib.rs +++ b/components/plugins/lib.rs @@ -8,7 +8,8 @@ //! //! - `#[privatize]` : Forces all fields in a struct/enum to be private //! - `#[jstraceable]` : Auto-derives an implementation of `JSTraceable` for a struct in the script crate -//! - `#[must_root]` : Prevents data of the marked type from being used on the stack. See the lints module for more details +//! - `#[must_root]` : Prevents data of the marked type from being used on the stack. See the lints module for more +//! details //! - `#[dom_struct]` : Implies `#[privatize]`,`#[jstraceable]`, and `#[must_root]`. //! Use this for structs that correspond to a DOM type diff --git a/components/plugins/lints/inheritance_integrity.rs b/components/plugins/lints/inheritance_integrity.rs index d8cf22a102b..3f1d596693d 100644 --- a/components/plugins/lints/inheritance_integrity.rs +++ b/components/plugins/lints/inheritance_integrity.rs @@ -22,7 +22,8 @@ impl LintPass for InheritancePass { lint_array!(INHERITANCE_INTEGRITY) } - fn check_struct_def(&mut self, cx: &Context, def: &ast::StructDef, _i: ast::Ident, _gen: &ast::Generics, id: ast::NodeId) { + fn check_struct_def(&mut self, cx: &Context, def: &ast::StructDef, _i: ast::Ident, + _gen: &ast::Generics, id: ast::NodeId) { // Lints are run post expansion, so it's fine to use // #[_dom_struct_marker] here without also checking for #[dom_struct] if ty::has_attr(cx.tcx, ast_util::local_def(id), "_dom_struct_marker") { @@ -32,7 +33,8 @@ impl LintPass for InheritancePass { if match_lang_ty(cx, &*f.node.ty, "reflector") { if ctr > 0 { cx.span_lint(INHERITANCE_INTEGRITY, f.span, - "The Reflector should be the first field of the DOM struct"); + "The Reflector should be the first field of the DOM \ + struct"); } return true; } diff --git a/components/plugins/lints/privatize.rs b/components/plugins/lints/privatize.rs index 91ecf15d9da..d2b5e6744b9 100644 --- a/components/plugins/lints/privatize.rs +++ b/components/plugins/lints/privatize.rs @@ -13,7 +13,8 @@ declare_lint!(PRIVATIZE, Deny, /// Lint for keeping DOM fields private /// -/// This lint (disable with `-A privatize`/`#[allow(privatize)]`) ensures all types marked with `#[privatize]` have no private fields +/// This lint (disable with `-A privatize`/`#[allow(privatize)]`) ensures all types marked with `#[privatize]` +/// have no private fields pub struct PrivatizePass; impl LintPass for PrivatizePass { @@ -21,13 +22,19 @@ impl LintPass for PrivatizePass { lint_array!(PRIVATIZE) } - fn check_struct_def(&mut self, cx: &Context, def: &ast::StructDef, _i: ast::Ident, _gen: &ast::Generics, id: ast::NodeId) { + fn check_struct_def(&mut self, + cx: &Context, + def: &ast::StructDef, + _i: ast::Ident, + _gen: &ast::Generics, + id: ast::NodeId) { if ty::has_attr(cx.tcx, ast_util::local_def(id), "privatize") { for field in def.fields.iter() { match field.node { ast::StructField_ { kind: ast::NamedField(ident, visibility), .. } if visibility == Public => { cx.span_lint(PRIVATIZE, field.span, - &format!("Field {} is public where only private fields are allowed", ident.name)); + &format!("Field {} is public where only private fields are allowed", + ident.name)); } _ => {} } diff --git a/components/plugins/lints/unrooted_must_root.rs b/components/plugins/lints/unrooted_must_root.rs index e819f8d0e4d..927d60df5a0 100644 --- a/components/plugins/lints/unrooted_must_root.rs +++ b/components/plugins/lints/unrooted_must_root.rs @@ -15,14 +15,17 @@ declare_lint!(UNROOTED_MUST_ROOT, Deny, /// Lint for ensuring safe usage of unrooted pointers /// -/// This lint (disable with `-A unrooted-must-root`/`#[allow(unrooted_must_root)]`) ensures that `#[must_root]` values are used correctly. +/// This lint (disable with `-A unrooted-must-root`/`#[allow(unrooted_must_root)]`) ensures that `#[must_root]` +/// values are used correctly. +/// /// "Incorrect" usage includes: /// /// - Not being used in a struct/enum field which is not `#[must_root]` itself /// - Not being used as an argument to a function (Except onces named `new` and `new_inherited`) /// - Not being bound locally in a `let` statement, assignment, `for` loop, or `match` statement. /// -/// This helps catch most situations where pointers like `JS<T>` are used in a way that they can be invalidated by a GC pass. +/// This helps catch most situations where pointers like `JS<T>` are used in a way that they can be invalidated by a +/// GC pass. pub struct UnrootedPass; // Checks if a type has the #[must_root] annotation. @@ -31,7 +34,8 @@ pub struct UnrootedPass; fn lint_unrooted_ty(cx: &Context, ty: &ast::Ty, warning: &str) { match ty.node { ast::TyVec(ref t) | ast::TyFixedLengthVec(ref t, _) | - ast::TyPtr(ast::MutTy { ty: ref t, ..}) | ast::TyRptr(_, ast::MutTy { ty: ref t, ..}) => lint_unrooted_ty(cx, &**t, warning), + ast::TyPtr(ast::MutTy { ty: ref t, ..}) | ast::TyRptr(_, ast::MutTy { ty: ref t, ..}) => + lint_unrooted_ty(cx, &**t, warning), ast::TyPath(..) => { match cx.tcx.def_map.borrow()[&ty.id] { def::PathResolution{ base_def: def::DefTy(def_id, _), .. } => { @@ -51,7 +55,12 @@ impl LintPass for UnrootedPass { lint_array!(UNROOTED_MUST_ROOT) } /// All structs containing #[must_root] types must be #[must_root] themselves - fn check_struct_def(&mut self, cx: &Context, def: &ast::StructDef, _i: ast::Ident, _gen: &ast::Generics, id: ast::NodeId) { + fn check_struct_def(&mut self, + cx: &Context, + def: &ast::StructDef, + _i: ast::Ident, + _gen: &ast::Generics, + id: ast::NodeId) { let item = match cx.tcx.map.get(id) { ast_map::Node::NodeItem(item) => item, _ => cx.tcx.map.expect_item(cx.tcx.map.get_parent(id)), diff --git a/components/plugins/reflector.rs b/components/plugins/reflector.rs index d369dcbd3f3..f9df9b22c20 100644 --- a/components/plugins/reflector.rs +++ b/components/plugins/reflector.rs @@ -9,12 +9,14 @@ use syntax::ast; use utils::match_ty_unwrap; -pub fn expand_reflector(cx: &mut ExtCtxt, span: Span, _: &MetaItem, annotatable: Annotatable, push: &mut FnMut(Annotatable)) { +pub fn expand_reflector(cx: &mut ExtCtxt, span: Span, _: &MetaItem, annotatable: Annotatable, + push: &mut FnMut(Annotatable)) { if let Annotatable::Item(item) = annotatable { if let ast::ItemStruct(ref def, _) = item.node { let struct_name = item.ident; // This path has to be hardcoded, unfortunately, since we can't resolve paths at expansion time - match def.fields.iter().find(|f| match_ty_unwrap(&*f.node.ty, &["dom", "bindings", "utils", "Reflector"]).is_some()) { + match def.fields.iter().find( + |f| match_ty_unwrap(&*f.node.ty, &["dom", "bindings", "utils", "Reflector"]).is_some()) { // If it has a field that is a Reflector, use that Some(f) => { let field_name = f.node.ident(); diff --git a/components/plugins/utils.rs b/components/plugins/utils.rs index 3da728481e9..562ac89e0ba 100644 --- a/components/plugins/utils.rs +++ b/components/plugins/utils.rs @@ -83,6 +83,7 @@ pub fn unsafe_context(map: &ast_map::Map, id: ast::NodeId) -> bool { _ => false, } } - _ => false // There are probably a couple of other unsafe cases we don't care to lint, those will need to be added. + _ => false // There are probably a couple of other unsafe cases we don't care to lint, those will need + // to be added. } } diff --git a/components/script/cors.rs b/components/script/cors.rs index 0a0660c3d18..6587d07bc97 100644 --- a/components/script/cors.rs +++ b/components/script/cors.rs @@ -339,7 +339,11 @@ pub struct CORSCacheEntry { } impl CORSCacheEntry { - fn new (origin:Url, url: Url, max_age: u32, credentials: bool, header_or_method: HeaderOrMethod) -> CORSCacheEntry { + fn new(origin:Url, + url: Url, + max_age: u32, + credentials: bool, + header_or_method: HeaderOrMethod) -> CORSCacheEntry { CORSCacheEntry { origin: origin, url: url, @@ -354,9 +358,12 @@ impl CORSCacheEntry { impl CORSCache { /// https://fetch.spec.whatwg.org/#concept-cache-clear #[allow(dead_code)] - fn clear (&mut self, request: &CORSRequest) { + fn clear(&mut self, request: &CORSRequest) { let CORSCache(buf) = self.clone(); - let new_buf: Vec<CORSCacheEntry> = buf.into_iter().filter(|e| e.origin == request.origin && request.destination == e.url).collect(); + let new_buf: Vec<CORSCacheEntry> = + buf.into_iter() + .filter(|e| e.origin == request.origin && request.destination == e.url) + .collect(); *self = CORSCache(new_buf); } @@ -364,12 +371,16 @@ impl CORSCache { fn cleanup(&mut self) { let CORSCache(buf) = self.clone(); let now = time::now().to_timespec(); - let new_buf: Vec<CORSCacheEntry> = buf.into_iter().filter(|e| now.sec > e.created.sec + e.max_age as i64).collect(); + let new_buf: Vec<CORSCacheEntry> = buf.into_iter() + .filter(|e| now.sec > e.created.sec + e.max_age as i64) + .collect(); *self = CORSCache(new_buf); } /// https://fetch.spec.whatwg.org/#concept-cache-match-header - fn find_entry_by_header<'a>(&'a mut self, request: &CORSRequest, header_name: &str) -> Option<&'a mut CORSCacheEntry> { + fn find_entry_by_header<'a>(&'a mut self, + request: &CORSRequest, + header_name: &str) -> Option<&'a mut CORSCacheEntry> { self.cleanup(); let CORSCache(ref mut buf) = *self; // Credentials are not yet implemented here @@ -389,7 +400,9 @@ impl CORSCache { self.find_entry_by_header(request, header_name).map(|e| e.max_age = new_max_age).is_some() } - fn find_entry_by_method<'a>(&'a mut self, request: &CORSRequest, method: &Method) -> Option<&'a mut CORSCacheEntry> { + fn find_entry_by_method<'a>(&'a mut self, + request: &CORSRequest, + method: &Method) -> Option<&'a mut CORSCacheEntry> { // we can take the method from CORSRequest itself self.cleanup(); let CORSCache(ref mut buf) = *self; diff --git a/components/script/devtools.rs b/components/script/devtools.rs index d67f57b4e4f..cd093616207 100644 --- a/components/script/devtools.rs +++ b/components/script/devtools.rs @@ -36,7 +36,8 @@ pub fn handle_evaluate_js(page: &Rc<Page>, pipeline: PipelineId, eval: String, r EvaluateJSReply::NumberValue(FromJSValConvertible::from_jsval(cx, rval, ()).unwrap()) } else if rval.is_string() { //FIXME: use jsstring_to_str when jsval grows to_jsstring - EvaluateJSReply::StringValue(FromJSValConvertible::from_jsval(cx, rval, StringificationBehavior::Default).unwrap()) + EvaluateJSReply::StringValue( + FromJSValConvertible::from_jsval(cx, rval, StringificationBehavior::Default).unwrap()) } else if rval.is_null() { EvaluateJSReply::NullValue } else { @@ -95,7 +96,10 @@ pub fn handle_get_layout(page: &Rc<Page>, pipeline: PipelineId, node_id: String, reply.send((width, height)).unwrap(); } -pub fn handle_modify_attribute(page: &Rc<Page>, pipeline: PipelineId, node_id: String, modifications: Vec<Modification>) { +pub fn handle_modify_attribute(page: &Rc<Page>, + pipeline: PipelineId, + node_id: String, + modifications: Vec<Modification>) { let node = find_node_by_unique_id(&*page, pipeline, node_id).root(); let elem: JSRef<Element> = ElementCast::to_ref(node.r()).expect("should be getting layout of element"); diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 9b7d83c2c26..8d111592a24 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -378,7 +378,8 @@ impl RootedCollectionSet { } } - let dom_collections = &self.set[CollectionType::DOMObjects as usize] as *const _ as *const HashSet<*const RootedVec<JS<Void>>>; + let dom_collections = + &self.set[CollectionType::DOMObjects as usize] as *const _ as *const HashSet<*const RootedVec<JS<Void>>>; for dom_collection in (*dom_collections).iter() { for reflector in (**dom_collection).iter() { trace_reflector(tracer, "", reflector.reflector()); diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index b27a0c3e7e9..63536fdd296 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -66,7 +66,8 @@ impl Blob { } // http://dev.w3.org/2006/webapi/FileAPI/#constructorBlob - pub fn Constructor_(global: GlobalRef, blobParts: DOMString, blobPropertyBag: &BlobBinding::BlobPropertyBag) -> Fallible<Temporary<Blob>> { + pub fn Constructor_(global: GlobalRef, blobParts: DOMString, + blobPropertyBag: &BlobBinding::BlobPropertyBag) -> Fallible<Temporary<Blob>> { //TODO: accept other blobParts types - ArrayBuffer or ArrayBufferView or Blob let bytes: Option<Vec<u8>> = Some(blobParts.into_bytes()); let typeString = if is_ascii_printable(&blobPropertyBag.type_) { diff --git a/components/script/dom/browsercontext.rs b/components/script/dom/browsercontext.rs index 8744c169572..f51930f3f63 100644 --- a/components/script/dom/browsercontext.rs +++ b/components/script/dom/browsercontext.rs @@ -118,7 +118,8 @@ unsafe fn GetSubframeWindow(cx: *mut JSContext, proxy: *mut JSObject, id: jsid) } #[allow(unsafe_code)] -unsafe extern fn getOwnPropertyDescriptor(cx: *mut JSContext, proxy: *mut JSObject, id: jsid, set: bool, desc: *mut JSPropertyDescriptor) -> bool { +unsafe extern fn getOwnPropertyDescriptor(cx: *mut JSContext, proxy: *mut JSObject, id: jsid, + set: bool, desc: *mut JSPropertyDescriptor) -> bool { let window = GetSubframeWindow(cx, proxy, id); if let Some(window) = window { let window = window.root(); @@ -145,7 +146,8 @@ unsafe extern fn getOwnPropertyDescriptor(cx: *mut JSContext, proxy: *mut JSObje } #[allow(unsafe_code)] -unsafe extern fn defineProperty(cx: *mut JSContext, proxy: *mut JSObject, id: jsid, desc: *mut JSPropertyDescriptor) -> bool { +unsafe extern fn defineProperty(cx: *mut JSContext, proxy: *mut JSObject, id: jsid, + desc: *mut JSPropertyDescriptor) -> bool { if get_array_index_from_id(cx, id).is_some() { // Spec says to Reject whether this is a supported index or not, // since we have no indexed setter or indexed creator. That means @@ -178,7 +180,8 @@ unsafe extern fn hasOwn(cx: *mut JSContext, proxy: *mut JSObject, id: jsid, bp: } #[allow(unsafe_code)] -unsafe extern fn get(cx: *mut JSContext, proxy: *mut JSObject, receiver: *mut JSObject, id: jsid, vp: *mut JSVal) -> bool { +unsafe extern fn get(cx: *mut JSContext, proxy: *mut JSObject, receiver: *mut JSObject, id: jsid, + vp: *mut JSVal) -> bool { let window = GetSubframeWindow(cx, proxy, id); if let Some(window) = window { let window = window.root(); @@ -191,7 +194,8 @@ unsafe extern fn get(cx: *mut JSContext, proxy: *mut JSObject, receiver: *mut JS } #[allow(unsafe_code)] -unsafe extern fn set(cx: *mut JSContext, proxy: *mut JSObject, _receiver: *mut JSObject, id: jsid, _strict: bool, vp: *mut JSVal) -> bool { +unsafe extern fn set(cx: *mut JSContext, proxy: *mut JSObject, _receiver: *mut JSObject, + id: jsid, _strict: bool, vp: *mut JSVal) -> bool { if get_array_index_from_id(cx, id).is_some() { // Reject (which means throw if and only if strict) the set. // FIXME: Throw @@ -205,12 +209,14 @@ unsafe extern fn set(cx: *mut JSContext, proxy: *mut JSObject, _receiver: *mut J static PROXY_HANDLER: ProxyTraps = ProxyTraps { getPropertyDescriptor: Some(get_property_descriptor - as unsafe extern "C" fn(*mut JSContext, *mut JSObject, jsid, bool, *mut JSPropertyDescriptor) -> bool), + as unsafe extern "C" fn(*mut JSContext, *mut JSObject, jsid, bool, + *mut JSPropertyDescriptor) -> bool), getOwnPropertyDescriptor: Some(getOwnPropertyDescriptor as unsafe extern "C" fn(*mut JSContext, *mut JSObject, jsid, bool, *mut JSPropertyDescriptor) -> bool), - defineProperty: Some(defineProperty as unsafe extern "C" fn(*mut JSContext, *mut JSObject, jsid, *mut JSPropertyDescriptor) -> bool), + defineProperty: Some(defineProperty as unsafe extern "C" fn(*mut JSContext, *mut JSObject, jsid, + *mut JSPropertyDescriptor) -> bool), getOwnPropertyNames: None, delete_: None, enumerate: None, @@ -218,7 +224,8 @@ static PROXY_HANDLER: ProxyTraps = ProxyTraps { has: None, hasOwn: Some(hasOwn as unsafe extern "C" fn(*mut JSContext, *mut JSObject, jsid, *mut bool) -> bool), get: Some(get as unsafe extern "C" fn(*mut JSContext, *mut JSObject, *mut JSObject, jsid, *mut JSVal) -> bool), - set: Some(set as unsafe extern "C" fn(*mut JSContext, *mut JSObject, *mut JSObject, jsid, bool, *mut JSVal) -> bool), + set: Some(set as unsafe extern "C" fn(*mut JSContext, *mut JSObject, *mut JSObject, + jsid, bool, *mut JSVal) -> bool), keys: None, iterate: None, diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs index e27cfe74fe8..7ddce7791c9 100644 --- a/components/script/dom/canvasrenderingcontext2d.rs +++ b/components/script/dom/canvasrenderingcontext2d.rs @@ -221,7 +221,8 @@ impl CanvasRenderingContext2D { renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::GetImageData(source_rect, image_size, sender))).unwrap(); let imagedata = receiver.recv().unwrap(); // Writes pixels to destination canvas - CanvasMsg::Canvas2d(Canvas2dMsg::DrawImage(imagedata, source_rect.size, dest_rect, source_rect, smoothing_enabled)) + CanvasMsg::Canvas2d( + Canvas2dMsg::DrawImage(imagedata, source_rect.size, dest_rect, source_rect, smoothing_enabled)) }; self.renderer.send(msg).unwrap(); @@ -820,7 +821,9 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> } } StringOrCanvasGradientOrCanvasPattern::eCanvasGradient(gradient) => { - self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetFillStyle(gradient.root().r().to_fill_or_stroke_style()))).unwrap(); + let msg = CanvasMsg::Canvas2d( + Canvas2dMsg::SetFillStyle(gradient.root().r().to_fill_or_stroke_style())); + self.renderer.send(msg).unwrap(); } _ => {} } @@ -845,7 +848,11 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> } // https://html.spec.whatwg.org/multipage/#dom-context-2d-getimagedata - fn GetImageData(self, sx: Finite<f64>, sy: Finite<f64>, sw: Finite<f64>, sh: Finite<f64>) -> Fallible<Temporary<ImageData>> { + fn GetImageData(self, + sx: Finite<f64>, + sy: Finite<f64>, + sw: Finite<f64>, + sh: Finite<f64>) -> Fallible<Temporary<ImageData>> { let sx = *sx; let sy = *sy; let sw = *sw; @@ -871,7 +878,8 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> // XXX: // By the spec: http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas_CR/#dom-context-2d-putimagedata - // "If any of the arguments to the method are infinite or NaN, the method must throw a NotSupportedError exception" + // "If any of the arguments to the method are infinite or NaN, the method must throw a NotSupportedError + // exception" // But this arguments are stricted value, so if they are not finite values, // they will be TypeError by WebIDL spec before call this methods. @@ -880,7 +888,8 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> let image_data_size = Size2D(image_data_size.width as f64, image_data_size.height as f64); let image_data_rect = Rect(Point2D(dx, dy), image_data_size); let dirty_rect = None; - self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::PutImageData(data, image_data_rect, dirty_rect))).unwrap(); + let msg = CanvasMsg::Canvas2d(Canvas2dMsg::PutImageData(data, image_data_rect, dirty_rect)); + self.renderer.send(msg).unwrap(); self.mark_as_dirty(); } @@ -896,7 +905,8 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> // XXX: // By the spec: http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas_CR/#dom-context-2d-putimagedata - // "If any of the arguments to the method are infinite or NaN, the method must throw a NotSupportedError exception" + // "If any of the arguments to the method are infinite or NaN, the method must throw a NotSupportedError + // exception" // But this arguments are stricted value, so if they are not finite values, // they will be TypeError by WebIDL spec before call this methods. @@ -906,7 +916,8 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> imagedata.Height() as f64)); let dirty_rect = Some(Rect(Point2D(dirtyX, dirtyY), Size2D(dirtyWidth, dirtyHeight))); - self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::PutImageData(data, image_data_rect, dirty_rect))).unwrap(); + let msg = CanvasMsg::Canvas2d(Canvas2dMsg::PutImageData(data, image_data_rect, dirty_rect)); + self.renderer.send(msg).unwrap(); self.mark_as_dirty(); } @@ -919,7 +930,8 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> let y1 = *y1; if [x0, y0, x1, y1].iter().any(|x| x.is_nan() || x.is_infinite()) { - return Err(Type("One of the arguments of createLinearGradient() is not a finite floating-point value.".to_owned())); + return Err(Type("One of the arguments of createLinearGradient() is not a finite \ + floating-point value.".to_owned())); } Ok(CanvasGradient::new(self.global.root().r(), CanvasGradientStyle::Linear(LinearGradientStyle::new(x0, y0, x1, y1, Vec::new())))) @@ -927,7 +939,8 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> // https://html.spec.whatwg.org/multipage/#dom-context-2d-createradialgradient fn CreateRadialGradient(self, x0: Finite<f64>, y0: Finite<f64>, r0: Finite<f64>, - x1: Finite<f64>, y1: Finite<f64>, r1: Finite<f64>) -> Fallible<Temporary<CanvasGradient>> { + x1: Finite<f64>, y1: Finite<f64>, r1: Finite<f64>) + -> Fallible<Temporary<CanvasGradient>> { let x0 = *x0; let y0 = *y0; let r0 = *r0; @@ -936,10 +949,12 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> let r1 = *r1; if [x0, y0, r0, x1, y1, r1].iter().any(|x| x.is_nan() || x.is_infinite()) { - return Err(Type("One of the arguments of createRadialGradient() is not a finite floating-point value.".to_owned())); + return Err(Type("One of the arguments of createRadialGradient() is not a \ + finite floating-point value.".to_owned())); } Ok(CanvasGradient::new(self.global.root().r(), - CanvasGradientStyle::Radial(RadialGradientStyle::new(x0, y0, r0, x1, y1, r1, Vec::new())))) + CanvasGradientStyle::Radial( + RadialGradientStyle::new(x0, y0, r0, x1, y1, r1, Vec::new())))) } // https://html.spec.whatwg.org/multipage/#dom-context-2d-linewidth diff --git a/components/script/dom/closeevent.rs b/components/script/dom/closeevent.rs index 08ed8a07aa9..2d2e7d8e323 100644 --- a/components/script/dom/closeevent.rs +++ b/components/script/dom/closeevent.rs @@ -56,7 +56,11 @@ impl CloseEvent { init: &CloseEventBinding::CloseEventInit) -> Fallible<Temporary<CloseEvent>> { let bubbles = if init.parent.bubbles { EventBubbles::Bubbles } else { EventBubbles::DoesNotBubble }; - let cancelable = if init.parent.cancelable { EventCancelable::Cancelable } else { EventCancelable::NotCancelable }; + let cancelable = if init.parent.cancelable { + EventCancelable::Cancelable + } else { + EventCancelable::NotCancelable + }; Ok(CloseEvent::new(global, type_, bubbles, cancelable, init.wasClean, init.code, init.reason.clone())) } diff --git a/components/script/dom/customevent.rs b/components/script/dom/customevent.rs index f4a11be9dc2..5aa761d6846 100644 --- a/components/script/dom/customevent.rs +++ b/components/script/dom/customevent.rs @@ -41,7 +41,11 @@ impl CustomEvent { global, CustomEventBinding::Wrap) } - pub fn new(global: GlobalRef, type_: DOMString, bubbles: bool, cancelable: bool, detail: JSVal) -> Temporary<CustomEvent> { + pub fn new(global: GlobalRef, + type_: DOMString, + bubbles: bool, + cancelable: bool, + detail: JSVal) -> Temporary<CustomEvent> { let ev = CustomEvent::new_uninitialized(global).root(); ev.r().InitCustomEvent(global.get_cx(), type_, bubbles, cancelable, detail); Temporary::from_rooted(ev.r()) diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 6001cbc24ad..13f035f3e3f 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -381,7 +381,8 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> { let mut idmap = self.idmap.borrow_mut(); - let root = self.GetDocumentElement().expect("The element is in the document, so there must be a document element.").root(); + let root = self.GetDocumentElement().expect( + "The element is in the document, so there must be a document element.").root(); match idmap.entry(id) { Vacant(entry) => { @@ -764,7 +765,8 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> { match key { Key::Space if !prevented && state == KeyState::Released => { let maybe_elem: Option<JSRef<Element>> = ElementCast::to_ref(target); - maybe_elem.map(|el| el.as_maybe_activatable().map(|a| a.synthetic_click_activation(ctrl, alt, shift, meta))); + maybe_elem.map( + |el| el.as_maybe_activatable().map(|a| a.synthetic_click_activation(ctrl, alt, shift, meta))); } Key::Enter if !prevented && state == KeyState::Released => { let maybe_elem: Option<JSRef<Element>> = ElementCast::to_ref(target); @@ -1077,7 +1079,8 @@ impl<'a> PrivateClickEventHelpers for JSRef<'a, Node> { // NodeTypeId::Element(ElementTypeId::HTMLKeygenElement) | NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptionElement)) | NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)) | - NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement)) if self.get_disabled_state() => true, + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement)) + if self.get_disabled_state() => true, _ => false } } diff --git a/components/script/dom/domexception.rs b/components/script/dom/domexception.rs index 414e4481f16..434a6acc957 100644 --- a/components/script/dom/domexception.rs +++ b/components/script/dom/domexception.rs @@ -96,7 +96,8 @@ impl<'a> DOMExceptionMethods for JSRef<'a, DOMException> { DOMErrorName::URLMismatchError => "The given URL does not match another URL.", DOMErrorName::QuotaExceededError => "The quota has been exceeded.", DOMErrorName::TimeoutError => "The operation timed out.", - DOMErrorName::InvalidNodeTypeError => "The supplied node is incorrect or has an incorrect ancestor for this operation.", + DOMErrorName::InvalidNodeTypeError => + "The supplied node is incorrect or has an incorrect ancestor for this operation.", DOMErrorName::DataCloneError => "The object can not be cloned.", DOMErrorName::EncodingError => "The encoding operation (either encoded or decoding) failed." }; diff --git a/components/script/dom/domimplementation.rs b/components/script/dom/domimplementation.rs index d64ad103aa1..8171db316ac 100644 --- a/components/script/dom/domimplementation.rs +++ b/components/script/dom/domimplementation.rs @@ -129,12 +129,14 @@ impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> { { // Step 4. - let doc_html: Root<Node> = NodeCast::from_temporary(HTMLHtmlElement::new("html".to_owned(), None, doc.r())).root(); + let doc_html: Root<Node> = NodeCast::from_temporary( + HTMLHtmlElement::new("html".to_owned(), None, doc.r())).root(); assert!(doc_node.AppendChild(doc_html.r()).is_ok()); { // Step 5. - let doc_head: Root<Node> = NodeCast::from_temporary(HTMLHeadElement::new("head".to_owned(), None, doc.r())).root(); + let doc_head: Root<Node> = NodeCast::from_temporary( + HTMLHeadElement::new("head".to_owned(), None, doc.r())).root(); assert!(doc_html.r().AppendChild(doc_head.r()).is_ok()); // Step 6. @@ -142,7 +144,8 @@ impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> { None => (), Some(title_str) => { // Step 6.1. - let doc_title: Root<Node> = NodeCast::from_temporary(HTMLTitleElement::new("title".to_owned(), None, doc.r())).root(); + let doc_title: Root<Node> = NodeCast::from_temporary( + HTMLTitleElement::new("title".to_owned(), None, doc.r())).root(); assert!(doc_head.r().AppendChild(doc_title.r()).is_ok()); // Step 6.2. diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index b586172816d..3b830a982d1 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -151,9 +151,14 @@ impl Element { } } - pub fn new(local_name: DOMString, namespace: Namespace, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<Element> { - Node::reflect_node(box Element::new_inherited(ElementTypeId::Element, local_name, namespace, prefix, document), - document, ElementBinding::Wrap) + pub fn new(local_name: DOMString, + namespace: Namespace, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<Element> { + Node::reflect_node( + box Element::new_inherited(ElementTypeId::Element, local_name, namespace, prefix, document), + document, + ElementBinding::Wrap) } } @@ -846,7 +851,10 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> { fn get_attribute(self, namespace: &Namespace, local_name: &Atom) -> Option<Temporary<Attr>> { let mut attributes = RootedVec::new(); self.get_attributes(local_name, &mut attributes); - attributes.iter().map(|attr| attr.root()).find(|attr| attr.r().namespace() == namespace).map(|x| Temporary::from_rooted(x.r())) + attributes.iter() + .map(|attr| attr.root()) + .find(|attr| attr.r().namespace() == namespace) + .map(|x| Temporary::from_rooted(x.r())) } // https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name diff --git a/components/script/dom/errorevent.rs b/components/script/dom/errorevent.rs index 0be4acdb245..a43dd368505 100644 --- a/components/script/dom/errorevent.rs +++ b/components/script/dom/errorevent.rs @@ -97,7 +97,11 @@ impl ErrorEvent { let bubbles = if init.parent.bubbles { EventBubbles::Bubbles } else { EventBubbles::DoesNotBubble }; - let cancelable = if init.parent.cancelable { EventCancelable::Cancelable } else { EventCancelable::NotCancelable }; + let cancelable = if init.parent.cancelable { + EventCancelable::Cancelable + } else { + EventCancelable::NotCancelable + }; let event = ErrorEvent::new(global, type_, bubbles, cancelable, diff --git a/components/script/dom/htmlanchorelement.rs b/components/script/dom/htmlanchorelement.rs index 9ed6b5df5c7..21aff2de855 100644 --- a/components/script/dom/htmlanchorelement.rs +++ b/components/script/dom/htmlanchorelement.rs @@ -38,20 +38,27 @@ pub struct HTMLAnchorElement { impl HTMLAnchorElementDerived for EventTarget { fn is_htmlanchorelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAnchorElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAnchorElement))) } } impl HTMLAnchorElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLAnchorElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLAnchorElement { HTMLAnchorElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLAnchorElement, localName, prefix, document), + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLAnchorElement, localName, prefix, document), rel_list: Default::default(), } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLAnchorElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLAnchorElement> { let element = HTMLAnchorElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLAnchorElementBinding::Wrap) } @@ -133,7 +140,8 @@ impl<'a> Activatable for JSRef<'a, HTMLAnchorElement> { if target.is_htmlimageelement() && element.has_attribute(&atom!("ismap")) { let target_node = NodeCast::to_ref(target).unwrap(); - let rect = window_from_node(target_node).root().r().content_box_query(target_node.to_trusted_node_address()); + let rect = window_from_node(target_node).root().r().content_box_query( + target_node.to_trusted_node_address()); ismap_suffix = Some( format!("?{},{}", mouse_event.ClientX().to_f32().unwrap() - rect.origin.x.to_f32_px(), mouse_event.ClientY().to_f32().unwrap() - rect.origin.y.to_f32_px()) diff --git a/components/script/dom/htmlappletelement.rs b/components/script/dom/htmlappletelement.rs index 585df5d5273..66509384e60 100644 --- a/components/script/dom/htmlappletelement.rs +++ b/components/script/dom/htmlappletelement.rs @@ -26,19 +26,26 @@ pub struct HTMLAppletElement { impl HTMLAppletElementDerived for EventTarget { fn is_htmlappletelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAppletElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAppletElement))) } } impl HTMLAppletElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLAppletElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLAppletElement { HTMLAppletElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLAppletElement, localName, prefix, document) + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLAppletElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLAppletElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLAppletElement> { let element = HTMLAppletElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLAppletElementBinding::Wrap) } diff --git a/components/script/dom/htmlareaelement.rs b/components/script/dom/htmlareaelement.rs index 9c7d255a5b4..1baa1379978 100644 --- a/components/script/dom/htmlareaelement.rs +++ b/components/script/dom/htmlareaelement.rs @@ -29,7 +29,9 @@ pub struct HTMLAreaElement { impl HTMLAreaElementDerived for EventTarget { fn is_htmlareaelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAreaElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAreaElement))) } } @@ -42,7 +44,9 @@ impl HTMLAreaElement { } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLAreaElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLAreaElement> { let element = HTMLAreaElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLAreaElementBinding::Wrap) } diff --git a/components/script/dom/htmlaudioelement.rs b/components/script/dom/htmlaudioelement.rs index eff07c1c7cf..de0b38c22f8 100644 --- a/components/script/dom/htmlaudioelement.rs +++ b/components/script/dom/htmlaudioelement.rs @@ -28,14 +28,19 @@ impl HTMLAudioElementDerived for EventTarget { } impl HTMLAudioElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLAudioElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLAudioElement { HTMLAudioElement { - htmlmediaelement: HTMLMediaElement::new_inherited(HTMLMediaElementTypeId::HTMLAudioElement, localName, prefix, document) + htmlmediaelement: + HTMLMediaElement::new_inherited(HTMLMediaElementTypeId::HTMLAudioElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLAudioElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLAudioElement> { let element = HTMLAudioElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLAudioElementBinding::Wrap) } diff --git a/components/script/dom/htmlbaseelement.rs b/components/script/dom/htmlbaseelement.rs index 76745d1d1c8..e66969b7090 100644 --- a/components/script/dom/htmlbaseelement.rs +++ b/components/script/dom/htmlbaseelement.rs @@ -19,7 +19,9 @@ pub struct HTMLBaseElement { impl HTMLBaseElementDerived for EventTarget { fn is_htmlbaseelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBaseElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBaseElement))) } } @@ -31,7 +33,9 @@ impl HTMLBaseElement { } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLBaseElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLBaseElement> { let element = HTMLBaseElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLBaseElementBinding::Wrap) } diff --git a/components/script/dom/htmlbodyelement.rs b/components/script/dom/htmlbodyelement.rs index c716be93d39..8145c2f3866 100644 --- a/components/script/dom/htmlbodyelement.rs +++ b/components/script/dom/htmlbodyelement.rs @@ -32,7 +32,9 @@ pub struct HTMLBodyElement { impl HTMLBodyElementDerived for EventTarget { fn is_htmlbodyelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBodyElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBodyElement))) } } diff --git a/components/script/dom/htmlbrelement.rs b/components/script/dom/htmlbrelement.rs index db8eeeb5924..b0e881e040b 100644 --- a/components/script/dom/htmlbrelement.rs +++ b/components/script/dom/htmlbrelement.rs @@ -19,7 +19,9 @@ pub struct HTMLBRElement { impl HTMLBRElementDerived for EventTarget { fn is_htmlbrelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBRElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBRElement))) } } @@ -31,7 +33,9 @@ impl HTMLBRElement { } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLBRElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLBRElement> { let element = HTMLBRElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLBRElementBinding::Wrap) } diff --git a/components/script/dom/htmlbuttonelement.rs b/components/script/dom/htmlbuttonelement.rs index 38ed9b26e74..3bb7012cab4 100644 --- a/components/script/dom/htmlbuttonelement.rs +++ b/components/script/dom/htmlbuttonelement.rs @@ -45,21 +45,28 @@ pub struct HTMLButtonElement { impl HTMLButtonElementDerived for EventTarget { fn is_htmlbuttonelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement))) } } impl HTMLButtonElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLButtonElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLButtonElement { HTMLButtonElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLButtonElement, localName, prefix, document), + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLButtonElement, localName, prefix, document), //TODO: implement button_type in after_set_attr button_type: Cell::new(ButtonType::ButtonSubmit) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLButtonElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLButtonElement> { let element = HTMLButtonElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLButtonElementBinding::Wrap) } @@ -96,7 +103,8 @@ impl<'a> HTMLButtonElementMethods for JSRef<'a, HTMLButtonElement> { make_setter!(SetFormAction, "formaction"); - make_enumerated_getter!(FormEnctype, "application/x-www-form-urlencoded", ("text/plain") | ("multipart/form-data")); + make_enumerated_getter!( + FormEnctype, "application/x-www-form-urlencoded", ("text/plain") | ("multipart/form-data")); make_setter!(SetFormEnctype, "formenctype"); diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs index 5d3b01427bf..3a4d7c15d18 100644 --- a/components/script/dom/htmlcanvaselement.rs +++ b/components/script/dom/htmlcanvaselement.rs @@ -47,14 +47,19 @@ pub struct HTMLCanvasElement { impl HTMLCanvasElementDerived for EventTarget { fn is_htmlcanvaselement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLCanvasElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLCanvasElement))) } } impl HTMLCanvasElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLCanvasElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLCanvasElement { HTMLCanvasElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLCanvasElement, localName, prefix, document), + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLCanvasElement, localName, prefix, document), context_2d: Default::default(), context_webgl: Default::default(), width: Cell::new(DEFAULT_WIDTH), @@ -63,7 +68,9 @@ impl HTMLCanvasElement { } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLCanvasElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLCanvasElement> { let element = HTMLCanvasElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLCanvasElementBinding::Wrap) } @@ -182,7 +189,9 @@ impl<'a> HTMLCanvasElementMethods for JSRef<'a, HTMLCanvasElement> { let size = self.get_size(); CanvasRenderingContext2D::new(GlobalRef::Window(window.r()), self, size) }); - Some(CanvasRenderingContext2DOrWebGLRenderingContext::eCanvasRenderingContext2D(Unrooted::from_temporary(context_2d))) + Some( + CanvasRenderingContext2DOrWebGLRenderingContext::eCanvasRenderingContext2D( + Unrooted::from_temporary(context_2d))) } "webgl" | "experimental-webgl" => { if self.context_2d.get().is_some() { diff --git a/components/script/dom/htmldataelement.rs b/components/script/dom/htmldataelement.rs index fa455dc772c..02148e319fb 100644 --- a/components/script/dom/htmldataelement.rs +++ b/components/script/dom/htmldataelement.rs @@ -19,19 +19,25 @@ pub struct HTMLDataElement { impl HTMLDataElementDerived for EventTarget { fn is_htmldataelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDataElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDataElement))) } } impl HTMLDataElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLDataElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLDataElement { HTMLDataElement { htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLDataElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLDataElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLDataElement> { let element = HTMLDataElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLDataElementBinding::Wrap) } diff --git a/components/script/dom/htmldatalistelement.rs b/components/script/dom/htmldatalistelement.rs index d674af0cb59..d9bd35279ef 100644 --- a/components/script/dom/htmldatalistelement.rs +++ b/components/script/dom/htmldatalistelement.rs @@ -23,19 +23,26 @@ pub struct HTMLDataListElement { impl HTMLDataListElementDerived for EventTarget { fn is_htmldatalistelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDataListElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDataListElement))) } } impl HTMLDataListElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLDataListElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLDataListElement { HTMLDataListElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLDataListElement, localName, prefix, document) + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLDataListElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLDataListElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLDataListElement> { let element = HTMLDataListElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLDataListElementBinding::Wrap) } diff --git a/components/script/dom/htmldialogelement.rs b/components/script/dom/htmldialogelement.rs index 6d332530f55..c614f55a691 100644 --- a/components/script/dom/htmldialogelement.rs +++ b/components/script/dom/htmldialogelement.rs @@ -25,20 +25,27 @@ pub struct HTMLDialogElement { impl HTMLDialogElementDerived for EventTarget { fn is_htmldialogelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDialogElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDialogElement))) } } impl HTMLDialogElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLDialogElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLDialogElement { HTMLDialogElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLDialogElement, localName, prefix, document), + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLDialogElement, localName, prefix, document), return_value: DOMRefCell::new("".to_owned()), } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLDialogElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLDialogElement> { let element = HTMLDialogElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLDialogElementBinding::Wrap) } diff --git a/components/script/dom/htmldirectoryelement.rs b/components/script/dom/htmldirectoryelement.rs index 10691999e21..7c0eeb0d616 100644 --- a/components/script/dom/htmldirectoryelement.rs +++ b/components/script/dom/htmldirectoryelement.rs @@ -19,19 +19,26 @@ pub struct HTMLDirectoryElement { impl HTMLDirectoryElementDerived for EventTarget { fn is_htmldirectoryelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDirectoryElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDirectoryElement))) } } impl HTMLDirectoryElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLDirectoryElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLDirectoryElement { HTMLDirectoryElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLDirectoryElement, localName, prefix, document) + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLDirectoryElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLDirectoryElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLDirectoryElement> { let element = HTMLDirectoryElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLDirectoryElementBinding::Wrap) } diff --git a/components/script/dom/htmldivelement.rs b/components/script/dom/htmldivelement.rs index 653ad2aa0a8..6a7bb96cc5d 100644 --- a/components/script/dom/htmldivelement.rs +++ b/components/script/dom/htmldivelement.rs @@ -19,19 +19,25 @@ pub struct HTMLDivElement { impl HTMLDivElementDerived for EventTarget { fn is_htmldivelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDivElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDivElement))) } } impl HTMLDivElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLDivElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLDivElement { HTMLDivElement { htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLDivElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLDivElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLDivElement> { let element = HTMLDivElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLDivElementBinding::Wrap) } diff --git a/components/script/dom/htmldlistelement.rs b/components/script/dom/htmldlistelement.rs index 41e5ea94f9c..94e579836cf 100644 --- a/components/script/dom/htmldlistelement.rs +++ b/components/script/dom/htmldlistelement.rs @@ -19,19 +19,24 @@ pub struct HTMLDListElement { impl HTMLDListElementDerived for EventTarget { fn is_htmldlistelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDListElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDListElement))) } } impl HTMLDListElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLDListElement { HTMLDListElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLDListElement, localName, prefix, document) + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLDListElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLDListElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLDListElement> { let element = HTMLDListElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLDListElementBinding::Wrap) } diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index b3ffe4b056f..ffa13308375 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -54,9 +54,13 @@ impl HTMLElementDerived for EventTarget { } impl HTMLElement { - pub fn new_inherited(type_id: HTMLElementTypeId, tag_name: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLElement { + pub fn new_inherited(type_id: HTMLElementTypeId, + tag_name: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLElement { HTMLElement { - element: Element::new_inherited(ElementTypeId::HTMLElement(type_id), tag_name, ns!(HTML), prefix, document), + element: + Element::new_inherited(ElementTypeId::HTMLElement(type_id), tag_name, ns!(HTML), prefix, document), style_decl: Default::default(), dataset: Default::default(), } diff --git a/components/script/dom/htmlembedelement.rs b/components/script/dom/htmlembedelement.rs index f3779f9c33c..2e961d6642f 100644 --- a/components/script/dom/htmlembedelement.rs +++ b/components/script/dom/htmlembedelement.rs @@ -19,7 +19,9 @@ pub struct HTMLEmbedElement { impl HTMLEmbedElementDerived for EventTarget { fn is_htmlembedelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLEmbedElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLEmbedElement))) } } @@ -31,7 +33,9 @@ impl HTMLEmbedElement { } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLEmbedElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLEmbedElement> { let element = HTMLEmbedElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLEmbedElementBinding::Wrap) } diff --git a/components/script/dom/htmlfieldsetelement.rs b/components/script/dom/htmlfieldsetelement.rs index 27feed8eb3a..ba786f095c7 100644 --- a/components/script/dom/htmlfieldsetelement.rs +++ b/components/script/dom/htmlfieldsetelement.rs @@ -28,19 +28,26 @@ pub struct HTMLFieldSetElement { impl HTMLFieldSetElementDerived for EventTarget { fn is_htmlfieldsetelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFieldSetElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFieldSetElement))) } } impl HTMLFieldSetElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLFieldSetElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLFieldSetElement { HTMLFieldSetElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLFieldSetElement, localName, prefix, document) + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLFieldSetElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLFieldSetElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLFieldSetElement> { let element = HTMLFieldSetElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLFieldSetElementBinding::Wrap) } @@ -105,10 +112,14 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLFieldSetElement> { for descendant in child.r().traverse_preorder() { let descendant = descendant.root(); match descendant.r().type_id() { - NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement)) | - NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)) | - NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)) | - NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement)) => { + NodeTypeId::Element( + ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement)) | + NodeTypeId::Element( + ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)) | + NodeTypeId::Element( + ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)) | + NodeTypeId::Element( + ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement)) => { descendant.r().set_disabled_state(true); descendant.r().set_enabled_state(false); }, @@ -144,10 +155,14 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLFieldSetElement> { for descendant in child.r().traverse_preorder() { let descendant = descendant.root(); match descendant.r().type_id() { - NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement)) | - NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)) | - NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)) | - NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement)) => { + NodeTypeId::Element( + ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement)) | + NodeTypeId::Element( + ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)) | + NodeTypeId::Element( + ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)) | + NodeTypeId::Element( + ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement)) => { descendant.r().check_disabled_attribute(); descendant.r().check_ancestors_disabled_state_for_form_control(); }, diff --git a/components/script/dom/htmlfontelement.rs b/components/script/dom/htmlfontelement.rs index d2faa87441c..6a69751aac5 100644 --- a/components/script/dom/htmlfontelement.rs +++ b/components/script/dom/htmlfontelement.rs @@ -26,7 +26,9 @@ pub struct HTMLFontElement { impl HTMLFontElementDerived for EventTarget { fn is_htmlfontelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFontElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFontElement))) } } @@ -39,7 +41,9 @@ impl HTMLFontElement { } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLFontElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLFontElement> { let element = HTMLFontElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLFontElementBinding::Wrap) } diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index 3d6ad028ab7..254465dc416 100644 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -51,12 +51,16 @@ pub struct HTMLFormElement { impl HTMLFormElementDerived for EventTarget { fn is_htmlformelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFormElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFormElement))) } } impl HTMLFormElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLFormElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLFormElement { HTMLFormElement { htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLFormElement, localName, prefix, document), marked_for_reset: Cell::new(false), @@ -64,7 +68,9 @@ impl HTMLFormElement { } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLFormElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLFormElement> { let element = HTMLFormElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLFormElementBinding::Wrap) } diff --git a/components/script/dom/htmlframeelement.rs b/components/script/dom/htmlframeelement.rs index 565c2e9a7a9..c9107fa7c33 100644 --- a/components/script/dom/htmlframeelement.rs +++ b/components/script/dom/htmlframeelement.rs @@ -19,7 +19,9 @@ pub struct HTMLFrameElement { impl HTMLFrameElementDerived for EventTarget { fn is_htmlframeelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFrameElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFrameElement))) } } @@ -31,7 +33,9 @@ impl HTMLFrameElement { } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLFrameElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLFrameElement> { let element = HTMLFrameElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLFrameElementBinding::Wrap) } diff --git a/components/script/dom/htmlframesetelement.rs b/components/script/dom/htmlframesetelement.rs index 060f4a63018..529efa599bd 100644 --- a/components/script/dom/htmlframesetelement.rs +++ b/components/script/dom/htmlframesetelement.rs @@ -19,19 +19,26 @@ pub struct HTMLFrameSetElement { impl HTMLFrameSetElementDerived for EventTarget { fn is_htmlframesetelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFrameSetElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFrameSetElement))) } } impl HTMLFrameSetElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLFrameSetElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLFrameSetElement { HTMLFrameSetElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLFrameSetElement, localName, prefix, document) + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLFrameSetElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLFrameSetElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLFrameSetElement> { let element = HTMLFrameSetElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLFrameSetElementBinding::Wrap) } diff --git a/components/script/dom/htmlheadelement.rs b/components/script/dom/htmlheadelement.rs index cc02c8a0d39..57b365185d3 100644 --- a/components/script/dom/htmlheadelement.rs +++ b/components/script/dom/htmlheadelement.rs @@ -21,19 +21,25 @@ pub struct HTMLHeadElement { impl HTMLHeadElementDerived for EventTarget { fn is_htmlheadelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHeadElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHeadElement))) } } impl HTMLHeadElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLHeadElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLHeadElement { HTMLHeadElement { htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLHeadElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLHeadElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLHeadElement> { let element = HTMLHeadElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLHeadElementBinding::Wrap) } diff --git a/components/script/dom/htmlheadingelement.rs b/components/script/dom/htmlheadingelement.rs index 2cd4dd3af30..bb701236a8a 100644 --- a/components/script/dom/htmlheadingelement.rs +++ b/components/script/dom/htmlheadingelement.rs @@ -30,20 +30,29 @@ pub struct HTMLHeadingElement { impl HTMLHeadingElementDerived for EventTarget { fn is_htmlheadingelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHeadingElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHeadingElement))) } } impl HTMLHeadingElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>, level: HeadingLevel) -> HTMLHeadingElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>, + level: HeadingLevel) -> HTMLHeadingElement { HTMLHeadingElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLHeadingElement, localName, prefix, document), + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLHeadingElement, localName, prefix, document), level: level, } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>, level: HeadingLevel) -> Temporary<HTMLHeadingElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>, + level: HeadingLevel) -> Temporary<HTMLHeadingElement> { let element = HTMLHeadingElement::new_inherited(localName, prefix, document, level); Node::reflect_node(box element, document, HTMLHeadingElementBinding::Wrap) } diff --git a/components/script/dom/htmlhrelement.rs b/components/script/dom/htmlhrelement.rs index 302dcafcf2b..71e8a4a6a41 100644 --- a/components/script/dom/htmlhrelement.rs +++ b/components/script/dom/htmlhrelement.rs @@ -19,7 +19,9 @@ pub struct HTMLHRElement { impl HTMLHRElementDerived for EventTarget { fn is_htmlhrelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHRElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHRElement))) } } @@ -31,7 +33,9 @@ impl HTMLHRElement { } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLHRElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLHRElement> { let element = HTMLHRElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLHRElementBinding::Wrap) } diff --git a/components/script/dom/htmlhtmlelement.rs b/components/script/dom/htmlhtmlelement.rs index f9e98199430..f22f822cbdd 100644 --- a/components/script/dom/htmlhtmlelement.rs +++ b/components/script/dom/htmlhtmlelement.rs @@ -19,7 +19,9 @@ pub struct HTMLHtmlElement { impl HTMLHtmlElementDerived for EventTarget { fn is_htmlhtmlelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHtmlElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHtmlElement))) } } @@ -31,7 +33,9 @@ impl HTMLHtmlElement { } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLHtmlElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLHtmlElement> { let element = HTMLHtmlElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLHtmlElementBinding::Wrap) } diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index fe09197e06b..13ec9d9c5a1 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -7,7 +7,8 @@ use dom::bindings::codegen::Bindings::HTMLIFrameElementBinding; use dom::bindings::codegen::Bindings::HTMLIFrameElementBinding::HTMLIFrameElementMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::codegen::InheritTypes::{NodeCast, ElementCast, EventCast}; -use dom::bindings::codegen::InheritTypes::{EventTargetCast, HTMLElementCast, HTMLIFrameElementDerived}; +use dom::bindings::codegen::InheritTypes::{EventTargetCast, HTMLElementCast, + HTMLIFrameElementDerived}; use dom::bindings::conversions::ToJSValConvertible; use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::error::Error::NotSupported; @@ -59,7 +60,9 @@ pub struct HTMLIFrameElement { impl HTMLIFrameElementDerived for EventTarget { fn is_htmliframeelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLIFrameElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLIFrameElement))) } } @@ -191,9 +194,12 @@ impl RawHTMLIFrameElementHelpers for HTMLIFrameElement { } impl HTMLIFrameElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLIFrameElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLIFrameElement { HTMLIFrameElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLIFrameElement, localName, prefix, document), + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLIFrameElement, localName, prefix, document), subpage_id: Cell::new(None), containing_page_pipeline_id: Cell::new(None), sandbox: Cell::new(None), @@ -201,7 +207,9 @@ impl HTMLIFrameElement { } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLIFrameElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLIFrameElement> { let element = HTMLIFrameElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLIFrameElementBinding::Wrap) } diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index 09b6c950da4..a01664f249d 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -7,7 +7,8 @@ use dom::attr::{AttrHelpers, AttrValue}; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::HTMLImageElementBinding; use dom::bindings::codegen::Bindings::HTMLImageElementBinding::HTMLImageElementMethods; -use dom::bindings::codegen::InheritTypes::{NodeCast, ElementCast, EventTargetCast, HTMLElementCast, HTMLImageElementDerived}; +use dom::bindings::codegen::InheritTypes::{NodeCast, ElementCast, EventTargetCast, HTMLElementCast, + HTMLImageElementDerived}; use dom::bindings::global::GlobalRef; use dom::bindings::js::{JSRef, LayoutJS, Rootable, Temporary}; use dom::bindings::refcounted::Trusted; @@ -40,7 +41,9 @@ pub struct HTMLImageElement { impl HTMLImageElementDerived for EventTarget { fn is_htmlimageelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLImageElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLImageElement))) } } @@ -143,7 +146,9 @@ impl HTMLImageElement { } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLImageElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLImageElement> { let element = HTMLImageElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLImageElementBinding::Wrap) } diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index eb784c91b6f..1525d8f88e8 100644 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -105,7 +105,9 @@ impl InputActivationState { impl HTMLInputElementDerived for EventTarget { fn is_htmlinputelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement))) } } @@ -129,7 +131,9 @@ impl HTMLInputElement { } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLInputElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLInputElement> { let element = HTMLInputElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLInputElementBinding::Wrap) } @@ -297,7 +301,8 @@ impl<'a> HTMLInputElementMethods for JSRef<'a, HTMLInputElement> { make_setter!(SetFormAction, "formaction"); // https://html.spec.whatwg.org/multipage/#dom-input-formenctype - make_enumerated_getter!(FormEnctype, "application/x-www-form-urlencoded", ("text/plain") | ("multipart/form-data")); + make_enumerated_getter!( + FormEnctype, "application/x-www-form-urlencoded", ("text/plain") | ("multipart/form-data")); // https://html.spec.whatwg.org/multipage/#dom-input-formenctype make_setter!(SetFormEnctype, "formenctype"); @@ -678,9 +683,11 @@ impl<'a> Activatable for JSRef<'a, HTMLInputElement> { // https://html.spec.whatwg.org/multipage/#reset-button-state-(type=reset):activation-behavior // InputType::InputSubmit => (), // No behavior defined InputType::InputCheckbox => { - // https://html.spec.whatwg.org/multipage/#checkbox-state-(type=checkbox):pre-click-activation-steps - // cache current values of `checked` and `indeterminate` - // we may need to restore them later + /* + https://html.spec.whatwg.org/multipage/#checkbox-state-(type=checkbox):pre-click-activation-steps + cache current values of `checked` and `indeterminate` + we may need to restore them later + */ cache.indeterminate = self.Indeterminate(); cache.checked = self.Checked(); cache.checked_changed = self.checked_changed.get(); diff --git a/components/script/dom/htmllabelelement.rs b/components/script/dom/htmllabelelement.rs index a6db0ada537..926b789e98c 100644 --- a/components/script/dom/htmllabelelement.rs +++ b/components/script/dom/htmllabelelement.rs @@ -19,19 +19,26 @@ pub struct HTMLLabelElement { impl HTMLLabelElementDerived for EventTarget { fn is_htmllabelelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLabelElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLabelElement))) } } impl HTMLLabelElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLLabelElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLLabelElement { HTMLLabelElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLLabelElement, localName, prefix, document) + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLLabelElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLLabelElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLLabelElement> { let element = HTMLLabelElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLLabelElementBinding::Wrap) } diff --git a/components/script/dom/htmllegendelement.rs b/components/script/dom/htmllegendelement.rs index 38c3a154400..49f3e712b9f 100644 --- a/components/script/dom/htmllegendelement.rs +++ b/components/script/dom/htmllegendelement.rs @@ -19,19 +19,26 @@ pub struct HTMLLegendElement { impl HTMLLegendElementDerived for EventTarget { fn is_htmllegendelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLegendElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLegendElement))) } } impl HTMLLegendElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLLegendElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLLegendElement { HTMLLegendElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLLegendElement, localName, prefix, document) + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLLegendElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLLegendElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLLegendElement> { let element = HTMLLegendElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLLegendElementBinding::Wrap) } diff --git a/components/script/dom/htmllielement.rs b/components/script/dom/htmllielement.rs index 09d60655ac7..f8d8b0939c8 100644 --- a/components/script/dom/htmllielement.rs +++ b/components/script/dom/htmllielement.rs @@ -19,7 +19,9 @@ pub struct HTMLLIElement { impl HTMLLIElementDerived for EventTarget { fn is_htmllielement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLIElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLIElement))) } } @@ -31,7 +33,9 @@ impl HTMLLIElement { } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLLIElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLLIElement> { let element = HTMLLIElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLLIElementBinding::Wrap) } diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs index 275194bdd7f..c0d38221e2e 100644 --- a/components/script/dom/htmllinkelement.rs +++ b/components/script/dom/htmllinkelement.rs @@ -44,7 +44,9 @@ pub struct HTMLLinkElement { impl HTMLLinkElementDerived for EventTarget { fn is_htmllinkelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLinkElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLinkElement))) } } @@ -57,7 +59,9 @@ impl HTMLLinkElement { } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLLinkElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLLinkElement> { let element = HTMLLinkElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLLinkElementBinding::Wrap) } diff --git a/components/script/dom/htmlmapelement.rs b/components/script/dom/htmlmapelement.rs index be58a71738d..4e3654e47c1 100644 --- a/components/script/dom/htmlmapelement.rs +++ b/components/script/dom/htmlmapelement.rs @@ -19,19 +19,25 @@ pub struct HTMLMapElement { impl HTMLMapElementDerived for EventTarget { fn is_htmlmapelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMapElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMapElement))) } } impl HTMLMapElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLMapElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLMapElement { HTMLMapElement { htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLMapElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLMapElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLMapElement> { let element = HTMLMapElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLMapElementBinding::Wrap) } diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index fbd12be244c..d56ea964f91 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -19,7 +19,8 @@ pub struct HTMLMediaElement { impl HTMLMediaElementDerived for EventTarget { fn is_htmlmediaelement(&self) -> bool { match *self.type_id() { - EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMediaElement(_)))) => true, + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMediaElement(_)))) => true, _ => false } } @@ -30,7 +31,8 @@ impl HTMLMediaElement { prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLMediaElement { HTMLMediaElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLMediaElement(type_id), tag_name, prefix, document) + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLMediaElement(type_id), tag_name, prefix, document) } } diff --git a/components/script/dom/htmlmetaelement.rs b/components/script/dom/htmlmetaelement.rs index 00390c615cc..9b6967e036b 100644 --- a/components/script/dom/htmlmetaelement.rs +++ b/components/script/dom/htmlmetaelement.rs @@ -20,19 +20,25 @@ pub struct HTMLMetaElement { impl HTMLMetaElementDerived for EventTarget { fn is_htmlmetaelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMetaElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMetaElement))) } } impl HTMLMetaElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLMetaElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLMetaElement { HTMLMetaElement { htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLMetaElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLMetaElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLMetaElement> { let element = HTMLMetaElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLMetaElementBinding::Wrap) } diff --git a/components/script/dom/htmlmeterelement.rs b/components/script/dom/htmlmeterelement.rs index d700f0342cb..f81fd57346e 100644 --- a/components/script/dom/htmlmeterelement.rs +++ b/components/script/dom/htmlmeterelement.rs @@ -19,19 +19,25 @@ pub struct HTMLMeterElement { impl HTMLMeterElementDerived for EventTarget { fn is_htmlmeterelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMeterElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMeterElement))) } } impl HTMLMeterElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLMeterElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLMeterElement { HTMLMeterElement { htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLMeterElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLMeterElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLMeterElement> { let element = HTMLMeterElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLMeterElementBinding::Wrap) } diff --git a/components/script/dom/htmlmodelement.rs b/components/script/dom/htmlmodelement.rs index 9c329089a85..015381228bf 100644 --- a/components/script/dom/htmlmodelement.rs +++ b/components/script/dom/htmlmodelement.rs @@ -19,19 +19,26 @@ pub struct HTMLModElement { impl HTMLModElementDerived for EventTarget { fn is_htmlmodelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLModElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLModElement))) } } impl HTMLModElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLModElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLModElement { HTMLModElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLModElement, localName, prefix, document) + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLModElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLModElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLModElement> { let element = HTMLModElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLModElementBinding::Wrap) } diff --git a/components/script/dom/htmlobjectelement.rs b/components/script/dom/htmlobjectelement.rs index df2c98ecfda..bb247aa52c1 100644 --- a/components/script/dom/htmlobjectelement.rs +++ b/components/script/dom/htmlobjectelement.rs @@ -33,20 +33,27 @@ pub struct HTMLObjectElement { impl HTMLObjectElementDerived for EventTarget { fn is_htmlobjectelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLObjectElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLObjectElement))) } } impl HTMLObjectElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLObjectElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLObjectElement { HTMLObjectElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLObjectElement, localName, prefix, document), + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLObjectElement, localName, prefix, document), image: DOMRefCell::new(None), } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLObjectElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLObjectElement> { let element = HTMLObjectElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLObjectElementBinding::Wrap) } diff --git a/components/script/dom/htmlolistelement.rs b/components/script/dom/htmlolistelement.rs index a8554f20013..0441dc636e5 100644 --- a/components/script/dom/htmlolistelement.rs +++ b/components/script/dom/htmlolistelement.rs @@ -19,19 +19,25 @@ pub struct HTMLOListElement { impl HTMLOListElementDerived for EventTarget { fn is_htmlolistelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOListElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOListElement))) } } impl HTMLOListElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLOListElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLOListElement { HTMLOListElement { htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLOListElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLOListElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLOListElement> { let element = HTMLOListElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLOListElementBinding::Wrap) } diff --git a/components/script/dom/htmloptgroupelement.rs b/components/script/dom/htmloptgroupelement.rs index f259eccf5bc..15e70190ba3 100644 --- a/components/script/dom/htmloptgroupelement.rs +++ b/components/script/dom/htmloptgroupelement.rs @@ -26,19 +26,26 @@ pub struct HTMLOptGroupElement { impl HTMLOptGroupElementDerived for EventTarget { fn is_htmloptgroupelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptGroupElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptGroupElement))) } } impl HTMLOptGroupElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLOptGroupElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLOptGroupElement { HTMLOptGroupElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLOptGroupElement, localName, prefix, document) + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLOptGroupElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLOptGroupElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLOptGroupElement> { let element = HTMLOptGroupElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLOptGroupElementBinding::Wrap) } diff --git a/components/script/dom/htmloptionelement.rs b/components/script/dom/htmloptionelement.rs index 29ef5040641..ec40d819b2c 100644 --- a/components/script/dom/htmloptionelement.rs +++ b/components/script/dom/htmloptionelement.rs @@ -30,19 +30,26 @@ pub struct HTMLOptionElement { impl HTMLOptionElementDerived for EventTarget { fn is_htmloptionelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptionElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptionElement))) } } impl HTMLOptionElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLOptionElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLOptionElement { HTMLOptionElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLOptionElement, localName, prefix, document) + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLOptionElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLOptionElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLOptionElement> { let element = HTMLOptionElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLOptionElementBinding::Wrap) } diff --git a/components/script/dom/htmloutputelement.rs b/components/script/dom/htmloutputelement.rs index b1f67343f36..79cba6418df 100644 --- a/components/script/dom/htmloutputelement.rs +++ b/components/script/dom/htmloutputelement.rs @@ -21,19 +21,26 @@ pub struct HTMLOutputElement { impl HTMLOutputElementDerived for EventTarget { fn is_htmloutputelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOutputElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOutputElement))) } } impl HTMLOutputElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLOutputElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLOutputElement { HTMLOutputElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLOutputElement, localName, prefix, document) + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLOutputElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLOutputElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLOutputElement> { let element = HTMLOutputElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLOutputElementBinding::Wrap) } diff --git a/components/script/dom/htmlparagraphelement.rs b/components/script/dom/htmlparagraphelement.rs index 9619659d9bd..3d580c11928 100644 --- a/components/script/dom/htmlparagraphelement.rs +++ b/components/script/dom/htmlparagraphelement.rs @@ -19,19 +19,26 @@ pub struct HTMLParagraphElement { impl HTMLParagraphElementDerived for EventTarget { fn is_htmlparagraphelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLParagraphElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLParagraphElement))) } } impl HTMLParagraphElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLParagraphElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLParagraphElement { HTMLParagraphElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLParagraphElement, localName, prefix, document) + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLParagraphElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLParagraphElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLParagraphElement> { let element = HTMLParagraphElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLParagraphElementBinding::Wrap) } diff --git a/components/script/dom/htmlparamelement.rs b/components/script/dom/htmlparamelement.rs index 8b526dd70ff..491064de085 100644 --- a/components/script/dom/htmlparamelement.rs +++ b/components/script/dom/htmlparamelement.rs @@ -19,19 +19,26 @@ pub struct HTMLParamElement { impl HTMLParamElementDerived for EventTarget { fn is_htmlparamelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLParamElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLParamElement))) } } impl HTMLParamElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLParamElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLParamElement { HTMLParamElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLParamElement, localName, prefix, document) + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLParamElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLParamElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLParamElement> { let element = HTMLParamElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLParamElementBinding::Wrap) } diff --git a/components/script/dom/htmlpreelement.rs b/components/script/dom/htmlpreelement.rs index 07da87f10a7..6b7fdc2825e 100644 --- a/components/script/dom/htmlpreelement.rs +++ b/components/script/dom/htmlpreelement.rs @@ -19,19 +19,26 @@ pub struct HTMLPreElement { impl HTMLPreElementDerived for EventTarget { fn is_htmlpreelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLPreElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLPreElement))) } } impl HTMLPreElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLPreElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLPreElement { HTMLPreElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLPreElement, localName, prefix, document) + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLPreElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLPreElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLPreElement> { let element = HTMLPreElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLPreElementBinding::Wrap) } diff --git a/components/script/dom/htmlprogresselement.rs b/components/script/dom/htmlprogresselement.rs index a75457f20f4..4a58ac6d835 100644 --- a/components/script/dom/htmlprogresselement.rs +++ b/components/script/dom/htmlprogresselement.rs @@ -19,19 +19,26 @@ pub struct HTMLProgressElement { impl HTMLProgressElementDerived for EventTarget { fn is_htmlprogresselement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLProgressElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLProgressElement))) } } impl HTMLProgressElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLProgressElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLProgressElement { HTMLProgressElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLProgressElement, localName, prefix, document) + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLProgressElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLProgressElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLProgressElement> { let element = HTMLProgressElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLProgressElementBinding::Wrap) } diff --git a/components/script/dom/htmlquoteelement.rs b/components/script/dom/htmlquoteelement.rs index 7cbbfdb0060..f89e4004e57 100644 --- a/components/script/dom/htmlquoteelement.rs +++ b/components/script/dom/htmlquoteelement.rs @@ -19,19 +19,26 @@ pub struct HTMLQuoteElement { impl HTMLQuoteElementDerived for EventTarget { fn is_htmlquoteelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLQuoteElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLQuoteElement))) } } impl HTMLQuoteElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLQuoteElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLQuoteElement { HTMLQuoteElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLQuoteElement, localName, prefix, document) + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLQuoteElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLQuoteElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLQuoteElement> { let element = HTMLQuoteElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLQuoteElementBinding::Wrap) } diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index 2011a31bf66..35a5d83ad03 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -75,7 +75,9 @@ pub struct HTMLScriptElement { impl HTMLScriptElementDerived for EventTarget { fn is_htmlscriptelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLScriptElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLScriptElement))) } } @@ -83,7 +85,8 @@ impl HTMLScriptElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>, creator: ElementCreator) -> HTMLScriptElement { HTMLScriptElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLScriptElement, localName, prefix, document), + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLScriptElement, localName, prefix, document), already_started: Cell::new(false), parser_inserted: Cell::new(creator == ElementCreator::ParserCreated), non_blocking: Cell::new(creator != ElementCreator::ParserCreated), diff --git a/components/script/dom/htmlselectelement.rs b/components/script/dom/htmlselectelement.rs index 6b8e38e9161..c2537a06d46 100644 --- a/components/script/dom/htmlselectelement.rs +++ b/components/script/dom/htmlselectelement.rs @@ -31,21 +31,28 @@ pub struct HTMLSelectElement { impl HTMLSelectElementDerived for EventTarget { fn is_htmlselectelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement))) } } static DEFAULT_SELECT_SIZE: u32 = 0; impl HTMLSelectElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLSelectElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLSelectElement { HTMLSelectElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLSelectElement, localName, prefix, document) + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLSelectElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLSelectElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLSelectElement> { let element = HTMLSelectElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLSelectElementBinding::Wrap) } diff --git a/components/script/dom/htmlsourceelement.rs b/components/script/dom/htmlsourceelement.rs index b35c1264166..a30b2689843 100644 --- a/components/script/dom/htmlsourceelement.rs +++ b/components/script/dom/htmlsourceelement.rs @@ -19,19 +19,26 @@ pub struct HTMLSourceElement { impl HTMLSourceElementDerived for EventTarget { fn is_htmlsourceelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSourceElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSourceElement))) } } impl HTMLSourceElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLSourceElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLSourceElement { HTMLSourceElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLSourceElement, localName, prefix, document) + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLSourceElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLSourceElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLSourceElement> { let element = HTMLSourceElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLSourceElementBinding::Wrap) } diff --git a/components/script/dom/htmlspanelement.rs b/components/script/dom/htmlspanelement.rs index bf7e1fccdc8..cbd68c1b186 100644 --- a/components/script/dom/htmlspanelement.rs +++ b/components/script/dom/htmlspanelement.rs @@ -19,7 +19,9 @@ pub struct HTMLSpanElement { impl HTMLSpanElementDerived for EventTarget { fn is_htmlspanelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSpanElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSpanElement))) } } @@ -31,7 +33,9 @@ impl HTMLSpanElement { } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLSpanElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLSpanElement> { let element = HTMLSpanElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLSpanElementBinding::Wrap) } diff --git a/components/script/dom/htmlstyleelement.rs b/components/script/dom/htmlstyleelement.rs index 572c7df38eb..8ab295a24af 100644 --- a/components/script/dom/htmlstyleelement.rs +++ b/components/script/dom/htmlstyleelement.rs @@ -27,19 +27,25 @@ pub struct HTMLStyleElement { impl HTMLStyleElementDerived for EventTarget { fn is_htmlstyleelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLStyleElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLStyleElement))) } } impl HTMLStyleElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLStyleElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLStyleElement { HTMLStyleElement { htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLStyleElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLStyleElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLStyleElement> { let element = HTMLStyleElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLStyleElementBinding::Wrap) } diff --git a/components/script/dom/htmltablecaptionelement.rs b/components/script/dom/htmltablecaptionelement.rs index 453fae62851..ec60a9e3955 100644 --- a/components/script/dom/htmltablecaptionelement.rs +++ b/components/script/dom/htmltablecaptionelement.rs @@ -19,19 +19,26 @@ pub struct HTMLTableCaptionElement { impl HTMLTableCaptionElementDerived for EventTarget { fn is_htmltablecaptionelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableCaptionElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableCaptionElement))) } } impl HTMLTableCaptionElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLTableCaptionElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLTableCaptionElement { HTMLTableCaptionElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLTableCaptionElement, localName, prefix, document) + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLTableCaptionElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLTableCaptionElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLTableCaptionElement> { let element = HTMLTableCaptionElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLTableCaptionElementBinding::Wrap) } diff --git a/components/script/dom/htmltablecellelement.rs b/components/script/dom/htmltablecellelement.rs index 02d32d55968..e9c3a0ab59a 100644 --- a/components/script/dom/htmltablecellelement.rs +++ b/components/script/dom/htmltablecellelement.rs @@ -41,7 +41,8 @@ pub struct HTMLTableCellElement { impl HTMLTableCellElementDerived for EventTarget { fn is_htmltablecellelement(&self) -> bool { match *self.type_id() { - EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableCellElement(_)))) => true, + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableCellElement(_)))) => true, _ => false } } @@ -54,7 +55,8 @@ impl HTMLTableCellElement { document: JSRef<Document>) -> HTMLTableCellElement { HTMLTableCellElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLTableCellElement(type_id), tag_name, prefix, document), + htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLTableCellElement(type_id), + tag_name, prefix, document), background_color: Cell::new(None), colspan: Cell::new(None), width: Cell::new(LengthOrPercentageOrAuto::Auto), diff --git a/components/script/dom/htmltablecolelement.rs b/components/script/dom/htmltablecolelement.rs index 41770af9db9..48262a71aba 100644 --- a/components/script/dom/htmltablecolelement.rs +++ b/components/script/dom/htmltablecolelement.rs @@ -19,19 +19,26 @@ pub struct HTMLTableColElement { impl HTMLTableColElementDerived for EventTarget { fn is_htmltablecolelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableColElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableColElement))) } } impl HTMLTableColElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLTableColElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLTableColElement { HTMLTableColElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLTableColElement, localName, prefix, document) + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLTableColElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLTableColElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLTableColElement> { let element = HTMLTableColElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLTableColElementBinding::Wrap) } diff --git a/components/script/dom/htmltabledatacellelement.rs b/components/script/dom/htmltabledatacellelement.rs index 91ae686d766..48dd4e21fe4 100644 --- a/components/script/dom/htmltabledatacellelement.rs +++ b/components/script/dom/htmltabledatacellelement.rs @@ -28,10 +28,13 @@ impl HTMLTableDataCellElementDerived for EventTarget { } impl HTMLTableDataCellElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLTableDataCellElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLTableDataCellElement { HTMLTableDataCellElement { - htmltablecellelement: HTMLTableCellElement::new_inherited(HTMLTableCellElementTypeId::HTMLTableDataCellElement, - localName, prefix, document) + htmltablecellelement: + HTMLTableCellElement::new_inherited( + HTMLTableCellElementTypeId::HTMLTableDataCellElement, localName, prefix, document) } } diff --git a/components/script/dom/htmltableelement.rs b/components/script/dom/htmltableelement.rs index 5d78305883c..a32c3e7e452 100644 --- a/components/script/dom/htmltableelement.rs +++ b/components/script/dom/htmltableelement.rs @@ -35,7 +35,9 @@ pub struct HTMLTableElement { impl HTMLTableElementDerived for EventTarget { fn is_htmltableelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableElement))) } } diff --git a/components/script/dom/htmltableheadercellelement.rs b/components/script/dom/htmltableheadercellelement.rs index b3d94bb0017..48a31e5b0a6 100644 --- a/components/script/dom/htmltableheadercellelement.rs +++ b/components/script/dom/htmltableheadercellelement.rs @@ -28,15 +28,19 @@ impl HTMLTableHeaderCellElementDerived for EventTarget { } impl HTMLTableHeaderCellElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLTableHeaderCellElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLTableHeaderCellElement { HTMLTableHeaderCellElement { - htmltablecellelement: HTMLTableCellElement::new_inherited(HTMLTableCellElementTypeId::HTMLTableHeaderCellElement, - localName, prefix, document) + htmltablecellelement: HTMLTableCellElement::new_inherited( + HTMLTableCellElementTypeId::HTMLTableHeaderCellElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLTableHeaderCellElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLTableHeaderCellElement> { let element = HTMLTableHeaderCellElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLTableHeaderCellElementBinding::Wrap) } diff --git a/components/script/dom/htmltablerowelement.rs b/components/script/dom/htmltablerowelement.rs index 156dd6bb787..5f8be49d964 100644 --- a/components/script/dom/htmltablerowelement.rs +++ b/components/script/dom/htmltablerowelement.rs @@ -25,7 +25,9 @@ pub struct HTMLTableRowElement { impl HTMLTableRowElementDerived for EventTarget { fn is_htmltablerowelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableRowElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableRowElement))) } } diff --git a/components/script/dom/htmltablesectionelement.rs b/components/script/dom/htmltablesectionelement.rs index 27b26a79dd6..10dbf4c7b6c 100644 --- a/components/script/dom/htmltablesectionelement.rs +++ b/components/script/dom/htmltablesectionelement.rs @@ -25,7 +25,9 @@ pub struct HTMLTableSectionElement { impl HTMLTableSectionElementDerived for EventTarget { fn is_htmltablesectionelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableSectionElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableSectionElement))) } } diff --git a/components/script/dom/htmltemplateelement.rs b/components/script/dom/htmltemplateelement.rs index 92028db1bcf..50678811ee0 100644 --- a/components/script/dom/htmltemplateelement.rs +++ b/components/script/dom/htmltemplateelement.rs @@ -19,19 +19,26 @@ pub struct HTMLTemplateElement { impl HTMLTemplateElementDerived for EventTarget { fn is_htmltemplateelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTemplateElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTemplateElement))) } } impl HTMLTemplateElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLTemplateElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLTemplateElement { HTMLTemplateElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLTemplateElement, localName, prefix, document) + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLTemplateElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLTemplateElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLTemplateElement> { let element = HTMLTemplateElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLTemplateElementBinding::Wrap) } diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs index dc2f89c6122..3fc78914173 100644 --- a/components/script/dom/htmltextareaelement.rs +++ b/components/script/dom/htmltextareaelement.rs @@ -50,7 +50,9 @@ pub struct HTMLTextAreaElement { impl HTMLTextAreaElementDerived for EventTarget { fn is_htmltextareaelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement))) } } @@ -92,10 +94,13 @@ static DEFAULT_COLS: u32 = 20; static DEFAULT_ROWS: u32 = 2; impl HTMLTextAreaElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLTextAreaElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLTextAreaElement { let chan = document.window().root().r().constellation_chan(); HTMLTextAreaElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLTextAreaElement, localName, prefix, document), + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLTextAreaElement, localName, prefix, document), textinput: DOMRefCell::new(TextInput::new(Lines::Multiple, "".to_owned(), chan)), cols: Cell::new(DEFAULT_COLS), rows: Cell::new(DEFAULT_ROWS), @@ -104,7 +109,9 @@ impl HTMLTextAreaElement { } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLTextAreaElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLTextAreaElement> { let element = HTMLTextAreaElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLTextAreaElementBinding::Wrap) } diff --git a/components/script/dom/htmltimeelement.rs b/components/script/dom/htmltimeelement.rs index 70abbbb2759..4fda22809b8 100644 --- a/components/script/dom/htmltimeelement.rs +++ b/components/script/dom/htmltimeelement.rs @@ -19,7 +19,9 @@ pub struct HTMLTimeElement { impl HTMLTimeElementDerived for EventTarget { fn is_htmltimeelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTimeElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTimeElement))) } } @@ -31,7 +33,9 @@ impl HTMLTimeElement { } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLTimeElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLTimeElement> { let element = HTMLTimeElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLTimeElementBinding::Wrap) } diff --git a/components/script/dom/htmltitleelement.rs b/components/script/dom/htmltitleelement.rs index c01262c1933..3ce8cd7db2c 100644 --- a/components/script/dom/htmltitleelement.rs +++ b/components/script/dom/htmltitleelement.rs @@ -25,7 +25,9 @@ pub struct HTMLTitleElement { impl HTMLTitleElementDerived for EventTarget { fn is_htmltitleelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTitleElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTitleElement))) } } @@ -37,7 +39,9 @@ impl HTMLTitleElement { } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLTitleElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLTitleElement> { let element = HTMLTitleElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLTitleElementBinding::Wrap) } diff --git a/components/script/dom/htmltrackelement.rs b/components/script/dom/htmltrackelement.rs index 31e9f4a2a62..1a07ced2ab5 100644 --- a/components/script/dom/htmltrackelement.rs +++ b/components/script/dom/htmltrackelement.rs @@ -19,7 +19,9 @@ pub struct HTMLTrackElement { impl HTMLTrackElementDerived for EventTarget { fn is_htmltrackelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTrackElement))) + *self.type_id() == EventTargetTypeId::Node( + NodeTypeId::Element( + ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTrackElement))) } } @@ -31,7 +33,9 @@ impl HTMLTrackElement { } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLTrackElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLTrackElement> { let element = HTMLTrackElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLTrackElementBinding::Wrap) } diff --git a/components/script/dom/htmlulistelement.rs b/components/script/dom/htmlulistelement.rs index 7e67c3442b1..b5deb9f0b96 100644 --- a/components/script/dom/htmlulistelement.rs +++ b/components/script/dom/htmlulistelement.rs @@ -19,7 +19,9 @@ pub struct HTMLUListElement { impl HTMLUListElementDerived for EventTarget { fn is_htmlulistelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLUListElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLUListElement))) } } @@ -31,7 +33,9 @@ impl HTMLUListElement { } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLUListElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLUListElement> { let element = HTMLUListElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLUListElementBinding::Wrap) } diff --git a/components/script/dom/htmlunknownelement.rs b/components/script/dom/htmlunknownelement.rs index 4b470adb82c..35c04fc1f47 100644 --- a/components/script/dom/htmlunknownelement.rs +++ b/components/script/dom/htmlunknownelement.rs @@ -19,19 +19,26 @@ pub struct HTMLUnknownElement { impl HTMLUnknownElementDerived for EventTarget { fn is_htmlunknownelement(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLUnknownElement))) + *self.type_id() == + EventTargetTypeId::Node( + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLUnknownElement))) } } impl HTMLUnknownElement { - fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLUnknownElement { + fn new_inherited(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> HTMLUnknownElement { HTMLUnknownElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLUnknownElement, localName, prefix, document) + htmlelement: + HTMLElement::new_inherited(HTMLElementTypeId::HTMLUnknownElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLUnknownElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLUnknownElement> { let element = HTMLUnknownElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLUnknownElementBinding::Wrap) } diff --git a/components/script/dom/htmlvideoelement.rs b/components/script/dom/htmlvideoelement.rs index 06817d89198..69046ec0181 100644 --- a/components/script/dom/htmlvideoelement.rs +++ b/components/script/dom/htmlvideoelement.rs @@ -30,12 +30,15 @@ impl HTMLVideoElementDerived for EventTarget { impl HTMLVideoElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLVideoElement { HTMLVideoElement { - htmlmediaelement: HTMLMediaElement::new_inherited(HTMLMediaElementTypeId::HTMLVideoElement, localName, prefix, document) + htmlmediaelement: + HTMLMediaElement::new_inherited(HTMLMediaElementTypeId::HTMLVideoElement, localName, prefix, document) } } #[allow(unrooted_must_root)] - pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLVideoElement> { + pub fn new(localName: DOMString, + prefix: Option<DOMString>, + document: JSRef<Document>) -> Temporary<HTMLVideoElement> { let element = HTMLVideoElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLVideoElementBinding::Wrap) } diff --git a/components/script/dom/messageevent.rs b/components/script/dom/messageevent.rs index b40d8c75d3d..e74e8c95e59 100644 --- a/components/script/dom/messageevent.rs +++ b/components/script/dom/messageevent.rs @@ -49,7 +49,10 @@ impl MessageEvent { MessageEvent::new_initialized(global, UndefinedValue(), "".to_owned(), "".to_owned()) } - pub fn new_initialized(global: GlobalRef, data: JSVal, origin: DOMString, lastEventId: DOMString) -> Temporary<MessageEvent> { + pub fn new_initialized(global: GlobalRef, + data: JSVal, + origin: DOMString, + lastEventId: DOMString) -> Temporary<MessageEvent> { reflect_dom_object(box MessageEvent::new_inherited(data, origin, lastEventId), global, MessageEventBinding::Wrap) diff --git a/components/script/dom/mouseevent.rs b/components/script/dom/mouseevent.rs index a9c6a6b26f2..131889952bf 100644 --- a/components/script/dom/mouseevent.rs +++ b/components/script/dom/mouseevent.rs @@ -80,7 +80,8 @@ impl MouseEvent { button: i16, relatedTarget: Option<JSRef<EventTarget>>) -> Temporary<MouseEvent> { let ev = MouseEvent::new_uninitialized(window).root(); - ev.r().InitMouseEvent(type_, canBubble == EventBubbles::Bubbles, cancelable == EventCancelable::Cancelable, view, detail, + ev.r().InitMouseEvent(type_, canBubble == EventBubbles::Bubbles, cancelable == EventCancelable::Cancelable, + view, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget); @@ -90,8 +91,16 @@ impl MouseEvent { pub fn Constructor(global: GlobalRef, type_: DOMString, init: &MouseEventBinding::MouseEventInit) -> Fallible<Temporary<MouseEvent>> { - let bubbles = if init.parent.parent.parent.bubbles { EventBubbles::Bubbles } else { EventBubbles::DoesNotBubble }; - let cancelable = if init.parent.parent.parent.cancelable { EventCancelable::Cancelable } else { EventCancelable::NotCancelable }; + let bubbles = if init.parent.parent.parent.bubbles { + EventBubbles::Bubbles + } else { + EventBubbles::DoesNotBubble + }; + let cancelable = if init.parent.parent.parent.cancelable { + EventCancelable::Cancelable + } else { + EventCancelable::NotCancelable + }; let event = MouseEvent::new(global.as_window(), type_, bubbles, cancelable, diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 92ed3f41f6e..d9e9ef25b7c 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -177,7 +177,8 @@ impl NodeFlags { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptGroupElement)) | NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptionElement)) | //NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMenuItemElement)) | - NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFieldSetElement)) => IN_ENABLED_STATE | dirty, + NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFieldSetElement)) => + IN_ENABLED_STATE | dirty, _ => dirty, } } @@ -1809,13 +1810,20 @@ impl<'a> NodeMethods for JSRef<'a, Node> { // https://dom.spec.whatwg.org/#dom-node-nodetype fn NodeType(self) -> u16 { match self.type_id { - NodeTypeId::CharacterData(CharacterDataTypeId::Text) => NodeConstants::TEXT_NODE, - NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction) => NodeConstants::PROCESSING_INSTRUCTION_NODE, - NodeTypeId::CharacterData(CharacterDataTypeId::Comment) => NodeConstants::COMMENT_NODE, - NodeTypeId::Document => NodeConstants::DOCUMENT_NODE, - NodeTypeId::DocumentType => NodeConstants::DOCUMENT_TYPE_NODE, - NodeTypeId::DocumentFragment => NodeConstants::DOCUMENT_FRAGMENT_NODE, - NodeTypeId::Element(_) => NodeConstants::ELEMENT_NODE, + NodeTypeId::CharacterData(CharacterDataTypeId::Text) => + NodeConstants::TEXT_NODE, + NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction) => + NodeConstants::PROCESSING_INSTRUCTION_NODE, + NodeTypeId::CharacterData(CharacterDataTypeId::Comment) => + NodeConstants::COMMENT_NODE, + NodeTypeId::Document => + NodeConstants::DOCUMENT_NODE, + NodeTypeId::DocumentType => + NodeConstants::DOCUMENT_TYPE_NODE, + NodeTypeId::DocumentFragment => + NodeConstants::DOCUMENT_FRAGMENT_NODE, + NodeTypeId::Element(_) => + NodeConstants::ELEMENT_NODE, } } @@ -2008,7 +2016,8 @@ impl<'a> NodeMethods for JSRef<'a, Node> { // Step 4-5. match node.type_id() { - NodeTypeId::CharacterData(CharacterDataTypeId::Text) if self.is_document() => return Err(HierarchyRequest), + NodeTypeId::CharacterData(CharacterDataTypeId::Text) if self.is_document() => + return Err(HierarchyRequest), NodeTypeId::DocumentType if !self.is_document() => return Err(HierarchyRequest), NodeTypeId::DocumentFragment | NodeTypeId::DocumentType | @@ -2159,7 +2168,8 @@ impl<'a> NodeMethods for JSRef<'a, Node> { match prev_text { Some(ref text_node) => { let text_node = text_node.clone().root(); - let prev_characterdata: JSRef<CharacterData> = CharacterDataCast::from_ref(text_node.r()); + let prev_characterdata: JSRef<CharacterData> = + CharacterDataCast::from_ref(text_node.r()); let _ = prev_characterdata.AppendData(characterdata.Data()); self.remove_child(child.r()); }, diff --git a/components/script/dom/processinginstruction.rs b/components/script/dom/processinginstruction.rs index d288b33c0f5..3013cdb2f87 100644 --- a/components/script/dom/processinginstruction.rs +++ b/components/script/dom/processinginstruction.rs @@ -21,7 +21,8 @@ pub struct ProcessingInstruction { impl ProcessingInstructionDerived for EventTarget { fn is_processinginstruction(&self) -> bool { - *self.type_id() == EventTargetTypeId::Node(NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction)) + *self.type_id() == + EventTargetTypeId::Node(NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction)) } } diff --git a/components/script/dom/storage.rs b/components/script/dom/storage.rs index 36beb11bc4e..0afad8294ae 100644 --- a/components/script/dom/storage.rs +++ b/components/script/dom/storage.rs @@ -76,7 +76,8 @@ impl<'a> StorageMethods for JSRef<'a, Storage> { fn GetItem(self, name: DOMString) -> Option<DOMString> { let (sender, receiver) = channel(); - self.get_storage_task().send(StorageTaskMsg::GetItem(sender, self.get_url(), self.storage_type, name)).unwrap(); + let msg = StorageTaskMsg::GetItem(sender, self.get_url(), self.storage_type, name); + self.get_storage_task().send(msg).unwrap(); receiver.recv().unwrap() } @@ -89,7 +90,8 @@ impl<'a> StorageMethods for JSRef<'a, Storage> { fn SetItem(self, name: DOMString, value: DOMString) { let (sender, receiver) = channel(); - self.get_storage_task().send(StorageTaskMsg::SetItem(sender, self.get_url(), self.storage_type, name.clone(), value.clone())).unwrap(); + let msg = StorageTaskMsg::SetItem(sender, self.get_url(), self.storage_type, name.clone(), value.clone()); + self.get_storage_task().send(msg).unwrap(); let (changed, old_value) = receiver.recv().unwrap(); if changed { self.broadcast_change_notification(Some(name), old_value, Some(value)); @@ -107,7 +109,8 @@ impl<'a> StorageMethods for JSRef<'a, Storage> { fn RemoveItem(self, name: DOMString) { let (sender, receiver) = channel(); - self.get_storage_task().send(StorageTaskMsg::RemoveItem(sender, self.get_url(), self.storage_type, name.clone())).unwrap(); + let msg = StorageTaskMsg::RemoveItem(sender, self.get_url(), self.storage_type, name.clone()); + self.get_storage_task().send(msg).unwrap(); if let Some(old_value) = receiver.recv().unwrap() { self.broadcast_change_notification(Some(name), Some(old_value), None); } diff --git a/components/script/dom/storageevent.rs b/components/script/dom/storageevent.rs index 1fad3001140..e6de4b0575a 100644 --- a/components/script/dom/storageevent.rs +++ b/components/script/dom/storageevent.rs @@ -73,7 +73,11 @@ impl StorageEvent { let url = init.url.clone(); let storageArea = init.storageArea.r(); let bubbles = if init.parent.bubbles { EventBubbles::Bubbles } else { EventBubbles::DoesNotBubble }; - let cancelable = if init.parent.cancelable { EventCancelable::Cancelable } else { EventCancelable::NotCancelable }; + let cancelable = if init.parent.cancelable { + EventCancelable::Cancelable + } else { + EventCancelable::NotCancelable + }; let event = StorageEvent::new(global, type_, bubbles, cancelable, key, oldValue, newValue, diff --git a/components/script/dom/uievent.rs b/components/script/dom/uievent.rs index d65a30d10aa..9c62346ff4a 100644 --- a/components/script/dom/uievent.rs +++ b/components/script/dom/uievent.rs @@ -55,7 +55,8 @@ impl UIEvent { view: Option<JSRef<Window>>, detail: i32) -> Temporary<UIEvent> { let ev = UIEvent::new_uninitialized(window).root(); - ev.r().InitUIEvent(type_, can_bubble == EventBubbles::Bubbles, cancelable == EventCancelable::Cancelable, view, detail); + ev.r().InitUIEvent(type_, can_bubble == EventBubbles::Bubbles, + cancelable == EventCancelable::Cancelable, view, detail); Temporary::from_rooted(ev.r()) } @@ -63,7 +64,11 @@ impl UIEvent { type_: DOMString, init: &UIEventBinding::UIEventInit) -> Fallible<Temporary<UIEvent>> { let bubbles = if init.parent.bubbles { EventBubbles::Bubbles } else { EventBubbles::DoesNotBubble }; - let cancelable = if init.parent.cancelable { EventCancelable::Cancelable } else { EventCancelable::NotCancelable }; + let cancelable = if init.parent.cancelable { + EventCancelable::Cancelable + } else { + EventCancelable::NotCancelable + }; let event = UIEvent::new(global.as_window(), type_, bubbles, cancelable, init.view.r(), init.detail); diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 939225caa66..ee64fe73de0 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -5,7 +5,8 @@ use canvas::webgl_paint_task::WebGLPaintTask; use canvas_traits::{CanvasMsg, CanvasWebGLMsg, CanvasCommonMsg}; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding; -use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::{ WebGLRenderingContextMethods, WebGLRenderingContextConstants}; +use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::{ + WebGLRenderingContextMethods, WebGLRenderingContextConstants}; use dom::bindings::global::{GlobalRef, GlobalField}; use dom::bindings::js::{JS, JSRef, LayoutJS, Temporary}; use dom::bindings::utils::{Reflector, reflect_dom_object}; @@ -192,12 +193,15 @@ impl<'a> WebGLRenderingContextMethods for JSRef<'a, WebGLRenderingContext> { None => return NullValue(), }; let (sender, receiver) = channel::<i32>(); - self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::GetShaderParameter(shader_id, param_id, sender))).unwrap(); + let msg = CanvasMsg::WebGL(CanvasWebGLMsg::GetShaderParameter(shader_id, param_id, sender)); + self.renderer.send(msg).unwrap(); Int32Value(receiver.recv().unwrap()) } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 - fn GetUniformLocation(self, program: Option<JSRef<WebGLProgram>>, name: DOMString) -> Option<Temporary<WebGLUniformLocation>> { + fn GetUniformLocation(self, + program: Option<JSRef<WebGLProgram>>, + name: DOMString) -> Option<Temporary<WebGLUniformLocation>> { let program_id = match program { Some(program) => program.get_id(), None => return None, @@ -226,12 +230,16 @@ impl<'a> WebGLRenderingContextMethods for JSRef<'a, WebGLRenderingContext> { .split(|c: char| c == '\n') .map(|line: &str| String::from_str(line) + "\n") .collect(); - self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::ShaderSource(shader_id, source_lines))).unwrap() + let msg = CanvasMsg::WebGL(CanvasWebGLMsg::ShaderSource(shader_id, source_lines)); + self.renderer.send(msg).unwrap() } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 #[allow(unsafe_code)] - fn Uniform4fv(self, cx: *mut JSContext, uniform: Option<JSRef<WebGLUniformLocation>>, data: Option<*mut JSObject>) { + fn Uniform4fv(self, + cx: *mut JSContext, + uniform: Option<JSRef<WebGLUniformLocation>>, + data: Option<*mut JSObject>) { let uniform_id = match uniform { Some(uniform) => uniform.get_id(), None => return, @@ -262,8 +270,9 @@ impl<'a> WebGLRenderingContextMethods for JSRef<'a, WebGLRenderingContext> { normalized: bool, stride: i32, offset: i64) { match data_type { WebGLRenderingContextConstants::FLOAT => { - self.renderer.send( - CanvasMsg::WebGL(CanvasWebGLMsg::VertexAttribPointer2f(attrib_id, size, normalized, stride, offset))).unwrap() + let msg = CanvasMsg::WebGL( + CanvasWebGLMsg::VertexAttribPointer2f(attrib_id, size, normalized, stride, offset)); + self.renderer.send(msg).unwrap() } _ => panic!("VertexAttribPointer: Data Type not supported") } diff --git a/components/script/dom/websocket.rs b/components/script/dom/websocket.rs index e902d1ac034..79365539055 100644 --- a/components/script/dom/websocket.rs +++ b/components/script/dom/websocket.rs @@ -162,7 +162,8 @@ impl WebSocket { //Create everything necessary for starting the open asynchronous task, then begin the task. let global_root = ws_root.global.root(); - let addr: Trusted<WebSocket> = Trusted::new(global_root.r().get_cx(), ws_root, global_root.r().script_chan().clone()); + let addr: Trusted<WebSocket> = + Trusted::new(global_root.r().get_cx(), ws_root, global_root.r().script_chan().clone()); let open_task = box WebSocketTaskHandler::new(addr.clone(), WebSocketTask::Open); global_root.r().script_chan().send(ScriptMsg::RunnableMsg(open_task)).unwrap(); //TODO: Spawn thread here for receive loop @@ -200,7 +201,8 @@ impl<'a> WebSocketMethods for JSRef<'a, WebSocket> { } fn Send(self, data: Option<USVString>)-> Fallible<()>{ - /*TODO: This is not up to spec see http://html.spec.whatwg.org/multipage/comms.html search for "If argument is a string" + /*TODO: This is not up to spec see http://html.spec.whatwg.org/multipage/comms.html search for + "If argument is a string" TODO: Need to buffer data TODO: bufferedAmount attribute returns the size of the buffer in bytes - this is a required attribute defined in the websocket.webidl file @@ -240,9 +242,11 @@ impl<'a> WebSocketMethods for JSRef<'a, WebSocket> { self.failed.set(true); self.sendCloseFrame.set(true); //Dispatch send task to send close frame - //TODO: Sending here is just empty string, though no string is really needed. Another send, empty send, could be used. + //TODO: Sending here is just empty string, though no string is really needed. Another send, empty + // send, could be used. let _ = self.Send(None); - //Note: After sending the close message, the receive loop confirms a close message from the server and must fire a close event + //Note: After sending the close message, the receive loop confirms a close message from the server and + // must fire a close event } WebSocketRequestState::Open => { //Closing handshake not started - still in open @@ -257,7 +261,8 @@ impl<'a> WebSocketMethods for JSRef<'a, WebSocket> { self.sendCloseFrame.set(true); //Dispatch send task to send close frame let _ = self.Send(None); - //Note: After sending the close message, the receive loop confirms a close message from the server and must fire a close event + //Note: After sending the close message, the receive loop confirms a close message from the server and + // must fire a close event } } Ok(()) //Return Ok diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index b8e0ffb86e7..6ebff11c5f1 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -735,14 +735,18 @@ impl<'a> WindowHelpers for JSRef<'a, Window> { } fn content_box_query(self, content_box_request: TrustedNodeAddress) -> Rect<Au> { - self.reflow(ReflowGoal::ForScriptQuery, ReflowQueryType::ContentBoxQuery(content_box_request), ReflowReason::Query); + self.reflow(ReflowGoal::ForScriptQuery, + ReflowQueryType::ContentBoxQuery(content_box_request), + ReflowReason::Query); self.join_layout(); //FIXME: is this necessary, or is layout_rpc's mutex good enough? let ContentBoxResponse(rect) = self.layout_rpc.content_box(); rect } fn content_boxes_query(self, content_boxes_request: TrustedNodeAddress) -> Vec<Rect<Au>> { - self.reflow(ReflowGoal::ForScriptQuery, ReflowQueryType::ContentBoxesQuery(content_boxes_request), ReflowReason::Query); + self.reflow(ReflowGoal::ForScriptQuery, + ReflowQueryType::ContentBoxesQuery(content_boxes_request), + ReflowReason::Query); self.join_layout(); //FIXME: is this necessary, or is layout_rpc's mutex good enough? let ContentBoxesResponse(rects) = self.layout_rpc.content_boxes(); rects diff --git a/components/script/dom/worker.rs b/components/script/dom/worker.rs index 749ba34183a..774cf67e913 100644 --- a/components/script/dom/worker.rs +++ b/components/script/dom/worker.rs @@ -192,7 +192,8 @@ pub struct WorkerErrorHandler { } impl WorkerErrorHandler { - pub fn new(addr: TrustedWorkerAddress, msg: DOMString, file_name: DOMString, line_num: u32, col_num: u32) -> WorkerErrorHandler { + pub fn new(addr: TrustedWorkerAddress, msg: DOMString, file_name: DOMString, line_num: u32, col_num: u32) + -> WorkerErrorHandler { WorkerErrorHandler { addr: addr, msg: msg, diff --git a/components/script/dom/xmlhttprequestupload.rs b/components/script/dom/xmlhttprequestupload.rs index 756a8c2e3aa..61004299b84 100644 --- a/components/script/dom/xmlhttprequestupload.rs +++ b/components/script/dom/xmlhttprequestupload.rs @@ -19,7 +19,8 @@ pub struct XMLHttpRequestUpload { impl XMLHttpRequestUpload { fn new_inherited() -> XMLHttpRequestUpload { XMLHttpRequestUpload { - eventtarget: XMLHttpRequestEventTarget::new_inherited(XMLHttpRequestEventTargetTypeId::XMLHttpRequestUpload) + eventtarget: XMLHttpRequestEventTarget::new_inherited( + XMLHttpRequestEventTargetTypeId::XMLHttpRequestUpload) } } pub fn new(global: GlobalRef) -> Temporary<XMLHttpRequestUpload> { @@ -31,6 +32,7 @@ impl XMLHttpRequestUpload { impl XMLHttpRequestUploadDerived for EventTarget { fn is_xmlhttprequestupload(&self) -> bool { - *self.type_id() == EventTargetTypeId::XMLHttpRequestEventTarget(XMLHttpRequestEventTargetTypeId::XMLHttpRequestUpload) + *self.type_id() == + EventTargetTypeId::XMLHttpRequestEventTarget(XMLHttpRequestEventTargetTypeId::XMLHttpRequestUpload) } } diff --git a/components/script/script_task.rs b/components/script/script_task.rs index 8e7812a4d9c..bd20c027d79 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -32,7 +32,8 @@ use dom::bindings::refcounted::{LiveDOMReferences, Trusted, TrustedReference}; use dom::bindings::structuredclone::StructuredCloneData; use dom::bindings::trace::{JSTraceable, trace_collections, RootedVec}; use dom::bindings::utils::{wrap_for_same_compartment, pre_wrap}; -use dom::document::{Document, IsHTMLDocument, DocumentHelpers, DocumentProgressHandler, DocumentProgressTask, DocumentSource, MouseEventType}; +use dom::document::{Document, IsHTMLDocument, DocumentHelpers, DocumentProgressHandler, + DocumentProgressTask, DocumentSource, MouseEventType}; use dom::element::{Element, AttributeHandlers}; use dom::event::{Event, EventHelpers, EventBubbles, EventCancelable}; use dom::htmliframeelement::{HTMLIFrameElement, HTMLIFrameElementHelpers}; @@ -1414,7 +1415,11 @@ impl ScriptTask { } } - fn handle_mouse_event(&self, pipeline_id: PipelineId, mouse_event_type: MouseEventType, button: MouseButton, point: Point2D<f32>) { + fn handle_mouse_event(&self, + pipeline_id: PipelineId, + mouse_event_type: MouseEventType, + button: MouseButton, + point: Point2D<f32>) { let _marker; if self.need_emit_timeline_marker(TimelineMarkerType::DOMEvent) { _marker = AutoDOMEventMarker::new(self); diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs index dc04e2346a0..6d6c7313a7c 100644 --- a/components/script/webdriver_handlers.rs +++ b/components/script/webdriver_handlers.rs @@ -46,7 +46,9 @@ pub fn jsval_to_webdriver(cx: *mut JSContext, val: JSVal) -> WebDriverJSResult { Ok(WebDriverJSValue::Number(FromJSValConvertible::from_jsval(cx, val, ()).unwrap())) } else if val.is_string() { //FIXME: use jsstring_to_str when jsval grows to_jsstring - Ok(WebDriverJSValue::String(FromJSValConvertible::from_jsval(cx, val, StringificationBehavior::Default).unwrap())) + Ok( + WebDriverJSValue::String( + FromJSValConvertible::from_jsval(cx, val, StringificationBehavior::Default).unwrap())) } else if val.is_null() { Ok(WebDriverJSValue::Null) } else { @@ -63,14 +65,16 @@ pub fn handle_execute_script(page: &Rc<Page>, pipeline: PipelineId, eval: String reply.send(jsval_to_webdriver(cx, rval)).unwrap(); } -pub fn handle_execute_async_script(page: &Rc<Page>, pipeline: PipelineId, eval: String, reply: Sender<WebDriverJSResult>) { +pub fn handle_execute_async_script(page: &Rc<Page>, pipeline: PipelineId, eval: String, + reply: Sender<WebDriverJSResult>) { let page = get_page(&*page, pipeline); let window = page.window().root(); window.r().set_webdriver_script_chan(Some(reply)); window.r().evaluate_js_on_global_with_result(&eval); } -pub fn handle_find_element_css(page: &Rc<Page>, _pipeline: PipelineId, selector: String, reply: Sender<Result<Option<String>, ()>>) { +pub fn handle_find_element_css(page: &Rc<Page>, _pipeline: PipelineId, selector: String, + reply: Sender<Result<Option<String>, ()>>) { reply.send(match page.document().root().r().QuerySelector(selector.clone()) { Ok(node) => { let result = node.map(|x| NodeCast::from_ref(x.root().r()).get_unique_id()); @@ -80,7 +84,8 @@ pub fn handle_find_element_css(page: &Rc<Page>, _pipeline: PipelineId, selector: }).unwrap(); } -pub fn handle_find_elements_css(page: &Rc<Page>, _pipeline: PipelineId, selector: String, reply: Sender<Result<Vec<String>, ()>>) { +pub fn handle_find_elements_css(page: &Rc<Page>, _pipeline: PipelineId, selector: String, + reply: Sender<Result<Vec<String>, ()>>) { reply.send(match page.document().root().r().QuerySelectorAll(selector.clone()) { Ok(ref node_list) => { let nodes = node_list.root(); diff --git a/components/style/build.rs b/components/style/build.rs index 80965f329f5..76d58e81264 100644 --- a/components/style/build.rs +++ b/components/style/build.rs @@ -22,7 +22,8 @@ fn main() { .env("PYTHONPATH", &mako) .env("TEMPLATE", &template) .arg("-c") - .arg("from os import environ; from mako.template import Template; print(Template(filename=environ['TEMPLATE']).render())") + .arg("from os import environ; from mako.template import Template;\ + print(Template(filename=environ['TEMPLATE']).render())") .stderr(Stdio::inherit()) .output() .unwrap(); diff --git a/components/style/legacy.rs b/components/style/legacy.rs index 4d5123ff187..bf8e42c228d 100644 --- a/components/style/legacy.rs +++ b/components/style/legacy.rs @@ -33,24 +33,18 @@ pub trait PresentationalHintSynthesis { /// you don't, you risk strange random nondeterministic failures due to false positives in /// style sharing. fn synthesize_presentational_hints_for_legacy_attributes<'a,N,V>( - &self, - node: &N, - matching_rules_list: &mut V, - shareable: &mut bool) - where N: TNode<'a>, - N::Element: TElementAttributes<'a>, - V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>>; + &self, node: &N, matching_rules_list: &mut V, shareable: &mut bool) + where N: TNode<'a>, + N::Element: TElementAttributes<'a>, + V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>>; } impl PresentationalHintSynthesis for Stylist { fn synthesize_presentational_hints_for_legacy_attributes<'a,N,V>( - &self, - node: &N, - matching_rules_list: &mut V, - shareable: &mut bool) - where N: TNode<'a>, - N::Element: TElementAttributes<'a>, - V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>> { + &self, node: &N, matching_rules_list: &mut V, shareable: &mut bool) + where N: TNode<'a>, + N::Element: TElementAttributes<'a>, + V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>> { let element = node.as_element(); let length = matching_rules_list.len(); diff --git a/components/style/properties.mako.rs b/components/style/properties.mako.rs index 518ce6dd542..69d14fad990 100644 --- a/components/style/properties.mako.rs +++ b/components/style/properties.mako.rs @@ -567,8 +567,8 @@ pub mod longhands { } SpecifiedValue::Number(value) => computed_value::T::Number(value), SpecifiedValue::Percentage(value) => { - computed_value::T::Length( - specified::Length::FontRelative(specified::FontRelativeLength::Em(value)).to_computed_value(context)) + let fr = specified::Length::FontRelative(specified::FontRelativeLength::Em(value)); + computed_value::T::Length(fr.to_computed_value(context)) } } } @@ -1134,8 +1134,9 @@ pub mod longhands { // CSS 2.1, Section 14 - Colors and Backgrounds ${new_style_struct("Background", is_inherited=False)} - ${predefined_type("background-color", "CSSColor", - "::cssparser::Color::RGBA(::cssparser::RGBA { red: 0., green: 0., blue: 0., alpha: 0. }) /* transparent */")} + ${predefined_type( + "background-color", "CSSColor", + "::cssparser::Color::RGBA(::cssparser::RGBA { red: 0., green: 0., blue: 0., alpha: 0. }) /* transparent */")} <%self:longhand name="background-image"> use values::specified::Image; @@ -1701,7 +1702,8 @@ pub mod longhands { input.try(specified::LengthOrPercentage::parse_non_negative) .map(|value| match value { specified::LengthOrPercentage::Length(value) => value, - specified::LengthOrPercentage::Percentage(value) => specified::Length::FontRelative(specified::FontRelativeLength::Em(value)) + specified::LengthOrPercentage::Percentage(value) => + specified::Length::FontRelative(specified::FontRelativeLength::Em(value)) }) .or_else(|()| { match_ignore_ascii_case! { try!(input.expect_ident()), @@ -1725,7 +1727,8 @@ pub mod longhands { </%self:longhand> ${single_keyword("font-stretch", - "normal ultra-condensed extra-condensed condensed semi-condensed semi-expanded expanded extra-expanded ultra-expanded")} + "normal ultra-condensed extra-condensed condensed semi-condensed semi-expanded \ + expanded extra-expanded ultra-expanded")} // CSS 2.1, Section 16 - Text @@ -3076,7 +3079,8 @@ pub mod longhands { fn to_computed_value(&self, context: &computed::Context) -> computed_value::T { computed_value::T{ filters: self.0.iter().map(|value| { match value { - &SpecifiedFilter::Blur(factor) => computed_value::Filter::Blur(factor.to_computed_value(context)), + &SpecifiedFilter::Blur(factor) => + computed_value::Filter::Blur(factor.to_computed_value(context)), &SpecifiedFilter::Brightness(factor) => computed_value::Filter::Brightness(factor), &SpecifiedFilter::Contrast(factor) => computed_value::Filter::Contrast(factor), &SpecifiedFilter::Grayscale(factor) => computed_value::Filter::Grayscale(factor), @@ -4406,7 +4410,8 @@ pub mod shorthands { Ok(Longhands { border_${side}_color: color, border_${side}_style: style, - border_${side}_width: width.map(longhands::${to_rust_ident('border-%s-width' % side)}::SpecifiedValue), + border_${side}_width: + width.map(longhands::${to_rust_ident('border-%s-width' % side)}::SpecifiedValue), }) </%self:shorthand> % endfor @@ -4421,7 +4426,8 @@ pub mod shorthands { % for side in ["top", "right", "bottom", "left"]: border_${side}_color: color.clone(), border_${side}_style: style, - border_${side}_width: width.map(longhands::${to_rust_ident('border-%s-width' % side)}::SpecifiedValue), + border_${side}_width: + width.map(longhands::${to_rust_ident('border-%s-width' % side)}::SpecifiedValue), % endfor }) </%self:shorthand> @@ -4719,7 +4725,8 @@ pub mod shorthands { </%self:shorthand> <%self:shorthand name="transition" - sub_properties="transition-property transition-duration transition-timing-function transition-delay"> + sub_properties="transition-property transition-duration transition-timing-function + transition-delay"> use properties::longhands::{transition_delay, transition_duration, transition_property}; use properties::longhands::{transition_timing_function}; diff --git a/components/style/viewport.rs b/components/style/viewport.rs index 9115b9a8b26..831c3769a56 100644 --- a/components/style/viewport.rs +++ b/components/style/viewport.rs @@ -434,7 +434,8 @@ impl ViewportConstraints { length.to_computed_value(initial_viewport), _ => unreachable!() }), - LengthOrPercentageOrAuto::Percentage(value) => Some(initial_viewport.$dimension.scale_by(value)), + LengthOrPercentageOrAuto::Percentage(value) => + Some(initial_viewport.$dimension.scale_by(value)), LengthOrPercentageOrAuto::Auto => None, } } else { diff --git a/components/util/opts.rs b/components/util/opts.rs index 8db1abf7574..f3e7487f468 100644 --- a/components/util/opts.rs +++ b/components/util/opts.rs @@ -255,14 +255,16 @@ pub fn from_cmdline_args(args: &[String]) -> bool { getopts::optopt("y", "layout-threads", "Number of threads to use for layout", "1"), getopts::optflag("i", "nonincremental-layout", "Enable to turn off incremental layout."), getopts::optflag("", "no-ssl", "Disables ssl certificate verification."), - getopts::optflagopt("", "userscripts", "Uses userscripts in resources/user-agent-js, or a specified full path",""), + getopts::optflagopt("", "userscripts", + "Uses userscripts in resources/user-agent-js, or a specified full path",""), getopts::optflag("z", "headless", "Headless mode"), getopts::optflag("f", "hard-fail", "Exit on task failure instead of displaying about:failure"), getopts::optflagopt("", "devtools", "Start remote devtools server on port", "6000"), getopts::optflagopt("", "webdriver", "Start remote WebDriver server on port", "7000"), getopts::optopt("", "resolution", "Set window resolution.", "800x600"), getopts::optopt("u", "user-agent", "Set custom user agent string", "NCSA Mosaic/1.0 (X11;SunOS 4.1.4 sun4m)"), - getopts::optopt("Z", "debug", "A comma-separated string of debug options. Pass help to show available options.", ""), + getopts::optopt("Z", "debug", + "A comma-separated string of debug options. Pass help to show available options.", ""), getopts::optflag("h", "help", "Print this message"), getopts::optopt("", "resources-path", "Path to find static resources", "/home/servo/resources"), getopts::optflag("", "sniff-mime-types" , "Enable MIME sniffing"), diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs index df32cd1e4ea..ade47771472 100644 --- a/components/webdriver_server/lib.rs +++ b/components/webdriver_server/lib.rs @@ -196,7 +196,8 @@ impl Handler { const_chan.send(ConstellationMsg::WebDriverCommand(cmd_msg)).unwrap(); match reciever.recv().unwrap() { Ok(value) => { - Ok(WebDriverResponse::Generic(ValueResponse::new(value.map(|x| WebElement::new(x).to_json()).to_json()))) + let v_res = ValueResponse::new(value.map(|x| WebElement::new(x).to_json()).to_json()); + Ok(WebDriverResponse::Generic(v_res)) } Err(_) => Err(WebDriverError::new(ErrorStatus::InvalidSelector, "Invalid selector")) @@ -296,7 +297,8 @@ impl Handler { self.execute_script(command, reciever) } - fn handle_execute_async_script(&self, parameters: &JavascriptCommandParameters) -> WebDriverResult<WebDriverResponse> { + fn handle_execute_async_script(&self, + parameters: &JavascriptCommandParameters) -> WebDriverResult<WebDriverResponse> { let func_body = ¶meters.script; let args_string = "window.webdriverCallback"; @@ -309,7 +311,9 @@ impl Handler { self.execute_script(command, reciever) } - fn execute_script(&self, command: WebDriverScriptCommand, reciever: Receiver<WebDriverJSResult>) -> WebDriverResult<WebDriverResponse> { + fn execute_script(&self, + command: WebDriverScriptCommand, + reciever: Receiver<WebDriverJSResult>) -> WebDriverResult<WebDriverResponse> { // TODO: This isn't really right because it always runs the script in the // root window let pipeline_id = try!(self.get_root_pipeline()); @@ -368,7 +372,9 @@ impl Handler { } impl WebDriverHandler for Handler { - fn handle_command(&mut self, _session: &Option<Session>, msg: &WebDriverMessage) -> WebDriverResult<WebDriverResponse> { + fn handle_command(&mut self, + _session: &Option<Session>, + msg: &WebDriverMessage) -> WebDriverResult<WebDriverResponse> { match msg.command { WebDriverCommand::NewSession => self.handle_new_session(), diff --git a/ports/glutin/window.rs b/ports/glutin/window.rs index 1878389ced3..7989cbc1f0f 100644 --- a/ports/glutin/window.rs +++ b/ports/glutin/window.rs @@ -70,7 +70,9 @@ pub struct Window { #[cfg(feature = "window")] impl Window { - pub fn new(is_foreground: bool, window_size: TypedSize2D<DevicePixel, u32>, parent: glutin::WindowID) -> Rc<Window> { + pub fn new(is_foreground: bool, + window_size: TypedSize2D<DevicePixel, u32>, + parent: glutin::WindowID) -> Rc<Window> { let mut glutin_window = glutin::WindowBuilder::new() .with_title("Servo".to_string()) .with_dimensions(window_size.to_untyped().width, window_size.to_untyped().height) @@ -616,7 +618,9 @@ pub struct Window { #[cfg(feature = "headless")] impl Window { - pub fn new(_is_foreground: bool, window_size: TypedSize2D<DevicePixel, u32>, _parent: glutin::WindowID) -> Rc<Window> { + pub fn new(_is_foreground: bool, + window_size: TypedSize2D<DevicePixel, u32>, + _parent: glutin::WindowID) -> Rc<Window> { let window_size = window_size.to_untyped(); let headless_builder = glutin::HeadlessRendererBuilder::new(window_size.width, window_size.height); diff --git a/ports/gonk/src/input.rs b/ports/gonk/src/input.rs index bac48d43162..e6be7d5b03f 100644 --- a/ports/gonk/src/input.rs +++ b/ports/gonk/src/input.rs @@ -117,7 +117,8 @@ fn read_input_device(device_path: &Path, let touchWidth = x_info.maximum - x_info.minimum; let touchHeight = y_info.maximum - y_info.minimum; - println!("xMin: {}, yMin: {}, touchWidth: {}, touchHeight: {}", x_info.minimum, y_info.minimum, touchWidth, touchHeight); + println!("xMin: {}, yMin: {}, touchWidth: {}, touchHeight: {}", + x_info.minimum, y_info.minimum, touchWidth, touchHeight); // XXX: Why isn't size_of treated as constant? // let buf: [u8; (16 * size_of::<linux_input_event>())]; @@ -168,12 +169,15 @@ fn read_input_device(device_path: &Path, if dist < 16 { let click_pt = TypedPoint2D(slotA.x as f32, slotA.y as f32); println!("Dispatching click!"); - sender.send(WindowEvent::MouseWindowEventClass(MouseWindowEvent::MouseDown(MouseButton::Left, click_pt))) - .ok().unwrap(); - sender.send(WindowEvent::MouseWindowEventClass(MouseWindowEvent::MouseUp(MouseButton::Left, click_pt))) - .ok().unwrap(); - sender.send(WindowEvent::MouseWindowEventClass(MouseWindowEvent::Click(MouseButton::Left, click_pt))) - .ok().unwrap(); + sender.send( + WindowEvent::MouseWindowEventClass( + MouseWindowEvent::MouseDown(MouseButton::Left, click_pt))).ok().unwrap(); + sender.send( + WindowEvent::MouseWindowEventClass( + MouseWindowEvent::MouseUp(MouseButton::Left, click_pt))).ok().unwrap(); + sender.send( + WindowEvent::MouseWindowEventClass( + MouseWindowEvent::Click(MouseButton::Left, click_pt))).ok().unwrap(); } } else { println!("Touch down"); @@ -188,15 +192,19 @@ fn read_input_device(device_path: &Path, } } else { println!("Touch move x: {}, y: {}", slotA.x, slotA.y); - sender.send(WindowEvent::Scroll(TypedPoint2D((slotA.x - last_x) as f32, (slotA.y - last_y) as f32), - TypedPoint2D(slotA.x, slotA.y))).ok().unwrap(); + sender.send( + WindowEvent::Scroll(TypedPoint2D((slotA.x - last_x) as f32, (slotA.y - last_y) as f32), + TypedPoint2D(slotA.x, slotA.y))).ok().unwrap(); last_x = slotA.x; last_y = slotA.y; if touch_count >= 2 { let slotB = &slots[1]; let cur_dist = dist(slotA.x, slotB.x, slotA.y, slotB.y); - println!("Zooming {} {} {} {}", cur_dist, last_dist, screen_dist, ((screen_dist + (cur_dist - last_dist))/screen_dist)); - sender.send(WindowEvent::Zoom((screen_dist + (cur_dist - last_dist))/screen_dist)).ok().unwrap(); + println!("Zooming {} {} {} {}", + cur_dist, last_dist, screen_dist, + ((screen_dist + (cur_dist - last_dist))/screen_dist)); + sender.send( + WindowEvent::Zoom((screen_dist + (cur_dist - last_dist))/screen_dist)).ok().unwrap(); last_dist = cur_dist; } } diff --git a/ports/gonk/src/window.rs b/ports/gonk/src/window.rs index c6c60088232..0655a64dd14 100644 --- a/ports/gonk/src/window.rs +++ b/ports/gonk/src/window.rs @@ -246,18 +246,22 @@ pub struct gralloc_module { common: hw_module, registerBuffer: extern fn(*const gralloc_module, *const native_handle) -> c_int, unregisterBuffer: extern fn(*const gralloc_module, *const native_handle) -> c_int, - lock: extern fn(*const gralloc_module, *const native_handle, c_int, c_int, c_int, c_int, *mut *mut c_void) -> c_int, + lock: extern fn(*const gralloc_module, *const native_handle, c_int, c_int, c_int, c_int, + *mut *mut c_void) -> c_int, unlock: extern fn(*const gralloc_module, *const native_handle) -> c_int, perform: extern fn(*const gralloc_module, c_int, ...) -> c_int, - lock_ycbcr: extern fn(*const gralloc_module, *const native_handle, c_int, c_int, c_int, c_int, c_int, *mut android_ycbcr) -> c_int, + lock_ycbcr: extern fn(*const gralloc_module, *const native_handle, c_int, c_int, c_int, c_int, + c_int, *mut android_ycbcr) -> c_int, reserved: [*mut c_void; 6], } #[repr(C)] pub struct alloc_device { common: hw_device, - allocSize: extern fn(*mut alloc_device, c_int, c_int, c_int, c_int, *mut *const native_handle, *mut c_int, c_int) -> c_int, - alloc: extern fn(*mut alloc_device, c_int, c_int, c_int, c_int, *mut *const native_handle, *mut c_int) -> c_int, + allocSize: extern fn(*mut alloc_device, c_int, c_int, c_int, c_int, *mut *const native_handle, + *mut c_int, c_int) -> c_int, + alloc: extern fn(*mut alloc_device, c_int, c_int, c_int, c_int, *mut *const native_handle, + *mut c_int) -> c_int, free: extern fn(*mut alloc_device, *const native_handle) -> c_int, dump: Option<extern fn(*mut alloc_device, *mut c_char, c_int)>, reserved: [*mut c_void; 7], @@ -454,7 +458,8 @@ extern fn gnw_decRef(base: *mut ANativeBase) { } impl GonkNativeWindow { - pub fn new(alloc_dev: *mut alloc_device, hwc_dev: *mut hwc_composer_device, width: i32, height: i32, usage: c_int) -> *mut GonkNativeWindow { + pub fn new(alloc_dev: *mut alloc_device, hwc_dev: *mut hwc_composer_device, width: i32, + height: i32, usage: c_int) -> *mut GonkNativeWindow { let win = box GonkNativeWindow { window: ANativeWindow { common: ANativeBase { @@ -561,7 +566,9 @@ impl GonkNativeWindow { }; unsafe { let mut displays: [*mut hwc_display_contents; 3] = [ &mut list, ptr::null_mut(), ptr::null_mut(), ]; - let _ = ((*self.hwc_dev).prepare)(self.hwc_dev, displays.len() as size_t, transmute(displays.as_mut_ptr())); + let _ = ((*self.hwc_dev).prepare)(self.hwc_dev, + displays.len() as size_t, + transmute(displays.as_mut_ptr())); let _ = ((*self.hwc_dev).set)(self.hwc_dev, displays.len() as size_t, transmute(displays.as_mut_ptr())); if list.retireFenceFd >= 0 { close(list.retireFenceFd); @@ -585,7 +592,10 @@ extern fn gnwb_decRef(base: *mut ANativeBase) { } impl GonkNativeWindowBuffer { - pub fn new(dev: *mut alloc_device, width: i32, height: i32, format: c_int, usage: c_int) -> *mut GonkNativeWindowBuffer { + pub fn new(dev: *mut alloc_device, + width: i32, + height: i32, + format: c_int, usage: c_int) -> *mut GonkNativeWindowBuffer { let mut buf = box GonkNativeWindowBuffer { buffer: ANativeWindowBuffer { common: ANativeBase { @@ -607,7 +617,10 @@ impl GonkNativeWindowBuffer { count: 1, }; - let ret = unsafe { ((*dev).alloc)(dev, width, height, format, usage, &mut buf.buffer.handle, &mut buf.buffer.stride) }; + let ret = unsafe { + ((*dev).alloc)(dev, width, height, format, usage, + &mut buf.buffer.handle, &mut buf.buffer.stride) + }; assert!(ret == 0, "Failed to allocate gralloc buffer!"); unsafe { transmute(buf) } diff --git a/python/tidy.py b/python/tidy.py index 5191a8921b8..500c75bf316 100644 --- a/python/tidy.py +++ b/python/tidy.py @@ -68,7 +68,7 @@ def check_license(contents): def check_length(idx, line): - if len(line) >= 150: + if len(line) >= 120: yield (idx + 1, "(much) overlong line") def check_whatwg_url(idx, line): diff --git a/tests/reftest.rs b/tests/reftest.rs index 547fe548234..b0592bb2e8e 100644 --- a/tests/reftest.rs +++ b/tests/reftest.rs @@ -44,7 +44,8 @@ fn main() { let (render_mode_string, base_path, testname) = match harness_args { [] | [_] => panic!("USAGE: cpu|gpu base_path [testname regex]"), [ref render_mode_string, ref base_path] => (render_mode_string, base_path, None), - [ref render_mode_string, ref base_path, ref testname, ..] => (render_mode_string, base_path, Some(testname.clone())), + [ref render_mode_string, ref base_path, ref testname, ..] => + (render_mode_string, base_path, Some(testname.clone())), }; let mut render_mode = match &**render_mode_string { diff --git a/tests/unit/net/data_loader.rs b/tests/unit/net/data_loader.rs index b66d50a41ad..362fd4c5193 100644 --- a/tests/unit/net/data_loader.rs +++ b/tests/unit/net/data_loader.rs @@ -51,14 +51,19 @@ fn plain() { #[test] fn plain_ct() { - assert_parse("data:text/plain,hello", - Some(ContentType(Mime(TopLevel::Text, SubLevel::Plain, vec!()))), None, Some(b"hello".iter().map(|&x| x).collect())); + assert_parse( + "data:text/plain,hello", + Some(ContentType(Mime(TopLevel::Text, SubLevel::Plain, vec!()))), + None, + Some(b"hello".iter().map(|&x| x).collect())); } #[test] fn plain_charset() { assert_parse("data:text/plain;charset=latin1,hello", - Some(ContentType(Mime(TopLevel::Text, SubLevel::Plain, vec!((Attr::Charset, Value::Ext("latin1".to_string())))))), + Some(ContentType(Mime(TopLevel::Text, + SubLevel::Plain, + vec!((Attr::Charset, Value::Ext("latin1".to_string())))))), Some("latin1".to_string()), Some(b"hello".iter().map(|&x| x).collect())); } diff --git a/tests/unit/net/resource_task.rs b/tests/unit/net/resource_task.rs index 9690ae2473d..9a902c43282 100644 --- a/tests/unit/net/resource_task.rs +++ b/tests/unit/net/resource_task.rs @@ -98,7 +98,8 @@ fn test_parse_hostsfile_with_tabs_instead_spaces() { #[test] fn test_parse_hostsfile_with_valid_ipv4_addresses() { - let mock_hosts_file_content = "255.255.255.255 foo.bar.com\n169.0.1.201 servo.test.server\n192.168.5.0 servo.foo.com"; + let mock_hosts_file_content = + "255.255.255.255 foo.bar.com\n169.0.1.201 servo.test.server\n192.168.5.0 servo.foo.com"; let hosts_table = parse_hostsfile(mock_hosts_file_content); assert_eq!(3, (*hosts_table).len()); } @@ -173,7 +174,9 @@ fn test_replace_hosts() { let resource_task = new_resource_task(None, None); let (start_chan, _) = channel(); let url = Url::parse(&format!("http://foo.bar.com:{}", port)).unwrap(); - resource_task.send(ControlMsg::Load(replace_hosts(LoadData::new(url, None), host_table), LoadConsumer::Channel(start_chan))).unwrap(); + let msg = ControlMsg::Load(replace_hosts(LoadData::new(url, None), host_table), + LoadConsumer::Channel(start_chan)); + resource_task.send(msg).unwrap(); match listener.accept() { Ok(..) => assert!(true, "received request"), diff --git a/tests/unit/script/textinput.rs b/tests/unit/script/textinput.rs index 653507983a2..1c364d5739a 100644 --- a/tests/unit/script/textinput.rs +++ b/tests/unit/script/textinput.rs @@ -123,12 +123,14 @@ fn test_textinput_adjust_horizontal() { #[test] fn test_textinput_handle_return() { - let mut single_line_textinput = TextInput::new(Lines::Single, "abcdef".to_owned(), DummyClipboardContext::new("")); + let mut single_line_textinput = TextInput::new( + Lines::Single, "abcdef".to_owned(), DummyClipboardContext::new("")); single_line_textinput.adjust_horizontal(3, Selection::NotSelected); single_line_textinput.handle_return(); assert_eq!(single_line_textinput.get_content(), "abcdef"); - let mut multi_line_textinput = TextInput::new(Lines::Multiple, "abcdef".to_owned(), DummyClipboardContext::new("")); + let mut multi_line_textinput = TextInput::new( + Lines::Multiple, "abcdef".to_owned(), DummyClipboardContext::new("")); multi_line_textinput.adjust_horizontal(3, Selection::NotSelected); multi_line_textinput.handle_return(); assert_eq!(multi_line_textinput.get_content(), "abc\ndef"); @@ -136,7 +138,8 @@ fn test_textinput_handle_return() { #[test] fn test_textinput_select_all() { - let mut textinput = TextInput::new(Lines::Multiple, "abc\nde\nf".to_owned(), DummyClipboardContext::new("")); + let mut textinput = TextInput::new( + Lines::Multiple, "abc\nde\nf".to_owned(), DummyClipboardContext::new("")); assert_eq!(textinput.edit_point.line, 0); assert_eq!(textinput.edit_point.index, 0); @@ -150,7 +153,8 @@ fn test_textinput_get_content() { let single_line_textinput = TextInput::new(Lines::Single, "abcdefg".to_owned(), DummyClipboardContext::new("")); assert_eq!(single_line_textinput.get_content(), "abcdefg"); - let multi_line_textinput = TextInput::new(Lines::Multiple, "abc\nde\nf".to_owned(), DummyClipboardContext::new("")); + let multi_line_textinput = TextInput::new( + Lines::Multiple, "abc\nde\nf".to_owned(), DummyClipboardContext::new("")); assert_eq!(multi_line_textinput.get_content(), "abc\nde\nf"); } diff --git a/tests/unit/style/media_queries.rs b/tests/unit/style/media_queries.rs index 236dacd1e6b..65381f2b6aa 100644 --- a/tests/unit/style/media_queries.rs +++ b/tests/unit/style/media_queries.rs @@ -393,13 +393,19 @@ fn test_matching_width() { media_query_test(&device, "@media screen and (min-width: 250px) and (max-width: 300px) { a { color: red; } }", 0); media_query_test(&device, "@media screen and (min-width: 50px) and (max-width: 250px) { a { color: red; } }", 1); - media_query_test(&device, "@media not screen and (min-width: 50px) and (max-width: 100px) { a { color: red; } }", 1); - media_query_test(&device, "@media not screen and (min-width: 250px) and (max-width: 300px) { a { color: red; } }", 1); - media_query_test(&device, "@media not screen and (min-width: 50px) and (max-width: 250px) { a { color: red; } }", 0); - - media_query_test(&device, "@media not screen and (min-width: 3.1em) and (max-width: 6em) { a { color: red; } }", 1); - media_query_test(&device, "@media not screen and (min-width: 16em) and (max-width: 19.75em) { a { color: red; } }", 1); - media_query_test(&device, "@media not screen and (min-width: 3em) and (max-width: 250px) { a { color: red; } }", 0); + media_query_test( + &device, "@media not screen and (min-width: 50px) and (max-width: 100px) { a { color: red; } }", 1); + media_query_test( + &device, "@media not screen and (min-width: 250px) and (max-width: 300px) { a { color: red; } }", 1); + media_query_test( + &device, "@media not screen and (min-width: 50px) and (max-width: 250px) { a { color: red; } }", 0); + + media_query_test( + &device, "@media not screen and (min-width: 3.1em) and (max-width: 6em) { a { color: red; } }", 1); + media_query_test( + &device, "@media not screen and (min-width: 16em) and (max-width: 19.75em) { a { color: red; } }", 1); + media_query_test( + &device, "@media not screen and (min-width: 3em) and (max-width: 250px) { a { color: red; } }", 0); } #[test] diff --git a/tests/unit/style/viewport.rs b/tests/unit/style/viewport.rs index 6be92ea24fd..b2fd82069d5 100644 --- a/tests/unit/style/viewport.rs +++ b/tests/unit/style/viewport.rs @@ -36,7 +36,7 @@ fn test_viewport_rule<F>(css: &str, assert!(rule_count > 0); } -macro_rules! assert_declarations_len { +macro_rules! assert_decl_len { ($declarations:ident == 1) => { assert!($declarations.len() == 1, "expected 1 declaration; have {}: {:?})", @@ -55,11 +55,11 @@ fn empty_viewport_rule() { test_viewport_rule("@viewport {}", &device, |declarations, css| { println!("{}", css); - assert_declarations_len!(declarations == 0); + assert_decl_len!(declarations == 0); }); } -macro_rules! assert_declaration_eq { +macro_rules! assert_decl_eq { ($d:expr, $origin:ident, $expected:ident: $value:expr) => {{ assert_eq!($d.origin, Origin::$origin); assert_eq!($d.descriptor, ViewportDescriptor::$expected($value)); @@ -81,27 +81,27 @@ fn simple_viewport_rules() { user-zoom: zoom; orientation: auto; }", &device, |declarations, css| { println!("{}", css); - assert_declarations_len!(declarations == 9); - assert_declaration_eq!(&declarations[0], Author, MinWidth: LengthOrPercentageOrAuto::Auto); - assert_declaration_eq!(&declarations[1], Author, MaxWidth: LengthOrPercentageOrAuto::Auto); - assert_declaration_eq!(&declarations[2], Author, MinHeight: LengthOrPercentageOrAuto::Auto); - assert_declaration_eq!(&declarations[3], Author, MaxHeight: LengthOrPercentageOrAuto::Auto); - assert_declaration_eq!(&declarations[4], Author, Zoom: Zoom::Auto); - assert_declaration_eq!(&declarations[5], Author, MinZoom: Zoom::Number(0.)); - assert_declaration_eq!(&declarations[6], Author, MaxZoom: Zoom::Percentage(2.)); - assert_declaration_eq!(&declarations[7], Author, UserZoom: UserZoom::Zoom); - assert_declaration_eq!(&declarations[8], Author, Orientation: Orientation::Auto); + assert_decl_len!(declarations == 9); + assert_decl_eq!(&declarations[0], Author, MinWidth: LengthOrPercentageOrAuto::Auto); + assert_decl_eq!(&declarations[1], Author, MaxWidth: LengthOrPercentageOrAuto::Auto); + assert_decl_eq!(&declarations[2], Author, MinHeight: LengthOrPercentageOrAuto::Auto); + assert_decl_eq!(&declarations[3], Author, MaxHeight: LengthOrPercentageOrAuto::Auto); + assert_decl_eq!(&declarations[4], Author, Zoom: Zoom::Auto); + assert_decl_eq!(&declarations[5], Author, MinZoom: Zoom::Number(0.)); + assert_decl_eq!(&declarations[6], Author, MaxZoom: Zoom::Percentage(2.)); + assert_decl_eq!(&declarations[7], Author, UserZoom: UserZoom::Zoom); + assert_decl_eq!(&declarations[8], Author, Orientation: Orientation::Auto); }); test_viewport_rule("@viewport { min-width: 200px; max-width: auto;\ min-height: 200px; max-height: auto; }", &device, |declarations, css| { println!("{}", css); - assert_declarations_len!(declarations == 4); - assert_declaration_eq!(&declarations[0], Author, MinWidth: LengthOrPercentageOrAuto::Length(Length::from_px(200.))); - assert_declaration_eq!(&declarations[1], Author, MaxWidth: LengthOrPercentageOrAuto::Auto); - assert_declaration_eq!(&declarations[2], Author, MinHeight: LengthOrPercentageOrAuto::Length(Length::from_px(200.))); - assert_declaration_eq!(&declarations[3], Author, MaxHeight: LengthOrPercentageOrAuto::Auto); + assert_decl_len!(declarations == 4); + assert_decl_eq!(&declarations[0], Author, MinWidth: LengthOrPercentageOrAuto::Length(Length::from_px(200.))); + assert_decl_eq!(&declarations[1], Author, MaxWidth: LengthOrPercentageOrAuto::Auto); + assert_decl_eq!(&declarations[2], Author, MinHeight: LengthOrPercentageOrAuto::Length(Length::from_px(200.))); + assert_decl_eq!(&declarations[3], Author, MaxHeight: LengthOrPercentageOrAuto::Auto); }); } @@ -113,60 +113,60 @@ fn cascading_within_viewport_rule() { test_viewport_rule("@viewport { min-width: 200px; min-width: auto; }", &device, |declarations, css| { println!("{}", css); - assert_declarations_len!(declarations == 1); - assert_declaration_eq!(&declarations[0], Author, MinWidth: LengthOrPercentageOrAuto::Auto); + assert_decl_len!(declarations == 1); + assert_decl_eq!(&declarations[0], Author, MinWidth: LengthOrPercentageOrAuto::Auto); }); // !important order of appearance test_viewport_rule("@viewport { min-width: 200px !important; min-width: auto !important; }", &device, |declarations, css| { println!("{}", css); - assert_declarations_len!(declarations == 1); - assert_declaration_eq!(&declarations[0], Author, MinWidth: LengthOrPercentageOrAuto::Auto, !important); + assert_decl_len!(declarations == 1); + assert_decl_eq!(&declarations[0], Author, MinWidth: LengthOrPercentageOrAuto::Auto, !important); }); // !important vs normal test_viewport_rule("@viewport { min-width: auto !important; min-width: 200px; }", &device, |declarations, css| { println!("{}", css); - assert_declarations_len!(declarations == 1); - assert_declaration_eq!(&declarations[0], Author, MinWidth: LengthOrPercentageOrAuto::Auto, !important); + assert_decl_len!(declarations == 1); + assert_decl_eq!(&declarations[0], Author, MinWidth: LengthOrPercentageOrAuto::Auto, !important); }); // normal longhands vs normal shorthand test_viewport_rule("@viewport { min-width: 200px; max-width: 200px; width: auto; }", &device, |declarations, css| { println!("{}", css); - assert_declarations_len!(declarations == 2); - assert_declaration_eq!(&declarations[0], Author, MinWidth: LengthOrPercentageOrAuto::Auto); - assert_declaration_eq!(&declarations[1], Author, MaxWidth: LengthOrPercentageOrAuto::Auto); + assert_decl_len!(declarations == 2); + assert_decl_eq!(&declarations[0], Author, MinWidth: LengthOrPercentageOrAuto::Auto); + assert_decl_eq!(&declarations[1], Author, MaxWidth: LengthOrPercentageOrAuto::Auto); }); // normal shorthand vs normal longhands test_viewport_rule("@viewport { width: 200px; min-width: auto; max-width: auto; }", &device, |declarations, css| { println!("{}", css); - assert_declarations_len!(declarations == 2); - assert_declaration_eq!(&declarations[0], Author, MinWidth: LengthOrPercentageOrAuto::Auto); - assert_declaration_eq!(&declarations[1], Author, MaxWidth: LengthOrPercentageOrAuto::Auto); + assert_decl_len!(declarations == 2); + assert_decl_eq!(&declarations[0], Author, MinWidth: LengthOrPercentageOrAuto::Auto); + assert_decl_eq!(&declarations[1], Author, MaxWidth: LengthOrPercentageOrAuto::Auto); }); // one !important longhand vs normal shorthand test_viewport_rule("@viewport { min-width: auto !important; width: 200px; }", &device, |declarations, css| { println!("{}", css); - assert_declarations_len!(declarations == 2); - assert_declaration_eq!(&declarations[0], Author, MinWidth: LengthOrPercentageOrAuto::Auto, !important); - assert_declaration_eq!(&declarations[1], Author, MaxWidth: LengthOrPercentageOrAuto::Length(Length::from_px(200.))); + assert_decl_len!(declarations == 2); + assert_decl_eq!(&declarations[0], Author, MinWidth: LengthOrPercentageOrAuto::Auto, !important); + assert_decl_eq!(&declarations[1], Author, MaxWidth: LengthOrPercentageOrAuto::Length(Length::from_px(200.))); }); // both !important longhands vs normal shorthand test_viewport_rule("@viewport { min-width: auto !important; max-width: auto !important; width: 200px; }", &device, |declarations, css| { println!("{}", css); - assert_declarations_len!(declarations == 2); - assert_declaration_eq!(&declarations[0], Author, MinWidth: LengthOrPercentageOrAuto::Auto, !important); - assert_declaration_eq!(&declarations[1], Author, MaxWidth: LengthOrPercentageOrAuto::Auto, !important); + assert_decl_len!(declarations == 2); + assert_decl_eq!(&declarations[0], Author, MinWidth: LengthOrPercentageOrAuto::Auto, !important); + assert_decl_eq!(&declarations[1], Author, MaxWidth: LengthOrPercentageOrAuto::Auto, !important); }); } @@ -183,24 +183,27 @@ fn multiple_stylesheets_cascading() { .flat_map(|s| s.effective_rules(&device).viewport()) .cascade() .declarations; - assert_declarations_len!(declarations == 3); - assert_declaration_eq!(&declarations[0], UserAgent, Zoom: Zoom::Number(1.)); - assert_declaration_eq!(&declarations[1], User, MinHeight: LengthOrPercentageOrAuto::Length(Length::from_px(200.))); - assert_declaration_eq!(&declarations[2], Author, MinWidth: LengthOrPercentageOrAuto::Length(Length::from_px(300.))); + assert_decl_len!(declarations == 3); + assert_decl_eq!(&declarations[0], UserAgent, Zoom: Zoom::Number(1.)); + assert_decl_eq!(&declarations[1], User, MinHeight: LengthOrPercentageOrAuto::Length(Length::from_px(200.))); + assert_decl_eq!(&declarations[2], Author, MinWidth: LengthOrPercentageOrAuto::Length(Length::from_px(300.))); let stylesheets = vec![ stylesheet!("@viewport { min-width: 100px !important; }", UserAgent), stylesheet!("@viewport { min-width: 200px !important; min-height: 200px !important; }", User), - stylesheet!("@viewport { min-width: 300px !important; min-height: 300px !important; zoom: 3 !important; }", Author)]; + stylesheet!( + "@viewport { min-width: 300px !important; min-height: 300px !important; zoom: 3 !important; }", Author)]; let declarations = stylesheets.iter() .flat_map(|s| s.effective_rules(&device).viewport()) .cascade() .declarations; - assert_declarations_len!(declarations == 3); - assert_declaration_eq!(&declarations[0], UserAgent, MinWidth: LengthOrPercentageOrAuto::Length(Length::from_px(100.)), !important); - assert_declaration_eq!(&declarations[1], User, MinHeight: LengthOrPercentageOrAuto::Length(Length::from_px(200.)), !important); - assert_declaration_eq!(&declarations[2], Author, Zoom: Zoom::Number(3.), !important); + assert_decl_len!(declarations == 3); + assert_decl_eq!( + &declarations[0], UserAgent, MinWidth: LengthOrPercentageOrAuto::Length(Length::from_px(100.)), !important); + assert_decl_eq!( + &declarations[1], User, MinHeight: LengthOrPercentageOrAuto::Length(Length::from_px(200.)), !important); + assert_decl_eq!(&declarations[2], Author, Zoom: Zoom::Number(3.), !important); } #[test] |