diff options
533 files changed, 9486 insertions, 5313 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3036586fe49..1608b118511 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,7 +12,7 @@ pull requests. Each pull request will be reviewed by a core contributor given feedback for changes that would be required. All contributions should follow this format, even those from core contributors. -If you're looking for easy bugs, have a look at the [E-Easy issue tag](https://github.com/mozilla/servo/issues?labels=E-easy&page=1&state=open) on GitHub. +If you're looking for easy bugs, have a look at the [E-Easy issue tag](https://github.com/servo/servo/labels/E-easy) on GitHub. ## Pull Request Checklist @@ -29,9 +29,9 @@ If you're looking for easy bugs, have a look at the [E-Easy issue tag](https://g - Add tests relevant to the fixed bug or new feature. For a DOM change this will usually be a web platform test; for layout, a reftest. See our [testing - guide](https://github.com/mozilla/servo/wiki/Testing) for more information. + guide](https://github.com/servo/servo/wiki/Testing) for more information. -For specific git instructions, see [GitHub & Critic PR handling 101](https://github.com/mozilla/servo/wiki/Github-&-Critic-PR-handling-101). +For specific git instructions, see [GitHub & Critic PR handling 101](https://github.com/servo/servo/wiki/Github-&-Critic-PR-handling-101). ## Conduct diff --git a/README.md b/README.md index 934236c17f7..12697350369 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ On Fedora: sudo yum install curl freeglut-devel libtool gcc-c++ libXi-devel \ freetype-devel mesa-libGL-devel glib2-devel libX11-devel libXrandr-devel gperf \ fontconfig-devel cabextract ttmkfdir python python-virtualenv expat-devel \ - rpm-build openssl-devel cmake bzip2-devel libXcursor-devel libXmu-devel + rpm-build openssl-devel cmake bzip2-devel libXcursor-devel libXmu-devel mesa-libOSMesa-devel pushd /tmp wget http://corefonts.sourceforge.net/msttcorefonts-2.5-1.spec rpmbuild -bb msttcorefonts-2.5-1.spec @@ -81,6 +81,15 @@ cd servo ./mach run tests/html/about-mozilla.html ``` +By default, Servo builds in debug mode. This is useful for development, but +the resulting binary is very slow. For benchmarking, performance testing, or +real-world use, add the `--release` flag to create an optimized build: + +``` sh +./mach build --release +./mach run --release tests/html/about-mozilla.html +``` + ### Building for Android target ``` sh diff --git a/cargo-nightly-build b/cargo-nightly-build index d9ca78f0ecd..6e6ac373f0d 100644 --- a/cargo-nightly-build +++ b/cargo-nightly-build @@ -1 +1 @@ -2015-03-11 +2015-04-14 diff --git a/components/canvas/Cargo.toml b/components/canvas/Cargo.toml index b3f0198396e..52557fca98b 100644 --- a/components/canvas/Cargo.toml +++ b/components/canvas/Cargo.toml @@ -10,9 +10,6 @@ path = "lib.rs" [dependencies.azure] git = "https://github.com/servo/rust-azure" -[dependencies.cssparser] -git = "https://github.com/servo/rust-cssparser" - [dependencies.geom] git = "https://github.com/servo/rust-geom" @@ -25,10 +22,9 @@ path = "../util" [dependencies.gfx] path = "../gfx" -[dependencies.glutin] -git = "https://github.com/servo/glutin" -branch = "servo" -features = ["headless"] - [dependencies.offscreen_gl_context] git = "https://github.com/ecoal95/rust-offscreen-rendering-context" + +[dependencies] +cssparser = "0.3.1" +num = "0.1.24" diff --git a/components/canvas/canvas_msg.rs b/components/canvas/canvas_msg.rs index 6399302161b..aa0df80eb22 100644 --- a/components/canvas/canvas_msg.rs +++ b/components/canvas/canvas_msg.rs @@ -52,8 +52,27 @@ pub enum Canvas2dMsg { #[derive(Clone)] pub enum CanvasWebGLMsg { + AttachShader(u32, u32), + BindBuffer(u32, u32), + BufferData(u32, Vec<f32>, u32), Clear(u32), ClearColor(f32, f32, f32, f32), + CompileShader(u32), + CreateBuffer(Sender<u32>), + CreateProgram(Sender<u32>), + CreateShader(u32, Sender<u32>), + DrawArrays(u32, i32, i32), + EnableVertexAttribArray(u32), + GetAttribLocation(u32, String, Sender<i32>), + GetShaderInfoLog(u32, Sender<String>), + GetShaderParameter(u32, u32, Sender<i32>), + GetUniformLocation(u32, String, Sender<u32>), + LinkProgram(u32), + ShaderSource(u32, Vec<String>), + Uniform4fv(u32, Vec<f32>), + UseProgram(u32), + VertexAttribPointer2f(u32, i32, bool, i32, i64), + Viewport(i32, i32, i32, i32), } #[derive(Clone)] diff --git a/components/canvas/canvas_paint_task.rs b/components/canvas/canvas_paint_task.rs index 2740cdc330e..6906b96aa5c 100644 --- a/components/canvas/canvas_paint_task.rs +++ b/components/canvas/canvas_paint_task.rs @@ -13,13 +13,13 @@ use geom::point::Point2D; use geom::rect::Rect; use geom::size::Size2D; use gfx::color; +use num::ToPrimitive; use util::task::spawn_named; use util::vec::byte_swap; use cssparser::RGBA; use std::borrow::ToOwned; use std::mem; -use std::num::{Float, ToPrimitive}; use std::sync::mpsc::{channel, Sender}; impl<'a> CanvasPaintTask<'a> { diff --git a/components/canvas/lib.rs b/components/canvas/lib.rs index 17a5bcd0197..2fb0ea8b8f5 100644 --- a/components/canvas/lib.rs +++ b/components/canvas/lib.rs @@ -2,9 +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/. */ -#![feature(collections)] #![feature(core)] -#![feature(std_misc)] +#![feature(collections)] #![feature(rustc_private)] extern crate azure; @@ -13,8 +12,8 @@ extern crate geom; extern crate gfx; extern crate util; extern crate gleam; +extern crate num; extern crate offscreen_gl_context; -extern crate glutin; #[macro_use] extern crate log; diff --git a/components/canvas/webgl_paint_task.rs b/components/canvas/webgl_paint_task.rs index 97e711b6718..806440db36b 100644 --- a/components/canvas/webgl_paint_task.rs +++ b/components/canvas/webgl_paint_task.rs @@ -11,44 +11,15 @@ use gleam::gl::types::{GLsizei}; use util::task::spawn_named; use std::borrow::ToOwned; +use std::slice::bytes::copy_memory; use std::sync::mpsc::{channel, Sender}; use util::vec::byte_swap; use offscreen_gl_context::{GLContext, GLContextAttributes}; -use glutin::{HeadlessRendererBuilder, HeadlessContext}; - -// FIXME(ecoal95): We use glutin as a fallback until GLContext support improves. -enum PlatformIndependentContext { - GLContext(GLContext), - GlutinContext(HeadlessContext), -} - -impl PlatformIndependentContext { - fn make_current(&self) { - match *self { - PlatformIndependentContext::GLContext(ref ctx) => ctx.make_current().unwrap(), - PlatformIndependentContext::GlutinContext(ref ctx) => unsafe { ctx.make_current() } - } - } -} - -fn create_offscreen_context(size: Size2D<i32>, attrs: GLContextAttributes) -> Result<PlatformIndependentContext, &'static str> { - match GLContext::create_offscreen(size, attrs) { - Ok(ctx) => Ok(PlatformIndependentContext::GLContext(ctx)), - Err(msg) => { - debug!("GLContext creation error: {}", msg); - match HeadlessRendererBuilder::new(size.width as u32, size.height as u32).build() { - Ok(ctx) => Ok(PlatformIndependentContext::GlutinContext(ctx)), - Err(_) => Err("Glutin headless context creation failed") - } - } - } -} - pub struct WebGLPaintTask { size: Size2D<i32>, original_context_size: Size2D<i32>, - gl_context: PlatformIndependentContext, + gl_context: GLContext, } // This allows trying to create the PaintTask @@ -57,7 +28,8 @@ unsafe impl Send for WebGLPaintTask {} impl WebGLPaintTask { fn new(size: Size2D<i32>) -> Result<WebGLPaintTask, &'static str> { - let context = try!(create_offscreen_context(size, GLContextAttributes::default())); + // TODO(ecoal95): Get the GLContextAttributes from the `GetContext` call + let context = try!(GLContext::create_offscreen(size, GLContextAttributes::default())); Ok(WebGLPaintTask { size: size, original_context_size: size, @@ -74,15 +46,37 @@ impl WebGLPaintTask { match port.recv().unwrap() { CanvasMsg::WebGL(message) => { match message { + CanvasWebGLMsg::AttachShader(program_id, shader_id) => painter.attach_shader(program_id, shader_id), + CanvasWebGLMsg::BindBuffer(buffer_type, buffer_id) => painter.bind_buffer(buffer_type, buffer_id), + CanvasWebGLMsg::BufferData(buffer_type, data, usage) => painter.buffer_data(buffer_type, data, usage), CanvasWebGLMsg::Clear(mask) => painter.clear(mask), CanvasWebGLMsg::ClearColor(r, g, b, a) => painter.clear_color(r, g, b, a), + CanvasWebGLMsg::CreateBuffer(chan) => painter.create_buffer(chan), + CanvasWebGLMsg::DrawArrays(mode, first, count) => painter.draw_arrays(mode, first, count), + CanvasWebGLMsg::EnableVertexAttribArray(attrib_id) => painter.enable_vertex_attrib_array(attrib_id), + CanvasWebGLMsg::GetAttribLocation(program_id, name, chan) => painter.get_attrib_location(program_id, name, chan), + CanvasWebGLMsg::GetShaderInfoLog(shader_id, chan) => painter.get_shader_info_log(shader_id, chan), + CanvasWebGLMsg::GetShaderParameter(shader_id, param_id, chan) => painter.get_shader_parameter(shader_id, param_id, chan), + CanvasWebGLMsg::GetUniformLocation(program_id, name, chan) => painter.get_uniform_location(program_id, name, chan), + CanvasWebGLMsg::CompileShader(shader_id) => painter.compile_shader(shader_id), + CanvasWebGLMsg::CreateProgram(chan) => painter.create_program(chan), + CanvasWebGLMsg::CreateShader(shader_type, chan) => painter.create_shader(shader_type, chan), + CanvasWebGLMsg::LinkProgram(program_id) => painter.link_program(program_id), + CanvasWebGLMsg::ShaderSource(shader_id, source) => painter.shader_source(shader_id, source), + CanvasWebGLMsg::Uniform4fv(uniform_id, data) => painter.uniform_4fv(uniform_id, data), + CanvasWebGLMsg::UseProgram(program_id) => painter.use_program(program_id), + CanvasWebGLMsg::VertexAttribPointer2f(attrib_id, size, normalized, stride, offset) => { + painter.vertex_attrib_pointer_f32(attrib_id, size, normalized, stride, offset); + }, + CanvasWebGLMsg::Viewport(x, y, width, height) => painter.viewport(x, y, width, height), } }, CanvasMsg::Common(message) => { match message { CanvasCommonMsg::Close => break, CanvasCommonMsg::SendPixelContents(chan) => painter.send_pixel_contents(chan), - CanvasCommonMsg::Recreate(size) => painter.recreate(size), + // TODO(ecoal95): handle error nicely + CanvasCommonMsg::Recreate(size) => painter.recreate(size).unwrap(), } }, CanvasMsg::Canvas2d(_) => panic!("Wrong message sent to WebGLTask"), @@ -93,6 +87,18 @@ impl WebGLPaintTask { Ok(chan) } + fn attach_shader(&self, program_id: u32, shader_id: u32) { + gl::attach_shader(program_id, shader_id); + } + + fn bind_buffer(&self, buffer_type: u32, buffer_id: u32) { + gl::bind_buffer(buffer_type, buffer_id); + } + + fn buffer_data(&self, buffer_type: u32, data: Vec<f32>, usage: u32) { + gl::buffer_data(buffer_type, &data, usage); + } + fn clear(&self, mask: u32) { gl::clear(mask); } @@ -101,33 +107,116 @@ impl WebGLPaintTask { gl::clear_color(r, g, b, a); } + fn create_buffer(&self, chan: Sender<u32>) { + let buffers = gl::gen_buffers(1); + chan.send(buffers[0]).unwrap(); + } + + fn compile_shader(&self, shader_id: u32) { + gl::compile_shader(shader_id); + } + + fn create_program(&self, chan: Sender<u32>) { + let program = gl::create_program(); + chan.send(program).unwrap(); + } + + fn create_shader(&self, shader_type: u32, chan: Sender<u32>) { + let shader = gl::create_shader(shader_type); + chan.send(shader).unwrap(); + } + + fn draw_arrays(&self, mode: u32, first: i32, count: i32) { + gl::draw_arrays(mode, first, count); + } + + fn enable_vertex_attrib_array(&self, attrib_id: u32) { + gl::enable_vertex_attrib_array(attrib_id); + } + + fn get_attrib_location(&self, program_id: u32, name: String, chan: Sender<i32> ) { + let attrib_location = gl::get_attrib_location(program_id, &name); + chan.send(attrib_location).unwrap(); + } + + fn get_shader_info_log(&self, shader_id: u32, chan: Sender<String>) { + let info = gl::get_shader_info_log(shader_id); + chan.send(info).unwrap(); + } + + fn get_shader_parameter(&self, shader_id: u32, param_id: u32, chan: Sender<i32>) { + let parameter = gl::get_shader_iv(shader_id, param_id); + chan.send(parameter as i32).unwrap(); + } + + fn get_uniform_location(&self, program_id: u32, name: String, chan: Sender<u32>) { + let uniform_location = gl::get_uniform_location(program_id, &name); + chan.send(uniform_location as u32).unwrap(); + } + + fn link_program(&self, program_id: u32) { + gl::link_program(program_id); + } + fn send_pixel_contents(&mut self, chan: Sender<Vec<u8>>) { // FIXME(#5652, dmarcos) Instead of a readback strategy we have // to layerize the canvas + let width = self.size.width as usize; + let height = self.size.height as usize; let mut pixels = gl::read_pixels(0, 0, - self.size.width as gl::GLsizei, - self.size.height as gl::GLsizei, - gl::RGBA, gl::UNSIGNED_BYTE); + self.size.width as gl::GLsizei, + self.size.height as gl::GLsizei, + gl::RGBA, gl::UNSIGNED_BYTE); + // flip image vertically (texture is upside down) + let orig_pixels = pixels.clone(); + let stride = width * 4; + for y in 0..height { + let dst_start = y * stride; + let src_start = (height - y - 1) * stride; + let src_slice = &orig_pixels[src_start .. src_start + stride]; + copy_memory(&src_slice[..stride], &mut pixels[dst_start .. dst_start + stride]); + } // rgba -> bgra byte_swap(&mut pixels); chan.send(pixels).unwrap(); } - fn recreate(&mut self, size: Size2D<i32>) { - // TODO(ecoal95): GLContext should support a resize() method + fn shader_source(&self, shader_id: u32, source_lines: Vec<String>) { + let mut lines: Vec<&[u8]> = source_lines.iter().map(|line| line.as_bytes()).collect(); + gl::shader_source(shader_id, &mut lines); + } + + fn uniform_4fv(&self, uniform_id: u32, data: Vec<f32>) { + gl::uniform_4f(uniform_id as i32, data[0], data[1], data[2], data[3]); + } + + fn use_program(&self, program_id: u32) { + gl::use_program(program_id); + } + + fn vertex_attrib_pointer_f32(&self, attrib_id: u32, size: i32, + normalized: bool, stride: i32, offset: i64) { + gl::vertex_attrib_pointer_f32(attrib_id, size, normalized, stride, offset as u32); + } + + fn viewport(&self, x: i32, y: i32, width: i32, height: i32) { + gl::viewport(x, y, width, height); + } + + fn recreate(&mut self, size: Size2D<i32>) -> Result<(), &'static str> { if size.width > self.original_context_size.width || size.height > self.original_context_size.height { - panic!("Can't grow a GLContext (yet)"); + try!(self.gl_context.resize(size)); + self.size = size; } else { - // Right now we just crop the viewport, it will do the job self.size = size; - gl::viewport(0, 0, size.width, size.height); unsafe { gl::Scissor(0, 0, size.width, size.height); } } + Ok(()) } fn init(&mut self) { - self.gl_context.make_current(); + self.gl_context.make_current().unwrap(); } } diff --git a/components/compositing/Cargo.toml b/components/compositing/Cargo.toml index fcc129e2ccc..a16df45f0ed 100644 --- a/components/compositing/Cargo.toml +++ b/components/compositing/Cargo.toml @@ -22,12 +22,15 @@ path = "../msg" [dependencies.net] path = "../net" -[dependencies.profile] -path = "../profile" +[dependencies.profile_traits] +path = "../profile_traits" [dependencies.net_traits] path = "../net_traits" +[dependencies.style] +path = "../style" + [dependencies.util] path = "../util" @@ -59,9 +62,10 @@ git = "https://github.com/servo/rust-core-text" git = "https://github.com/servo/gleam" [dependencies.clipboard] -git = "https://github.com/aweinstock314/rust-x11-clipboard" +git = "https://github.com/servo/rust-x11-clipboard" [dependencies] +num = "0.1.24" url = "0.2.16" time = "0.1.17" libc = "*" diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 727760e57ed..3ff8ba62d33 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -27,22 +27,23 @@ use layers::rendergl; use layers::scene::Scene; use msg::compositor_msg::{Epoch, LayerId}; use msg::compositor_msg::{ReadyState, PaintState, ScrollPolicy}; +use msg::constellation_msg::AnimationState; use msg::constellation_msg::Msg as ConstellationMsg; use msg::constellation_msg::{ConstellationChan, NavigationDirection}; use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData}; use msg::constellation_msg::{PipelineId, WindowSizeData}; use png; -use profile::mem; -use profile::time::{self, ProfilerCategory, profile}; +use profile_traits::mem; +use profile_traits::time::{self, ProfilerCategory, profile}; use script_traits::{ConstellationControlMsg, ScriptControlChan}; use std::cmp; use std::collections::HashMap; use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::mem as std_mem; -use std::num::Float; use std::rc::Rc; use std::slice::bytes::copy_memory; use std::sync::mpsc::Sender; +use style::viewport::ViewportConstraints; use time::{precise_time_ns, precise_time_s}; use url::Url; use util::geometry::{PagePx, ScreenPx, ViewportPx}; @@ -75,6 +76,10 @@ pub struct IOCompositor<Window: WindowMethods> { /// "Mobile-style" zoom that does not reflow the page. viewport_zoom: ScaleFactor<PagePx, ViewportPx, f32>, + /// Viewport zoom constraints provided by @viewport. + min_viewport_zoom: Option<ScaleFactor<PagePx, ViewportPx, f32>>, + max_viewport_zoom: Option<ScaleFactor<PagePx, ViewportPx, f32>>, + /// "Desktop-style" zoom that resizes the viewport to fit the window. /// See `ViewportPx` docs in util/geom.rs for details. page_zoom: ScaleFactor<ViewportPx, ScreenPx, f32>, @@ -87,6 +92,9 @@ pub struct IOCompositor<Window: WindowMethods> { /// A handle to the scrolling timer. scrolling_timer: ScrollingTimerProxy, + /// The type of composition to perform + composite_target: CompositeTarget, + /// Tracks whether we should composite this frame. composition_request: CompositionRequest, @@ -167,8 +175,11 @@ struct PipelineDetails { /// The status of this pipeline's PaintTask. paint_state: PaintState, - /// Whether animations are running. + /// Whether animations are running animations_running: bool, + + /// Whether there are animation callbacks + animation_callbacks_running: bool, } impl PipelineDetails { @@ -178,10 +189,43 @@ impl PipelineDetails { ready_state: ReadyState::Blank, paint_state: PaintState::Painting, animations_running: false, + animation_callbacks_running: false, } } } +#[derive(Clone, Copy, PartialEq)] +enum CompositeTarget { + /// Normal composition to a window + Window, + + /// Compose as normal, but also return a PNG of the composed output + WindowAndPng, + + /// Compose to a PNG, write it to disk, and then exit the browser (used for reftests) + PngFile +} + +fn initialize_png(width: usize, height: usize) -> (Vec<gl::GLuint>, Vec<gl::GLuint>) { + let framebuffer_ids = gl::gen_framebuffers(1); + gl::bind_framebuffer(gl::FRAMEBUFFER, framebuffer_ids[0]); + + let texture_ids = gl::gen_textures(1); + gl::bind_texture(gl::TEXTURE_2D, texture_ids[0]); + + gl::tex_image_2d(gl::TEXTURE_2D, 0, gl::RGB as GLint, width as GLsizei, + height as GLsizei, 0, gl::RGB, gl::UNSIGNED_BYTE, None); + gl::tex_parameter_i(gl::TEXTURE_2D, gl::TEXTURE_MAG_FILTER, gl::NEAREST as GLint); + gl::tex_parameter_i(gl::TEXTURE_2D, gl::TEXTURE_MIN_FILTER, gl::NEAREST as GLint); + + gl::framebuffer_texture_2d(gl::FRAMEBUFFER, gl::COLOR_ATTACHMENT0, gl::TEXTURE_2D, + texture_ids[0], 0); + + gl::bind_texture(gl::TEXTURE_2D, 0); + + (framebuffer_ids, texture_ids) +} + impl<Window: WindowMethods> IOCompositor<Window> { fn new(window: Rc<Window>, sender: Box<CompositorProxy+Send>, @@ -196,6 +240,10 @@ impl<Window: WindowMethods> IOCompositor<Window> { // display list. This is only here because we don't have that logic in the painter yet. let window_size = window.framebuffer_size(); let hidpi_factor = window.hidpi_factor(); + let composite_target = match opts::get().output_file { + Some(_) => CompositeTarget::PngFile, + None => CompositeTarget::Window + }; IOCompositor { window: window, port: receiver, @@ -212,9 +260,12 @@ impl<Window: WindowMethods> IOCompositor<Window> { scrolling_timer: ScrollingTimerProxy::new(sender), composition_request: CompositionRequest::NoCompositingNecessary, pending_scroll_events: Vec::new(), + composite_target: composite_target, shutdown_state: ShutdownState::NotShuttingDown, page_zoom: ScaleFactor::new(1.0), viewport_zoom: ScaleFactor::new(1.0), + min_viewport_zoom: None, + max_viewport_zoom: None, zoom_action: false, zoom_time: 0f64, got_load_complete_message: false, @@ -279,9 +330,9 @@ impl<Window: WindowMethods> IOCompositor<Window> { self.change_paint_state(pipeline_id, paint_state); } - (Msg::ChangeRunningAnimationsState(pipeline_id, running_animations), + (Msg::ChangeRunningAnimationsState(pipeline_id, animation_state), ShutdownState::NotShuttingDown) => { - self.change_running_animations_state(pipeline_id, running_animations); + self.change_running_animations_state(pipeline_id, animation_state); } (Msg::ChangePageTitle(pipeline_id, title), ShutdownState::NotShuttingDown) => { @@ -379,12 +430,21 @@ impl<Window: WindowMethods> IOCompositor<Window> { self.window.set_cursor(cursor) } + (Msg::CreatePng(reply), ShutdownState::NotShuttingDown) => { + let img = self.composite_specific_target(CompositeTarget::WindowAndPng); + reply.send(img).unwrap(); + } + (Msg::PaintTaskExited(pipeline_id), ShutdownState::NotShuttingDown) => { if self.pipeline_details.remove(&pipeline_id).is_none() { panic!("Saw PaintTaskExited message from an unknown pipeline!"); } } + (Msg::ViewportConstrained(pipeline_id, constraints), ShutdownState::NotShuttingDown) => { + self.constrain_viewport(pipeline_id, constraints); + } + // When we are shutting_down, we need to avoid performing operations // such as Paint that may crash because we have begun tearing down // the rest of our resources. @@ -399,7 +459,7 @@ impl<Window: WindowMethods> IOCompositor<Window> { self.window.set_ready_state(self.get_earliest_pipeline_ready_state()); // If we're painting in headless mode, schedule a recomposite. - if opts::get().output_file.is_some() { + if let CompositeTarget::PngFile = self.composite_target { self.composite_if_necessary(CompositingReason::Headless) } } @@ -423,11 +483,22 @@ impl<Window: WindowMethods> IOCompositor<Window> { /// recomposite if necessary. fn change_running_animations_state(&mut self, pipeline_id: PipelineId, - animations_running: bool) { - self.get_or_create_pipeline_details(pipeline_id).animations_running = animations_running; - - if animations_running { - self.composite_if_necessary(CompositingReason::Animation); + animation_state: AnimationState) { + match animation_state { + AnimationState::AnimationsPresent => { + self.get_or_create_pipeline_details(pipeline_id).animations_running = true; + self.composite_if_necessary(CompositingReason::Animation); + } + AnimationState::AnimationCallbacksPresent => { + self.get_or_create_pipeline_details(pipeline_id).animation_callbacks_running = true; + self.composite_if_necessary(CompositingReason::Animation); + } + AnimationState::NoAnimationsPresent => { + self.get_or_create_pipeline_details(pipeline_id).animations_running = false; + } + AnimationState::NoAnimationCallbacksPresent => { + self.get_or_create_pipeline_details(pipeline_id).animation_callbacks_running = false; + } } } @@ -922,10 +993,26 @@ impl<Window: WindowMethods> IOCompositor<Window> { /// If there are any animations running, dispatches appropriate messages to the constellation. fn process_animations(&mut self) { for (pipeline_id, pipeline_details) in self.pipeline_details.iter() { - if !pipeline_details.animations_running { - continue + if pipeline_details.animations_running || + pipeline_details.animation_callbacks_running { + + self.constellation_chan.0.send(ConstellationMsg::TickAnimation(*pipeline_id)).unwrap(); } - self.constellation_chan.0.send(ConstellationMsg::TickAnimation(*pipeline_id)).unwrap(); + } + } + + fn constrain_viewport(&mut self, pipeline_id: PipelineId, constraints: ViewportConstraints) { + let is_root = self.root_pipeline.as_ref().map_or(false, |root_pipeline| { + root_pipeline.id == pipeline_id + }); + + if is_root { + // TODO: actual viewport size + + self.viewport_zoom = constraints.initial_zoom; + self.min_viewport_zoom = constraints.min_zoom; + self.max_viewport_zoom = constraints.max_zoom; + self.update_zoom_transform(); } } @@ -960,12 +1047,19 @@ impl<Window: WindowMethods> IOCompositor<Window> { // TODO(pcwalton): I think this should go through the same queuing as scroll events do. fn on_pinch_zoom_window_event(&mut self, magnification: f32) { + use num::Float; + self.zoom_action = true; self.zoom_time = precise_time_s(); let old_viewport_zoom = self.viewport_zoom; - self.viewport_zoom = ScaleFactor::new((self.viewport_zoom.get() * magnification).max(1.0)); - let viewport_zoom = self.viewport_zoom; + let mut viewport_zoom = self.viewport_zoom.get() * magnification; + if let Some(min_zoom) = self.min_viewport_zoom.as_ref() { + viewport_zoom = min_zoom.get().max(viewport_zoom) + } + let viewport_zoom = self.max_viewport_zoom.as_ref().map_or(1., |z| z.get()).min(viewport_zoom); + let viewport_zoom = ScaleFactor::new(viewport_zoom); + self.viewport_zoom = viewport_zoom; self.update_zoom_transform(); @@ -1121,35 +1215,31 @@ impl<Window: WindowMethods> IOCompositor<Window> { } fn composite(&mut self) { + let target = self.composite_target; + self.composite_specific_target(target); + } + + fn composite_specific_target(&mut self, target: CompositeTarget) -> Option<png::Image> { if !self.window.prepare_for_composite() { - return + return None } - let output_image = opts::get().output_file.is_some() && - self.is_ready_to_paint_image_output(); + match target { + CompositeTarget::WindowAndPng | CompositeTarget::PngFile => { + if !self.is_ready_to_paint_image_output() { + return None + } + }, + _ => {} + } - let mut framebuffer_ids = vec!(); - let mut texture_ids = vec!(); let (width, height) = (self.window_size.width.get() as usize, self.window_size.height.get() as usize); - if output_image { - framebuffer_ids = gl::gen_framebuffers(1); - gl::bind_framebuffer(gl::FRAMEBUFFER, framebuffer_ids[0]); - - texture_ids = gl::gen_textures(1); - gl::bind_texture(gl::TEXTURE_2D, texture_ids[0]); - - gl::tex_image_2d(gl::TEXTURE_2D, 0, gl::RGB as GLint, width as GLsizei, - height as GLsizei, 0, gl::RGB, gl::UNSIGNED_BYTE, None); - gl::tex_parameter_i(gl::TEXTURE_2D, gl::TEXTURE_MAG_FILTER, gl::NEAREST as GLint); - gl::tex_parameter_i(gl::TEXTURE_2D, gl::TEXTURE_MIN_FILTER, gl::NEAREST as GLint); - - gl::framebuffer_texture_2d(gl::FRAMEBUFFER, gl::COLOR_ATTACHMENT0, gl::TEXTURE_2D, - texture_ids[0], 0); - - gl::bind_texture(gl::TEXTURE_2D, 0); - } + let (framebuffer_ids, texture_ids) = match target { + CompositeTarget::Window => (vec!(), vec!()), + _ => initialize_png(width, height) + }; profile(ProfilerCategory::Compositing, None, self.time_profiler_chan.clone(), || { debug!("compositor: compositing"); @@ -1170,41 +1260,24 @@ impl<Window: WindowMethods> IOCompositor<Window> { } }); - if output_image { - let path = opts::get().output_file.as_ref().unwrap(); - let mut pixels = gl::read_pixels(0, 0, - width as gl::GLsizei, - height as gl::GLsizei, - gl::RGB, gl::UNSIGNED_BYTE); - - gl::bind_framebuffer(gl::FRAMEBUFFER, 0); - - gl::delete_buffers(&texture_ids); - gl::delete_frame_buffers(&framebuffer_ids); - - // flip image vertically (texture is upside down) - let orig_pixels = pixels.clone(); - let stride = width * 3; - for y in 0..height { - let dst_start = y * stride; - let src_start = (height - y - 1) * stride; - let src_slice = &orig_pixels[src_start .. src_start + stride]; - copy_memory(&mut pixels[dst_start .. dst_start + stride], - &src_slice[..stride]); + let rv = match target { + CompositeTarget::Window => None, + CompositeTarget::WindowAndPng => { + Some(self.draw_png(framebuffer_ids, texture_ids, width, height)) } - let mut img = png::Image { - width: width as u32, - height: height as u32, - pixels: png::PixelsByColorType::RGB8(pixels), - }; - let res = png::store_png(&mut img, &path); - assert!(res.is_ok()); - - debug!("shutting down the constellation after generating an output file"); - let ConstellationChan(ref chan) = self.constellation_chan; - chan.send(ConstellationMsg::Exit).unwrap(); - self.shutdown_state = ShutdownState::ShuttingDown; - } + CompositeTarget::PngFile => { + let mut img = self.draw_png(framebuffer_ids, texture_ids, width, height); + let path = opts::get().output_file.as_ref().unwrap(); + let res = png::store_png(&mut img, &path); + assert!(res.is_ok()); + + debug!("shutting down the constellation after generating an output file"); + let ConstellationChan(ref chan) = self.constellation_chan; + chan.send(ConstellationMsg::Exit).unwrap(); + self.shutdown_state = ShutdownState::ShuttingDown; + None + } + }; // Perform the page flip. This will likely block for a while. self.window.present(); @@ -1214,6 +1287,35 @@ impl<Window: WindowMethods> IOCompositor<Window> { self.composition_request = CompositionRequest::NoCompositingNecessary; self.process_pending_scroll_events(); self.process_animations(); + rv + } + + fn draw_png(&self, framebuffer_ids: Vec<gl::GLuint>, texture_ids: Vec<gl::GLuint>, width: usize, height: usize) -> png::Image { + let mut pixels = gl::read_pixels(0, 0, + width as gl::GLsizei, + height as gl::GLsizei, + gl::RGB, gl::UNSIGNED_BYTE); + + gl::bind_framebuffer(gl::FRAMEBUFFER, 0); + + gl::delete_buffers(&texture_ids); + gl::delete_frame_buffers(&framebuffer_ids); + + // flip image vertically (texture is upside down) + let orig_pixels = pixels.clone(); + let stride = width * 3; + for y in 0..height { + let dst_start = y * stride; + let src_start = (height - y - 1) * stride; + let src_slice = &orig_pixels[src_start .. src_start + stride]; + copy_memory(&src_slice[..stride], + &mut pixels[dst_start .. dst_start + stride]); + } + png::Image { + width: width as u32, + height: height as u32, + pixels: png::PixelsByColorType::RGB8(pixels), + } } fn composite_if_necessary(&mut self, reason: CompositingReason) { @@ -1436,4 +1538,3 @@ pub enum CompositingReason { /// The window has been zoomed. Zoom, } - diff --git a/components/compositing/compositor_layer.rs b/components/compositing/compositor_layer.rs index 04653bca346..b5234e9d09e 100644 --- a/components/compositing/compositor_layer.rs +++ b/components/compositing/compositor_layer.rs @@ -20,7 +20,6 @@ use script_traits::CompositorEvent::{ClickEvent, MouseDownEvent, MouseMoveEvent, use script_traits::{ScriptControlChan, ConstellationControlMsg}; use msg::compositor_msg::{Epoch, LayerId, ScrollPolicy}; use msg::constellation_msg::PipelineId; -use std::num::Float; use std::rc::Rc; pub struct CompositorData { @@ -63,6 +62,7 @@ impl CompositorData { Rc::new(Layer::new(Rect::from_untyped(&layer_properties.rect), tile_size, to_layers_color(&layer_properties.background_color), + 1.0, new_compositor_data)) } } diff --git a/components/compositing/compositor_task.rs b/components/compositing/compositor_task.rs index 69e5ef4f17b..bed4255e34b 100644 --- a/components/compositing/compositor_task.rs +++ b/components/compositing/compositor_task.rs @@ -19,13 +19,15 @@ use layers::platform::surface::{NativeCompositingGraphicsContext, NativeGraphics use layers::layers::LayerBufferSet; use msg::compositor_msg::{Epoch, LayerId, LayerMetadata, ReadyState}; use msg::compositor_msg::{PaintListener, PaintState, ScriptListener, ScrollPolicy}; -use msg::constellation_msg::{ConstellationChan, PipelineId}; +use msg::constellation_msg::{AnimationState, ConstellationChan, PipelineId}; use msg::constellation_msg::{Key, KeyState, KeyModifiers}; -use profile::mem; -use profile::time; +use profile_traits::mem; +use profile_traits::time; +use png; use std::sync::mpsc::{channel, Sender, Receiver}; use std::fmt::{Error, Formatter, Debug}; use std::rc::Rc; +use style::viewport::ViewportConstraints; use url::Url; use util::cursor::Cursor; @@ -202,7 +204,7 @@ pub enum Msg { /// Alerts the compositor that the current page has changed its URL. ChangePageUrl(PipelineId, Url), /// Alerts the compositor that the given pipeline has changed whether it is running animations. - ChangeRunningAnimationsState(PipelineId, bool), + ChangeRunningAnimationsState(PipelineId, AnimationState), /// Alerts the compositor that a `PaintMsg` has been discarded. PaintMsgDiscarded, /// Replaces the current frame tree, typically called during main frame navigation. @@ -217,8 +219,12 @@ pub enum Msg { KeyEvent(Key, KeyState, KeyModifiers), /// Changes the cursor. SetCursor(Cursor), + /// Composite to a PNG file and return the Image over a passed channel. + CreatePng(Sender<Option<png::Image>>), /// Informs the compositor that the paint task for the given pipeline has exited. PaintTaskExited(PipelineId), + /// Alerts the compositor that the viewport has been constrained in some manner + ViewportConstrained(PipelineId, ViewportConstraints), } impl Debug for Msg { @@ -244,7 +250,9 @@ impl Debug for Msg { Msg::RecompositeAfterScroll => write!(f, "RecompositeAfterScroll"), Msg::KeyEvent(..) => write!(f, "KeyEvent"), Msg::SetCursor(..) => write!(f, "SetCursor"), + Msg::CreatePng(..) => write!(f, "CreatePng"), Msg::PaintTaskExited(..) => write!(f, "PaintTaskExited"), + Msg::ViewportConstrained(..) => write!(f, "ViewportConstrained"), } } } @@ -303,4 +311,3 @@ pub trait CompositorEventListener { /// Requests that the compositor send the title for the main frame as soon as possible. fn get_title_for_main_frame(&self); } - diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs index 7ad95f89b90..8794c65662c 100644 --- a/components/compositing/constellation.rs +++ b/components/compositing/constellation.rs @@ -14,6 +14,7 @@ use gfx::font_cache_task::FontCacheTask; use layout_traits::{LayoutControlMsg, LayoutTaskFactory}; use libc; use msg::compositor_msg::LayerId; +use msg::constellation_msg::AnimationState; use msg::constellation_msg::Msg as ConstellationMsg; use msg::constellation_msg::{FrameId, PipelineExitType, PipelineId}; use msg::constellation_msg::{IFrameSandboxState, MozBrowserEvent, NavigationDirection}; @@ -23,8 +24,8 @@ use msg::constellation_msg::{self, ConstellationChan, Failure}; use net_traits::{self, ResourceTask}; use net_traits::image_cache_task::ImageCacheTask; use net_traits::storage_task::{StorageTask, StorageTaskMsg}; -use profile::mem; -use profile::time; +use profile_traits::mem; +use profile_traits::time; use script_traits::{CompositorEvent, ConstellationControlMsg}; use script_traits::{ScriptControlChan, ScriptTaskFactory}; use std::borrow::ToOwned; @@ -33,6 +34,7 @@ use std::io::{self, Write}; use std::marker::PhantomData; use std::mem::replace; use std::sync::mpsc::{Sender, Receiver, channel}; +use style::viewport::ViewportConstraints; use url::Url; use util::cursor::Cursor; use util::geometry::PagePx; @@ -344,8 +346,8 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> { sandbox); } ConstellationMsg::SetCursor(cursor) => self.handle_set_cursor_msg(cursor), - ConstellationMsg::ChangeRunningAnimationsState(pipeline_id, animations_running) => { - self.handle_change_running_animations_state(pipeline_id, animations_running) + ConstellationMsg::ChangeRunningAnimationsState(pipeline_id, animation_state) => { + self.handle_change_running_animations_state(pipeline_id, animation_state) } ConstellationMsg::TickAnimation(pipeline_id) => { self.handle_tick_animation(pipeline_id) @@ -411,12 +413,19 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> { }; sender.send(result).unwrap(); } + ConstellationMsg::CompositePng(reply) => { + self.compositor_proxy.send(CompositorMsg::CreatePng(reply)); + } ConstellationMsg::WebDriverCommand(pipeline_id, command) => { debug!("constellation got webdriver command message"); self.handle_webdriver_command_msg(pipeline_id, command); } + ConstellationMsg::ViewportConstrained(pipeline_id, constraints) => { + debug!("constellation got viewport-constrained event message"); + self.handle_viewport_constrained_msg(pipeline_id, constraints); + } } true } @@ -560,9 +569,9 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> { fn handle_change_running_animations_state(&mut self, pipeline_id: PipelineId, - animations_running: bool) { + animation_state: AnimationState) { self.compositor_proxy.send(CompositorMsg::ChangeRunningAnimationsState(pipeline_id, - animations_running)) + animation_state)) } fn handle_tick_animation(&mut self, pipeline_id: PipelineId) { @@ -912,6 +921,11 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> { self.window_size = new_size; } + /// Handle updating actual viewport / zoom due to @viewport rules + fn handle_viewport_constrained_msg(&mut self, pipeline_id: PipelineId, constraints: ViewportConstraints) { + self.compositor_proxy.send(CompositorMsg::ViewportConstrained(pipeline_id, constraints)); + } + // Close a frame (and all children) fn close_frame(&mut self, frame_id: FrameId, exit_mode: ExitPipelineMode) { let frame = self.frames.remove(&frame_id).unwrap(); diff --git a/components/compositing/headless.rs b/components/compositing/headless.rs index 46f8351ba21..0b2567821ad 100644 --- a/components/compositing/headless.rs +++ b/components/compositing/headless.rs @@ -9,8 +9,8 @@ use geom::scale_factor::ScaleFactor; use geom::size::TypedSize2D; use msg::constellation_msg::Msg as ConstellationMsg; use msg::constellation_msg::{ConstellationChan, WindowSizeData}; -use profile::mem; -use profile::time; +use profile_traits::mem; +use profile_traits::time; /// Starts the compositor, which listens for messages on the specified port. /// @@ -107,7 +107,9 @@ impl CompositorEventListener for NullCompositor { Msg::ChangePageTitle(..) | Msg::ChangePageUrl(..) | Msg::KeyEvent(..) | - Msg::SetCursor(..) => {} + Msg::SetCursor(..) | + Msg::ViewportConstrained(..) => {} + Msg::CreatePng(..) | Msg::PaintTaskExited(..) => {} } true diff --git a/components/compositing/lib.rs b/components/compositing/lib.rs index 7b8d49348c3..de013523827 100644 --- a/components/compositing/lib.rs +++ b/components/compositing/lib.rs @@ -4,10 +4,7 @@ #![feature(box_syntax)] #![feature(core)] -#![feature(io)] -#![feature(old_io)] #![feature(rustc_private)] -#![feature(std_misc)] #[macro_use] extern crate log; @@ -22,8 +19,10 @@ extern crate png; extern crate script_traits; extern crate msg; extern crate net; -extern crate profile; +extern crate num; +extern crate profile_traits; extern crate net_traits; +extern crate style; #[macro_use] extern crate util; extern crate gleam; diff --git a/components/compositing/pipeline.rs b/components/compositing/pipeline.rs index 3c96524b18b..06d85a2ca2a 100644 --- a/components/compositing/pipeline.rs +++ b/components/compositing/pipeline.rs @@ -16,8 +16,8 @@ use gfx::font_cache_task::FontCacheTask; use layers::geometry::DevicePixel; use msg::constellation_msg::{ConstellationChan, Failure, FrameId, PipelineId, SubpageId}; use msg::constellation_msg::{LoadData, WindowSizeData, PipelineExitType, MozBrowserEvent}; -use profile::mem; -use profile::time; +use profile_traits::mem; +use profile_traits::time; use net_traits::ResourceTask; use net_traits::image_cache_task::ImageCacheTask; use net_traits::storage_task::StorageTask; diff --git a/components/compositing/scrolling.rs b/components/compositing/scrolling.rs index 89890fd2b27..11a0b8721f6 100644 --- a/components/compositing/scrolling.rs +++ b/components/compositing/scrolling.rs @@ -6,10 +6,8 @@ use compositor_task::{CompositorProxy, Msg}; -use std::old_io::timer; use std::sync::mpsc::{Receiver, Sender, channel}; -use std::thread::Builder; -use std::time::duration::Duration; +use std::thread::{Builder, sleep_ms}; use time; /// The amount of time in nanoseconds that we give to the painting thread to paint new tiles upon @@ -61,8 +59,8 @@ impl ScrollingTimer { match self.receiver.recv() { Ok(ToScrollingTimerMsg::ScrollEventProcessedMsg(timestamp)) => { let target = timestamp as i64 + TIMEOUT; - let delta = target - (time::precise_time_ns() as i64); - timer::sleep(Duration::nanoseconds(delta)); + let delta_ns = target - (time::precise_time_ns() as i64); + sleep_ms((delta_ns / 1000) as u32); self.compositor_proxy.send(Msg::ScrollTimeout(timestamp)); } Ok(ToScrollingTimerMsg::ExitMsg) | Err(_) => break, diff --git a/components/devtools/Cargo.toml b/components/devtools/Cargo.toml index 6503aa125cb..5fe447183ee 100644 --- a/components/devtools/Cargo.toml +++ b/components/devtools/Cargo.toml @@ -19,3 +19,5 @@ path = "../util" [dependencies] time = "*" rustc-serialize = "0.3" +url = "*" +hyper = "*" diff --git a/components/devtools/actor.rs b/components/devtools/actor.rs index 1fdd2af5c14..ee12104b209 100644 --- a/components/devtools/actor.rs +++ b/components/devtools/actor.rs @@ -8,6 +8,7 @@ use rustc_serialize::json; use std::any::{Any, TypeId}; use std::collections::HashMap; use std::cell::{Cell, RefCell}; +use std::marker::Reflect; use std::mem::{replace, transmute}; use std::net::TcpStream; use std::raw::TraitObject; @@ -26,10 +27,10 @@ pub trait Actor: Any { fn name(&self) -> String; } -impl Actor { +impl Actor + Send { /// Returns true if the boxed type is the same as `T` #[inline] - pub fn is<T: 'static>(&self) -> bool { + pub fn is<T: Reflect + 'static>(&self) -> bool { // Get TypeId of the type this function is instantiated with let t = TypeId::of::<T>(); @@ -43,7 +44,7 @@ impl Actor { /// Returns some reference to the boxed value if it is of type `T`, or /// `None` if it isn't. #[inline] - pub fn downcast_ref<T: 'static>(&self) -> Option<&T> { + pub fn downcast_ref<T: Reflect + 'static>(&self) -> Option<&T> { if self.is::<T>() { unsafe { // Get the raw representation of the trait object @@ -60,7 +61,7 @@ impl Actor { /// Returns some mutable reference to the boxed value if it is of type `T`, or /// `None` if it isn't. #[inline] - pub fn downcast_mut<T: 'static>(&mut self) -> Option<&mut T> { + pub fn downcast_mut<T: Reflect + 'static>(&mut self) -> Option<&mut T> { if self.is::<T>() { unsafe { // Get the raw representation of the trait object @@ -168,13 +169,13 @@ impl ActorRegistry { } /// Find an actor by registered name - pub fn find<'a, T: 'static>(&'a self, name: &str) -> &'a T { + pub fn find<'a, T: Reflect + 'static>(&'a self, name: &str) -> &'a T { let actor = self.actors.get(&name.to_string()).unwrap(); actor.downcast_ref::<T>().unwrap() } /// Find an actor by registered name - pub fn find_mut<'a, T: 'static>(&'a mut self, name: &str) -> &'a mut T { + pub fn find_mut<'a, T: Reflect + 'static>(&'a mut self, name: &str) -> &'a mut T { let actor = self.actors.get_mut(&name.to_string()).unwrap(); actor.downcast_mut::<T>().unwrap() } diff --git a/components/devtools/actors/console.rs b/components/devtools/actors/console.rs index 4939cfa47da..834ccc99235 100644 --- a/components/devtools/actors/console.rs +++ b/components/devtools/actors/console.rs @@ -18,7 +18,6 @@ use collections::BTreeMap; use core::cell::RefCell; use rustc_serialize::json::{self, Json, ToJson}; use std::net::TcpStream; -use std::num::Float; use std::sync::mpsc::{channel, Sender}; #[derive(RustcEncodable)] @@ -251,7 +250,7 @@ impl Actor for ConsoleActor { m.insert("type".to_string(), "Infinity".to_string().to_json()); } Json::Object(m) - } else if val == Float::neg_zero() { + } else if val == 0. && val.is_sign_negative() { let mut m = BTreeMap::new(); m.insert("type".to_string(), "-0".to_string().to_json()); Json::Object(m) diff --git a/components/devtools/actors/framerate.rs b/components/devtools/actors/framerate.rs index 0cb82486342..3e02971a1ed 100644 --- a/components/devtools/actors/framerate.rs +++ b/components/devtools/actors/framerate.rs @@ -5,15 +5,23 @@ use rustc_serialize::json; use std::mem; use std::net::TcpStream; +use std::sync::{Arc, Mutex}; +use std::sync::mpsc::Sender; use time::precise_time_ns; +use msg::constellation_msg::PipelineId; use actor::{Actor, ActorRegistry}; +use actors::timeline::HighResolutionStamp; +use devtools_traits::{DevtoolsControlMsg, DevtoolScriptControlMsg}; pub struct FramerateActor { name: String, + pipeline: PipelineId, + script_sender: Sender<DevtoolScriptControlMsg>, + devtools_sender: Sender<DevtoolsControlMsg>, start_time: Option<u64>, - is_recording: bool, - ticks: Vec<u64>, + is_recording: Arc<Mutex<bool>>, + ticks: Arc<Mutex<Vec<HighResolutionStamp>>>, } impl Actor for FramerateActor { @@ -33,13 +41,19 @@ impl Actor for FramerateActor { impl FramerateActor { /// return name of actor - pub fn create(registry: &ActorRegistry) -> String { + pub fn create(registry: &ActorRegistry, + pipeline_id: PipelineId, + script_sender: Sender<DevtoolScriptControlMsg>, + devtools_sender: Sender<DevtoolsControlMsg>) -> String { let actor_name = registry.new_name("framerate"); let mut actor = FramerateActor { name: actor_name.clone(), + pipeline: pipeline_id, + script_sender: script_sender, + devtools_sender: devtools_sender, start_time: None, - is_recording: false, - ticks: Vec::new(), + is_recording: Arc::new(Mutex::new(false)), + ticks: Arc::new(Mutex::new(Vec::new())), }; actor.start_recording(); @@ -47,36 +61,71 @@ impl FramerateActor { actor_name } - // callback on request animation frame - #[allow(dead_code)] - pub fn on_refresh_driver_tick(&mut self) { - if !self.is_recording { - return; - } - // TODO: Need implement requesting animation frame - // http://hg.mozilla.org/mozilla-central/file/0a46652bd992/dom/base/nsGlobalWindow.cpp#l5314 - - let start_time = self.start_time.as_ref().unwrap(); - self.ticks.push(*start_time - precise_time_ns()); + pub fn add_tick(&self, tick: f64) { + let mut lock = self.ticks.lock(); + let mut ticks = lock.as_mut().unwrap(); + ticks.push(HighResolutionStamp::wrap(tick)); } - pub fn take_pending_ticks(&mut self) -> Vec<u64> { - mem::replace(&mut self.ticks, Vec::new()) + pub fn take_pending_ticks(&self) -> Vec<HighResolutionStamp> { + let mut lock = self.ticks.lock(); + let mut ticks = lock.as_mut().unwrap(); + mem::replace(ticks, Vec::new()) } fn start_recording(&mut self) { - self.is_recording = true; + let mut lock = self.is_recording.lock(); + if **lock.as_ref().unwrap() { + return; + } + self.start_time = Some(precise_time_ns()); + let is_recording = lock.as_mut(); + **is_recording.unwrap() = true; + + fn get_closure(is_recording: Arc<Mutex<bool>>, + name: String, + pipeline: PipelineId, + script_sender: Sender<DevtoolScriptControlMsg>, + devtools_sender: Sender<DevtoolsControlMsg>) + -> Box<Fn(f64, ) + Send> { + + let closure = move |now: f64| { + let msg = DevtoolsControlMsg::FramerateTick(name.clone(), now); + devtools_sender.send(msg).unwrap(); + + if !*is_recording.lock().unwrap() { + return; + } + + let closure = get_closure(is_recording.clone(), + name.clone(), + pipeline.clone(), + script_sender.clone(), + devtools_sender.clone()); + let msg = DevtoolScriptControlMsg::RequestAnimationFrame(pipeline, closure); + script_sender.send(msg).unwrap(); + }; + Box::new(closure) + }; - // TODO(#5681): Need implement requesting animation frame - // http://hg.mozilla.org/mozilla-central/file/0a46652bd992/dom/base/nsGlobalWindow.cpp#l5314 + let closure = get_closure(self.is_recording.clone(), + self.name(), + self.pipeline.clone(), + self.script_sender.clone(), + self.devtools_sender.clone()); + let msg = DevtoolScriptControlMsg::RequestAnimationFrame(self.pipeline, closure); + self.script_sender.send(msg).unwrap(); } fn stop_recording(&mut self) { - if !self.is_recording { + let mut lock = self.is_recording.lock(); + if !**lock.as_ref().unwrap() { return; } - self.is_recording = false; + + let is_recording = lock.as_mut(); + **is_recording.unwrap() = false; self.start_time = None; } diff --git a/components/devtools/actors/inspector.rs b/components/devtools/actors/inspector.rs index 5519652cf06..3dbaf5c6d43 100644 --- a/components/devtools/actors/inspector.rs +++ b/components/devtools/actors/inspector.rs @@ -16,7 +16,6 @@ use msg::constellation_msg::PipelineId; use rustc_serialize::json::{self, Json, ToJson}; use std::cell::RefCell; use std::net::TcpStream; -use std::num::Float; use std::sync::mpsc::{channel, Sender}; pub struct InspectorActor { diff --git a/components/devtools/actors/network_event.rs b/components/devtools/actors/network_event.rs new file mode 100644 index 00000000000..28a6acc18f0 --- /dev/null +++ b/components/devtools/actors/network_event.rs @@ -0,0 +1,165 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/// Liberally derived from the [Firefox JS implementation](http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/webconsole.js). +/// Handles interaction with the remote web console on network events (HTTP requests, responses) in Servo. + +extern crate hyper; + +use actor::{Actor, ActorRegistry}; +use protocol::JsonPacketStream; +use rustc_serialize::json; +use std::net::TcpStream; +use url::Url; +use hyper::header::Headers; +use hyper::http::RawStatus; +use hyper::method::Method; + +struct HttpRequest { + url: String, + method: Method, + headers: Headers, + body: Option<Vec<u8>>, +} + +struct HttpResponse { + headers: Option<Headers>, + status: Option<RawStatus>, + body: Option<Vec<u8>> +} + +pub struct NetworkEventActor { + pub name: String, + request: HttpRequest, + response: HttpResponse, +} + +#[derive(RustcEncodable)] +pub struct EventActor { + pub actor: String, + pub url: String, + pub method: String, + pub startedDateTime: String, + pub isXHR: bool, + pub private: bool +} + +#[derive(RustcEncodable)] +pub struct ResponseStartMsg { + pub httpVersion: String, + pub remoteAddress: String, + pub remotePort: u32, + pub status: String, + pub statusText: String, + pub headersSize: u32, + pub discardResponseBody: bool, +} + +#[derive(RustcEncodable)] +struct GetRequestHeadersReply { + from: String, + headers: Vec<String>, + headerSize: u8, + rawHeaders: String +} + +impl Actor for NetworkEventActor { + fn name(&self) -> String { + self.name.clone() + } + + fn handle_message(&self, + _registry: &ActorRegistry, + msg_type: &str, + _msg: &json::Object, + stream: &mut TcpStream) -> Result<bool, ()> { + Ok(match msg_type { + "getRequestHeaders" => { + // TODO: Pass the correct values for headers, headerSize, rawHeaders + let msg = GetRequestHeadersReply { + from: self.name(), + headers: Vec::new(), + headerSize: 10, + rawHeaders: "Raw headers".to_string(), + }; + stream.write_json_packet(&msg); + true + } + "getRequestCookies" => { + false + } + "getRequestPostData" => { + false + } + "getResponseHeaders" => { + false + } + "getResponseCookies" => { + false + } + "getResponseContent" => { + false + } + _ => false + }) + } +} + +impl NetworkEventActor { + pub fn new(name: String) -> NetworkEventActor { + NetworkEventActor { + name: name, + request: HttpRequest { + url: String::new(), + method: Method::Get, + headers: Headers::new(), + body: None + }, + response: HttpResponse { + headers: None, + status: None, + body: None, + } + } + } + + pub fn add_request(&mut self, url: Url, method: Method, headers: Headers, body: Option<Vec<u8>>) { + self.request.url = url.serialize(); + self.request.method = method.clone(); + self.request.headers = headers.clone(); + self.request.body = body; + } + + pub fn add_response(&mut self, headers: Option<Headers>, status: Option<RawStatus>, body: Option<Vec<u8>>) { + self.response.headers = headers.clone(); + self.response.status = status.clone(); + self.response.body = body.clone(); + } + + pub fn get_event_actor(&self) -> EventActor { + // TODO: Send the correct values for startedDateTime, isXHR, private + EventActor { + actor: self.name(), + url: self.request.url.clone(), + method: format!("{}", self.request.method), + startedDateTime: "2015-04-22T20:47:08.545Z".to_string(), + isXHR: false, + private: false, + } + } + + pub fn get_response_start(&self) -> ResponseStartMsg { + // TODO: Send the correct values for all these fields. + // This is a fake message. + ResponseStartMsg { + httpVersion: "HTTP/1.1".to_string(), + remoteAddress: "63.245.217.43".to_string(), + remotePort: 443, + status: "200".to_string(), + statusText: "OK".to_string(), + headersSize: 337, + discardResponseBody: true + } + } +} diff --git a/components/devtools/actors/timeline.rs b/components/devtools/actors/timeline.rs index 6ea92626ae3..dc29b8a80b7 100644 --- a/components/devtools/actors/timeline.rs +++ b/components/devtools/actors/timeline.rs @@ -2,22 +2,21 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use core::iter::FromIterator; use msg::constellation_msg::PipelineId; use rustc_serialize::{json, Encoder, Encodable}; use std::cell::RefCell; use std::collections::{HashMap, VecDeque}; +use std::mem; use std::net::TcpStream; -use std::old_io::timer::sleep; +use std::thread::sleep_ms; use std::sync::{Arc, Mutex}; -use std::time::duration::Duration; use std::sync::mpsc::{channel, Sender, Receiver}; use time::PreciseTime; use actor::{Actor, ActorRegistry}; use actors::memory::{MemoryActor, TimelineMemoryReply}; use actors::framerate::FramerateActor; -use devtools_traits::DevtoolScriptControlMsg; +use devtools_traits::{DevtoolsControlMsg, DevtoolScriptControlMsg}; use devtools_traits::DevtoolScriptControlMsg::{SetTimelineMarkers, DropTimelineMarkers}; use devtools_traits::{TimelineMarker, TracingMetadata, TimelineMarkerType}; use protocol::JsonPacketStream; @@ -26,6 +25,7 @@ use util::task; pub struct TimelineActor { name: String, script_sender: Sender<DevtoolScriptControlMsg>, + devtools_sender: Sender<DevtoolsControlMsg>, marker_types: Vec<TimelineMarkerType>, pipeline: PipelineId, is_recording: Arc<Mutex<bool>>, @@ -94,21 +94,25 @@ struct FramerateEmitterReply { __type__: String, from: String, delta: HighResolutionStamp, - timestamps: Vec<u64>, + timestamps: Vec<HighResolutionStamp>, } /// HighResolutionStamp is struct that contains duration in milliseconds /// with accuracy to microsecond that shows how much time has passed since /// actor registry inited /// analog https://w3c.github.io/hr-time/#sec-DOMHighResTimeStamp -struct HighResolutionStamp(f64); +pub struct HighResolutionStamp(f64); impl HighResolutionStamp { - fn new(start_stamp: PreciseTime, time: PreciseTime) -> HighResolutionStamp { + pub fn new(start_stamp: PreciseTime, time: PreciseTime) -> HighResolutionStamp { let duration = start_stamp.to(time).num_microseconds() .expect("Too big duration in microseconds"); HighResolutionStamp(duration as f64 / 1000 as f64) } + + pub fn wrap(time: f64) -> HighResolutionStamp { + HighResolutionStamp(time) + } } impl Encodable for HighResolutionStamp { @@ -117,12 +121,13 @@ impl Encodable for HighResolutionStamp { } } -static DEFAULT_TIMELINE_DATA_PULL_TIMEOUT: usize = 200; //ms +static DEFAULT_TIMELINE_DATA_PULL_TIMEOUT: u32 = 200; //ms impl TimelineActor { pub fn new(name: String, pipeline: PipelineId, - script_sender: Sender<DevtoolScriptControlMsg>) -> TimelineActor { + script_sender: Sender<DevtoolScriptControlMsg>, + devtools_sender: Sender<DevtoolsControlMsg>) -> TimelineActor { let marker_types = vec!(TimelineMarkerType::Reflow, TimelineMarkerType::DOMEvent); @@ -132,6 +137,7 @@ impl TimelineActor { pipeline: pipeline, marker_types: marker_types, script_sender: script_sender, + devtools_sender: devtools_sender, is_recording: Arc::new(Mutex::new(false)), stream: RefCell::new(None), @@ -214,7 +220,7 @@ impl TimelineActor { } emitter.send(); - sleep(Duration::milliseconds(DEFAULT_TIMELINE_DATA_PULL_TIMEOUT as i64)); + sleep_ms(DEFAULT_TIMELINE_DATA_PULL_TIMEOUT); } }); } @@ -249,7 +255,11 @@ impl Actor for TimelineActor { // init framerate actor if let Some(with_ticks) = msg.get("withTicks") { if let Some(true) = with_ticks.as_boolean() { - *self.framerate_actor.borrow_mut() = Some(FramerateActor::create(registry)); + let framerate_actor = Some(FramerateActor::create(registry, + self.pipeline.clone(), + self.script_sender.clone(), + self.devtools_sender.clone())); + *self.framerate_actor.borrow_mut() = framerate_actor; } } @@ -344,7 +354,7 @@ impl Emitter { let end_time = PreciseTime::now(); let reply = MarkersEmitterReply { __type__: "markers".to_string(), - markers: Vec::from_iter(self.markers.drain()), + markers: mem::replace(&mut self.markers, Vec::new()), from: self.from.clone(), endTime: HighResolutionStamp::new(self.start_stamp, end_time), }; @@ -353,7 +363,7 @@ impl Emitter { if let Some(ref actor_name) = self.framerate_actor { let mut lock = self.registry.lock(); let registry = lock.as_mut().unwrap(); - let mut framerate_actor = registry.find_mut::<FramerateActor>(actor_name); + let framerate_actor = registry.find_mut::<FramerateActor>(actor_name); let framerateReply = FramerateEmitterReply { __type__: "framerate".to_string(), from: framerate_actor.name(), diff --git a/components/devtools/lib.rs b/components/devtools/lib.rs index e2d06a7665b..1e51abaaa86 100644 --- a/components/devtools/lib.rs +++ b/components/devtools/lib.rs @@ -11,10 +11,7 @@ #![crate_type = "rlib"] #![feature(box_syntax, core, rustc_private)] -#![feature(collections, std_misc)] -#![feature(io)] -#![feature(net)] -#![feature(old_io)] +#![feature(collections)] #![allow(non_snake_case)] @@ -24,21 +21,25 @@ extern crate log; extern crate collections; extern crate core; extern crate devtools_traits; -extern crate "rustc-serialize" as rustc_serialize; +extern crate rustc_serialize; extern crate msg; extern crate time; extern crate util; +extern crate hyper; +extern crate url; use actor::{Actor, ActorRegistry}; use actors::console::ConsoleActor; -use actors::worker::WorkerActor; +use actors::network_event::{NetworkEventActor, EventActor, ResponseStartMsg}; +use actors::framerate::FramerateActor; use actors::inspector::InspectorActor; use actors::root::RootActor; use actors::tab::TabActor; use actors::timeline::TimelineActor; +use actors::worker::WorkerActor; use protocol::JsonPacketStream; -use devtools_traits::{ConsoleMessage, DevtoolsControlMsg}; +use devtools_traits::{ConsoleMessage, DevtoolsControlMsg, NetworkEvent}; use devtools_traits::{DevtoolsPageInfo, DevtoolScriptControlMsg}; use msg::constellation_msg::{PipelineId, WorkerId}; use util::task::spawn_named; @@ -46,6 +47,8 @@ use util::task::spawn_named; use std::borrow::ToOwned; use std::cell::RefCell; use std::collections::HashMap; +use std::collections::hash_map::Entry::{Occupied, Vacant}; +use std::error::Error; use std::sync::mpsc::{channel, Receiver, Sender, RecvError}; use std::net::{TcpListener, TcpStream, Shutdown}; use std::sync::{Arc, Mutex}; @@ -62,6 +65,7 @@ mod actors { pub mod tab; pub mod timeline; pub mod worker; + pub mod network_event; } mod protocol; @@ -82,6 +86,21 @@ struct ConsoleMsg { columnNumber: u32, } +#[derive(RustcEncodable)] +struct NetworkEventMsg { + from: String, + __type__: String, + eventActor: EventActor, +} + +#[derive(RustcEncodable)] +struct NetworkEventUpdateMsg { + from: String, + __type__: String, + updateType: String, + response: ResponseStartMsg, +} + /// Spin up a devtools server that listens for connections on the specified port. pub fn start_server(port: u16) -> Sender<DevtoolsControlMsg> { let (sender, receiver) = channel(); @@ -113,6 +132,7 @@ fn run_server(sender: Sender<DevtoolsControlMsg>, let mut accepted_connections: Vec<TcpStream> = Vec::new(); let mut actor_pipelines: HashMap<PipelineId, String> = HashMap::new(); + let mut actor_requests: HashMap<String, String> = HashMap::new(); let mut actor_workers: HashMap<(PipelineId, WorkerId), String> = HashMap::new(); @@ -128,7 +148,7 @@ fn run_server(sender: Sender<DevtoolsControlMsg>, 'outer: loop { match stream.read_json_packet() { - Ok(json_packet) => { + Ok(Some(json_packet)) => { match actors.lock().unwrap().handle_message(json_packet.as_object().unwrap(), &mut stream) { Ok(()) => {}, @@ -139,6 +159,10 @@ fn run_server(sender: Sender<DevtoolsControlMsg>, } } } + Ok(None) => { + println!("error: EOF"); + break 'outer + } Err(e) => { println!("error: {}", e.description()); break 'outer @@ -147,12 +171,19 @@ fn run_server(sender: Sender<DevtoolsControlMsg>, } } + fn handle_framerate_tick(actors: Arc<Mutex<ActorRegistry>>, actor_name: String, tick: f64) { + let actors = actors.lock().unwrap(); + let framerate_actor = actors.find::<FramerateActor>(&actor_name); + framerate_actor.add_tick(tick); + } + // We need separate actor representations for each script global that exists; // clients can theoretically connect to multiple globals simultaneously. // TODO: move this into the root or tab modules? fn handle_new_global(actors: Arc<Mutex<ActorRegistry>>, ids: (PipelineId, Option<WorkerId>), - scriptSender: Sender<DevtoolScriptControlMsg>, + script_sender: Sender<DevtoolScriptControlMsg>, + devtools_sender: Sender<DevtoolsControlMsg>, actor_pipelines: &mut HashMap<PipelineId, String>, actor_workers: &mut HashMap<(PipelineId, WorkerId), String>, page_info: DevtoolsPageInfo) { @@ -164,7 +195,7 @@ fn run_server(sender: Sender<DevtoolsControlMsg>, let (tab, console, inspector, timeline) = { let console = ConsoleActor { name: actors.new_name("console"), - script_chan: scriptSender.clone(), + script_chan: script_sender.clone(), pipeline: pipeline, streams: RefCell::new(Vec::new()), }; @@ -173,13 +204,14 @@ fn run_server(sender: Sender<DevtoolsControlMsg>, walker: RefCell::new(None), pageStyle: RefCell::new(None), highlighter: RefCell::new(None), - script_chan: scriptSender.clone(), + script_chan: script_sender.clone(), pipeline: pipeline, }; let timeline = TimelineActor::new(actors.new_name("timeline"), pipeline, - scriptSender); + script_sender, + devtools_sender); let DevtoolsPageInfo { title, url } = page_info; let tab = TabActor { @@ -244,17 +276,88 @@ fn run_server(sender: Sender<DevtoolsControlMsg>, id: PipelineId, actor_pipelines: &HashMap<PipelineId, String>) -> String { let actors = actors.lock().unwrap(); - let ref tab_actor_name = (*actor_pipelines)[id]; + let ref tab_actor_name = (*actor_pipelines)[&id]; let tab_actor = actors.find::<TabActor>(tab_actor_name); let console_actor_name = tab_actor.console.clone(); return console_actor_name; } + fn handle_network_event(actors: Arc<Mutex<ActorRegistry>>, + mut connections: Vec<TcpStream>, + actor_pipelines: &HashMap<PipelineId, String>, + actor_requests: &mut HashMap<String, String>, + pipeline_id: PipelineId, + request_id: String, + network_event: NetworkEvent) { + + let console_actor_name = find_console_actor(actors.clone(), pipeline_id, actor_pipelines); + let netevent_actor_name = find_network_event_actor(actors.clone(), actor_requests, request_id.clone()); + let mut actors = actors.lock().unwrap(); + let actor = actors.find_mut::<NetworkEventActor>(&netevent_actor_name); + + match network_event { + NetworkEvent::HttpRequest(url, method, headers, body) => { + //Store the request information in the actor + actor.add_request(url, method, headers, body); + + //Send a networkEvent message to the client + let msg = NetworkEventMsg { + from: console_actor_name, + __type__: "networkEvent".to_string(), + eventActor: actor.get_event_actor(), + }; + for stream in connections.iter_mut() { + stream.write_json_packet(&msg); + } + } + NetworkEvent::HttpResponse(headers, status, body) => { + //Store the response information in the actor + actor.add_response(headers, status, body); + + //Send a networkEventUpdate (responseStart) to the client + let msg = NetworkEventUpdateMsg { + from: netevent_actor_name, + __type__: "networkEventUpdate".to_string(), + updateType: "responseStart".to_string(), + response: actor.get_response_start() + }; + + for stream in connections.iter_mut() { + stream.write_json_packet(&msg); + } + } + //TODO: Send the other types of update messages at appropriate times + // requestHeaders, requestCookies, responseHeaders, securityInfo, etc + } + } + + // Find the name of NetworkEventActor corresponding to request_id + // Create a new one if it does not exist, add it to the actor_requests hashmap + fn find_network_event_actor(actors: Arc<Mutex<ActorRegistry>>, + actor_requests: &mut HashMap<String, String>, + request_id: String) -> String { + let mut actors = actors.lock().unwrap(); + match (*actor_requests).entry(request_id) { + Occupied(name) => { + //TODO: Delete from map like Firefox does? + name.into_mut().clone() + } + Vacant(entry) => { + let actor_name = actors.new_name("netevent"); + let actor = NetworkEventActor::new(actor_name.clone()); + entry.insert(actor_name.clone()); + actors.register(box actor); + actor_name + } + } + } + + let sender_clone = sender.clone(); spawn_named("DevtoolsClientAcceptor".to_owned(), move || { // accept connections and process them, spawning a new task for each one for stream in listener.incoming() { // connection succeeded - sender.send(DevtoolsControlMsg::AddClient(stream.unwrap())).unwrap(); + sender_clone.send(DevtoolsControlMsg::AddClient(stream.unwrap())).unwrap(); } }); @@ -267,16 +370,28 @@ fn run_server(sender: Sender<DevtoolsControlMsg>, handle_client(actors, stream.try_clone().unwrap()) }) } - Ok(DevtoolsControlMsg::ServerExitMsg) | Err(RecvError) => break, - Ok(DevtoolsControlMsg::NewGlobal(ids, scriptSender, pageinfo)) => - handle_new_global(actors.clone(), ids, scriptSender, &mut actor_pipelines, + Ok(DevtoolsControlMsg::FramerateTick(actor_name, tick)) => + handle_framerate_tick(actors.clone(), actor_name, tick), + Ok(DevtoolsControlMsg::NewGlobal(ids, script_sender, pageinfo)) => + handle_new_global(actors.clone(), ids, script_sender, sender.clone(), &mut actor_pipelines, &mut actor_workers, pageinfo), Ok(DevtoolsControlMsg::SendConsoleMessage(id, console_message)) => handle_console_message(actors.clone(), id, console_message, &actor_pipelines), + Ok(DevtoolsControlMsg::NetworkEventMessage(request_id, network_event)) => { + // copy the accepted_connections vector + let mut connections = Vec::<TcpStream>::new(); + for stream in accepted_connections.iter() { + connections.push(stream.try_clone().unwrap()); + } + //TODO: Get pipeline_id from NetworkEventMessage after fixing the send in http_loader + // For now, the id of the first pipeline is passed + handle_network_event(actors.clone(), connections, &actor_pipelines, &mut actor_requests, + PipelineId(0), request_id, network_event); + }, + Ok(DevtoolsControlMsg::ServerExitMsg) | Err(RecvError) => break } } - for connection in accepted_connections.iter_mut() { let _ = connection.shutdown(Shutdown::Both); } diff --git a/components/devtools/protocol.rs b/components/devtools/protocol.rs index f8dfea7eac6..daa7c19fba6 100644 --- a/components/devtools/protocol.rs +++ b/components/devtools/protocol.rs @@ -8,13 +8,12 @@ use rustc_serialize::{json, Encodable}; use rustc_serialize::json::Json; -use std::io::{self, Read, ReadExt, Write, ErrorKind}; +use std::io::{self, Read, Write}; use std::net::TcpStream; -use std::num; pub trait JsonPacketStream { fn write_json_packet<'a, T: Encodable>(&mut self, obj: &T); - fn read_json_packet(&mut self) -> io::Result<Json>; + fn read_json_packet(&mut self) -> io::Result<Option<Json>>; } impl JsonPacketStream for TcpStream { @@ -26,25 +25,25 @@ impl JsonPacketStream for TcpStream { self.write_all(s.as_bytes()).unwrap(); } - fn read_json_packet<'a>(&mut self) -> io::Result<Json> { + fn read_json_packet<'a>(&mut self) -> io::Result<Option<Json>> { // https://wiki.mozilla.org/Remote_Debugging_Protocol_Stream_Transport // In short, each JSON packet is [ascii length]:[JSON data of given length] let mut buffer = vec!(); loop { let mut buf = [0]; let byte = match try!(self.read(&mut buf)) { - 0 => return Err(io::Error::new(ErrorKind::Other, "EOF", None)), + 0 => return Ok(None), // EOF 1 => buf[0], _ => unreachable!(), }; match byte { b':' => { let packet_len_str = String::from_utf8(buffer).unwrap(); - let packet_len = num::from_str_radix(&packet_len_str, 10).unwrap(); + let packet_len = u64::from_str_radix(&packet_len_str, 10).unwrap(); let mut packet = String::new(); self.take(packet_len).read_to_string(&mut packet).unwrap(); println!("{}", packet); - return Ok(Json::from_str(&packet).unwrap()) + return Ok(Some(Json::from_str(&packet).unwrap())) }, c => buffer.push(c), } diff --git a/components/devtools_traits/Cargo.toml b/components/devtools_traits/Cargo.toml index 0788d874c3a..05cc4a9f283 100644 --- a/components/devtools_traits/Cargo.toml +++ b/components/devtools_traits/Cargo.toml @@ -14,8 +14,7 @@ path = "../msg" path = "../util" [dependencies] -url = "0.2.16" - -[dependencies] time = "*" rustc-serialize = "0.3" +url = "*" +hyper = "*" diff --git a/components/devtools_traits/lib.rs b/components/devtools_traits/lib.rs index 659c6983e36..54411122271 100644 --- a/components/devtools_traits/lib.rs +++ b/components/devtools_traits/lib.rs @@ -9,13 +9,12 @@ #![crate_name = "devtools_traits"] #![crate_type = "rlib"] -#![feature(net)] - #![allow(non_snake_case)] extern crate msg; -extern crate "rustc-serialize" as rustc_serialize; +extern crate rustc_serialize; extern crate url; +extern crate hyper; extern crate util; extern crate time; @@ -24,6 +23,10 @@ use msg::constellation_msg::{PipelineId, WorkerId}; use util::str::DOMString; use url::Url; +use hyper::header::Headers; +use hyper::http::RawStatus; +use hyper::method::Method; + use std::net::TcpStream; use std::sync::mpsc::{Sender, Receiver}; @@ -41,9 +44,11 @@ pub struct DevtoolsPageInfo { /// according to changes in the browser. pub enum DevtoolsControlMsg { AddClient(TcpStream), + FramerateTick(String, f64), NewGlobal((PipelineId, Option<WorkerId>), Sender<DevtoolScriptControlMsg>, DevtoolsPageInfo), SendConsoleMessage(PipelineId, ConsoleMessage), - ServerExitMsg + ServerExitMsg, + NetworkEventMessage(String, NetworkEvent), } /// Serialized JS return values @@ -117,6 +122,7 @@ pub enum DevtoolScriptControlMsg { WantsLiveNotifications(PipelineId, bool), SetTimelineMarkers(PipelineId, Vec<TimelineMarkerType>, Sender<TimelineMarker>), DropTimelineMarkers(PipelineId, Vec<TimelineMarkerType>), + RequestAnimationFrame(PipelineId, Box<Fn(f64, ) + Send>), } #[derive(RustcEncodable)] @@ -147,6 +153,12 @@ pub enum ConsoleMessage { //WarnMessage(String), } +#[derive(Clone)] +pub enum NetworkEvent { + HttpRequest(Url, Method, Headers, Option<Vec<u8>>), + HttpResponse(Option<Headers>, Option<RawStatus>, Option<Vec<u8>>) +} + impl TimelineMarker { pub fn new(name: String, metadata: TracingMetadata) -> TimelineMarker { TimelineMarker { diff --git a/components/gfx/Cargo.toml b/components/gfx/Cargo.toml index c78bda489d1..a8551de5965 100644 --- a/components/gfx/Cargo.toml +++ b/components/gfx/Cargo.toml @@ -20,8 +20,8 @@ path = "../util" [dependencies.msg] path = "../msg" -[dependencies.profile] -path = "../profile" +[dependencies.profile_traits] +path = "../profile_traits" [dependencies.style] path = "../style" @@ -61,7 +61,6 @@ git = "https://github.com/servo/rust-core-text" [dependencies.skia] git = "https://github.com/servo/skia" -branch = "upstream-2014-06-16" [dependencies.script_traits] path = "../script_traits" diff --git a/components/gfx/buffer_map.rs b/components/gfx/buffer_map.rs index 69b798b4e19..cba6fa82b59 100644 --- a/components/gfx/buffer_map.rs +++ b/components/gfx/buffer_map.rs @@ -109,7 +109,7 @@ impl BufferMap { } }; if { - let list = &mut self.map[old_key].buffers; + let list = &mut self.map.get_mut(&old_key).unwrap().buffers; let condemned_buffer = list.pop().take().unwrap(); self.mem -= condemned_buffer.get_mem(); condemned_buffer.destroy(graphics_context); diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs index 75f6cde1e54..224da2ca68d 100644 --- a/components/gfx/display_list/mod.rs +++ b/components/gfx/display_list/mod.rs @@ -40,7 +40,7 @@ use util::linked_list::prepend_from; use util::geometry::{self, Au, MAX_RECT, ZERO_RECT}; use util::mem::HeapSizeOf; use util::range::Range; -use util::smallvec::{SmallVec, SmallVec8}; +use util::smallvec::SmallVec8; use std::fmt; use std::slice::Iter; use std::sync::Arc; @@ -64,7 +64,7 @@ pub static BLUR_INFLATION_FACTOR: i32 = 3; /// Because the script task's GC does not trace layout, node data cannot be safely stored in layout /// data structures. Also, layout code tends to be faster when the DOM is not being accessed, for /// locality reasons. Using `OpaqueNode` enforces this invariant. -#[derive(Clone, PartialEq, Copy)] +#[derive(Clone, PartialEq, Copy, Debug)] pub struct OpaqueNode(pub uintptr_t); impl OpaqueNode { @@ -305,8 +305,7 @@ impl StackingContext { for kid in display_list.children.iter() { positioned_children.push((*kid).clone()); } - positioned_children.as_slice_mut() - .sort_by(|this, other| this.z_index.cmp(&other.z_index)); + positioned_children.sort_by(|this, other| this.z_index.cmp(&other.z_index)); // Set up our clip rect and transform. let old_transform = paint_subcontext.draw_target.get_transform(); @@ -421,7 +420,7 @@ impl StackingContext { // Translate the child's overflow region into our coordinate system. let child_stacking_context_overflow = child_stacking_context.overflow.translate(&child_stacking_context.bounds.origin) - .to_azure_rect(); + .to_nearest_azure_rect(); // Intersect that with the current tile boundaries to find the tile boundaries that the // child covers. @@ -429,7 +428,7 @@ impl StackingContext { .unwrap_or(ZERO_AZURE_RECT); // Translate the resulting rect into the child's coordinate system. - tile_subrect.translate(&-child_stacking_context.bounds.to_azure_rect().origin) + tile_subrect.translate(&-child_stacking_context.bounds.to_nearest_azure_rect().origin) } /// Places all nodes containing the point of interest into `result`, topmost first. Respects @@ -490,9 +489,9 @@ impl StackingContext { point = point - self.bounds.origin; debug_assert!(!topmost_only || result.is_empty()); - let frac_point = self.transform.transform_point(&Point2D(point.x.to_frac32_px(), - point.y.to_frac32_px())); - point = Point2D(Au::from_frac32_px(frac_point.x), Au::from_frac32_px(frac_point.y)); + let frac_point = self.transform.transform_point(&Point2D(point.x.to_f32_px(), + point.y.to_f32_px())); + point = Point2D(Au::from_f32_px(frac_point.x), Au::from_f32_px(frac_point.y)); // Iterate through display items in reverse stacking order. Steps here refer to the // painting steps in CSS 2.1 Appendix E. diff --git a/components/gfx/filters.rs b/components/gfx/filters.rs index cfabcf20324..38db24ec318 100644 --- a/components/gfx/filters.rs +++ b/components/gfx/filters.rs @@ -10,7 +10,6 @@ use azure::azure_hl::{FilterNode, FilterType, LinearTransferAttribute, LinearTra use azure::azure_hl::{Matrix5x4, TableTransferAttribute, TableTransferInput}; use azure::azure_hl::{GaussianBlurAttribute, GaussianBlurInput}; -use std::num::Float; use style::computed_values::filter; use util::geometry::Au; @@ -96,7 +95,7 @@ pub fn create_filters(draw_target: &DrawTarget, } filter::Filter::Blur(amount) => { *accumulated_blur_radius = accumulated_blur_radius.clone() + amount; - let amount = amount.to_frac32_px(); + let amount = amount.to_f32_px(); let blur = draw_target.create_filter(FilterType::GaussianBlur); blur.set_attribute(GaussianBlurAttribute::StdDeviation(amount)); blur.set_input(GaussianBlurInput, &filter); diff --git a/components/gfx/font.rs b/components/gfx/font.rs index a44b08bce1e..52c3f95c53a 100644 --- a/components/gfx/font.rs +++ b/components/gfx/font.rs @@ -9,7 +9,7 @@ use std::slice; use std::rc::Rc; use std::cell::RefCell; use util::cache::HashCache; -use util::smallvec::{SmallVec, SmallVec8}; +use util::smallvec::SmallVec8; use style::computed_values::{font_stretch, font_variant, font_weight}; use style::properties::style_structs::Font as FontStyle; use std::sync::Arc; @@ -185,7 +185,7 @@ impl Font { pub fn glyph_index(&self, codepoint: char) -> Option<GlyphId> { let codepoint = match self.variant { - font_variant::T::small_caps => codepoint.to_uppercase(), + font_variant::T::small_caps => codepoint.to_uppercase().next().unwrap(), //FIXME: #5938 font_variant::T::normal => codepoint, }; self.handle.glyph_index(codepoint) @@ -222,7 +222,8 @@ impl FontGroup { assert!(self.fonts.len() > 0); // TODO(Issue #177): Actually fall back through the FontGroup when a font is unsuitable. - TextRun::new(&mut *self.fonts.get(0).borrow_mut(), text.clone(), options) + let mut font_borrow = self.fonts[0].borrow_mut(); + TextRun::new(&mut *font_borrow, text.clone(), options) } } diff --git a/components/gfx/font_cache_task.rs b/components/gfx/font_cache_task.rs index 24e36ba3163..5732e6a79cf 100644 --- a/components/gfx/font_cache_task.rs +++ b/components/gfx/font_cache_task.rs @@ -139,7 +139,7 @@ impl FontCache { let maybe_resource = load_whole_resource(&self.resource_task, url.clone()); match maybe_resource { Ok((_, bytes)) => { - let family = &mut self.web_families[family_name]; + let family = &mut self.web_families.get_mut(&family_name).unwrap(); family.add_template(&url.to_string(), Some(bytes)); }, Err(_) => { @@ -148,7 +148,7 @@ impl FontCache { } } Source::Local(ref local_family_name) => { - let family = &mut self.web_families[family_name]; + let family = &mut self.web_families.get_mut(&family_name).unwrap(); get_variations_for_family(&local_family_name, |path| { family.add_template(&path, None); }); @@ -188,10 +188,10 @@ impl FontCache { // look up canonical name if self.local_families.contains_key(family_name) { debug!("FontList: Found font family with name={}", &**family_name); - let s = &mut self.local_families[*family_name]; + let s = self.local_families.get_mut(family_name).unwrap(); if s.templates.len() == 0 { - get_variations_for_family(&family_name, |path| { + get_variations_for_family(family_name, |path| { s.add_template(&path, None); }); } @@ -213,7 +213,7 @@ impl FontCache { fn find_font_in_web_family<'a>(&'a mut self, family_name: &LowercaseString, desc: &FontTemplateDescriptor) -> Option<Arc<FontTemplateData>> { if self.web_families.contains_key(family_name) { - let family = &mut self.web_families[*family_name]; + let family = self.web_families.get_mut(family_name).unwrap(); let maybe_font = family.find_font_for_style(desc, &self.font_context); maybe_font } else { diff --git a/components/gfx/font_context.rs b/components/gfx/font_context.rs index 534c844cb87..cd6f1fa69f5 100644 --- a/components/gfx/font_context.rs +++ b/components/gfx/font_context.rs @@ -15,7 +15,7 @@ use platform::font_template::FontTemplateData; use util::cache::HashCache; use util::fnv::FnvHasher; use util::geometry::Au; -use util::smallvec::{SmallVec, SmallVec8}; +use util::smallvec::SmallVec8; use std::borrow::{self, ToOwned}; use std::cell::RefCell; @@ -26,7 +26,6 @@ use std::hash::{Hash, Hasher}; use std::rc::Rc; use std::sync::Arc; -use azure::AzFloat; use azure::azure_hl::BackendType; use azure::scaled_font::ScaledFont; @@ -36,16 +35,16 @@ use azure::scaled_font::FontInfo; #[cfg(any(target_os="linux", target_os = "android"))] fn create_scaled_font(template: &Arc<FontTemplateData>, pt_size: Au) -> ScaledFont { ScaledFont::new(BackendType::Skia, FontInfo::FontData(&template.bytes), - pt_size.to_subpx() as AzFloat) + pt_size.to_f32_px()) } #[cfg(target_os="macos")] fn create_scaled_font(template: &Arc<FontTemplateData>, pt_size: Au) -> ScaledFont { let cgfont = template.ctfont.as_ref().unwrap().copy_to_CGFont(); - ScaledFont::new(BackendType::Skia, &cgfont, pt_size.to_subpx() as AzFloat) + ScaledFont::new(BackendType::Skia, &cgfont, pt_size.to_f32_px()) } -static SMALL_CAPS_SCALE_FACTOR: f64 = 0.8; // Matches FireFox (see gfxFont.h) +static SMALL_CAPS_SCALE_FACTOR: f32 = 0.8; // Matches FireFox (see gfxFont.h) struct LayoutFontCacheEntry { family: String, @@ -160,7 +159,7 @@ impl FontContext { let mut fonts = SmallVec8::new(); - for family in style.font_family.iter() { + for family in style.font_family.0.iter() { // GWTODO: Check on real pages if this is faster as Vec() or HashMap(). let mut cache_hit = false; for cached_font_entry in self.layout_font_cache.iter() { diff --git a/components/gfx/lib.rs b/components/gfx/lib.rs index 3e59c8305a6..52d5a705de8 100644 --- a/components/gfx/lib.rs +++ b/components/gfx/lib.rs @@ -6,12 +6,10 @@ #![feature(box_syntax)] #![feature(collections)] #![feature(core)] -#![cfg_attr(any(target_os="linux", target_os = "android"), feature(io))] #![feature(plugin)] #![feature(rustc_private)] #![feature(std_misc)] -#![feature(unicode)] -#![feature(unsafe_destructor)] +#![feature(str_char)] #![plugin(plugins)] @@ -26,10 +24,9 @@ extern crate layers; extern crate libc; extern crate stb_image; extern crate png; -extern crate profile; +extern crate profile_traits; extern crate script_traits; -extern crate "rustc-serialize" as rustc_serialize; -extern crate unicode; +extern crate rustc_serialize; extern crate net_traits; #[macro_use] extern crate util; diff --git a/components/gfx/paint_context.rs b/components/gfx/paint_context.rs index 1999cc5cf66..24e7f1f7958 100644 --- a/components/gfx/paint_context.rs +++ b/components/gfx/paint_context.rs @@ -34,7 +34,6 @@ use png::PixelsByColorType; use std::default::Default; use std::f32; use std::mem; -use std::num::Float; use std::ptr; use std::sync::Arc; use style::computed_values::{border_style, filter, image_rendering, mix_blend_mode}; @@ -78,7 +77,7 @@ impl<'a> PaintContext<'a> { pub fn draw_solid_color(&self, bounds: &Rect<Au>, color: Color) { self.draw_target.make_current(); - self.draw_target.fill_rect(&bounds.to_azure_rect(), + self.draw_target.fill_rect(&bounds.to_nearest_azure_rect(), PatternRef::Color(&ColorPattern::new(color)), None); } @@ -105,7 +104,7 @@ impl<'a> PaintContext<'a> { } pub fn draw_push_clip(&self, bounds: &Rect<Au>) { - let rect = bounds.to_azure_rect(); + let rect = bounds.to_nearest_azure_rect(); let path_builder = self.draw_target.create_path_builder(); let left_top = Point2D(rect.origin.x, rect.origin.y); @@ -148,7 +147,7 @@ impl<'a> PaintContext<'a> { source_format); let source_rect = Rect(Point2D(0.0, 0.0), Size2D(image.width as AzFloat, image.height as AzFloat)); - let dest_rect = bounds.to_azure_rect(); + let dest_rect = bounds.to_nearest_azure_rect(); // TODO(pcwalton): According to CSS-IMAGES-3 § 5.3, nearest-neighbor interpolation is a // conforming implementation of `crisp-edges`, but it is not the best we could do. @@ -617,7 +616,7 @@ impl<'a> PaintContext<'a> { border: &SideOffsets2D<f32>, color: Color, dash_size: DashSize) { - let rect = bounds.to_azure_rect(); + let rect = bounds.to_nearest_azure_rect(); let draw_opts = DrawOptions::new(1 as AzFloat, 0 as uint16_t); let border_width = match direction { Direction::Top => border.top, @@ -672,7 +671,7 @@ impl<'a> PaintContext<'a> { border: &SideOffsets2D<f32>, radius: &BorderRadii<AzFloat>, color: Color) { - let rect = bounds.to_azure_rect(); + let rect = bounds.to_nearest_azure_rect(); self.draw_border_path(&rect, direction, border, radius, color); } @@ -680,7 +679,7 @@ impl<'a> PaintContext<'a> { bounds: &Rect<Au>, border: &SideOffsets2D<f32>, shrink_factor: f32) -> Rect<f32> { - let rect = bounds.to_azure_rect(); + let rect = bounds.to_nearest_azure_rect(); let scaled_border = SideOffsets2D::new(shrink_factor * border.top, shrink_factor * border.right, shrink_factor * border.bottom, @@ -827,16 +826,16 @@ impl<'a> PaintContext<'a> { let baseline_origin = match text.orientation { Upright => text.baseline_origin, SidewaysLeft => { - let x = text.baseline_origin.x.to_subpx() as AzFloat; - let y = text.baseline_origin.y.to_subpx() as AzFloat; + let x = text.baseline_origin.x.to_f32_px(); + let y = text.baseline_origin.y.to_f32_px(); self.draw_target.set_transform(&draw_target_transform.mul(&Matrix2D::new(0., -1., 1., 0., x, y))); Point2D::zero() } SidewaysRight => { - let x = text.baseline_origin.x.to_subpx() as AzFloat; - let y = text.baseline_origin.y.to_subpx() as AzFloat; + let x = text.baseline_origin.x.to_f32_px(); + let y = text.baseline_origin.y.to_f32_px(); self.draw_target.set_transform(&draw_target_transform.mul(&Matrix2D::new(0., 1., -1., 0., x, y))); @@ -880,11 +879,11 @@ impl<'a> PaintContext<'a> { self.draw_target.make_current(); let stops = self.draw_target.create_gradient_stops(stops, ExtendMode::Clamp); - let pattern = LinearGradientPattern::new(&start_point.to_azure_point(), - &end_point.to_azure_point(), + let pattern = LinearGradientPattern::new(&start_point.to_nearest_azure_point(), + &end_point.to_nearest_azure_point(), stops, &Matrix2D::identity()); - self.draw_target.fill_rect(&bounds.to_azure_rect(), + self.draw_target.fill_rect(&bounds.to_nearest_azure_rect(), PatternRef::LinearGradient(&pattern), None); } @@ -1061,7 +1060,7 @@ impl<'a> PaintContext<'a> { } let blur_filter = self.draw_target.create_filter(FilterType::GaussianBlur); - blur_filter.set_attribute(GaussianBlurAttribute::StdDeviation(blur_radius.to_subpx() as + blur_filter.set_attribute(GaussianBlurAttribute::StdDeviation(blur_radius.to_f64_px() as AzFloat)); blur_filter.set_input(GaussianBlurInput, &temporary_draw_target.draw_target.snapshot()); temporary_draw_target.draw_filter(&self.draw_target, blur_filter); @@ -1096,7 +1095,7 @@ impl<'a> PaintContext<'a> { self.draw_push_clip(&clip_region.main); for complex_region in clip_region.complex.iter() { // FIXME(pcwalton): Actually draw a rounded rect. - self.push_rounded_rect_clip(&complex_region.rect.to_azure_rect(), + self.push_rounded_rect_clip(&complex_region.rect.to_nearest_azure_rect(), &complex_region.radii.to_radii_px()) } self.transient_clip = Some(clip_region) @@ -1104,33 +1103,33 @@ impl<'a> PaintContext<'a> { } pub trait ToAzurePoint { + fn to_nearest_azure_point(&self) -> Point2D<AzFloat>; fn to_azure_point(&self) -> Point2D<AzFloat>; - fn to_subpx_azure_point(&self) -> Point2D<AzFloat>; } impl ToAzurePoint for Point2D<Au> { - fn to_azure_point(&self) -> Point2D<AzFloat> { + fn to_nearest_azure_point(&self) -> Point2D<AzFloat> { Point2D(self.x.to_nearest_px() as AzFloat, self.y.to_nearest_px() as AzFloat) } - fn to_subpx_azure_point(&self) -> Point2D<AzFloat> { - Point2D(self.x.to_subpx() as AzFloat, self.y.to_subpx() as AzFloat) + fn to_azure_point(&self) -> Point2D<AzFloat> { + Point2D(self.x.to_f32_px(), self.y.to_f32_px()) } } pub trait ToAzureRect { + fn to_nearest_azure_rect(&self) -> Rect<AzFloat>; fn to_azure_rect(&self) -> Rect<AzFloat>; - fn to_subpx_azure_rect(&self) -> Rect<AzFloat>; } impl ToAzureRect for Rect<Au> { - fn to_azure_rect(&self) -> Rect<AzFloat> { - Rect(self.origin.to_azure_point(), Size2D(self.size.width.to_nearest_px() as AzFloat, + fn to_nearest_azure_rect(&self) -> Rect<AzFloat> { + Rect(self.origin.to_nearest_azure_point(), Size2D(self.size.width.to_nearest_px() as AzFloat, self.size.height.to_nearest_px() as AzFloat)) } - fn to_subpx_azure_rect(&self) -> Rect<AzFloat> { - Rect(self.origin.to_subpx_azure_point(), Size2D(self.size.width.to_subpx() as AzFloat, - self.size.height.to_subpx() as AzFloat)) + fn to_azure_rect(&self) -> Rect<AzFloat> { + Rect(self.origin.to_azure_point(), Size2D(self.size.width.to_f32_px(), + self.size.height.to_f32_px())) } } @@ -1242,8 +1241,8 @@ impl ScaledFontExtensionMethods for ScaledFont { let azglyph = struct__AzGlyph { mIndex: glyph.id() as uint32_t, mPosition: struct__AzPoint { - x: (origin.x + glyph_offset.x).to_subpx() as AzFloat, - y: (origin.y + glyph_offset.y).to_subpx() as AzFloat + x: (origin.x + glyph_offset.x).to_f32_px(), + y: (origin.y + glyph_offset.y).to_f32_px(), } }; origin = Point2D(origin.x + glyph_advance, origin.y); @@ -1307,7 +1306,7 @@ impl DrawTargetExtensions for DrawTarget { // +-----------+ // 3 4 - let (outer_rect, inner_rect) = (outer_rect.to_azure_rect(), inner_rect.to_azure_rect()); + let (outer_rect, inner_rect) = (outer_rect.to_nearest_azure_rect(), inner_rect.to_nearest_azure_rect()); let path_builder = self.create_path_builder(); path_builder.move_to(Point2D(outer_rect.max_x(), outer_rect.origin.y)); // 1 path_builder.line_to(Point2D(outer_rect.origin.x, outer_rect.origin.y)); // 2 @@ -1324,10 +1323,10 @@ impl DrawTargetExtensions for DrawTarget { fn create_rectangular_path(&self, rect: &Rect<Au>) -> Path { let path_builder = self.create_path_builder(); - path_builder.move_to(rect.origin.to_azure_point()); - path_builder.line_to(Point2D(rect.max_x(), rect.origin.y).to_azure_point()); - path_builder.line_to(Point2D(rect.max_x(), rect.max_y()).to_azure_point()); - path_builder.line_to(Point2D(rect.origin.x, rect.max_y()).to_azure_point()); + path_builder.move_to(rect.origin.to_nearest_azure_point()); + path_builder.line_to(Point2D(rect.max_x(), rect.origin.y).to_nearest_azure_point()); + path_builder.line_to(Point2D(rect.max_x(), rect.max_y()).to_nearest_azure_point()); + path_builder.line_to(Point2D(rect.origin.x, rect.max_y()).to_nearest_azure_point()); path_builder.finish() } } @@ -1386,7 +1385,7 @@ impl TemporaryDrawTarget { fn from_bounds(main_draw_target: &DrawTarget, bounds: &Rect<Au>) -> TemporaryDrawTarget { let draw_target_transform = main_draw_target.get_transform(); let temporary_draw_target_bounds = - draw_target_transform.transform_rect(&bounds.to_subpx_azure_rect()); + draw_target_transform.transform_rect(&bounds.to_azure_rect()); let temporary_draw_target_size = Size2D(temporary_draw_target_bounds.size.width.ceil() as i32, temporary_draw_target_bounds.size.height.ceil() as i32); diff --git a/components/gfx/paint_task.rs b/components/gfx/paint_task.rs index a97487db92d..1ad7bf54006 100644 --- a/components/gfx/paint_task.rs +++ b/components/gfx/paint_task.rs @@ -25,7 +25,7 @@ use msg::compositor_msg::{LayerMetadata, PaintListener, ScrollPolicy}; use msg::constellation_msg::Msg as ConstellationMsg; use msg::constellation_msg::{ConstellationChan, Failure, PipelineId}; use msg::constellation_msg::PipelineExitType; -use profile::time::{self, profile}; +use profile_traits::time::{self, profile}; use skia::SkiaGrGLNativeContextRef; use std::borrow::ToOwned; use std::mem; @@ -33,7 +33,6 @@ use std::sync::Arc; use std::sync::mpsc::{Receiver, Sender, channel}; use util::geometry::{Au, ZERO_POINT}; use util::opts; -use util::smallvec::SmallVec; use util::task::spawn_named_with_send_on_failure; use util::task_state; use util::task::spawn_named; @@ -547,8 +546,8 @@ impl WorkerThread { // Apply a translation to start at the boundaries of the stacking context, since the // layer's origin starts at its overflow rect's origin. let tile_bounds = tile.page_rect.translate( - &Point2D(stacking_context.overflow.origin.x.to_subpx() as AzFloat, - stacking_context.overflow.origin.y.to_subpx() as AzFloat)); + &Point2D(stacking_context.overflow.origin.x.to_f32_px(), + stacking_context.overflow.origin.y.to_f32_px())); // Apply the translation to paint the tile we want. let matrix: Matrix2D<AzFloat> = Matrix2D::identity(); @@ -576,8 +575,8 @@ impl WorkerThread { // painted this tile. let color = THREAD_TINT_COLORS[thread_id % THREAD_TINT_COLORS.len()]; paint_context.draw_solid_color(&Rect(Point2D(Au(0), Au(0)), - Size2D(Au::from_px(size.width as isize), - Au::from_px(size.height as isize))), + Size2D(Au::from_px(size.width), + Au::from_px(size.height))), color); } } diff --git a/components/gfx/platform/freetype/font.rs b/components/gfx/platform/freetype/font.rs index 60587acb297..f65104aa649 100644 --- a/components/gfx/platform/freetype/font.rs +++ b/components/gfx/platform/freetype/font.rs @@ -7,7 +7,6 @@ extern crate freetype; use font::{FontHandleMethods, FontMetrics, FontTableMethods}; use font::{FontTableTag, FractionalPixel}; use util::geometry::Au; -use util::geometry; use util::str::c_str_to_string; use platform::font_context::FontContextHandle; use text::glyph::GlyphId; @@ -28,7 +27,6 @@ use freetype::tt_os2::TT_OS2; use libc::c_char; use std::mem; -use std::num::Float; use std::ptr; use std::sync::Arc; @@ -56,7 +54,6 @@ pub struct FontHandle { pub handle: FontContextHandle } -#[unsafe_destructor] impl Drop for FontHandle { fn drop(&mut self) { assert!(!self.face.is_null()); @@ -227,9 +224,9 @@ impl FontHandleMethods for FontHandle { let height = self.font_units_to_au(face.height as f64); let leading = height - (ascent + descent); - let mut strikeout_size = geometry::from_pt(0.0); - let mut strikeout_offset = geometry::from_pt(0.0); - let mut x_height = geometry::from_pt(0.0); + let mut strikeout_size = Au(0); + let mut strikeout_offset = Au(0); + let mut x_height = Au(0); unsafe { let os2 = FT_Get_Sfnt_Table(face, ft_sfnt_os2) as *mut TT_OS2; let valid = !os2.is_null() && (*os2).version != 0xffff; @@ -260,7 +257,7 @@ impl FontHandleMethods for FontHandle { line_gap: height, }; - debug!("Font metrics (@{} pt): {:?}", geometry::to_pt(em_size), metrics); + debug!("Font metrics (@{}px): {:?}", em_size.to_f32_px(), metrics); return metrics; } @@ -271,7 +268,7 @@ impl FontHandleMethods for FontHandle { impl<'a> FontHandle { fn set_char_size(face: FT_Face, pt_size: Au) -> Result<(), ()>{ - let char_width = float_to_fixed_ft((0.5f64 + pt_size.to_subpx()).floor()) as FT_F26Dot6; + let char_width = float_to_fixed_ft((0.5f64 + pt_size.to_f64_px()).floor()) as FT_F26Dot6; unsafe { let result = FT_Set_Char_Size(face, char_width, 0, 0, 0); @@ -299,6 +296,6 @@ impl<'a> FontHandle { // If this isn't true then we're scaling one of the axes wrong assert!(metrics.x_ppem == metrics.y_ppem); - return geometry::from_frac_px(value * x_scale); + return Au::from_f64_px(value * x_scale); } } diff --git a/components/gfx/platform/macos/font.rs b/components/gfx/platform/macos/font.rs index d38a3410260..f45177521c8 100644 --- a/components/gfx/platform/macos/font.rs +++ b/components/gfx/platform/macos/font.rs @@ -12,7 +12,6 @@ use font::{FontHandleMethods, FontMetrics, FontTableMethods}; use font::FontTableTag; use font::FractionalPixel; use util::geometry::{Au, px_to_pt}; -use util::geometry; use platform::macos::font_context::FontContextHandle; use text::glyph::GlyphId; use style::computed_values::{font_stretch, font_weight}; @@ -27,7 +26,6 @@ use core_text::font::CTFont; use core_text::font_descriptor::{SymbolicTraitAccessors, TraitAccessors}; use core_text::font_descriptor::{kCTFontDefaultOrientation}; -use std::num::Float; use std::ptr; use std::sync::Arc; @@ -63,7 +61,7 @@ impl FontHandleMethods for FontHandle { pt_size: Option<Au>) -> Result<FontHandle, ()> { let size = match pt_size { - Some(s) => s.to_subpx(), + Some(s) => s.to_f64_px(), None => 0.0 }; match template.ctfont { @@ -163,7 +161,7 @@ impl FontHandleMethods for FontHandle { let bounding_rect: CGRect = self.ctfont.bounding_box(); let ascent = self.ctfont.ascent() as f64; let descent = self.ctfont.descent() as f64; - let em_size = Au::from_frac_px(self.ctfont.pt_size() as f64); + let em_size = Au::from_f64_px(self.ctfont.pt_size() as f64); let leading = self.ctfont.leading() as f64; let scale = px_to_pt(self.ctfont.pt_size() as f64) / (ascent + descent); @@ -172,7 +170,7 @@ impl FontHandleMethods for FontHandle { let max_advance_width = Au::from_pt(bounding_rect.size.width as f64); let average_advance = self.glyph_index('0') .and_then(|idx| self.glyph_h_advance(idx)) - .map(|advance| Au::from_frac_px(advance)) + .map(|advance| Au::from_f64_px(advance)) .unwrap_or(max_advance_width); let metrics = FontMetrics { @@ -183,8 +181,8 @@ impl FontHandleMethods for FontHandle { // see also: https://bugs.webkit.org/show_bug.cgi?id=16768 // see also: https://bugreports.qt-project.org/browse/QTBUG-13364 underline_offset: Au::from_pt(self.ctfont.underline_position() as f64), - strikeout_size: geometry::from_pt(0.0), // FIXME(Issue #942) - strikeout_offset: geometry::from_pt(0.0), // FIXME(Issue #942) + strikeout_size: Au(0), // FIXME(Issue #942) + strikeout_offset: Au(0), // FIXME(Issue #942) leading: Au::from_pt(leading), x_height: Au::from_pt(self.ctfont.x_height() as f64), em_size: em_size, @@ -192,7 +190,7 @@ impl FontHandleMethods for FontHandle { descent: Au::from_pt(descent * scale), max_advance: max_advance_width, average_advance: average_advance, - line_gap: Au::from_frac_px(line_gap), + line_gap: Au::from_f64_px(line_gap), }; debug!("Font metrics (@{} pt): {:?}", self.ctfont.pt_size() as f64, metrics); return metrics; diff --git a/components/gfx/platform/macos/font_template.rs b/components/gfx/platform/macos/font_template.rs index a4cda3b5a66..5bb3e1f6bfe 100644 --- a/components/gfx/platform/macos/font_template.rs +++ b/components/gfx/platform/macos/font_template.rs @@ -34,7 +34,7 @@ impl FontTemplateData { } }, None => { - Some(core_text::font::new_from_name(&identifier, 0.0).unwrap()) + Some(core_text::font::new_from_name(identifier, 0.0).unwrap()) } }; diff --git a/components/gfx/text/glyph.rs b/components/gfx/text/glyph.rs index d69236b0ef5..0edddf87459 100644 --- a/components/gfx/text/glyph.rs +++ b/components/gfx/text/glyph.rs @@ -6,8 +6,6 @@ use geom::point::Point2D; use std::cmp::{Ordering, PartialOrd}; use std::iter::repeat; use std::mem; -use std::num::{ToPrimitive, NumCast}; -use std::ops::{Add, Sub, Mul, Neg, Div, Rem, BitAnd, BitOr, BitXor, Shl, Shr, Not}; use std::u16; use std::vec::Vec; use util::geometry::Au; @@ -156,10 +154,9 @@ fn is_simple_glyph_id(id: GlyphId) -> bool { } fn is_simple_advance(advance: Au) -> bool { - match advance.to_u32() { - Some(unsigned_au) => - (unsigned_au & (GLYPH_ADVANCE_MASK >> GLYPH_ADVANCE_SHIFT)) == unsigned_au, - None => false + advance >= Au(0) && { + let unsigned_au = advance.0 as u32; + (unsigned_au & (GLYPH_ADVANCE_MASK >> GLYPH_ADVANCE_SHIFT)) == unsigned_au } } @@ -171,7 +168,7 @@ impl GlyphEntry { // getter methods #[inline(always)] fn advance(&self) -> Au { - NumCast::from((self.value & GLYPH_ADVANCE_MASK) >> GLYPH_ADVANCE_SHIFT).unwrap() + Au(((self.value & GLYPH_ADVANCE_MASK) >> GLYPH_ADVANCE_SHIFT) as i32) } fn id(&self) -> GlyphId { @@ -731,7 +728,7 @@ impl<'a> GlyphStore { // FIXME(pcwalton): This can overflow for very large font-sizes. let advance = ((entry.value & GLYPH_ADVANCE_MASK) >> GLYPH_ADVANCE_SHIFT) + - Au::from_frac_px(space).to_u32().unwrap(); + Au::from_f64_px(space).0 as u32; entry.value = (entry.value & !GLYPH_ADVANCE_MASK) | (advance << GLYPH_ADVANCE_SHIFT); } diff --git a/components/gfx/text/shaping/harfbuzz.rs b/components/gfx/text/shaping/harfbuzz.rs index 4f473b96174..6ff6987e752 100644 --- a/components/gfx/text/shaping/harfbuzz.rs +++ b/components/gfx/text/shaping/harfbuzz.rs @@ -117,10 +117,10 @@ impl ShapedGlyphData { let x_advance = Shaper::fixed_to_float((*pos_info_i).x_advance); let y_advance = Shaper::fixed_to_float((*pos_info_i).y_advance); - let x_offset = Au::from_frac_px(x_offset); - let y_offset = Au::from_frac_px(y_offset); - let x_advance = Au::from_frac_px(x_advance); - let y_advance = Au::from_frac_px(y_advance); + let x_offset = Au::from_f64_px(x_offset); + let y_offset = Au::from_f64_px(y_offset); + let x_advance = Au::from_f64_px(x_advance); + let y_advance = Au::from_f64_px(y_advance); let offset = if x_offset == Au(0) && y_offset == Au(0) && y_advance == Au(0) { None @@ -154,7 +154,6 @@ pub struct Shaper { font_and_shaping_options: Box<FontAndShapingOptions>, } -#[unsafe_destructor] impl Drop for Shaper { fn drop(&mut self) { unsafe { @@ -186,7 +185,7 @@ impl Shaper { let hb_font: *mut hb_font_t = RUST_hb_font_create(hb_face); // Set points-per-em. if zero, performs no hinting in that direction. - let pt_size = font.actual_pt_size.to_subpx(); + let pt_size = font.actual_pt_size.to_f64_px(); RUST_hb_font_set_ppem(hb_font, pt_size as c_uint, pt_size as c_uint); // Set scaling. Note that this takes 16.16 fixed point. @@ -519,7 +518,7 @@ impl Shaper { advance = advance + options.word_spacing } else if character == '\t' { let tab_size = 8f64; - advance = Au::from_frac_px(tab_size * glyph_space_advance(self.font_and_shaping_options.font)); + advance = Au::from_f64_px(tab_size * glyph_space_advance(self.font_and_shaping_options.font)); } advance diff --git a/components/gfx/text/text_run.rs b/components/gfx/text/text_run.rs index 4e963bf1b28..20c1f8fb4da 100644 --- a/components/gfx/text/text_run.rs +++ b/components/gfx/text/text_run.rs @@ -8,7 +8,7 @@ use platform::font_template::FontTemplateData; use util::geometry::Au; use util::range::Range; use util::vec::{Comparator, FullBinarySearchMethods}; -use std::cmp::Ordering; +use std::cmp::{Ordering, max}; use std::slice::Iter; use std::sync::Arc; use text::glyph::{CharIndex, GlyphStore}; @@ -322,7 +322,7 @@ impl<'a> TextRun { debug!("iterating outer range {:?}", range); self.natural_word_slices_in_range(range).fold(Au(0), |max_piece_width, slice| { debug!("iterated on {:?}[{:?}]", slice.offset, slice.range); - Au::max(max_piece_width, self.advance_for_range(&slice.range)) + max(max_piece_width, self.advance_for_range(&slice.range)) }) } diff --git a/components/layout/Cargo.toml b/components/layout/Cargo.toml index 62a0e16ee65..fa527f4d5c9 100644 --- a/components/layout/Cargo.toml +++ b/components/layout/Cargo.toml @@ -37,15 +37,12 @@ path = "../plugins" [dependencies.net_traits] path = "../net_traits" -[dependencies.profile] -path = "../profile" +[dependencies.profile_traits] +path = "../profile_traits" [dependencies.util] path = "../util" -[dependencies.cssparser] -git = "https://github.com/servo/rust-cssparser" - [dependencies.selectors] git = "https://github.com/servo/rust-selectors" @@ -70,4 +67,4 @@ url = "0.2.16" bitflags = "*" rustc-serialize = "0.3" libc = "*" - +cssparser = "0.3.1" diff --git a/components/layout/animation.rs b/components/layout/animation.rs index 9cd46d4bcde..a2a3e1c5459 100644 --- a/components/layout/animation.rs +++ b/components/layout/animation.rs @@ -10,8 +10,9 @@ use incremental::{self, RestyleDamage}; use clock_ticks; use gfx::display_list::OpaqueNode; use layout_task::{LayoutTask, LayoutTaskData}; -use msg::constellation_msg::{Msg, PipelineId}; +use msg::constellation_msg::{AnimationState, Msg, PipelineId}; use script::layout_interface::Animation; +use script_traits::{ConstellationControlMsg, ScriptControlChan}; use std::mem; use std::sync::mpsc::Sender; use style::animation::{GetMod, PropertyAnimation}; @@ -31,7 +32,7 @@ pub fn start_transitions_if_applicable(new_animations_sender: &Sender<Animation> property_animation.update(new_style, 0.0); // Kick off the animation. - let now = clock_ticks::precise_time_s(); + let now = clock_ticks::precise_time_s() as f32; let animation_style = new_style.get_animation(); let start_time = now + animation_style.transition_delay.0.get_mod(i).seconds(); new_animations_sender.send(Animation { @@ -51,11 +52,18 @@ pub fn process_new_animations(rw_data: &mut LayoutTaskData, pipeline_id: Pipelin rw_data.running_animations.push(animation) } - let animations_are_running = !rw_data.running_animations.is_empty(); + let animation_state; + if rw_data.running_animations.is_empty() { + animation_state = AnimationState::NoAnimationsPresent; + } else { + animation_state = AnimationState::AnimationsPresent; + } + rw_data.constellation_chan .0 - .send(Msg::ChangeRunningAnimationsState(pipeline_id, animations_are_running)) + .send(Msg::ChangeRunningAnimationsState(pipeline_id, animation_state)) .unwrap(); + } /// Recalculates style for an animation. This does *not* run with the DOM lock held. @@ -66,7 +74,7 @@ pub fn recalc_style_for_animation(flow: &mut Flow, animation: &Animation) { return } - let now = clock_ticks::precise_time_s(); + let now = clock_ticks::precise_time_s() as f32; let mut progress = (now - animation.start_time) / animation.duration(); if progress > 1.0 { progress = 1.0 @@ -91,7 +99,7 @@ pub fn recalc_style_for_animation(flow: &mut Flow, animation: &Animation) { /// Handles animation updates. pub fn tick_all_animations(layout_task: &LayoutTask, rw_data: &mut LayoutTaskData) { let running_animations = mem::replace(&mut rw_data.running_animations, Vec::new()); - let now = clock_ticks::precise_time_s(); + let now = clock_ticks::precise_time_s() as f32; for running_animation in running_animations.into_iter() { layout_task.tick_animation(&running_animation, rw_data); @@ -100,5 +108,8 @@ pub fn tick_all_animations(layout_task: &LayoutTask, rw_data: &mut LayoutTaskDat rw_data.running_animations.push(running_animation) } } + + let ScriptControlChan(ref chan) = layout_task.script_chan; + chan.send(ConstellationControlMsg::TickAllAnimations(layout_task.id)).unwrap(); } diff --git a/components/layout/block.rs b/components/layout/block.rs index c21d3123bc7..718155f495b 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -933,7 +933,7 @@ impl BlockFlow { if is_root { let screen_size = LogicalSize::from_physical(self.fragment.style.writing_mode, layout_context.shared.screen_size); - block_size = Au::max(screen_size.block, block_size) + block_size = max(screen_size.block, block_size) } if is_root || self.formatting_context_type() != FormattingContextType::None || @@ -1395,9 +1395,7 @@ impl BlockFlow { } let info = PlacementInfo { - size: LogicalSize::new(self.fragment.style.writing_mode, - self.base.position.size.inline, - self.fragment.border_box.size.block), + size: self.fragment.border_box.size, ceiling: self.base.position.start.b, max_inline_size: MAX_AU, kind: FloatKind::Left, @@ -1467,8 +1465,8 @@ impl Flow for BlockFlow { // Find the maximum inline-size from children. let mut computation = self.fragment.compute_intrinsic_inline_sizes(); - let mut left_float_width = Au(0); - let mut right_float_width = Au(0); + let (mut left_float_width, mut right_float_width) = (Au(0), Au(0)); + let (mut left_float_width_accumulator, mut right_float_width_accumulator) = (Au(0), Au(0)); for kid in self.base.child_iter() { let is_absolutely_positioned = flow::base(kid).flags.contains(IS_ABSOLUTELY_POSITIONED); @@ -1479,6 +1477,15 @@ impl Flow for BlockFlow { max(computation.content_intrinsic_sizes.minimum_inline_size, child_base.intrinsic_inline_sizes.minimum_inline_size); + if child_base.flags.contains(CLEARS_LEFT) { + left_float_width = max(left_float_width, left_float_width_accumulator); + left_float_width_accumulator = Au(0) + } + if child_base.flags.contains(CLEARS_RIGHT) { + right_float_width = max(right_float_width, right_float_width_accumulator); + right_float_width_accumulator = Au(0) + } + match float_kind { float::T::none => { computation.content_intrinsic_sizes.preferred_inline_size = @@ -1486,11 +1493,11 @@ impl Flow for BlockFlow { child_base.intrinsic_inline_sizes.preferred_inline_size); } float::T::left => { - left_float_width = left_float_width + + left_float_width_accumulator = left_float_width_accumulator + child_base.intrinsic_inline_sizes.preferred_inline_size; } float::T::right => { - right_float_width = right_float_width + + right_float_width_accumulator = right_float_width_accumulator + child_base.intrinsic_inline_sizes.preferred_inline_size; } } @@ -1502,6 +1509,8 @@ impl Flow for BlockFlow { // FIXME(pcwalton): This should consider all float descendants, not just children. // FIXME(pcwalton): This is not well-spec'd; INTRINSIC specifies to do this, but CSS-SIZING // says not to. In practice, Gecko and WebKit both do this. + left_float_width = max(left_float_width, left_float_width_accumulator); + right_float_width = max(right_float_width, right_float_width_accumulator); computation.content_intrinsic_sizes.preferred_inline_size = max(computation.content_intrinsic_sizes.preferred_inline_size, left_float_width + right_float_width); @@ -1914,7 +1923,7 @@ impl Flow for BlockFlow { self.base .absolute_position_info .relative_containing_block_mode, - CoordinateSystem::Parent) + CoordinateSystem::Own) .translate(stacking_context_position)); } diff --git a/components/layout/construct.rs b/components/layout/construct.rs index 2365fe69e3b..af6ac911b5b 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -31,7 +31,7 @@ use fragment::TableColumnFragmentInfo; use fragment::UnscannedTextFragmentInfo; use fragment::{InlineBlockFragmentInfo, SpecificFragmentInfo}; use incremental::{RECONSTRUCT_FLOW, RestyleDamage}; -use inline::InlineFlow; +use inline::{InlineFlow, InlineFragmentNodeInfo}; use list_item::{ListItemFlow, ListStyleTypeContent}; use multicol::MulticolFlow; use opaque_node::OpaqueNodeMethods; @@ -169,14 +169,14 @@ struct InlineFragmentsAccumulator { /// Whether we've created a range to enclose all the fragments. This will be Some() if the /// outer node is an inline and None otherwise. - enclosing_style: Option<Arc<ComputedValues>>, + enclosing_node: Option<InlineFragmentNodeInfo>, } impl InlineFragmentsAccumulator { fn new() -> InlineFragmentsAccumulator { InlineFragmentsAccumulator { fragments: LinkedList::new(), - enclosing_style: None, + enclosing_node: None, } } @@ -184,7 +184,9 @@ impl InlineFragmentsAccumulator { let fragments = LinkedList::new(); InlineFragmentsAccumulator { fragments: fragments, - enclosing_style: Some(node.style().clone()), + enclosing_node: Some(InlineFragmentNodeInfo { + address: OpaqueNodeMethods::from_thread_safe_layout_node(node), + style: node.style().clone() }), } } @@ -199,9 +201,9 @@ impl InlineFragmentsAccumulator { fn to_dlist(self) -> LinkedList<Fragment> { let InlineFragmentsAccumulator { mut fragments, - enclosing_style + enclosing_node, } = self; - if let Some(enclosing_style) = enclosing_style { + if let Some(enclosing_node) = enclosing_node { let frag_len = fragments.len(); for (idx, frag) in fragments.iter_mut().enumerate() { @@ -210,7 +212,7 @@ impl InlineFragmentsAccumulator { // frag is the last inline fragment in the inline node let is_last = idx == frag_len - 1; - frag.add_inline_context_style(enclosing_style.clone(), is_first, is_last); + frag.add_inline_context_style(enclosing_node.clone(), is_first, is_last); } } fragments @@ -820,7 +822,7 @@ impl<'a> FlowConstructor<'a> { block_flow)); let fragment = Fragment::new(node, fragment_info); - let mut fragment_accumulator = InlineFragmentsAccumulator::from_inline_node(node); + let mut fragment_accumulator = InlineFragmentsAccumulator::new(); fragment_accumulator.fragments.push_back(fragment); let construction_item = @@ -1478,13 +1480,12 @@ impl FlowConstructionUtils for FlowRef { /// /// This must not be public because only the layout constructor can do this. fn add_new_child(&mut self, mut new_child: FlowRef) { - let base = flow::mut_base(&mut **self); - { let kid_base = flow::mut_base(&mut *new_child); kid_base.parallel.parent = parallel::mut_owned_flow_to_unsafe_flow(self); } + let base = flow::mut_base(&mut **self); base.children.push_back(new_child); let _ = base.parallel.children_count.fetch_add(1, Ordering::Relaxed); } diff --git a/components/layout/context.rs b/components/layout/context.rs index 38996d5eea1..9a7550fd2d6 100644 --- a/components/layout/context.rs +++ b/components/layout/context.rs @@ -15,7 +15,7 @@ use gfx::font_context::FontContext; use msg::constellation_msg::ConstellationChan; use net_traits::image::base::Image; use net_traits::image_cache_task::{ImageCacheChan, ImageCacheTask, ImageState}; -use script::layout_interface::{Animation, LayoutChan}; +use script::layout_interface::{Animation, LayoutChan, ReflowGoal}; use std::boxed; use std::cell::Cell; use std::ptr; @@ -98,6 +98,9 @@ pub struct SharedLayoutContext { /// A channel on which new animations that have been triggered by style recalculation can be /// sent. pub new_animations_sender: Sender<Animation>, + + /// Why is this reflow occurring + pub goal: ReflowGoal, } pub struct SharedLayoutContextWrapper(pub *const SharedLayoutContext); diff --git a/components/layout/css/matching.rs b/components/layout/css/matching.rs index 27533070bdf..f3f29d1b2e7 100644 --- a/components/layout/css/matching.rs +++ b/components/layout/css/matching.rs @@ -34,7 +34,7 @@ use style::selector_matching::{Stylist, DeclarationBlock}; use util::arc_ptr_eq; use util::cache::{LRUCache, SimpleHashCache}; use util::opts; -use util::smallvec::{SmallVec, SmallVec16}; +use util::smallvec::SmallVec16; use util::vec::ForgetfulSink; pub struct ApplicableDeclarations { @@ -689,7 +689,7 @@ impl<'ln> MatchMethods for LayoutNode<'ln> { let mut damage = self.cascade_node_pseudo_element( layout_context, parent_style, - applicable_declarations.normal.as_slice(), + &applicable_declarations.normal, &mut layout_data.shared_data.style, applicable_declarations_cache, new_animations_sender, diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index 890a3b12128..7c4ee2b5066 100644 --- a/components/layout/display_list_builder.rs +++ b/components/layout/display_list_builder.rs @@ -39,8 +39,6 @@ use png::{self, PixelsByColorType}; use std::cmp; use std::default::Default; use std::iter::repeat; -use std::num::Float; -use std::num::ToPrimitive; use std::sync::Arc; use std::sync::mpsc::channel; use style::computed_values::filter::Filter; @@ -54,7 +52,7 @@ use style::values::computed::{Image, LinearGradient, LengthOrPercentage, LengthO use style::values::specified::{AngleOrCorner, HorizontalDirection, VerticalDirection}; use url::Url; use util::cursor::Cursor; -use util::geometry::{self, Au, ZERO_POINT, to_px, to_frac_px}; +use util::geometry::{Au, ZERO_POINT}; use util::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMode}; use util::opts; @@ -247,13 +245,13 @@ pub trait FragmentDisplayListBuilding { fn handle_overlapping_radii(size: &Size2D<Au>, radii: &BorderRadii<Au>) -> BorderRadii<Au> { // No two corners' border radii may add up to more than the length of the edge // between them. To prevent that, all radii are scaled down uniformly. - fn scale_factor(radius_a: Au, radius_b: Au, edge_length: Au) -> f64 { + fn scale_factor(radius_a: Au, radius_b: Au, edge_length: Au) -> f32 { let required = radius_a + radius_b; if required <= edge_length { 1.0 } else { - to_frac_px(edge_length) / to_frac_px(required) + edge_length.to_f32_px() / required.to_f32_px() } } @@ -354,18 +352,18 @@ impl FragmentDisplayListBuilding for Fragment { // If `image_aspect_ratio` < `bounds_aspect_ratio`, the image is tall; otherwise, it is // wide. let image_aspect_ratio = (image.width as f64) / (image.height as f64); - let bounds_aspect_ratio = bounds.size.width.to_subpx() / bounds.size.height.to_subpx(); - let intrinsic_size = Size2D(Au::from_px(image.width as isize), - Au::from_px(image.height as isize)); + let bounds_aspect_ratio = bounds.size.width.to_f64_px() / bounds.size.height.to_f64_px(); + let intrinsic_size = Size2D(Au::from_px(image.width as i32), + Au::from_px(image.height as i32)); match (style.get_background().background_size.clone(), image_aspect_ratio < bounds_aspect_ratio) { (background_size::T::Contain, false) | (background_size::T::Cover, true) => { Size2D(bounds.size.width, - Au::from_frac_px(bounds.size.width.to_subpx() / image_aspect_ratio)) + Au::from_f64_px(bounds.size.width.to_f64_px() / image_aspect_ratio)) } (background_size::T::Contain, true) | (background_size::T::Cover, false) => { - Size2D(Au::from_frac_px(bounds.size.height.to_subpx() * image_aspect_ratio), + Size2D(Au::from_f64_px(bounds.size.height.to_f64_px() * image_aspect_ratio), bounds.size.height) } @@ -375,7 +373,7 @@ impl FragmentDisplayListBuilding for Fragment { }), _) => { let width = MaybeAuto::from_style(width, bounds.size.width) .specified_or_default(intrinsic_size.width); - Size2D(width, Au::from_frac_px(width.to_subpx() / image_aspect_ratio)) + Size2D(width, Au::from_f64_px(width.to_f64_px() / image_aspect_ratio)) } (background_size::T::Explicit(background_size::ExplicitSize { @@ -384,7 +382,7 @@ impl FragmentDisplayListBuilding for Fragment { }), _) => { let height = MaybeAuto::from_style(height, bounds.size.height) .specified_or_default(intrinsic_size.height); - Size2D(Au::from_frac_px(height.to_subpx() * image_aspect_ratio), height) + Size2D(Au::from_f64_px(height.to_f64_px() * image_aspect_ratio), height) } (background_size::T::Explicit(background_size::ExplicitSize { @@ -503,10 +501,10 @@ impl FragmentDisplayListBuilding for Fragment { // between the starting point and the ending point. let delta = match gradient.angle_or_corner { AngleOrCorner::Angle(angle) => { - Point2D(Au((angle.radians().sin() * - absolute_bounds.size.width.to_f64().unwrap() / 2.0) as i32), - Au((-angle.radians().cos() * - absolute_bounds.size.height.to_f64().unwrap() / 2.0) as i32)) + Point2D(Au::from_f32_px(angle.radians().sin() * + absolute_bounds.size.width.to_f32_px() / 2.0), + Au::from_f32_px(-angle.radians().cos() * + absolute_bounds.size.height.to_f32_px() / 2.0)) } AngleOrCorner::Corner(horizontal, vertical) => { let x_factor = match horizontal { @@ -517,14 +515,14 @@ impl FragmentDisplayListBuilding for Fragment { VerticalDirection::Top => -1, VerticalDirection::Bottom => 1, }; - Point2D(Au(x_factor * absolute_bounds.size.width.to_i32().unwrap() / 2), - Au(y_factor * absolute_bounds.size.height.to_i32().unwrap() / 2)) + Point2D(absolute_bounds.size.width * x_factor / 2, + absolute_bounds.size.height * y_factor / 2) } }; // This is the length of the gradient line. - let length = Au((delta.x.to_f64().unwrap() * 2.0).hypot(delta.y.to_f64().unwrap() * 2.0) - as i32); + let length = Au::from_f32_px( + (delta.x.to_f32_px() * 2.0).hypot(delta.y.to_f32_px() * 2.0)); // Determine the position of each stop per CSS-IMAGES § 3.4. // @@ -867,30 +865,30 @@ impl FragmentDisplayListBuilding for Fragment { // Add shadows, background, borders, and outlines, if applicable. if let Some(ref inline_context) = self.inline_context { - for style in inline_context.styles.iter().rev() { + for node in inline_context.nodes.iter().rev() { self.build_display_list_for_box_shadow_if_applicable( - &**style, + &*node.style, display_list, layout_context, level, &stacking_relative_border_box, &clip); self.build_display_list_for_background_if_applicable( - &**style, + &*node.style, display_list, layout_context, level, &stacking_relative_border_box, &clip); self.build_display_list_for_borders_if_applicable( - &**style, + &*node.style, border_painting_mode, display_list, &stacking_relative_border_box, level, &clip); self.build_display_list_for_outline_if_applicable( - &**style, + &*node.style, display_list, &stacking_relative_border_box, &clip); @@ -1027,9 +1025,9 @@ impl FragmentDisplayListBuilding for Fragment { } SpecificFragmentInfo::Canvas(ref canvas_fragment_info) => { let width = canvas_fragment_info.replaced_image_fragment_info - .computed_inline_size.map_or(0, |w| to_px(w) as usize); + .computed_inline_size.map_or(0, |w| w.to_px() as usize); let height = canvas_fragment_info.replaced_image_fragment_info - .computed_block_size.map_or(0, |h| to_px(h) as usize); + .computed_block_size.map_or(0, |h| h.to_px() as usize); let (sender, receiver) = channel::<Vec<u8>>(); let canvas_data = match canvas_fragment_info.renderer { @@ -1082,9 +1080,9 @@ impl FragmentDisplayListBuilding for Fragment { let transform_origin = self.style().get_effects().transform_origin; let transform_origin = Point2D(model::specified(transform_origin.horizontal, - border_box.size.width).to_frac32_px(), + border_box.size.width).to_f32_px(), model::specified(transform_origin.vertical, - border_box.size.height).to_frac32_px()); + border_box.size.height).to_f32_px()); let transform = self.style().get_effects().transform .unwrap_or(ComputedMatrix::identity()).to_gfx_matrix(&border_box.size); @@ -1119,10 +1117,10 @@ impl FragmentDisplayListBuilding for Fragment { layout_context: &LayoutContext) { let border_padding = (self.border_padding).to_physical(self.style.writing_mode); let content_size = self.content_box().size.to_physical(self.style.writing_mode); - let iframe_rect = Rect(Point2D(geometry::to_frac_px(offset.x + border_padding.left) as f32, - geometry::to_frac_px(offset.y + border_padding.top) as f32), - Size2D(geometry::to_frac_px(content_size.width) as f32, - geometry::to_frac_px(content_size.height) as f32)); + let iframe_rect = Rect(Point2D((offset.x + border_padding.left).to_f32_px(), + (offset.y + border_padding.top).to_f32_px()), + Size2D(content_size.width.to_f32_px(), + content_size.height.to_f32_px())); debug!("finalizing position and size of iframe for {:?},{:?}", iframe_fragment.pipeline_id, diff --git a/components/layout/flow.rs b/components/layout/flow.rs index a745ca8010b..f868983e6c2 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -55,7 +55,6 @@ use rustc_serialize::{Encoder, Encodable}; use std::fmt; use std::iter::Zip; use std::mem; -use std::num::FromPrimitive; use std::raw; use std::slice::IterMut; use std::sync::Arc; @@ -582,13 +581,13 @@ impl FlowFlags { #[inline] pub fn text_align(self) -> text_align::T { - FromPrimitive::from_u32((self & TEXT_ALIGN).bits() >> TEXT_ALIGN_SHIFT).unwrap() + text_align::T::from_u32((self & TEXT_ALIGN).bits() >> TEXT_ALIGN_SHIFT).unwrap() } #[inline] pub fn set_text_align(&mut self, value: text_align::T) { *self = (*self & !TEXT_ALIGN) | - FlowFlags::from_bits((value as u32) << TEXT_ALIGN_SHIFT).unwrap(); + FlowFlags::from_bits(value.to_u32() << TEXT_ALIGN_SHIFT).unwrap(); } #[inline] @@ -876,7 +875,6 @@ impl Encodable for BaseFlow { } } -#[unsafe_destructor] impl Drop for BaseFlow { fn drop(&mut self) { if self.strong_ref_count.load(Ordering::SeqCst) != 0 && diff --git a/components/layout/flow_ref.rs b/components/layout/flow_ref.rs index 9a8e2bb580e..6b323c15f6f 100644 --- a/components/layout/flow_ref.rs +++ b/components/layout/flow_ref.rs @@ -78,7 +78,8 @@ impl DerefMut for FlowRef { impl Drop for FlowRef { fn drop(&mut self) { unsafe { - if self.object.vtable.is_null() { + if self.object.vtable.is_null() || + self.object.vtable as usize == mem::POST_DROP_USIZE { return } if flow::base(&**self).strong_ref_count().fetch_sub(1, Ordering::Release) != 1 { @@ -102,7 +103,7 @@ impl Drop for FlowRef { let object_align = vtable[2]; let fake_data = heap::allocate(object_size, object_align); - ptr::copy(fake_data, flow_ref.object.data as *const u8, object_size); + ptr::copy(flow_ref.object.data as *const u8, fake_data, object_size); let fake_box = raw::TraitObject { vtable: flow_ref.object.vtable, data: fake_data as *mut () }; let fake_flow = mem::transmute::<raw::TraitObject, Box<Flow>>(fake_box); @@ -181,7 +182,8 @@ impl Clone for WeakFlowRef { impl Drop for WeakFlowRef { fn drop(&mut self) { unsafe { - if self.object.vtable.is_null() { + if self.object.vtable.is_null() || + self.object.vtable as usize == mem::POST_DROP_USIZE { return } diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index c7e1cd1ed04..7b451d608ad 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -14,7 +14,7 @@ use flow; use flow::Flow; use flow_ref::FlowRef; use incremental::{self, RestyleDamage}; -use inline::{InlineFragmentContext, InlineMetrics}; +use inline::{InlineFragmentContext, InlineFragmentNodeInfo, InlineMetrics}; use layout_debug; use model::{self, IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto, specified}; use text; @@ -34,7 +34,6 @@ use std::borrow::ToOwned; use std::cmp::{max, min}; use std::collections::LinkedList; use std::fmt; -use std::num::ToPrimitive; use std::str::FromStr; use std::sync::mpsc::Sender; use std::sync::{Arc, Mutex}; @@ -48,10 +47,9 @@ use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto}; use style::values::computed::{LengthOrPercentageOrNone}; use text::TextRunScanner; use url::Url; -use util::geometry::{self, Au, ZERO_POINT}; +use util::geometry::{Au, ZERO_POINT}; use util::logical_geometry::{LogicalRect, LogicalSize, LogicalMargin, WritingMode}; use util::range::*; -use util::smallvec::SmallVec; use util::str::is_whitespace; use util; @@ -215,9 +213,9 @@ fn clamp_size(size: Au, let min_size = model::specified(min_size, container_inline_size); let max_size = model::specified_or_none(max_size, container_inline_size); - Au::max(min_size, match max_size { + max(min_size, match max_size { None => size, - Some(max_size) => Au::min(size, max_size), + Some(max_size) => min(size, max_size), }) } @@ -273,8 +271,8 @@ impl CanvasFragmentInfo { pub fn new(node: &ThreadSafeLayoutNode) -> CanvasFragmentInfo { CanvasFragmentInfo { replaced_image_fragment_info: ReplacedImageFragmentInfo::new(node, - Some(Au::from_px(node.get_canvas_width() as isize)), - Some(Au::from_px(node.get_canvas_height() as isize))), + Some(Au::from_px(node.get_canvas_width() as i32)), + Some(Au::from_px(node.get_canvas_height() as i32))), renderer: node.get_renderer().map(|rec| Arc::new(Mutex::new(rec))), } } @@ -311,8 +309,8 @@ impl ImageFragmentInfo { fn convert_length(node: &ThreadSafeLayoutNode, name: &Atom) -> Option<Au> { let element = node.as_element(); element.get_attr(&ns!(""), name) - .and_then(|string| string.parse::<isize>().ok()) - .map(|pixels| Au::from_px(pixels)) + .and_then(|string| string.parse().ok()) + .map(Au::from_px) } let image = url.and_then(|url| layout_context.get_or_request_image(url)); @@ -333,7 +331,7 @@ impl ImageFragmentInfo { image.height } else { image.width - } as isize) + } as i32) } None => Au(0) } @@ -347,7 +345,7 @@ impl ImageFragmentInfo { image.width } else { image.height - } as isize) + } as i32) } None => Au(0) } @@ -356,8 +354,8 @@ impl ImageFragmentInfo { /// Tile an image pub fn tile_image(position: &mut Au, size: &mut Au, virtual_position: Au, image_size: u32) { - let image_size = image_size as isize; - let delta_pixels = geometry::to_px(virtual_position - *position); + let image_size = image_size as i32; + let delta_pixels = (virtual_position - *position).to_px(); let tile_count = (delta_pixels + image_size - 1) / image_size; let offset = Au::from_px(image_size * tile_count); let new_position = virtual_position - offset; @@ -453,8 +451,8 @@ impl ReplacedImageFragmentInfo { if intrinsic_height == Au(0) { intrinsic_width } else { - let ratio = intrinsic_width.to_f32().unwrap() / - intrinsic_height.to_f32().unwrap(); + let ratio = intrinsic_width.to_f32_px() / + intrinsic_height.to_f32_px(); let specified_height = ReplacedImageFragmentInfo::style_length( style_block_size, @@ -468,7 +466,7 @@ impl ReplacedImageFragmentInfo { style_min_block_size, style_max_block_size, Au(0)); - Au((specified_height.to_f32().unwrap() * ratio) as i32) + Au::from_f32_px(specified_height.to_f32_px() * ratio) } }, MaybeAuto::Specified(w) => w, @@ -505,8 +503,8 @@ impl ReplacedImageFragmentInfo { MaybeAuto::Auto => { let intrinsic_width = fragment_inline_size; let intrinsic_height = fragment_block_size; - let scale = intrinsic_width.to_f32().unwrap() / inline_size.to_f32().unwrap(); - Au((intrinsic_height.to_f32().unwrap() / scale) as i32) + let scale = intrinsic_width.to_f32_px() / inline_size.to_f32_px(); + Au::from_f32_px(intrinsic_height.to_f32_px() / scale) }, MaybeAuto::Specified(h) => { h @@ -840,32 +838,37 @@ impl Fragment { self.restyle_damage | self.specific.restyle_damage() } + pub fn contains_node(&self, node_address: OpaqueNode) -> bool { + node_address == self.node || + self.inline_context.as_ref().map_or(false, |ctx| { + ctx.contains_node(node_address) + }) + } + /// Adds a style to the inline context for this fragment. If the inline context doesn't exist /// yet, it will be created. pub fn add_inline_context_style(&mut self, - style: Arc<ComputedValues>, + mut node_info: InlineFragmentNodeInfo, first_frag: bool, last_frag: bool) { if self.inline_context.is_none() { self.inline_context = Some(InlineFragmentContext::new()); } - let frag_style = if first_frag && last_frag { - style.clone() - } else { + if !first_frag || !last_frag { // Set the border width to zero and the border style to none on // border sides that are not the outermost for a node container. // Because with multiple inline fragments they don't have interior // borders separating each other. - let mut border_width = style.logical_border_width(); + let mut border_width = node_info.style.logical_border_width(); if !last_frag { - border_width.set_right(style.writing_mode, Zero::zero()); + border_width.set_right(node_info.style.writing_mode, Zero::zero()); } if !first_frag { - border_width.set_left(style.writing_mode, Zero::zero()); + border_width.set_left(node_info.style.writing_mode, Zero::zero()); } - Arc::new(make_border(&*style, border_width)) + node_info.style = Arc::new(make_border(&*node_info.style, border_width)) }; - self.inline_context.as_mut().unwrap().styles.push(frag_style); + self.inline_context.as_mut().unwrap().nodes.push(node_info); } /// Determines which quantities (border/padding/margin/specified) should be included in the @@ -877,8 +880,7 @@ impl Fragment { SpecificFragmentInfo::Generic | SpecificFragmentInfo::GeneratedContent(_) | SpecificFragmentInfo::Iframe(_) | - SpecificFragmentInfo::Image(_) | - SpecificFragmentInfo::InlineBlock(_) => { + SpecificFragmentInfo::Image(_) => { QuantitiesIncludedInIntrinsicInlineSizes::all() } SpecificFragmentInfo::Table | SpecificFragmentInfo::TableCell => { @@ -913,7 +915,8 @@ impl Fragment { SpecificFragmentInfo::ScannedText(_) | SpecificFragmentInfo::TableColumn(_) | SpecificFragmentInfo::UnscannedText(_) | - SpecificFragmentInfo::InlineAbsoluteHypothetical(_) => { + SpecificFragmentInfo::InlineAbsoluteHypothetical(_) | + SpecificFragmentInfo::InlineBlock(_) => { QuantitiesIncludedInIntrinsicInlineSizes::empty() } } @@ -964,8 +967,8 @@ impl Fragment { let flags = self.quantities_included_in_intrinsic_inline_size(); let style = self.style(); let specified = if flags.contains(INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED) { - Au::max(model::specified(style.min_inline_size(), Au(0)), - MaybeAuto::from_style(style.content_inline_size(), Au(0)).specified_or_zero()) + max(model::specified(style.min_inline_size(), Au(0)), + MaybeAuto::from_style(style.content_inline_size(), Au(0)).specified_or_zero()) } else { Au(0) }; @@ -1000,10 +1003,10 @@ impl Fragment { match self.inline_context { None => style_border_width, Some(ref inline_fragment_context) => { - inline_fragment_context.styles + inline_fragment_context.nodes .iter() .fold(style_border_width, - |acc, style| acc + style.logical_border_width()) + |acc, node| acc + node.style.logical_border_width()) } } } @@ -1092,10 +1095,10 @@ impl Fragment { match self.inline_context { None => style_padding, Some(ref inline_fragment_context) => { - inline_fragment_context.styles + inline_fragment_context.nodes .iter() - .fold(style_padding, |acc, style| { - acc + model::padding_from_style(&**style, + .fold(style_padding, |acc, node| { + acc + model::padding_from_style(&*node.style, Au(0)) }) } @@ -1136,9 +1139,9 @@ impl Fragment { }; if let Some(ref inline_fragment_context) = self.inline_context { - for style in inline_fragment_context.styles.iter() { - if style.get_box().position == position::T::relative { - rel_pos = rel_pos + from_style(&**style, containing_block_size); + for node in inline_fragment_context.nodes.iter() { + if node.style.get_box().position == position::T::relative { + rel_pos = rel_pos + from_style(&*node.style, containing_block_size); } } } @@ -1282,10 +1285,10 @@ impl Fragment { // Take borders and padding for parent inline fragments into account, if necessary. if self.is_primary_fragment() { if let Some(ref context) = self.inline_context { - for style in context.styles.iter() { - let border_width = style.logical_border_width().inline_start_end(); + for node in context.nodes.iter() { + let border_width = node.style.logical_border_width().inline_start_end(); let padding_inline_size = - model::padding_from_style(&**style, Au(0)).inline_start_end(); + model::padding_from_style(&*node.style, Au(0)).inline_start_end(); result.surrounding_size = result.surrounding_size + border_width + padding_inline_size; } @@ -2097,11 +2100,11 @@ impl<'a> Iterator for InlineStyleIterator<'a> { Some(ref inline_context) => inline_context, }; let inline_style_index = self.inline_style_index; - if inline_style_index == inline_context.styles.len() { + if inline_style_index == inline_context.nodes.len() { return None } self.inline_style_index += 1; - Some(&*inline_context.styles[inline_style_index]) + Some(&*inline_context.nodes[inline_style_index].style) } } diff --git a/components/layout/generated_content.rs b/components/layout/generated_content.rs index d0cf0af98d1..e2ba7dbfe4b 100644 --- a/components/layout/generated_content.rs +++ b/components/layout/generated_content.rs @@ -21,7 +21,7 @@ use std::sync::Arc; use style::computed_values::content::ContentItem; use style::computed_values::{display, list_style_type}; use style::properties::ComputedValues; -use util::smallvec::{SmallVec, SmallVec8}; +use util::smallvec::SmallVec8; // Decimal styles per CSS-COUNTER-STYLES § 6.1: static DECIMAL: [char; 10] = [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' ]; @@ -530,9 +530,7 @@ fn push_alphabetic_representation(mut value: i32, system: &[char], accumulator: value = ((value as usize) / system.len()) as i32; } - for i in (0..string.len()).rev() { - accumulator.push(*string.get(i)) - } + accumulator.extend(string.iter().cloned().rev()) } /// Pushes the string that represents the value rendered using the given *numeric system* onto the @@ -554,8 +552,6 @@ fn push_numeric_representation(mut value: i32, system: &[char], accumulator: &mu } // Step 3. - for &ch in string.iter().rev() { - accumulator.push(ch) - } + accumulator.extend(string.iter().cloned().rev()) } diff --git a/components/layout/incremental.rs b/components/layout/incremental.rs index 9d989c7b65a..f9fda729cfe 100644 --- a/components/layout/incremental.rs +++ b/components/layout/incremental.rs @@ -210,7 +210,10 @@ impl<'a> LayoutDamageComputation for &'a mut (Flow + 'a) { .insert(self_base.restyle_damage.damage_for_child( is_absolutely_positioned, child_is_absolutely_positioned)); - special_damage.insert(kid.compute_layout_damage()); + { + let kid: &mut Flow = kid; + special_damage.insert(kid.compute_layout_damage()); + } self_base.restyle_damage .insert(flow::base(kid).restyle_damage.damage_for_parent( child_is_absolutely_positioned)); diff --git a/components/layout/inline.rs b/components/layout/inline.rs index d2e48630ee8..321a0868469 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -17,6 +17,7 @@ use text; use collections::VecDeque; use geom::{Point2D, Rect}; +use gfx::display_list::OpaqueNode; use gfx::font::FontMetrics; use gfx::font_context::FontContext; use gfx::text::glyph::CharIndex; @@ -24,8 +25,6 @@ use gfx::text::text_run::TextRun; use std::cmp::max; use std::fmt; use std::mem; -use std::num::ToPrimitive; -use std::ops::{Add, Sub, Mul, Div, Rem, Neg, Shl, Shr, Not, BitOr, BitAnd, BitXor}; use std::sync::Arc; use std::u16; use style::computed_values::{display, overflow_x, text_align, text_justify, text_overflow}; @@ -37,8 +36,8 @@ use util::range::{Range, RangeIndex}; use util; // From gfxFontConstants.h in Firefox -static FONT_SUBSCRIPT_OFFSET_RATIO: f64 = 0.20; -static FONT_SUPERSCRIPT_OFFSET_RATIO: f64 = 0.34; +static FONT_SUBSCRIPT_OFFSET_RATIO: f32 = 0.20; +static FONT_SUPERSCRIPT_OFFSET_RATIO: f32 = 0.34; /// `Line`s are represented as offsets into the child list, rather than /// as an object that "owns" fragments. Choosing a different set of line @@ -398,8 +397,8 @@ impl LineBreaker { fn new_block_size_for_line(&self, new_fragment: &Fragment, layout_context: &LayoutContext) -> Au { - Au::max(self.pending_line.bounds.size.block, - self.new_inline_metrics_for_line(new_fragment, layout_context).block_size()) + max(self.pending_line.bounds.size.block, + self.new_inline_metrics_for_line(new_fragment, layout_context).block_size()) } /// Computes the position of a line that has only the provided fragment. Returns the bounding @@ -927,7 +926,7 @@ impl InlineFlow { text_align::T::left | text_align::T::right => unreachable!() } - for fragment_index in line.range.begin()..line.range.end() { + for fragment_index in line.range.each_index() { let fragment = fragments.get_mut(fragment_index.to_usize()); let size = fragment.border_box.size; fragment.border_box = LogicalRect::new(fragment.style.writing_mode, @@ -967,7 +966,7 @@ impl InlineFlow { } // Then distribute all the space across the expansion opportunities. - let space_per_expansion_opportunity = slack_inline_size.to_subpx() / + let space_per_expansion_opportunity = slack_inline_size.to_f64_px() / (expansion_opportunities as f64); for fragment_index in line.range.each_index() { let fragment = fragments.get_mut(fragment_index.to_usize()); @@ -1016,7 +1015,7 @@ impl InlineFlow { line_distance_from_flow_block_start: Au, baseline_distance_from_block_start: Au, largest_depth_below_baseline: Au) { - for fragment_index in line.range.begin()..line.range.end() { + for fragment_index in line.range.each_index() { // If any of the inline styles say `top` or `bottom`, adjust the vertical align // appropriately. // @@ -1088,10 +1087,10 @@ impl InlineFlow { for frag in self.fragments.fragments.iter() { match frag.inline_context { Some(ref inline_context) => { - for style in inline_context.styles.iter() { - let font_style = style.get_font_arc(); + for node in inline_context.nodes.iter() { + let font_style = node.style.get_font_arc(); let font_metrics = text::font_metrics_for_style(font_context, font_style); - let line_height = text::line_height_from_style(&**style, &font_metrics); + let line_height = text::line_height_from_style(&*node.style, &font_metrics); let inline_metrics = InlineMetrics::from_font_metrics(&font_metrics, line_height); block_size_above_baseline = max(block_size_above_baseline, @@ -1294,7 +1293,7 @@ impl Flow for InlineFlow { let (mut largest_block_size_for_top_fragments, mut largest_block_size_for_bottom_fragments) = (Au(0), Au(0)); - for fragment_index in line.range.begin()..line.range.end() { + for fragment_index in line.range.each_index() { let fragment = &mut self.fragments.fragments[fragment_index.to_usize()]; let InlineMetrics { @@ -1476,7 +1475,7 @@ impl Flow for InlineFlow { &fragment.stacking_relative_border_box(stacking_relative_position, relative_containing_block_size, relative_containing_block_mode, - CoordinateSystem::Parent) + CoordinateSystem::Own) .translate(stacking_context_position)) } } @@ -1495,23 +1494,34 @@ impl fmt::Debug for InlineFlow { } #[derive(Clone)] +pub struct InlineFragmentNodeInfo { + pub address: OpaqueNode, + pub style: Arc<ComputedValues>, +} + +#[derive(Clone)] pub struct InlineFragmentContext { - pub styles: Vec<Arc<ComputedValues>>, + pub nodes: Vec<InlineFragmentNodeInfo>, } impl InlineFragmentContext { pub fn new() -> InlineFragmentContext { InlineFragmentContext { - styles: vec!() + nodes: vec!(), } } + #[inline] + pub fn contains_node(&self, node_address: OpaqueNode) -> bool { + self.nodes.iter().position(|node| node.address == node_address).is_some() + } + fn ptr_eq(&self, other: &InlineFragmentContext) -> bool { - if self.styles.len() != other.styles.len() { + if self.nodes.len() != other.nodes.len() { return false } - for (this_style, other_style) in self.styles.iter().zip(other.styles.iter()) { - if !util::arc_ptr_eq(this_style, other_style) { + for (this_node, other_node) in self.nodes.iter().zip(other.nodes.iter()) { + if !util::arc_ptr_eq(&this_node.style, &other_node.style) { return false } } @@ -1579,10 +1589,10 @@ impl InlineMetrics { pub fn max(&self, other: &InlineMetrics) -> InlineMetrics { InlineMetrics { - block_size_above_baseline: Au::max(self.block_size_above_baseline, - other.block_size_above_baseline), - depth_below_baseline: Au::max(self.depth_below_baseline, other.depth_below_baseline), - ascent: Au::max(self.ascent, other.ascent), + block_size_above_baseline: max(self.block_size_above_baseline, + other.block_size_above_baseline), + depth_below_baseline: max(self.depth_below_baseline, other.depth_below_baseline), + ascent: max(self.ascent, other.ascent), } } } diff --git a/components/layout/layout_debug.rs b/components/layout/layout_debug.rs index 36a013161dc..e9e5c585e68 100644 --- a/components/layout/layout_debug.rs +++ b/components/layout/layout_debug.rs @@ -6,7 +6,6 @@ //! that can be viewed by an external tool to make layout debugging easier. #![macro_use] -#![allow(unsafe_code)] // thread_local!() defines an unsafe function on Android use flow_ref::FlowRef; use flow; @@ -20,7 +19,7 @@ use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; thread_local!(static STATE_KEY: RefCell<Option<State>> = RefCell::new(None)); -static mut DEBUG_ID_COUNTER: AtomicUsize = ATOMIC_USIZE_INIT; +static DEBUG_ID_COUNTER: AtomicUsize = ATOMIC_USIZE_INIT; pub struct Scope; @@ -98,7 +97,7 @@ impl Drop for Scope { /// which are often reallocated but represent essentially the /// same data. pub fn generate_unique_debug_id() -> u16 { - unsafe { DEBUG_ID_COUNTER.fetch_add(1, Ordering::SeqCst) as u16 } + DEBUG_ID_COUNTER.fetch_add(1, Ordering::SeqCst) as u16 } /// Begin a layout debug trace. If this has not been called, diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index 6166b95f73b..324c765280e 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -42,9 +42,9 @@ use log; use msg::compositor_msg::ScrollPolicy; use msg::constellation_msg::Msg as ConstellationMsg; use msg::constellation_msg::{ConstellationChan, Failure, PipelineExitType, PipelineId}; -use profile::mem::{self, Report, ReportsChan}; -use profile::time::{self, ProfilerMetadata, profile}; -use profile::time::{TimerMetadataFrameType, TimerMetadataReflowType}; +use profile_traits::mem::{self, Report, ReportsChan}; +use profile_traits::time::{self, ProfilerMetadata, profile}; +use profile_traits::time::{TimerMetadataFrameType, TimerMetadataReflowType}; use net_traits::{load_bytes_iter, ResourceTask}; use net_traits::image_cache_task::{ImageCacheTask, ImageCacheResult, ImageCacheChan}; use script::dom::bindings::js::LayoutJS; @@ -73,7 +73,6 @@ use util::geometry::{Au, MAX_RECT}; use util::logical_geometry::LogicalPoint; use util::mem::HeapSizeOf; use util::opts; -use util::smallvec::SmallVec; use util::task::spawn_named_with_send_on_failure; use util::task_state; use util::workqueue::WorkQueue; @@ -350,7 +349,8 @@ impl LayoutTask { rw_data: &LayoutTaskData, screen_size_changed: bool, reflow_root: Option<&LayoutNode>, - url: &Url) + url: &Url, + goal: ReflowGoal) -> SharedLayoutContext { SharedLayoutContext { image_cache_task: rw_data.image_cache_task.clone(), @@ -366,6 +366,7 @@ impl LayoutTask { dirty: Rect::zero(), generation: rw_data.generation, new_animations_sender: rw_data.new_animations_sender.clone(), + goal: goal, } } @@ -467,7 +468,8 @@ impl LayoutTask { let mut layout_context = self.build_shared_layout_context(&*rw_data, false, None, - &self.url); + &self.url, + reflow_info.goal); self.perform_post_style_recalc_layout_passes(&reflow_info, &mut *rw_data, @@ -751,11 +753,11 @@ impl LayoutTask { rw_data.content_boxes_response = iterator.rects; } - fn build_display_list_for_reflow<'a>(&'a self, - data: &Reflow, - layout_root: &mut FlowRef, - shared_layout_context: &mut SharedLayoutContext, - rw_data: &mut LayoutTaskData) { + fn compute_abs_pos_and_build_display_list<'a>(&'a self, + data: &Reflow, + layout_root: &mut FlowRef, + shared_layout_context: &mut SharedLayoutContext, + rw_data: &mut LayoutTaskData) { let writing_mode = flow::base(&**layout_root).writing_mode; profile(time::ProfilerCategory::LayoutDispListBuild, self.profiler_metadata(), @@ -773,7 +775,8 @@ impl LayoutTask { match rw_data.parallel_traversal { None => { - sequential::build_display_list_for_subtree(layout_root, shared_layout_context); + sequential::build_display_list_for_subtree(layout_root, + shared_layout_context); } Some(ref mut traversal) => { parallel::build_display_list_for_subtree(layout_root, @@ -784,40 +787,42 @@ impl LayoutTask { } } - debug!("Done building display list."); - - let root_background_color = get_root_flow_background_color(&mut **layout_root); - let root_size = { - let root_flow = flow::base(&**layout_root); - root_flow.position.size.to_physical(root_flow.writing_mode) - }; - let mut display_list = box DisplayList::new(); - flow::mut_base(&mut **layout_root).display_list_building_result - .add_to(&mut *display_list); - let paint_layer = Arc::new(PaintLayer::new(layout_root.layer_id(0), - root_background_color, - ScrollPolicy::Scrollable)); - let origin = Rect(Point2D(Au(0), Au(0)), root_size); - - if opts::get().dump_display_list { - println!("#### start printing display list."); - display_list.print_items(String::from_str("#")); - } + if data.goal == ReflowGoal::ForDisplay { + debug!("Done building display list."); + + let root_background_color = get_root_flow_background_color(&mut **layout_root); + let root_size = { + let root_flow = flow::base(&**layout_root); + root_flow.position.size.to_physical(root_flow.writing_mode) + }; + let mut display_list = box DisplayList::new(); + flow::mut_base(&mut **layout_root).display_list_building_result + .add_to(&mut *display_list); + let paint_layer = Arc::new(PaintLayer::new(layout_root.layer_id(0), + root_background_color, + ScrollPolicy::Scrollable)); + let origin = Rect(Point2D(Au(0), Au(0)), root_size); + + if opts::get().dump_display_list { + println!("#### start printing display list."); + display_list.print_items(String::from_str("#")); + } - let stacking_context = Arc::new(StackingContext::new(display_list, - &origin, - &origin, - 0, - &Matrix2D::identity(), - filter::T::new(Vec::new()), - mix_blend_mode::T::normal, - Some(paint_layer))); + let stacking_context = Arc::new(StackingContext::new(display_list, + &origin, + &origin, + 0, + &Matrix2D::identity(), + filter::T::new(Vec::new()), + mix_blend_mode::T::normal, + Some(paint_layer))); - rw_data.stacking_context = Some(stacking_context.clone()); + rw_data.stacking_context = Some(stacking_context.clone()); - debug!("Layout done!"); + debug!("Layout done!"); - self.paint_chan.send(PaintMsg::PaintInit(stacking_context)); + self.paint_chan.send(PaintMsg::PaintInit(stacking_context)); + } }); } @@ -842,19 +847,32 @@ impl LayoutTask { let mut rw_data = self.lock_rw_data(possibly_locked_rw_data); - // TODO: Calculate the "actual viewport": - // http://www.w3.org/TR/css-device-adapt/#actual-viewport - let viewport_size = data.window_size.initial_viewport; + let initial_viewport = data.window_size.initial_viewport; let old_screen_size = rw_data.screen_size; - let current_screen_size = Size2D(Au::from_frac32_px(viewport_size.width.get()), - Au::from_frac32_px(viewport_size.height.get())); + let current_screen_size = Size2D(Au::from_f32_px(initial_viewport.width.get()), + Au::from_f32_px(initial_viewport.height.get())); rw_data.screen_size = current_screen_size; // Handle conditions where the entire flow tree is invalid. let screen_size_changed = current_screen_size != old_screen_size; if screen_size_changed { - let device = Device::new(MediaType::Screen, data.window_size.initial_viewport); + // Calculate the actual viewport as per DEVICE-ADAPT § 6 + let device = Device::new(MediaType::Screen, initial_viewport); rw_data.stylist.set_device(device); + + if let Some(constraints) = rw_data.stylist.constrain_viewport() { + debug!("Viewport constraints: {:?}", constraints); + + // other rules are evaluated against the actual viewport + rw_data.screen_size = Size2D(Au::from_f32_px(constraints.size.width.get()), + Au::from_f32_px(constraints.size.height.get())); + let device = Device::new(MediaType::Screen, constraints.size); + rw_data.stylist.set_device(device); + + // let the constellation know about the viewport constraints + let ConstellationChan(ref constellation_chan) = rw_data.constellation_chan; + constellation_chan.send(ConstellationMsg::ViewportConstrained(self.id, constraints)).unwrap(); + } } // If the entire flow tree is invalid, then it will be reflowed anyhow. @@ -878,7 +896,8 @@ impl LayoutTask { let mut shared_layout_context = self.build_shared_layout_context(&*rw_data, screen_size_changed, Some(&node), - &self.url); + &self.url, + data.reflow_info.goal); // Recalculate CSS styles and rebuild flows and fragments. profile(time::ProfilerCategory::LayoutStyleRecalc, @@ -946,7 +965,8 @@ impl LayoutTask { let mut layout_context = self.build_shared_layout_context(&*rw_data, false, None, - &self.url); + &self.url, + reflow_info.goal); let mut root_flow = (*rw_data.root_flow.as_ref().unwrap()).clone(); profile(time::ProfilerCategory::LayoutStyleRecalc, self.profiler_metadata(), @@ -1010,16 +1030,10 @@ impl LayoutTask { }); // Build the display list if necessary, and send it to the painter. - match data.goal { - ReflowGoal::ForDisplay => { - self.build_display_list_for_reflow(data, - &mut root_flow, - &mut *layout_context, - rw_data); - } - ReflowGoal::ForScriptQuery => {} - } - + self.compute_abs_pos_and_build_display_list(data, + &mut root_flow, + &mut *layout_context, + rw_data); self.first_reflow.set(false); if opts::get().trace_layout { @@ -1095,7 +1109,7 @@ impl LayoutRPC for LayoutRPCImpl { /// Requests the node containing the point of interest. fn hit_test(&self, _: TrustedNodeAddress, point: Point2D<f32>) -> Result<HitTestResponse, ()> { - let point = Point2D(Au::from_frac_px(point.x as f64), Au::from_frac_px(point.y as f64)); + let point = Point2D(Au::from_f32_px(point.x), Au::from_f32_px(point.y)); let resp = { let &LayoutRPCImpl(ref rw_data) = self; let rw_data = rw_data.lock().unwrap(); @@ -1122,7 +1136,7 @@ impl LayoutRPC for LayoutRPCImpl { fn mouse_over(&self, _: TrustedNodeAddress, point: Point2D<f32>) -> Result<MouseOverResponse, ()> { let mut mouse_over_list: Vec<DisplayItemMetadata> = vec!(); - let point = Point2D(Au::from_frac_px(point.x as f64), Au::from_frac_px(point.y as f64)); + let point = Point2D(Au::from_f32_px(point.x), Au::from_f32_px(point.y)); { let &LayoutRPCImpl(ref rw_data) = self; let rw_data = rw_data.lock().unwrap(); @@ -1182,7 +1196,7 @@ impl FragmentBorderBoxIterator for UnioningFragmentBorderBoxIterator { } fn should_process(&mut self, fragment: &Fragment) -> bool { - self.node_address == fragment.node + fragment.contains_node(self.node_address) } } @@ -1206,7 +1220,7 @@ impl FragmentBorderBoxIterator for CollectingFragmentBorderBoxIterator { } fn should_process(&mut self, fragment: &Fragment) -> bool { - self.node_address == fragment.node + fragment.contains_node(self.node_address) } } diff --git a/components/layout/lib.rs b/components/layout/lib.rs index 844689f0534..b394c5db88a 100644 --- a/components/layout/lib.rs +++ b/components/layout/lib.rs @@ -6,13 +6,12 @@ #![feature(box_syntax)] #![feature(collections)] #![feature(core)] -#![feature(io)] +#![feature(filling_drop)] #![feature(plugin)] #![feature(rustc_private)] #![feature(std_misc)] +#![feature(str_char)] #![feature(thread_local)] -#![feature(unicode)] -#![feature(unsafe_destructor)] #![feature(unsafe_no_drop_flag)] #![deny(unsafe_code)] @@ -29,15 +28,15 @@ extern crate bitflags; #[macro_use] #[no_link] -extern crate "plugins" as servo_plugins; +extern crate plugins as servo_plugins; extern crate net_traits; #[macro_use] -extern crate profile; +extern crate profile_traits; #[macro_use] extern crate util; -extern crate "rustc-serialize" as rustc_serialize; +extern crate rustc_serialize; extern crate alloc; extern crate azure; extern crate canvas; diff --git a/components/layout/list_item.rs b/components/layout/list_item.rs index 8bf3fee6880..6dff3b48c95 100644 --- a/components/layout/list_item.rs +++ b/components/layout/list_item.rs @@ -172,7 +172,7 @@ impl Flow for ListItemFlow { .base .absolute_position_info .relative_containing_block_mode, - CoordinateSystem::Parent) + CoordinateSystem::Own) .translate(stacking_context_position)); } } diff --git a/components/layout/model.rs b/components/layout/model.rs index 8aecee621ee..8b4da87cd45 100644 --- a/components/layout/model.rs +++ b/components/layout/model.rs @@ -434,8 +434,8 @@ impl ToGfxMatrix for ComputedMatrix { self.m12 as f32, self.m21 as f32, self.m22 as f32, - self.m31.to_au(containing_size.width).to_subpx() as f32, - self.m32.to_au(containing_size.height).to_subpx() as f32) + self.m31.to_au(containing_size.width).to_f32_px(), + self.m32.to_au(containing_size.height).to_f32_px()) } } @@ -446,7 +446,7 @@ trait ToAu { impl ToAu for LengthAndPercentage { #[inline] fn to_au(&self, containing_size: Au) -> Au { - self.length + Au::from_frac_px(self.percentage * containing_size.to_subpx()) + self.length + Au::from_f32_px(self.percentage * containing_size.to_f32_px()) } } diff --git a/components/layout/parallel.rs b/components/layout/parallel.rs index 6699e44d487..5d61e11a3d4 100644 --- a/components/layout/parallel.rs +++ b/components/layout/parallel.rs @@ -20,7 +20,7 @@ use wrapper::{layout_node_to_unsafe_layout_node, layout_node_from_unsafe_layout_ use wrapper::{PostorderNodeMutTraversal, UnsafeLayoutNode}; use wrapper::{PreorderDomTraversal, PostorderDomTraversal}; -use profile::time::{self, ProfilerMetadata, profile}; +use profile_traits::time::{self, ProfilerMetadata, profile}; use std::mem; use std::ptr; use std::sync::atomic::{AtomicIsize, Ordering}; diff --git a/components/layout/sequential.rs b/components/layout/sequential.rs index 3c4755c8e0c..74522354e7d 100644 --- a/components/layout/sequential.rs +++ b/components/layout/sequential.rs @@ -82,7 +82,10 @@ pub fn traverse_flow_tree_preorder(root: &mut FlowRef, if opts::get().bubble_inline_sizes_separately { let bubble_inline_sizes = BubbleISizes { layout_context: &layout_context }; - root.traverse_postorder(&bubble_inline_sizes); + { + let root: &mut Flow = root; + root.traverse_postorder(&bubble_inline_sizes); + } } let assign_inline_sizes = AssignISizes { layout_context: &layout_context }; diff --git a/components/layout/table.rs b/components/layout/table.rs index d6ad3746054..72af04817f2 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -430,8 +430,8 @@ impl Flow for TableFlow { // if there are any, or among all the columns if all are specified. self.column_computed_inline_sizes.clear(); if num_unspecified_inline_sizes == 0 { - let ratio = content_inline_size.to_subpx() / - total_column_inline_size.to_subpx(); + let ratio = content_inline_size.to_f32_px() / + total_column_inline_size.to_f32_px(); for column_inline_size in self.column_intrinsic_inline_sizes.iter() { self.column_computed_inline_sizes.push(ColumnComputedInlineSize { size: column_inline_size.minimum_length.scale_by(ratio), diff --git a/components/layout/table_rowgroup.rs b/components/layout/table_rowgroup.rs index 8990b127da4..034597965bc 100644 --- a/components/layout/table_rowgroup.rs +++ b/components/layout/table_rowgroup.rs @@ -88,7 +88,7 @@ impl TableRowGroupFlow { self.collapsed_inline_direction_border_widths_for_table .extend(collapsed_inline_direction_border_widths_for_table.into_iter().map(|x| *x)); - for _ in range(0, self.block_flow.base.children.len()) { + for _ in 0..self.block_flow.base.children.len() { if let Some(collapsed_block_direction_border_width_for_table) = collapsed_block_direction_border_widths_for_table.next() { self.collapsed_block_direction_border_widths_for_table diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs index 7369acbbf4c..8a3e368d140 100644 --- a/components/layout/table_wrapper.rs +++ b/components/layout/table_wrapper.rs @@ -305,7 +305,7 @@ impl Flow for TableWrapperFlow { self.compute_used_inline_size(layout_context, containing_block_inline_size, - intermediate_column_inline_sizes.as_slice()); + &intermediate_column_inline_sizes); if let TableLayout::Auto = self.table_layout { self.calculate_table_column_sizes_for_automatic_layout( @@ -590,7 +590,7 @@ impl SelectedAutoLayoutCandidateGuess { /// Computes the weight needed to linearly interpolate `middle` between two guesses `low` and /// `high` as specified by INTRINSIC § 4.3. fn weight(low: Au, middle: Au, high: Au) -> CSSFloat { - (middle - low).to_subpx() / (high - low).to_subpx() + (middle - low).to_f32_px() / (high - low).to_f32_px() } /// Linearly interpolates between two guesses, as specified by INTRINSIC § 4.3. @@ -653,9 +653,9 @@ impl ExcessInlineSizeDistributionInfo { // do? if !column_intrinsic_inline_size.constrained && column_intrinsic_inline_size.percentage == 0.0 { - column_intrinsic_inline_size.preferred.to_subpx() / + column_intrinsic_inline_size.preferred.to_f32_px() / self.preferred_inline_size_of_nonconstrained_columns_with_no_percentage - .to_subpx() + .to_f32_px() } else { 0.0 } @@ -663,8 +663,8 @@ impl ExcessInlineSizeDistributionInfo { 1.0 / (self.count_of_nonconstrained_columns_with_no_percentage as CSSFloat) } else if self.preferred_inline_size_of_constrained_columns_with_no_percentage > Au(0) { - column_intrinsic_inline_size.preferred.to_subpx() / - self.preferred_inline_size_of_constrained_columns_with_no_percentage.to_subpx() + column_intrinsic_inline_size.preferred.to_f32_px() / + self.preferred_inline_size_of_constrained_columns_with_no_percentage.to_f32_px() } else if self.total_percentage > 0.0 { column_intrinsic_inline_size.percentage / self.total_percentage } else { @@ -684,7 +684,7 @@ impl ExcessInlineSizeDistributionInfo { /// An intermediate column size assignment. struct IntermediateColumnInlineSize { size: Au, - percentage: f64, + percentage: f32, } fn initial_computed_inline_size(block: &mut BlockFlow, @@ -695,11 +695,10 @@ fn initial_computed_inline_size(block: &mut BlockFlow, containing_block_inline_size); match inline_size_from_style { MaybeAuto::Auto => { - MaybeAuto::Specified(Au::max(containing_block_inline_size, - minimum_width_of_all_columns)) + MaybeAuto::Specified(max(containing_block_inline_size, minimum_width_of_all_columns)) } MaybeAuto::Specified(inline_size_from_style) => { - MaybeAuto::Specified(Au::max(inline_size_from_style, minimum_width_of_all_columns)) + MaybeAuto::Specified(max(inline_size_from_style, minimum_width_of_all_columns)) } } } diff --git a/components/layout/text.rs b/components/layout/text.rs index 4bfbcb66ca8..9930b389b62 100644 --- a/components/layout/text.rs +++ b/components/layout/text.rs @@ -27,7 +27,7 @@ use util::geometry::Au; use util::linked_list::split_off_head; use util::logical_geometry::{LogicalSize, WritingMode}; use util::range::{Range, RangeIndex}; -use util::smallvec::{SmallVec, SmallVec1}; +use util::smallvec::SmallVec1; /// A stack-allocated object for scanning an inline flow into `TextRun`-containing `TextFragment`s. pub struct TextRunScanner { @@ -185,7 +185,7 @@ impl TextRunScanner { }; // FIXME(https://github.com/rust-lang/rust/issues/23338) - let mut font = fontgroup.fonts.get(0).borrow_mut(); + let mut font = fontgroup.fonts[0].borrow_mut(); Arc::new(box TextRun::new(&mut *font, run_text, &options)) }; @@ -193,7 +193,7 @@ impl TextRunScanner { debug!("TextRunScanner: pushing {} fragment(s)", self.clump.len()); for (logical_offset, old_fragment) in mem::replace(&mut self.clump, LinkedList::new()).into_iter().enumerate() { - let mut range = *new_ranges.get(logical_offset); + let mut range = new_ranges[logical_offset]; if range.is_empty() { debug!("Elided an `SpecificFragmentInfo::UnscannedText` because it was \ zero-length after compression"); @@ -238,14 +238,14 @@ impl TextRunScanner { let length = string.len(); let original = mem::replace(string, String::with_capacity(length)); for character in original.chars() { - string.push(character.to_uppercase()) + string.extend(character.to_uppercase()) } } text_transform::T::lowercase => { let length = string.len(); let original = mem::replace(string, String::with_capacity(length)); for character in original.chars() { - string.push(character.to_lowercase()) + string.extend(character.to_lowercase()) } } text_transform::T::capitalize => { @@ -258,7 +258,7 @@ impl TextRunScanner { // // http://dev.w3.org/csswg/css-text/#typographic-letter-unit if capitalize_next_letter && character.is_alphabetic() { - string.push(character.to_uppercase()); + string.extend(character.to_uppercase()); capitalize_next_letter = false; continue } @@ -308,7 +308,7 @@ pub fn font_metrics_for_style(font_context: &mut FontContext, font_style: Arc<Fo -> FontMetrics { let fontgroup = font_context.get_layout_font_group_for_style(font_style); // FIXME(https://github.com/rust-lang/rust/issues/23338) - let font = fontgroup.fonts.get(0).borrow(); + let font = fontgroup.fonts[0].borrow(); font.metrics.clone() } diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index 0441f4fa76a..cfedc0ae3f1 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -14,6 +14,7 @@ use flow::{Flow, MutableFlowUtils}; use flow::{PreorderFlowTraversal, PostorderFlowTraversal}; use flow; use incremental::{self, BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, RestyleDamage}; +use script::layout_interface::ReflowGoal; use wrapper::{layout_node_to_unsafe_layout_node, LayoutNode}; use wrapper::{PostorderNodeMutTraversal, ThreadSafeLayoutNode, UnsafeLayoutNode}; use wrapper::{PreorderDomTraversal, PostorderDomTraversal}; @@ -378,5 +379,9 @@ impl<'a> PostorderFlowTraversal for BuildDisplayList<'a> { fn process(&self, flow: &mut Flow) { flow.build_display_list(self.layout_context); } -} + #[inline] + fn should_process(&self, _: &mut Flow) -> bool { + self.layout_context.shared.goal == ReflowGoal::ForDisplay + } +} diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index 49c6a688a7c..b647284c2ed 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -71,11 +71,11 @@ use style::computed_values::content::ContentItem; use style::computed_values::{content, display, white_space}; use selectors::matching::DeclarationBlock; use selectors::parser::{NamespaceConstraint, AttrSelector}; -use selectors::smallvec::VecLike; use style::legacy::{IntegerAttribute, LengthAttribute}; use style::legacy::{UnsignedIntegerAttribute}; use style::node::{TElement, TElementAttributes, TNode}; use style::properties::{PropertyDeclaration, PropertyDeclarationBlock}; +use util::smallvec::VecLike; use url::Url; /// Allows some convenience methods on generic layout nodes. diff --git a/components/layout_traits/Cargo.toml b/components/layout_traits/Cargo.toml index 02df09b7f2b..17d706eeca3 100644 --- a/components/layout_traits/Cargo.toml +++ b/components/layout_traits/Cargo.toml @@ -19,8 +19,8 @@ path = "../msg" [dependencies.net_traits] path = "../net_traits" -[dependencies.profile] -path = "../profile" +[dependencies.profile_traits] +path = "../profile_traits" [dependencies.util] path = "../util" diff --git a/components/layout_traits/lib.rs b/components/layout_traits/lib.rs index 406730f65d7..f37cfa194bb 100644 --- a/components/layout_traits/lib.rs +++ b/components/layout_traits/lib.rs @@ -5,7 +5,7 @@ extern crate gfx; extern crate script_traits; extern crate msg; -extern crate profile; +extern crate profile_traits; extern crate net_traits; extern crate url; extern crate util; @@ -18,8 +18,8 @@ extern crate util; use gfx::font_cache_task::FontCacheTask; use gfx::paint_task::PaintChan; use msg::constellation_msg::{ConstellationChan, Failure, PipelineId, PipelineExitType}; -use profile::mem; -use profile::time; +use profile_traits::mem; +use profile_traits::time; use net_traits::ResourceTask; use net_traits::image_cache_task::ImageCacheTask; use url::Url; diff --git a/components/msg/Cargo.toml b/components/msg/Cargo.toml index b3a0ebfe5d1..035ce9aaa19 100644 --- a/components/msg/Cargo.toml +++ b/components/msg/Cargo.toml @@ -32,6 +32,9 @@ git = "https://github.com/servo/rust-core-foundation" [dependencies.io_surface] git = "https://github.com/servo/rust-io-surface" +[dependencies.png] +git = "https://github.com/servo/rust-png" + [dependencies] url = "0.2.16" bitflags = "*" diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs index 40ddb0161dd..c819ee14944 100644 --- a/components/msg/constellation_msg.rs +++ b/components/msg/constellation_msg.rs @@ -11,9 +11,11 @@ use geom::scale_factor::ScaleFactor; use hyper::header::Headers; use hyper::method::Method; use layers::geometry::DevicePixel; +use png; use util::cursor::Cursor; use util::geometry::{PagePx, ViewportPx}; use std::sync::mpsc::{channel, Sender, Receiver}; +use style::viewport::ViewportConstraints; use webdriver_traits::WebDriverScriptCommand; use url::Url; @@ -223,17 +225,29 @@ pub enum Msg { /// Dispatch a mozbrowser event to a given iframe. Only available in experimental mode. MozBrowserEvent(PipelineId, SubpageId, MozBrowserEvent), /// Indicates whether this pipeline is currently running animations. - ChangeRunningAnimationsState(PipelineId, bool), + ChangeRunningAnimationsState(PipelineId, AnimationState), /// Requests that the constellation instruct layout to begin a new tick of the animation. TickAnimation(PipelineId), - // Request that the constellation send the current root pipeline id over a provided channel + /// Request that the constellation send the current root pipeline id over a provided channel GetRootPipeline(Sender<Option<PipelineId>>), /// Notifies the constellation that this frame has received focus. Focus(PipelineId), /// Requests that the constellation retrieve the current contents of the clipboard GetClipboardContents(Sender<String>), - // Dispatch a webdriver command - WebDriverCommand(PipelineId, WebDriverScriptCommand) + /// Dispatch a webdriver command + WebDriverCommand(PipelineId, WebDriverScriptCommand), + /// Notifies the constellation that the viewport has been constrained in some manner + ViewportConstrained(PipelineId, ViewportConstraints), + /// Create a PNG of the window contents + CompositePng(Sender<Option<png::Image>>) +} + +#[derive(Clone, Eq, PartialEq)] +pub enum AnimationState { + AnimationsPresent, + AnimationCallbacksPresent, + NoAnimationsPresent, + NoAnimationCallbacksPresent, } // https://developer.mozilla.org/en-US/docs/Web/API/Using_the_Browser_API#Events diff --git a/components/msg/lib.rs b/components/msg/lib.rs index fc125583e95..73c5255ddca 100644 --- a/components/msg/lib.rs +++ b/components/msg/lib.rs @@ -7,8 +7,10 @@ extern crate azure; extern crate geom; extern crate hyper; extern crate layers; +extern crate png; extern crate util; extern crate url; +extern crate style; extern crate webdriver_traits; #[cfg(target_os="macos")] diff --git a/components/net/Cargo.toml b/components/net/Cargo.toml index 2f33836598c..6869fb274e6 100644 --- a/components/net/Cargo.toml +++ b/components/net/Cargo.toml @@ -7,15 +7,15 @@ authors = ["The Servo Project Developers"] name = "net" path = "lib.rs" -[dependencies.profile] -path = "../profile" - [dependencies.net_traits] path = "../net_traits" [dependencies.util] path = "../util" +[dependencies.devtools_traits] +path = "../devtools_traits" + [dependencies.geom] git = "https://github.com/servo/rust-geom" @@ -25,10 +25,11 @@ git = "https://github.com/servo/rust-png" [dependencies] url = "0.2.16" time = "0.1.17" -openssl="0.5.1" +openssl="0.6.1" rustc-serialize = "0.3" cookie="*" regex = "0.1.14" regex_macros = "0.1.8" hyper = "0.3" flate2 = "0.2.0" +uuid = "0.1.16" diff --git a/components/net/about_loader.rs b/components/net/about_loader.rs index 11533c353f4..213988904c2 100644 --- a/components/net/about_loader.rs +++ b/components/net/about_loader.rs @@ -14,7 +14,6 @@ use hyper::http::RawStatus; use hyper::mime::{Mime, TopLevel, SubLevel}; use util::resource_files::resources_dir_path; -use std::borrow::IntoCow; use std::fs::PathExt; use std::sync::Arc; @@ -26,7 +25,7 @@ pub fn factory(mut load_data: LoadData, start_chan: LoadConsumer, classifier: Ar content_type: Some(ContentType(Mime(TopLevel::Text, SubLevel::Html, vec![]))), charset: Some("utf-8".to_string()), headers: None, - status: Some(RawStatus(200, "OK".into_cow())), + status: Some(RawStatus(200, "OK".into())), }); chan.send(Done(Ok(()))).unwrap(); return diff --git a/components/net/cookie.rs b/components/net/cookie.rs index 48b9fab41ed..e520e0cbcb6 100644 --- a/components/net/cookie.rs +++ b/components/net/cookie.rs @@ -9,12 +9,10 @@ use net_traits::CookieSource; use pub_domains::PUB_DOMAINS; use cookie_rs; -use time::{Tm, now, at, Timespec}; +use time::{Tm, now, at, Duration}; use url::Url; use std::borrow::ToOwned; -use std::i64; use std::net::{Ipv4Addr, Ipv6Addr}; -use std::time::Duration; use std::str::FromStr; /// A stored cookie that wraps the definition in cookie-rs. This is used to implement @@ -27,7 +25,7 @@ pub struct Cookie { pub persistent: bool, pub creation_time: Tm, pub last_access: Tm, - pub expiry_time: Tm, + pub expiry_time: Option<Tm>, } impl Cookie { @@ -36,9 +34,11 @@ impl Cookie { -> Option<Cookie> { // Step 3 let (persistent, expiry_time) = match (&cookie.max_age, &cookie.expires) { - (&Some(max_age), _) => (true, at(now().to_timespec() + Duration::seconds(max_age as i64))), - (_, &Some(expires)) => (true, expires), - _ => (false, at(Timespec::new(i64::MAX, 0))) + (&Some(max_age), _) => { + (true, Some(at(now().to_timespec() + Duration::seconds(max_age as i64)))) + } + (_, &Some(expires)) => (true, Some(expires)), + _ => (false, None) }; let url_host = request.host().map(|host| host.serialize()).unwrap_or("".to_owned()); @@ -68,7 +68,7 @@ impl Cookie { // Step 7 let mut path = cookie.path.unwrap_or("".to_owned()); - if path.is_empty() || path.char_at(0) != '/' { + if path.is_empty() || path.as_bytes()[0] != b'/' { let url_path = request.serialize_path(); let url_path = url_path.as_ref().map(|path| &**path); path = Cookie::default_path(url_path.unwrap_or("")).to_owned(); @@ -117,7 +117,7 @@ impl Cookie { pub fn path_match(request_path: &str, cookie_path: &str) -> bool { request_path == cookie_path || ( request_path.starts_with(cookie_path) && - ( request_path.ends_with("/") || request_path.char_at(cookie_path.len() - 1) == '/' ) + ( request_path.ends_with("/") || request_path.as_bytes()[cookie_path.len() - 1] == b'/' ) ) } @@ -127,7 +127,7 @@ impl Cookie { return true; } if string.ends_with(domain_string) - && string.char_at(string.len()-domain_string.len()-1) == '.' + && string.as_bytes()[string.len()-domain_string.len()-1] == b'.' && Ipv4Addr::from_str(string).is_err() && Ipv6Addr::from_str(string).is_err() { return true; diff --git a/components/net/data_loader.rs b/components/net/data_loader.rs index 5b86af53851..36daf044e61 100644 --- a/components/net/data_loader.rs +++ b/components/net/data_loader.rs @@ -11,7 +11,8 @@ use rustc_serialize::base64::FromBase64; use hyper::mime::Mime; use std::sync::Arc; -use url::{percent_decode, SchemeData}; +use url::percent_encoding::percent_decode; +use url::SchemeData; pub fn factory(load_data: LoadData, senders: LoadConsumer, _classifier: Arc<MIMEClassifier>) { // NB: we don't spawn a new task. @@ -39,7 +40,7 @@ pub fn load(load_data: LoadData, start_chan: LoadConsumer) { }, None => () } - let parts: Vec<&str> = scheme_data.splitn(1, ',').collect(); + let parts: Vec<&str> = scheme_data.splitn(2, ',').collect(); if parts.len() != 2 { start_sending(start_chan, metadata).send(Done(Err("invalid data uri".to_string()))).unwrap(); return; diff --git a/components/net/fetch/cors_cache.rs b/components/net/fetch/cors_cache.rs index 407e4813653..565271a340a 100644 --- a/components/net/fetch/cors_cache.rs +++ b/components/net/fetch/cors_cache.rs @@ -101,7 +101,6 @@ pub trait CORSCache { /// A simple, vector-based CORS Cache #[derive(Clone)] -#[unstable = "This might later be replaced with a HashMap-like entity, though that requires a separate Origin struct"] pub struct BasicCORSCache(Vec<CORSCacheEntry>); impl BasicCORSCache { diff --git a/components/net/fetch/response.rs b/components/net/fetch/response.rs index 468d86abf39..fc33c123010 100644 --- a/components/net/fetch/response.rs +++ b/components/net/fetch/response.rs @@ -28,7 +28,6 @@ pub enum TerminationReason { /// The response body can still be pushed to after fetch /// This provides a way to store unfinished response bodies -#[unstable = "I haven't yet decided exactly how the interface for this will be"] #[derive(Clone)] pub enum ResponseBody { Empty, // XXXManishearth is this necessary, or is Done(vec![]) enough? @@ -36,14 +35,12 @@ pub enum ResponseBody { Done(Vec<u8>), } -#[unstable = "I haven't yet decided exactly how the interface for this will be"] pub enum ResponseMsg { Chunk(Vec<u8>), Finished, Errored } -#[unstable = "I haven't yet decided exactly how the interface for this will be"] pub struct ResponseLoader { response: Response, chan: Receiver<ResponseMsg> diff --git a/components/net/file_loader.rs b/components/net/file_loader.rs index 9240a736862..a81d0e8afdb 100644 --- a/components/net/file_loader.rs +++ b/components/net/file_loader.rs @@ -8,6 +8,7 @@ use mime_classifier::MIMEClassifier; use resource_task::{start_sending, start_sending_sniffed, ProgressSender}; use std::borrow::ToOwned; +use std::error::Error; use std::fs::File; use std::io::Read; use std::path::PathBuf; diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs index bc2a74cafca..bc3b72dddf0 100644 --- a/components/net/http_loader.rs +++ b/components/net/http_loader.rs @@ -4,6 +4,7 @@ use net_traits::{ControlMsg, CookieSource, LoadData, Metadata, LoadConsumer}; use net_traits::ProgressMsg::{Payload, Done}; +use devtools_traits::{DevtoolsControlMsg, NetworkEvent}; use mime_classifier::MIMEClassifier; use resource_task::{start_sending_opt, start_sending_sniffed_opt}; @@ -19,22 +20,23 @@ use hyper::mime::{Mime, TopLevel, SubLevel}; use hyper::net::HttpConnector; use hyper::status::{StatusCode, StatusClass}; use std::error::Error; -use openssl::ssl::{SslContext, SslVerifyMode}; +use openssl::ssl::{SslContext, SSL_VERIFY_PEER}; use std::io::{self, Read, Write}; use std::sync::Arc; use std::sync::mpsc::{Sender, channel}; -use std::thunk::Invoke; use util::task::spawn_named; use util::resource_files::resources_dir_path; use util::opts; use url::{Url, UrlParser}; +use uuid; use std::borrow::ToOwned; +use std::boxed::FnBox; -pub fn factory(cookies_chan: Sender<ControlMsg>) - -> Box<Invoke<(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)) +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)) } } @@ -66,7 +68,8 @@ fn read_block<R: Read>(reader: &mut R) -> Result<ReadResult, ()> { } } -fn load(mut load_data: LoadData, start_chan: LoadConsumer, classifier: Arc<MIMEClassifier>, cookies_chan: Sender<ControlMsg>) { +fn load(mut load_data: LoadData, start_chan: LoadConsumer, classifier: Arc<MIMEClassifier>, + cookies_chan: Sender<ControlMsg>, devtools_chan: Option<Sender<DevtoolsControlMsg>>) { // FIXME: At the time of writing this FIXME, servo didn't have any central // location for configuration. If you're reading this and such a // repository DOES exist, please update this constant to use it. @@ -114,20 +117,20 @@ fn load(mut load_data: LoadData, start_chan: LoadConsumer, classifier: Arc<MIMEC info!("requesting {}", url.serialize()); fn verifier(ssl: &mut SslContext) { - ssl.set_verify(SslVerifyMode::SslVerifyPeer, None); + ssl.set_verify(SSL_VERIFY_PEER, None); let mut certs = resources_dir_path(); certs.push("certs"); - ssl.set_CA_file(&certs); + ssl.set_CA_file(&certs).unwrap(); }; - let ssl_err_string = "[UnknownError { library: \"SSL routines\", \ + let ssl_err_string = "Some(OpenSslErrors([UnknownError { library: \"SSL routines\", \ function: \"SSL3_GET_SERVER_CERTIFICATE\", \ -reason: \"certificate verify failed\" }]"; +reason: \"certificate verify failed\" }]))"; let mut connector = if opts::get().nossl { HttpConnector(None) } else { - HttpConnector(Some(box verifier as Box<FnMut(&mut SslContext)>)) + HttpConnector(Some(box verifier as Box<FnMut(&mut SslContext) + Send>)) }; let mut req = match Request::with_connector(load_data.method.clone(), url.clone(), &mut connector) { @@ -135,11 +138,12 @@ reason: \"certificate verify failed\" }]"; Err(HttpError::HttpIoError(ref io_error)) if ( io_error.kind() == io::ErrorKind::Other && io_error.description() == "Error in OpenSSL" && - io_error.detail() == Some(ssl_err_string.to_owned()) + // FIXME: This incredibly hacky. Make it more robust, and at least test it. + format!("{:?}", io_error.cause()) == ssl_err_string ) => { let mut image = resources_dir_path(); image.push("badcert.html"); - let load_data = LoadData::new(Url::from_file_path(&*image).unwrap()); + let load_data = LoadData::new(Url::from_file_path(&*image).unwrap(), None); file_loader::factory(load_data, start_chan, classifier); return; }, @@ -230,6 +234,18 @@ reason: \"certificate verify failed\" }]"; } } }; + + // Send an HttpRequest message to devtools with a unique request_id + // TODO: Do this only if load_data has some pipeline_id, and send the pipeline_id in the message + let request_id = uuid::Uuid::new_v4().to_simple_string(); + if let Some(ref chan) = devtools_chan { + let net_event = NetworkEvent::HttpRequest(load_data.url.clone(), + load_data.method.clone(), + load_data.headers.clone(), + load_data.data.clone()); + chan.send(DevtoolsControlMsg::NetworkEventMessage(request_id.clone(), net_event)).unwrap(); + } + let mut response = match writer.send() { Ok(r) => r, Err(e) => { @@ -328,6 +344,13 @@ 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); + chan.send(DevtoolsControlMsg::NetworkEventMessage(request_id, net_event_response)).unwrap(); + } + match encoding_str { Some(encoding) => { if encoding == "gzip" { diff --git a/components/net/image_cache_task.rs b/components/net/image_cache_task.rs index d4e7f3c98b6..b0b488386bf 100644 --- a/components/net/image_cache_task.rs +++ b/components/net/image_cache_task.rs @@ -306,7 +306,7 @@ impl ImageCache { pending_load.add_listener(image_listener); e.insert(pending_load); - let load_data = LoadData::new(url.clone()); + let load_data = LoadData::new(url.clone(), None); let listener = box ResourceListener { url: url, sender: self.progress_sender.clone(), diff --git a/components/net/lib.rs b/components/net/lib.rs index cdc6217b706..d00f458b505 100644 --- a/components/net/lib.rs +++ b/components/net/lib.rs @@ -6,19 +6,16 @@ #![feature(box_syntax)] #![feature(collections)] #![feature(core)] -#![feature(io)] -#![cfg_attr(test, feature(net))] -#![feature(path)] #![feature(path_ext)] #![feature(plugin)] #![feature(rustc_private)] #![feature(std_misc)] -#![feature(unboxed_closures)] #![plugin(regex_macros)] extern crate net_traits; -extern crate "cookie" as cookie_rs; +extern crate cookie as cookie_rs; +extern crate devtools_traits; extern crate collections; extern crate flate2; extern crate geom; @@ -27,11 +24,11 @@ extern crate png; #[macro_use] extern crate log; extern crate openssl; -extern crate profile; -extern crate "rustc-serialize" as rustc_serialize; +extern crate rustc_serialize; extern crate util; extern crate time; extern crate url; +extern crate uuid; extern crate regex; diff --git a/components/net/resource_task.rs b/components/net/resource_task.rs index 15c48d111d9..ac463503a1b 100644 --- a/components/net/resource_task.rs +++ b/components/net/resource_task.rs @@ -18,11 +18,12 @@ use net_traits::ProgressMsg::Done; use util::opts; use util::task::spawn_named; +use devtools_traits::{DevtoolsControlMsg}; use hyper::header::{ContentType, Header, SetCookie, UserAgent}; use hyper::mime::{Mime, TopLevel, SubLevel}; use std::borrow::ToOwned; -use std::boxed; +use std::boxed::{self, FnBox}; use std::collections::HashMap; use std::env; use std::fs::File; @@ -30,7 +31,7 @@ use std::io::{BufReader, Read}; use std::str::FromStr; use std::sync::Arc; use std::sync::mpsc::{channel, Receiver, Sender}; -use std::thunk::Invoke; + static mut HOST_TABLE: Option<*mut HashMap<String, String>> = None; @@ -48,7 +49,7 @@ pub fn global_init() { let mut lines = String::new(); match file.read_to_string(&mut lines) { - Ok(()) => (), + Ok(_) => (), Err(_) => return, }; @@ -137,11 +138,11 @@ pub fn start_sending_opt(start_chan: LoadConsumer, metadata: Metadata) -> Result } /// Create a ResourceTask -pub fn new_resource_task(user_agent: Option<String>) -> 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 || { - ResourceManager::new(setup_port, user_agent, setup_chan_clone).start(); + ResourceManager::new(setup_port, user_agent, setup_chan_clone, devtools_chan).start(); }); setup_chan } @@ -186,17 +187,19 @@ struct ResourceManager { cookie_storage: CookieStorage, resource_task: Sender<ControlMsg>, mime_classifier: Arc<MIMEClassifier>, + devtools_chan: Option<Sender<DevtoolsControlMsg>> } impl ResourceManager { fn new(from_client: Receiver<ControlMsg>, user_agent: Option<String>, - resource_task: Sender<ControlMsg>) -> ResourceManager { + resource_task: Sender<ControlMsg>, devtools_channel: Option<Sender<DevtoolsControlMsg>>) -> ResourceManager { ResourceManager { from_client: from_client, user_agent: user_agent, cookie_storage: CookieStorage::new(), resource_task: resource_task, mime_classifier: Arc::new(MIMEClassifier::new()), + devtools_chan: devtools_channel } } } @@ -239,15 +242,15 @@ impl ResourceManager { self.user_agent.as_ref().map(|ua| load_data.headers.set(UserAgent(ua.clone()))); fn from_factory(factory: fn(LoadData, LoadConsumer, Arc<MIMEClassifier>)) - -> Box<Invoke<(LoadData, LoadConsumer, Arc<MIMEClassifier>)> + Send> { - box move |(load_data, senders, classifier)| { + -> Box<FnBox(LoadData, LoadConsumer, Arc<MIMEClassifier>) + Send> { + box move |load_data, senders, classifier| { factory(load_data, senders, classifier) } } let loader = match &*load_data.url.scheme { "file" => from_factory(file_loader::factory), - "http" | "https" | "view-source" => http_loader::factory(self.resource_task.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), _ => { @@ -259,6 +262,6 @@ impl ResourceManager { }; debug!("resource_task: loading url: {}", load_data.url.serialize()); - loader.invoke((load_data, consumer, self.mime_classifier.clone())); + loader.call_box((load_data, consumer, self.mime_classifier.clone())); } } diff --git a/components/net_traits/Cargo.toml b/components/net_traits/Cargo.toml index f75b04eff49..6f82ca385c6 100644 --- a/components/net_traits/Cargo.toml +++ b/components/net_traits/Cargo.toml @@ -13,12 +13,12 @@ git = "https://github.com/servo/rust-geom" [dependencies.png] git = "https://github.com/servo/rust-png" -[dependencies.profile] -path = "../profile" - [dependencies.util] path = "../util" +[dependencies.msg] +path = "../msg" + [dependencies.stb_image] git = "https://github.com/servo/rust-stb-image" diff --git a/components/net_traits/image/base.rs b/components/net_traits/image/base.rs index 4a14fdd6255..8af32f826d0 100644 --- a/components/net_traits/image/base.rs +++ b/components/net_traits/image/base.rs @@ -4,7 +4,6 @@ use png; use stb_image::image as stb_image2; -use std::iter::range_step; use util::vec::byte_swap; // FIXME: Images must not be copied every frame. Instead we should atomically @@ -14,7 +13,7 @@ pub type Image = png::Image; // TODO(pcwalton): Speed up with SIMD, or better yet, find some way to not do this. fn byte_swap_and_premultiply(data: &mut [u8]) { let length = data.len(); - for i in range_step(0, length, 4) { + for i in (0..length).step_by(4) { let r = data[i + 2]; let g = data[i + 1]; let b = data[i + 0]; diff --git a/components/net_traits/lib.rs b/components/net_traits/lib.rs index 55cb27a0519..c5f5fb884e8 100644 --- a/components/net_traits/lib.rs +++ b/components/net_traits/lib.rs @@ -4,26 +4,27 @@ #![feature(box_syntax)] #![feature(collections)] -#![feature(core)] #![feature(rustc_private)] +#![feature(slice_patterns)] +#![feature(step_by)] extern crate geom; extern crate hyper; #[macro_use] extern crate log; extern crate png; -extern crate profile; extern crate stb_image; extern crate url; extern crate util; +extern crate msg; use hyper::header::{ContentType, Headers}; use hyper::http::RawStatus; use hyper::method::Method; use hyper::mime::{Mime, Attr}; +use msg::constellation_msg::{PipelineId}; use url::Url; -use std::borrow::IntoCow; use std::sync::mpsc::{channel, Receiver, Sender}; pub mod image_cache_task; @@ -48,10 +49,11 @@ pub struct LoadData { pub preserved_headers: Headers, pub data: Option<Vec<u8>>, pub cors: Option<ResourceCORSData>, + pub pipeline_id: Option<PipelineId>, } impl LoadData { - pub fn new(url: Url) -> LoadData { + pub fn new(url: Url, id: Option<PipelineId>) -> LoadData { LoadData { url: url, method: Method::Get, @@ -59,6 +61,7 @@ impl LoadData { preserved_headers: Headers::new(), data: None, cors: None, + pipeline_id: id, } } } @@ -170,7 +173,7 @@ impl Metadata { charset: None, headers: None, // https://fetch.spec.whatwg.org/#concept-response-status-message - status: Some(RawStatus(200, "OK".into_cow())), + status: Some(RawStatus(200, "OK".into())), } } @@ -213,7 +216,7 @@ pub enum ProgressMsg { pub fn load_whole_resource(resource_task: &ResourceTask, url: Url) -> Result<(Metadata, Vec<u8>), String> { let (start_chan, start_port) = channel(); - resource_task.send(ControlMsg::Load(LoadData::new(url), LoadConsumer::Channel(start_chan))).unwrap(); + resource_task.send(ControlMsg::Load(LoadData::new(url, None), LoadConsumer::Channel(start_chan))).unwrap(); let response = start_port.recv().unwrap(); let mut buf = vec!(); @@ -229,7 +232,7 @@ pub fn load_whole_resource(resource_task: &ResourceTask, url: Url) /// Load a URL asynchronously and iterate over chunks of bytes from the response. pub fn load_bytes_iter(resource_task: &ResourceTask, url: Url) -> (Metadata, ProgressMsgPortIterator) { let (input_chan, input_port) = channel(); - resource_task.send(ControlMsg::Load(LoadData::new(url), LoadConsumer::Channel(input_chan))).unwrap(); + resource_task.send(ControlMsg::Load(LoadData::new(url, None), LoadConsumer::Channel(input_chan))).unwrap(); let response = input_port.recv().unwrap(); let iter = ProgressMsgPortIterator { progress_port: response.progress_port }; diff --git a/components/plugins/casing.rs b/components/plugins/casing.rs index 98cefc658b2..f679441dbbd 100644 --- a/components/plugins/casing.rs +++ b/components/plugins/casing.rs @@ -11,17 +11,17 @@ use syntax::parse::token; pub fn expand_lower<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> Box<base::MacResult + 'cx> { - expand_cased(cx, sp, tts, |c| { c.to_lowercase() }) + expand_cased(cx, sp, tts, |s| { s.to_lowercase() }) } pub fn expand_upper<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> Box<base::MacResult + 'cx> { - expand_cased(cx, sp, tts, |c| { c.to_uppercase() }) + expand_cased(cx, sp, tts, |s| { s.to_uppercase() }) } fn expand_cased<'cx, T>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree], transform: T) -> Box<base::MacResult + 'cx> - where T: Fn(char) -> char + where T: Fn(&str) -> String { let es = match base::get_exprs_from_tts(cx, sp, tts) { Some(e) => e, @@ -47,8 +47,7 @@ fn expand_cased<'cx, T>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree], }; match (res, it.count()) { (Some((s, span)), 0) => { - let new_s = s.chars().map(transform).collect::<String>(); - base::MacEager::expr(cx.expr_str(span, token::intern_and_get_ident(&new_s))) + base::MacEager::expr(cx.expr_str(span, token::intern_and_get_ident(&transform(&s)))) } (_, rest) => { if rest > 0 { diff --git a/components/plugins/jstraceable.rs b/components/plugins/jstraceable.rs index 9384ed2038c..0ef1cecea3d 100644 --- a/components/plugins/jstraceable.rs +++ b/components/plugins/jstraceable.rs @@ -47,15 +47,16 @@ pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item: ], associated_types: vec![], }; - trait_def.expand(cx, mitem, item, |a| push(a)) + trait_def.expand(cx, mitem, item, push) } // Mostly copied from syntax::ext::deriving::hash /// Defines how the implementation for `trace()` is to be generated fn jstraceable_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) -> P<Expr> { - let state_expr = match substr.nonself_args { - [ref state_expr] => state_expr, - _ => cx.span_bug(trait_span, "incorrect number of arguments in `jstraceable`") + let state_expr = if substr.nonself_args.len() == 1 { + &substr.nonself_args[0] + } else { + cx.span_bug(trait_span, "incorrect number of arguments in `jstraceable`") }; let trace_ident = substr.method_ident; let call_trace = |span, thing_expr| { diff --git a/components/plugins/lib.rs b/components/plugins/lib.rs index 36045cec078..a8bf2ad8b20 100644 --- a/components/plugins/lib.rs +++ b/components/plugins/lib.rs @@ -12,7 +12,7 @@ //! - `#[dom_struct]` : Implies `#[privatize]`,`#[jstraceable]`, and `#[must_root]`. //! Use this for structs that correspond to a DOM type -#![feature(plugin_registrar, quote, plugin, box_syntax, rustc_private, unicode)] +#![feature(plugin_registrar, quote, plugin, box_syntax, rustc_private, collections)] #[macro_use] extern crate syntax; diff --git a/components/plugins/lints/unrooted_must_root.rs b/components/plugins/lints/unrooted_must_root.rs index 3150c7da5e6..7a39f6cc4d5 100644 --- a/components/plugins/lints/unrooted_must_root.rs +++ b/components/plugins/lints/unrooted_must_root.rs @@ -33,7 +33,7 @@ fn lint_unrooted_ty(cx: &Context, ty: &ast::Ty, warning: &str) { 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::TyPath(..) => { - match cx.tcx.def_map.borrow()[ty.id] { + match cx.tcx.def_map.borrow()[&ty.id] { def::PathResolution{ base_def: def::DefTy(def_id, _), .. } => { if ty::has_attr(cx.tcx, def_id, "must_root") { cx.span_lint(UNROOTED_MUST_ROOT, ty.span, warning); @@ -78,11 +78,11 @@ impl LintPass for UnrootedPass { fn check_fn(&mut self, cx: &Context, kind: visit::FnKind, decl: &ast::FnDecl, block: &ast::Block, _span: codemap::Span, id: ast::NodeId) { match kind { - visit::FkItemFn(i, _, _, _) | + visit::FkItemFn(i, _, _, _, _) | visit::FkMethod(i, _, _) if i.as_str() == "new" || i.as_str() == "new_inherited" => { return; }, - visit::FkItemFn(_, _, style, _) => match style { + visit::FkItemFn(_, _, style, _, _) => match style { ast::Unsafety::Unsafe => return, _ => () }, diff --git a/components/plugins/utils.rs b/components/plugins/utils.rs index 603aa3569a0..3da728481e9 100644 --- a/components/plugins/utils.rs +++ b/components/plugins/utils.rs @@ -69,15 +69,9 @@ pub fn match_lang_ty(cx: &Context, ty: &Ty, value: &str) -> bool { pub fn unsafe_context(map: &ast_map::Map, id: ast::NodeId) -> bool { match map.find(map.get_parent(id)) { Some(ast_map::NodeImplItem(itm)) => { - match *itm { - ast::MethodImplItem(ref meth) => match meth.node { - ast::MethDecl(_, _, _, _, style, _, _, _) => match style { - ast::Unsafety::Unsafe => true, - _ => false, - }, - _ => false, - }, - _ => false, + match itm.node { + ast::MethodImplItem(ref sig, _) => sig.unsafety == ast::Unsafety::Unsafe, + _ => false } }, Some(ast_map::NodeItem(itm)) => { diff --git a/components/profile/Cargo.toml b/components/profile/Cargo.toml index de9fb13a597..dfb3a187e30 100644 --- a/components/profile/Cargo.toml +++ b/components/profile/Cargo.toml @@ -7,6 +7,9 @@ authors = ["The Servo Project Developers"] name = "profile" path = "lib.rs" +[dependencies.profile_traits] +path = "../profile_traits" + [dependencies.task_info] path = "../../support/rust-task_info" @@ -17,4 +20,3 @@ path = "../util" libc = "*" regex = "0.1.14" time = "0.1.12" -url = "0.2.16" diff --git a/components/profile/lib.rs b/components/profile/lib.rs index 55a59065a4e..ab60d36f86e 100644 --- a/components/profile/lib.rs +++ b/components/profile/lib.rs @@ -5,24 +5,21 @@ #![feature(box_syntax)] #![feature(collections)] #![feature(core)] -#![cfg_attr(target_os="linux", feature(io))] -#![feature(old_io)] #![cfg_attr(target_os="linux", feature(page_size))] #![feature(rustc_private)] -#![feature(std_misc)] -#![cfg_attr(target_os="linux", feature(str_words))] #[macro_use] extern crate log; extern crate collections; extern crate libc; +#[macro_use] +extern crate profile_traits; #[cfg(target_os="linux")] extern crate regex; #[cfg(target_os="macos")] extern crate task_info; -extern crate "time" as std_time; +extern crate time as std_time; extern crate util; -extern crate url; pub mod mem; pub mod time; diff --git a/components/profile/mem.rs b/components/profile/mem.rs index 522ebe896b4..26aff02bb05 100644 --- a/components/profile/mem.rs +++ b/components/profile/mem.rs @@ -4,83 +4,15 @@ //! Memory profiling functions. +use profile_traits::mem::{ProfilerChan, ProfilerMsg, Reporter, ReportsChan}; use self::system_reporter::SystemReporter; use std::borrow::ToOwned; use std::cmp::Ordering; use std::collections::HashMap; -use std::old_io::timer::sleep; -use std::sync::mpsc::{Sender, channel, Receiver}; -use std::time::duration::Duration; +use std::thread::sleep_ms; +use std::sync::mpsc::{channel, Receiver}; use util::task::spawn_named; -#[derive(Clone)] -pub struct ProfilerChan(pub Sender<ProfilerMsg>); - -impl ProfilerChan { - pub fn send(&self, msg: ProfilerMsg) { - let ProfilerChan(ref c) = *self; - c.send(msg).unwrap(); - } -} - -/// An easy way to build a path for a report. -#[macro_export] -macro_rules! path { - ($($x:expr),*) => {{ - use std::borrow::ToOwned; - vec![$( $x.to_owned() ),*] - }} -} - -/// A single memory-related measurement. -pub struct Report { - /// The identifying path for this report. - pub path: Vec<String>, - - /// The size, in bytes. - pub size: usize, -} - -/// A channel through which memory reports can be sent. -#[derive(Clone)] -pub struct ReportsChan(pub Sender<Vec<Report>>); - -impl ReportsChan { - pub fn send(&self, report: Vec<Report>) { - let ReportsChan(ref c) = *self; - c.send(report).unwrap(); - } -} - -/// A memory reporter is capable of measuring some data structure of interest. Because it needs -/// to be passed to and registered with the Profiler, it's typically a "small" (i.e. easily -/// cloneable) value that provides access to a "large" data structure, e.g. a channel that can -/// inject a request for measurements into the event queue associated with the "large" data -/// structure. -pub trait Reporter { - /// Collect one or more memory reports. Returns true on success, and false on failure. - fn collect_reports(&self, reports_chan: ReportsChan) -> bool; -} - -/// Messages that can be sent to the memory profiler thread. -pub enum ProfilerMsg { - /// Register a Reporter with the memory profiler. The String is only used to identify the - /// reporter so it can be unregistered later. The String must be distinct from that used by any - /// other registered reporter otherwise a panic will occur. - RegisterReporter(String, Box<Reporter + Send>), - - /// Unregister a Reporter with the memory profiler. The String must match the name given when - /// the reporter was registered. If the String does not match the name of a registered reporter - /// a panic will occur. - UnregisterReporter(String), - - /// Triggers printing of the memory profiling metrics. - Print, - - /// Tells the memory profiler to shut down. - Exit, -} - pub struct Profiler { /// The port through which messages are received. pub port: Receiver<ProfilerMsg>, @@ -95,11 +27,11 @@ impl Profiler { // Create the timer thread if a period was provided. if let Some(period) = period { - let period_ms = Duration::milliseconds((period * 1000f64) as i64); + let period_ms = (period * 1000.) as u32; let chan = chan.clone(); spawn_named("Memory profiler timer".to_owned(), move || { loop { - sleep(period_ms); + sleep_ms(period_ms); if chan.send(ProfilerMsg::Print).is_err() { break; } @@ -363,11 +295,11 @@ impl ReportsForest { mod system_reporter { use libc::{c_char, c_int, c_void, size_t}; + use profile_traits::mem::{Report, Reporter, ReportsChan}; use std::borrow::ToOwned; use std::ffi::CString; use std::mem::size_of; use std::ptr::null_mut; - use super::{Report, Reporter, ReportsChan}; #[cfg(target_os="macos")] use task_info::task_basic_info::{virtual_size, resident_size}; @@ -511,7 +443,7 @@ mod system_reporter { let mut f = option_try!(File::open("/proc/self/statm").ok()); let mut contents = String::new(); option_try!(f.read_to_string(&mut contents).ok()); - let s = option_try!(contents.words().nth(field)); + let s = option_try!(contents.split_whitespace().nth(field)); let npages = option_try!(s.parse::<usize>().ok()); Some(npages * ::std::env::page_size()) } @@ -552,7 +484,7 @@ mod system_reporter { use std::collections::HashMap; use std::collections::hash_map::Entry; use std::fs::File; - use std::io::{BufReader, BufReadExt}; + use std::io::{BufReader, BufRead}; // The first line of an entry in /proc/<pid>/smaps looks just like an entry // in /proc/<pid>/maps: diff --git a/components/profile/time.rs b/components/profile/time.rs index 8b85f4d8e7c..464796006fa 100644 --- a/components/profile/time.rs +++ b/components/profile/time.rs @@ -5,36 +5,15 @@ //! Timing functions. use collections::BTreeMap; +use profile_traits::time::{ProfilerCategory, ProfilerChan, ProfilerMsg, TimerMetadata}; use std::borrow::ToOwned; use std::cmp::Ordering; use std::f64; -use std::old_io::timer::sleep; -use std::iter::AdditiveIterator; -use std::num::Float; -use std::sync::mpsc::{Sender, channel, Receiver}; -use std::time::duration::Duration; +use std::sync::mpsc::{channel, Receiver}; +use std::thread::sleep_ms; use std_time::precise_time_ns; -use url::Url; use util::task::spawn_named; -// front-end representation of the profiler used to communicate with the profiler -#[derive(Clone)] -pub struct ProfilerChan(pub Sender<ProfilerMsg>); - -impl ProfilerChan { - pub fn send(&self, msg: ProfilerMsg) { - let ProfilerChan(ref c) = *self; - c.send(msg).unwrap(); - } -} - -#[derive(PartialEq, Clone, PartialOrd, Eq, Ord)] -pub struct TimerMetadata { - url: String, - iframe: bool, - incremental: bool, -} - pub trait Formattable { fn format(&self) -> String; } @@ -60,38 +39,6 @@ impl Formattable for Option<TimerMetadata> { } } -#[derive(Clone)] -pub enum ProfilerMsg { - /// Normal message used for reporting time - Time((ProfilerCategory, Option<TimerMetadata>), f64), - /// Message used to force print the profiling metrics - Print, - /// Tells the profiler to shut down. - Exit, -} - -#[repr(u32)] -#[derive(PartialEq, Clone, PartialOrd, Eq, Ord)] -pub enum ProfilerCategory { - Compositing, - LayoutPerform, - LayoutStyleRecalc, - LayoutRestyleDamagePropagation, - LayoutNonIncrementalReset, - LayoutSelectorMatch, - LayoutTreeBuilder, - LayoutDamagePropagate, - LayoutGeneratedContent, - LayoutMain, - LayoutParallelWarmup, - LayoutShaping, - LayoutDispListBuild, - PaintingPerTile, - PaintingPrepBuff, - Painting, - ImageDecoding, -} - impl Formattable for ProfilerCategory { // some categories are subcategories of LayoutPerformCategory // and should be printed to indicate this @@ -149,11 +96,11 @@ impl Profiler { let (chan, port) = channel(); match period { Some(period) => { - let period = Duration::milliseconds((period * 1000f64) as i64); + let period = (period * 1000.) as u32; let chan = chan.clone(); spawn_named("Time profiler timer".to_owned(), move || { loop { - sleep(period); + sleep_ms(period); if chan.send(ProfilerMsg::Print).is_err() { break; } @@ -242,7 +189,7 @@ impl Profiler { let data_len = data.len(); if data_len > 0 { let (mean, median, min, max) = - (data.iter().map(|&x|x).sum() / (data_len as f64), + (data.iter().map(|&x|x).sum::<f64>() / (data_len as f64), data[data_len / 2], data.iter().fold(f64::INFINITY, |a, &b| a.min(b)), data.iter().fold(-f64::INFINITY, |a, &b| a.max(b))); @@ -254,41 +201,6 @@ impl Profiler { } } -#[derive(Eq, PartialEq)] -pub enum TimerMetadataFrameType { - RootWindow, - IFrame, -} - -#[derive(Eq, PartialEq)] -pub enum TimerMetadataReflowType { - Incremental, - FirstReflow, -} - -pub type ProfilerMetadata<'a> = Option<(&'a Url, TimerMetadataFrameType, TimerMetadataReflowType)>; - -pub fn profile<T, F>(category: ProfilerCategory, - meta: ProfilerMetadata, - profiler_chan: ProfilerChan, - callback: F) - -> T - where F: FnOnce() -> T -{ - let start_time = precise_time_ns(); - let val = callback(); - let end_time = precise_time_ns(); - let ms = (end_time - start_time) as f64 / 1000000f64; - let meta = meta.map(|(url, iframe, reflow_type)| - TimerMetadata { - url: url.serialize(), - iframe: iframe == TimerMetadataFrameType::IFrame, - incremental: reflow_type == TimerMetadataReflowType::Incremental, - }); - profiler_chan.send(ProfilerMsg::Time((category, meta), ms)); - return val; -} - pub fn time<T, F>(msg: &str, callback: F) -> T where F: Fn() -> T { diff --git a/components/profile_traits/Cargo.toml b/components/profile_traits/Cargo.toml new file mode 100644 index 00000000000..eb9da970c20 --- /dev/null +++ b/components/profile_traits/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "profile_traits" +version = "0.0.1" +authors = ["The Servo Project Developers"] + +[lib] +name = "profile_traits" +path = "lib.rs" + +[dependencies] +time = "0.1.12" +url = "0.2.16" + diff --git a/components/profile_traits/lib.rs b/components/profile_traits/lib.rs new file mode 100644 index 00000000000..25dbb0b4c5b --- /dev/null +++ b/components/profile_traits/lib.rs @@ -0,0 +1,6 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +pub mod mem; +pub mod time; diff --git a/components/profile_traits/mem.rs b/components/profile_traits/mem.rs new file mode 100644 index 00000000000..f31e6f73358 --- /dev/null +++ b/components/profile_traits/mem.rs @@ -0,0 +1,72 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use std::sync::mpsc::Sender; + +#[derive(Clone)] +pub struct ProfilerChan(pub Sender<ProfilerMsg>); + +impl ProfilerChan { + pub fn send(&self, msg: ProfilerMsg) { + let ProfilerChan(ref c) = *self; + c.send(msg).unwrap(); + } +} + +/// A single memory-related measurement. +pub struct Report { + /// The identifying path for this report. + pub path: Vec<String>, + + /// The size, in bytes. + pub size: usize, +} + +/// A channel through which memory reports can be sent. +#[derive(Clone)] +pub struct ReportsChan(pub Sender<Vec<Report>>); + +impl ReportsChan { + pub fn send(&self, report: Vec<Report>) { + let ReportsChan(ref c) = *self; + c.send(report).unwrap(); + } +} + +/// A memory reporter is capable of measuring some data structure of interest. Because it needs to +/// be passed to and registered with the Profiler, it's typically a "small" (i.e. easily cloneable) +/// value that provides access to a "large" data structure, e.g. a channel that can inject a +/// request for measurements into the event queue associated with the "large" data structure. +pub trait Reporter { + /// Collect one or more memory reports. Returns true on success, and false on failure. + fn collect_reports(&self, reports_chan: ReportsChan) -> bool; +} + +/// An easy way to build a path for a report. +#[macro_export] +macro_rules! path { + ($($x:expr),*) => {{ + use std::borrow::ToOwned; + vec![$( $x.to_owned() ),*] + }} +} + +/// Messages that can be sent to the memory profiler thread. +pub enum ProfilerMsg { + /// Register a Reporter with the memory profiler. The String is only used to identify the + /// reporter so it can be unregistered later. The String must be distinct from that used by any + /// other registered reporter otherwise a panic will occur. + RegisterReporter(String, Box<Reporter + Send>), + + /// Unregister a Reporter with the memory profiler. The String must match the name given when + /// the reporter was registered. If the String does not match the name of a registered reporter + /// a panic will occur. + UnregisterReporter(String), + + /// Triggers printing of the memory profiling metrics. + Print, + + /// Tells the memory profiler to shut down. + Exit, +} diff --git a/components/profile_traits/time.rs b/components/profile_traits/time.rs new file mode 100644 index 00000000000..f49940a168f --- /dev/null +++ b/components/profile_traits/time.rs @@ -0,0 +1,95 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +extern crate time as std_time; +extern crate url; + +use self::std_time::precise_time_ns; +use self::url::Url; +use std::sync::mpsc::Sender; + +#[derive(PartialEq, Clone, PartialOrd, Eq, Ord)] +pub struct TimerMetadata { + pub url: String, + pub iframe: bool, + pub incremental: bool, +} + +#[derive(Clone)] +pub struct ProfilerChan(pub Sender<ProfilerMsg>); + +impl ProfilerChan { + pub fn send(&self, msg: ProfilerMsg) { + let ProfilerChan(ref c) = *self; + c.send(msg).unwrap(); + } +} + +#[derive(Clone)] +pub enum ProfilerMsg { + /// Normal message used for reporting time + Time((ProfilerCategory, Option<TimerMetadata>), f64), + /// Message used to force print the profiling metrics + Print, + /// Tells the profiler to shut down. + Exit, +} + +#[repr(u32)] +#[derive(PartialEq, Clone, PartialOrd, Eq, Ord)] +pub enum ProfilerCategory { + Compositing, + LayoutPerform, + LayoutStyleRecalc, + LayoutRestyleDamagePropagation, + LayoutNonIncrementalReset, + LayoutSelectorMatch, + LayoutTreeBuilder, + LayoutDamagePropagate, + LayoutGeneratedContent, + LayoutMain, + LayoutParallelWarmup, + LayoutShaping, + LayoutDispListBuild, + PaintingPerTile, + PaintingPrepBuff, + Painting, + ImageDecoding, +} + +#[derive(Eq, PartialEq)] +pub enum TimerMetadataFrameType { + RootWindow, + IFrame, +} + +#[derive(Eq, PartialEq)] +pub enum TimerMetadataReflowType { + Incremental, + FirstReflow, +} + +pub type ProfilerMetadata<'a> = + Option<(&'a Url, TimerMetadataFrameType, TimerMetadataReflowType)>; + +pub fn profile<T, F>(category: ProfilerCategory, + meta: ProfilerMetadata, + profiler_chan: ProfilerChan, + callback: F) + -> T + where F: FnOnce() -> T +{ + let start_time = precise_time_ns(); + let val = callback(); + let end_time = precise_time_ns(); + let ms = (end_time - start_time) as f64 / 1000000f64; + let meta = meta.map(|(url, iframe, reflow_type)| + TimerMetadata { + url: url.serialize(), + iframe: iframe == TimerMetadataFrameType::IFrame, + incremental: reflow_type == TimerMetadataReflowType::Incremental, + }); + profiler_chan.send(ProfilerMsg::Time((category, meta), ms)); + return val; +} diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index 50607cabefe..ac3c05fbb6d 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -24,8 +24,8 @@ path = "../msg" [dependencies.net_traits] path = "../net_traits" -[dependencies.profile] -path = "../profile" +[dependencies.profile_traits] +path = "../profile_traits" [dependencies.script_traits] path = "../script_traits" @@ -45,9 +45,6 @@ path = "../canvas" [dependencies.webdriver_traits] path = "../webdriver_traits" -[dependencies.cssparser] -git = "https://github.com/servo/rust-cssparser" - [dependencies.selectors] git = "https://github.com/servo/rust-selectors" @@ -63,9 +60,6 @@ git = "https://github.com/servo/rust-mozjs" [dependencies.png] git = "https://github.com/servo/rust-png" -[dependencies.uuid] -git = "https://github.com/rust-lang/uuid" - [dependencies.string_cache] git = "https://github.com/servo/string-cache" @@ -80,3 +74,8 @@ bitflags = "*" rustc-serialize = "*" libc = "*" hyper = "0.3" +cssparser = "0.3.1" +unicase = "0.1" +num = "0.1.24" +websocket = "0.11.0" +uuid = "0.1.16" diff --git a/components/script/clipboard_provider.rs b/components/script/clipboard_provider.rs new file mode 100644 index 00000000000..060c857b64b --- /dev/null +++ b/components/script/clipboard_provider.rs @@ -0,0 +1,48 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use msg::constellation_msg::ConstellationChan; +use msg::constellation_msg::Msg as ConstellationMsg; + +use collections::borrow::ToOwned; +use std::sync::mpsc::channel; + +pub trait ClipboardProvider { + // blocking method to get the clipboard contents + fn get_clipboard_contents(&mut self) -> String; + // blocking method to set the clipboard contents + fn set_clipboard_contents(&mut self, &str); +} + +impl ClipboardProvider for ConstellationChan { + fn get_clipboard_contents(&mut self) -> String { + let (tx, rx) = channel(); + self.0.send(ConstellationMsg::GetClipboardContents(tx)).unwrap(); + rx.recv().unwrap() + } + fn set_clipboard_contents(&mut self, _: &str) { + panic!("not yet implemented"); + } +} + +pub struct DummyClipboardContext { + content: String +} + +impl DummyClipboardContext { + pub fn new(s: &str) -> DummyClipboardContext { + DummyClipboardContext { + content: s.to_owned() + } + } +} + +impl ClipboardProvider for DummyClipboardContext { + fn get_clipboard_contents(&mut self) -> String { + self.content.clone() + } + fn set_clipboard_contents(&mut self, s: &str) { + self.content = s.to_owned(); + } +} diff --git a/components/script/cors.rs b/components/script/cors.rs index a4044a52568..cd7d0828564 100644 --- a/components/script/cors.rs +++ b/components/script/cors.rs @@ -30,6 +30,7 @@ use hyper::header::{ContentType, Host}; use hyper::method::Method; use hyper::status::StatusClass::Success; +use unicase::UniCase; use url::{SchemeData, Url}; use util::task::spawn_named; @@ -185,10 +186,10 @@ impl CORSRequest { // Step 5 - 7 let mut header_names = vec!(); for header in self.headers.iter() { - header_names.push(header.name().to_ascii_lowercase()); + header_names.push(header.name().to_owned()); } header_names.sort(); - preflight.headers.set(AccessControlRequestHeaders(header_names)); + preflight.headers.set(AccessControlRequestHeaders(header_names.into_iter().map(UniCase).collect())); // Step 8 unnecessary, we don't use the request body // Step 9, 10 unnecessary, we're writing our own fetch code @@ -446,8 +447,8 @@ fn is_simple_method(m: &Method) -> bool { pub fn allow_cross_origin_request(req: &CORSRequest, headers: &Headers) -> bool { //FIXME(seanmonstar): use req.headers.get::<AccessControlAllowOrigin>() match headers.get() { - Some(&AccessControlAllowOrigin::AllowStar) => true, // Not always true, depends on credentials mode - Some(&AccessControlAllowOrigin::AllowOrigin(ref url)) => + Some(&AccessControlAllowOrigin::Any) => true, // Not always true, depends on credentials mode + Some(&AccessControlAllowOrigin::Value(ref url)) => url.scheme == req.origin.scheme && url.host() == req.origin.host() && url.port() == req.origin.port(), diff --git a/components/script/devtools.rs b/components/script/devtools.rs index cdc0537fa15..d67f57b4e4f 100644 --- a/components/script/devtools.rs +++ b/components/script/devtools.rs @@ -14,7 +14,7 @@ use dom::node::{Node, NodeHelpers}; use dom::window::{WindowHelpers, ScriptHelpers}; use dom::element::Element; use dom::document::DocumentHelpers; -use page::Page; +use page::{IterablePage, Page}; use msg::constellation_msg::PipelineId; use script_task::{get_page, ScriptTask}; @@ -147,3 +147,9 @@ pub fn handle_drop_timeline_markers(page: &Rc<Page>, } } } + +pub fn handle_request_animation_frame(page: &Rc<Page>, id: PipelineId, callback: Box<Fn(f64, )>) { + let page = page.find(id).expect("There is no such page"); + let doc = page.document().root(); + doc.r().request_animation_frame(callback); +} diff --git a/components/script/dom/activation.rs b/components/script/dom/activation.rs index 047d3a5c4df..dbbe4689e1b 100644 --- a/components/script/dom/activation.rs +++ b/components/script/dom/activation.rs @@ -14,7 +14,7 @@ use dom::node::window_from_node; use std::borrow::ToOwned; /// Trait for elements with defined activation behavior -pub trait Activatable : Copy { +pub trait Activatable { fn as_element(&self) -> Temporary<Element>; // Is this particular instance of the element activatable? diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs index 88384aabe5f..3e3979dbaef 100644 --- a/components/script/dom/attr.rs +++ b/components/script/dom/attr.rs @@ -54,8 +54,25 @@ impl AttrValue { AttrValue::TokenList(tokens, atoms) } + // https://html.spec.whatwg.org/multipage/#reflecting-content-attributes-in-idl-attributes:idl-unsigned-long pub fn from_u32(string: DOMString, default: u32) -> AttrValue { let result = parse_unsigned_integer(string.chars()).unwrap_or(default); + let result = if result > 2147483647 { + default + } else { + result + }; + AttrValue::UInt(string, result) + } + + // https://html.spec.whatwg.org/multipage/#limited-to-only-non-negative-numbers-greater-than-zero + pub fn from_limited_u32(string: DOMString, default: u32) -> AttrValue { + let result = parse_unsigned_integer(string.chars()).unwrap_or(default); + let result = if result == 0 || result > 2147483647 { + default + } else { + result + }; AttrValue::UInt(string, result) } diff --git a/components/script/dom/bindings/conversions.rs b/components/script/dom/bindings/conversions.rs index aa509ad5927..089193cca43 100644 --- a/components/script/dom/bindings/conversions.rs +++ b/components/script/dom/bindings/conversions.rs @@ -56,15 +56,14 @@ use js::jsval::{UndefinedValue, NullValue, BooleanValue, Int32Value, UInt32Value use js::jsval::{StringValue, ObjectValue, ObjectOrNullValue}; use libc; +use num::Float; use std::borrow::ToOwned; use std::default; -use std::marker::MarkerTrait; -use std::num::Float; use std::slice; /// A trait to retrieve the constants necessary to check if a `JSObject` /// implements a given interface. -pub trait IDLInterface: MarkerTrait { +pub trait IDLInterface { /// Returns the prototype ID. fn get_prototype_id() -> PrototypeList::ID; /// Returns the prototype depth, i.e., the number of interfaces this @@ -400,9 +399,8 @@ impl FromJSValConvertible for USVString { impl ToJSValConvertible for ByteString { fn to_jsval(&self, cx: *mut JSContext) -> JSVal { unsafe { - let slice = self.as_slice(); - let jsstr = JS_NewStringCopyN(cx, slice.as_ptr() as *const libc::c_char, - slice.len() as libc::size_t); + let jsstr = JS_NewStringCopyN(cx, self.as_ptr() as *const libc::c_char, + self.len() as libc::size_t); if jsstr.is_null() { panic!("JS_NewStringCopyN failed"); } diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs index c80aa48b4ac..fc22078360f 100644 --- a/components/script/dom/bindings/js.rs +++ b/components/script/dom/bindings/js.rs @@ -593,7 +593,7 @@ impl RootCollection { /// `RootCollection` object. Attempts to transfer ownership of a `Root` via /// moving will trigger dynamic unrooting failures due to incorrect ordering. #[no_move] -pub struct Root<T> { +pub struct Root<T: Reflectable> { /// List that ensures correct dynamic root ordering root_list: &'static RootCollection, /// Reference to rooted value that must not outlive this container @@ -641,7 +641,6 @@ impl<T: Reflectable> Root<T> { } } -#[unsafe_destructor] impl<T: Reflectable> Drop for Root<T> { fn drop(&mut self) { self.root_list.unroot(self); diff --git a/components/script/dom/bindings/num.rs b/components/script/dom/bindings/num.rs index 353a395784b..d0ceaae89f8 100644 --- a/components/script/dom/bindings/num.rs +++ b/components/script/dom/bindings/num.rs @@ -5,7 +5,7 @@ //! The `Finite<T>` struct. use core::nonzero::Zeroable; -use std::num::Float; +use num::Float; use std::ops::Deref; /// Encapsulates the IDL restricted float type. diff --git a/components/script/dom/bindings/refcounted.rs b/components/script/dom/bindings/refcounted.rs index 8a626ac6b67..046ae913b50 100644 --- a/components/script/dom/bindings/refcounted.rs +++ b/components/script/dom/bindings/refcounted.rs @@ -47,7 +47,7 @@ unsafe impl Send for TrustedReference {} /// shared among tasks for use in asynchronous operations. The underlying /// DOM object is guaranteed to live at least as long as the last outstanding /// `Trusted<T>` instance. -pub struct Trusted<T> { +pub struct Trusted<T: Reflectable> { /// A pointer to the Rust DOM object of type T, but void to allow /// sending `Trusted<T>` between tasks, regardless of T's sendability. ptr: *const libc::c_void, @@ -110,7 +110,6 @@ impl<T: Reflectable> Clone for Trusted<T> { } } -#[unsafe_destructor] impl<T: Reflectable> Drop for Trusted<T> { fn drop(&mut self) { let mut refcount = self.refcount.lock().unwrap(); diff --git a/components/script/dom/bindings/str.rs b/components/script/dom/bindings/str.rs index fff381e98f8..b8c0af0caa6 100644 --- a/components/script/dom/bindings/str.rs +++ b/components/script/dom/bindings/str.rs @@ -4,8 +4,10 @@ //! The `ByteString` struct. +use std::ascii::AsciiExt; use std::borrow::ToOwned; use std::hash::{Hash, Hasher}; +use std::ops; use std::str; use std::str::FromStr; @@ -27,12 +29,6 @@ impl ByteString { str::from_utf8(&vec).ok() } - /// Returns the underlying vector as a slice. - pub fn as_slice<'a>(&'a self) -> &'a [u8] { - let ByteString(ref vector) = *self; - vector - } - /// Returns the length. pub fn len(&self) -> usize { let ByteString(ref vector) = *self; @@ -41,20 +37,12 @@ impl ByteString { /// Compare `self` to `other`, matching A–Z and a–z as equal. pub fn eq_ignore_case(&self, other: &ByteString) -> bool { - // XXXManishearth make this more efficient - self.to_lower() == other.to_lower() + self.0.eq_ignore_ascii_case(&other.0) } /// Returns `self` with A–Z replaced by a–z. pub fn to_lower(&self) -> ByteString { - let ByteString(ref vec) = *self; - ByteString::new(vec.iter().map(|&x| { - if x > 'A' as u8 && x < 'Z' as u8 { - x + ('a' as u8) - ('A' as u8) - } else { - x - } - }).collect()) + ByteString::new(self.0.to_ascii_lowercase()) } /// Returns whether `self` is a `token`, as defined by @@ -158,6 +146,13 @@ impl FromStr for ByteString { } } +impl ops::Deref for ByteString { + type Target = [u8]; + fn deref(&self) -> &[u8] { + &self.0 + } +} + /// A string that is constructed from a UCS-2 buffer by replacing invalid code /// points with the replacement character. pub struct USVString(pub String); diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index c25b0addc47..31f1a78f717 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -56,7 +56,7 @@ use script_traits::UntrustedNodeAddress; use msg::compositor_msg::ScriptListener; use msg::constellation_msg::ConstellationChan; use net_traits::image::base::Image; -use util::smallvec::{SmallVec1, SmallVec}; +use util::smallvec::SmallVec1; use util::str::{LengthOrPercentageOrAuto}; use std::cell::{Cell, RefCell}; use std::collections::{HashMap, HashSet}; @@ -64,7 +64,6 @@ use std::collections::hash_state::HashState; use std::ffi::CString; use std::hash::{Hash, Hasher}; use std::intrinsics::return_address; -use std::old_io::timer::Timer; use std::ops::{Deref, DerefMut}; use std::rc::Rc; use std::sync::Arc; @@ -99,7 +98,7 @@ pub fn trace_jsval(tracer: *mut JSTracer, description: &str, val: JSVal) { unsafe { let name = CString::new(description).unwrap(); (*tracer).debugPrinter = None; - (*tracer).debugPrintIndex = -1; + (*tracer).debugPrintIndex = !0; (*tracer).debugPrintArg = name.as_ptr() as *const libc::c_void; debug!("tracing value {}", description); JS_CallTracer(tracer, val.to_gcthing(), val.trace_kind()); @@ -117,7 +116,7 @@ pub fn trace_object(tracer: *mut JSTracer, description: &str, obj: *mut JSObject unsafe { let name = CString::new(description).unwrap(); (*tracer).debugPrinter = None; - (*tracer).debugPrintIndex = -1; + (*tracer).debugPrintIndex = !0; (*tracer).debugPrintArg = name.as_ptr() as *const libc::c_void; debug!("tracing {}", description); JS_CallTracer(tracer, obj as *mut libc::c_void, JSGCTraceKind::JSTRACE_OBJECT); @@ -252,7 +251,7 @@ no_jsmanaged_fields!(Receiver<T>); no_jsmanaged_fields!(Rect<T>); no_jsmanaged_fields!(Arc<T>); no_jsmanaged_fields!(Image, ImageCacheChan, ImageCacheTask, ScriptControlChan); -no_jsmanaged_fields!(Atom, Namespace, Timer); +no_jsmanaged_fields!(Atom, Namespace); no_jsmanaged_fields!(Trusted<T>); no_jsmanaged_fields!(PropertyDeclarationBlock); no_jsmanaged_fields!(HashSet<T>); @@ -282,6 +281,13 @@ impl JSTraceable for Box<ScriptChan+Send> { } } +impl JSTraceable for Box<Fn(f64, )> { + #[inline] + fn trace(&self, _trc: *mut JSTracer) { + // Do nothing + } +} + impl<'a> JSTraceable for &'a str { #[inline] fn trace(&self, _: *mut JSTracer) { @@ -318,16 +324,20 @@ impl JSTraceable for () { /// Holds a set of vectors that need to be rooted pub struct RootedCollectionSet { - set: Vec<HashSet<*const RootedVec<()>>> + set: Vec<HashSet<*const RootedVec<Void>>> } /// TLV Holds a set of vectors that need to be rooted thread_local!(pub static ROOTED_COLLECTIONS: Rc<RefCell<RootedCollectionSet>> = Rc::new(RefCell::new(RootedCollectionSet::new()))); -enum CollectionType { +/// Type of `RootedVec` +pub enum CollectionType { + /// DOM objects DOMObjects, + /// `JSVal`s JSVals, + /// `*mut JSObject`s JSObjects, } @@ -356,10 +366,12 @@ impl RootedCollectionSet { } unsafe fn trace(&self, tracer: *mut JSTracer) { - fn trace_collection_type<T: JSTraceable>(tracer: *mut JSTracer, - collections: &HashSet<*const RootedVec<()>>) { + fn trace_collection_type<T>(tracer: *mut JSTracer, + collections: &HashSet<*const RootedVec<Void>>) + where T: JSTraceable + VecRootableType + { for collection in collections { - let collection: *const RootedVec<()> = *collection; + let collection: *const RootedVec<Void> = *collection; let collection = collection as *const RootedVec<T>; unsafe { let _ = (*collection).trace(tracer); @@ -367,10 +379,10 @@ impl RootedCollectionSet { } } - let dom_collections = &self.set[CollectionType::DOMObjects as usize] as *const _ as *const HashSet<*const RootedVec<*const Reflector>>; + 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); + trace_reflector(tracer, "", reflector.reflector()); } } @@ -381,7 +393,7 @@ impl RootedCollectionSet { /// Trait implemented by all types that can be used with RootedVec -trait VecRootableType { +pub trait VecRootableType { /// Return the type tag used to determine how to trace RootedVec fn tag(_a: Option<Self>) -> CollectionType; } @@ -398,11 +410,21 @@ impl VecRootableType for *mut JSObject { fn tag(_a: Option<*mut JSObject>) -> CollectionType { CollectionType::JSObjects } } +enum Void {} + +impl VecRootableType for Void { + fn tag(_a: Option<Void>) -> CollectionType { unreachable!() } +} + +impl Reflectable for Void { + fn reflector<'a>(&'a self) -> &'a Reflector { unreachable!() } +} + /// A vector of items that are rooted for the lifetime /// of this struct #[allow(unrooted_must_root)] #[no_move] -pub struct RootedVec<T> { +pub struct RootedVec<T: VecRootableType> { v: Vec<T> } @@ -428,21 +450,20 @@ impl<T: VecRootableType> RootedVec<T> { } } -#[unsafe_destructor] impl<T: VecRootableType> Drop for RootedVec<T> { fn drop(&mut self) { RootedCollectionSet::remove(self); } } -impl<T> Deref for RootedVec<T> { +impl<T: VecRootableType> Deref for RootedVec<T> { type Target = Vec<T>; fn deref(&self) -> &Vec<T> { &self.v } } -impl<T> DerefMut for RootedVec<T> { +impl<T: VecRootableType> DerefMut for RootedVec<T> { fn deref_mut(&mut self) -> &mut Vec<T> { &mut self.v } diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs index 2c96fa2c0dd..55933484165 100644 --- a/components/script/dom/bindings/utils.rs +++ b/components/script/dom/bindings/utils.rs @@ -639,7 +639,7 @@ pub fn validate_and_extract(namespace: Option<DOMString>, qualified_name: &str) let (prefix, local_name) = if qualified_name.contains(":") { // Step 5. - let mut parts = qualified_name.splitn(1, ':'); + let mut parts = qualified_name.splitn(2, ':'); let prefix = parts.next().unwrap(); debug_assert!(!prefix.is_empty()); let local_name = parts.next().unwrap(); diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index 47d03d72082..b27a0c3e7e9 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -12,10 +12,10 @@ use dom::bindings::codegen::Bindings::BlobBinding::BlobMethods; use util::str::DOMString; +use num::ToPrimitive; use std::ascii::AsciiExt; use std::borrow::ToOwned; use std::cmp::{min, max}; -use std::num::ToPrimitive; #[jstraceable] pub enum BlobTypeId { diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs index cd02eb18f0e..6353479b116 100644 --- a/components/script/dom/canvasrenderingcontext2d.rs +++ b/components/script/dom/canvasrenderingcontext2d.rs @@ -6,6 +6,7 @@ use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding; use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasRenderingContext2DMethods; use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasWindingRule; use dom::bindings::codegen::Bindings::ImageDataBinding::ImageDataMethods; +use dom::bindings::codegen::InheritTypes::NodeCast; use dom::bindings::codegen::UnionTypes::HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D; use dom::bindings::codegen::UnionTypes::StringOrCanvasGradientOrCanvasPattern; use dom::bindings::error::Error::{IndexSize, NotSupported, Type, InvalidState}; @@ -18,7 +19,7 @@ use dom::canvasgradient::{CanvasGradient, CanvasGradientStyle, ToFillOrStrokeSty use dom::htmlcanvaselement::{HTMLCanvasElement, HTMLCanvasElementHelpers}; use dom::htmlimageelement::{HTMLImageElement, HTMLImageElementHelpers}; use dom::imagedata::{ImageData, ImageDataHelpers}; -use dom::node::{window_from_node}; +use dom::node::{window_from_node, NodeHelpers, NodeDamage}; use cssparser::Color as CSSColor; use cssparser::{Parser, RGBA, ToCss}; @@ -36,9 +37,9 @@ use net_traits::image::base::Image; use net_traits::image_cache_task::ImageCacheChan; use png::PixelsByColorType; +use num::{Float, ToPrimitive}; use std::borrow::ToOwned; use std::cell::RefCell; -use std::num::{Float, ToPrimitive}; use std::sync::{Arc}; use std::sync::mpsc::{channel, Sender}; @@ -118,6 +119,12 @@ impl CanvasRenderingContext2D { self.renderer.send(CanvasMsg::Common(CanvasCommonMsg::Recreate(size))).unwrap(); } + fn mark_as_dirty(&self) { + let canvas = self.canvas.root(); + let node = NodeCast::from_ref(canvas.r()); + node.dirty(NodeDamage::OtherNodeDamage); + } + fn update_transform(&self) { self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetTransform(self.state.borrow().transform))).unwrap() } @@ -220,6 +227,7 @@ impl CanvasRenderingContext2D { }; self.renderer.send(msg).unwrap(); + self.mark_as_dirty(); Ok(()) } @@ -239,6 +247,7 @@ impl CanvasRenderingContext2D { self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::DrawImage( image_data, image_size, dest_rect, source_rect, smoothing_enabled))).unwrap(); + self.mark_as_dirty(); Ok(()) } @@ -355,6 +364,20 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> self.update_transform() } + // https://html.spec.whatwg.org/multipage/#dom-context-2d-rotate + fn Rotate(self, angle: f64) { + if angle == 0.0 || !angle.is_finite() { + return; + } + + let (sin, cos) = (angle.sin(), angle.cos()); + let transform = self.state.borrow().transform; + self.state.borrow_mut().transform = transform.mul(&Matrix2D::new(cos as f32, sin as f32, + -sin as f32, cos as f32, + 0.0, 0.0)); + self.update_transform() + } + // https://html.spec.whatwg.org/multipage/#dom-context-2d-translate fn Translate(self, x: f64, y: f64) { if !(x.is_finite() && y.is_finite()) { @@ -399,6 +422,12 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> self.update_transform() } + // https://html.spec.whatwg.org/multipage/#dom-context-2d-resettransform + fn ResetTransform(self) { + self.state.borrow_mut().transform = Matrix2D::identity(); + self.update_transform() + } + // https://html.spec.whatwg.org/multipage/#dom-context-2d-globalalpha fn GlobalAlpha(self) -> f64 { let state = self.state.borrow(); @@ -436,6 +465,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> fn FillRect(self, x: f64, y: f64, width: f64, height: f64) { if let Some(rect) = self.create_drawable_rect(x, y, width, height) { self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::FillRect(rect))).unwrap(); + self.mark_as_dirty(); } } @@ -443,6 +473,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> fn ClearRect(self, x: f64, y: f64, width: f64, height: f64) { if let Some(rect) = self.create_drawable_rect(x, y, width, height) { self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::ClearRect(rect))).unwrap(); + self.mark_as_dirty(); } } @@ -450,6 +481,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> fn StrokeRect(self, x: f64, y: f64, width: f64, height: f64) { if let Some(rect) = self.create_drawable_rect(x, y, width, height) { self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::StrokeRect(rect))).unwrap(); + self.mark_as_dirty(); } } @@ -467,11 +499,13 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> fn Fill(self, _: CanvasWindingRule) { // TODO: Process winding rule self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::Fill)).unwrap(); + self.mark_as_dirty(); } // https://html.spec.whatwg.org/multipage/#dom-context-2d-stroke fn Stroke(self) { self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::Stroke)).unwrap(); + self.mark_as_dirty(); } // https://html.spec.whatwg.org/multipage/#dom-context-2d-clip @@ -848,7 +882,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() + self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::PutImageData(data, image_data_rect, dirty_rect))).unwrap(); + self.mark_as_dirty(); } // https://html.spec.whatwg.org/multipage/#dom-context-2d-putimagedata @@ -873,7 +908,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() + self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::PutImageData(data, image_data_rect, dirty_rect))).unwrap(); + self.mark_as_dirty(); } // https://html.spec.whatwg.org/multipage/#dom-context-2d-createlineargradient @@ -977,7 +1013,6 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> } } -#[unsafe_destructor] impl Drop for CanvasRenderingContext2D { fn drop(&mut self) { self.renderer.send(CanvasMsg::Common(CanvasCommonMsg::Close)).unwrap(); diff --git a/components/script/dom/closeevent.rs b/components/script/dom/closeevent.rs new file mode 100644 index 00000000000..08ed8a07aa9 --- /dev/null +++ b/components/script/dom/closeevent.rs @@ -0,0 +1,77 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use dom::bindings::codegen::Bindings::EventBinding::EventMethods; +use dom::bindings::codegen::Bindings::CloseEventBinding; +use dom::bindings::codegen::Bindings::CloseEventBinding::CloseEventMethods; +use dom::bindings::codegen::InheritTypes::EventCast; +use dom::bindings::error::Fallible; +use dom::bindings::global::GlobalRef; +use dom::bindings::js::{JSRef, Temporary, Rootable}; +use dom::bindings::utils::reflect_dom_object; +use dom::event::{Event, EventTypeId, EventBubbles, EventCancelable}; +use script_task::ScriptChan; + +use util::str::DOMString; + +#[dom_struct] +pub struct CloseEvent { + event: Event, + wasClean: bool, + code: u16, + reason: DOMString, +} + +impl CloseEvent { + pub fn new_inherited(type_id: EventTypeId, wasClean: bool, code: u16, + reason: DOMString) -> CloseEvent { + CloseEvent { + event: Event::new_inherited(type_id), + wasClean: wasClean, + code: code, + reason: reason, + } + } + + pub fn new(global: GlobalRef, + type_: DOMString, + bubbles: EventBubbles, + cancelable: EventCancelable, + wasClean: bool, + code: u16, + reason: DOMString) -> Temporary<CloseEvent> { + let event = box CloseEvent::new_inherited(EventTypeId::CloseEvent, + wasClean, code, reason); + let ev = reflect_dom_object(event, global, CloseEventBinding::Wrap).root(); + let event: JSRef<Event> = EventCast::from_ref(ev.r()); + event.InitEvent(type_, + bubbles == EventBubbles::Bubbles, + cancelable == EventCancelable::Cancelable); + Temporary::from_rooted(ev.r()) + } + + pub fn Constructor(global: GlobalRef, + type_: DOMString, + 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 }; + Ok(CloseEvent::new(global, type_, bubbles, cancelable, init.wasClean, + init.code, init.reason.clone())) + } +} + +impl<'a> CloseEventMethods for JSRef<'a, CloseEvent> { + fn WasClean(self) -> bool { + self.wasClean + } + + fn Code(self) -> u16 { + self.code + } + + fn Reason(self) -> DOMString { + self.reason.clone() + } +} diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs index 97c25e56b9c..28ecf365848 100644 --- a/components/script/dom/dedicatedworkerglobalscope.rs +++ b/components/script/dom/dedicatedworkerglobalscope.rs @@ -84,7 +84,6 @@ impl<'a> AutoWorkerReset<'a> { } } -#[unsafe_destructor] impl<'a> Drop for AutoWorkerReset<'a> { fn drop(&mut self) { *self.workerscope.worker.borrow_mut() = self.old_worker.clone(); diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 692c597d7af..9c3b0b00511 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -11,6 +11,8 @@ use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; use dom::bindings::codegen::Bindings::EventTargetBinding::EventTargetMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeFilterBinding::NodeFilter; +use dom::bindings::codegen::Bindings::PerformanceBinding::PerformanceMethods; +use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::codegen::InheritTypes::{DocumentDerived, EventCast, HTMLBodyElementCast}; use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLHeadElementCast, ElementCast}; use dom::bindings::codegen::InheritTypes::{DocumentTypeCast, HTMLHtmlElementCast, NodeCast}; @@ -63,6 +65,7 @@ use dom::window::{Window, WindowHelpers, ReflowReason}; use layout_interface::{HitTestResponse, MouseOverResponse}; use msg::compositor_msg::ScriptListener; +use msg::constellation_msg::AnimationState; use msg::constellation_msg::Msg as ConstellationMsg; use msg::constellation_msg::{ConstellationChan, FocusType, Key, KeyState, KeyModifiers, MozBrowserEvent}; use msg::constellation_msg::{SUPER, ALT, SHIFT, CONTROL}; @@ -81,14 +84,15 @@ use string_cache::{Atom, QualName}; use url::Url; use js::jsapi::JSRuntime; +use num::ToPrimitive; +use std::iter::FromIterator; use std::borrow::ToOwned; use std::collections::HashMap; use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::ascii::AsciiExt; -use std::cell::{Cell, Ref}; +use std::cell::{Cell, Ref, RefCell}; use std::default::Default; use std::sync::mpsc::channel; -use std::num::ToPrimitive; use time; #[derive(PartialEq)] @@ -129,6 +133,12 @@ pub struct Document { /// https://html.spec.whatwg.org/multipage/#concept-n-noscript /// True if scripting is enabled for all scripts in this document scripting_enabled: Cell<bool>, + /// https://html.spec.whatwg.org/multipage/#animation-frame-callback-identifier + /// Current identifier of animation frame callback + animation_frame_ident: Cell<i32>, + /// https://html.spec.whatwg.org/multipage/#list-of-animation-frame-callbacks + /// List of animation frame callbacks + animation_frame_list: RefCell<HashMap<i32, Box<Fn(f64)>>>, } impl DocumentDerived for EventTarget { @@ -220,8 +230,6 @@ pub trait DocumentHelpers<'a> { fn title_changed(self); fn send_title_to_compositor(self); fn dirty_all_nodes(self); - fn handle_click_event(self, js_runtime: *mut JSRuntime, - button: MouseButton, point: Point2D<f32>); fn dispatch_key_event(self, key: Key, state: KeyState, modifiers: KeyModifiers, compositor: &mut Box<ScriptListener+'static>); fn node_from_nodes_and_strings(self, nodes: Vec<NodeOrString>) @@ -229,6 +237,9 @@ pub trait DocumentHelpers<'a> { fn get_body_attribute(self, local_name: &Atom) -> DOMString; fn set_body_attribute(self, local_name: &Atom, value: DOMString); + fn handle_mouse_event(self, js_runtime: *mut JSRuntime, + button: MouseButton, point: Point2D<f32>, + mouse_event_type: MouseEventType); /// Handles a mouse-move event coming from the compositor. fn handle_mouse_move_event(self, js_runtime: *mut JSRuntime, @@ -237,6 +248,12 @@ pub trait DocumentHelpers<'a> { fn set_current_script(self, script: Option<JSRef<HTMLScriptElement>>); fn trigger_mozbrowser_event(self, event: MozBrowserEvent); + /// http://w3c.github.io/animation-timing/#dom-windowanimationtiming-requestanimationframe + fn request_animation_frame(self, callback: Box<Fn(f64, )>) -> i32; + /// http://w3c.github.io/animation-timing/#dom-windowanimationtiming-cancelanimationframe + fn cancel_animation_frame(self, ident: i32); + /// http://w3c.github.io/animation-timing/#dfn-invoke-callbacks-algorithm + fn invoke_animation_callbacks(self); } impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> { @@ -511,9 +528,15 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> { } } - fn handle_click_event(self, js_runtime: *mut JSRuntime, - _button: MouseButton, point: Point2D<f32>) { - debug!("ClickEvent: clicked at {:?}", point); + fn handle_mouse_event(self, js_runtime: *mut JSRuntime, + _button: MouseButton, point: Point2D<f32>, + mouse_event_type: MouseEventType) { + let mouse_event_type_string = match mouse_event_type { + MouseEventType::Click => "click".to_owned(), + MouseEventType::MouseUp => "mouseup".to_owned(), + MouseEventType::MouseDown => "mousedown".to_owned(), + }; + debug!("{}: at {:?}", mouse_event_type_string, point); let node = match self.hit_test(&point) { Some(node_address) => { debug!("node address is {:?}", node_address.0); @@ -525,7 +548,7 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> { let el = match ElementCast::to_ref(node.r()) { Some(el) => Temporary::from_rooted(el), None => { - let parent = node.r().parent_node(); + let parent = node.r().GetParentNode(); match parent.and_then(ElementCast::to_temporary) { Some(parent) => parent, None => return, @@ -534,13 +557,15 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> { }.root(); let node: JSRef<Node> = NodeCast::from_ref(el.r()); - debug!("clicked on {:?}", node.debug_str()); + debug!("{} on {:?}", mouse_event_type_string, node.debug_str()); // Prevent click event if form control element is disabled. - if node.click_event_filter_by_disabled_state() { - return; - } + if let MouseEventType::Click = mouse_event_type { + if node.click_event_filter_by_disabled_state() { + return; + } - self.begin_focus_transaction(); + self.begin_focus_transaction(); + } let window = self.window.root(); @@ -548,7 +573,7 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> { let x = point.x as i32; let y = point.y as i32; let event = MouseEvent::new(window.r(), - "click".to_owned(), + mouse_event_type_string, EventBubbles::Bubbles, EventCancelable::Cancelable, Some(window.r()), @@ -562,9 +587,17 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> { // https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#trusted-events event.set_trusted(true); // https://html.spec.whatwg.org/multipage/#run-authentic-click-activation-steps - el.r().authentic_click_activation(event); + match mouse_event_type { + MouseEventType::Click => el.r().authentic_click_activation(event), + _ => { + let target: JSRef<EventTarget> = EventTargetCast::from_ref(node); + event.fire(target); + }, + } - self.commit_focus_transaction(FocusType::Element); + if let MouseEventType::Click = mouse_event_type { + self.commit_focus_transaction(FocusType::Element); + } window.r().reflow(ReflowGoal::ForDisplay, ReflowQueryType::NoQuery, ReflowReason::MouseEvent); } @@ -668,8 +701,8 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> { let props = KeyboardEvent::key_properties(key, modifiers); let keyevent = KeyboardEvent::new(window.r(), ev_type, true, true, - Some(window.r()), 0, - props.key.to_owned(), props.code.to_owned(), + Some(window.r()), 0, Some(key), + props.key_string.to_owned(), props.code.to_owned(), props.location, is_repeating, is_composing, ctrl, alt, shift, meta, None, props.key_code).root(); @@ -681,8 +714,8 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> { if state != KeyState::Released && props.is_printable() && !prevented { // https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#keypress-event-order let event = KeyboardEvent::new(window.r(), "keypress".to_owned(), - true, true, Some(window.r()), - 0, props.key.to_owned(), props.code.to_owned(), + true, true, Some(window.r()), 0, Some(key), + props.key_string.to_owned(), props.code.to_owned(), props.location, is_repeating, is_composing, ctrl, alt, shift, meta, props.char_code, 0).root(); @@ -776,6 +809,67 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> { } } } + + /// http://w3c.github.io/animation-timing/#dom-windowanimationtiming-requestanimationframe + fn request_animation_frame(self, callback: Box<Fn(f64, )>) -> i32 { + let window = self.window.root(); + let window = window.r(); + let ident = self.animation_frame_ident.get() + 1; + + self.animation_frame_ident.set(ident); + self.animation_frame_list.borrow_mut().insert(ident, callback); + + // TODO: Should tick animation only when document is visible + let ConstellationChan(ref chan) = window.constellation_chan(); + let event = ConstellationMsg::ChangeRunningAnimationsState(window.pipeline(), + AnimationState::AnimationCallbacksPresent); + chan.send(event).unwrap(); + + ident + } + + /// http://w3c.github.io/animation-timing/#dom-windowanimationtiming-cancelanimationframe + fn cancel_animation_frame(self, ident: i32) { + self.animation_frame_list.borrow_mut().remove(&ident); + if self.animation_frame_list.borrow().len() == 0 { + let window = self.window.root(); + let window = window.r(); + let ConstellationChan(ref chan) = window.constellation_chan(); + let event = ConstellationMsg::ChangeRunningAnimationsState(window.pipeline(), + AnimationState::NoAnimationCallbacksPresent); + chan.send(event).unwrap(); + } + } + + /// http://w3c.github.io/animation-timing/#dfn-invoke-callbacks-algorithm + fn invoke_animation_callbacks(self) { + let animation_frame_list; + { + let mut list = self.animation_frame_list.borrow_mut(); + animation_frame_list = Vec::from_iter(list.drain()); + + let window = self.window.root(); + let window = window.r(); + let ConstellationChan(ref chan) = window.constellation_chan(); + let event = ConstellationMsg::ChangeRunningAnimationsState(window.pipeline(), + AnimationState::NoAnimationCallbacksPresent); + chan.send(event).unwrap(); + } + let window = self.window.root(); + let window = window.r(); + let performance = window.Performance().root(); + let performance = performance.r(); + + for (_, callback) in animation_frame_list { + callback(*performance.Now()); + } + } +} + +pub enum MouseEventType { + Click, + MouseDown, + MouseUp, } #[derive(PartialEq)] @@ -847,6 +941,8 @@ impl Document { focused: Default::default(), current_script: Default::default(), scripting_enabled: Cell::new(true), + animation_frame_ident: Cell::new(0), + animation_frame_list: RefCell::new(HashMap::new()), } } diff --git a/components/script/dom/domrect.rs b/components/script/dom/domrect.rs index 08cacc09be2..45c325b3a2d 100644 --- a/components/script/dom/domrect.rs +++ b/components/script/dom/domrect.rs @@ -10,7 +10,6 @@ use dom::bindings::num::Finite; use dom::bindings::utils::{Reflector, reflect_dom_object}; use dom::window::Window; use util::geometry::Au; -use std::num::Float; #[dom_struct] pub struct DOMRect { diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index a936e783ad4..9468cc28033 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -64,6 +64,7 @@ use style::properties::{PropertyDeclarationBlock, PropertyDeclaration, parse_sty use style::properties::DeclaredValue::SpecifiedValue; use style::values::specified::CSSColor; use util::namespace; +use util::smallvec::VecLike; use util::str::{DOMString, LengthOrPercentageOrAuto}; use cssparser::Color; @@ -74,16 +75,14 @@ use html5ever::serialize::TraversalScope::{IncludeNode, ChildrenOnly}; use html5ever::tree_builder::{NoQuirks, LimitedQuirks, Quirks}; use selectors::matching::{matches, DeclarationBlock}; use selectors::parser::parse_author_origin_selector_list_from_str; -use selectors::smallvec::VecLike; use string_cache::{Atom, Namespace, QualName}; use url::UrlParser; use std::ascii::AsciiExt; -use std::borrow::{IntoCow, ToOwned}; +use std::borrow::{Cow, ToOwned}; use std::cell::{Ref, RefMut}; use std::default::Default; use std::mem; -use std::old_io::{MemWriter, Writer}; use std::sync::Arc; #[dom_struct] @@ -257,7 +256,7 @@ impl RawLayoutElementHelpers for Element { }; if let Some(color) = bgcolor { - hints.vec_push(from_declaration( + hints.push(from_declaration( PropertyDeclaration::BackgroundColor(SpecifiedValue( CSSColor { parsed: Color::RGBA(color), authored: None })))); } @@ -571,13 +570,13 @@ impl<'a> ElementHelpers<'a> for JSRef<'a, Element> { fn serialize(self, traversal_scope: TraversalScope) -> Fallible<DOMString> { let node: JSRef<Node> = NodeCast::from_ref(self); - let mut writer = MemWriter::new(); + let mut writer = vec![]; match serialize(&mut writer, &node, SerializeOpts { traversal_scope: traversal_scope, .. Default::default() }) { - Ok(()) => Ok(String::from_utf8(writer.into_inner()).unwrap()), + Ok(()) => Ok(String::from_utf8(writer).unwrap()), Err(_) => panic!("Cannot serialize element"), } } @@ -711,7 +710,7 @@ pub trait AttributeHandlers { fn get_tokenlist_attribute(self, local_name: &Atom) -> Vec<Atom>; fn set_tokenlist_attribute(self, local_name: &Atom, value: DOMString); fn set_atomic_tokenlist_attribute(self, local_name: &Atom, tokens: Vec<Atom>); - fn get_uint_attribute(self, local_name: &Atom) -> u32; + fn get_uint_attribute(self, local_name: &Atom, default: u32) -> u32; fn set_uint_attribute(self, local_name: &Atom, value: u32); } @@ -966,7 +965,7 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> { self.set_attribute(local_name, AttrValue::from_atomic_tokens(tokens)); } - fn get_uint_attribute(self, local_name: &Atom) -> u32 { + fn get_uint_attribute(self, local_name: &Atom, default: u32) -> u32 { assert!(local_name.chars().all(|ch| { !ch.is_ascii() || ch.to_ascii_lowercase() == ch })); @@ -979,7 +978,7 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> { implement parse_plain_attribute"), } } - None => 0, + None => default, } } fn set_uint_attribute(self, local_name: &Atom, value: u32) { @@ -1011,9 +1010,9 @@ impl<'a> ElementMethods for JSRef<'a, Element> { fn TagName(self) -> DOMString { let qualified_name = match self.prefix { Some(ref prefix) => { - (format!("{}:{}", &**prefix, &*self.local_name)).into_cow() + Cow::Owned(format!("{}:{}", &**prefix, &*self.local_name)) }, - None => self.local_name.into_cow() + None => Cow::Borrowed(&*self.local_name) }; if self.html_element_in_html_document() { qualified_name.to_ascii_uppercase() @@ -1215,11 +1214,13 @@ impl<'a> ElementMethods for JSRef<'a, Element> { let context_document = document_from_node(self).root(); let context_node: JSRef<Node> = NodeCast::from_ref(self); // Step 1. - let context_parent = match context_node.parent_node() { - // Step 2. - None => return Ok(()), - Some(parent) => parent.root() - }; + let context_parent = match context_node.GetParentNode() { + None => { + // Step 2. + return Ok(()); + }, + Some(parent) => parent, + }.root(); let parent = match context_parent.r().type_id() { // Step 3. @@ -1230,11 +1231,10 @@ impl<'a> ElementMethods for JSRef<'a, Element> { let body_elem = Element::create(QualName::new(ns!(HTML), atom!(body)), None, context_document.r(), ElementCreator::ScriptCreated); - let body_node: Temporary<Node> = NodeCast::from_temporary(body_elem); - body_node.root() + NodeCast::from_temporary(body_elem) }, - _ => context_node.parent_node().unwrap().root() - }; + _ => context_node.GetParentNode().unwrap() + }.root(); // Step 5. let frag = try!(parent.r().parse_fragment(value)); diff --git a/components/script/dom/event.rs b/components/script/dom/event.rs index 4f0086310aa..012742a0d7b 100644 --- a/components/script/dom/event.rs +++ b/components/script/dom/event.rs @@ -39,7 +39,8 @@ pub enum EventTypeId { ProgressEvent, StorageEvent, UIEvent, - ErrorEvent + ErrorEvent, + CloseEvent } #[derive(PartialEq)] diff --git a/components/script/dom/formdata.rs b/components/script/dom/formdata.rs index 98410ef02ef..068c0b591a5 100644 --- a/components/script/dom/formdata.rs +++ b/components/script/dom/formdata.rs @@ -87,7 +87,7 @@ impl<'a> FormDataMethods for JSRef<'a, FormData> { // FIXME(https://github.com/rust-lang/rust/issues/23338) let data = self.data.borrow(); if data.contains_key(&name) { - match data[name][0].clone() { + match data[&name][0].clone() { FormDatum::StringData(ref s) => Some(eString(s.clone())), FormDatum::FileData(ref f) => { Some(eFile(Unrooted::from_js(*f))) diff --git a/components/script/dom/htmlanchorelement.rs b/components/script/dom/htmlanchorelement.rs index 7a13b77b986..9ed6b5df5c7 100644 --- a/components/script/dom/htmlanchorelement.rs +++ b/components/script/dom/htmlanchorelement.rs @@ -25,8 +25,8 @@ use dom::node::{Node, NodeHelpers, NodeTypeId, document_from_node, window_from_n use dom::virtualmethods::VirtualMethods; use dom::window::WindowHelpers; +use num::ToPrimitive; use std::default::Default; -use std::num::ToPrimitive; use string_cache::Atom; use util::str::DOMString; @@ -135,8 +135,8 @@ impl<'a> Activatable for JSRef<'a, HTMLAnchorElement> { 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()); ismap_suffix = Some( - format!("?{},{}", mouse_event.ClientX().to_f32().unwrap() - rect.origin.x.to_frac32_px(), - mouse_event.ClientY().to_f32().unwrap() - rect.origin.y.to_frac32_px()) + 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/htmlcollection.rs b/components/script/dom/htmlcollection.rs index e4520f6760c..68d8c9cf3e8 100644 --- a/components/script/dom/htmlcollection.rs +++ b/components/script/dom/htmlcollection.rs @@ -167,10 +167,12 @@ impl HTMLCollection { fn traverse(root: JSRef<Node>) -> FilterMap<Skip<TreeIterator>, fn(Temporary<Node>) -> Option<Temporary<Element>>> { + fn to_temporary(node: Temporary<Node>) -> Option<Temporary<Element>> { + ElementCast::to_temporary(node) + } root.traverse_preorder() .skip(1) - .filter_map(ElementCast::to_temporary as - fn(Temporary<Node>) -> Option<Temporary<Element>>) + .filter_map(to_temporary as fn(Temporary<Node>) -> Option<Temporary<Element>>) } } diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index f42aceced3a..ce70535de74 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -176,7 +176,7 @@ fn to_snake_case(name: DOMString) -> DOMString { for ch in name.chars() { if ch.is_uppercase() { attr_name.push('\x2d'); - attr_name.push(ch.to_lowercase()); + attr_name.extend(ch.to_lowercase()); } else { attr_name.push(ch); } diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index 59c100465c0..760f5942aa0 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -21,7 +21,6 @@ use dom::htmlelement::{HTMLElement, HTMLElementTypeId}; use dom::node::{document_from_node, Node, NodeTypeId, NodeHelpers, NodeDamage, window_from_node}; use dom::virtualmethods::VirtualMethods; use dom::window::WindowHelpers; -use util::geometry::to_px; use util::str::DOMString; use string_cache::Atom; @@ -188,7 +187,7 @@ impl<'a> HTMLImageElementMethods for JSRef<'a, HTMLImageElement> { fn Width(self) -> u32 { let node: JSRef<Node> = NodeCast::from_ref(self); let rect = node.get_bounding_content_box(); - to_px(rect.size.width) as u32 + rect.size.width.to_px() as u32 } fn SetWidth(self, width: u32) { @@ -199,7 +198,7 @@ impl<'a> HTMLImageElementMethods for JSRef<'a, HTMLImageElement> { fn Height(self) -> u32 { let node: JSRef<Node> = NodeCast::from_ref(self); let rect = node.get_bounding_content_box(); - to_px(rect.size.height) as u32 + rect.size.height.to_px() as u32 } fn SetHeight(self, height: u32) { diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index 17768a76c8b..e077cfac737 100644 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -35,6 +35,7 @@ use dom::window::WindowHelpers; use textinput::TextInput; use textinput::KeyReaction::{TriggerDefaultAction, DispatchInput, Nothing}; use textinput::Lines::Single; +use msg::constellation_msg::ConstellationChan; use util::str::DOMString; use string_cache::Atom; @@ -72,7 +73,7 @@ pub struct HTMLInputElement { indeterminate: Cell<bool>, value_changed: Cell<bool>, size: Cell<u32>, - textinput: DOMRefCell<TextInput>, + textinput: DOMRefCell<TextInput<ConstellationChan>>, activation_state: DOMRefCell<InputActivationState>, } @@ -122,7 +123,7 @@ impl HTMLInputElement { checked_changed: Cell::new(false), value_changed: Cell::new(false), size: Cell::new(DEFAULT_INPUT_SIZE), - textinput: DOMRefCell::new(TextInput::new(Single, "".to_owned(), Some(chan))), + textinput: DOMRefCell::new(TextInput::new(Single, "".to_owned(), chan)), activation_state: DOMRefCell::new(InputActivationState::new()) } } @@ -242,10 +243,8 @@ impl<'a> HTMLInputElementMethods for JSRef<'a, HTMLInputElement> { make_bool_setter!(SetReadOnly, "readonly"); // https://html.spec.whatwg.org/multipage/#dom-input-size - make_uint_getter!(Size); - - // https://html.spec.whatwg.org/multipage/#dom-input-size - make_uint_setter!(SetSize, "size"); + make_uint_getter!(Size, "size", DEFAULT_INPUT_SIZE); + make_limited_uint_setter!(SetSize, "size", DEFAULT_INPUT_SIZE); // https://html.spec.whatwg.org/multipage/#dom-input-type make_enumerated_getter!(Type, "text", ("hidden") | ("search") | ("tel") | @@ -568,7 +567,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLInputElement> { fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue { match name { - &atom!("size") => AttrValue::from_u32(value, DEFAULT_INPUT_SIZE), + &atom!("size") => AttrValue::from_limited_u32(value, DEFAULT_INPUT_SIZE), _ => self.super_type().unwrap().parse_plain_attribute(name, value), } } diff --git a/components/script/dom/htmloptionelement.rs b/components/script/dom/htmloptionelement.rs index 11c512b03e6..232e5ec2dec 100644 --- a/components/script/dom/htmloptionelement.rs +++ b/components/script/dom/htmloptionelement.rs @@ -175,7 +175,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLOptionElement> { } let node: JSRef<Node> = NodeCast::from_ref(*self); - if node.parent_node().is_some() { + if node.GetParentNode().is_some() { node.check_parent_disabled_state_for_option(); } else { node.check_disabled_attribute(); diff --git a/components/script/dom/htmltablecellelement.rs b/components/script/dom/htmltablecellelement.rs index 378a804c361..02d32d55968 100644 --- a/components/script/dom/htmltablecellelement.rs +++ b/components/script/dom/htmltablecellelement.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/. */ -use dom::attr::{Attr, AttrHelpers}; +use dom::attr::{Attr, AttrHelpers, AttrValue}; +use dom::bindings::codegen::Bindings::HTMLTableCellElementBinding::HTMLTableCellElementMethods; use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLTableCellElementDerived}; use dom::bindings::js::JSRef; use dom::document::Document; @@ -12,9 +13,15 @@ use dom::htmlelement::{HTMLElement, HTMLElementTypeId}; use dom::node::NodeTypeId; use dom::virtualmethods::VirtualMethods; -use cssparser::RGBA; use util::str::{self, DOMString, LengthOrPercentageOrAuto}; + +use cssparser::RGBA; +use string_cache::Atom; + use std::cell::Cell; +use std::cmp::max; + +const DEFAULT_COLSPAN: u32 = 1; #[derive(Copy, Clone, PartialEq, Debug)] #[jstraceable] @@ -60,6 +67,12 @@ impl HTMLTableCellElement { } } +impl<'a> HTMLTableCellElementMethods for JSRef<'a, HTMLTableCellElement> { + // https://html.spec.whatwg.org/multipage/#dom-tdth-colspan + make_uint_getter!(ColSpan, "colspan", DEFAULT_COLSPAN); + make_uint_setter!(SetColSpan, "colspan"); +} + pub trait HTMLTableCellElementHelpers { fn get_background_color(&self) -> Option<RGBA>; fn get_colspan(&self) -> Option<u32>; @@ -96,8 +109,13 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLTableCellElement> { self.background_color.set(str::parse_legacy_color(&attr.value()).ok()) } &atom!("colspan") => { - self.colspan.set(str::parse_unsigned_integer(attr.value().chars())); - } + match *attr.value() { + AttrValue::UInt(_, colspan) => { + self.colspan.set(Some(max(DEFAULT_COLSPAN, colspan))) + }, + _ => unreachable!(), + } + }, &atom!("width") => self.width.set(str::parse_length(&attr.value())), _ => () } @@ -115,5 +133,11 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLTableCellElement> { _ => () } } -} + fn parse_plain_attribute(&self, local_name: &Atom, value: DOMString) -> AttrValue { + match local_name { + &atom!("colspan") => AttrValue::from_u32(value, DEFAULT_COLSPAN), + _ => self.super_type().unwrap().parse_plain_attribute(local_name, value), + } + } +} diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs index 5e6724d5c63..dc2f89c6122 100644 --- a/components/script/dom/htmltextareaelement.rs +++ b/components/script/dom/htmltextareaelement.rs @@ -30,6 +30,7 @@ use textinput::{TextInput, Lines, KeyReaction}; use dom::virtualmethods::VirtualMethods; use dom::window::WindowHelpers; use script_task::{ScriptMsg, Runnable}; +use msg::constellation_msg::ConstellationChan; use util::str::DOMString; use string_cache::Atom; @@ -40,7 +41,7 @@ use std::cell::Cell; #[dom_struct] pub struct HTMLTextAreaElement { htmlelement: HTMLElement, - textinput: DOMRefCell<TextInput>, + textinput: DOMRefCell<TextInput<ConstellationChan>>, cols: Cell<u32>, rows: Cell<u32>, // https://html.spec.whatwg.org/multipage/#concept-textarea-dirty @@ -95,7 +96,7 @@ impl HTMLTextAreaElement { let chan = document.window().root().r().constellation_chan(); HTMLTextAreaElement { htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLTextAreaElement, localName, prefix, document), - textinput: DOMRefCell::new(TextInput::new(Lines::Multiple, "".to_owned(), Some(chan))), + textinput: DOMRefCell::new(TextInput::new(Lines::Multiple, "".to_owned(), chan)), cols: Cell::new(DEFAULT_COLS), rows: Cell::new(DEFAULT_ROWS), value_changed: Cell::new(false), @@ -114,10 +115,8 @@ impl<'a> HTMLTextAreaElementMethods for JSRef<'a, HTMLTextAreaElement> { // constraints // https://html.spec.whatwg.org/multipage/#dom-textarea-cols - make_uint_getter!(Cols); - - // https://html.spec.whatwg.org/multipage/#dom-textarea-cols - make_uint_setter!(SetCols, "cols"); + make_uint_getter!(Cols, "cols", DEFAULT_COLS); + make_limited_uint_setter!(SetCols, "cols", DEFAULT_COLS); // https://www.whatwg.org/html/#dom-fe-disabled make_bool_getter!(Disabled); @@ -150,10 +149,8 @@ impl<'a> HTMLTextAreaElementMethods for JSRef<'a, HTMLTextAreaElement> { make_bool_setter!(SetRequired, "required"); // https://html.spec.whatwg.org/multipage/#dom-textarea-rows - make_uint_getter!(Rows); - - // https://html.spec.whatwg.org/multipage/#dom-textarea-rows - make_uint_setter!(SetRows, "rows"); + make_uint_getter!(Rows, "rows", DEFAULT_ROWS); + make_limited_uint_setter!(SetRows, "rows", DEFAULT_ROWS); // https://html.spec.whatwg.org/multipage/#dom-textarea-wrap make_getter!(Wrap); @@ -310,8 +307,8 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLTextAreaElement> { fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue { match name { - &atom!("cols") => AttrValue::from_u32(value, DEFAULT_COLS), - &atom!("rows") => AttrValue::from_u32(value, DEFAULT_ROWS), + &atom!("cols") => AttrValue::from_limited_u32(value, DEFAULT_COLS), + &atom!("rows") => AttrValue::from_limited_u32(value, DEFAULT_ROWS), _ => self.super_type().unwrap().parse_plain_attribute(name, value), } } diff --git a/components/script/dom/imagedata.rs b/components/script/dom/imagedata.rs index 34bebafb082..99dfbc853a7 100644 --- a/components/script/dom/imagedata.rs +++ b/components/script/dom/imagedata.rs @@ -33,7 +33,7 @@ impl ImageData { if let Some(vec) = data { let js_object_data: *mut uint8_t = JS_GetUint8ClampedArrayData(js_object, cx); - ptr::copy_nonoverlapping(js_object_data, vec.as_ptr(), vec.len()) + ptr::copy_nonoverlapping(vec.as_ptr(), js_object_data, vec.len()) } ImageData { diff --git a/components/script/dom/keyboardevent.rs b/components/script/dom/keyboardevent.rs index 08a268678f0..d0ac71c814c 100644 --- a/components/script/dom/keyboardevent.rs +++ b/components/script/dom/keyboardevent.rs @@ -14,15 +14,20 @@ use dom::event::{Event, EventTypeId}; use dom::uievent::UIEvent; use dom::window::Window; use msg::constellation_msg; +use msg::constellation_msg::{Key, KeyModifiers}; +use msg::constellation_msg::{SHIFT, CONTROL, ALT, SUPER}; use util::str::DOMString; use std::borrow::ToOwned; use std::cell::{RefCell, Cell}; +no_jsmanaged_fields!(Key); + #[dom_struct] pub struct KeyboardEvent { uievent: UIEvent, - key: RefCell<DOMString>, + key: Cell<Option<Key>>, + key_string: RefCell<DOMString>, code: RefCell<DOMString>, location: Cell<u32>, ctrl: Cell<bool>, @@ -45,7 +50,8 @@ impl KeyboardEvent { fn new_inherited() -> KeyboardEvent { KeyboardEvent { uievent: UIEvent::new_inherited(EventTypeId::KeyboardEvent), - key: RefCell::new("".to_owned()), + key: Cell::new(None), + key_string: RefCell::new("".to_owned()), code: RefCell::new("".to_owned()), location: Cell::new(0), ctrl: Cell::new(false), @@ -71,7 +77,8 @@ impl KeyboardEvent { cancelable: bool, view: Option<JSRef<Window>>, _detail: i32, - key: DOMString, + key: Option<Key>, + key_string: DOMString, code: DOMString, location: u32, repeat: bool, @@ -83,10 +90,11 @@ impl KeyboardEvent { char_code: Option<u32>, key_code: u32) -> Temporary<KeyboardEvent> { let ev = KeyboardEvent::new_uninitialized(window).root(); - ev.r().InitKeyboardEvent(type_, canBubble, cancelable, view, key, location, + ev.r().InitKeyboardEvent(type_, canBubble, cancelable, view, key_string, location, "".to_owned(), repeat, "".to_owned()); // FIXME(https://github.com/rust-lang/rust/issues/23338) let ev = ev.r(); + ev.key.set(key); *ev.code.borrow_mut() = code; ev.ctrl.set(ctrlKey); ev.alt.set(altKey); @@ -105,7 +113,7 @@ impl KeyboardEvent { init.parent.parent.parent.bubbles, init.parent.parent.parent.cancelable, init.parent.parent.view.r(), - init.parent.parent.detail, + init.parent.parent.detail, key_from_string(&init.key, init.location), init.key.clone(), init.code.clone(), init.location, init.repeat, init.isComposing, init.parent.ctrlKey, init.parent.altKey, init.parent.shiftKey, init.parent.metaKey, @@ -113,10 +121,10 @@ impl KeyboardEvent { Ok(event) } - pub fn key_properties(key: constellation_msg::Key, mods: constellation_msg::KeyModifiers) + pub fn key_properties(key: Key, mods: KeyModifiers) -> KeyEventProperties { KeyEventProperties { - key: key_value(key, mods), + key_string: key_value(key, mods), code: code_value(key), location: key_location(key), char_code: key_charcode(key, mods), @@ -125,321 +133,521 @@ impl KeyboardEvent { } } +pub trait KeyboardEventHelpers { + fn get_key(&self) -> Option<Key>; + fn get_key_modifiers(&self) -> KeyModifiers; +} + +impl<'a> KeyboardEventHelpers for JSRef<'a, KeyboardEvent> { + fn get_key(&self) -> Option<Key> { + self.key.get().clone() + } + + fn get_key_modifiers(&self) -> KeyModifiers { + let mut result = KeyModifiers::empty(); + if self.shift.get() { + result = result | constellation_msg::SHIFT; + } + if self.ctrl.get() { + result = result | constellation_msg::CONTROL; + } + if self.alt.get() { + result = result | constellation_msg::ALT; + } + if self.meta.get() { + result = result | constellation_msg::SUPER; + } + return result; + } +} + + // https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3Events-key.html -fn key_value(key: constellation_msg::Key, mods: constellation_msg::KeyModifiers) -> &'static str { +pub fn key_value(key: Key, mods: KeyModifiers) -> &'static str { let shift = mods.contains(constellation_msg::SHIFT); match key { - constellation_msg::Key::Space => " ", - constellation_msg::Key::Apostrophe if shift => "\"", - constellation_msg::Key::Apostrophe => "'", - constellation_msg::Key::Comma if shift => "<", - constellation_msg::Key::Comma => ",", - constellation_msg::Key::Minus if shift => "_", - constellation_msg::Key::Minus => "-", - constellation_msg::Key::Period if shift => ">", - constellation_msg::Key::Period => ".", - constellation_msg::Key::Slash if shift => "?", - constellation_msg::Key::Slash => "/", - constellation_msg::Key::GraveAccent if shift => "~", - constellation_msg::Key::GraveAccent => "`", - constellation_msg::Key::Num0 if shift => ")", - constellation_msg::Key::Num0 => "0", - constellation_msg::Key::Num1 if shift => "!", - constellation_msg::Key::Num1 => "1", - constellation_msg::Key::Num2 if shift => "@", - constellation_msg::Key::Num2 => "2", - constellation_msg::Key::Num3 if shift => "#", - constellation_msg::Key::Num3 => "3", - constellation_msg::Key::Num4 if shift => "$", - constellation_msg::Key::Num4 => "4", - constellation_msg::Key::Num5 if shift => "%", - constellation_msg::Key::Num5 => "5", - constellation_msg::Key::Num6 if shift => "^", - constellation_msg::Key::Num6 => "6", - constellation_msg::Key::Num7 if shift => "&", - constellation_msg::Key::Num7 => "7", - constellation_msg::Key::Num8 if shift => "*", - constellation_msg::Key::Num8 => "8", - constellation_msg::Key::Num9 if shift => "(", - constellation_msg::Key::Num9 => "9", - constellation_msg::Key::Semicolon if shift => ":", - constellation_msg::Key::Semicolon => ";", - constellation_msg::Key::Equal if shift => "+", - constellation_msg::Key::Equal => "=", - constellation_msg::Key::A if shift => "A", - constellation_msg::Key::A => "a", - constellation_msg::Key::B if shift => "B", - constellation_msg::Key::B => "b", - constellation_msg::Key::C if shift => "C", - constellation_msg::Key::C => "c", - constellation_msg::Key::D if shift => "D", - constellation_msg::Key::D => "d", - constellation_msg::Key::E if shift => "E", - constellation_msg::Key::E => "e", - constellation_msg::Key::F if shift => "F", - constellation_msg::Key::F => "f", - constellation_msg::Key::G if shift => "G", - constellation_msg::Key::G => "g", - constellation_msg::Key::H if shift => "H", - constellation_msg::Key::H => "h", - constellation_msg::Key::I if shift => "I", - constellation_msg::Key::I => "i", - constellation_msg::Key::J if shift => "J", - constellation_msg::Key::J => "j", - constellation_msg::Key::K if shift => "K", - constellation_msg::Key::K => "k", - constellation_msg::Key::L if shift => "L", - constellation_msg::Key::L => "l", - constellation_msg::Key::M if shift => "M", - constellation_msg::Key::M => "m", - constellation_msg::Key::N if shift => "N", - constellation_msg::Key::N => "n", - constellation_msg::Key::O if shift => "O", - constellation_msg::Key::O => "o", - constellation_msg::Key::P if shift => "P", - constellation_msg::Key::P => "p", - constellation_msg::Key::Q if shift => "Q", - constellation_msg::Key::Q => "q", - constellation_msg::Key::R if shift => "R", - constellation_msg::Key::R => "r", - constellation_msg::Key::S if shift => "S", - constellation_msg::Key::S => "s", - constellation_msg::Key::T if shift => "T", - constellation_msg::Key::T => "t", - constellation_msg::Key::U if shift => "U", - constellation_msg::Key::U => "u", - constellation_msg::Key::V if shift => "V", - constellation_msg::Key::V => "v", - constellation_msg::Key::W if shift => "W", - constellation_msg::Key::W => "w", - constellation_msg::Key::X if shift => "X", - constellation_msg::Key::X => "x", - constellation_msg::Key::Y if shift => "Y", - constellation_msg::Key::Y => "y", - constellation_msg::Key::Z if shift => "Z", - constellation_msg::Key::Z => "z", - constellation_msg::Key::LeftBracket if shift => "{", - constellation_msg::Key::LeftBracket => "[", - constellation_msg::Key::Backslash if shift => "|", - constellation_msg::Key::Backslash => "\\", - constellation_msg::Key::RightBracket if shift => "}", - constellation_msg::Key::RightBracket => "]", - constellation_msg::Key::World1 => "Unidentified", - constellation_msg::Key::World2 => "Unidentified", - constellation_msg::Key::Escape => "Escape", - constellation_msg::Key::Enter => "Enter", - constellation_msg::Key::Tab => "Tab", - constellation_msg::Key::Backspace => "Backspace", - constellation_msg::Key::Insert => "Insert", - constellation_msg::Key::Delete => "Delete", - constellation_msg::Key::Right => "ArrowRight", - constellation_msg::Key::Left => "ArrowLeft", - constellation_msg::Key::Down => "ArrowDown", - constellation_msg::Key::Up => "ArrowUp", - constellation_msg::Key::PageUp => "PageUp", - constellation_msg::Key::PageDown => "PageDown", - constellation_msg::Key::Home => "Home", - constellation_msg::Key::End => "End", - constellation_msg::Key::CapsLock => "CapsLock", - constellation_msg::Key::ScrollLock => "ScrollLock", - constellation_msg::Key::NumLock => "NumLock", - constellation_msg::Key::PrintScreen => "PrintScreen", - constellation_msg::Key::Pause => "Pause", - constellation_msg::Key::F1 => "F1", - constellation_msg::Key::F2 => "F2", - constellation_msg::Key::F3 => "F3", - constellation_msg::Key::F4 => "F4", - constellation_msg::Key::F5 => "F5", - constellation_msg::Key::F6 => "F6", - constellation_msg::Key::F7 => "F7", - constellation_msg::Key::F8 => "F8", - constellation_msg::Key::F9 => "F9", - constellation_msg::Key::F10 => "F10", - constellation_msg::Key::F11 => "F11", - constellation_msg::Key::F12 => "F12", - constellation_msg::Key::F13 => "F13", - constellation_msg::Key::F14 => "F14", - constellation_msg::Key::F15 => "F15", - constellation_msg::Key::F16 => "F16", - constellation_msg::Key::F17 => "F17", - constellation_msg::Key::F18 => "F18", - constellation_msg::Key::F19 => "F19", - constellation_msg::Key::F20 => "F20", - constellation_msg::Key::F21 => "F21", - constellation_msg::Key::F22 => "F22", - constellation_msg::Key::F23 => "F23", - constellation_msg::Key::F24 => "F24", - constellation_msg::Key::F25 => "F25", - constellation_msg::Key::Kp0 => "0", - constellation_msg::Key::Kp1 => "1", - constellation_msg::Key::Kp2 => "2", - constellation_msg::Key::Kp3 => "3", - constellation_msg::Key::Kp4 => "4", - constellation_msg::Key::Kp5 => "5", - constellation_msg::Key::Kp6 => "6", - constellation_msg::Key::Kp7 => "7", - constellation_msg::Key::Kp8 => "8", - constellation_msg::Key::Kp9 => "9", - constellation_msg::Key::KpDecimal => ".", - constellation_msg::Key::KpDivide => "/", - constellation_msg::Key::KpMultiply => "*", - constellation_msg::Key::KpSubtract => "-", - constellation_msg::Key::KpAdd => "+", - constellation_msg::Key::KpEnter => "Enter", - constellation_msg::Key::KpEqual => "=", - constellation_msg::Key::LeftShift => "Shift", - constellation_msg::Key::LeftControl => "Control", - constellation_msg::Key::LeftAlt => "Alt", - constellation_msg::Key::LeftSuper => "Super", - constellation_msg::Key::RightShift => "Shift", - constellation_msg::Key::RightControl => "Control", - constellation_msg::Key::RightAlt => "Alt", - constellation_msg::Key::RightSuper => "Super", - constellation_msg::Key::Menu => "ContextMenu", + Key::Space => " ", + Key::Apostrophe if shift => "\"", + Key::Apostrophe => "'", + Key::Comma if shift => "<", + Key::Comma => ",", + Key::Minus if shift => "_", + Key::Minus => "-", + Key::Period if shift => ">", + Key::Period => ".", + Key::Slash if shift => "?", + Key::Slash => "/", + Key::GraveAccent if shift => "~", + Key::GraveAccent => "`", + Key::Num0 if shift => ")", + Key::Num0 => "0", + Key::Num1 if shift => "!", + Key::Num1 => "1", + Key::Num2 if shift => "@", + Key::Num2 => "2", + Key::Num3 if shift => "#", + Key::Num3 => "3", + Key::Num4 if shift => "$", + Key::Num4 => "4", + Key::Num5 if shift => "%", + Key::Num5 => "5", + Key::Num6 if shift => "^", + Key::Num6 => "6", + Key::Num7 if shift => "&", + Key::Num7 => "7", + Key::Num8 if shift => "*", + Key::Num8 => "8", + Key::Num9 if shift => "(", + Key::Num9 => "9", + Key::Semicolon if shift => ":", + Key::Semicolon => ";", + Key::Equal if shift => "+", + Key::Equal => "=", + Key::A if shift => "A", + Key::A => "a", + Key::B if shift => "B", + Key::B => "b", + Key::C if shift => "C", + Key::C => "c", + Key::D if shift => "D", + Key::D => "d", + Key::E if shift => "E", + Key::E => "e", + Key::F if shift => "F", + Key::F => "f", + Key::G if shift => "G", + Key::G => "g", + Key::H if shift => "H", + Key::H => "h", + Key::I if shift => "I", + Key::I => "i", + Key::J if shift => "J", + Key::J => "j", + Key::K if shift => "K", + Key::K => "k", + Key::L if shift => "L", + Key::L => "l", + Key::M if shift => "M", + Key::M => "m", + Key::N if shift => "N", + Key::N => "n", + Key::O if shift => "O", + Key::O => "o", + Key::P if shift => "P", + Key::P => "p", + Key::Q if shift => "Q", + Key::Q => "q", + Key::R if shift => "R", + Key::R => "r", + Key::S if shift => "S", + Key::S => "s", + Key::T if shift => "T", + Key::T => "t", + Key::U if shift => "U", + Key::U => "u", + Key::V if shift => "V", + Key::V => "v", + Key::W if shift => "W", + Key::W => "w", + Key::X if shift => "X", + Key::X => "x", + Key::Y if shift => "Y", + Key::Y => "y", + Key::Z if shift => "Z", + Key::Z => "z", + Key::LeftBracket if shift => "{", + Key::LeftBracket => "[", + Key::Backslash if shift => "|", + Key::Backslash => "\\", + Key::RightBracket if shift => "}", + Key::RightBracket => "]", + Key::World1 => "Unidentified", + Key::World2 => "Unidentified", + Key::Escape => "Escape", + Key::Enter => "Enter", + Key::Tab => "Tab", + Key::Backspace => "Backspace", + Key::Insert => "Insert", + Key::Delete => "Delete", + Key::Right => "ArrowRight", + Key::Left => "ArrowLeft", + Key::Down => "ArrowDown", + Key::Up => "ArrowUp", + Key::PageUp => "PageUp", + Key::PageDown => "PageDown", + Key::Home => "Home", + Key::End => "End", + Key::CapsLock => "CapsLock", + Key::ScrollLock => "ScrollLock", + Key::NumLock => "NumLock", + Key::PrintScreen => "PrintScreen", + Key::Pause => "Pause", + Key::F1 => "F1", + Key::F2 => "F2", + Key::F3 => "F3", + Key::F4 => "F4", + Key::F5 => "F5", + Key::F6 => "F6", + Key::F7 => "F7", + Key::F8 => "F8", + Key::F9 => "F9", + Key::F10 => "F10", + Key::F11 => "F11", + Key::F12 => "F12", + Key::F13 => "F13", + Key::F14 => "F14", + Key::F15 => "F15", + Key::F16 => "F16", + Key::F17 => "F17", + Key::F18 => "F18", + Key::F19 => "F19", + Key::F20 => "F20", + Key::F21 => "F21", + Key::F22 => "F22", + Key::F23 => "F23", + Key::F24 => "F24", + Key::F25 => "F25", + Key::Kp0 => "0", + Key::Kp1 => "1", + Key::Kp2 => "2", + Key::Kp3 => "3", + Key::Kp4 => "4", + Key::Kp5 => "5", + Key::Kp6 => "6", + Key::Kp7 => "7", + Key::Kp8 => "8", + Key::Kp9 => "9", + Key::KpDecimal => ".", + Key::KpDivide => "/", + Key::KpMultiply => "*", + Key::KpSubtract => "-", + Key::KpAdd => "+", + Key::KpEnter => "Enter", + Key::KpEqual => "=", + Key::LeftShift => "Shift", + Key::LeftControl => "Control", + Key::LeftAlt => "Alt", + Key::LeftSuper => "Super", + Key::RightShift => "Shift", + Key::RightControl => "Control", + Key::RightAlt => "Alt", + Key::RightSuper => "Super", + Key::Menu => "ContextMenu", + } +} + +fn key_from_string(key_string: &str, location: u32) -> Option<Key> { + match key_string { + " " => Some(Key::Space), + "\"" => Some(Key::Apostrophe), + "'" => Some(Key::Apostrophe), + "<" => Some(Key::Comma), + "," => Some(Key::Comma), + "_" => Some(Key::Minus), + "-" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Minus), + ">" => Some(Key::Period), + "." if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Period), + "?" => Some(Key::Slash), + "/" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Slash), + "~" => Some(Key::GraveAccent), + "`" => Some(Key::GraveAccent), + ")" => Some(Key::Num0), + "0" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num0), + "!" => Some(Key::Num1), + "1" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num1), + "@" => Some(Key::Num2), + "2" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num2), + "#" => Some(Key::Num3), + "3" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num3), + "$" => Some(Key::Num4), + "4" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num4), + "%" => Some(Key::Num5), + "5" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num5), + "^" => Some(Key::Num6), + "6" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num6), + "&" => Some(Key::Num7), + "7" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num7), + "*" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num8), + "8" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num8), + "(" => Some(Key::Num9), + "9" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num9), + ":" => Some(Key::Semicolon), + ";" => Some(Key::Semicolon), + "+" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Equal), + "=" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Equal), + "A" => Some(Key::A), + "a" => Some(Key::A), + "B" => Some(Key::B), + "b" => Some(Key::B), + "C" => Some(Key::C), + "c" => Some(Key::C), + "D" => Some(Key::D), + "d" => Some(Key::D), + "E" => Some(Key::E), + "e" => Some(Key::E), + "F" => Some(Key::F), + "f" => Some(Key::F), + "G" => Some(Key::G), + "g" => Some(Key::G), + "H" => Some(Key::H), + "h" => Some(Key::H), + "I" => Some(Key::I), + "i" => Some(Key::I), + "J" => Some(Key::J), + "j" => Some(Key::J), + "K" => Some(Key::K), + "k" => Some(Key::K), + "L" => Some(Key::L), + "l" => Some(Key::L), + "M" => Some(Key::M), + "m" => Some(Key::M), + "N" => Some(Key::N), + "n" => Some(Key::N), + "O" => Some(Key::O), + "o" => Some(Key::O), + "P" => Some(Key::P), + "p" => Some(Key::P), + "Q" => Some(Key::Q), + "q" => Some(Key::Q), + "R" => Some(Key::R), + "r" => Some(Key::R), + "S" => Some(Key::S), + "s" => Some(Key::S), + "T" => Some(Key::T), + "t" => Some(Key::T), + "U" => Some(Key::U), + "u" => Some(Key::U), + "V" => Some(Key::V), + "v" => Some(Key::V), + "W" => Some(Key::W), + "w" => Some(Key::W), + "X" => Some(Key::X), + "x" => Some(Key::X), + "Y" => Some(Key::Y), + "y" => Some(Key::Y), + "Z" => Some(Key::Z), + "z" => Some(Key::Z), + "{" => Some(Key::LeftBracket), + "[" => Some(Key::LeftBracket), + "|" => Some(Key::Backslash), + "\\" => Some(Key::Backslash), + "}" => Some(Key::RightBracket), + "]" => Some(Key::RightBracket), + "Escape" => Some(Key::Escape), + "Enter" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Enter), + "Tab" => Some(Key::Tab), + "Backspace" => Some(Key::Backspace), + "Insert" => Some(Key::Insert), + "Delete" => Some(Key::Delete), + "ArrowRight" => Some(Key::Right), + "ArrowLeft" => Some(Key::Left), + "ArrowDown" => Some(Key::Down), + "ArrowUp" => Some(Key::Up), + "PageUp" => Some(Key::PageUp), + "PageDown" => Some(Key::PageDown), + "Home" => Some(Key::Home), + "End" => Some(Key::End), + "CapsLock" => Some(Key::CapsLock), + "ScrollLock" => Some(Key::ScrollLock), + "NumLock" => Some(Key::NumLock), + "PrintScreen" => Some(Key::PrintScreen), + "Pause" => Some(Key::Pause), + "F1" => Some(Key::F1), + "F2" => Some(Key::F2), + "F3" => Some(Key::F3), + "F4" => Some(Key::F4), + "F5" => Some(Key::F5), + "F6" => Some(Key::F6), + "F7" => Some(Key::F7), + "F8" => Some(Key::F8), + "F9" => Some(Key::F9), + "F10" => Some(Key::F10), + "F11" => Some(Key::F11), + "F12" => Some(Key::F12), + "F13" => Some(Key::F13), + "F14" => Some(Key::F14), + "F15" => Some(Key::F15), + "F16" => Some(Key::F16), + "F17" => Some(Key::F17), + "F18" => Some(Key::F18), + "F19" => Some(Key::F19), + "F20" => Some(Key::F20), + "F21" => Some(Key::F21), + "F22" => Some(Key::F22), + "F23" => Some(Key::F23), + "F24" => Some(Key::F24), + "F25" => Some(Key::F25), + "0" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp0), + "1" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp1), + "2" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp2), + "3" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp3), + "4" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp4), + "5" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp5), + "6" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp6), + "7" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp7), + "8" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp8), + "9" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp9), + "." if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpDecimal), + "/" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpDivide), + "*" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpMultiply), + "-" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpSubtract), + "+" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpAdd), + "Enter" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpEnter), + "=" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpEqual), + "Shift" if location == KeyboardEventConstants::DOM_KEY_LOCATION_LEFT => Some(Key::LeftShift), + "Control" if location == KeyboardEventConstants::DOM_KEY_LOCATION_LEFT => Some(Key::LeftControl), + "Alt" if location == KeyboardEventConstants::DOM_KEY_LOCATION_LEFT => Some(Key::LeftAlt), + "Super" if location == KeyboardEventConstants::DOM_KEY_LOCATION_LEFT => Some(Key::LeftSuper), + "Shift" if location == KeyboardEventConstants::DOM_KEY_LOCATION_RIGHT => Some(Key::RightShift), + "Control" if location == KeyboardEventConstants::DOM_KEY_LOCATION_RIGHT => Some(Key::RightControl), + "Alt" if location == KeyboardEventConstants::DOM_KEY_LOCATION_RIGHT => Some(Key::RightAlt), + "Super" if location == KeyboardEventConstants::DOM_KEY_LOCATION_RIGHT => Some(Key::RightSuper), + "ContextMenu" => Some(Key::Menu), + _ => None } } // https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3Events-code.html -fn code_value(key: constellation_msg::Key) -> &'static str { +fn code_value(key: Key) -> &'static str { match key { - constellation_msg::Key::Space => "Space", - constellation_msg::Key::Apostrophe => "Quote", - constellation_msg::Key::Comma => "Comma", - constellation_msg::Key::Minus => "Minus", - constellation_msg::Key::Period => "Period", - constellation_msg::Key::Slash => "Slash", - constellation_msg::Key::GraveAccent => "Backquote", - constellation_msg::Key::Num0 => "Digit0", - constellation_msg::Key::Num1 => "Digit1", - constellation_msg::Key::Num2 => "Digit2", - constellation_msg::Key::Num3 => "Digit3", - constellation_msg::Key::Num4 => "Digit4", - constellation_msg::Key::Num5 => "Digit5", - constellation_msg::Key::Num6 => "Digit6", - constellation_msg::Key::Num7 => "Digit7", - constellation_msg::Key::Num8 => "Digit8", - constellation_msg::Key::Num9 => "Digit9", - constellation_msg::Key::Semicolon => "Semicolon", - constellation_msg::Key::Equal => "Equal", - constellation_msg::Key::A => "KeyA", - constellation_msg::Key::B => "KeyB", - constellation_msg::Key::C => "KeyC", - constellation_msg::Key::D => "KeyD", - constellation_msg::Key::E => "KeyE", - constellation_msg::Key::F => "KeyF", - constellation_msg::Key::G => "KeyG", - constellation_msg::Key::H => "KeyH", - constellation_msg::Key::I => "KeyI", - constellation_msg::Key::J => "KeyJ", - constellation_msg::Key::K => "KeyK", - constellation_msg::Key::L => "KeyL", - constellation_msg::Key::M => "KeyM", - constellation_msg::Key::N => "KeyN", - constellation_msg::Key::O => "KeyO", - constellation_msg::Key::P => "KeyP", - constellation_msg::Key::Q => "KeyQ", - constellation_msg::Key::R => "KeyR", - constellation_msg::Key::S => "KeyS", - constellation_msg::Key::T => "KeyT", - constellation_msg::Key::U => "KeyU", - constellation_msg::Key::V => "KeyV", - constellation_msg::Key::W => "KeyW", - constellation_msg::Key::X => "KeyX", - constellation_msg::Key::Y => "KeyY", - constellation_msg::Key::Z => "KeyZ", - constellation_msg::Key::LeftBracket => "BracketLeft", - constellation_msg::Key::Backslash => "Backslash", - constellation_msg::Key::RightBracket => "BracketRight", - - constellation_msg::Key::World1 | - constellation_msg::Key::World2 => panic!("unknown char code for {:?}", key), - - constellation_msg::Key::Escape => "Escape", - constellation_msg::Key::Enter => "Enter", - constellation_msg::Key::Tab => "Tab", - constellation_msg::Key::Backspace => "Backspace", - constellation_msg::Key::Insert => "Insert", - constellation_msg::Key::Delete => "Delete", - constellation_msg::Key::Right => "ArrowRight", - constellation_msg::Key::Left => "ArrowLeft", - constellation_msg::Key::Down => "ArrowDown", - constellation_msg::Key::Up => "ArrowUp", - constellation_msg::Key::PageUp => "PageUp", - constellation_msg::Key::PageDown => "PageDown", - constellation_msg::Key::Home => "Home", - constellation_msg::Key::End => "End", - constellation_msg::Key::CapsLock => "CapsLock", - constellation_msg::Key::ScrollLock => "ScrollLock", - constellation_msg::Key::NumLock => "NumLock", - constellation_msg::Key::PrintScreen => "PrintScreen", - constellation_msg::Key::Pause => "Pause", - constellation_msg::Key::F1 => "F1", - constellation_msg::Key::F2 => "F2", - constellation_msg::Key::F3 => "F3", - constellation_msg::Key::F4 => "F4", - constellation_msg::Key::F5 => "F5", - constellation_msg::Key::F6 => "F6", - constellation_msg::Key::F7 => "F7", - constellation_msg::Key::F8 => "F8", - constellation_msg::Key::F9 => "F9", - constellation_msg::Key::F10 => "F10", - constellation_msg::Key::F11 => "F11", - constellation_msg::Key::F12 => "F12", - constellation_msg::Key::F13 => "F13", - constellation_msg::Key::F14 => "F14", - constellation_msg::Key::F15 => "F15", - constellation_msg::Key::F16 => "F16", - constellation_msg::Key::F17 => "F17", - constellation_msg::Key::F18 => "F18", - constellation_msg::Key::F19 => "F19", - constellation_msg::Key::F20 => "F20", - constellation_msg::Key::F21 => "F21", - constellation_msg::Key::F22 => "F22", - constellation_msg::Key::F23 => "F23", - constellation_msg::Key::F24 => "F24", - constellation_msg::Key::F25 => "F25", - constellation_msg::Key::Kp0 => "Numpad0", - constellation_msg::Key::Kp1 => "Numpad1", - constellation_msg::Key::Kp2 => "Numpad2", - constellation_msg::Key::Kp3 => "Numpad3", - constellation_msg::Key::Kp4 => "Numpad4", - constellation_msg::Key::Kp5 => "Numpad5", - constellation_msg::Key::Kp6 => "Numpad6", - constellation_msg::Key::Kp7 => "Numpad7", - constellation_msg::Key::Kp8 => "Numpad8", - constellation_msg::Key::Kp9 => "Numpad9", - constellation_msg::Key::KpDecimal => "NumpadDecimal", - constellation_msg::Key::KpDivide => "NumpadDivide", - constellation_msg::Key::KpMultiply => "NumpadMultiply", - constellation_msg::Key::KpSubtract => "NumpadSubtract", - constellation_msg::Key::KpAdd => "NumpadAdd", - constellation_msg::Key::KpEnter => "NumpadEnter", - constellation_msg::Key::KpEqual => "NumpadEqual", - constellation_msg::Key::LeftShift | constellation_msg::Key::RightShift => "Shift", - constellation_msg::Key::LeftControl | constellation_msg::Key::RightControl => "Control", - constellation_msg::Key::LeftAlt | constellation_msg::Key::RightAlt => "Alt", - constellation_msg::Key::LeftSuper | constellation_msg::Key::RightSuper => "Super", - constellation_msg::Key::Menu => "Menu", + Key::Space => "Space", + Key::Apostrophe => "Quote", + Key::Comma => "Comma", + Key::Minus => "Minus", + Key::Period => "Period", + Key::Slash => "Slash", + Key::GraveAccent => "Backquote", + Key::Num0 => "Digit0", + Key::Num1 => "Digit1", + Key::Num2 => "Digit2", + Key::Num3 => "Digit3", + Key::Num4 => "Digit4", + Key::Num5 => "Digit5", + Key::Num6 => "Digit6", + Key::Num7 => "Digit7", + Key::Num8 => "Digit8", + Key::Num9 => "Digit9", + Key::Semicolon => "Semicolon", + Key::Equal => "Equal", + Key::A => "KeyA", + Key::B => "KeyB", + Key::C => "KeyC", + Key::D => "KeyD", + Key::E => "KeyE", + Key::F => "KeyF", + Key::G => "KeyG", + Key::H => "KeyH", + Key::I => "KeyI", + Key::J => "KeyJ", + Key::K => "KeyK", + Key::L => "KeyL", + Key::M => "KeyM", + Key::N => "KeyN", + Key::O => "KeyO", + Key::P => "KeyP", + Key::Q => "KeyQ", + Key::R => "KeyR", + Key::S => "KeyS", + Key::T => "KeyT", + Key::U => "KeyU", + Key::V => "KeyV", + Key::W => "KeyW", + Key::X => "KeyX", + Key::Y => "KeyY", + Key::Z => "KeyZ", + Key::LeftBracket => "BracketLeft", + Key::Backslash => "Backslash", + Key::RightBracket => "BracketRight", + + Key::World1 | + Key::World2 => panic!("unknown char code for {:?}", key), + + Key::Escape => "Escape", + Key::Enter => "Enter", + Key::Tab => "Tab", + Key::Backspace => "Backspace", + Key::Insert => "Insert", + Key::Delete => "Delete", + Key::Right => "ArrowRight", + Key::Left => "ArrowLeft", + Key::Down => "ArrowDown", + Key::Up => "ArrowUp", + Key::PageUp => "PageUp", + Key::PageDown => "PageDown", + Key::Home => "Home", + Key::End => "End", + Key::CapsLock => "CapsLock", + Key::ScrollLock => "ScrollLock", + Key::NumLock => "NumLock", + Key::PrintScreen => "PrintScreen", + Key::Pause => "Pause", + Key::F1 => "F1", + Key::F2 => "F2", + Key::F3 => "F3", + Key::F4 => "F4", + Key::F5 => "F5", + Key::F6 => "F6", + Key::F7 => "F7", + Key::F8 => "F8", + Key::F9 => "F9", + Key::F10 => "F10", + Key::F11 => "F11", + Key::F12 => "F12", + Key::F13 => "F13", + Key::F14 => "F14", + Key::F15 => "F15", + Key::F16 => "F16", + Key::F17 => "F17", + Key::F18 => "F18", + Key::F19 => "F19", + Key::F20 => "F20", + Key::F21 => "F21", + Key::F22 => "F22", + Key::F23 => "F23", + Key::F24 => "F24", + Key::F25 => "F25", + Key::Kp0 => "Numpad0", + Key::Kp1 => "Numpad1", + Key::Kp2 => "Numpad2", + Key::Kp3 => "Numpad3", + Key::Kp4 => "Numpad4", + Key::Kp5 => "Numpad5", + Key::Kp6 => "Numpad6", + Key::Kp7 => "Numpad7", + Key::Kp8 => "Numpad8", + Key::Kp9 => "Numpad9", + Key::KpDecimal => "NumpadDecimal", + Key::KpDivide => "NumpadDivide", + Key::KpMultiply => "NumpadMultiply", + Key::KpSubtract => "NumpadSubtract", + Key::KpAdd => "NumpadAdd", + Key::KpEnter => "NumpadEnter", + Key::KpEqual => "NumpadEqual", + Key::LeftShift | Key::RightShift => "Shift", + Key::LeftControl | Key::RightControl => "Control", + Key::LeftAlt | Key::RightAlt => "Alt", + Key::LeftSuper | Key::RightSuper => "Super", + Key::Menu => "Menu", } } -fn key_location(key: constellation_msg::Key) -> u32 { +fn key_location(key: Key) -> u32 { match key { - constellation_msg::Key::Kp0 | constellation_msg::Key::Kp1 | constellation_msg::Key::Kp2 | - constellation_msg::Key::Kp3 | constellation_msg::Key::Kp4 | constellation_msg::Key::Kp5 | - constellation_msg::Key::Kp6 | constellation_msg::Key::Kp7 | constellation_msg::Key::Kp8 | - constellation_msg::Key::Kp9 | constellation_msg::Key::KpDecimal | - constellation_msg::Key::KpDivide | constellation_msg::Key::KpMultiply | - constellation_msg::Key::KpSubtract | constellation_msg::Key::KpAdd | - constellation_msg::Key::KpEnter | constellation_msg::Key::KpEqual => + Key::Kp0 | Key::Kp1 | Key::Kp2 | + Key::Kp3 | Key::Kp4 | Key::Kp5 | + Key::Kp6 | Key::Kp7 | Key::Kp8 | + Key::Kp9 | Key::KpDecimal | + Key::KpDivide | Key::KpMultiply | + Key::KpSubtract | Key::KpAdd | + Key::KpEnter | Key::KpEqual => KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD, - constellation_msg::Key::LeftShift | constellation_msg::Key::LeftAlt | - constellation_msg::Key::LeftControl | constellation_msg::Key::LeftSuper => + Key::LeftShift | Key::LeftAlt | + Key::LeftControl | Key::LeftSuper => KeyboardEventConstants::DOM_KEY_LOCATION_LEFT, - constellation_msg::Key::RightShift | constellation_msg::Key::RightAlt | - constellation_msg::Key::RightControl | constellation_msg::Key::RightSuper => + Key::RightShift | Key::RightAlt | + Key::RightControl | Key::RightSuper => KeyboardEventConstants::DOM_KEY_LOCATION_RIGHT, _ => KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD, @@ -447,89 +655,89 @@ fn key_location(key: constellation_msg::Key) -> u32 { } // https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#widl-KeyboardEvent-charCode -fn key_charcode(key: constellation_msg::Key, mods: constellation_msg::KeyModifiers) -> Option<u32> { - let key = key_value(key, mods); - if key.len() == 1 { - Some(key.char_at(0) as u32) +fn key_charcode(key: Key, mods: KeyModifiers) -> Option<u32> { + let key_string = key_value(key, mods); + if key_string.len() == 1 { + Some(key_string.chars().next().unwrap() as u32) } else { None } } // https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#legacy-key-models -fn key_keycode(key: constellation_msg::Key) -> u32 { +fn key_keycode(key: Key) -> u32 { match key { // https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#legacy-key-models - constellation_msg::Key::Backspace => 8, - constellation_msg::Key::Tab => 9, - constellation_msg::Key::Enter => 13, - constellation_msg::Key::LeftShift | constellation_msg::Key::RightShift => 16, - constellation_msg::Key::LeftControl | constellation_msg::Key::RightControl => 17, - constellation_msg::Key::LeftAlt | constellation_msg::Key::RightAlt => 18, - constellation_msg::Key::CapsLock => 20, - constellation_msg::Key::Escape => 27, - constellation_msg::Key::Space => 32, - constellation_msg::Key::PageUp => 33, - constellation_msg::Key::PageDown => 34, - constellation_msg::Key::End => 35, - constellation_msg::Key::Home => 36, - constellation_msg::Key::Left => 37, - constellation_msg::Key::Up => 38, - constellation_msg::Key::Right => 39, - constellation_msg::Key::Down => 40, - constellation_msg::Key::Delete => 46, + Key::Backspace => 8, + Key::Tab => 9, + Key::Enter => 13, + Key::LeftShift | Key::RightShift => 16, + Key::LeftControl | Key::RightControl => 17, + Key::LeftAlt | Key::RightAlt => 18, + Key::CapsLock => 20, + Key::Escape => 27, + Key::Space => 32, + Key::PageUp => 33, + Key::PageDown => 34, + Key::End => 35, + Key::Home => 36, + Key::Left => 37, + Key::Up => 38, + Key::Right => 39, + Key::Down => 40, + Key::Delete => 46, // https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#optionally-fixed-virtual-key-codes - constellation_msg::Key::Semicolon => 186, - constellation_msg::Key::Equal => 187, - constellation_msg::Key::Comma => 188, - constellation_msg::Key::Minus => 189, - constellation_msg::Key::Period => 190, - constellation_msg::Key::Slash => 191, - constellation_msg::Key::LeftBracket => 219, - constellation_msg::Key::Backslash => 220, - constellation_msg::Key::RightBracket => 221, - constellation_msg::Key::Apostrophe => 222, + Key::Semicolon => 186, + Key::Equal => 187, + Key::Comma => 188, + Key::Minus => 189, + Key::Period => 190, + Key::Slash => 191, + Key::LeftBracket => 219, + Key::Backslash => 220, + Key::RightBracket => 221, + Key::Apostrophe => 222, //§ B.2.1.3 - constellation_msg::Key::Num0 | - constellation_msg::Key::Num1 | - constellation_msg::Key::Num2 | - constellation_msg::Key::Num3 | - constellation_msg::Key::Num4 | - constellation_msg::Key::Num5 | - constellation_msg::Key::Num6 | - constellation_msg::Key::Num7 | - constellation_msg::Key::Num8 | - constellation_msg::Key::Num9 => key as u32 - constellation_msg::Key::Num0 as u32 + '0' as u32, + Key::Num0 | + Key::Num1 | + Key::Num2 | + Key::Num3 | + Key::Num4 | + Key::Num5 | + Key::Num6 | + Key::Num7 | + Key::Num8 | + Key::Num9 => key as u32 - Key::Num0 as u32 + '0' as u32, //§ B.2.1.4 - constellation_msg::Key::A | - constellation_msg::Key::B | - constellation_msg::Key::C | - constellation_msg::Key::D | - constellation_msg::Key::E | - constellation_msg::Key::F | - constellation_msg::Key::G | - constellation_msg::Key::H | - constellation_msg::Key::I | - constellation_msg::Key::J | - constellation_msg::Key::K | - constellation_msg::Key::L | - constellation_msg::Key::M | - constellation_msg::Key::N | - constellation_msg::Key::O | - constellation_msg::Key::P | - constellation_msg::Key::Q | - constellation_msg::Key::R | - constellation_msg::Key::S | - constellation_msg::Key::T | - constellation_msg::Key::U | - constellation_msg::Key::V | - constellation_msg::Key::W | - constellation_msg::Key::X | - constellation_msg::Key::Y | - constellation_msg::Key::Z => key as u32 - constellation_msg::Key::A as u32 + 'A' as u32, + Key::A | + Key::B | + Key::C | + Key::D | + Key::E | + Key::F | + Key::G | + Key::H | + Key::I | + Key::J | + Key::K | + Key::L | + Key::M | + Key::N | + Key::O | + Key::P | + Key::Q | + Key::R | + Key::S | + Key::T | + Key::U | + Key::V | + Key::W | + Key::X | + Key::Y | + Key::Z => key as u32 - Key::A as u32 + 'A' as u32, //§ B.2.1.8 _ => 0 @@ -537,7 +745,7 @@ fn key_keycode(key: constellation_msg::Key) -> u32 { } pub struct KeyEventProperties { - pub key: &'static str, + pub key_string: &'static str, pub code: &'static str, pub location: u32, pub char_code: Option<u32>, @@ -568,15 +776,15 @@ impl<'a> KeyboardEventMethods for JSRef<'a, KeyboardEvent> { let uievent: JSRef<UIEvent> = UIEventCast::from_ref(self); uievent.InitUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, 0); - *self.key.borrow_mut() = keyArg; + *self.key_string.borrow_mut() = keyArg; self.location.set(locationArg); self.repeat.set(repeat); } fn Key(self) -> DOMString { // FIXME(https://github.com/rust-lang/rust/issues/23338) - let key = self.key.borrow(); - key.clone() + let key_string = self.key_string.borrow(); + key_string.clone() } fn Code(self) -> DOMString { diff --git a/components/script/dom/macros.rs b/components/script/dom/macros.rs index 76157789e71..d66190ffada 100644 --- a/components/script/dom/macros.rs +++ b/components/script/dom/macros.rs @@ -39,7 +39,7 @@ macro_rules! make_bool_getter( #[macro_export] macro_rules! make_uint_getter( - ( $attr:ident, $htmlname:expr ) => ( + ($attr:ident, $htmlname:expr, $default:expr) => ( fn $attr(self) -> u32 { use dom::element::{Element, AttributeHandlers}; use dom::bindings::codegen::InheritTypes::ElementCast; @@ -47,9 +47,12 @@ macro_rules! make_uint_getter( use std::ascii::AsciiExt; let element: JSRef<Element> = ElementCast::from_ref(self); // FIXME(pcwalton): Do this at compile time, not runtime. - element.get_uint_attribute(&Atom::from_slice($htmlname)) + element.get_uint_attribute(&Atom::from_slice($htmlname), $default) } ); + ($attr:ident, $htmlname:expr) => { + make_uint_getter!($attr, $htmlname, 0); + }; ($attr:ident) => { make_uint_getter!($attr, to_lower!(stringify!($attr))); } @@ -85,12 +88,11 @@ macro_rules! make_url_or_base_getter( use std::ascii::AsciiExt; let element: JSRef<Element> = ElementCast::from_ref(self); let url = element.get_url_attribute(&Atom::from_slice($htmlname)); - match &*url { - "" => { - let window = window_from_node(self).root(); - window.r().get_url().serialize() - }, - _ => url + if url.is_empty() { + let window = window_from_node(self).root(); + window.r().get_url().serialize() + } else { + url } } ); @@ -153,15 +155,51 @@ macro_rules! make_bool_setter( #[macro_export] macro_rules! make_uint_setter( - ( $attr:ident, $htmlname:expr ) => ( + ($attr:ident, $htmlname:expr, $default:expr) => ( fn $attr(self, value: u32) { use dom::element::{Element, AttributeHandlers}; use dom::bindings::codegen::InheritTypes::ElementCast; + let value = if value > 2147483647 { + $default + } else { + value + }; let element: JSRef<Element> = ElementCast::from_ref(self); // FIXME(pcwalton): Do this at compile time, not at runtime. element.set_uint_attribute(&Atom::from_slice($htmlname), value) } ); + ($attr:ident, $htmlname:expr) => { + make_uint_setter!($attr, $htmlname, 0); + }; +); + +#[macro_export] +macro_rules! make_limited_uint_setter( + ($attr:ident, $htmlname:expr, $default:expr) => ( + fn $attr(self, value: u32) -> $crate::dom::bindings::error::ErrorResult { + use dom::element::AttributeHandlers; + use dom::bindings::codegen::InheritTypes::ElementCast; + use string_cache::Atom; + let value = if value == 0 { + return Err($crate::dom::bindings::error::Error::IndexSize); + } else if value > 2147483647 { + $default + } else { + value + }; + let element = ElementCast::from_ref(self); + // FIXME(pcwalton): Do this at compile time, not runtime. + element.set_uint_attribute(&Atom::from_slice($htmlname), value); + Ok(()) + } + ); + ($attr:ident, $htmlname:expr) => { + make_limited_uint_setter!($attr, $htmlname, 1); + }; + ($attr:ident) => { + make_limited_uint_setter!($attr, to_lower!(stringify!($attr))); + }; ); /// For use on non-jsmanaged types diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index 00b7a05d348..e693b1f70de 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -206,6 +206,7 @@ pub mod cssstyledeclaration; pub mod domrect; pub mod domrectlist; pub mod domstringmap; +pub mod closeevent; pub mod comment; pub mod console; mod create; @@ -325,7 +326,12 @@ pub mod urlsearchparams; pub mod userscripts; pub mod validitystate; pub mod virtualmethods; +pub mod webglobject; +pub mod webglbuffer; +pub mod webglprogram; pub mod webglrenderingcontext; +pub mod webglshader; +pub mod webgluniformlocation; pub mod websocket; pub mod window; pub mod worker; diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 9143677d1e0..048ee28b3a9 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -179,7 +179,6 @@ impl NodeFlags { } } -#[unsafe_destructor] impl Drop for Node { #[allow(unsafe_code)] fn drop(&mut self) { @@ -286,7 +285,7 @@ trait PrivateNodeHelpers { impl<'a> PrivateNodeHelpers for JSRef<'a, Node> { // https://dom.spec.whatwg.org/#node-is-inserted fn node_inserted(self) { - assert!(self.parent_node().is_some()); + assert!(self.parent_node.get().is_some()); let document = document_from_node(self).root(); let is_in_doc = self.is_in_doc(); @@ -295,14 +294,14 @@ impl<'a> PrivateNodeHelpers for JSRef<'a, Node> { vtable_for(&node.r()).bind_to_tree(is_in_doc); } - let parent = self.parent_node().root(); + let parent = self.parent_node.get().root(); parent.r().map(|parent| vtable_for(&parent).child_inserted(self)); document.r().content_and_heritage_changed(self, NodeDamage::OtherNodeDamage); } // https://dom.spec.whatwg.org/#node-is-removed fn node_removed(self, parent_in_doc: bool) { - assert!(self.parent_node().is_none()); + assert!(self.parent_node.get().is_none()); for node in self.traverse_preorder() { let node = node.root(); vtable_for(&node.r()).unbind_from_tree(parent_in_doc); @@ -318,15 +317,15 @@ impl<'a> PrivateNodeHelpers for JSRef<'a, Node> { /// /// Fails unless `new_child` is disconnected from the tree. fn add_child(self, new_child: JSRef<Node>, before: Option<JSRef<Node>>) { - assert!(new_child.parent_node().is_none()); - assert!(new_child.prev_sibling().is_none()); - assert!(new_child.next_sibling().is_none()); + assert!(new_child.parent_node.get().is_none()); + assert!(new_child.prev_sibling.get().is_none()); + assert!(new_child.next_sibling.get().is_none()); match before { Some(ref before) => { - assert!(before.parent_node().root().r() == Some(self)); - match before.prev_sibling().root() { + assert!(before.parent_node.get().root().r() == Some(self)); + match before.prev_sibling.get().root() { None => { - assert!(Some(*before) == self.first_child().root().r()); + assert!(Some(*before) == self.first_child.get().root().r()); self.first_child.set(Some(JS::from_rooted(new_child))); }, Some(ref prev_sibling) => { @@ -338,10 +337,10 @@ impl<'a> PrivateNodeHelpers for JSRef<'a, Node> { new_child.next_sibling.set(Some(JS::from_rooted(*before))); }, None => { - match self.last_child().root() { + match self.last_child.get().root() { None => self.first_child.set(Some(JS::from_rooted(new_child))), Some(ref last_child) => { - assert!(last_child.r().next_sibling().is_none()); + assert!(last_child.r().next_sibling.get().is_none()); last_child.r().next_sibling.set(Some(JS::from_rooted(new_child))); new_child.prev_sibling.set(Some(JS::from_rooted(last_child.r()))); } @@ -358,7 +357,7 @@ impl<'a> PrivateNodeHelpers for JSRef<'a, Node> { /// /// Fails unless `child` is a child of this node. fn remove_child(self, child: JSRef<Node>) { - assert!(child.parent_node().root().r() == Some(self)); + assert!(child.parent_node.get().root().r() == Some(self)); match child.prev_sibling.get().root() { None => { @@ -430,12 +429,6 @@ pub trait NodeHelpers { fn len(self) -> u32; fn index(self) -> u32; - fn parent_node(self) -> Option<Temporary<Node>>; - fn first_child(self) -> Option<Temporary<Node>>; - fn last_child(self) -> Option<Temporary<Node>>; - fn prev_sibling(self) -> Option<Temporary<Node>>; - fn next_sibling(self) -> Option<Temporary<Node>>; - fn owner_doc(self) -> Temporary<Document>; fn set_owner_doc(self, document: JSRef<Document>); fn is_in_html_doc(self) -> bool; @@ -585,28 +578,6 @@ impl<'a> NodeHelpers for JSRef<'a, Node> { self.preceding_siblings().count() as u32 } - fn parent_node(self) -> Option<Temporary<Node>> { - self.parent_node.get().map(Temporary::from_rooted) - } - - fn first_child(self) -> Option<Temporary<Node>> { - self.first_child.get().map(Temporary::from_rooted) - } - - fn last_child(self) -> Option<Temporary<Node>> { - self.last_child.get().map(Temporary::from_rooted) - } - - /// Returns the previous sibling of this node. Fails if this node is borrowed mutably. - fn prev_sibling(self) -> Option<Temporary<Node>> { - self.prev_sibling.get().map(Temporary::from_rooted) - } - - /// Returns the next sibling of this node. Fails if this node is borrowed mutably. - fn next_sibling(self) -> Option<Temporary<Node>> { - self.next_sibling.get().map(Temporary::from_rooted) - } - #[inline] fn is_element(self) -> bool { match self.type_id { @@ -757,12 +728,12 @@ impl<'a> NodeHelpers for JSRef<'a, Node> { // selectors. Maybe we can do something smarter in the future. if !self.get_has_dirty_siblings() { let parent = - match self.parent_node() { + match self.parent_node.get() { None => return, Some(parent) => parent, - }; + }.root(); - for sibling in parent.root().r().children() { + for sibling in parent.r().children() { let sibling = sibling.root(); sibling.r().set_has_dirty_siblings(true); } @@ -799,20 +770,20 @@ impl<'a> NodeHelpers for JSRef<'a, Node> { fn following_siblings(self) -> NodeSiblingIterator { NodeSiblingIterator { - current: self.next_sibling(), + current: self.GetNextSibling(), } } fn preceding_siblings(self) -> ReverseSiblingIterator { ReverseSiblingIterator { - current: self.prev_sibling(), + current: self.GetPreviousSibling(), } } fn is_parent_of(self, child: JSRef<Node>) -> bool { - match child.parent_node() { - Some(ref parent) if parent == &Temporary::from_rooted(self) => true, - _ => false + match child.parent_node.get().root() { + Some(ref parent) => parent.r() == self, + None => false, } } @@ -830,7 +801,7 @@ impl<'a> NodeHelpers for JSRef<'a, Node> { // https://dom.spec.whatwg.org/#dom-childnode-before fn before(self, nodes: Vec<NodeOrString>) -> ErrorResult { - match self.parent_node().root() { + match self.parent_node.get().root() { None => { // Step 1. Ok(()) @@ -848,7 +819,7 @@ impl<'a> NodeHelpers for JSRef<'a, Node> { // https://dom.spec.whatwg.org/#dom-childnode-after fn after(self, nodes: Vec<NodeOrString>) -> ErrorResult { - match self.parent_node().root() { + match self.parent_node.get().root() { None => { // Step 1. Ok(()) @@ -859,7 +830,7 @@ impl<'a> NodeHelpers for JSRef<'a, Node> { let node = try!(doc.r().node_from_nodes_and_strings(nodes)).root(); // Step 3. // FIXME(https://github.com/servo/servo/issues/5720) - let next_sibling = self.next_sibling().root(); + let next_sibling = self.next_sibling.get().root(); Node::pre_insert(node.r(), parent_node.r(), next_sibling.r()).map(|_| ()) }, @@ -868,7 +839,7 @@ impl<'a> NodeHelpers for JSRef<'a, Node> { // https://dom.spec.whatwg.org/#dom-childnode-replacewith fn replace_with(self, nodes: Vec<NodeOrString>) -> ErrorResult { - match self.parent_node().root() { + match self.parent_node.get().root() { None => { // Step 1. Ok(()) @@ -889,7 +860,7 @@ impl<'a> NodeHelpers for JSRef<'a, Node> { let doc = self.owner_doc().root(); let node = try!(doc.r().node_from_nodes_and_strings(nodes)).root(); // Step 2. - let first_child = self.first_child().root(); + let first_child = self.first_child.get().root(); Node::pre_insert(node.r(), self, first_child.r()).map(|_| ()) } @@ -952,7 +923,7 @@ impl<'a> NodeHelpers for JSRef<'a, Node> { fn ancestors(self) -> AncestorIterator { AncestorIterator { - current: self.parent_node() + current: self.GetParentNode() } } @@ -976,24 +947,27 @@ impl<'a> NodeHelpers for JSRef<'a, Node> { fn children(self) -> NodeSiblingIterator { NodeSiblingIterator { - current: self.first_child(), + current: self.GetFirstChild(), } } fn rev_children(self) -> ReverseSiblingIterator { ReverseSiblingIterator { - current: self.last_child(), + current: self.GetLastChild(), } } fn child_elements(self) -> ChildElementIterator { + fn to_temporary(node: Temporary<Node>) -> Option<Temporary<Element>> { + ElementCast::to_temporary(node) + } self.children() - .filter_map(ElementCast::to_temporary as fn(_) -> _) + .filter_map(to_temporary as fn(_) -> _) .peekable() } fn remove_self(self) { - match self.parent_node().root() { + match self.parent_node.get().root() { Some(ref parent) => parent.r().remove_child(self), None => () } @@ -1241,7 +1215,7 @@ impl Iterator for NodeSiblingIterator { None => return None, Some(current) => current, }.root(); - self.current = current.r().next_sibling(); + self.current = current.r().GetNextSibling(); Some(Temporary::from_rooted(current.r())) } } @@ -1258,7 +1232,7 @@ impl Iterator for ReverseSiblingIterator { None => return None, Some(current) => current, }.root(); - self.current = current.r().prev_sibling(); + self.current = current.r().GetPreviousSibling(); Some(Temporary::from_rooted(current.r())) } } @@ -1275,7 +1249,7 @@ impl Iterator for AncestorIterator { None => return None, Some(current) => current, }.root(); - self.current = current.r().parent_node(); + self.current = current.r().GetParentNode(); Some(Temporary::from_rooted(current.r())) } } @@ -1304,7 +1278,7 @@ impl Iterator for TreeIterator { Some(current) => current, }; let node = current.root(); - if let Some(first_child) = node.r().first_child() { + if let Some(first_child) = node.r().GetFirstChild() { self.current = Some(first_child); self.depth += 1; return Some(current); @@ -1313,7 +1287,7 @@ impl Iterator for TreeIterator { if self.depth == 0 { break; } - if let Some(next_sibling) = ancestor.root().r().next_sibling() { + if let Some(next_sibling) = ancestor.root().r().GetNextSibling() { self.current = Some(next_sibling); return Some(current); } @@ -1392,7 +1366,7 @@ impl Node { // https://dom.spec.whatwg.org/#concept-node-adopt pub fn adopt(node: JSRef<Node>, document: JSRef<Document>) { // Step 1. - match node.parent_node().root() { + match node.parent_node.get().root() { Some(ref parent) => { Node::remove(node, parent.r(), SuppressObserver::Unsuppressed); } @@ -1532,7 +1506,7 @@ impl Node { // Step 7-8. let reference_child = match child { - Some(child) if child == node => node.next_sibling(), + Some(child) if child == node => node.GetNextSibling(), _ => None }.root(); let reference_child = reference_child.r().or(child); @@ -1670,7 +1644,7 @@ impl Node { // https://dom.spec.whatwg.org/#concept-node-pre-remove fn pre_remove(child: JSRef<Node>, parent: JSRef<Node>) -> Fallible<Temporary<Node>> { // Step 1. - match child.parent_node() { + match child.GetParentNode() { Some(ref node) if node != &Temporary::from_rooted(parent) => return Err(NotFound), None => return Err(NotFound), _ => () @@ -1685,7 +1659,7 @@ impl Node { // https://dom.spec.whatwg.org/#concept-node-remove fn remove(node: JSRef<Node>, parent: JSRef<Node>, suppress_observers: SuppressObserver) { - assert!(node.parent_node().map_or(false, |node_parent| node_parent == Temporary::from_rooted(parent))); + assert!(node.GetParentNode().map_or(false, |node_parent| node_parent == Temporary::from_rooted(parent))); // Step 1-5: ranges. // Step 6-7: mutation observers. @@ -1890,13 +1864,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> { // https://dom.spec.whatwg.org/#dom-node-parentelement fn GetParentElement(self) -> Option<Temporary<Element>> { - self.parent_node.get() - .and_then(|parent| { - let parent = parent.root(); - ElementCast::to_ref(parent.r()).map(|elem| { - Temporary::from_rooted(elem) - }) - }) + self.GetParentNode().and_then(ElementCast::to_temporary) } // https://dom.spec.whatwg.org/#dom-node-haschildnodes @@ -2122,8 +2090,8 @@ impl<'a> NodeMethods for JSRef<'a, Node> { } // Step 7-8. - let child_next_sibling = child.next_sibling().root(); - let node_next_sibling = node.next_sibling().root(); + let child_next_sibling = child.next_sibling.get().root(); + let node_next_sibling = node.next_sibling.get().root(); let reference_child = if child_next_sibling.r() == Some(node) { node_next_sibling.r() } else { @@ -2431,53 +2399,28 @@ impl<'a> style::node::TNode<'a> for JSRef<'a, Node> { type Element = JSRef<'a, Element>; fn parent_node(self) -> Option<JSRef<'a, Node>> { - // FIXME(zwarich): Remove this when UFCS lands and there is a better way - // of disambiguating methods. - fn parent_node<'a, T: NodeHelpers>(this: T) -> Option<Temporary<Node>> { - this.parent_node() - } - - parent_node(self).map(|node| node.root().get_unsound_ref_forever()) + (*self).parent_node.get() + .map(|node| node.root().get_unsound_ref_forever()) } fn first_child(self) -> Option<JSRef<'a, Node>> { - // FIXME(zwarich): Remove this when UFCS lands and there is a better way - // of disambiguating methods. - fn first_child<'a, T: NodeHelpers>(this: T) -> Option<Temporary<Node>> { - this.first_child() - } - - first_child(self).map(|node| node.root().get_unsound_ref_forever()) + (*self).first_child.get() + .map(|node| node.root().get_unsound_ref_forever()) } fn last_child(self) -> Option<JSRef<'a, Node>> { - // FIXME(zwarich): Remove this when UFCS lands and there is a better way - // of disambiguating methods. - fn last_child<'a, T: NodeHelpers>(this: T) -> Option<Temporary<Node>> { - this.last_child() - } - - last_child(self).map(|node| node.root().get_unsound_ref_forever()) + (*self).last_child.get() + .map(|node| node.root().get_unsound_ref_forever()) } fn prev_sibling(self) -> Option<JSRef<'a, Node>> { - // FIXME(zwarich): Remove this when UFCS lands and there is a better way - // of disambiguating methods. - fn prev_sibling<'a, T: NodeHelpers>(this: T) -> Option<Temporary<Node>> { - this.prev_sibling() - } - - prev_sibling(self).map(|node| node.root().get_unsound_ref_forever()) + (*self).prev_sibling.get() + .map(|node| node.root().get_unsound_ref_forever()) } fn next_sibling(self) -> Option<JSRef<'a, Node>> { - // FIXME(zwarich): Remove this when UFCS lands and there is a better way - // of disambiguating methods. - fn next_sibling<'a, T: NodeHelpers>(this: T) -> Option<Temporary<Node>> { - this.next_sibling() - } - - next_sibling(self).map(|node| node.root().get_unsound_ref_forever()) + (*self).next_sibling.get() + .map(|node| node.root().get_unsound_ref_forever()) } fn is_document(self) -> bool { @@ -2595,7 +2538,7 @@ impl<'a> DisabledStateHelpers for JSRef<'a, Node> { fn check_parent_disabled_state_for_option(self) { if self.get_disabled_state() { return; } - if let Some(ref parent) = self.parent_node().root() { + if let Some(ref parent) = self.GetParentNode().root() { if parent.r().is_htmloptgroupelement() && parent.r().get_disabled_state() { self.set_disabled_state(true); self.set_enabled_state(false); diff --git a/components/script/dom/range.rs b/components/script/dom/range.rs index c9124f1eb3d..bf5cf088953 100644 --- a/components/script/dom/range.rs +++ b/components/script/dom/range.rs @@ -133,25 +133,25 @@ impl<'a> RangeMethods for JSRef<'a, Range> { // https://dom.spec.whatwg.org/#dom-range-setstartbeforenode fn SetStartBefore(self, node: JSRef<Node>) -> ErrorResult { - let parent = try!(node.parent_node().ok_or(Error::InvalidNodeType)).root(); + let parent = try!(node.GetParentNode().ok_or(Error::InvalidNodeType)).root(); self.SetStart(parent.r(), node.index()) } // https://dom.spec.whatwg.org/#dom-range-setstartafternode fn SetStartAfter(self, node: JSRef<Node>) -> ErrorResult { - let parent = try!(node.parent_node().ok_or(Error::InvalidNodeType)).root(); + let parent = try!(node.GetParentNode().ok_or(Error::InvalidNodeType)).root(); self.SetStart(parent.r(), node.index() + 1) } // https://dom.spec.whatwg.org/#dom-range-setendbeforenode fn SetEndBefore(self, node: JSRef<Node>) -> ErrorResult { - let parent = try!(node.parent_node().ok_or(Error::InvalidNodeType)).root(); + let parent = try!(node.GetParentNode().ok_or(Error::InvalidNodeType)).root(); self.SetEnd(parent.r(), node.index()) } // https://dom.spec.whatwg.org/#dom-range-setendafternode fn SetEndAfter(self, node: JSRef<Node>) -> ErrorResult { - let parent = try!(node.parent_node().ok_or(Error::InvalidNodeType)).root(); + let parent = try!(node.GetParentNode().ok_or(Error::InvalidNodeType)).root(); self.SetEnd(parent.r(), node.index() + 1) } @@ -259,7 +259,7 @@ impl<'a> RangeMethods for JSRef<'a, Range> { // Step 1. return false; } - let parent = match node.parent_node() { + let parent = match node.GetParentNode() { Some(parent) => parent, None => { // Step 3. @@ -364,7 +364,7 @@ impl RangeInner { // https://dom.spec.whatwg.org/#dom-range-selectnodenode fn select_node(&mut self, node: JSRef<Node>) -> ErrorResult { // Steps 1, 2. - let parent = try!(node.parent_node().ok_or(Error::InvalidNodeType)).root(); + let parent = try!(node.GetParentNode().ok_or(Error::InvalidNodeType)).root(); // Step 3. let index = node.index(); // Step 4. @@ -497,7 +497,7 @@ fn bp_position(a_node: JSRef<Node>, a_offset: u32, // Step 3-1, 3-2. let b_ancestors = b_node.inclusive_ancestors(); let ref child = b_ancestors.map(|child| child.root()).find(|child| { - child.r().parent_node().unwrap().root().r() == a_node + child.r().GetParentNode().unwrap().root().r() == a_node }).unwrap(); // Step 3-3. if child.r().index() < a_offset { diff --git a/components/script/dom/text.rs b/components/script/dom/text.rs index 9cd321bf9ae..217f1e1bca1 100644 --- a/components/script/dom/text.rs +++ b/components/script/dom/text.rs @@ -68,11 +68,11 @@ impl<'a> TextMethods for JSRef<'a, Text> { let owner_doc = node.owner_doc().root(); let new_node = owner_doc.r().CreateTextNode(new_data).root(); // Step 6. - let parent = node.parent_node().root(); + let parent = node.GetParentNode().root(); if let Some(ref parent) = parent { // Step 7. parent.r().InsertBefore(NodeCast::from_ref(new_node.r()), - node.next_sibling().root().r()) + node.GetNextSibling().root().r()) .unwrap(); // TODO: Ranges. } diff --git a/components/script/dom/textencoder.rs b/components/script/dom/textencoder.rs index 91a02257d71..09aeb01c5e4 100644 --- a/components/script/dom/textencoder.rs +++ b/components/script/dom/textencoder.rs @@ -14,7 +14,6 @@ use dom::bindings::utils::{Reflector, reflect_dom_object}; use util::str::DOMString; use std::borrow::ToOwned; -use std::ascii::AsciiExt; use std::ptr; use encoding::types::EncodingRef; @@ -50,7 +49,7 @@ impl TextEncoder { // https://encoding.spec.whatwg.org/#dom-textencoder pub fn Constructor(global: GlobalRef, label: DOMString) -> Fallible<Temporary<TextEncoder>> { - let encoding = match encoding_from_whatwg_label(&label.trim().to_ascii_lowercase()) { + let encoding = match encoding_from_whatwg_label(&label) { Some(enc) => enc, None => { debug!("Encoding Label Not Supported"); @@ -80,12 +79,12 @@ impl<'a> TextEncoderMethods for JSRef<'a, TextEncoder> { #[allow(unsafe_code)] fn Encode(self, cx: *mut JSContext, input: USVString) -> *mut JSObject { unsafe { - let output = self.encoder.encode(&input.0, EncoderTrap::Strict).unwrap(); - let length = output.len() as u32; + let encoded = self.encoder.encode(&input.0, EncoderTrap::Strict).unwrap(); + let length = encoded.len() as u32; let js_object: *mut JSObject = JS_NewUint8Array(cx, length); let js_object_data: *mut uint8_t = JS_GetUint8ArrayData(js_object, cx); - ptr::copy_nonoverlapping(js_object_data, output.as_ptr(), length as usize); + ptr::copy_nonoverlapping(encoded.as_ptr(), js_object_data, length as usize); return js_object; } } diff --git a/components/script/dom/treewalker.rs b/components/script/dom/treewalker.rs index 094092ec90e..237bbfb892d 100644 --- a/components/script/dom/treewalker.rs +++ b/components/script/dom/treewalker.rs @@ -14,7 +14,7 @@ use dom::bindings::js::{JS, JSRef, MutHeap, OptionalRootable, Rootable}; use dom::bindings::js::Temporary; use dom::bindings::utils::{Reflector, reflect_dom_object}; use dom::document::{Document, DocumentHelpers}; -use dom::node::{Node, NodeHelpers}; +use dom::node::Node; // https://dom.spec.whatwg.org/#interface-treewalker #[dom_struct] @@ -93,37 +93,175 @@ impl<'a> TreeWalkerMethods for JSRef<'a, TreeWalker> { // https://dom.spec.whatwg.org/#dom-treewalker-parentnode fn ParentNode(self) -> Fallible<Option<Temporary<Node>>> { - self.parent_node() + // "1. Let node be the value of the currentNode attribute." + let mut node = self.current_node.get().root().get_unsound_ref_forever(); + // "2. While node is not null and is not root, run these substeps:" + while !self.is_root_node(node) { + // "1. Let node be node's parent." + match node.GetParentNode() { + Some(n) => { + node = n.root().get_unsound_ref_forever(); + // "2. If node is not null and filtering node returns FILTER_ACCEPT, + // then set the currentNode attribute to node, return node." + match try!(self.accept_node(node)) { + NodeFilterConstants::FILTER_ACCEPT => { + self.current_node.set(JS::from_rooted(node)); + return Ok(Some(Temporary::from_rooted(node))) + }, + _ => {} + } + }, + None => break, + } + } + // "3. Return null." + Ok(None) } // https://dom.spec.whatwg.org/#dom-treewalker-firstchild fn FirstChild(self) -> Fallible<Option<Temporary<Node>>> { - self.first_child() + // "The firstChild() method must traverse children of type first." + self.traverse_children(|node| node.GetFirstChild(), + |node| node.GetNextSibling()) } // https://dom.spec.whatwg.org/#dom-treewalker-lastchild fn LastChild(self) -> Fallible<Option<Temporary<Node>>> { - self.last_child() + // "The lastChild() method must traverse children of type last." + self.traverse_children(|node| node.GetLastChild(), + |node| node.GetPreviousSibling()) } // https://dom.spec.whatwg.org/#dom-treewalker-previoussibling fn PreviousSibling(self) -> Fallible<Option<Temporary<Node>>> { - self.prev_sibling() + // "The nextSibling() method must traverse siblings of type next." + self.traverse_siblings(|node| node.GetLastChild(), + |node| node.GetPreviousSibling()) } // https://dom.spec.whatwg.org/#dom-treewalker-nextsibling fn NextSibling(self) -> Fallible<Option<Temporary<Node>>> { - self.next_sibling() + // "The previousSibling() method must traverse siblings of type previous." + self.traverse_siblings(|node| node.GetFirstChild(), + |node| node.GetNextSibling()) } // https://dom.spec.whatwg.org/#dom-treewalker-previousnode fn PreviousNode(self) -> Fallible<Option<Temporary<Node>>> { - self.prev_node() + // "1. Let node be the value of the currentNode attribute." + let mut node = self.current_node.get().root().get_unsound_ref_forever(); + // "2. While node is not root, run these substeps:" + while !self.is_root_node(node) { + // "1. Let sibling be the previous sibling of node." + let mut sibling_op = node.GetPreviousSibling(); + // "2. While sibling is not null, run these subsubsteps:" + while sibling_op.is_some() { + // "1. Set node to sibling." + node = sibling_op.unwrap().root().get_unsound_ref_forever(); + // "2. Filter node and let result be the return value." + // "3. While result is not FILTER_REJECT and node has a child, + // set node to its last child and then filter node and + // set result to the return value." + // "4. If result is FILTER_ACCEPT, then + // set the currentNode attribute to node and return node." + loop { + let result = try!(self.accept_node(node)); + match result { + NodeFilterConstants::FILTER_REJECT => break, + _ if node.GetFirstChild().is_some() => + node = node.GetLastChild().unwrap().root() + .get_unsound_ref_forever(), + NodeFilterConstants::FILTER_ACCEPT => { + self.current_node.set(JS::from_rooted(node)); + return Ok(Some(Temporary::from_rooted(node))) + }, + _ => break + } + } + // "5. Set sibling to the previous sibling of node." + sibling_op = node.GetPreviousSibling() + } + // "3. If node is root or node's parent is null, return null." + if self.is_root_node(node) || node.GetParentNode().is_none() { + return Ok(None) + } + // "4. Set node to its parent." + match node.GetParentNode() { + None => + // This can happen if the user set the current node to somewhere + // outside of the tree rooted at the original root. + return Ok(None), + Some(n) => node = n.root().get_unsound_ref_forever() + } + // "5. Filter node and if the return value is FILTER_ACCEPT, then + // set the currentNode attribute to node and return node." + match try!(self.accept_node(node)) { + NodeFilterConstants::FILTER_ACCEPT => { + self.current_node.set(JS::from_rooted(node)); + return Ok(Some(Temporary::from_rooted(node))) + }, + _ => {} + } + } + // "6. Return null." + Ok(None) } // https://dom.spec.whatwg.org/#dom-treewalker-nextnode fn NextNode(self) -> Fallible<Option<Temporary<Node>>> { - self.next_node() + // "1. Let node be the value of the currentNode attribute." + let mut node = self.current_node.get().root().get_unsound_ref_forever(); + // "2. Let result be FILTER_ACCEPT." + let mut result = NodeFilterConstants::FILTER_ACCEPT; + // "3. Run these substeps:" + loop { + // "1. While result is not FILTER_REJECT and node has a child, run these subsubsteps:" + loop { + match result { + NodeFilterConstants::FILTER_REJECT => break, + _ => {} + } + match node.GetFirstChild() { + None => break, + Some (child) => { + // "1. Set node to its first child." + node = child.root().get_unsound_ref_forever(); + // "2. Filter node and set result to the return value." + result = try!(self.accept_node(node)); + // "3. If result is FILTER_ACCEPT, then + // set the currentNode attribute to node and return node." + match result { + NodeFilterConstants::FILTER_ACCEPT => { + self.current_node.set(JS::from_rooted(node)); + return Ok(Some(Temporary::from_rooted(node))) + }, + _ => {} + } + } + } + } + // "2. If a node is following node and is not following root, + // set node to the first such node." + // "Otherwise, return null." + match self.first_following_node_not_following_root(node) { + None => return Ok(None), + Some(n) => { + node = n.root().get_unsound_ref_forever(); + // "3. Filter node and set result to the return value." + result = try!(self.accept_node(node)); + // "4. If result is FILTER_ACCEPT, then + // set the currentNode attribute to node and return node." + match result { + NodeFilterConstants::FILTER_ACCEPT => { + self.current_node.set(JS::from_rooted(node)); + return Ok(Some(Temporary::from_rooted(node))) + }, + _ => {} + } + } + } + // "5. Run these substeps again." + } } } @@ -209,7 +347,7 @@ impl<'a> PrivateTreeWalkerHelpers for JSRef<'a, TreeWalker> { }, None => { // "3. Let parent be node's parent." - match node.parent_node().map(|p| p.root().get_unsound_ref_forever()) { + match node.GetParentNode().map(|p| p.root().get_unsound_ref_forever()) { // "4. If parent is null, parent is root, // or parent is currentNode attribute's value, // return null." @@ -280,7 +418,7 @@ impl<'a> PrivateTreeWalkerHelpers for JSRef<'a, TreeWalker> { } } // "3. Set node to its parent." - match node.parent_node().map(|p| p.root().get_unsound_ref_forever()) { + match node.GetParentNode().map(|p| p.root().get_unsound_ref_forever()) { // "4. If node is null or is root, return null." None => return Ok(None), Some(n) if self.is_root_node(n) => return Ok(None), @@ -302,11 +440,11 @@ impl<'a> PrivateTreeWalkerHelpers for JSRef<'a, TreeWalker> { -> Option<Temporary<Node>> { // "An object A is following an object B if A and B are in the same tree // and A comes after B in tree order." - match node.next_sibling() { + match node.GetNextSibling() { None => { let mut candidate = node; - while !self.is_root_node(candidate) && candidate.next_sibling().is_none() { - match candidate.parent_node() { + while !self.is_root_node(candidate) && candidate.GetNextSibling().is_none() { + match candidate.GetParentNode() { None => // This can happen if the user set the current node to somewhere // outside of the tree rooted at the original root. @@ -317,7 +455,7 @@ impl<'a> PrivateTreeWalkerHelpers for JSRef<'a, TreeWalker> { if self.is_root_node(candidate) { None } else { - candidate.next_sibling() + candidate.GetNextSibling() } }, it => it @@ -354,195 +492,11 @@ impl<'a> PrivateTreeWalkerHelpers for JSRef<'a, TreeWalker> { } } -pub trait TreeWalkerHelpers { - fn parent_node(self) -> Fallible<Option<Temporary<Node>>>; - fn first_child(self) -> Fallible<Option<Temporary<Node>>>; - fn last_child(self) -> Fallible<Option<Temporary<Node>>>; - fn next_sibling(self) -> Fallible<Option<Temporary<Node>>>; - fn prev_sibling(self) -> Fallible<Option<Temporary<Node>>>; - fn next_node(self) -> Fallible<Option<Temporary<Node>>>; - fn prev_node(self) -> Fallible<Option<Temporary<Node>>>; -} - -impl<'a> TreeWalkerHelpers for JSRef<'a, TreeWalker> { - // https://dom.spec.whatwg.org/#dom-treewalker-parentnode - fn parent_node(self) -> Fallible<Option<Temporary<Node>>> { - // "1. Let node be the value of the currentNode attribute." - let mut node = self.current_node.get().root().get_unsound_ref_forever(); - // "2. While node is not null and is not root, run these substeps:" - while !self.is_root_node(node) { - // "1. Let node be node's parent." - match node.parent_node() { - Some(n) => { - node = n.root().get_unsound_ref_forever(); - // "2. If node is not null and filtering node returns FILTER_ACCEPT, - // then set the currentNode attribute to node, return node." - match try!(self.accept_node(node)) { - NodeFilterConstants::FILTER_ACCEPT => { - self.current_node.set(JS::from_rooted(node)); - return Ok(Some(Temporary::from_rooted(node))) - }, - _ => {} - } - }, - None => break, - } - } - // "3. Return null." - Ok(None) - } - - // https://dom.spec.whatwg.org/#dom-treewalker-firstchild - fn first_child(self) -> Fallible<Option<Temporary<Node>>> { - // "The firstChild() method must traverse children of type first." - self.traverse_children(|node| node.first_child(), - |node| node.next_sibling()) - } - - // https://dom.spec.whatwg.org/#dom-treewalker-lastchild - fn last_child(self) -> Fallible<Option<Temporary<Node>>> { - // "The lastChild() method must traverse children of type last." - self.traverse_children(|node| node.last_child(), - |node| node.prev_sibling()) - } - - // https://dom.spec.whatwg.org/#dom-treewalker-nextsibling - fn next_sibling(self) -> Fallible<Option<Temporary<Node>>> { - // "The nextSibling() method must traverse siblings of type next." - self.traverse_siblings(|node| node.first_child(), - |node| node.next_sibling()) - } - - // https://dom.spec.whatwg.org/#dom-treewalker-previoussibling - fn prev_sibling(self) -> Fallible<Option<Temporary<Node>>> { - // "The previousSibling() method must traverse siblings of type previous." - self.traverse_siblings(|node| node.last_child(), - |node| node.prev_sibling()) - } - - // https://dom.spec.whatwg.org/#dom-treewalker-previousnode - fn prev_node(self) -> Fallible<Option<Temporary<Node>>> { - // "1. Let node be the value of the currentNode attribute." - let mut node = self.current_node.get().root().get_unsound_ref_forever(); - // "2. While node is not root, run these substeps:" - while !self.is_root_node(node) { - // "1. Let sibling be the previous sibling of node." - let mut sibling_op = node.prev_sibling(); - // "2. While sibling is not null, run these subsubsteps:" - while sibling_op.is_some() { - // "1. Set node to sibling." - node = sibling_op.unwrap().root().get_unsound_ref_forever(); - // "2. Filter node and let result be the return value." - // "3. While result is not FILTER_REJECT and node has a child, - // set node to its last child and then filter node and - // set result to the return value." - // "4. If result is FILTER_ACCEPT, then - // set the currentNode attribute to node and return node." - loop { - let result = try!(self.accept_node(node)); - match result { - NodeFilterConstants::FILTER_REJECT => break, - _ if node.first_child().is_some() => - node = node.last_child().unwrap().root().get_unsound_ref_forever(), - NodeFilterConstants::FILTER_ACCEPT => { - self.current_node.set(JS::from_rooted(node)); - return Ok(Some(Temporary::from_rooted(node))) - }, - _ => break - } - } - // "5. Set sibling to the previous sibling of node." - sibling_op = node.prev_sibling() - } - // "3. If node is root or node's parent is null, return null." - if self.is_root_node(node) || node.parent_node() == None { - return Ok(None) - } - // "4. Set node to its parent." - match node.parent_node() { - None => - // This can happen if the user set the current node to somewhere - // outside of the tree rooted at the original root. - return Ok(None), - Some(n) => node = n.root().get_unsound_ref_forever() - } - // "5. Filter node and if the return value is FILTER_ACCEPT, then - // set the currentNode attribute to node and return node." - match try!(self.accept_node(node)) { - NodeFilterConstants::FILTER_ACCEPT => { - self.current_node.set(JS::from_rooted(node)); - return Ok(Some(Temporary::from_rooted(node))) - }, - _ => {} - } - } - // "6. Return null." - Ok(None) - } - - // https://dom.spec.whatwg.org/#dom-treewalker-nextnode - fn next_node(self) -> Fallible<Option<Temporary<Node>>> { - // "1. Let node be the value of the currentNode attribute." - let mut node = self.current_node.get().root().get_unsound_ref_forever(); - // "2. Let result be FILTER_ACCEPT." - let mut result = NodeFilterConstants::FILTER_ACCEPT; - // "3. Run these substeps:" - loop { - // "1. While result is not FILTER_REJECT and node has a child, run these subsubsteps:" - loop { - match result { - NodeFilterConstants::FILTER_REJECT => break, - _ => {} - } - match node.first_child() { - None => break, - Some (child) => { - // "1. Set node to its first child." - node = child.root().get_unsound_ref_forever(); - // "2. Filter node and set result to the return value." - result = try!(self.accept_node(node)); - // "3. If result is FILTER_ACCEPT, then - // set the currentNode attribute to node and return node." - match result { - NodeFilterConstants::FILTER_ACCEPT => { - self.current_node.set(JS::from_rooted(node)); - return Ok(Some(Temporary::from_rooted(node))) - }, - _ => {} - } - } - } - } - // "2. If a node is following node and is not following root, - // set node to the first such node." - // "Otherwise, return null." - match self.first_following_node_not_following_root(node) { - None => return Ok(None), - Some(n) => { - node = n.root().get_unsound_ref_forever(); - // "3. Filter node and set result to the return value." - result = try!(self.accept_node(node)); - // "4. If result is FILTER_ACCEPT, then - // set the currentNode attribute to node and return node." - match result { - NodeFilterConstants::FILTER_ACCEPT => { - self.current_node.set(JS::from_rooted(node)); - return Ok(Some(Temporary::from_rooted(node))) - }, - _ => {} - } - } - } - // "5. Run these substeps again." - } - } -} - impl<'a> Iterator for JSRef<'a, TreeWalker> { type Item = JSRef<'a, Node>; fn next(&mut self) -> Option<JSRef<'a, Node>> { - match self.next_node() { + match self.NextNode() { Ok(node) => node.map(|n| n.root().get_unsound_ref_forever()), Err(_) => // The Err path happens only when a JavaScript diff --git a/components/script/dom/userscripts.rs b/components/script/dom/userscripts.rs index 3f4a7e6f268..1910784b0c5 100644 --- a/components/script/dom/userscripts.rs +++ b/components/script/dom/userscripts.rs @@ -28,7 +28,7 @@ pub fn load_script(head: JSRef<HTMLHeadElement>) { p.push("user-agent-js"); p } else { - PathBuf::new(path_str) + PathBuf::from(path_str) }; let mut files = read_dir(&path).ok().expect("Bad path passed to --userscripts") diff --git a/components/script/dom/webglbuffer.rs b/components/script/dom/webglbuffer.rs new file mode 100644 index 00000000000..ee19ff7d57c --- /dev/null +++ b/components/script/dom/webglbuffer.rs @@ -0,0 +1,39 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl +use dom::bindings::codegen::Bindings::WebGLBufferBinding; +use dom::bindings::global::GlobalRef; +use dom::bindings::js::{Temporary, JSRef}; +use dom::bindings::utils::reflect_dom_object; +use dom::webglobject::WebGLObject; + +#[dom_struct] +pub struct WebGLBuffer { + webgl_object: WebGLObject, + id: u32, +} + +impl WebGLBuffer { + fn new_inherited(id: u32) -> WebGLBuffer { + WebGLBuffer { + webgl_object: WebGLObject::new_inherited(), + id: id, + } + } + + pub fn new(global: GlobalRef, id: u32) -> Temporary<WebGLBuffer> { + reflect_dom_object(box WebGLBuffer::new_inherited(id), global, WebGLBufferBinding::Wrap) + } +} + +pub trait WebGLBufferHelpers { + fn get_id(&self) -> u32; +} + +impl<'a> WebGLBufferHelpers for JSRef<'a, WebGLBuffer> { + fn get_id(&self) -> u32 { + self.id + } +} diff --git a/components/script/dom/webglobject.rs b/components/script/dom/webglobject.rs new file mode 100644 index 00000000000..0decbe1060d --- /dev/null +++ b/components/script/dom/webglobject.rs @@ -0,0 +1,26 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl +use dom::bindings::codegen::Bindings::WebGLObjectBinding; +use dom::bindings::global::GlobalRef; +use dom::bindings::js::{Temporary}; +use dom::bindings::utils::{Reflector, reflect_dom_object}; + +#[dom_struct] +pub struct WebGLObject { + reflector_: Reflector, +} + +impl WebGLObject { + pub fn new_inherited() -> WebGLObject { + WebGLObject { + reflector_: Reflector::new(), + } + } + + pub fn new(global: GlobalRef) -> Temporary<WebGLObject> { + reflect_dom_object(box WebGLObject::new_inherited(), global, WebGLObjectBinding::Wrap) + } +} diff --git a/components/script/dom/webglprogram.rs b/components/script/dom/webglprogram.rs new file mode 100644 index 00000000000..7839b0ffb03 --- /dev/null +++ b/components/script/dom/webglprogram.rs @@ -0,0 +1,39 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl +use dom::bindings::codegen::Bindings::WebGLProgramBinding; +use dom::bindings::global::GlobalRef; +use dom::bindings::js::{Temporary, JSRef}; +use dom::bindings::utils::reflect_dom_object; +use dom::webglobject::WebGLObject; + +#[dom_struct] +pub struct WebGLProgram { + webgl_object: WebGLObject, + id: u32, +} + +impl WebGLProgram { + fn new_inherited(id: u32) -> WebGLProgram { + WebGLProgram { + webgl_object: WebGLObject::new_inherited(), + id: id, + } + } + + pub fn new(global: GlobalRef, id: u32) -> Temporary<WebGLProgram> { + reflect_dom_object(box WebGLProgram::new_inherited(id), global, WebGLProgramBinding::Wrap) + } +} + +pub trait WebGLProgramHelpers { + fn get_id(&self) -> u32; +} + +impl<'a> WebGLProgramHelpers for JSRef<'a, WebGLProgram> { + fn get_id(&self) -> u32 { + self.id + } +} diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index a521f469d1d..82dfc614f52 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -5,13 +5,23 @@ use canvas::webgl_paint_task::WebGLPaintTask; use canvas::canvas_msg::{CanvasMsg, CanvasWebGLMsg, CanvasCommonMsg}; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding; -use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextMethods; +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}; use dom::htmlcanvaselement::{HTMLCanvasElement}; +use dom::webglbuffer::{WebGLBuffer, WebGLBufferHelpers}; +use dom::webglshader::{WebGLShader, WebGLShaderHelpers}; +use dom::webglprogram::{WebGLProgram, WebGLProgramHelpers}; +use dom::webgluniformlocation::{WebGLUniformLocation, WebGLUniformLocationHelpers}; use geom::size::Size2D; -use std::sync::mpsc::{Sender}; +use js::jsapi::{JSContext, JSObject}; +use js::jsfriendapi::bindgen::{JS_GetFloat32ArrayData, JS_GetObjectAsArrayBufferView}; +use js::jsval::{JSVal, NullValue, Int32Value}; +use std::mem; +use std::ptr; +use std::sync::mpsc::{channel, Sender}; +use util::str::DOMString; #[dom_struct] pub struct WebGLRenderingContext { @@ -51,7 +61,6 @@ impl WebGLRenderingContext { } } -#[unsafe_destructor] impl Drop for WebGLRenderingContext { fn drop(&mut self) { self.renderer.send(CanvasMsg::Common(CanvasCommonMsg::Close)).unwrap(); @@ -59,13 +68,212 @@ impl Drop for WebGLRenderingContext { } impl<'a> WebGLRenderingContextMethods for JSRef<'a, WebGLRenderingContext> { - fn Clear(self, mask: u32) -> () { + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9 + fn AttachShader(self, program: Option<JSRef<WebGLProgram>>, shader: Option<JSRef<WebGLShader>>) { + let program_id = match program { + Some(program) => program.get_id(), + None => return, + }; + let shader_id = match shader { + Some(shader) => shader.get_id(), + None => return, + }; + self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::AttachShader(program_id, shader_id))).unwrap() + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5 + fn BindBuffer(self, buffer_type: u32, buffer: Option<JSRef<WebGLBuffer>>) { + let buffer_id = match buffer { + Some(buffer) => buffer.get_id(), + None => return, + }; + self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::BindBuffer(buffer_type, buffer_id))).unwrap() + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5 + #[allow(unsafe_code)] + fn BufferData(self, cx: *mut JSContext, target: u32, data: Option<*mut JSObject>, usage: u32) { + let data = match data { + Some(data) => data, + None => return, + }; + let data_vec; + unsafe { + let mut length = 0; + let mut ptr = ptr::null_mut(); + let buffer_data = JS_GetObjectAsArrayBufferView(cx, data, &mut length, &mut ptr); + if buffer_data.is_null() { + panic!("Argument data to WebGLRenderingContext.bufferdata is not a Float32Array") + } + let data_f32 = JS_GetFloat32ArrayData(buffer_data, cx); + let data_vec_length = length / mem::size_of::<f32>() as u32; + data_vec = Vec::from_raw_buf(data_f32, data_vec_length as usize); + } + self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::BufferData(target, data_vec, usage))).unwrap() + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.11 + fn Clear(self, mask: u32) { self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::Clear(mask))).unwrap() } - fn ClearColor(self, red: f32, green: f32, blue: f32, alpha: f32) -> (){ + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3 + fn ClearColor(self, red: f32, green: f32, blue: f32, alpha: f32) { self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::ClearColor(red, green, blue, alpha))).unwrap() } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9 + fn CompileShader(self, shader: Option<JSRef<WebGLShader>>) { + let shader_id = match shader { + Some(shader) => shader.get_id(), + None => return, + }; + self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::CompileShader(shader_id))).unwrap() + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5 + fn CreateBuffer(self) -> Option<Temporary<WebGLBuffer>> { + let (sender, receiver) = channel::<u32>(); + self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::CreateBuffer(sender))).unwrap(); + Some(WebGLBuffer::new(self.global.root().r(), receiver.recv().unwrap())) + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9 + fn CreateProgram(self) -> Option<Temporary<WebGLProgram>> { + let (sender, receiver) = channel::<u32>(); + self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::CreateProgram(sender))).unwrap(); + Some(WebGLProgram::new(self.global.root().r(), receiver.recv().unwrap())) + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9 + fn CreateShader(self, shader_type: u32) -> Option<Temporary<WebGLShader>> { + let (sender, receiver) = channel::<u32>(); + self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::CreateShader(shader_type, sender))).unwrap(); + Some(WebGLShader::new(self.global.root().r(), receiver.recv().unwrap())) + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.11 + fn DrawArrays(self, mode: u32, first: i32, count: i32) { + self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::DrawArrays(mode, first, count))).unwrap() + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn EnableVertexAttribArray(self, attrib_id: u32) { + self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::EnableVertexAttribArray(attrib_id))).unwrap() + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn GetAttribLocation(self, program: Option<JSRef<WebGLProgram>>, name: DOMString) -> i32 { + let program_id = match program { + Some(program) => program.get_id(), + None => return -1, + }; + let (sender, receiver) = channel::<i32>(); + self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::GetAttribLocation(program_id, name, sender))).unwrap(); + receiver.recv().unwrap() + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9 + fn GetShaderInfoLog(self, shader: Option<JSRef<WebGLShader>>) -> Option<DOMString> { + let shader_id = match shader { + Some(shader) => shader.get_id(), + None => return None, + }; + let (sender, receiver) = channel::<String>(); + self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::GetShaderInfoLog(shader_id, sender))).unwrap(); + let info = receiver.recv().unwrap(); + Some(info) + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9 + fn GetShaderParameter(self, _: *mut JSContext, shader: Option<JSRef<WebGLShader>>, param_id: u32) -> JSVal { + let shader_id = match shader { + Some(shader) => shader.get_id(), + None => return NullValue(), + }; + let (sender, receiver) = channel::<i32>(); + self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::GetShaderParameter(shader_id, param_id, sender))).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>> { + let program_id = match program { + Some(program) => program.get_id(), + None => return None, + }; + let (sender, receiver) = channel::<u32>(); + self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::GetUniformLocation(program_id, name, sender))).unwrap(); + Some(WebGLUniformLocation::new(self.global.root().r(), receiver.recv().unwrap())) + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9 + fn LinkProgram(self, program: Option<JSRef<WebGLProgram>>) { + let program_id = match program { + Some(program) => program.get_id(), + None => return, + }; + self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::LinkProgram(program_id))).unwrap() + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9 + fn ShaderSource(self, shader: Option<JSRef<WebGLShader>>, source: DOMString) { + let shader_id = match shader { + Some(shader) => shader.get_id(), + None => return, + }; + let source_lines: Vec<String> = source.trim() + .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() + } + + // 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>) { + let uniform_id = match uniform { + Some(uniform) => uniform.get_id(), + None => return, + }; + let data = match data { + Some(data) => data, + None => return, + }; + let data_vec: Vec<f32>; + unsafe { + let data_f32 = JS_GetFloat32ArrayData(data, cx); + data_vec = Vec::from_raw_buf(data_f32, 4); + } + self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::Uniform4fv(uniform_id, data_vec))).unwrap() + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9 + fn UseProgram(self, program: Option<JSRef<WebGLProgram>>) { + let program_id = match program { + Some(program) => program.get_id(), + None => return, + }; + self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::UseProgram(program_id as u32))).unwrap() + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn VertexAttribPointer(self, attrib_id: u32, size: i32, data_type: u32, + 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() + } + _ => panic!("VertexAttribPointer: Data Type not supported") + } + + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.4 + fn Viewport(self, x: i32, y: i32, width: i32, height: i32) { + self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::Viewport(x, y, width, height))).unwrap() + } } pub trait LayoutCanvasWebGLRenderingContextHelpers { diff --git a/components/script/dom/webglshader.rs b/components/script/dom/webglshader.rs new file mode 100644 index 00000000000..ade6f6e93c9 --- /dev/null +++ b/components/script/dom/webglshader.rs @@ -0,0 +1,40 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl +use dom::bindings::codegen::Bindings::WebGLShaderBinding; +use dom::bindings::global::GlobalRef; +use dom::bindings::js::{Temporary, JSRef}; +use dom::bindings::utils::reflect_dom_object; +use dom::webglobject::WebGLObject; + +#[dom_struct] +pub struct WebGLShader { + webgl_object: WebGLObject, + id: u32, +} + +impl WebGLShader { + fn new_inherited(id: u32) -> WebGLShader { + WebGLShader { + webgl_object: WebGLObject::new_inherited(), + id: id, + } + } + + pub fn new(global: GlobalRef, id: u32) -> Temporary<WebGLShader> { + reflect_dom_object(box WebGLShader::new_inherited(id), global, WebGLShaderBinding::Wrap) + } +} + +pub trait WebGLShaderHelpers { + fn get_id(&self) -> u32; +} + +impl<'a> WebGLShaderHelpers for JSRef<'a, WebGLShader> { + fn get_id(&self) -> u32 { + self.id + } +} + diff --git a/components/script/dom/webgluniformlocation.rs b/components/script/dom/webgluniformlocation.rs new file mode 100644 index 00000000000..8d7beab3894 --- /dev/null +++ b/components/script/dom/webgluniformlocation.rs @@ -0,0 +1,39 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl +use dom::bindings::codegen::Bindings::WebGLUniformLocationBinding; +use dom::bindings::global::GlobalRef; +use dom::bindings::js::{Temporary, JSRef}; +use dom::bindings::utils::reflect_dom_object; +use dom::webglobject::WebGLObject; + +#[dom_struct] +pub struct WebGLUniformLocation { + webgl_object: WebGLObject, + id: u32, +} + +impl WebGLUniformLocation { + fn new_inherited(id: u32) -> WebGLUniformLocation { + WebGLUniformLocation { + webgl_object: WebGLObject::new_inherited(), + id: id, + } + } + + pub fn new(global: GlobalRef, id: u32) -> Temporary<WebGLUniformLocation> { + reflect_dom_object(box WebGLUniformLocation::new_inherited(id), global, WebGLUniformLocationBinding::Wrap) + } +} + +pub trait WebGLUniformLocationHelpers { + fn get_id(&self) -> u32; +} + +impl<'a> WebGLUniformLocationHelpers for JSRef<'a, WebGLUniformLocation> { + fn get_id(&self) -> u32 { + self.id + } +} diff --git a/components/script/dom/webidls/CanvasRenderingContext2D.webidl b/components/script/dom/webidls/CanvasRenderingContext2D.webidl index 447afc745f5..e9ce0aa78e1 100644 --- a/components/script/dom/webidls/CanvasRenderingContext2D.webidl +++ b/components/script/dom/webidls/CanvasRenderingContext2D.webidl @@ -32,7 +32,7 @@ interface CanvasRenderingContext2D { // transformations (default transform is the identity matrix) // attribute SVGMatrix currentTransform; void scale(unrestricted double x, unrestricted double y); - //void rotate(unrestricted double angle); + void rotate(unrestricted double angle); void translate(unrestricted double x, unrestricted double y); void transform(unrestricted double a, unrestricted double b, @@ -46,7 +46,7 @@ interface CanvasRenderingContext2D { unrestricted double d, unrestricted double e, unrestricted double f); - //void resetTransform(); + void resetTransform(); // compositing attribute unrestricted double globalAlpha; // (default 1.0) diff --git a/components/script/dom/webidls/CloseEvent.webidl b/components/script/dom/webidls/CloseEvent.webidl new file mode 100644 index 00000000000..b30096e0fb6 --- /dev/null +++ b/components/script/dom/webidls/CloseEvent.webidl @@ -0,0 +1,17 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//https://html.spec.whatwg.org/multipage/#the-closeevent-interfaces +[Constructor(DOMString type, optional CloseEventInit eventInitDict)/*, Exposed=(Window,Worker)*/] +interface CloseEvent : Event { + readonly attribute boolean wasClean; + readonly attribute unsigned short code; + readonly attribute DOMString reason; +}; + +dictionary CloseEventInit : EventInit { + boolean wasClean = false; + unsigned short code = 0; + DOMString reason = ""; +}; diff --git a/components/script/dom/webidls/HTMLInputElement.webidl b/components/script/dom/webidls/HTMLInputElement.webidl index c62d29ddeeb..81ff5f97426 100644 --- a/components/script/dom/webidls/HTMLInputElement.webidl +++ b/components/script/dom/webidls/HTMLInputElement.webidl @@ -34,7 +34,8 @@ interface HTMLInputElement : HTMLElement { attribute DOMString placeholder; attribute boolean readOnly; // attribute boolean required; - attribute unsigned long size; + [SetterThrows] + attribute unsigned long size; // attribute DOMString src; // attribute DOMString step; attribute DOMString type; diff --git a/components/script/dom/webidls/HTMLTableCellElement.webidl b/components/script/dom/webidls/HTMLTableCellElement.webidl index 8f9ce054dd1..de1211b6333 100644 --- a/components/script/dom/webidls/HTMLTableCellElement.webidl +++ b/components/script/dom/webidls/HTMLTableCellElement.webidl @@ -5,7 +5,7 @@ // https://www.whatwg.org/html/#htmltablecellelement interface HTMLTableCellElement : HTMLElement { - // attribute unsigned long colSpan; + attribute unsigned long colSpan; // attribute unsigned long rowSpan; //[PutForwards=value] readonly attribute DOMSettableTokenList headers; //readonly attribute long cellIndex; diff --git a/components/script/dom/webidls/HTMLTextAreaElement.webidl b/components/script/dom/webidls/HTMLTextAreaElement.webidl index 7feec003ba5..fa70cb4d47a 100644 --- a/components/script/dom/webidls/HTMLTextAreaElement.webidl +++ b/components/script/dom/webidls/HTMLTextAreaElement.webidl @@ -7,7 +7,8 @@ interface HTMLTextAreaElement : HTMLElement { // attribute DOMString autocomplete; // attribute boolean autofocus; - attribute unsigned long cols; + [SetterThrows] + attribute unsigned long cols; // attribute DOMString dirName; attribute boolean disabled; //readonly attribute HTMLFormElement? form; @@ -18,6 +19,7 @@ interface HTMLTextAreaElement : HTMLElement { attribute DOMString placeholder; attribute boolean readOnly; attribute boolean required; + [SetterThrows] attribute unsigned long rows; attribute DOMString wrap; diff --git a/components/script/dom/webidls/WebGLBuffer.webidl b/components/script/dom/webidls/WebGLBuffer.webidl new file mode 100644 index 00000000000..418e9ef231e --- /dev/null +++ b/components/script/dom/webidls/WebGLBuffer.webidl @@ -0,0 +1,7 @@ +// +// WebGL IDL definitions scraped from the Khronos specification: +// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.4 +// + +interface WebGLBuffer : WebGLObject { +}; diff --git a/components/script/dom/webidls/WebGLObject.webidl b/components/script/dom/webidls/WebGLObject.webidl new file mode 100644 index 00000000000..468f3762b44 --- /dev/null +++ b/components/script/dom/webidls/WebGLObject.webidl @@ -0,0 +1,7 @@ +// +// WebGL IDL definitions scraped from the Khronos specification: +// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.3 +// + +interface WebGLObject { +}; diff --git a/components/script/dom/webidls/WebGLProgram.webidl b/components/script/dom/webidls/WebGLProgram.webidl new file mode 100644 index 00000000000..80b2d535931 --- /dev/null +++ b/components/script/dom/webidls/WebGLProgram.webidl @@ -0,0 +1,7 @@ +// +// WebGL IDL definitions scraped from the Khronos specification: +// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.6 +// + +interface WebGLProgram : WebGLObject { +}; diff --git a/components/script/dom/webidls/WebGLRenderingContext.webidl b/components/script/dom/webidls/WebGLRenderingContext.webidl index aa1d3535635..0aeb3077ee5 100644 --- a/components/script/dom/webidls/WebGLRenderingContext.webidl +++ b/components/script/dom/webidls/WebGLRenderingContext.webidl @@ -1,4 +1,3 @@ -// AUTOGENERATED FILE -- DO NOT EDIT -- SEE Makefile // // WebGL IDL definitions scraped from the Khronos specification: // https://www.khronos.org/registry/webgl/specs/latest/ @@ -34,30 +33,15 @@ dictionary WebGLContextAttributes { GLboolean failIfMajorPerformanceCaveat = false; }; -//interface WebGLObject { -//}; - -//interface WebGLBuffer : WebGLObject { -//}; - //interface WebGLFramebuffer : WebGLObject { //}; -//interface WebGLProgram : WebGLObject { -//}; - //interface WebGLRenderbuffer : WebGLObject { //}; -//interface WebGLShader : WebGLObject { -//}; - //interface WebGLTexture : WebGLObject { //}; -//interface WebGLUniformLocation { -//}; - //interface WebGLActiveInfo { // readonly attribute GLint size; // readonly attribute GLenum type; @@ -75,18 +59,18 @@ interface WebGLRenderingContextBase { /* ClearBufferMask */ - //const GLenum DEPTH_BUFFER_BIT = 0x00000100; - //const GLenum STENCIL_BUFFER_BIT = 0x00000400; + const GLenum DEPTH_BUFFER_BIT = 0x00000100; + const GLenum STENCIL_BUFFER_BIT = 0x00000400; const GLenum COLOR_BUFFER_BIT = 0x00004000; /* BeginMode */ - //const GLenum POINTS = 0x0000; - //const GLenum LINES = 0x0001; - //const GLenum LINE_LOOP = 0x0002; - //const GLenum LINE_STRIP = 0x0003; - //const GLenum TRIANGLES = 0x0004; - //const GLenum TRIANGLE_STRIP = 0x0005; - //const GLenum TRIANGLE_FAN = 0x0006; + const GLenum POINTS = 0x0000; + const GLenum LINES = 0x0001; + const GLenum LINE_LOOP = 0x0002; + const GLenum LINE_STRIP = 0x0003; + const GLenum TRIANGLES = 0x0004; + const GLenum TRIANGLE_STRIP = 0x0005; + const GLenum TRIANGLE_FAN = 0x0006; /* AlphaFunction (not supported in ES20) */ /* NEVER */ @@ -141,14 +125,14 @@ interface WebGLRenderingContextBase //const GLenum BLEND_COLOR = 0x8005; /* Buffer Objects */ - //const GLenum ARRAY_BUFFER = 0x8892; - //const GLenum ELEMENT_ARRAY_BUFFER = 0x8893; - //const GLenum ARRAY_BUFFER_BINDING = 0x8894; - //const GLenum ELEMENT_ARRAY_BUFFER_BINDING = 0x8895; + const GLenum ARRAY_BUFFER = 0x8892; + const GLenum ELEMENT_ARRAY_BUFFER = 0x8893; + const GLenum ARRAY_BUFFER_BINDING = 0x8894; + const GLenum ELEMENT_ARRAY_BUFFER_BINDING = 0x8895; - //const GLenum STREAM_DRAW = 0x88E0; - //const GLenum STATIC_DRAW = 0x88E4; - //const GLenum DYNAMIC_DRAW = 0x88E8; + const GLenum STREAM_DRAW = 0x88E0; + const GLenum STATIC_DRAW = 0x88E4; + const GLenum DYNAMIC_DRAW = 0x88E8; //const GLenum BUFFER_SIZE = 0x8764; //const GLenum BUFFER_USAGE = 0x8765; @@ -260,13 +244,13 @@ interface WebGLRenderingContextBase //const GLenum GENERATE_MIPMAP_HINT = 0x8192; /* DataType */ - //const GLenum BYTE = 0x1400; - //const GLenum UNSIGNED_BYTE = 0x1401; - //const GLenum SHORT = 0x1402; - //const GLenum UNSIGNED_SHORT = 0x1403; - //const GLenum INT = 0x1404; - //const GLenum UNSIGNED_INT = 0x1405; - //const GLenum FLOAT = 0x1406; + const GLenum BYTE = 0x1400; + const GLenum UNSIGNED_BYTE = 0x1401; + const GLenum SHORT = 0x1402; + const GLenum UNSIGNED_SHORT = 0x1403; + const GLenum INT = 0x1404; + const GLenum UNSIGNED_INT = 0x1405; + const GLenum FLOAT = 0x1406; /* PixelFormat */ //const GLenum DEPTH_COMPONENT = 0x1902; @@ -283,8 +267,8 @@ interface WebGLRenderingContextBase //const GLenum UNSIGNED_SHORT_5_6_5 = 0x8363; /* Shaders */ - //const GLenum FRAGMENT_SHADER = 0x8B30; - //const GLenum VERTEX_SHADER = 0x8B31; + const GLenum FRAGMENT_SHADER = 0x8B30; + const GLenum VERTEX_SHADER = 0x8B31; //const GLenum MAX_VERTEX_ATTRIBS = 0x8869; //const GLenum MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB; //const GLenum MAX_VARYING_VECTORS = 0x8DFC; @@ -430,7 +414,7 @@ interface WebGLRenderingContextBase //const GLenum IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B; /* Shader Source */ - //const GLenum COMPILE_STATUS = 0x8B81; + const GLenum COMPILE_STATUS = 0x8B81; /* Shader Precision-Specified Types */ //const GLenum LOW_FLOAT = 0x8DF0; @@ -504,9 +488,9 @@ interface WebGLRenderingContextBase //object? getExtension(DOMString name); //void activeTexture(GLenum texture); - //void attachShader(WebGLProgram? program, WebGLShader? shader); + void attachShader(WebGLProgram? program, WebGLShader? shader); //void bindAttribLocation(WebGLProgram? program, GLuint index, DOMString name); - //void bindBuffer(GLenum target, WebGLBuffer? buffer); + void bindBuffer(GLenum target, WebGLBuffer? buffer); //void bindFramebuffer(GLenum target, WebGLFramebuffer? framebuffer); //void bindRenderbuffer(GLenum target, WebGLRenderbuffer? renderbuffer); //void bindTexture(GLenum target, WebGLTexture? texture); @@ -517,9 +501,13 @@ interface WebGLRenderingContextBase //void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, // GLenum srcAlpha, GLenum dstAlpha); - //typedef (ArrayBuffer or ArrayBufferView) BufferDataSource; + // typedef (ArrayBuffer or ArrayBufferView) BufferDataSource; //void bufferData(GLenum target, GLsizeiptr size, GLenum usage); - //void bufferData(GLenum target, BufferDataSource? data, GLenum usage); + // FIXME(dmarcos) The function below is the original function in the webIdl: + // void bufferData(GLenum target, BufferDataSource? data, GLenum usage); + // The Code genearator doesn't handle BufferDataSource so we're using 'optional object' + // in the meantime + void bufferData(GLenum target, optional object data, GLenum usage); //void bufferSubData(GLenum target, GLintptr offset, BufferDataSource? data); //[WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target); @@ -528,7 +516,7 @@ interface WebGLRenderingContextBase //void clearDepth(GLclampf depth); //void clearStencil(GLint s); //void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); - //void compileShader(WebGLShader? shader); + void compileShader(WebGLShader? shader); //void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, // GLsizei width, GLsizei height, GLint border, @@ -544,11 +532,11 @@ interface WebGLRenderingContextBase //void copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, // GLint x, GLint y, GLsizei width, GLsizei height); - //WebGLBuffer? createBuffer(); + WebGLBuffer? createBuffer(); //WebGLFramebuffer? createFramebuffer(); - //WebGLProgram? createProgram(); + WebGLProgram? createProgram(); //WebGLRenderbuffer? createRenderbuffer(); - //WebGLShader? createShader(GLenum type); + WebGLShader? createShader(GLenum type); //WebGLTexture? createTexture(); //void cullFace(GLenum mode); @@ -566,11 +554,11 @@ interface WebGLRenderingContextBase //void detachShader(WebGLProgram? program, WebGLShader? shader); //void disable(GLenum cap); //void disableVertexAttribArray(GLuint index); - //void drawArrays(GLenum mode, GLint first, GLsizei count); + void drawArrays(GLenum mode, GLint first, GLsizei count); //void drawElements(GLenum mode, GLsizei count, GLenum type, GLintptr offset); //void enable(GLenum cap); - //void enableVertexAttribArray(GLuint index); + void enableVertexAttribArray(GLuint index); //void finish(); //void flush(); //void framebufferRenderbuffer(GLenum target, GLenum attachment, @@ -586,7 +574,7 @@ interface WebGLRenderingContextBase //WebGLActiveInfo? getActiveUniform(WebGLProgram? program, GLuint index); //sequence<WebGLShader>? getAttachedShaders(WebGLProgram? program); - //[WebGLHandlesContextLoss] GLint getAttribLocation(WebGLProgram? program, DOMString name); + [WebGLHandlesContextLoss] GLint getAttribLocation(WebGLProgram? program, DOMString name); //any getBufferParameter(GLenum target, GLenum pname); //any getParameter(GLenum pname); @@ -598,9 +586,9 @@ interface WebGLRenderingContextBase //any getProgramParameter(WebGLProgram? program, GLenum pname); //DOMString? getProgramInfoLog(WebGLProgram? program); //any getRenderbufferParameter(GLenum target, GLenum pname); - //any getShaderParameter(WebGLShader? shader, GLenum pname); + any getShaderParameter(WebGLShader? shader, GLenum pname); //WebGLShaderPrecisionFormat? getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype); - //DOMString? getShaderInfoLog(WebGLShader? shader); + DOMString? getShaderInfoLog(WebGLShader? shader); //DOMString? getShaderSource(WebGLShader? shader); @@ -608,7 +596,7 @@ interface WebGLRenderingContextBase //any getUniform(WebGLProgram? program, WebGLUniformLocation? location); - //WebGLUniformLocation? getUniformLocation(WebGLProgram? program, DOMString name); + WebGLUniformLocation? getUniformLocation(WebGLProgram? program, DOMString name); //any getVertexAttrib(GLuint index, GLenum pname); @@ -623,7 +611,7 @@ interface WebGLRenderingContextBase //[WebGLHandlesContextLoss] GLboolean isShader(WebGLShader? shader); //[WebGLHandlesContextLoss] GLboolean isTexture(WebGLTexture? texture); //void lineWidth(GLfloat width); - //void linkProgram(WebGLProgram? program); + void linkProgram(WebGLProgram? program); //void pixelStorei(GLenum pname, GLint param); //void polygonOffset(GLfloat factor, GLfloat units); @@ -635,7 +623,7 @@ interface WebGLRenderingContextBase //void sampleCoverage(GLclampf value, GLboolean invert); //void scissor(GLint x, GLint y, GLsizei width, GLsizei height); - //void shaderSource(WebGLShader? shader, DOMString source); + void shaderSource(WebGLShader? shader, DOMString source); //void stencilFunc(GLenum func, GLint ref, GLuint mask); //void stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); @@ -682,7 +670,11 @@ interface WebGLRenderingContextBase //void uniform3iv(WebGLUniformLocation? location, Int32Array v); //void uniform3iv(WebGLUniformLocation? location, sequence<long> v); //void uniform4f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - //void uniform4fv(WebGLUniformLocation? location, Float32Array v); + // FIXME(dmarcos) The function below is the original function in the webIdl: + // void uniform4fv(WebGLUniformLocation? location, Float32Array v); + // The Code genearator doesn't handle BufferDataSource so we're using 'optional object' + // in the meantime + void uniform4fv(WebGLUniformLocation? location, optional object v); //void uniform4fv(WebGLUniformLocation? location, sequence<GLfloat> v); //void uniform4i(WebGLUniformLocation? location, GLint x, GLint y, GLint z, GLint w); //void uniform4iv(WebGLUniformLocation? location, Int32Array v); @@ -701,7 +693,7 @@ interface WebGLRenderingContextBase //void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, // sequence<GLfloat> value); - //void useProgram(WebGLProgram? program); + void useProgram(WebGLProgram? program); //void validateProgram(WebGLProgram? program); //void vertexAttrib1f(GLuint indx, GLfloat x); @@ -716,10 +708,10 @@ interface WebGLRenderingContextBase //void vertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); //void vertexAttrib4fv(GLuint indx, Float32Array values); //void vertexAttrib4fv(GLuint indx, sequence<GLfloat> values); - //void vertexAttribPointer(GLuint indx, GLint size, GLenum type, - // GLboolean normalized, GLsizei stride, GLintptr offset); + void vertexAttribPointer(GLuint indx, GLint size, GLenum type, + GLboolean normalized, GLsizei stride, GLintptr offset); - //void viewport(GLint x, GLint y, GLsizei width, GLsizei height); + void viewport(GLint x, GLint y, GLsizei width, GLsizei height); }; interface WebGLRenderingContext diff --git a/components/script/dom/webidls/WebGLShader.webidl b/components/script/dom/webidls/WebGLShader.webidl new file mode 100644 index 00000000000..c308e303da9 --- /dev/null +++ b/components/script/dom/webidls/WebGLShader.webidl @@ -0,0 +1,7 @@ +// +// WebGL IDL definitions scraped from the Khronos specification: +// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.8 +// + +interface WebGLShader : WebGLObject { +}; diff --git a/components/script/dom/webidls/WebGLUniformLocation.webidl b/components/script/dom/webidls/WebGLUniformLocation.webidl new file mode 100644 index 00000000000..2331c90c961 --- /dev/null +++ b/components/script/dom/webidls/WebGLUniformLocation.webidl @@ -0,0 +1,7 @@ +// +// WebGL IDL definitions scraped from the Khronos specification: +// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.10 +// + +interface WebGLUniformLocation { +}; diff --git a/components/script/dom/webidls/WebSocket.webidl b/components/script/dom/webidls/WebSocket.webidl index 3f54ec79019..6067ca30c4f 100644 --- a/components/script/dom/webidls/WebSocket.webidl +++ b/components/script/dom/webidls/WebSocket.webidl @@ -2,26 +2,34 @@ * 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/. */ +enum BinaryType { "blob", "arraybuffer" }; + [Constructor(DOMString url)] interface WebSocket : EventTarget { -readonly attribute DOMString url; - //attribute DOMString port; - //attribute DOMString host; + readonly attribute DOMString url; //ready state const unsigned short CONNECTING = 0; const unsigned short OPEN = 1; const unsigned short CLOSING = 2; const unsigned short CLOSED = 3; - //readonly attribute unsigned short readyState; + readonly attribute unsigned short readyState; //readonly attribute unsigned long bufferedAmount; + //networking - //attribute EventHandler onopen; - //attribute EventHandler onerror; - //attribute EventHandler onclose; + attribute EventHandler onopen; + attribute EventHandler onerror; + attribute EventHandler onclose; //readonly attribute DOMString extensions; //readonly attribute DOMString protocol; - //void send(USVString data); + //[Throws] void close([Clamp] optional unsigned short code, optional DOMString reason); //Clamp doesn't work + [Throws] void close(optional unsigned short code, optional DOMString reason); //No clamp version - works + + //messaging + //attribute EventHandler onmessage; + //attribute BinaryType binaryType; + [Throws] void send(optional DOMString data); //void send(Blob data); //void send(ArrayBuffer data); //void send(ArrayBufferView data); + }; diff --git a/components/script/dom/webidls/Window.webidl b/components/script/dom/webidls/Window.webidl index 8999d9e561d..08caf90004e 100644 --- a/components/script/dom/webidls/Window.webidl +++ b/components/script/dom/webidls/Window.webidl @@ -141,3 +141,10 @@ interface WindowLocalStorage { readonly attribute Storage localStorage; }; Window implements WindowLocalStorage; + +// http://w3c.github.io/animation-timing/#Window-interface-extensions +partial interface Window { + long requestAnimationFrame(FrameRequestCallback callback); + void cancelAnimationFrame(long handle); +}; +callback FrameRequestCallback = void (DOMHighResTimeStamp time); diff --git a/components/script/dom/websocket.rs b/components/script/dom/websocket.rs index 1af70fa5f0b..0b7673d828b 100644 --- a/components/script/dom/websocket.rs +++ b/components/script/dom/websocket.rs @@ -2,34 +2,137 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::WebSocketBinding; use dom::bindings::codegen::Bindings::WebSocketBinding::WebSocketMethods; -use dom::bindings::error::Fallible; -use dom::bindings::global::GlobalRef; -use dom::bindings::js::{Temporary, JSRef}; +use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; +use dom::bindings::codegen::InheritTypes::EventTargetCast; +use dom::bindings::codegen::InheritTypes::EventCast; +use dom::bindings::error::{Error, Fallible}; +use dom::bindings::error::Error::InvalidAccess; +use dom::bindings::error::Error::Syntax; +use dom::bindings::global::{GlobalField, GlobalRef}; +use dom::bindings::js::{Temporary, JSRef, Rootable}; +use dom::bindings::refcounted::Trusted; +use dom::bindings::trace::JSTraceable; use dom::bindings::utils::reflect_dom_object; -use dom::eventtarget::{EventTarget, EventTargetTypeId}; +use dom::closeevent::CloseEvent; +use dom::event::{Event, EventBubbles, EventCancelable, EventHelpers}; +use dom::eventtarget::{EventTarget, EventTargetHelpers, EventTargetTypeId}; +use script_task::Runnable; +use script_task::ScriptMsg; +use std::cell::{Cell, RefCell}; +use std::borrow::ToOwned; use util::str::DOMString; -// https://html.spec.whatwg.org/#the-websocket-interface +use websocket::Message; +use websocket::ws::sender::Sender as Sender_Object; +use websocket::client::sender::Sender; +use websocket::client::receiver::Receiver; +use websocket::stream::WebSocketStream; +use websocket::client::request::Url; +use websocket::Client; + + +#[derive(PartialEq, Copy, Clone)] +#[jstraceable] +enum WebSocketRequestState { + Connecting = 0, + Open = 1, + Closing = 2, + Closed = 3, +} + +no_jsmanaged_fields!(Sender<WebSocketStream>); +no_jsmanaged_fields!(Receiver<WebSocketStream>); + #[dom_struct] pub struct WebSocket { eventtarget: EventTarget, - url: DOMString + url: DOMString, + global: GlobalField, + ready_state: Cell<WebSocketRequestState>, + sender: RefCell<Option<Sender<WebSocketStream>>>, + receiver: RefCell<Option<Receiver<WebSocketStream>>>, + failed: Cell<bool>, //Flag to tell if websocket was closed due to failure + full: Cell<bool>, //Flag to tell if websocket queue is full + clean_close: Cell<bool>, //Flag to tell if the websocket closed cleanly (not due to full or fail) + code: Cell<u16>, //Closing code + reason: DOMRefCell<DOMString>, //Closing reason + data: DOMRefCell<DOMString>, //Data from send - TODO: Remove after buffer is added. + sendCloseFrame: Cell<bool> } impl WebSocket { - pub fn new_inherited(url: DOMString) -> WebSocket { + pub fn new_inherited(global: GlobalRef, url: DOMString) -> WebSocket { WebSocket { eventtarget: EventTarget::new_inherited(EventTargetTypeId::WebSocket), - url: url + url: url, + global: GlobalField::from_rooted(&global), + ready_state: Cell::new(WebSocketRequestState::Connecting), + failed: Cell::new(false), + sender: RefCell::new(None), + receiver: RefCell::new(None), + full: Cell::new(false), + clean_close: Cell::new(true), + code: Cell::new(0), + reason: DOMRefCell::new("".to_owned()), + data: DOMRefCell::new("".to_owned()), + sendCloseFrame: Cell::new(false) } + } pub fn new(global: GlobalRef, url: DOMString) -> Temporary<WebSocket> { - reflect_dom_object(box WebSocket::new_inherited(url), - global, - WebSocketBinding::Wrap) + /*TODO: This constructor is only a prototype, it does not accomplish the specs + defined here: + http://html.spec.whatwg.org + All 9 items must be satisfied. + TODO: This constructor should be responsible for spawning a thread for the + receive loop after ws_root.r().Open() - See comment + */ + let ws_root = reflect_dom_object(box WebSocket::new_inherited(global, url), + global, + WebSocketBinding::Wrap).root(); + let ws_root = ws_root.r(); + let parsed_url = Url::parse(&ws_root.url).unwrap(); + let request = Client::connect(parsed_url).unwrap(); + let response = request.send().unwrap(); + response.validate().unwrap(); + ws_root.ready_state.set(WebSocketRequestState::Open); + //Check to see if ready_state is Closing or Closed and failed = true - means we failed the websocket + //if so return without setting any states + let ready_state = ws_root.ready_state.get(); + let failed = ws_root.failed.get(); + if failed && (ready_state == WebSocketRequestState::Closed || ready_state == WebSocketRequestState::Closing) { + //Do nothing else. Let the close finish. + return Temporary::from_rooted(ws_root); + } + let (temp_sender, temp_receiver) = response.begin().split(); + let mut other_sender = ws_root.sender.borrow_mut(); + let mut other_receiver = ws_root.receiver.borrow_mut(); + *other_sender = Some(temp_sender); + *other_receiver = Some(temp_receiver); + + //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 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 + /*TODO: Add receive loop here and make new thread run this + Receive is an infinite loop "similiar" the one shown here: + https://github.com/cyderize/rust-websocket/blob/master/examples/client.rs#L64 + TODO: The receive loop however does need to follow the spec. These are outlined here + under "WebSocket message has been received" items 1-5: + https://github.com/cyderize/rust-websocket/blob/master/examples/client.rs#L64 + TODO: The receive loop also needs to dispatch an asynchronous event as stated here: + https://github.com/cyderize/rust-websocket/blob/master/examples/client.rs#L64 + TODO: When the receive loop receives a close message from the server, + it confirms the websocket is now closed. This requires the close event + to be fired (dispatch_close fires the close event - see implementation below) + */ + Temporary::from_rooted(ws_root) } pub fn Constructor(global: GlobalRef, url: DOMString) -> Fallible<Temporary<WebSocket>> { @@ -38,8 +141,162 @@ impl WebSocket { } impl<'a> WebSocketMethods for JSRef<'a, WebSocket> { - // https://html.spec.whatwg.org/#dom-websocket-url + event_handler!(open, GetOnopen, SetOnopen); + event_handler!(close, GetOnclose, SetOnclose); + event_handler!(error, GetOnerror, SetOnerror); + fn Url(self) -> DOMString { self.url.clone() } + + fn ReadyState(self) -> u16 { + self.ready_state.get() as u16 + } + + fn Send(self, data: Option<DOMString>)-> 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: Need to buffer data + TODO: bufferedAmount attribute returns the size of the buffer in bytes - this is a required attribute defined in the websocket.webidle file + TODO: The send function needs to flag when full by using the following + self.full.set(true). This needs to be done when the buffer is full + */ + let mut other_sender = self.sender.borrow_mut(); + let my_sender = other_sender.as_mut().unwrap(); + if self.sendCloseFrame.get() { //TODO: Also check if the buffer is full + self.sendCloseFrame.set(false); + let _ = my_sender.send_message(Message::Close(None)); + return Ok(()); + } + let _ = my_sender.send_message(Message::Text(data.unwrap())); + return Ok(()) + } + + fn Close(self, code: Option<u16>, reason: Option<DOMString>) -> Fallible<()>{ + if let Some(code) = code { + //Check code is NOT 1000 NOR in the range of 3000-4999 (inclusive) + if code != 1000 && (code < 3000 || code > 4999) { + return Err(Error::InvalidAccess); + } + } + if let Some(ref reason) = reason { + if reason.as_bytes().len() > 123 { //reason cannot be larger than 123 bytes + return Err(Error::Syntax); + } + } + + match self.ready_state.get() { + WebSocketRequestState::Closing | WebSocketRequestState::Closed => {} //Do nothing + WebSocketRequestState::Connecting => { //Connection is not yet established + /*By setting the state to closing, the open function + will abort connecting the websocket*/ + self.ready_state.set(WebSocketRequestState::Closing); + 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. + 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 + } + WebSocketRequestState::Open => { + //Closing handshake not started - still in open + //Start the closing by setting the code and reason if they exist + if let Some(code) = code { + self.code.set(code); + } + if let Some(reason) = reason { + *self.reason.borrow_mut() = reason; + } + self.ready_state.set(WebSocketRequestState::Closing); + 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 + } + } + Ok(()) //Return Ok + } } + + +pub enum WebSocketTask { + Open, + Close, +} + +pub struct WebSocketTaskHandler { + addr: Trusted<WebSocket>, + task: WebSocketTask, +} + +impl WebSocketTaskHandler { + pub fn new(addr: Trusted<WebSocket>, task: WebSocketTask) -> WebSocketTaskHandler { + WebSocketTaskHandler { + addr: addr, + task: task, + } + } + + fn dispatch_open(&self) { + /*TODO: Items 1, 3, 4, & 5 under "WebSocket connection is established" as specified here: + https://html.spec.whatwg.org/multipage/#feedback-from-the-protocol + */ + let ws = self.addr.to_temporary().root(); //Get root + let ws = ws.r(); //Get websocket reference + let global = ws.global.root(); + let event = Event::new(global.r(), + "open".to_owned(), + EventBubbles::DoesNotBubble, + EventCancelable::Cancelable).root(); + let target: JSRef<EventTarget> = EventTargetCast::from_ref(ws); + event.r().fire(target); + } + + fn dispatch_close(&self) { + let ws = self.addr.to_temporary().root(); + let ws = ws.r(); + let global = ws.global.root(); + ws.ready_state.set(WebSocketRequestState::Closed); + //If failed or full, fire error event + if ws.failed.get() || ws.full.get() { + ws.failed.set(false); + ws.full.set(false); + //A Bad close + ws.clean_close.set(false); + let event = Event::new(global.r(), + "error".to_owned(), + EventBubbles::DoesNotBubble, + EventCancelable::Cancelable).root(); + let target: JSRef<EventTarget> = EventTargetCast::from_ref(ws); + event.r().fire(target); + } + let rsn = ws.reason.borrow(); + let rsn_clone = rsn.clone(); + /*In addition, we also have to fire a close even if error event fired + https://html.spec.whatwg.org/multipage/#closeWebSocket + */ + let close_event = CloseEvent::new(global.r(), + "close".to_owned(), + EventBubbles::DoesNotBubble, + EventCancelable::Cancelable, + ws.clean_close.get(), + ws.code.get(), + rsn_clone).root(); + let target: JSRef<EventTarget> = EventTargetCast::from_ref(ws); + let event: JSRef<Event> = EventCast::from_ref(close_event.r()); + event.fire(target); + } +} + +impl Runnable for WebSocketTaskHandler { + fn handler(self: Box<WebSocketTaskHandler>) { + match self.task { + WebSocketTask::Open => { + self.dispatch_open(); + } + WebSocketTask::Close => { + self.dispatch_close(); + } + } + } +} + diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 70046185981..facc50b51e9 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -3,11 +3,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::cell::DOMRefCell; +use dom::bindings::callback::ExceptionHandling; use dom::bindings::codegen::Bindings::EventHandlerBinding::{OnErrorEventHandlerNonNull, EventHandlerNonNull}; -use dom::bindings::codegen::Bindings::FunctionBinding::Function; -use dom::bindings::codegen::Bindings::WindowBinding; -use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; +use dom::bindings::codegen::Bindings::FunctionBinding::Function; +use dom::bindings::codegen::Bindings::WindowBinding::{self, WindowMethods, FrameRequestCallback}; use dom::bindings::codegen::InheritTypes::{NodeCast, EventTargetCast}; use dom::bindings::global::global_object_for_js_object; use dom::bindings::error::{report_pending_exception, Fallible}; @@ -15,6 +15,7 @@ use dom::bindings::error::Error::InvalidCharacter; use dom::bindings::global::GlobalRef; use dom::bindings::js::{JS, JSRef, MutNullableHeap, OptionalRootable}; use dom::bindings::js::{Rootable, RootedReference, Temporary}; +use dom::bindings::num::Finite; use dom::bindings::utils::{GlobalStaticData, Reflectable, WindowProxyHandler}; use dom::browsercontext::BrowserContext; use dom::console::Console; @@ -61,7 +62,6 @@ use std::collections::HashSet; use std::default::Default; use std::ffi::CString; use std::mem; -use std::num::Float; use std::rc::Rc; use std::sync::mpsc::{channel, Receiver, Sender}; use std::sync::mpsc::TryRecvError::{Empty, Disconnected}; @@ -465,6 +465,24 @@ impl<'a> WindowMethods for JSRef<'a, Window> { fn Atob(self, atob: DOMString) -> Fallible<DOMString> { base64_atob(atob) } + + /// http://w3c.github.io/animation-timing/#dom-windowanimationtiming-requestanimationframe + fn RequestAnimationFrame(self, callback: FrameRequestCallback) -> i32 { + let doc = self.Document().root(); + + let callback = move |now: f64| { + // TODO: @jdm The spec says that any exceptions should be suppressed; + callback.Call__(Finite::wrap(now), ExceptionHandling::Report).unwrap(); + }; + + doc.r().request_animation_frame(Box::new(callback)) + } + + /// http://w3c.github.io/animation-timing/#dom-windowanimationtiming-cancelanimationframe + fn CancelAnimationFrame(self, ident: i32) { + let doc = self.Document().root(); + doc.r().cancel_animation_frame(ident); + } } pub trait WindowHelpers { @@ -918,10 +936,10 @@ impl Window { } fn should_move_clip_rect(clip_rect: Rect<Au>, new_viewport: Rect<f32>) -> bool{ - let clip_rect = Rect(Point2D(geometry::to_frac_px(clip_rect.origin.x) as f32, - geometry::to_frac_px(clip_rect.origin.y) as f32), - Size2D(geometry::to_frac_px(clip_rect.size.width) as f32, - geometry::to_frac_px(clip_rect.size.height) as f32)); + let clip_rect = Rect(Point2D(clip_rect.origin.x.to_f32_px(), + clip_rect.origin.y.to_f32_px()), + Size2D(clip_rect.size.width.to_f32_px(), + clip_rect.size.height.to_f32_px())); // We only need to move the clip rect if the viewport is getting near the edge of // our preexisting clip rect. We use half of the size of the viewport as a heuristic diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index 73748b27f14..99d412ee8b7 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -56,15 +56,16 @@ use std::ascii::AsciiExt; use std::borrow::ToOwned; use std::cell::{RefCell, Cell}; use std::default::Default; -use std::old_io::Timer; use std::str::FromStr; use std::sync::{Mutex, Arc}; -use std::time::duration::Duration; +use std::sync::mpsc::{channel, Sender, TryRecvError}; +use std::thread::sleep_ms; use time; use url::{Url, UrlParser}; use dom::bindings::codegen::UnionTypes::StringOrURLSearchParams; use dom::bindings::codegen::UnionTypes::StringOrURLSearchParams::{eString, eURLSearchParams}; + pub type SendParam = StringOrURLSearchParams; #[derive(PartialEq, Copy, Clone)] @@ -140,7 +141,7 @@ pub struct XMLHttpRequest { send_flag: Cell<bool>, global: GlobalField, - timer: DOMRefCell<Timer>, + timeout_cancel: DOMRefCell<Option<Sender<()>>>, fetch_time: Cell<i64>, timeout_target: DOMRefCell<Option<Box<ScriptChan+Send>>>, generation_id: Cell<GenerationId>, @@ -174,7 +175,7 @@ impl XMLHttpRequest { upload_events: Cell::new(false), global: GlobalField::from_rooted(&global), - timer: DOMRefCell::new(Timer::new().unwrap()), + timeout_cancel: DOMRefCell::new(None), fetch_time: Cell::new(0), timeout_target: DOMRefCell::new(None), generation_id: Cell::new(GenerationId(0)), @@ -399,14 +400,14 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> { debug!("SetRequestHeader: old value = {:?}", raw[0]); let mut buf = raw[0].clone(); buf.push_all(b", "); - buf.push_all(value.as_slice()); + buf.push_all(&value); debug!("SetRequestHeader: new value = {:?}", buf); value = ByteString::new(buf); }, None => {} } - headers.set_raw(name_str.to_owned(), vec![value.as_slice().to_vec()]); + headers.set_raw(name_str.to_owned(), vec![value.to_vec()]); Ok(()) } @@ -514,7 +515,9 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> { } - let mut load_data = LoadData::new(self.request_url.borrow().clone().unwrap()); + let global = self.global.root(); + let pipeline_id = global.r().pipeline(); + let mut load_data = LoadData::new(self.request_url.borrow().clone().unwrap(), Some(pipeline_id)); load_data.data = extracted; #[inline] @@ -678,7 +681,7 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> { }, _ if self.ready_state.get() != XMLHttpRequestState::Done => NullValue(), Json => { - let decoded = UTF_8.decode(self.response.borrow().as_slice(), DecoderTrap::Replace).unwrap().to_owned(); + let decoded = UTF_8.decode(&self.response.borrow(), DecoderTrap::Replace).unwrap().to_owned(); let decoded: Vec<u16> = decoded.utf16_units().collect(); let mut vp = UndefinedValue(); unsafe { @@ -963,7 +966,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> { let total = self.response_headers.borrow().get::<ContentLength>().map(|x| {**x as u64}); self.dispatch_progress_event(false, type_, len, total); } - fn set_timeout(self, timeout: u32) { + fn set_timeout(self, duration_ms: u32) { struct XHRTimeout { xhr: TrustedXHRAddress, gen_id: GenerationId, @@ -981,22 +984,23 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> { // Sets up the object to timeout in a given number of milliseconds // This will cancel all previous timeouts - let oneshot = self.timer.borrow_mut() - .oneshot(Duration::milliseconds(timeout as i64)); let timeout_target = (*self.timeout_target.borrow().as_ref().unwrap()).clone(); let global = self.global.root(); let xhr = Trusted::new(global.r().get_cx(), self, global.r().script_chan()); let gen_id = self.generation_id.get(); + let (cancel_tx, cancel_rx) = channel(); + *self.timeout_cancel.borrow_mut() = Some(cancel_tx); spawn_named("XHR:Timer".to_owned(), move || { - match oneshot.recv() { - Ok(_) => { + sleep_ms(duration_ms); + match cancel_rx.try_recv() { + Err(TryRecvError::Empty) => { timeout_target.send(ScriptMsg::RunnableMsg(box XHRTimeout { xhr: xhr, gen_id: gen_id, })).unwrap(); }, - Err(_) => { - // This occurs if xhr.timeout (the sender) goes out of scope (i.e, xhr went out of scope) + Err(TryRecvError::Disconnected) | Ok(()) => { + // This occurs if xhr.timeout_cancel (the sender) goes out of scope (i.e, xhr went out of scope) // or if the oneshot timer was overwritten. The former case should not happen due to pinning. debug!("XHR timeout was overwritten or canceled") } @@ -1006,8 +1010,9 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> { } fn cancel_timeout(self) { - // oneshot() closes the previous channel, canceling the timeout - self.timer.borrow_mut().oneshot(Duration::zero()); + if let Some(cancel_tx) = self.timeout_cancel.borrow_mut().take() { + let _ = cancel_tx.send(()); + } } fn text_response(self) -> DOMString { @@ -1028,7 +1033,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> { let response = self.response.borrow(); // According to Simon, decode() should never return an error, so unwrap()ing // the result should be fine. XXXManishearth have a closer look at this later - encoding.decode(response.as_slice(), DecoderTrap::Replace).unwrap().to_owned() + encoding.decode(&response, DecoderTrap::Replace).unwrap().to_owned() } fn filter_response_headers(self) -> Headers { // https://fetch.spec.whatwg.org/#concept-response-header-list diff --git a/components/script/horribly_inefficient_timers.rs b/components/script/horribly_inefficient_timers.rs new file mode 100644 index 00000000000..6f3774d3dca --- /dev/null +++ b/components/script/horribly_inefficient_timers.rs @@ -0,0 +1,31 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/// A quick hack to work around the removal of [`std::old_io::timer::Timer`]( +/// http://doc.rust-lang.org/1.0.0-beta/std/old_io/timer/struct.Timer.html ) + +use std::sync::mpsc::{channel, Receiver}; +use std::thread::{spawn, sleep_ms}; + +pub fn oneshot(duration_ms: u32) -> Receiver<()> { + let (tx, rx) = channel(); + spawn(move || { + sleep_ms(duration_ms); + let _ = tx.send(()); + }); + rx +} + +pub fn periodic(duration_ms: u32) -> Receiver<()> { + let (tx, rx) = channel(); + spawn(move || { + loop { + sleep_ms(duration_ms); + if tx.send(()).is_err() { + break + } + } + }); + rx +} diff --git a/components/script/layout_interface.rs b/components/script/layout_interface.rs index 4859c075058..34d21e7e788 100644 --- a/components/script/layout_interface.rs +++ b/components/script/layout_interface.rs @@ -12,11 +12,10 @@ use geom::point::Point2D; use geom::rect::Rect; use libc::uintptr_t; use msg::constellation_msg::{PipelineExitType, WindowSizeData}; -use profile::mem::{Reporter, ReportsChan}; +use profile_traits::mem::{Reporter, ReportsChan}; use script_traits::{ScriptControlChan, OpaqueScriptLayoutChannel, UntrustedNodeAddress}; use std::any::Any; use std::sync::mpsc::{channel, Receiver, Sender}; -use std::boxed::BoxAny; use style::animation::PropertyAnimation; use style::media_queries::MediaQueryList; use style::stylesheets::Stylesheet; @@ -88,7 +87,7 @@ pub struct HitTestResponse(pub UntrustedNodeAddress); pub struct MouseOverResponse(pub Vec<UntrustedNodeAddress>); /// Why we're doing reflow. -#[derive(PartialEq, Debug)] +#[derive(PartialEq, Copy, Clone, Debug)] pub enum ReflowGoal { /// We're reflowing in order to send a display list to the screen. ForDisplay, @@ -185,15 +184,15 @@ pub struct Animation { /// A description of the property animation that is occurring. pub property_animation: PropertyAnimation, /// The start time of the animation, as returned by `time::precise_time_s()`. - pub start_time: f64, + pub start_time: f32, /// The end time of the animation, as returned by `time::precise_time_s()`. - pub end_time: f64, + pub end_time: f32, } impl Animation { /// Returns the duration of this animation in seconds. #[inline] - pub fn duration(&self) -> f64 { + pub fn duration(&self) -> f32 { self.end_time - self.start_time } } diff --git a/components/script/lib.rs b/components/script/lib.rs index 5c2e522f5d4..09340e7446e 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -7,13 +7,9 @@ #![feature(collections)] #![feature(core)] #![feature(custom_attribute)] -#![feature(old_io)] -#![feature(path)] #![feature(plugin)] #![feature(rustc_private)] #![feature(std_misc)] -#![feature(unicode)] -#![feature(unsafe_destructor)] #![deny(unsafe_code)] #![allow(non_snake_case)] @@ -39,16 +35,19 @@ extern crate js; extern crate libc; extern crate msg; extern crate net_traits; +extern crate num; extern crate png; -extern crate "rustc-serialize" as rustc_serialize; +extern crate rustc_serialize; extern crate time; extern crate canvas; -extern crate profile; +extern crate profile_traits; extern crate script_traits; extern crate selectors; extern crate util; +extern crate websocket; #[macro_use] extern crate style; +extern crate unicase; extern crate url; extern crate uuid; extern crate string_cache; @@ -67,5 +66,7 @@ pub mod page; pub mod script_task; mod timers; pub mod textinput; +pub mod clipboard_provider; mod devtools; +mod horribly_inefficient_timers; mod webdriver_handlers; diff --git a/components/script/page.rs b/components/script/page.rs index 57c22e4e3e7..67da1a9fc61 100644 --- a/components/script/page.rs +++ b/components/script/page.rs @@ -9,7 +9,6 @@ use dom::node::NodeHelpers; use dom::window::Window; use msg::constellation_msg::PipelineId; -use util::smallvec::SmallVec; use std::cell::Cell; use std::rc::Rc; use url::Url; diff --git a/components/script/parse/html.rs b/components/script/parse/html.rs index d16177e3a07..c870fe8c616 100644 --- a/components/script/parse/html.rs +++ b/components/script/parse/html.rs @@ -39,13 +39,13 @@ use util::str::DOMString; use util::task_state; use util::task_state::IN_HTML_PARSER; use std::borrow::Cow; -use std::old_io::{Writer, IoResult}; +use std::io::{self, Write}; use url::Url; use html5ever::Attribute; use html5ever::serialize::{Serializable, Serializer, AttrRef}; use html5ever::serialize::TraversalScope; use html5ever::serialize::TraversalScope::{IncludeNode, ChildrenOnly}; -use html5ever::tree_builder::{TreeSink, QuirksMode, NodeOrText, AppendNode, AppendText}; +use html5ever::tree_builder::{TreeSink, QuirksMode, NodeOrText, AppendNode, AppendText, NextParserState}; use string_cache::QualName; use hyper::header::ContentType; @@ -121,7 +121,7 @@ impl<'a> TreeSink for servohtmlparser::Sink { new_node: NodeOrText<JS<Node>>) -> Result<(), NodeOrText<JS<Node>>> { // If there is no parent, return the node to the parser. let sibling: Root<Node> = sibling.root(); - let parent = match sibling.r().parent_node() { + let parent = match sibling.r().GetParentNode() { Some(p) => p.root(), None => return Err(new_node), }; @@ -179,10 +179,11 @@ impl<'a> TreeSink for servohtmlparser::Sink { script.map(|script| script.mark_already_started()); } - fn complete_script(&mut self, node: JS<Node>) { + fn complete_script(&mut self, node: JS<Node>) -> NextParserState { let node: Root<Node> = node.root(); let script: Option<JSRef<HTMLScriptElement>> = HTMLScriptElementCast::to_ref(node.r()); script.map(|script| script.prepare()); + NextParserState::Continue } fn reparent_children(&mut self, node: JS<Node>, new_parent: JS<Node>) { @@ -198,8 +199,8 @@ impl<'a> TreeSink for servohtmlparser::Sink { } impl<'a> Serializable for JSRef<'a, Node> { - fn serialize<'wr, Wr: Writer>(&self, serializer: &mut Serializer<'wr, Wr>, - traversal_scope: TraversalScope) -> IoResult<()> { + fn serialize<'wr, Wr: Write>(&self, serializer: &mut Serializer<'wr, Wr>, + traversal_scope: TraversalScope) -> io::Result<()> { let node = *self; match (traversal_scope, node.type_id()) { (_, NodeTypeId::Element(..)) => { diff --git a/components/script/script_task.rs b/components/script/script_task.rs index 6d408d2f10f..b7fc3198511 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -31,7 +31,7 @@ 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}; +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}; @@ -51,7 +51,7 @@ use webdriver_handlers; use devtools_traits::{DevtoolsControlChan, DevtoolsControlPort, DevtoolsPageInfo}; use devtools_traits::{DevtoolsControlMsg, DevtoolScriptControlMsg}; use devtools_traits::{TimelineMarker, TimelineMarkerType, TracingMetadata}; -use script_traits::CompositorEvent; +use script_traits::{CompositorEvent, MouseButton}; use script_traits::CompositorEvent::{ResizeEvent, ClickEvent}; use script_traits::CompositorEvent::{MouseDownEvent, MouseUpEvent}; use script_traits::CompositorEvent::{MouseMoveEvent, KeyEvent}; @@ -70,8 +70,6 @@ use net_traits::LoadData as NetLoadData; use net_traits::image_cache_task::{ImageCacheChan, ImageCacheTask, ImageCacheResult}; use net_traits::storage_task::StorageTask; use string_cache::Atom; -use util::geometry::to_frac_px; -use util::smallvec::SmallVec; use util::str::DOMString; use util::task::{spawn_named, spawn_named_with_send_on_failure}; use util::task_state; @@ -90,7 +88,6 @@ use std::any::Any; use std::borrow::ToOwned; use std::cell::{Cell, RefCell}; use std::collections::HashSet; -use std::num::ToPrimitive; use std::option::Option; use std::ptr; use std::rc::Rc; @@ -98,7 +95,7 @@ use std::result::Result; use std::sync::mpsc::{channel, Sender, Receiver, Select}; use time::Tm; -use hyper::header::ContentType; +use hyper::header::{ContentType, HttpDate}; use hyper::mime::{Mime, TopLevel, SubLevel}; thread_local!(pub static STACK_ROOTS: Cell<Option<RootCollectionPtr>> = Cell::new(None)); @@ -266,8 +263,6 @@ impl Drop for StackRootTLS { /// Information for an entire page. Pages are top-level browsing contexts and can contain multiple /// frames. -/// -/// FIXME: Rename to `Page`, following WebKit? #[jstraceable] pub struct ScriptTask { /// A handle to the information pertaining to page layout @@ -342,7 +337,6 @@ impl<'a> ScriptMemoryFailsafe<'a> { } } -#[unsafe_destructor] impl<'a> Drop for ScriptMemoryFailsafe<'a> { #[allow(unrooted_must_root)] fn drop(&mut self) { @@ -730,9 +724,10 @@ impl ScriptTask { self.handle_update_subpage_id(containing_pipeline_id, old_subpage_id, new_subpage_id), ConstellationControlMsg::FocusIFrame(containing_pipeline_id, subpage_id) => self.handle_focus_iframe_msg(containing_pipeline_id, subpage_id), - ConstellationControlMsg::WebDriverCommand(pipeline_id, msg) => { - self.handle_webdriver_msg(pipeline_id, msg); - } + ConstellationControlMsg::WebDriverCommand(pipeline_id, msg) => + self.handle_webdriver_msg(pipeline_id, msg), + ConstellationControlMsg::TickAllAnimations(pipeline_id) => + self.handle_tick_all_animations(pipeline_id), } } @@ -782,6 +777,8 @@ impl ScriptTask { devtools::handle_set_timeline_markers(&page, self, marker_types, reply), DevtoolScriptControlMsg::DropTimelineMarkers(_pipeline_id, marker_types) => devtools::handle_drop_timeline_markers(&page, self, marker_types), + DevtoolScriptControlMsg::RequestAnimationFrame(pipeline_id, callback) => + devtools::handle_request_animation_frame(&page, pipeline_id, callback), } } @@ -793,7 +790,9 @@ impl ScriptTask { let page = self.root_page(); match msg { WebDriverScriptCommand::EvaluateJS(script, reply) => - webdriver_handlers::handle_evaluate_js(&page, pipeline_id, script, reply) + webdriver_handlers::handle_evaluate_js(&page, pipeline_id, script, reply), + WebDriverScriptCommand::GetTitle(reply) => + webdriver_handlers::handle_get_title(&page, pipeline_id, reply) } } @@ -1022,6 +1021,13 @@ impl ScriptTask { return false; } + /// Handles when layout task finishes all animation in one tick + fn handle_tick_all_animations(&self, id: PipelineId) { + let page = get_page(&self.root_page(), id); + let document = page.document().root(); + document.r().invoke_animation_callbacks(); + } + /// The entry point to document loading. Defines bindings, sets up the window and document /// objects, parses HTML and CSS, and kicks off initial layout. fn load(&self, response: LoadResponse, incomplete: InProgressLoad) { @@ -1090,7 +1096,6 @@ impl ScriptTask { self.neutered = true; } } - #[unsafe_destructor] impl<'a> Drop for AutoPageRemover<'a> { fn drop(&mut self) { if !self.neutered { @@ -1129,7 +1134,7 @@ impl ScriptTask { incomplete.window_size).root(); let last_modified: Option<DOMString> = response.metadata.headers.as_ref().and_then(|headers| { - headers.get().map(|&LastModified(ref tm)| dom_last_modified(tm)) + headers.get().map(|&LastModified(HttpDate(ref tm))| dom_last_modified(tm)) }); let content_type = match response.metadata.content_type { @@ -1187,8 +1192,7 @@ impl ScriptTask { fn scroll_fragment_point(&self, pipeline_id: PipelineId, node: JSRef<Element>) { let node: JSRef<Node> = NodeCast::from_ref(node); let rect = node.get_bounding_content_box(); - let point = Point2D(to_frac_px(rect.origin.x).to_f32().unwrap(), - to_frac_px(rect.origin.y).to_f32().unwrap()); + let point = Point2D(rect.origin.x.to_f32_px(), rect.origin.y.to_f32_px()); // FIXME(#2003, pcwalton): This is pretty bogus when multiple layers are involved. // Really what needs to happen is that this needs to go through layout to ask which // layer the element belongs to, and have it send the scroll message to the @@ -1230,17 +1234,17 @@ impl ScriptTask { } ClickEvent(button, point) => { - let _marker; - if self.need_emit_timeline_marker(TimelineMarkerType::DOMEvent) { - _marker = AutoDOMEventMarker::new(self); - } - let page = get_page(&self.root_page(), pipeline_id); - let document = page.document().root(); - document.r().handle_click_event(self.js_runtime.rt(), button, point); + self.handle_mouse_event(pipeline_id, MouseEventType::Click, button, point); + } + + MouseDownEvent(button, point) => { + self.handle_mouse_event(pipeline_id, MouseEventType::MouseDown, button, point); + } + + MouseUpEvent(button, point) => { + self.handle_mouse_event(pipeline_id, MouseEventType::MouseUp, button, point); } - MouseDownEvent(..) => {} - MouseUpEvent(..) => {} MouseMoveEvent(point) => { let _marker; if self.need_emit_timeline_marker(TimelineMarkerType::DOMEvent) { @@ -1268,6 +1272,16 @@ impl ScriptTask { } } + 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); + } + let page = get_page(&self.root_page(), pipeline_id); + let document = page.document().root(); + document.r().handle_mouse_event(self.js_runtime.rt(), button, point, mouse_event_type); + } + /// https://html.spec.whatwg.org/multipage/#navigating-across-documents /// The entry point for content to notify that a new load has been requested /// for the given pipeline (specifically the "navigate" algorithm). @@ -1353,6 +1367,7 @@ impl ScriptTask { preserved_headers: load_data.headers, data: load_data.data, cors: None, + pipeline_id: Some(id), }, LoadConsumer::Channel(input_chan))).unwrap(); let load_response = input_port.recv().unwrap(); @@ -1450,7 +1465,6 @@ impl<'a> AutoDOMEventMarker<'a> { } } -#[unsafe_destructor] impl<'a> Drop for AutoDOMEventMarker<'a> { fn drop(&mut self) { let marker = TimelineMarker::new("DOMEvent".to_owned(), TracingMetadata::IntervalEnd); diff --git a/components/script/textinput.rs b/components/script/textinput.rs index 24383bf3fb4..abe74f2f330 100644 --- a/components/script/textinput.rs +++ b/components/script/textinput.rs @@ -4,18 +4,17 @@ //! Common handling of keyboard input and state management for text input controls -use dom::bindings::codegen::Bindings::KeyboardEventBinding::KeyboardEventMethods; +use clipboard_provider::ClipboardProvider; use dom::bindings::js::JSRef; -use msg::constellation_msg::ConstellationChan; -use msg::constellation_msg::Msg as ConstellationMsg; -use dom::keyboardevent::KeyboardEvent; +use dom::keyboardevent::{KeyboardEvent, KeyboardEventHelpers, key_value}; +use msg::constellation_msg::{SHIFT, CONTROL, ALT, SUPER}; +use msg::constellation_msg::{Key, KeyModifiers}; use util::str::DOMString; use std::borrow::ToOwned; use std::cmp::{min, max}; use std::default::Default; -use std::num::SignedInt; -use std::sync::mpsc::channel; + #[derive(Copy, Clone, PartialEq)] pub enum Selection { @@ -34,7 +33,7 @@ pub struct TextPoint { /// Encapsulated state for handling keyboard input in a single or multiline text input control. #[jstraceable] -pub struct TextInput { +pub struct TextInput<T: ClipboardProvider> { /// Current text input content, split across lines without trailing '\n' lines: Vec<DOMString>, /// Current cursor input point @@ -43,7 +42,7 @@ pub struct TextInput { selection_begin: Option<TextPoint>, /// Is this a multiline input? multiline: bool, - constellation_channel: Option<ConstellationChan> + clipboard_provider: T, } /// Resulting action to be taken by the owner of a text input that is handling an event. @@ -80,24 +79,42 @@ pub enum DeleteDir { /// Was the keyboard event accompanied by the standard control modifier, /// i.e. cmd on Mac OS or ctrl on other platforms. #[cfg(target_os="macos")] -fn is_control_key(event: JSRef<KeyboardEvent>) -> bool { - event.MetaKey() && !event.CtrlKey() && !event.AltKey() +fn is_control_key(mods: KeyModifiers) -> bool { + mods.contains(SUPER) && !mods.contains(CONTROL | ALT) } #[cfg(not(target_os="macos"))] -fn is_control_key(event: JSRef<KeyboardEvent>) -> bool { - event.CtrlKey() && !event.MetaKey() && !event.AltKey() +fn is_control_key(mods: KeyModifiers) -> bool { + mods.contains(CONTROL) && !mods.contains(SUPER | ALT) +} + +fn is_printable_key(key: Key) -> bool { + match key { + Key::Space | Key::Apostrophe | Key::Comma | Key::Minus | + Key::Period | Key::Slash | Key::GraveAccent | Key::Num0 | + Key::Num1 | Key::Num2 | Key::Num3 | Key::Num4 | Key::Num5 | + Key::Num6 | Key::Num7 | Key::Num8 | Key::Num9 | Key::Semicolon | + Key::Equal | Key::A | Key::B | Key::C | Key::D | Key::E | Key::F | + Key::G | Key::H | Key::I | Key::J | Key::K | Key::L | Key::M | Key::N | + Key::O | Key::P | Key::Q | Key::R | Key::S | Key::T | Key::U | Key::V | + Key::W | Key::X | Key::Y | Key::Z | Key::LeftBracket | Key::Backslash | + Key::RightBracket | Key::Kp0 | Key::Kp1 | Key::Kp2 | Key::Kp3 | + Key::Kp4 | Key::Kp5 | Key::Kp6 | Key::Kp7 | Key::Kp8 | Key::Kp9 | + Key::KpDecimal | Key::KpDivide | Key::KpMultiply | Key::KpSubtract | + Key::KpAdd | Key::KpEqual => true, + _ => false, + } } -impl TextInput { +impl<T: ClipboardProvider> TextInput<T> { /// Instantiate a new text input control - pub fn new(lines: Lines, initial: DOMString, cc: Option<ConstellationChan>) -> TextInput { + pub fn new(lines: Lines, initial: DOMString, clipboard_provider: T) -> TextInput<T> { let mut i = TextInput { lines: vec!(), edit_point: Default::default(), selection_begin: None, multiline: lines == Lines::Multiple, - constellation_channel: cc, + clipboard_provider: clipboard_provider }; i.set_content(initial); i @@ -284,81 +301,74 @@ impl TextInput { /// Process a given `KeyboardEvent` and return an action for the caller to execute. pub fn handle_keydown(&mut self, event: JSRef<KeyboardEvent>) -> KeyReaction { - //A simple way to convert an event to a selection - fn maybe_select(event: JSRef<KeyboardEvent>) -> Selection { - if event.ShiftKey() { - return Selection::Selected - } - return Selection::NotSelected + if let Some(key) = event.get_key() { + self.handle_keydown_aux(key, event.get_key_modifiers()) + } else { + KeyReaction::Nothing } - match &*event.Key() { - "a" if is_control_key(event) => { + } + pub fn handle_keydown_aux(&mut self, key: Key, mods: KeyModifiers) -> KeyReaction { + let maybe_select = if mods.contains(SHIFT) { Selection::Selected } else { Selection::NotSelected }; + match key { + Key::A if is_control_key(mods) => { self.select_all(); KeyReaction::Nothing }, - "v" if is_control_key(event) => { - let (tx, rx) = channel(); - let mut contents = None; - if let Some(ref cc) = self.constellation_channel { - cc.0.send(ConstellationMsg::GetClipboardContents(tx)).unwrap(); - contents = Some(rx.recv().unwrap()); - } - if let Some(contents) = contents { - self.insert_string(&contents); - } + Key::V if is_control_key(mods) => { + let contents = self.clipboard_provider.get_clipboard_contents(); + self.insert_string(&contents); KeyReaction::DispatchInput }, - // printable characters have single-character key values - c if c.len() == 1 => { - self.insert_char(c.char_at(0)); + _ if is_printable_key(key) => { + self.insert_string(key_value(key, mods)); KeyReaction::DispatchInput } - "Space" => { + Key::Space => { self.insert_char(' '); KeyReaction::DispatchInput } - "Delete" => { + Key::Delete => { self.delete_char(DeleteDir::Forward); KeyReaction::DispatchInput } - "Backspace" => { + Key::Backspace => { self.delete_char(DeleteDir::Backward); KeyReaction::DispatchInput } - "ArrowLeft" => { - self.adjust_horizontal(-1, maybe_select(event)); + Key::Left => { + self.adjust_horizontal(-1, maybe_select); KeyReaction::Nothing } - "ArrowRight" => { - self.adjust_horizontal(1, maybe_select(event)); + Key::Right => { + self.adjust_horizontal(1, maybe_select); KeyReaction::Nothing } - "ArrowUp" => { - self.adjust_vertical(-1, maybe_select(event)); + Key::Up => { + self.adjust_vertical(-1, maybe_select); KeyReaction::Nothing } - "ArrowDown" => { - self.adjust_vertical(1, maybe_select(event)); + Key::Down => { + self.adjust_vertical(1, maybe_select); KeyReaction::Nothing } - "Enter" => self.handle_return(), - "Home" => { + Key::Enter | Key::KpEnter => self.handle_return(), + Key::Home => { self.edit_point.index = 0; KeyReaction::Nothing } - "End" => { + Key::End => { self.edit_point.index = self.current_line_length(); KeyReaction::Nothing } - "PageUp" => { - self.adjust_vertical(-28, maybe_select(event)); + Key::PageUp => { + self.adjust_vertical(-28, maybe_select); KeyReaction::Nothing } - "PageDown" => { - self.adjust_vertical(28, maybe_select(event)); + Key::PageDown => { + self.adjust_vertical(28, maybe_select); KeyReaction::Nothing } - "Tab" => KeyReaction::TriggerDefaultAction, + Key::Tab => KeyReaction::TriggerDefaultAction, _ => KeyReaction::Nothing, } } diff --git a/components/script/timers.rs b/components/script/timers.rs index 01e9920b3b7..806bc57b85a 100644 --- a/components/script/timers.rs +++ b/components/script/timers.rs @@ -11,6 +11,7 @@ use dom::bindings::utils::Reflectable; use dom::window::ScriptHelpers; use script_task::{ScriptChan, ScriptMsg, TimerSource}; +use horribly_inefficient_timers; use util::task::spawn_named; use util::str::DOMString; @@ -24,8 +25,6 @@ use std::collections::HashMap; use std::sync::mpsc::{channel, Sender}; use std::sync::mpsc::Select; use std::hash::{Hash, Hasher}; -use std::old_io::timer::Timer; -use std::time::duration::Duration; #[derive(PartialEq, Eq)] #[jstraceable] @@ -74,7 +73,6 @@ pub struct TimerManager { } -#[unsafe_destructor] impl Drop for TimerManager { fn drop(&mut self) { for (_, timer_handle) in self.active_timers.borrow_mut().iter_mut() { @@ -141,13 +139,12 @@ impl TimerManager { source: TimerSource, script_chan: Box<ScriptChan+Send>) -> i32 { - let timeout = cmp::max(0, timeout) as u64; + let duration_ms = cmp::max(0, timeout) as u32; let handle = self.next_timer_handle.get(); self.next_timer_handle.set(handle + 1); // Spawn a new timer task; it will dispatch the `ScriptMsg::FireTimer` // to the relevant script handler that will deal with it. - let tm = Timer::new().unwrap(); let (control_chan, control_port) = channel(); let spawn_name = match source { TimerSource::FromWindow(_) if is_interval == IsInterval::Interval => "Window:SetInterval", @@ -156,12 +153,10 @@ impl TimerManager { TimerSource::FromWorker => "Worker:SetTimeout", }.to_owned(); spawn_named(spawn_name, move || { - let mut tm = tm; - let duration = Duration::milliseconds(timeout as i64); let timeout_port = if is_interval == IsInterval::Interval { - tm.periodic(duration) + horribly_inefficient_timers::periodic(duration_ms) } else { - tm.oneshot(duration) + horribly_inefficient_timers::oneshot(duration_ms) }; let control_port = control_port; diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs index d021c28e38e..f9ff918c60e 100644 --- a/components/script/webdriver_handlers.rs +++ b/components/script/webdriver_handlers.rs @@ -5,6 +5,7 @@ use webdriver_traits::{EvaluateJSReply}; use dom::bindings::conversions::FromJSValConvertible; use dom::bindings::conversions::StringificationBehavior; +use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; use dom::bindings::js::{OptionalRootable, Rootable}; use dom::window::ScriptHelpers; use dom::document::DocumentHelpers; @@ -15,7 +16,7 @@ use script_task::get_page; use std::rc::Rc; use std::sync::mpsc::Sender; -pub fn handle_evaluate_js(page: &Rc<Page>, pipeline: PipelineId, eval: String, reply: Sender<Result<EvaluateJSReply, ()>>){ +pub fn handle_evaluate_js(page: &Rc<Page>, pipeline: PipelineId, eval: String, reply: Sender<Result<EvaluateJSReply, ()>>) { let page = get_page(&*page, pipeline); let window = page.window().root(); let cx = window.r().get_cx(); @@ -36,3 +37,7 @@ pub fn handle_evaluate_js(page: &Rc<Page>, pipeline: PipelineId, eval: String, r Err(()) }).unwrap(); } + +pub fn handle_get_title(page: &Rc<Page>, _pipeline: PipelineId, reply: Sender<String>) { + reply.send(page.document().root().r().Title()).unwrap(); +} diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index 1fa6e8d321f..62143373f0a 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -2,6 +2,12 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +//! This module contains traits in script used generically in the rest of Servo. +//! The traits are here instead of in script so that these modules won't have +//! to depend on script. + +#[deny(missing_docs)] + extern crate devtools_traits; extern crate geom; extern crate libc; @@ -11,11 +17,6 @@ extern crate util; extern crate url; extern crate webdriver_traits; -// This module contains traits in script used generically -// in the rest of Servo. -// The traits are here instead of in script so -// that these modules won't have to depend on script. - use devtools_traits::DevtoolsControlChan; use libc::c_void; use msg::constellation_msg::{ConstellationChan, PipelineId, Failure, WindowSizeData}; @@ -39,11 +40,18 @@ use geom::rect::Rect; pub struct UntrustedNodeAddress(pub *const c_void); unsafe impl Send for UntrustedNodeAddress {} +/// The initial data associated with a newly-created framed pipeline. pub struct NewLayoutInfo { + /// Id of the parent of this new pipeline. pub containing_pipeline_id: PipelineId, + /// Id of the newly-created pipeline. pub new_pipeline_id: PipelineId, + /// Id of the new frame associated with this pipeline. pub subpage_id: SubpageId, - pub layout_chan: Box<Any+Send>, // opaque reference to a LayoutChannel + /// Channel for communicating with this new pipeline's layout task. + /// (This is a LayoutChannel.) + pub layout_chan: Box<Any+Send>, + /// Network request data which will be initiated by the script task. pub load_data: LoadData, } @@ -78,24 +86,35 @@ pub enum ConstellationControlMsg { /// Set an iframe to be focused. Used when an element in an iframe gains focus. FocusIFrame(PipelineId, SubpageId), // Passes a webdriver command to the script task for execution - WebDriverCommand(PipelineId, WebDriverScriptCommand) + WebDriverCommand(PipelineId, WebDriverScriptCommand), + /// Notifies script task that all animations are done + TickAllAnimations(PipelineId), } /// The mouse button involved in the event. #[derive(Clone, Debug)] pub enum MouseButton { + /// The left mouse button. Left, + /// The middle mouse button. Middle, + /// The right mouse button. Right, } /// Events from the compositor that the script task needs to know about pub enum CompositorEvent { + /// The window was resized. ResizeEvent(WindowSizeData), + /// A point was clicked. ClickEvent(MouseButton, Point2D<f32>), + /// A mouse button was pressed on a point. MouseDownEvent(MouseButton, Point2D<f32>), + /// A mouse button was released on a point. MouseUpEvent(MouseButton, Point2D<f32>), + /// The mouse was moved over a point. MouseMoveEvent(Point2D<f32>), + /// A key was pressed. KeyEvent(Key, KeyState, KeyModifiers), } diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index 5fdb4195f71..322b41c5d5b 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -2,7 +2,7 @@ name = "servo" version = "0.0.1" dependencies = [ - "android_glue 0.0.1", + "android_glue 0.0.2", "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "compositing 0.0.1", "devtools 0.0.1", @@ -11,17 +11,19 @@ dependencies = [ "gfx_tests 0.0.1", "glutin_app 0.0.1", "layout 0.0.1", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net 0.0.1", "net_tests 0.0.1", "net_traits 0.0.1", "png 0.1.0 (git+https://github.com/servo/rust-png)", "profile 0.0.1", + "profile_traits 0.0.1", "script 0.0.1", "script_tests 0.0.1", "style_tests 0.0.1", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "util_tests 0.0.1", "webdriver_server 0.0.1", @@ -29,17 +31,17 @@ dependencies = [ [[package]] name = "android_glue" -version = "0.0.1" +version = "0.0.2" [[package]] name = "android_glue" -version = "0.0.1" -source = "git+https://github.com/tomaka/android-rs-glue#fa1eaa1d1857e0fa93832c5c8db5dc8bbcbc1eba" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "azure" version = "0.1.0" -source = "git+https://github.com/servo/rust-azure#3e5daf667a62f702dc16285e923464458bef785f" +source = "git+https://github.com/servo/rust-azure#91e18a325fa5fdee9b1634b44a3a3a7ac1fb09ff" dependencies = [ "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)", @@ -47,8 +49,8 @@ dependencies = [ "egl 0.1.0 (git+https://github.com/servo/rust-egl)", "freetype 0.1.0 (git+https://github.com/servo/rust-freetype)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "skia 0.0.20130412 (git+https://github.com/servo/skia?branch=upstream-2014-06-16)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "skia 0.0.20130412 (git+https://github.com/servo/skia)", "xlib 0.1.0 (git+https://github.com/servo/rust-xlib)", ] @@ -58,15 +60,20 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "byteorder" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "canvas" version = "0.0.1" dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure)", - "cssparser 0.2.0 (git+https://github.com/servo/rust-cssparser)", + "cssparser 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gfx 0.0.1", "gleam 0.0.1 (git+https://github.com/servo/gleam)", - "glutin 0.0.7 (git+https://github.com/servo/glutin?branch=servo)", + "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "offscreen_gl_context 0.0.1 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)", "util 0.0.1", ] @@ -74,32 +81,27 @@ dependencies = [ [[package]] name = "cgl" version = "0.0.1" -source = "git+https://github.com/servo/rust-cgl#211afc4d1572d8fe67b91c452441b6cb292a2bc7" +source = "git+https://github.com/servo/rust-cgl#851ca1b90081d221c3c38d33548d3e22a19db79f" dependencies = [ "gleam 0.0.1 (git+https://github.com/servo/gleam)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "clipboard" version = "0.0.1" -source = "git+https://github.com/aweinstock314/rust-x11-clipboard#eae9596e7e407c8b6037b934c1a8e42a309423fd" +source = "git+https://github.com/servo/rust-x11-clipboard#43afb218871e3148758c603f335576cb101cb1fa" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "xlib 0.1.0 (git+https://github.com/servo/rust-xlib)", ] [[package]] name = "clock_ticks" -version = "0.0.4" -source = "git+https://github.com/tomaka/clock_ticks#6a3005279bedc406b13eea09ff92447f05ca0de6" - -[[package]] -name = "cocoa" -version = "0.1.1" -source = "git+https://github.com/servo/rust-cocoa#ca3441a14783aa0683e073f1a1f990ed21900718" +version = "0.0.5" +source = "git+https://github.com/tomaka/clock_ticks#462848731d99ed2f800e2e5a19e2d8ca3b11c90c" dependencies = [ - "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -107,7 +109,7 @@ name = "compositing" version = "0.0.1" dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure)", - "clipboard 0.0.1 (git+https://github.com/aweinstock314/rust-x11-clipboard)", + "clipboard 0.0.1 (git+https://github.com/servo/rust-x11-clipboard)", "core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)", "core_text 0.1.0 (git+https://github.com/servo/rust-core-text)", "devtools_traits 0.0.1", @@ -116,73 +118,83 @@ dependencies = [ "gleam 0.0.1 (git+https://github.com/servo/gleam)", "layers 0.1.0 (git+https://github.com/servo/rust-layers)", "layout_traits 0.0.1", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net 0.0.1", "net_traits 0.0.1", + "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "png 0.1.0 (git+https://github.com/servo/rust-png)", - "profile 0.0.1", + "profile_traits 0.0.1", "script_traits 0.0.1", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "style 0.0.1", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "webdriver_traits 0.0.1", ] [[package]] name = "cookie" -version = "0.1.14" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "openssl 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "core_foundation" version = "0.1.0" -source = "git+https://github.com/servo/rust-core-foundation#c577bd64b0301fe926cf7b757b9852a1ce1d521d" +source = "git+https://github.com/servo/rust-core-foundation#928efbae42fc596e6ede2cf0949c3d6d6f3dad8f" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "core_graphics" version = "0.1.0" -source = "git+https://github.com/servo/rust-core-graphics#e169ad38f71ed003c21fb550a9dfa0e51423ed3a" +source = "git+https://github.com/servo/rust-core-graphics#da0d2fe947412afea55b438454194b2183c21594" dependencies = [ "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "core_text" version = "0.1.0" -source = "git+https://github.com/servo/rust-core-text#8809f011445585d023d5e2a0712a1adcbf7ce609" +source = "git+https://github.com/servo/rust-core-text#bc6994c3765f0660e9c04f5488ba194a9354e8fb" dependencies = [ "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cssparser" -version = "0.2.0" -source = "git+https://github.com/servo/rust-cssparser#56d5f94d5239d4bd68358813405e4d5823c01ff6" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "encoding 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "text_writer 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] +name = "debug-builders" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "devtools" version = "0.0.1" dependencies = [ "devtools_traits 0.0.1", + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] @@ -190,101 +202,111 @@ dependencies = [ name = "devtools_traits" version = "0.0.1" dependencies = [ + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] [[package]] name = "egl" version = "0.1.0" -source = "git+https://github.com/servo/rust-egl#328e79b6256dea346f1821ccc4215e95fd1d58bc" +source = "git+https://github.com/servo/rust-egl#c0159346b3adfdcf13f2cd86f5ee41750a72c078" +dependencies = [ + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "encoding" -version = "0.2.25" +version = "0.2.32" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "encoding-index-japanese 1.20141219.2 (registry+https://github.com/rust-lang/crates.io-index)", - "encoding-index-korean 1.20141219.1 (registry+https://github.com/rust-lang/crates.io-index)", - "encoding-index-simpchinese 1.20141219.1 (registry+https://github.com/rust-lang/crates.io-index)", - "encoding-index-singlebyte 1.20141219.1 (registry+https://github.com/rust-lang/crates.io-index)", - "encoding-index-tradchinese 1.20141219.2 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-japanese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-korean 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-simpchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-singlebyte 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-tradchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "encoding-index-japanese" -version = "1.20141219.2" +version = "1.20141219.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "encoding_index_tests 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "encoding-index-korean" -version = "1.20141219.1" +version = "1.20141219.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "encoding_index_tests 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "encoding-index-simpchinese" -version = "1.20141219.1" +version = "1.20141219.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "encoding_index_tests 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "encoding-index-singlebyte" -version = "1.20141219.1" +version = "1.20141219.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "encoding_index_tests 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "encoding-index-tradchinese" -version = "1.20141219.2" +version = "1.20141219.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "encoding_index_tests 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "encoding_index_tests" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "expat-sys" version = "2.1.0" -source = "git+https://github.com/servo/libexpat#523a2f2f51b41adf7bb5c4c65e80db0cb615d70b" +source = "git+https://github.com/servo/libexpat#5f798cfbb74650a5e1d95e4c03a9e41e55e28625" [[package]] name = "flate2" -version = "0.2.0" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] +name = "fnv" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "fontconfig" version = "0.1.0" -source = "git+https://github.com/servo/rust-fontconfig#91195bd29daa9280680bb28ba556821d504a17c6" +source = "git+https://github.com/servo/rust-fontconfig#7839e5adcb4d6da3cefe2256f5071ac0203b9206" dependencies = [ "fontconfig-sys 2.11.1 (git+https://github.com/servo/libfontconfig)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "fontconfig-sys" version = "2.11.1" -source = "git+https://github.com/servo/libfontconfig#adc60cacbca697123f4535ce2ff07619ec013cec" +source = "git+https://github.com/servo/libfontconfig#ce4a38633dc649b95c9b4935c0cce53e76d8b46a" dependencies = [ "expat-sys 2.1.0 (git+https://github.com/servo/libexpat)", "freetype-sys 2.4.11 (git+https://github.com/servo/libfreetype2)", @@ -295,38 +317,36 @@ name = "freetype" version = "0.1.0" source = "git+https://github.com/servo/rust-freetype#f256a9ac84893f0a183b8966de2a3a03d7552b8b" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "freetype-sys" version = "2.4.11" -source = "git+https://github.com/servo/libfreetype2#a488dfd86872bf9c163d54a7f73a5dc4d3c4fd9e" +source = "git+https://github.com/servo/libfreetype2#50c1cf412d87f20ccbb940e39a14a38ae7cbb512" [[package]] name = "gcc" -version = "0.3.1" -source = "git+https://github.com/alexcrichton/gcc-rs#564247d019449ba46f25f64ffdefade5968b6ae7" - -[[package]] -name = "gcc" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "gdi32-sys" -version = "0.0.4" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "geom" version = "0.1.0" -source = "git+https://github.com/servo/rust-geom#c47fc0f927b6d6e5543fe3b5445c86810831dce1" +source = "git+https://github.com/servo/rust-geom#c4bdb1ef8f4915ae636eb752b103f69246b50304" dependencies = [ - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -343,20 +363,20 @@ dependencies = [ "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "harfbuzz 0.1.0 (git+https://github.com/servo/rust-harfbuzz)", "layers 0.1.0 (git+https://github.com/servo/rust-layers)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", "plugins 0.0.1", "png 0.1.0 (git+https://github.com/servo/rust-png)", - "profile 0.0.1", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "profile_traits 0.0.1", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "script_traits 0.0.1", - "skia 0.0.20130412 (git+https://github.com/servo/skia?branch=upstream-2014-06-16)", + "skia 0.0.20130412 (git+https://github.com/servo/skia)", "stb_image 0.1.0 (git+https://github.com/servo/rust-stb-image)", - "string_cache 0.0.0 (git+https://github.com/servo/string-cache)", + "string_cache 0.1.0 (git+https://github.com/servo/string-cache)", "style 0.0.1", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] @@ -368,51 +388,66 @@ dependencies = [ ] [[package]] +name = "gl" +version = "0.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gl_common 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "khronos_api 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "gl_common" version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gl_generator" -version = "0.0.19" +version = "0.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "khronos_api 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "xml-rs 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "xml-rs 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gleam" version = "0.0.1" -source = "git+https://github.com/servo/gleam#70c5f2ea3ef3602277b7c380c24b504e42338056" +source = "git+https://github.com/servo/gleam#f2edabf2ef0474bb270b107e5e68c2727c4a422d" dependencies = [ "gl_common 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gl_generator 0.0.19 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "khronos_api 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "glutin" -version = "0.0.7" -source = "git+https://github.com/servo/glutin?branch=servo#0feab4842c5b229bfe88739d2c526d03c198fd33" +version = "0.0.26" +source = "git+https://github.com/servo/glutin?branch=servo#11389c9ead188376095297a5a295f53d98129a57" dependencies = [ - "android_glue 0.0.1 (git+https://github.com/tomaka/android-rs-glue)", - "cocoa 0.1.1 (git+https://github.com/servo/rust-cocoa)", - "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", - "core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)", - "gdi32-sys 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "android_glue 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gdi32-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "gl_common 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gl_generator 0.0.19 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin_cocoa 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin_core_foundation 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin_core_graphics 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "khronos_api 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "user32-sys 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "osmesa-sys 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "user32-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "x11 0.0.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -425,99 +460,139 @@ dependencies = [ "egl 0.1.0 (git+https://github.com/servo/rust-egl)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gleam 0.0.1 (git+https://github.com/servo/gleam)", - "glutin 0.0.7 (git+https://github.com/servo/glutin?branch=servo)", + "glutin 0.0.26 (git+https://github.com/servo/glutin?branch=servo)", "layers 0.1.0 (git+https://github.com/servo/rust-layers)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "script_traits 0.0.1", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] [[package]] +name = "glutin_cocoa" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "glutin_core_foundation" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "glutin_core_graphics" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "glutin_core_foundation 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "glx" version = "0.0.1" -source = "git+https://github.com/servo/rust-glx#f2103861d38076ef5e01a8c2f58df1e79ca12f41" +source = "git+https://github.com/servo/rust-glx#60ac0aee2438eadb4b51ddc8eac6fc4b5ca8e447" dependencies = [ "gl_common 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gl_generator 0.0.19 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "khronos_api 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "harfbuzz" version = "0.1.0" -source = "git+https://github.com/servo/rust-harfbuzz#cc875777f820da0b85f39c2359d9609650b16600" +source = "git+https://github.com/servo/rust-harfbuzz#33b6fd019fc04e46dd5fe15a5faf8efb1a9a0128" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "html5ever" version = "0.0.0" -source = "git+https://github.com/servo/html5ever#8bad1ca8e1e05a7972be80acc64efd729ffdc8a5" +source = "git+https://github.com/servo/html5ever#74dc5f5a36451cfbe789488b20d51bef97c63898" dependencies = [ "html5ever_macros 0.0.0 (git+https://github.com/servo/html5ever)", - "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "mac 0.0.2 (git+https://github.com/reem/rust-mac)", - "phf 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "phf_macros 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "string_cache 0.0.0 (git+https://github.com/servo/string-cache)", - "string_cache_plugin 0.0.0 (git+https://github.com/servo/string-cache)", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", + "phf 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_macros 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache 0.1.0 (git+https://github.com/servo/string-cache)", + "string_cache_plugin 0.1.1 (git+https://github.com/servo/string-cache)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "html5ever_macros" version = "0.0.0" -source = "git+https://github.com/servo/html5ever#8bad1ca8e1e05a7972be80acc64efd729ffdc8a5" +source = "git+https://github.com/servo/html5ever#74dc5f5a36451cfbe789488b20d51bef97c63898" dependencies = [ "mac 0.0.2 (git+https://github.com/reem/rust-mac)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] +name = "httparse" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "hyper" -version = "0.3.0" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cookie 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "cookie 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "unicase 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "traitobject 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "typeable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "io_surface" version = "0.1.0" -source = "git+https://github.com/servo/rust-io-surface#f380a03a9b0e0316866d4320d46a78dda87efbec" +source = "git+https://github.com/servo/rust-io-surface#ab0ebd4ea6dd953c1581d9486b9e80ecf3c7577d" dependencies = [ "cgl 0.0.1 (git+https://github.com/servo/rust-cgl)", "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gleam 0.0.1 (git+https://github.com/servo/gleam)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "js" version = "0.1.0" -source = "git+https://github.com/servo/rust-mozjs#402b7b2db8816ffeccacfa9a8d316f4487e96ba0" +source = "git+https://github.com/servo/rust-mozjs#30a1ad31d1ee47a8e4e1ef582e793badfb405fa0" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "mozjs_sys 0.0.0 (git+https://github.com/servo/mozjs)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "kernel32-sys" -version = "0.0.11" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -528,7 +603,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "layers" version = "0.1.0" -source = "git+https://github.com/servo/rust-layers#df3a14d00260c8ab506565972555931444361ff8" +source = "git+https://github.com/servo/rust-layers#018259e838c3842032010829feeaba316e577376" dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure)", "cgl 0.0.1 (git+https://github.com/servo/rust-cgl)", @@ -538,8 +613,10 @@ dependencies = [ "gleam 0.0.1 (git+https://github.com/servo/gleam)", "glx 0.0.1 (git+https://github.com/servo/rust-glx)", "io_surface 0.1.0 (git+https://github.com/servo/rust-io-surface)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "skia 0.0.20130412 (git+https://github.com/servo/skia?branch=upstream-2014-06-16)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "skia 0.0.20130412 (git+https://github.com/servo/skia)", "xlib 0.1.0 (git+https://github.com/servo/rust-xlib)", ] @@ -550,26 +627,26 @@ dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure)", "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "canvas 0.0.1", - "clock_ticks 0.0.4 (git+https://github.com/tomaka/clock_ticks)", - "cssparser 0.2.0 (git+https://github.com/servo/rust-cssparser)", - "encoding 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)", + "clock_ticks 0.0.5 (git+https://github.com/tomaka/clock_ticks)", + "cssparser 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gfx 0.0.1", "layout_traits 0.0.1", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", "plugins 0.0.1", "png 0.1.0 (git+https://github.com/servo/rust-png)", - "profile 0.0.1", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "profile_traits 0.0.1", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "script 0.0.1", "script_traits 0.0.1", "selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", - "string_cache 0.0.0 (git+https://github.com/servo/string-cache)", - "string_cache_plugin 0.0.0 (git+https://github.com/servo/string-cache)", + "string_cache 0.1.0 (git+https://github.com/servo/string-cache)", + "string_cache_plugin 0.1.1 (git+https://github.com/servo/string-cache)", "style 0.0.1", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] @@ -580,34 +657,37 @@ dependencies = [ "gfx 0.0.1", "msg 0.0.1", "net_traits 0.0.1", - "profile 0.0.1", + "profile_traits 0.0.1", "script_traits 0.0.1", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] [[package]] name = "lazy_static" -version = "0.1.8" -source = "git+https://github.com/Kimundi/lazy-static.rs#56b4be4141d3c58273cf5ee1d2e956e2f22248b9" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.1.2" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libressl-pnacl-sys" -version = "2.1.4" +version = "2.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "pnacl-build-helper 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "pnacl-build-helper 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "log" -version = "0.2.5" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "mac" @@ -615,6 +695,19 @@ version = "0.0.2" source = "git+https://github.com/reem/rust-mac#6316d3f4663756180fd236b126a84e245e978765" [[package]] +name = "mac" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "malloc_buf" +version = "0.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "matches" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -624,21 +717,21 @@ name = "mime" version = "0.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "miniz-sys" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "mod_path" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -654,11 +747,12 @@ dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", - "hyper 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "io_surface 0.1.0 (git+https://github.com/servo/rust-io-surface)", "layers 0.1.0 (git+https://github.com/servo/rust-layers)", + "png 0.1.0 (git+https://github.com/servo/rust-png)", "style 0.0.1", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "webdriver_traits 0.0.1", ] @@ -667,32 +761,32 @@ dependencies = [ name = "net" version = "0.0.1" dependencies = [ - "cookie 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cookie 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", + "devtools_traits 0.0.1", + "flate2 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", - "hyper 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "net_traits 0.0.1", - "openssl 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "png 0.1.0 (git+https://github.com/servo/rust-png)", - "profile 0.0.1", - "regex 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "regex_macros 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", + "regex_macros 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", + "uuid 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "net_tests" version = "0.0.1" dependencies = [ - "cookie 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cookie 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "net 0.0.1", "net_traits 0.0.1", - "profile 0.0.1", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] @@ -701,81 +795,122 @@ name = "net_traits" version = "0.0.1" dependencies = [ "geom 0.1.0 (git+https://github.com/servo/rust-geom)", - "hyper 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "msg 0.0.1", "png 0.1.0 (git+https://github.com/servo/rust-png)", - "profile 0.0.1", "stb_image 0.1.0 (git+https://github.com/servo/rust-stb-image)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] [[package]] +name = "num" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num_cpus" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "objc" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "malloc_buf 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "offscreen_gl_context" version = "0.0.1" -source = "git+https://github.com/ecoal95/rust-offscreen-rendering-context#9547d416019b15e0e59dc5176f5b1a14e14b44ca" +source = "git+https://github.com/ecoal95/rust-offscreen-rendering-context#c2b3dfd7fe344384e4206672b99c296141f5b4d6" dependencies = [ "cgl 0.0.1 (git+https://github.com/servo/rust-cgl)", + "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gleam 0.0.1 (git+https://github.com/servo/gleam)", "glx 0.0.1 (git+https://github.com/servo/rust-glx)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "xlib 0.1.0 (git+https://github.com/servo/rust-xlib)", ] [[package]] name = "openssl" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "openssl-sys" -version = "0.5.1" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gcc 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libressl-pnacl-sys 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "osmesa-sys" +version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libressl-pnacl-sys 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gl 0.0.12 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "phf" -version = "0.6.12" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "phf_shared 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "debug-builders 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "phf_generator" -version = "0.6.12" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "phf_shared 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "phf_macros" -version = "0.6.12" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "phf_generator 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "phf_shared 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_generator 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "phf_shared" -version = "0.6.12" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "pkg-config" -version = "0.3.0" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -787,60 +922,76 @@ dependencies = [ [[package]] name = "pnacl-build-helper" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "tempdir 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "png" version = "0.1.0" -source = "git+https://github.com/servo/rust-png#1d9c59c97598014860077f372443ae98b35ff4d9" +source = "git+https://github.com/servo/rust-png#80e765ed1880ea70a8326a13964f57657b9e6fa9" dependencies = [ - "gcc 0.3.1 (git+https://github.com/alexcrichton/gcc-rs)", + "gcc 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "png-sys 1.6.16 (git+https://github.com/servo/rust-png)", ] [[package]] name = "png-sys" version = "1.6.16" -source = "git+https://github.com/servo/rust-png#1d9c59c97598014860077f372443ae98b35ff4d9" +source = "git+https://github.com/servo/rust-png#80e765ed1880ea70a8326a13964f57657b9e6fa9" [[package]] name = "profile" version = "0.0.1" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "profile_traits 0.0.1", + "regex 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", "task_info 0.0.1", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] [[package]] +name = "profile_traits" +version = "0.0.1" +dependencies = [ + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quicksort" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "rand" -version = "0.1.4" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex" -version = "0.1.18" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "regex_macros" -version = "0.1.11" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "regex 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-serialize" -version = "0.3.4" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -849,37 +1000,41 @@ version = "0.0.1" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "canvas 0.0.1", - "cssparser 0.2.0 (git+https://github.com/servo/rust-cssparser)", + "cssparser 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "devtools_traits 0.0.1", - "encoding 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gfx 0.0.1", "html5ever 0.0.0 (git+https://github.com/servo/html5ever)", - "hyper 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "js 0.1.0 (git+https://github.com/servo/rust-mozjs)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", + "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", "png 0.1.0 (git+https://github.com/servo/rust-png)", - "profile 0.0.1", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "profile_traits 0.0.1", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "script_traits 0.0.1", "selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", - "string_cache 0.0.0 (git+https://github.com/servo/string-cache)", - "string_cache_plugin 0.0.0 (git+https://github.com/servo/string-cache)", + "string_cache 0.1.0 (git+https://github.com/servo/string-cache)", + "string_cache_plugin 0.1.1 (git+https://github.com/servo/string-cache)", "style 0.0.1", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "uuid 0.1.11 (git+https://github.com/rust-lang/uuid)", + "uuid 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "webdriver_traits 0.0.1", + "websocket 0.11.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "script_tests" version = "0.0.1" dependencies = [ + "msg 0.0.1", "script 0.0.1", ] @@ -889,10 +1044,10 @@ version = "0.0.1" dependencies = [ "devtools_traits 0.0.1", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "webdriver_traits 0.0.1", ] @@ -900,68 +1055,85 @@ dependencies = [ [[package]] name = "selectors" version = "0.1.0" -source = "git+https://github.com/servo/rust-selectors#0d7d846090c21d71ebb1bc17921806933a38f52b" +source = "git+https://github.com/servo/rust-selectors#1fda09bf0c59acfcb697f71b38dad22108b3d27a" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.2.0 (git+https://github.com/servo/rust-cssparser)", + "cssparser 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "string_cache 0.0.0 (git+https://github.com/servo/string-cache)", - "string_cache_plugin 0.0.0 (git+https://github.com/servo/string-cache)", + "quicksort 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache 0.1.0 (git+https://github.com/servo/string-cache)", + "string_cache_plugin 0.1.1 (git+https://github.com/servo/string-cache)", ] [[package]] name = "skia" version = "0.0.20130412" -source = "git+https://github.com/servo/skia?branch=upstream-2014-06-16#db5b5393c83da9ff5b8fb2076481e98fb2b659f2" +source = "git+https://github.com/servo/skia#d60e6753b2b23b3b4ff787b505da56cfad0335c9" dependencies = [ "expat-sys 2.1.0 (git+https://github.com/servo/libexpat)", "freetype-sys 2.4.11 (git+https://github.com/servo/libfreetype2)", ] [[package]] +name = "smallvec" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "stb_image" version = "0.1.0" -source = "git+https://github.com/servo/rust-stb-image#b683cc9e7ba52a1bb65361347da0df1bc9c5e854" +source = "git+https://github.com/servo/rust-stb-image#f6c411b381322609a321b7fb5f948b2365973604" +dependencies = [ + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "string_cache" -version = "0.0.0" -source = "git+https://github.com/servo/string-cache#124cb555651bd7838c5c6dc4788bc4f5350947a9" +version = "0.1.0" +source = "git+https://github.com/servo/string-cache#c5912f925e9c1db7dbe4a7980fbc3eed08eef51d" dependencies = [ - "lazy_static 0.1.8 (git+https://github.com/Kimundi/lazy-static.rs)", - "phf 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "phf_macros 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "string_cache_plugin 0.0.0 (git+https://github.com/servo/string-cache)", + "lazy_static 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "phf 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_macros 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache_plugin 0.1.1 (git+https://github.com/servo/string-cache)", + "string_cache_shared 0.1.0 (git+https://github.com/servo/string-cache)", ] [[package]] name = "string_cache_plugin" -version = "0.0.0" -source = "git+https://github.com/servo/string-cache#124cb555651bd7838c5c6dc4788bc4f5350947a9" +version = "0.1.1" +source = "git+https://github.com/servo/string-cache#c5912f925e9c1db7dbe4a7980fbc3eed08eef51d" dependencies = [ - "lazy_static 0.1.8 (git+https://github.com/Kimundi/lazy-static.rs)", - "mac 0.0.2 (git+https://github.com/reem/rust-mac)", + "lazy_static 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache_shared 0.1.0 (git+https://github.com/servo/string-cache)", ] [[package]] +name = "string_cache_shared" +version = "0.1.0" +source = "git+https://github.com/servo/string-cache#c5912f925e9c1db7dbe4a7980fbc3eed08eef51d" + +[[package]] name = "style" version = "0.0.1" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.2.0 (git+https://github.com/servo/rust-cssparser)", - "encoding 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", - "lazy_static 0.1.8 (git+https://github.com/Kimundi/lazy-static.rs)", + "lazy_static 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "mod_path 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "mod_path 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", - "string_cache 0.0.0 (git+https://github.com/servo/string-cache)", - "string_cache_plugin 0.0.0 (git+https://github.com/servo/string-cache)", - "text_writer 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache 0.1.0 (git+https://github.com/servo/string-cache)", + "string_cache_plugin 0.1.1 (git+https://github.com/servo/string-cache)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] @@ -969,13 +1141,13 @@ dependencies = [ name = "style_tests" version = "0.0.1" dependencies = [ - "cssparser 0.2.0 (git+https://github.com/servo/rust-cssparser)", + "cssparser 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", - "string_cache 0.0.0 (git+https://github.com/servo/string-cache)", - "string_cache_plugin 0.0.0 (git+https://github.com/servo/string-cache)", + "string_cache 0.1.0 (git+https://github.com/servo/string-cache)", + "string_cache_plugin 0.1.1 (git+https://github.com/servo/string-cache)", "style 0.0.1", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] @@ -984,44 +1156,57 @@ name = "task_info" version = "0.0.1" [[package]] +name = "tempdir" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "tenacious" version = "0.0.1" source = "git+https://github.com/Manishearth/rust-tenacious.git#d61782e70005a9f0cdf66f366d4ec88fc563ea1e" [[package]] -name = "text_writer" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] name = "time" -version = "0.1.19" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] +name = "traitobject" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "typeable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "unicase" -version = "0.0.5" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "url" -version = "0.2.23" +version = "0.2.31" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "user32-sys" -version = "0.0.11" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1030,19 +1215,22 @@ version = "0.0.1" dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure)", "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.2.0 (git+https://github.com/servo/rust-cssparser)", + "cssparser 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "layers 0.1.0 (git+https://github.com/servo/rust-layers)", - "lazy_static 0.1.8 (git+https://github.com/Kimundi/lazy-static.rs)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", - "rand 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", - "string_cache 0.0.0 (git+https://github.com/servo/string-cache)", - "string_cache_plugin 0.0.0 (git+https://github.com/servo/string-cache)", - "text_writer 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache 0.1.0 (git+https://github.com/servo/string-cache)", + "string_cache_plugin 0.1.1 (git+https://github.com/servo/string-cache)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1055,32 +1243,23 @@ dependencies = [ [[package]] name = "uuid" -version = "0.1.11" -source = "git+https://github.com/rust-lang/uuid#c7862508f84b114d22bb68ec01202eafc50a81b2" -dependencies = [ - "rand 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "uuid" -version = "0.1.11" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "webdriver" -version = "0.0.1" -source = "git+https://github.com/jgraham/webdriver-rust.git#fa625e3cf8fdb39b503c1cc902506df3a1d1c9de" +version = "0.1.0" +source = "git+https://github.com/jgraham/webdriver-rust.git#c2038b4195ee8cd982079cc48d6a9d039f59f1fb" dependencies = [ - "hyper 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "uuid 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1088,11 +1267,12 @@ name = "webdriver_server" version = "0.0.1" dependencies = [ "msg 0.0.1", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "png 0.1.0 (git+https://github.com/servo/rust-png)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "uuid 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "webdriver 0.0.1 (git+https://github.com/jgraham/webdriver-rust.git)", + "uuid 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "webdriver 0.1.0 (git+https://github.com/jgraham/webdriver-rust.git)", "webdriver_traits 0.0.1", ] @@ -1100,15 +1280,38 @@ dependencies = [ name = "webdriver_traits" version = "0.0.1" dependencies = [ - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "websocket" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "winapi" -version = "0.1.15" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "x11" +version = "0.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1117,12 +1320,12 @@ version = "0.1.0" source = "git+https://github.com/servo/rust-xlib#1a0f3d48fbebf96e2d1bf83ac71309b27f49e0c7" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "xml-rs" -version = "0.1.20" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/components/servo/Cargo.toml b/components/servo/Cargo.toml index 24ab504b303..7693687e1cb 100644 --- a/components/servo/Cargo.toml +++ b/components/servo/Cargo.toml @@ -67,6 +67,9 @@ path = "../msg" [dependencies.profile] path = "../profile" +[dependencies.profile_traits] +path = "../profile_traits" + [dependencies.util] path = "../util" @@ -100,3 +103,4 @@ optional = true url = "0.2.16" time = "0.1.12" bitflags = "*" +libc = "*" diff --git a/components/servo/lib.rs b/components/servo/lib.rs index 22ec02646ef..225d8f8a3b5 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -16,8 +16,7 @@ // // The `Browser` is fed events from a generic type that implements the // `WindowMethods` trait. -#![feature(libc, thread_local)] -#![cfg_attr(not(test), feature(path))] +#![feature(thread_local)] extern crate compositing; extern crate devtools; @@ -26,6 +25,7 @@ extern crate net; extern crate net_traits; extern crate msg; extern crate profile; +extern crate profile_traits; #[macro_use] extern crate util; extern crate script; @@ -52,8 +52,10 @@ use net::resource_task::new_resource_task; use net_traits::storage_task::StorageTask; use gfx::font_cache_task::FontCacheTask; -use profile::mem; -use profile::time; +use profile::mem as profile_mem; +use profile::time as profile_time; +use profile_traits::mem; +use profile_traits::time; use util::opts; use std::rc::Rc; @@ -92,8 +94,8 @@ impl Browser { // to deliver the message. let (compositor_proxy, compositor_receiver) = WindowMethods::create_compositor_channel(&window); - let time_profiler_chan = time::Profiler::create(opts.time_profiler_period); - let mem_profiler_chan = mem::Profiler::create(opts.mem_profiler_period); + let time_profiler_chan = profile_time::Profiler::create(opts.time_profiler_period); + let mem_profiler_chan = profile_mem::Profiler::create(opts.mem_profiler_period); let devtools_chan = opts.devtools_port.map(|port| { devtools::start_server(port) }); @@ -153,7 +155,7 @@ fn create_constellation(opts: opts::Opts, use std::env; // Create a Servo instance. - let resource_task = new_resource_task(opts.user_agent.clone()); + let resource_task = new_resource_task(opts.user_agent.clone(), devtools_chan.clone()); let image_cache_task = new_image_cache_task(resource_task.clone()); let font_cache_task = FontCacheTask::new(resource_task.clone()); diff --git a/components/servo/main.rs b/components/servo/main.rs index 1bf329920e3..0358a971b3e 100644 --- a/components/servo/main.rs +++ b/components/servo/main.rs @@ -26,7 +26,7 @@ extern crate net; // Servo common utilitiess extern crate util; // The window backed by glutin -extern crate "glutin_app" as app; +extern crate glutin_app as app; extern crate time; #[cfg(target_os="android")] @@ -187,7 +187,6 @@ mod android { use self::libc::funcs::posix88::stdio::fdopen; use self::libc::funcs::c95::stdio::fgets; use util::task::spawn_named; - use std::mem; use std::ffi::CString; use std::str::from_utf8; @@ -195,14 +194,15 @@ mod android { let mut pipes: [c_int; 2] = [ 0, 0 ]; pipe(pipes.as_mut_ptr()); dup2(pipes[1], file_no); - let mode = CString::from_slice("r".as_bytes()); + let mode = CString::new("r").unwrap(); let input_file = FilePtr(fdopen(pipes[0], mode.as_ptr())); spawn_named("android-logger".to_owned(), move || { loop { - let mut read_buffer: [u8; 1024] = mem::zeroed(); + let mut read_buffer: Vec<u8> = vec!(); + read_buffer.reserve(1024); let FilePtr(input_file) = input_file; fgets(read_buffer.as_mut_ptr() as *mut i8, read_buffer.len() as i32, input_file); - let cs = CString::from_slice(&read_buffer); + let cs = CString::new(read_buffer).unwrap(); match from_utf8(cs.as_bytes()) { Ok(s) => android_glue::write_log(s), _ => {} diff --git a/components/style/Cargo.toml b/components/style/Cargo.toml index dde46e98962..d29f89d4863 100644 --- a/components/style/Cargo.toml +++ b/components/style/Cargo.toml @@ -18,15 +18,9 @@ path = "../util" [dependencies.geom] git = "https://github.com/servo/rust-geom" -[dependencies.cssparser] -git = "https://github.com/servo/rust-cssparser" - [dependencies.selectors] git = "https://github.com/servo/rust-selectors" -[dependencies.lazy_static] -git = "https://github.com/Kimundi/lazy-static.rs" - [dependencies.string_cache] git = "https://github.com/servo/string-cache" @@ -34,10 +28,12 @@ git = "https://github.com/servo/string-cache" git = "https://github.com/servo/string-cache" [dependencies] -text_writer = "0.1.1" encoding = "0.2" rustc-serialize = "0.3" matches = "0.1" url = "0.2.16" mod_path = "0.1" bitflags = "*" +cssparser = "0.3.1" +num = "0.1.24" +lazy_static = "0.1.10" diff --git a/components/style/animation.rs b/components/style/animation.rs index 06e073bf745..d8652b3ea0e 100644 --- a/components/style/animation.rs +++ b/components/style/animation.rs @@ -21,10 +21,8 @@ use values::computed::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone, Lengt use values::CSSFloat; use cssparser::{RGBA, Color}; -use std::num::Float; use std::cmp::Ordering; use std::iter::repeat; -use std::num::FromPrimitive; use util::bezier::Bezier; use util::geometry::Au; @@ -155,7 +153,7 @@ impl PropertyAnimation { } } - pub fn update(&self, style: &mut ComputedValues, time: f64) { + pub fn update(&self, style: &mut ComputedValues, time: f32) { let progress = match self.timing_function { TransitionTimingFunction::CubicBezier(p1, p2) => { // See `WebCore::AnimationBase::solveEpsilon(double)` in WebKit. @@ -163,10 +161,10 @@ impl PropertyAnimation { Bezier::new(p1, p2).solve(time, epsilon) } TransitionTimingFunction::Steps(steps, StartEnd::Start) => { - (time * (steps as f64)).ceil() / (steps as f64) + (time * (steps as f32)).ceil() / (steps as f32) } TransitionTimingFunction::Steps(steps, StartEnd::End) => { - (time * (steps as f64)).floor() / (steps as f64) + (time * (steps as f32)).floor() / (steps as f32) } }; @@ -336,19 +334,19 @@ impl AnimatedProperty { } trait Interpolate { - fn interpolate(&self, other: &Self, time: f64) -> Option<Self>; + fn interpolate(&self, other: &Self, time: f32) -> Option<Self>; } impl Interpolate for Au { #[inline] - fn interpolate(&self, other: &Au, time: f64) -> Option<Au> { - Some(Au((self.0 as f64 + (other.0 as f64 - self.0 as f64) * time).round() as i32)) + fn interpolate(&self, other: &Au, time: f32) -> Option<Au> { + Some(Au((self.0 as f32 + (other.0 as f32 - self.0 as f32) * time).round() as i32)) } } impl <T> Interpolate for Option<T> where T:Interpolate { #[inline] - fn interpolate(&self, other: &Option<T>, time: f64) -> Option<Option<T>> { + fn interpolate(&self, other: &Option<T>, time: f32) -> Option<Option<T>> { match (self, other) { (&Some(ref this), &Some(ref other)) => { this.interpolate(other, time).and_then(|value| { @@ -360,32 +358,32 @@ impl <T> Interpolate for Option<T> where T:Interpolate { } } -impl Interpolate for f64 { +impl Interpolate for f32 { #[inline] - fn interpolate(&self, other: &f64, time: f64) -> Option<f64> { + fn interpolate(&self, other: &f32, time: f32) -> Option<f32> { Some(*self + (*other - *self) * time) } } -impl Interpolate for f32 { +impl Interpolate for f64 { #[inline] - fn interpolate(&self, other: &f32, time: f64) -> Option<f32> { - Some(*self + (*other - *self) * (time as f32)) + fn interpolate(&self, other: &f64, time: f32) -> Option<f64> { + Some(*self + (*other - *self) * (time as f64)) } } impl Interpolate for i32 { #[inline] - fn interpolate(&self, other: &i32, time: f64) -> Option<i32> { - let a = *self as f64; - let b = *other as f64; + fn interpolate(&self, other: &i32, time: f32) -> Option<i32> { + let a = *self as f32; + let b = *other as f32; Some((a + (b - a) * time).round() as i32) } } impl Interpolate for Visibility { #[inline] - fn interpolate(&self, other: &Visibility, time: f64) + fn interpolate(&self, other: &Visibility, time: f32) -> Option<Visibility> { match (*self, *other) { (Visibility::visible, _) | (_, Visibility::visible) => { @@ -404,7 +402,7 @@ impl Interpolate for Visibility { impl Interpolate for ZIndex { #[inline] - fn interpolate(&self, other: &ZIndex, time: f64) + fn interpolate(&self, other: &ZIndex, time: f32) -> Option<ZIndex> { match (*self, *other) { (ZIndex::Number(ref this), @@ -420,7 +418,7 @@ impl Interpolate for ZIndex { impl Interpolate for VerticalAlign { #[inline] - fn interpolate(&self, other: &VerticalAlign, time: f64) + fn interpolate(&self, other: &VerticalAlign, time: f32) -> Option<VerticalAlign> { match (*self, *other) { (VerticalAlign::Length(ref this), @@ -436,7 +434,7 @@ impl Interpolate for VerticalAlign { impl Interpolate for BorderSpacing { #[inline] - fn interpolate(&self, other: &BorderSpacing, time: f64) + fn interpolate(&self, other: &BorderSpacing, time: f32) -> Option<BorderSpacing> { self.horizontal.interpolate(&other.horizontal, time).and_then(|horizontal| { self.vertical.interpolate(&other.vertical, time).and_then(|vertical| { @@ -448,7 +446,7 @@ impl Interpolate for BorderSpacing { impl Interpolate for RGBA { #[inline] - fn interpolate(&self, other: &RGBA, time: f64) -> Option<RGBA> { + fn interpolate(&self, other: &RGBA, time: f32) -> Option<RGBA> { match (self.red.interpolate(&other.red, time), self.green.interpolate(&other.green, time), self.blue.interpolate(&other.blue, time), @@ -463,7 +461,7 @@ impl Interpolate for RGBA { impl Interpolate for Color { #[inline] - fn interpolate(&self, other: &Color, time: f64) -> Option<Color> { + fn interpolate(&self, other: &Color, time: f32) -> Option<Color> { match (*self, *other) { (Color::RGBA(ref this), Color::RGBA(ref other)) => { this.interpolate(other, time).and_then(|value| { @@ -477,7 +475,7 @@ impl Interpolate for Color { impl Interpolate for LengthOrPercentage { #[inline] - fn interpolate(&self, other: &LengthOrPercentage, time: f64) + fn interpolate(&self, other: &LengthOrPercentage, time: f32) -> Option<LengthOrPercentage> { match (*self, *other) { (LengthOrPercentage::Length(ref this), @@ -499,7 +497,7 @@ impl Interpolate for LengthOrPercentage { impl Interpolate for LengthOrPercentageOrAuto { #[inline] - fn interpolate(&self, other: &LengthOrPercentageOrAuto, time: f64) + fn interpolate(&self, other: &LengthOrPercentageOrAuto, time: f32) -> Option<LengthOrPercentageOrAuto> { match (*self, *other) { (LengthOrPercentageOrAuto::Length(ref this), @@ -524,7 +522,7 @@ impl Interpolate for LengthOrPercentageOrAuto { impl Interpolate for LengthOrPercentageOrNone { #[inline] - fn interpolate(&self, other: &LengthOrPercentageOrNone, time: f64) + fn interpolate(&self, other: &LengthOrPercentageOrNone, time: f32) -> Option<LengthOrPercentageOrNone> { match (*self, *other) { (LengthOrPercentageOrNone::Length(ref this), @@ -549,7 +547,7 @@ impl Interpolate for LengthOrPercentageOrNone { impl Interpolate for LineHeight { #[inline] - fn interpolate(&self, other: &LineHeight, time: f64) + fn interpolate(&self, other: &LineHeight, time: f32) -> Option<LineHeight> { match (*self, *other) { (LineHeight::Length(ref this), @@ -572,20 +570,39 @@ impl Interpolate for LineHeight { } } +/// http://dev.w3.org/csswg/css-transitions/#animtype-font-weight impl Interpolate for FontWeight { #[inline] - fn interpolate(&self, other: &FontWeight, time: f64) + fn interpolate(&self, other: &FontWeight, time: f32) -> Option<FontWeight> { - let a = (*self as isize) as f64; - let b = (*other as isize) as f64; - let weight: Option<FontWeight> = FromPrimitive::from_isize((a + (b - a) * time).round() as isize); - weight + let a = (*self as u32) as f32; + let b = (*other as u32) as f32; + let weight = a + (b - a) * time; + Some(if weight < 150. { + FontWeight::Weight100 + } else if weight < 250. { + FontWeight::Weight200 + } else if weight < 350. { + FontWeight::Weight300 + } else if weight < 450. { + FontWeight::Weight400 + } else if weight < 550. { + FontWeight::Weight500 + } else if weight < 650. { + FontWeight::Weight600 + } else if weight < 750. { + FontWeight::Weight700 + } else if weight < 850. { + FontWeight::Weight800 + } else { + FontWeight::Weight900 + }) } } impl Interpolate for ClipRect { #[inline] - fn interpolate(&self, other: &ClipRect, time: f64) + fn interpolate(&self, other: &ClipRect, time: f32) -> Option<ClipRect> { match (self.top.interpolate(&other.top, time), self.right.interpolate(&other.right, time), @@ -601,7 +618,7 @@ impl Interpolate for ClipRect { impl Interpolate for BackgroundPosition { #[inline] - fn interpolate(&self, other: &BackgroundPosition, time: f64) + fn interpolate(&self, other: &BackgroundPosition, time: f32) -> Option<BackgroundPosition> { match (self.horizontal.interpolate(&other.horizontal, time), self.vertical.interpolate(&other.vertical, time)) { @@ -615,7 +632,7 @@ impl Interpolate for BackgroundPosition { impl Interpolate for TextShadow { #[inline] - fn interpolate(&self, other: &TextShadow, time: f64) + fn interpolate(&self, other: &TextShadow, time: f32) -> Option<TextShadow> { match (self.offset_x.interpolate(&other.offset_x, time), self.offset_y.interpolate(&other.offset_y, time), @@ -631,7 +648,7 @@ impl Interpolate for TextShadow { impl Interpolate for TextShadowList { #[inline] - fn interpolate(&self, other: &TextShadowList, time: f64) + fn interpolate(&self, other: &TextShadowList, time: f32) -> Option<TextShadowList> { let zero = TextShadow { offset_x: Au(0), diff --git a/components/style/build.rs b/components/style/build.rs index 8e2117614cf..80965f329f5 100644 --- a/components/style/build.rs +++ b/components/style/build.rs @@ -2,8 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#![feature(io, path)] - use std::env; use std::fs::File; use std::io::Write; diff --git a/components/style/legacy.rs b/components/style/legacy.rs index c65332246a4..1b3cac694c0 100644 --- a/components/style/legacy.rs +++ b/components/style/legacy.rs @@ -16,8 +16,8 @@ use properties::PropertyDeclaration; use properties::longhands::{self, border_spacing}; use selector_matching::Stylist; -use selectors::smallvec::VecLike; use util::geometry::Au; +use util::smallvec::VecLike; use util::str::LengthOrPercentageOrAuto; /// Legacy presentational attributes that take a length as defined in HTML5 § 2.4.4.4. @@ -88,9 +88,9 @@ impl PresentationalHintSynthesis for Stylist { V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>> { let element = node.as_element(); - let length = matching_rules_list.vec_len(); + let length = matching_rules_list.len(); element.synthesize_presentational_hints_for_legacy_attributes(matching_rules_list); - if matching_rules_list.vec_len() != length { + if matching_rules_list.len() != length { // Never share style for elements with preshints *shareable = false; } @@ -101,13 +101,13 @@ impl PresentationalHintSynthesis for Stylist { LengthOrPercentageOrAuto::Auto => {} LengthOrPercentageOrAuto::Percentage(percentage) => { let width_value = specified::LengthOrPercentageOrAuto::Percentage(percentage); - matching_rules_list.vec_push(from_declaration( + matching_rules_list.push(from_declaration( PropertyDeclaration::Width(SpecifiedValue(width_value)))); *shareable = false } LengthOrPercentageOrAuto::Length(length) => { let width_value = specified::LengthOrPercentageOrAuto::Length(specified::Length::Absolute(length)); - matching_rules_list.vec_push(from_declaration( + matching_rules_list.push(from_declaration( PropertyDeclaration::Width(SpecifiedValue(width_value)))); *shareable = false } @@ -126,8 +126,8 @@ impl PresentationalHintSynthesis for Stylist { UnsignedIntegerAttribute::CellSpacing) { None => {} Some(length) => { - let width_value = specified::Length::Absolute(Au::from_px(length as isize)); - matching_rules_list.vec_push(from_declaration( + let width_value = specified::Length::Absolute(Au::from_px(length as i32)); + matching_rules_list.push(from_declaration( PropertyDeclaration::BorderSpacing( SpecifiedValue( border_spacing::SpecifiedValue { @@ -146,7 +146,7 @@ impl PresentationalHintSynthesis for Stylist { Some(value) if value != 0 => { let value = specified::Length::ServoCharacterWidth( specified::CharacterWidth(value)); - matching_rules_list.vec_push(from_declaration( + matching_rules_list.push(from_declaration( PropertyDeclaration::Width(SpecifiedValue( specified::LengthOrPercentageOrAuto::Length(value))))); *shareable = false @@ -166,7 +166,7 @@ impl PresentationalHintSynthesis for Stylist { // // https://html.spec.whatwg.org/multipage/#textarea-effective-width let value = specified::Length::ServoCharacterWidth(specified::CharacterWidth(value)); - matching_rules_list.vec_push(from_declaration( + matching_rules_list.push(from_declaration( PropertyDeclaration::Width(SpecifiedValue( specified::LengthOrPercentageOrAuto::Length(value))))); *shareable = false @@ -179,7 +179,7 @@ impl PresentationalHintSynthesis for Stylist { // // https://html.spec.whatwg.org/multipage/#textarea-effective-height let value = specified::Length::FontRelative(specified::FontRelativeLength::Em(value as CSSFloat)); - matching_rules_list.vec_push(from_declaration( + matching_rules_list.push(from_declaration( PropertyDeclaration::Height(SpecifiedValue( longhands::height::SpecifiedValue( specified::LengthOrPercentageOrAuto::Length(value)))))); @@ -204,17 +204,17 @@ impl PresentationalHintSynthesis for Stylist { match element.get_unsigned_integer_attribute(UnsignedIntegerAttribute::Border) { None => {} Some(length) => { - let width_value = specified::Length::Absolute(Au::from_px(length as isize)); - matching_rules_list.vec_push(from_declaration( + let width_value = specified::Length::Absolute(Au::from_px(length as i32)); + matching_rules_list.push(from_declaration( PropertyDeclaration::BorderTopWidth(SpecifiedValue( longhands::border_top_width::SpecifiedValue(width_value))))); - matching_rules_list.vec_push(from_declaration( + matching_rules_list.push(from_declaration( PropertyDeclaration::BorderLeftWidth(SpecifiedValue( longhands::border_left_width::SpecifiedValue(width_value))))); - matching_rules_list.vec_push(from_declaration( + matching_rules_list.push(from_declaration( PropertyDeclaration::BorderBottomWidth(SpecifiedValue( longhands::border_bottom_width::SpecifiedValue(width_value))))); - matching_rules_list.vec_push(from_declaration( + matching_rules_list.push(from_declaration( PropertyDeclaration::BorderRightWidth(SpecifiedValue( longhands::border_right_width::SpecifiedValue(width_value))))); *shareable = false diff --git a/components/style/lib.rs b/components/style/lib.rs index b4de6f762c4..59a936dd737 100644 --- a/components/style/lib.rs +++ b/components/style/lib.rs @@ -18,7 +18,6 @@ extern crate collections; extern crate geom; -extern crate text_writer; extern crate url; #[macro_use] @@ -28,13 +27,14 @@ extern crate cssparser; extern crate matches; extern crate encoding; -extern crate "rustc-serialize" as rustc_serialize; +extern crate rustc_serialize; extern crate string_cache; extern crate selectors; #[macro_use] extern crate lazy_static; +extern crate num; extern crate util; @@ -51,6 +51,7 @@ pub mod media_queries; pub mod font_face; pub mod legacy; pub mod animation; +pub mod viewport; macro_rules! reexport_computed_values { ( $( $name: ident )+ ) => { @@ -64,4 +65,3 @@ macro_rules! reexport_computed_values { } } longhand_properties_idents!(reexport_computed_values); - diff --git a/components/style/media_queries.rs b/components/style/media_queries.rs index 7f71d1602a2..8472347721c 100644 --- a/components/style/media_queries.rs +++ b/components/style/media_queries.rs @@ -203,8 +203,8 @@ pub fn parse_media_query_list(input: &mut Parser) -> MediaQueryList { impl MediaQueryList { pub fn evaluate(&self, device: &Device) -> bool { - let viewport_size = Size2D(Au::from_frac32_px(device.viewport_size.width.get()), - Au::from_frac32_px(device.viewport_size.height.get())); + let viewport_size = Size2D(Au::from_f32_px(device.viewport_size.width.get()), + Au::from_f32_px(device.viewport_size.height.get())); // Check if any queries match (OR condition) self.media_queries.iter().any(|mq| { diff --git a/components/style/node.rs b/components/style/node.rs index 6d2c84ac8cc..011066951c3 100644 --- a/components/style/node.rs +++ b/components/style/node.rs @@ -7,10 +7,10 @@ use legacy::{IntegerAttribute, LengthAttribute, UnsignedIntegerAttribute}; use properties::PropertyDeclaration; +use util::smallvec::VecLike; use util::str::LengthOrPercentageOrAuto; use selectors::matching::DeclarationBlock; -use selectors::smallvec::VecLike; pub use selectors::tree::{TNode, TElement}; pub trait TElementAttributes : Copy { diff --git a/components/style/parser.rs b/components/style/parser.rs index c9d1891d708..0e3ea92db52 100644 --- a/components/style/parser.rs +++ b/components/style/parser.rs @@ -11,6 +11,7 @@ use log; use stylesheets::Origin; pub struct ParserContext<'a> { + pub stylesheet_origin: Origin, pub base_url: &'a Url, pub selector_context: SelectorParserContext, } @@ -20,6 +21,7 @@ impl<'a> ParserContext<'a> { let mut selector_context = SelectorParserContext::new(); selector_context.in_user_agent_stylesheet = stylesheet_origin == Origin::UserAgent; ParserContext { + stylesheet_origin: stylesheet_origin, base_url: base_url, selector_context: selector_context, } diff --git a/components/style/properties.mako.rs b/components/style/properties.mako.rs index 9100f8221cd..1b869806c17 100644 --- a/components/style/properties.mako.rs +++ b/components/style/properties.mako.rs @@ -232,10 +232,10 @@ pub mod longhands { use values::computed::{ToComputedValue, Context}; use util::geometry::Au; use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { self.0.to_css(dest) } } @@ -384,7 +384,7 @@ pub mod longhands { pub type SpecifiedValue = computed_value::T; pub mod computed_value { use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; #[derive(PartialEq, Clone, Eq, Copy, Debug)] pub enum T { @@ -393,7 +393,7 @@ pub mod longhands { } impl ToCss for T { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match self { &T::Auto => dest.write_str("auto"), &T::Number(number) => write!(dest, "{}", number), @@ -437,10 +437,10 @@ pub mod longhands { <%self:longhand name="height"> use values::computed::{ToComputedValue, Context}; use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { self.0.to_css(dest) } } @@ -493,7 +493,7 @@ pub mod longhands { <%self:longhand name="line-height"> use values::computed::{ToComputedValue, Context}; use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; use values::CSSFloat; #[derive(Clone, PartialEq, Copy)] @@ -505,7 +505,7 @@ pub mod longhands { } impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match self { &SpecifiedValue::Normal => dest.write_str("normal"), &SpecifiedValue::Length(length) => length.to_css(dest), @@ -583,7 +583,7 @@ pub mod longhands { <%self:longhand name="vertical-align"> use values::computed::{ToComputedValue, Context}; use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; <% vertical_align_keywords = ( "baseline sub super top text-top middle bottom text-bottom".split()) %> @@ -597,7 +597,7 @@ pub mod longhands { } impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match self { % for keyword in vertical_align_keywords: &SpecifiedValue::${to_rust_ident(keyword)} => dest.write_str("${keyword}"), @@ -716,12 +716,12 @@ pub mod longhands { use values::computed::{Context, ToComputedValue}; use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; pub use self::computed_value::T as SpecifiedValue; impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { self.0.to_css(dest) } } @@ -778,7 +778,7 @@ pub mod longhands { use super::super::list_style_type; use cssparser::{self, ToCss}; - use text_writer::{self, TextWriter}; + use std::fmt; #[derive(PartialEq, Eq, Clone)] pub enum ContentItem { @@ -799,7 +799,7 @@ pub mod longhands { } impl ToCss for ContentItem { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match self { &ContentItem::String(ref s) => { cssparser::serialize_string(&**s, dest) @@ -837,7 +837,7 @@ pub mod longhands { } impl ToCss for T { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match self { &T::normal => dest.write_str("normal"), &T::none => dest.write_str("none"), @@ -943,10 +943,9 @@ pub mod longhands { """)} <%self:longhand name="list-style-image"> - use std::borrow::IntoCow; use url::Url; use cssparser::{ToCss, Token}; - use text_writer::{self, TextWriter}; + use std::fmt; use values::computed::{ToComputedValue, Context}; #[derive(Clone, PartialEq, Eq)] @@ -956,11 +955,11 @@ pub mod longhands { } impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match *self { SpecifiedValue::None => dest.write_str("none"), SpecifiedValue::Url(ref url) => { - Token::Url(url.to_string().into_cow()).to_css(dest) + Token::Url(url.to_string().into()).to_css(dest) } } } @@ -997,11 +996,11 @@ pub mod longhands { </%self:longhand> <%self:longhand name="quotes"> - use text_writer::{self, TextWriter}; + use std::fmt; use values::computed::ComputedValueAsSpecified; + use std::borrow::Cow; use cssparser::{ToCss, Token}; - use std::borrow::IntoCow; pub use self::computed_value::T as SpecifiedValue; @@ -1013,16 +1012,16 @@ pub mod longhands { impl ComputedValueAsSpecified for SpecifiedValue {} impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { let mut first = true; for pair in self.0.iter() { if !first { try!(dest.write_str(" ")); } first = false; - try!(Token::QuotedString((*pair.0).into_cow()).to_css(dest)); + try!(Token::QuotedString(Cow::from(&*pair.0)).to_css(dest)); try!(dest.write_str(" ")); - try!(Token::QuotedString((*pair.1).into_cow()).to_css(dest)); + try!(Token::QuotedString(Cow::from(&*pair.1)).to_css(dest)); } Ok(()) } @@ -1066,11 +1065,11 @@ pub mod longhands { <%self:longhand name="counter-increment"> use super::content; - use text_writer::{self, TextWriter}; + use std::fmt; use values::computed::ComputedValueAsSpecified; use cssparser::{ToCss, Token}; - use std::borrow::{IntoCow, ToOwned}; + use std::borrow::{Cow, ToOwned}; pub use self::computed_value::T as SpecifiedValue; @@ -1087,15 +1086,15 @@ pub mod longhands { impl ComputedValueAsSpecified for SpecifiedValue {} impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { let mut first = true; for pair in self.0.iter() { if !first { try!(dest.write_str(" ")); } first = false; - try!(Token::QuotedString(pair.0.as_slice().into_cow()).to_css(dest)); - try!(dest.write_str(format!(" {}", pair.1).as_slice())); + try!(Token::QuotedString(Cow::from(&*pair.0)).to_css(dest)); + try!(write!(dest, " {}", pair.1)); } Ok(()) } @@ -1145,7 +1144,7 @@ pub mod longhands { use values::specified::Image; use values::computed::{ToComputedValue, Context}; use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; pub mod computed_value { use values::computed; @@ -1156,7 +1155,7 @@ pub mod longhands { pub struct SpecifiedValue(pub Option<Image>); impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match *self { SpecifiedValue(Some(ref image)) => image.to_css(dest), SpecifiedValue(None) => dest.write_str("none"), @@ -1190,7 +1189,7 @@ pub mod longhands { <%self:longhand name="background-position"> use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; use values::computed::{ToComputedValue, Context}; pub mod computed_value { @@ -1210,7 +1209,7 @@ pub mod longhands { } impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { try!(self.horizontal.to_css(dest)); try!(dest.write_str(" ")); try!(self.vertical.to_css(dest)); @@ -1300,7 +1299,7 @@ pub mod longhands { <%self:longhand name="background-size"> use cssparser::{ToCss, Token}; use std::ascii::AsciiExt; - use text_writer::{self, TextWriter}; + use std::fmt; use values::computed::{Context, ToComputedValue}; pub mod computed_value { @@ -1327,7 +1326,7 @@ pub mod longhands { } impl ToCss for SpecifiedExplicitSize { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { try!(self.width.to_css(dest)); try!(dest.write_str(" ")); self.height.to_css(dest) @@ -1342,7 +1341,7 @@ pub mod longhands { } impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match *self { SpecifiedValue::Explicit(ref size) => size.to_css(dest), SpecifiedValue::Cover => dest.write_str("cover"), @@ -1461,12 +1460,13 @@ pub mod longhands { use self::computed_value::FontFamily; use string_cache::Atom; use values::computed::ComputedValueAsSpecified; + pub use self::computed_value::T as SpecifiedValue; impl ComputedValueAsSpecified for SpecifiedValue {} pub mod computed_value { use cssparser::ToCss; use string_cache::Atom; - use text_writer::{self, TextWriter}; + use std::fmt; #[derive(PartialEq, Eq, Clone, Hash)] pub enum FontFamily { @@ -1487,15 +1487,15 @@ pub mod longhands { } } impl ToCss for FontFamily { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match self { &FontFamily::FamilyName(ref name) => dest.write_str(name.as_slice()), } } } - impl ToCss for Vec<FontFamily> { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { - let mut iter = self.iter(); + impl ToCss for T { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { + let mut iter = self.0.iter(); try!(iter.next().unwrap().to_css(dest)); for family in iter { try!(dest.write_str(", ")); @@ -1504,23 +1504,23 @@ pub mod longhands { Ok(()) } } - pub type T = Vec<FontFamily>; + #[derive(Clone, PartialEq, Eq, Hash)] + pub struct T(pub Vec<FontFamily>); } - pub type SpecifiedValue = computed_value::T; #[inline] pub fn get_initial_value() -> computed_value::T { - vec![FontFamily::FamilyName(Atom::from_slice("serif"))] + computed_value::T(vec![FontFamily::FamilyName(Atom::from_slice("serif"))]) } /// <family-name># /// <family-name> = <string> | [ <ident>+ ] /// TODO: <generic-family> pub fn parse(_context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> { - input.parse_comma_separated(parse_one_family) + input.parse_comma_separated(parse_one_family).map(SpecifiedValue) } pub fn parse_one_family(input: &mut Parser) -> Result<FontFamily, ()> { if let Ok(value) = input.try(|input| input.expect_string()) { - return Ok(FontFamily::FamilyName(Atom::from_slice(value.as_slice()))) + return Ok(FontFamily::FamilyName(Atom::from_slice(&value))) } let first_ident = try!(input.expect_ident()); // match_ignore_ascii_case! { first_ident, @@ -1536,7 +1536,7 @@ pub mod longhands { value.push_str(" "); value.push_str(&ident); } - Ok(FontFamily::FamilyName(Atom::from_slice(value.as_slice()))) + Ok(FontFamily::FamilyName(Atom::from_slice(&value))) } </%self:longhand> @@ -1546,7 +1546,7 @@ pub mod longhands { <%self:longhand name="font-weight"> use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; use values::computed::{ToComputedValue, Context}; #[derive(Clone, PartialEq, Eq, Copy)] @@ -1559,7 +1559,7 @@ pub mod longhands { } impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match self { &SpecifiedValue::Bolder => dest.write_str("bolder"), &SpecifiedValue::Lighter => dest.write_str("lighter"), @@ -1596,7 +1596,7 @@ pub mod longhands { } pub mod computed_value { use std::fmt; - #[derive(PartialEq, Eq, Copy, Clone, Hash, FromPrimitive)] + #[derive(PartialEq, Eq, Copy, Clone, Hash)] pub enum T { % for weight in range(100, 901, 100): Weight${weight} = ${weight}, @@ -1667,10 +1667,10 @@ pub mod longhands { use util::geometry::Au; use values::computed::{ToComputedValue, Context}; use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { self.0.to_css(dest) } } @@ -1681,7 +1681,7 @@ pub mod longhands { use util::geometry::Au; pub type T = Au; } - const MEDIUM_PX: isize = 16; + const MEDIUM_PX: i32 = 16; #[inline] pub fn get_initial_value() -> computed_value::T { Au::from_px(MEDIUM_PX) } @@ -1730,12 +1730,59 @@ pub mod longhands { ${new_style_struct("InheritedText", is_inherited=True)} - ${single_keyword("text-align", "start end left right center justify")} + <%self:longhand name="text-align"> + pub use self::computed_value::T as SpecifiedValue; + use values::computed::ComputedValueAsSpecified; + impl ComputedValueAsSpecified for SpecifiedValue {} + pub mod computed_value { + macro_rules! define_text_align { + ( $( $name: ident => $discriminant: expr, )+ ) => { + define_css_keyword_enum! { T: + $( + stringify!($name) => $name, + )+ + } + impl T { + pub fn to_u32(self) -> u32 { + match self { + $( + T::$name => $discriminant, + )+ + } + } + pub fn from_u32(discriminant: u32) -> Option<T> { + match discriminant { + $( + $discriminant => Some(T::$name), + )+ + _ => None + } + } + } + } + } + define_text_align! { + start => 0, + end => 1, + left => 2, + right => 3, + center => 4, + justify => 5, + } + } + #[inline] pub fn get_initial_value() -> computed_value::T { + computed_value::T::start + } + pub fn parse(_context: &ParserContext, input: &mut Parser) + -> Result<SpecifiedValue, ()> { + computed_value::T::parse(input) + } + </%self:longhand> <%self:longhand name="letter-spacing"> use values::computed::{ToComputedValue, Context}; use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; #[derive(Clone, Copy, PartialEq)] pub enum SpecifiedValue { @@ -1744,7 +1791,7 @@ pub mod longhands { } impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match *self { SpecifiedValue::Normal => dest.write_str("normal"), SpecifiedValue::Specified(l) => l.to_css(dest), @@ -1786,7 +1833,7 @@ pub mod longhands { <%self:longhand name="word-spacing"> use values::computed::{ToComputedValue, Context}; use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; #[derive(Clone, Copy, PartialEq)] pub enum SpecifiedValue { @@ -1795,7 +1842,7 @@ pub mod longhands { } impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match *self { SpecifiedValue::Normal => dest.write_str("normal"), SpecifiedValue::Specified(l) => l.to_css(dest), @@ -1852,7 +1899,7 @@ pub mod longhands { <%self:longhand name="text-decoration"> use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; use values::computed::ComputedValueAsSpecified; impl ComputedValueAsSpecified for SpecifiedValue {} @@ -1867,7 +1914,7 @@ pub mod longhands { } impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { let mut space = false; if self.underline { try!(dest.write_str("underline")); @@ -2030,7 +2077,7 @@ pub mod longhands { use values::computed::{Context, ToComputedValue}; use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; use util::geometry::Au; pub mod computed_value { @@ -2058,7 +2105,7 @@ pub mod longhands { } impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { try!(self.horizontal.to_css(dest)); try!(dest.write_str(" ")); self.vertical.to_css(dest) @@ -2137,7 +2184,7 @@ pub mod longhands { pub mod computed_value { use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; use util::cursor::Cursor; #[derive(Clone, PartialEq, Eq, Copy, Debug)] @@ -2147,7 +2194,7 @@ pub mod longhands { } impl ToCss for T { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match *self { T::AutoCursor => dest.write_str("auto"), T::SpecifiedCursor(c) => c.to_css(dest), @@ -2183,7 +2230,7 @@ pub mod longhands { <%self:longhand name="column-width" experimental="True"> use values::computed::{ToComputedValue, Context}; use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; #[derive(Clone, Copy, PartialEq)] pub enum SpecifiedValue { @@ -2192,7 +2239,7 @@ pub mod longhands { } impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match *self { SpecifiedValue::Auto => dest.write_str("auto"), SpecifiedValue::Specified(l) => l.to_css(dest), @@ -2234,7 +2281,7 @@ pub mod longhands { <%self:longhand name="column-count" experimental="True"> use values::computed::{ToComputedValue, Context}; use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; #[derive(Clone, Copy, PartialEq)] pub enum SpecifiedValue { @@ -2243,7 +2290,7 @@ pub mod longhands { } impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match *self { SpecifiedValue::Auto => dest.write_str("auto"), SpecifiedValue::Specified(count) => write!(dest, "{}", count), @@ -2276,10 +2323,9 @@ pub mod longhands { if input.try(|input| input.expect_ident_matching("auto")).is_ok() { Ok(SpecifiedValue::Auto) } else { - use std::u32; let count = try!(input.expect_integer()); // Zero is invalid - if count <= 0 || count > (u32::MAX as i64) { + if count <= 0 { return Err(()) } Ok(SpecifiedValue::Specified(count as u32)) @@ -2290,7 +2336,7 @@ pub mod longhands { <%self:longhand name="column-gap" experimental="True"> use values::computed::{ToComputedValue, Context}; use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; #[derive(Clone, Copy, PartialEq)] pub enum SpecifiedValue { @@ -2299,7 +2345,7 @@ pub mod longhands { } impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match *self { SpecifiedValue::Normal => dest.write_str("normal"), SpecifiedValue::Specified(l) => l.to_css(dest), @@ -2345,10 +2391,10 @@ pub mod longhands { use values::CSSFloat; use values::computed::{ToComputedValue, Context}; use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { self.0.to_css(dest) } } @@ -2385,10 +2431,11 @@ pub mod longhands { <%self:longhand name="box-shadow"> use cssparser::{self, ToCss}; - use text_writer::{self, TextWriter}; + use std::fmt; use values::computed::{ToComputedValue, Context}; - pub type SpecifiedValue = Vec<SpecifiedBoxShadow>; + #[derive(Clone, PartialEq)] + pub struct SpecifiedValue(Vec<SpecifiedBoxShadow>); #[derive(Clone, PartialEq)] pub struct SpecifiedBoxShadow { @@ -2400,9 +2447,9 @@ pub mod longhands { pub inset: bool, } - impl ToCss for Vec<SpecifiedBoxShadow> { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { - let mut iter = self.iter(); + impl ToCss for SpecifiedValue { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { + let mut iter = self.0.iter(); if let Some(shadow) = iter.next() { try!(shadow.to_css(dest)); } else { @@ -2418,7 +2465,7 @@ pub mod longhands { } impl ToCss for SpecifiedBoxShadow { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { if self.inset { try!(dest.write_str("inset ")); } @@ -2474,9 +2521,9 @@ pub mod longhands { pub fn parse(_context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> { if input.try(|input| input.expect_ident_matching("none")).is_ok() { - Ok(Vec::new()) + Ok(SpecifiedValue(Vec::new())) } else { - input.parse_comma_separated(parse_one_box_shadow) + input.parse_comma_separated(parse_one_box_shadow).map(SpecifiedValue) } } @@ -2485,7 +2532,7 @@ pub mod longhands { #[inline] fn to_computed_value(&self, context: &Context) -> computed_value::T { - self.iter().map(|value| compute_one_box_shadow(value, context)).collect() + self.0.iter().map(|value| compute_one_box_shadow(value, context)).collect() } } @@ -2567,7 +2614,7 @@ pub mod longhands { <%self:longhand name="clip"> use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; // NB: `top` and `left` are 0 if `auto` per CSS 2.1 11.1.2. @@ -2595,10 +2642,11 @@ pub mod longhands { pub left: specified::Length, } - pub type SpecifiedValue = Option<SpecifiedClipRect>; + #[derive(Clone, Debug, PartialEq, Copy)] + pub struct SpecifiedValue(Option<SpecifiedClipRect>); impl ToCss for SpecifiedClipRect { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { try!(dest.write_str("rect(")); try!(self.top.to_css(dest)); @@ -2625,9 +2673,9 @@ pub mod longhands { } } - impl ToCss for Option<SpecifiedClipRect> { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { - if let Some(ref rect) = *self { + impl ToCss for SpecifiedValue { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { + if let Some(ref rect) = self.0 { rect.to_css(dest) } else { dest.write_str("auto") @@ -2645,7 +2693,7 @@ pub mod longhands { #[inline] fn to_computed_value(&self, context: &Context) -> computed_value::T { - self.map(|value| computed_value::ClipRect { + self.0.map(|value| computed_value::ClipRect { top: value.top.to_computed_value(context), right: value.right.map(|right| right.to_computed_value(context)), bottom: value.bottom.map(|bottom| bottom.to_computed_value(context)), @@ -2660,7 +2708,7 @@ pub mod longhands { use values::specified::Length; if input.try(|input| input.expect_ident_matching("auto")).is_ok() { - return Ok(None) + return Ok(SpecifiedValue(None)) } if !try!(input.expect_function()).eq_ignore_ascii_case("rect") { return Err(()) @@ -2675,12 +2723,12 @@ pub mod longhands { }) })); if sides.len() == 4 { - Ok(Some(SpecifiedClipRect { + Ok(SpecifiedValue(Some(SpecifiedClipRect { top: sides[0].unwrap_or(Length::Absolute(Au(0))), right: sides[1], bottom: sides[2], left: sides[3].unwrap_or(Length::Absolute(Au(0))), - })) + }))) } else { Err(()) } @@ -2690,7 +2738,6 @@ pub mod longhands { <%self:longhand name="text-shadow"> use cssparser::{self, ToCss}; use std::fmt; - use text_writer::{self, TextWriter}; use values::computed::{Context, ToComputedValue}; @@ -2736,7 +2783,7 @@ pub mod longhands { } impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { let mut iter = self.0.iter(); if let Some(shadow) = iter.next() { try!(shadow.to_css(dest)); @@ -2753,7 +2800,7 @@ pub mod longhands { } impl ToCss for SpecifiedTextShadow { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { try!(self.offset_x.to_css(dest)); try!(dest.write_str(" ")); try!(self.offset_y.to_css(dest)); @@ -2859,7 +2906,7 @@ pub mod longhands { use values::specified::{Angle, Length}; use values::CSSFloat; use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; #[derive(Clone, PartialEq)] pub struct SpecifiedValue(Vec<SpecifiedFilter>); @@ -2937,7 +2984,7 @@ pub mod longhands { } impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { let mut iter = self.0.iter(); if let Some(filter) = iter.next() { try!(filter.to_css(dest)); @@ -2954,7 +3001,7 @@ pub mod longhands { } impl ToCss for SpecifiedFilter { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match *self { SpecifiedFilter::Blur(value) => { try!(dest.write_str("blur(")); @@ -3047,16 +3094,15 @@ pub mod longhands { use values::computed::{ToComputedValue, Context}; use cssparser::ToCss; - use std::f64; + use std::f32; use std::ops::Mul; - use text_writer::{self, TextWriter}; + use std::fmt; use util::geometry::Au; pub mod computed_value { use values::CSSFloat; use values::computed; - use std::num::Float; use std::ops::Mul; #[derive(Clone, Copy, Debug, PartialEq)] @@ -3148,8 +3194,8 @@ pub mod longhands { m31: specified::LengthAndPercentage, m32: specified::LengthAndPercentage, } - impl ToCss for Option<SpecifiedMatrix> { - fn to_css<W>(&self, _: &mut W) -> text_writer::Result where W: TextWriter { + impl ToCss for SpecifiedMatrix { + fn to_css<W>(&self, _: &mut W) -> fmt::Result where W: fmt::Write { // TODO(pcwalton) Ok(()) } @@ -3217,7 +3263,7 @@ pub mod longhands { } impl ToCss for SpecifiedOperation { - fn to_css<W>(&self, _: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, _: &mut W) -> fmt::Result where W: fmt::Write { // TODO(pcwalton) Ok(()) } @@ -3227,7 +3273,7 @@ pub mod longhands { pub struct SpecifiedValue(Vec<SpecifiedOperation>); impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { let mut first = true; for operation in self.0.iter() { if !first { @@ -3267,8 +3313,8 @@ pub mod longhands { return Err(()) } let (tx, ty) = - (specified::Length::Absolute(Au::from_frac_px(values[4])), - specified::Length::Absolute(Au::from_frac_px(values[5]))); + (specified::Length::Absolute(Au::from_f32_px(values[4])), + specified::Length::Absolute(Au::from_f32_px(values[5]))); let (tx, ty) = (specified::LengthAndPercentage::from_length(tx), specified::LengthAndPercentage::from_length(ty)); @@ -3394,7 +3440,7 @@ pub mod longhands { result.scale(sx, sy) } SpecifiedOperation::Rotate(ref theta) => { - result.rotate(f64::consts::PI_2 - theta.radians()); + result.rotate(f32::consts::PI_2 - theta.radians()); } SpecifiedOperation::Skew(sx, sy) => { result.skew(sx, sy) @@ -3411,7 +3457,7 @@ pub mod longhands { use values::specified::LengthOrPercentage; use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; pub mod computed_value { use values::computed::LengthOrPercentage; @@ -3430,7 +3476,7 @@ pub mod longhands { } impl ToCss for SpecifiedValue { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { try!(self.horizontal.to_css(dest)); try!(dest.write_str(" ")); self.vertical.to_css(dest) @@ -3534,7 +3580,7 @@ pub mod longhands { pub mod computed_value { use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; #[derive(Copy, Clone, Debug, PartialEq)] pub enum T { @@ -3544,7 +3590,7 @@ pub mod longhands { } impl ToCss for T { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match *self { T::Auto => dest.write_str("auto"), T::CrispEdges => dest.write_str("crisp-edges"), @@ -3596,7 +3642,7 @@ pub mod longhands { pub mod computed_value { use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; use values::computed::{Context, ToComputedValue}; pub use values::computed::Time as SingleComputedValue; @@ -3614,7 +3660,7 @@ pub mod longhands { } impl ToCss for T { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { if self.0.is_empty() { return dest.write_str("none") } @@ -3704,18 +3750,18 @@ pub mod longhands { pub mod computed_value { use cssparser::ToCss; use geom::point::Point2D; - use text_writer::{self, TextWriter}; + use std::fmt; pub use self::TransitionTimingFunction as SingleComputedValue; #[derive(Copy, Clone, Debug, PartialEq)] pub enum TransitionTimingFunction { - CubicBezier(Point2D<f64>, Point2D<f64>), + CubicBezier(Point2D<f32>, Point2D<f32>), Steps(u32, StartEnd), } impl ToCss for TransitionTimingFunction { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match *self { TransitionTimingFunction::CubicBezier(p1, p2) => { try!(dest.write_str("cubic-bezier(")); @@ -3746,7 +3792,7 @@ pub mod longhands { } impl ToCss for StartEnd { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match *self { StartEnd::Start => dest.write_str("start"), StartEnd::End => dest.write_str("end"), @@ -3758,7 +3804,7 @@ pub mod longhands { pub struct T(pub Vec<TransitionTimingFunction>); impl ToCss for T { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { if self.0.is_empty() { return dest.write_str("none") } @@ -3857,7 +3903,7 @@ pub mod longhands { pub mod computed_value { use cssparser::ToCss; - use text_writer::{self, TextWriter}; + use std::fmt; pub use self::TransitionProperty as SingleComputedValue; @@ -3958,7 +4004,7 @@ pub mod longhands { ]; impl ToCss for TransitionProperty { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match *self { TransitionProperty::All => dest.write_str("all"), TransitionProperty::BackgroundColor => dest.write_str("background-color"), @@ -4013,7 +4059,7 @@ pub mod longhands { pub struct T(pub Vec<SingleComputedValue>); impl ToCss for T { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { if self.0.is_empty() { return dest.write_str("none") } @@ -4500,7 +4546,7 @@ pub mod shorthands { font_weight: weight, font_size: size, line_height: line_height, - font_family: Some(family) + font_family: Some(font_family::SpecifiedValue(family)) }) </%self:shorthand> diff --git a/components/style/selector_matching.rs b/components/style/selector_matching.rs index 6511f8c5772..a9c0839f5e8 100644 --- a/components/style/selector_matching.rs +++ b/components/style/selector_matching.rs @@ -8,15 +8,16 @@ use selectors::bloom::BloomFilter; use selectors::matching::{SelectorMap, Rule}; use selectors::matching::DeclarationBlock as GenericDeclarationBlock; use selectors::parser::PseudoElement; -use selectors::smallvec::VecLike; use selectors::tree::TNode; use util::resource_files::read_resource_file; +use util::smallvec::VecLike; use legacy::PresentationalHintSynthesis; use media_queries::Device; use node::TElementAttributes; use properties::{PropertyDeclaration, PropertyDeclarationBlock}; use stylesheets::{Stylesheet, CSSRuleIteratorExt, Origin}; +use viewport::{ViewportConstraints, ViewportRuleCascade}; pub type DeclarationBlock = GenericDeclarationBlock<Vec<PropertyDeclaration>>; @@ -69,6 +70,14 @@ impl Stylist { stylist } + pub fn constrain_viewport(&self) -> Option<ViewportConstraints> { + let cascaded_rule = self.stylesheets.iter() + .flat_map(|s| s.effective_rules(&self.device).viewport()) + .cascade(); + + ViewportConstraints::maybe_new(self.device.viewport_size, &cascaded_rule) + } + pub fn update(&mut self) -> bool { if self.is_dirty { self.element_map = PerPseudoElementSelectorMap::new(); @@ -213,7 +222,7 @@ impl Stylist { // Step 4: Normal style attributes. style_attribute.map(|sa| { shareable = false; - applicable_declarations.vec_push( + applicable_declarations.push( GenericDeclarationBlock::from_declarations(sa.normal.clone())) }); @@ -226,7 +235,7 @@ impl Stylist { // Step 6: `!important` style attributes. style_attribute.map(|sa| { shareable = false; - applicable_declarations.vec_push( + applicable_declarations.push( GenericDeclarationBlock::from_declarations(sa.important.clone())) }); diff --git a/components/style/stylesheets.rs b/components/style/stylesheets.rs index b910d3fe62a..a4eac87ce84 100644 --- a/components/style/stylesheets.rs +++ b/components/style/stylesheets.rs @@ -18,7 +18,8 @@ use parser::{ParserContext, log_css_error}; use properties::{PropertyDeclarationBlock, parse_property_declaration_list}; use media_queries::{Device, MediaQueryList, parse_media_query_list}; use font_face::{FontFaceRule, parse_font_face_block}; -use util::smallvec::{SmallVec, SmallVec2}; +use util::smallvec::SmallVec2; +use viewport::ViewportRule; /// Each style rule has an origin, which determines where it enters the cascade. @@ -53,6 +54,7 @@ pub enum CSSRule { Style(StyleRule), Media(MediaRule), FontFace(FontFaceRule), + Viewport(ViewportRule), } #[derive(Debug, PartialEq)] @@ -178,7 +180,7 @@ impl<'a> Iterator for Rules<'a> { fn next(&mut self) -> Option<&'a CSSRule> { while !self.stack.is_empty() { let top = self.stack.len() - 1; - while let Some(rule) = self.stack.get_mut(top).next() { + while let Some(rule) = self.stack[top].next() { // handle conditional group rules match rule { &CSSRule::Media(ref rule) => { @@ -216,6 +218,7 @@ pub mod rule_filter { use std::marker::PhantomData; use super::{CSSRule, MediaRule, StyleRule}; use super::super::font_face::FontFaceRule; + use super::super::viewport::ViewportRule; macro_rules! rule_filter { ($variant:ident -> $value:ty) => { @@ -259,6 +262,7 @@ pub mod rule_filter { rule_filter!(FontFace -> FontFaceRule); rule_filter!(Media -> MediaRule); rule_filter!(Style -> StyleRule); + rule_filter!(Viewport -> ViewportRule); } /// Extension methods for `CSSRule` iterators. @@ -271,6 +275,9 @@ pub trait CSSRuleIteratorExt<'a>: Iterator<Item=&'a CSSRule> { /// Yield only style rules. fn style(self) -> rule_filter::Style<'a, Self>; + + /// Yield only @viewport rules. + fn viewport(self) -> rule_filter::Viewport<'a, Self>; } impl<'a, I> CSSRuleIteratorExt<'a> for I where I: Iterator<Item=&'a CSSRule> { @@ -288,6 +295,11 @@ impl<'a, I> CSSRuleIteratorExt<'a> for I where I: Iterator<Item=&'a CSSRule> { fn style(self) -> rule_filter::Style<'a, I> { rule_filter::Style::new(self) } + + #[inline] + fn viewport(self) -> rule_filter::Viewport<'a, I> { + rule_filter::Viewport::new(self) + } } fn parse_nested_rules(context: &ParserContext, input: &mut Parser) -> Vec<CSSRule> { @@ -324,6 +336,7 @@ enum State { enum AtRulePrelude { FontFace, Media(MediaQueryList), + Viewport, } @@ -414,6 +427,13 @@ impl<'a, 'b> AtRuleParser for NestedRuleParser<'a, 'b> { }, "font-face" => { Ok(AtRuleType::WithBlock(AtRulePrelude::FontFace)) + }, + "viewport" => { + if ::util::opts::experimental_enabled() { + Ok(AtRuleType::WithBlock(AtRulePrelude::Viewport)) + } else { + Err(()) + } } _ => Err(()) } @@ -430,6 +450,9 @@ impl<'a, 'b> AtRuleParser for NestedRuleParser<'a, 'b> { rules: parse_nested_rules(self.context, input), })) } + AtRulePrelude::Viewport => { + ViewportRule::parse(input, self.context).map(CSSRule::Viewport) + } } } } diff --git a/components/style/values.rs b/components/style/values.rs index 12614a0bddc..5c2c29f7aef 100644 --- a/components/style/values.rs +++ b/components/style/values.rs @@ -12,7 +12,7 @@ macro_rules! define_css_keyword_enum { }; ($name: ident: $( $css: expr => $variant: ident ),+) => { #[allow(non_camel_case_types)] - #[derive(Clone, Eq, PartialEq, FromPrimitive, Copy, Hash, RustcEncodable)] + #[derive(Clone, Eq, PartialEq, Copy, Hash, RustcEncodable, Debug)] pub enum $name { $( $variant ),+ } @@ -26,17 +26,9 @@ macro_rules! define_css_keyword_enum { } } - impl ::std::fmt::Debug for $name { - #[inline] - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - use cssparser::ToCss; - self.fmt_to_css(f) - } - } - impl ::cssparser::ToCss for $name { - fn to_css<W>(&self, dest: &mut W) -> ::text_writer::Result - where W: ::text_writer::TextWriter { + fn to_css<W>(&self, dest: &mut W) -> ::std::fmt::Result + where W: ::std::fmt::Write { match self { $( &$name::$variant => dest.write_str($css) ),+ } @@ -51,7 +43,7 @@ macro_rules! define_numbered_css_keyword_enum { }; ($name: ident: $( $css: expr => $variant: ident = $value: expr ),+) => { #[allow(non_camel_case_types)] - #[derive(Clone, Eq, PartialEq, PartialOrd, Ord, FromPrimitive, Copy, RustcEncodable)] + #[derive(Clone, Eq, PartialEq, PartialOrd, Ord, Copy, RustcEncodable, Debug)] pub enum $name { $( $variant = $value ),+ } @@ -65,17 +57,9 @@ macro_rules! define_numbered_css_keyword_enum { } } - impl ::std::fmt::Debug for $name { - #[inline] - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - use cssparser::ToCss; - self.fmt_to_css(f) - } - } - impl ::cssparser::ToCss for $name { - fn to_css<W>(&self, dest: &mut W) -> ::text_writer::Result - where W: ::text_writer::TextWriter { + fn to_css<W>(&self, dest: &mut W) -> ::std::fmt::Result + where W: ::std::fmt::Write { match self { $( &$name::$variant => dest.write_str($css) ),+ } @@ -85,26 +69,40 @@ macro_rules! define_numbered_css_keyword_enum { } -pub type CSSFloat = f64; +pub type CSSFloat = f32; pub mod specified { use std::ascii::AsciiExt; use std::cmp; - use std::f64::consts::PI; + use std::f32::consts::PI; use std::fmt; - use std::fmt::{Formatter, Debug}; - use std::num::{NumCast, ToPrimitive}; + use std::fmt::Write; use std::ops::{Add, Mul}; use url::Url; use cssparser::{self, Token, Parser, ToCss, CssStringWriter}; use geom::size::Size2D; use parser::ParserContext; - use text_writer::{self, TextWriter}; use util::geometry::Au; use super::CSSFloat; - #[derive(Clone, PartialEq)] + #[derive(Clone, Copy, Debug, PartialEq, Eq)] + pub enum AllowedNumericType { + All, + NonNegative + } + + impl AllowedNumericType { + #[inline] + pub fn is_ok(&self, value: f32) -> bool { + match self { + &AllowedNumericType::All => true, + &AllowedNumericType::NonNegative => value >= 0., + } + } + } + + #[derive(Clone, PartialEq, Debug)] pub struct CSSColor { pub parsed: cssparser::Color, pub authored: Option<String>, @@ -124,12 +122,8 @@ pub mod specified { } } - impl fmt::Debug for CSSColor { - #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) } - } - impl ToCss for CSSColor { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match self.authored { Some(ref s) => dest.write_str(s), None => self.parsed.to_css(dest), @@ -137,17 +131,14 @@ pub mod specified { } } - #[derive(Clone, PartialEq)] + #[derive(Clone, PartialEq, Debug)] pub struct CSSRGBA { pub parsed: cssparser::RGBA, pub authored: Option<String>, } - impl fmt::Debug for CSSRGBA { - #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) } - } impl ToCss for CSSRGBA { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match self.authored { Some(ref s) => dest.write_str(s), None => self.parsed.to_css(dest), @@ -155,19 +146,15 @@ pub mod specified { } } - #[derive(Clone, PartialEq, Copy)] + #[derive(Clone, PartialEq, Copy, Debug)] pub enum FontRelativeLength { Em(CSSFloat), Ex(CSSFloat), Rem(CSSFloat) } - impl fmt::Debug for FontRelativeLength { - #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) } - } - impl ToCss for FontRelativeLength { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match self { &FontRelativeLength::Em(length) => write!(dest, "{}em", length), &FontRelativeLength::Ex(length) => write!(dest, "{}ex", length), @@ -193,7 +180,7 @@ pub mod specified { } } - #[derive(Clone, PartialEq, Copy)] + #[derive(Clone, PartialEq, Copy, Debug)] pub enum ViewportPercentageLength { Vw(CSSFloat), Vh(CSSFloat), @@ -201,12 +188,8 @@ pub mod specified { Vmax(CSSFloat) } - impl fmt::Debug for ViewportPercentageLength { - #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) } - } - impl ToCss for ViewportPercentageLength { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match self { &ViewportPercentageLength::Vw(length) => write!(dest, "{}vw", length), &ViewportPercentageLength::Vh(length) => write!(dest, "{}vh", length), @@ -220,7 +203,7 @@ pub mod specified { pub fn to_computed_value(&self, viewport_size: Size2D<Au>) -> Au { macro_rules! to_unit { ($viewport_dimension:expr) => { - $viewport_dimension.to_f64().unwrap() / 100.0 + $viewport_dimension.to_f32_px() / 100.0 } } @@ -234,11 +217,11 @@ pub mod specified { &ViewportPercentageLength::Vmax(length) => length * to_unit!(cmp::max(viewport_size.width, viewport_size.height)), }; - NumCast::from(value).unwrap() + Au::from_f32_px(value) } } - #[derive(Clone, PartialEq, Copy)] + #[derive(Clone, PartialEq, Copy, Debug)] pub struct CharacterWidth(pub i32); impl CharacterWidth { @@ -253,7 +236,7 @@ pub mod specified { } } - #[derive(Clone, PartialEq, Copy)] + #[derive(Clone, PartialEq, Copy, Debug)] pub enum Length { Absolute(Au), // application units FontRelative(FontRelativeLength), @@ -266,14 +249,10 @@ pub mod specified { ServoCharacterWidth(CharacterWidth), } - impl fmt::Debug for Length { - #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) } - } - impl ToCss for Length { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match self { - &Length::Absolute(length) => write!(dest, "{}px", length.to_subpx()), + &Length::Absolute(length) => write!(dest, "{}px", length.to_f32_px()), &Length::FontRelative(length) => length.to_css(dest), &Length::ViewportPercentage(length) => length.to_css(dest), &Length::ServoCharacterWidth(_) @@ -288,7 +267,7 @@ pub mod specified { #[inline] fn mul(self, scalar: CSSFloat) -> Length { match self { - Length::Absolute(Au(v)) => Length::Absolute(Au(((v as f64) * scalar) as i32)), + Length::Absolute(Au(v)) => Length::Absolute(Au(((v as f32) * scalar) as i32)), Length::FontRelative(v) => Length::FontRelative(v * scalar), Length::ViewportPercentage(v) => Length::ViewportPercentage(v * scalar), Length::ServoCharacterWidth(_) => panic!("Can't multiply ServoCharacterWidth!"), @@ -331,21 +310,21 @@ pub mod specified { const AU_PER_PC: CSSFloat = AU_PER_PT * 12.; impl Length { #[inline] - fn parse_internal(input: &mut Parser, negative_ok: bool) -> Result<Length, ()> { + fn parse_internal(input: &mut Parser, context: &AllowedNumericType) -> Result<Length, ()> { match try!(input.next()) { - Token::Dimension(ref value, ref unit) if negative_ok || value.value >= 0. => { - Length::parse_dimension(value.value, unit) - } - Token::Number(ref value) if value.value == 0. => Ok(Length::Absolute(Au(0))), + Token::Dimension(ref value, ref unit) if context.is_ok(value.value) => + Length::parse_dimension(value.value, unit), + Token::Number(ref value) if value.value == 0. => + Ok(Length::Absolute(Au(0))), _ => Err(()) } } #[allow(dead_code)] pub fn parse(input: &mut Parser) -> Result<Length, ()> { - Length::parse_internal(input, /* negative_ok = */ true) + Length::parse_internal(input, &AllowedNumericType::All) } pub fn parse_non_negative(input: &mut Parser) -> Result<Length, ()> { - Length::parse_internal(input, /* negative_ok = */ false) + Length::parse_internal(input, &AllowedNumericType::NonNegative) } pub fn parse_dimension(value: CSSFloat, unit: &str) -> Result<Length, ()> { match_ignore_ascii_case! { unit, @@ -374,18 +353,14 @@ pub mod specified { } - #[derive(Clone, PartialEq, Copy)] + #[derive(Clone, PartialEq, Copy, Debug)] pub enum LengthOrPercentage { Length(Length), Percentage(CSSFloat), // [0 .. 100%] maps to [0.0 .. 1.0] } - impl fmt::Debug for LengthOrPercentage { - #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) } - } - impl ToCss for LengthOrPercentage { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match self { &LengthOrPercentage::Length(length) => length.to_css(dest), &LengthOrPercentage::Percentage(percentage) @@ -394,46 +369,39 @@ pub mod specified { } } impl LengthOrPercentage { - fn parse_internal(input: &mut Parser, negative_ok: bool) - -> Result<LengthOrPercentage, ()> { + fn parse_internal(input: &mut Parser, context: &AllowedNumericType) + -> Result<LengthOrPercentage, ()> + { match try!(input.next()) { - Token::Dimension(ref value, ref unit) if negative_ok || value.value >= 0. => { - Length::parse_dimension(value.value, unit) - .map(LengthOrPercentage::Length) - } - Token::Percentage(ref value) if negative_ok || value.unit_value >= 0. => { - Ok(LengthOrPercentage::Percentage(value.unit_value)) - } - Token::Number(ref value) if value.value == 0. => { - Ok(LengthOrPercentage::Length(Length::Absolute(Au(0)))) - } + Token::Dimension(ref value, ref unit) if context.is_ok(value.value) => + Length::parse_dimension(value.value, unit).map(LengthOrPercentage::Length), + Token::Percentage(ref value) if context.is_ok(value.unit_value) => + Ok(LengthOrPercentage::Percentage(value.unit_value)), + Token::Number(ref value) if value.value == 0. => + Ok(LengthOrPercentage::Length(Length::Absolute(Au(0)))), _ => Err(()) } } #[allow(dead_code)] #[inline] pub fn parse(input: &mut Parser) -> Result<LengthOrPercentage, ()> { - LengthOrPercentage::parse_internal(input, /* negative_ok = */ true) + LengthOrPercentage::parse_internal(input, &AllowedNumericType::All) } #[inline] pub fn parse_non_negative(input: &mut Parser) -> Result<LengthOrPercentage, ()> { - LengthOrPercentage::parse_internal(input, /* negative_ok = */ false) + LengthOrPercentage::parse_internal(input, &AllowedNumericType::NonNegative) } } - #[derive(Clone, PartialEq, Copy)] + #[derive(Clone, PartialEq, Copy, Debug)] pub enum LengthOrPercentageOrAuto { Length(Length), Percentage(CSSFloat), // [0 .. 100%] maps to [0.0 .. 1.0] Auto, } - impl fmt::Debug for LengthOrPercentageOrAuto { - #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) } - } - impl ToCss for LengthOrPercentageOrAuto { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match self { &LengthOrPercentageOrAuto::Length(length) => length.to_css(dest), &LengthOrPercentageOrAuto::Percentage(percentage) @@ -442,85 +410,74 @@ pub mod specified { } } } + impl LengthOrPercentageOrAuto { - fn parse_internal(input: &mut Parser, negative_ok: bool) - -> Result<LengthOrPercentageOrAuto, ()> { + fn parse_internal(input: &mut Parser, context: &AllowedNumericType) + -> Result<LengthOrPercentageOrAuto, ()> + { match try!(input.next()) { - Token::Dimension(ref value, ref unit) if negative_ok || value.value >= 0. => { - Length::parse_dimension(value.value, unit) - .map(LengthOrPercentageOrAuto::Length) - } - Token::Percentage(ref value) if negative_ok || value.unit_value >= 0. => { - Ok(LengthOrPercentageOrAuto::Percentage(value.unit_value)) - } - Token::Number(ref value) if value.value == 0. => { - Ok(LengthOrPercentageOrAuto::Length(Length::Absolute(Au(0)))) - } - Token::Ident(ref value) if value.eq_ignore_ascii_case("auto") => { - Ok(LengthOrPercentageOrAuto::Auto) - } + Token::Dimension(ref value, ref unit) if context.is_ok(value.value) => + Length::parse_dimension(value.value, unit).map(LengthOrPercentageOrAuto::Length), + Token::Percentage(ref value) if context.is_ok(value.unit_value) => + Ok(LengthOrPercentageOrAuto::Percentage(value.unit_value)), + Token::Number(ref value) if value.value == 0. => + Ok(LengthOrPercentageOrAuto::Length(Length::Absolute(Au(0)))), + Token::Ident(ref value) if value.eq_ignore_ascii_case("auto") => + Ok(LengthOrPercentageOrAuto::Auto), _ => Err(()) } } #[inline] pub fn parse(input: &mut Parser) -> Result<LengthOrPercentageOrAuto, ()> { - LengthOrPercentageOrAuto::parse_internal(input, /* negative_ok = */ true) + LengthOrPercentageOrAuto::parse_internal(input, &AllowedNumericType::All) } #[inline] pub fn parse_non_negative(input: &mut Parser) -> Result<LengthOrPercentageOrAuto, ()> { - LengthOrPercentageOrAuto::parse_internal(input, /* negative_ok = */ false) + LengthOrPercentageOrAuto::parse_internal(input, &AllowedNumericType::NonNegative) } } - #[derive(Clone, PartialEq, Copy)] + #[derive(Clone, PartialEq, Copy, Debug)] pub enum LengthOrPercentageOrNone { Length(Length), Percentage(CSSFloat), // [0 .. 100%] maps to [0.0 .. 1.0] None, } - impl fmt::Debug for LengthOrPercentageOrNone { - #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) } - } - impl ToCss for LengthOrPercentageOrNone { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match self { &LengthOrPercentageOrNone::Length(length) => length.to_css(dest), - &LengthOrPercentageOrNone::Percentage(percentage) - => write!(dest, "{}%", percentage * 100.), + &LengthOrPercentageOrNone::Percentage(percentage) => + write!(dest, "{}%", percentage * 100.), &LengthOrPercentageOrNone::None => dest.write_str("none"), } } } impl LengthOrPercentageOrNone { - fn parse_internal(input: &mut Parser, negative_ok: bool) - -> Result<LengthOrPercentageOrNone, ()> { + fn parse_internal(input: &mut Parser, context: &AllowedNumericType) + -> Result<LengthOrPercentageOrNone, ()> + { match try!(input.next()) { - Token::Dimension(ref value, ref unit) if negative_ok || value.value >= 0. => { - Length::parse_dimension(value.value, unit) - .map(LengthOrPercentageOrNone::Length) - } - Token::Percentage(ref value) if negative_ok || value.unit_value >= 0. => { - Ok(LengthOrPercentageOrNone::Percentage(value.unit_value)) - } - Token::Number(ref value) if value.value == 0. => { - Ok(LengthOrPercentageOrNone::Length(Length::Absolute(Au(0)))) - } - Token::Ident(ref value) if value.eq_ignore_ascii_case("none") => { - Ok(LengthOrPercentageOrNone::None) - } + Token::Dimension(ref value, ref unit) if context.is_ok(value.value) => + Length::parse_dimension(value.value, unit).map(LengthOrPercentageOrNone::Length), + Token::Percentage(ref value) if context.is_ok(value.unit_value) => + Ok(LengthOrPercentageOrNone::Percentage(value.unit_value)), + Token::Number(ref value) if value.value == 0. => + Ok(LengthOrPercentageOrNone::Length(Length::Absolute(Au(0)))), + Token::Ident(ref value) if value.eq_ignore_ascii_case("none") => + Ok(LengthOrPercentageOrNone::None), _ => Err(()) } } #[allow(dead_code)] #[inline] pub fn parse(input: &mut Parser) -> Result<LengthOrPercentageOrNone, ()> { - LengthOrPercentageOrNone::parse_internal(input, /* negative_ok = */ true) + LengthOrPercentageOrNone::parse_internal(input, &AllowedNumericType::All) } #[inline] pub fn parse_non_negative(input: &mut Parser) -> Result<LengthOrPercentageOrNone, ()> { - LengthOrPercentageOrNone::parse_internal(input, /* negative_ok = */ false) + LengthOrPercentageOrNone::parse_internal(input, &AllowedNumericType::NonNegative) } } @@ -580,7 +537,7 @@ pub mod specified { fn add(self, other: LengthAndPercentage) -> LengthAndPercentage { let mut new_lengths = self.lengths.clone(); - new_lengths.push_all(other.lengths.as_slice()); + new_lengths.push_all(&other.lengths); LengthAndPercentage { lengths: new_lengths, percentage: self.percentage + other.percentage, @@ -650,22 +607,18 @@ pub mod specified { } } - #[derive(Clone, PartialEq, PartialOrd, Copy)] + #[derive(Clone, PartialEq, PartialOrd, Copy, Debug)] pub struct Angle(pub CSSFloat); - impl fmt::Debug for Angle { - #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) } - } - impl ToCss for Angle { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { let Angle(value) = *self; write!(dest, "{}rad", value) } } impl Angle { - pub fn radians(self) -> f64 { + pub fn radians(self) -> f32 { let Angle(radians) = self; radians } @@ -695,18 +648,14 @@ pub mod specified { } /// Specified values for an image according to CSS-IMAGES. - #[derive(Clone, PartialEq)] + #[derive(Clone, PartialEq, Debug)] pub enum Image { Url(Url), LinearGradient(LinearGradient), } - impl fmt::Debug for Image { - #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) } - } - impl ToCss for Image { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match self { &Image::Url(ref url) => { try!(dest.write_str("url(\"")); @@ -740,7 +689,7 @@ pub mod specified { } /// Specified values for a CSS linear gradient. - #[derive(Clone, PartialEq)] + #[derive(Clone, PartialEq, Debug)] pub struct LinearGradient { /// The angle or corner of the gradient. pub angle_or_corner: AngleOrCorner, @@ -749,42 +698,34 @@ pub mod specified { pub stops: Vec<ColorStop>, } - impl fmt::Debug for LinearGradient { - #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) } - } - impl ToCss for LinearGradient { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { try!(dest.write_str("linear-gradient(")); try!(self.angle_or_corner.to_css(dest)); for stop in self.stops.iter() { try!(dest.write_str(", ")); try!(stop.to_css(dest)); } - try!(dest.write_char(')')); + try!(dest.write_str(")")); Ok(()) } } /// Specified values for an angle or a corner in a linear gradient. - #[derive(Clone, PartialEq, Copy)] + #[derive(Clone, PartialEq, Copy, Debug)] pub enum AngleOrCorner { Angle(Angle), Corner(HorizontalDirection, VerticalDirection), } - impl fmt::Debug for AngleOrCorner { - #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) } - } - impl ToCss for AngleOrCorner { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match self { &AngleOrCorner::Angle(angle) => angle.to_css(dest), &AngleOrCorner::Corner(horizontal, vertical) => { try!(dest.write_str("to ")); try!(horizontal.to_css(dest)); - try!(dest.write_char(' ')); + try!(dest.write_str(" ")); try!(vertical.to_css(dest)); Ok(()) } @@ -793,7 +734,7 @@ pub mod specified { } /// Specified values for one color stop in a linear gradient. - #[derive(Clone, PartialEq)] + #[derive(Clone, PartialEq, Debug)] pub struct ColorStop { /// The color of this stop. pub color: CSSColor, @@ -803,15 +744,11 @@ pub mod specified { pub position: Option<LengthOrPercentage>, } - impl fmt::Debug for ColorStop { - #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) } - } - impl ToCss for ColorStop { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { try!(self.color.to_css(dest)); if let Some(position) = self.position { - try!(dest.write_char(' ')); + try!(dest.write_str(" ")); try!(position.to_css(dest)); } Ok(()) @@ -909,7 +846,7 @@ pub mod specified { impl Time { /// Returns the time in fractional seconds. - pub fn seconds(self) -> f64 { + pub fn seconds(self) -> f32 { let Time(seconds) = self; seconds } @@ -945,8 +882,8 @@ pub mod specified { } impl ToCss for Time { - fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter { - dest.write_str(format!("{}ms", self.0).as_slice()) + fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { + write!(dest, "{}ms", self.0) } } } @@ -959,7 +896,6 @@ pub mod computed { use geom::size::Size2D; use properties::longhands; use std::fmt; - use std::marker::MarkerTrait; use std::ops::{Add, Mul}; use url::Url; use util::geometry::Au; @@ -995,7 +931,7 @@ pub mod computed { fn to_computed_value(&self, _context: &Context) -> Self::ComputedValue; } - pub trait ComputedValueAsSpecified: MarkerTrait {} + pub trait ComputedValueAsSpecified {} impl<T> ToComputedValue for T where T: ComputedValueAsSpecified + Clone { type ComputedValue = T; @@ -1184,7 +1120,7 @@ pub mod computed { fn mul(self, scalar: CSSFloat) -> LengthAndPercentage { LengthAndPercentage { - length: Au::from_frac_px(self.length.to_subpx() * scalar), + length: Au::from_f32_px(self.length.to_f32_px() * scalar), percentage: self.percentage * scalar, } } diff --git a/components/style/viewport.rs b/components/style/viewport.rs new file mode 100644 index 00000000000..9115b9a8b26 --- /dev/null +++ b/components/style/viewport.rs @@ -0,0 +1,509 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use cssparser::{Parser, DeclarationListParser, AtRuleParser, DeclarationParser, ToCss, parse_important}; +use geom::size::{Size2D, TypedSize2D}; +use geom::scale_factor::ScaleFactor; +use parser::{ParserContext, log_css_error}; +use properties::longhands; +use stylesheets::Origin; +use util::geometry::{Au, PagePx, ViewportPx}; +use values::specified::{AllowedNumericType, Length, LengthOrPercentageOrAuto}; + +use std::ascii::AsciiExt; +use std::collections::hash_map::{Entry, HashMap}; +use std::fmt; +use std::intrinsics; + +#[derive(Copy, Clone, Debug, PartialEq)] +pub enum ViewportDescriptor { + MinWidth(LengthOrPercentageOrAuto), + MaxWidth(LengthOrPercentageOrAuto), + + MinHeight(LengthOrPercentageOrAuto), + MaxHeight(LengthOrPercentageOrAuto), + + Zoom(Zoom), + MinZoom(Zoom), + MaxZoom(Zoom), + + UserZoom(UserZoom), + Orientation(Orientation) +} + +/// Zoom is a number | percentage | auto +/// See http://dev.w3.org/csswg/css-device-adapt/#descdef-viewport-zoom +#[derive(Copy, Clone, Debug, PartialEq)] +pub enum Zoom { + Number(f32), + Percentage(f32), + Auto, +} + +impl ToCss for Zoom { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result + where W: fmt::Write + { + match self { + &Zoom::Number(number) => write!(dest, "{}", number), + &Zoom::Percentage(percentage) => write!(dest, "{}%", percentage * 100.), + &Zoom::Auto => write!(dest, "auto") + } + } +} + +impl Zoom { + pub fn parse(input: &mut Parser) -> Result<Zoom, ()> { + use cssparser::Token; + + match try!(input.next()) { + Token::Percentage(ref value) if AllowedNumericType::NonNegative.is_ok(value.unit_value) => + Ok(Zoom::Percentage(value.unit_value)), + Token::Number(ref value) if AllowedNumericType::NonNegative.is_ok(value.value) => + Ok(Zoom::Number(value.value)), + Token::Ident(ref value) if value.eq_ignore_ascii_case("auto") => + Ok(Zoom::Auto), + _ => Err(()) + } + } + + #[inline] + pub fn to_f32(&self) -> Option<f32> { + match self { + &Zoom::Number(number) => Some(number as f32), + &Zoom::Percentage(percentage) => Some(percentage as f32), + &Zoom::Auto => None + } + } +} + +define_css_keyword_enum!(UserZoom: + "zoom" => Zoom, + "fixed" => Fixed); + +define_css_keyword_enum!(Orientation: + "auto" => Auto, + "portrait" => Portrait, + "landscape" => Landscape); + +struct ViewportRuleParser<'a, 'b: 'a> { + context: &'a ParserContext<'b> +} + +#[derive(Copy, Clone, Debug, PartialEq)] +pub struct ViewportDescriptorDeclaration { + pub origin: Origin, + pub descriptor: ViewportDescriptor, + pub important: bool +} + +impl ViewportDescriptorDeclaration { + pub fn new(origin: Origin, + descriptor: ViewportDescriptor, + important: bool) -> ViewportDescriptorDeclaration + { + ViewportDescriptorDeclaration { + origin: origin, + descriptor: descriptor, + important: important + } + } +} + +fn parse_shorthand(input: &mut Parser) -> Result<[LengthOrPercentageOrAuto; 2], ()> { + let min = try!(LengthOrPercentageOrAuto::parse_non_negative(input)); + match input.try(|input| LengthOrPercentageOrAuto::parse_non_negative(input)) { + Err(()) => Ok([min.clone(), min]), + Ok(max) => Ok([min, max]) + } +} + +impl<'a, 'b> AtRuleParser for ViewportRuleParser<'a, 'b> { + type Prelude = (); + type AtRule = Vec<ViewportDescriptorDeclaration>; +} + +impl<'a, 'b> DeclarationParser for ViewportRuleParser<'a, 'b> { + type Declaration = Vec<ViewportDescriptorDeclaration>; + + fn parse_value(&self, name: &str, input: &mut Parser) -> Result<Vec<ViewportDescriptorDeclaration>, ()> { + macro_rules! declaration { + ($declaration:ident($parse:path)) => { + declaration!($declaration(value: try!($parse(input)), + important: input.try(parse_important).is_ok())) + }; + ($declaration:ident(value: $value:expr, important: $important:expr)) => { + ViewportDescriptorDeclaration::new( + self.context.stylesheet_origin, + ViewportDescriptor::$declaration($value), + $important) + } + } + + macro_rules! ok { + ($declaration:ident($parse:path)) => { + Ok(vec![declaration!($declaration($parse))]) + }; + (shorthand -> [$min:ident, $max:ident]) => {{ + let shorthand = try!(parse_shorthand(input)); + let important = input.try(parse_important).is_ok(); + + Ok(vec![declaration!($min(value: shorthand[0], important: important)), + declaration!($max(value: shorthand[1], important: important))]) + }} + } + + match name { + n if n.eq_ignore_ascii_case("min-width") => + ok!(MinWidth(LengthOrPercentageOrAuto::parse_non_negative)), + n if n.eq_ignore_ascii_case("max-width") => + ok!(MaxWidth(LengthOrPercentageOrAuto::parse_non_negative)), + n if n.eq_ignore_ascii_case("width") => + ok!(shorthand -> [MinWidth, MaxWidth]), + + n if n.eq_ignore_ascii_case("min-height") => + ok!(MinHeight(LengthOrPercentageOrAuto::parse_non_negative)), + n if n.eq_ignore_ascii_case("max-height") => + ok!(MaxHeight(LengthOrPercentageOrAuto::parse_non_negative)), + n if n.eq_ignore_ascii_case("height") => + ok!(shorthand -> [MinHeight, MaxHeight]), + + n if n.eq_ignore_ascii_case("zoom") => + ok!(Zoom(Zoom::parse)), + n if n.eq_ignore_ascii_case("min-zoom") => + ok!(MinZoom(Zoom::parse)), + n if n.eq_ignore_ascii_case("max-zoom") => + ok!(MaxZoom(Zoom::parse)), + + n if n.eq_ignore_ascii_case("user-zoom") => + ok!(UserZoom(UserZoom::parse)), + n if n.eq_ignore_ascii_case("orientation") => + ok!(Orientation(Orientation::parse)), + + _ => Err(()), + } + } +} + +#[derive(Debug, PartialEq)] +pub struct ViewportRule { + pub declarations: Vec<ViewportDescriptorDeclaration> +} + +impl ViewportRule { + pub fn parse<'a>(input: &mut Parser, context: &'a ParserContext) + -> Result<ViewportRule, ()> + { + let parser = ViewportRuleParser { context: context }; + + let mut errors = vec![]; + let valid_declarations = DeclarationListParser::new(input, parser) + .filter_map(|result| { + match result { + Ok(declarations) => Some(declarations), + Err(range) => { + errors.push(range); + None + } + } + }) + .flat_map(|declarations| declarations.into_iter()) + .collect::<Vec<_>>(); + + for range in errors { + let pos = range.start; + let message = format!("Unsupported @viewport descriptor declaration: '{}'", + input.slice(range)); + log_css_error(input, pos, &*message); + } + + Ok(ViewportRule { declarations: valid_declarations.iter().cascade() }) + } +} + +pub trait ViewportRuleCascade: Iterator + Sized { + fn cascade(self) -> ViewportRule; +} + +impl<'a, I> ViewportRuleCascade for I + where I: Iterator<Item=&'a ViewportRule> +{ + #[inline] + fn cascade(self) -> ViewportRule { + ViewportRule { + declarations: self.flat_map(|r| r.declarations.iter()).cascade() + } + } +} + +trait ViewportDescriptorDeclarationCascade: Iterator + Sized { + fn cascade(self) -> Vec<ViewportDescriptorDeclaration>; +} + +/// Computes the cascade precedence as according to +/// http://dev.w3.org/csswg/css-cascade/#cascade-origin +fn cascade_precendence(origin: Origin, important: bool) -> u8 { + match (origin, important) { + (Origin::UserAgent, true) => 1, + (Origin::User, true) => 2, + (Origin::Author, true) => 3, + (Origin::Author, false) => 4, + (Origin::User, false) => 5, + (Origin::UserAgent, false) => 6, + } +} + +impl ViewportDescriptorDeclaration { + fn higher_or_equal_precendence(&self, other: &ViewportDescriptorDeclaration) -> bool { + let self_precedence = cascade_precendence(self.origin, self.important); + let other_precedence = cascade_precendence(other.origin, other.important); + + self_precedence <= other_precedence + } +} + +fn cascade<'a, I>(iter: I) -> Vec<ViewportDescriptorDeclaration> + where I: Iterator<Item=&'a ViewportDescriptorDeclaration> +{ + let mut declarations: HashMap<u64, (usize, &'a ViewportDescriptorDeclaration)> = HashMap::new(); + + // index is used to reconstruct order of appearance after all declarations + // have been added to the map + let mut index = 0; + for declaration in iter { + let descriptor = unsafe { + intrinsics::discriminant_value(&declaration.descriptor) + }; + + match declarations.entry(descriptor) { + Entry::Occupied(mut entry) => { + if declaration.higher_or_equal_precendence(entry.get().1) { + entry.insert((index, declaration)); + index += 1; + } + } + Entry::Vacant(entry) => { + entry.insert((index, declaration)); + index += 1; + } + } + } + + // convert to a list and sort the descriptors by order of appearance + let mut declarations: Vec<_> = declarations.into_iter().map(|kv| kv.1).collect(); + declarations.sort_by(|a, b| a.0.cmp(&b.0)); + declarations.into_iter().map(|id| *id.1).collect::<Vec<_>>() +} + +impl<'a, I> ViewportDescriptorDeclarationCascade for I + where I: Iterator<Item=&'a ViewportDescriptorDeclaration> +{ + #[inline] + fn cascade(self) -> Vec<ViewportDescriptorDeclaration> { + cascade(self) + } +} + +#[derive(Debug, PartialEq)] +pub struct ViewportConstraints { + pub size: TypedSize2D<ViewportPx, f32>, + + pub initial_zoom: ScaleFactor<PagePx, ViewportPx, f32>, + pub min_zoom: Option<ScaleFactor<PagePx, ViewportPx, f32>>, + pub max_zoom: Option<ScaleFactor<PagePx, ViewportPx, f32>>, + + pub user_zoom: UserZoom, + pub orientation: Orientation +} + +impl ToCss for ViewportConstraints { + fn to_css<W>(&self, dest: &mut W) -> fmt::Result + where W: fmt::Write + { + try!(write!(dest, "@viewport {{")); + try!(write!(dest, " width: {}px;", self.size.width.get())); + try!(write!(dest, " height: {}px;", self.size.height.get())); + try!(write!(dest, " zoom: {};", self.initial_zoom.get())); + if let Some(min_zoom) = self.min_zoom { + try!(write!(dest, " min-zoom: {};", min_zoom.get())); + } + if let Some(max_zoom) = self.max_zoom { + try!(write!(dest, " max-zoom: {};", max_zoom.get())); + } + try!(write!(dest, " user-zoom: ")); try!(self.user_zoom.to_css(dest)); + try!(write!(dest, "; orientation: ")); try!(self.orientation.to_css(dest)); + write!(dest, "; }}") + } +} + +impl ViewportConstraints { + pub fn maybe_new(initial_viewport: TypedSize2D<ViewportPx, f32>, + rule: &ViewportRule) + -> Option<ViewportConstraints> + { + use std::cmp; + use num::{Float, ToPrimitive}; + + if rule.declarations.is_empty() { + return None + } + + let mut min_width = None; + let mut max_width = None; + + let mut min_height = None; + let mut max_height = None; + + let mut initial_zoom = None; + let mut min_zoom = None; + let mut max_zoom = None; + + let mut user_zoom = UserZoom::Zoom; + let mut orientation = Orientation::Auto; + + // collapse the list of declarations into descriptor values + for declaration in rule.declarations.iter() { + match declaration.descriptor { + ViewportDescriptor::MinWidth(value) => min_width = Some(value), + ViewportDescriptor::MaxWidth(value) => max_width = Some(value), + + ViewportDescriptor::MinHeight(value) => min_height = Some(value), + ViewportDescriptor::MaxHeight(value) => max_height = Some(value), + + ViewportDescriptor::Zoom(value) => initial_zoom = value.to_f32(), + ViewportDescriptor::MinZoom(value) => min_zoom = value.to_f32(), + ViewportDescriptor::MaxZoom(value) => max_zoom = value.to_f32(), + + ViewportDescriptor::UserZoom(value) => user_zoom = value, + ViewportDescriptor::Orientation(value) => orientation = value + } + } + + // TODO: return `None` if all descriptors are either absent or initial value + + macro_rules! choose { + ($op:ident, $opta:expr, $optb:expr) => { + match ($opta, $optb) { + (None, None) => None, + (a, None) => a.clone(), + (None, b) => b.clone(), + (a, b) => Some(a.clone().unwrap().$op(b.clone().unwrap())), + } + } + } + macro_rules! min { + ($opta:expr, $optb:expr) => { + choose!(min, $opta, $optb) + } + } + macro_rules! max { + ($opta:expr, $optb:expr) => { + choose!(max, $opta, $optb) + } + } + + // DEVICE-ADAPT § 6.2.1 Resolve min-zoom and max-zoom values + if min_zoom.is_some() && max_zoom.is_some() { + max_zoom = Some(min_zoom.clone().unwrap().max(max_zoom.unwrap())) + } + + // DEVICE-ADAPT § 6.2.2 Constrain zoom value to the [min-zoom, max-zoom] range + if initial_zoom.is_some() { + initial_zoom = max!(min_zoom, min!(max_zoom, initial_zoom)); + } + + // DEVICE-ADAPT § 6.2.3 Resolve non-auto lengths to pixel lengths + // + // Note: DEVICE-ADAPT § 5. states that relative length values are + // resolved against initial values + let initial_viewport = Size2D(Au::from_f32_px(initial_viewport.width.get()), + Au::from_f32_px(initial_viewport.height.get())); + + macro_rules! to_pixel_length { + ($value:ident, $dimension:ident) => { + if let Some($value) = $value { + match $value { + LengthOrPercentageOrAuto::Length(ref value) => Some(match value { + &Length::Absolute(length) => length, + &Length::FontRelative(length) => { + let initial_font_size = longhands::font_size::get_initial_value(); + length.to_computed_value(initial_font_size, initial_font_size) + } + &Length::ViewportPercentage(length) => + length.to_computed_value(initial_viewport), + _ => unreachable!() + }), + LengthOrPercentageOrAuto::Percentage(value) => Some(initial_viewport.$dimension.scale_by(value)), + LengthOrPercentageOrAuto::Auto => None, + } + } else { + None + } + } + } + + let min_width = to_pixel_length!(min_width, width); + let max_width = to_pixel_length!(max_width, width); + let min_height = to_pixel_length!(min_height, height); + let max_height = to_pixel_length!(max_height, height); + + // DEVICE-ADAPT § 6.2.4 Resolve initial width and height from min/max descriptors + macro_rules! resolve { + ($min:ident, $max:ident, $initial:expr) => { + if $min.is_some() || $max.is_some() { + let max = match $max { + Some(max) => cmp::min(max, $initial), + None => $initial + }; + + Some(match $min { + Some(min) => cmp::max(min, max), + None => max + }) + } else { + None + }; + } + } + + let width = resolve!(min_width, max_width, initial_viewport.width); + let height = resolve!(min_height, max_height, initial_viewport.height); + + // DEVICE-ADAPT § 6.2.5 Resolve width value + let width = if width.is_none() && height.is_none() { + Some(initial_viewport.width) + } else { + width + }; + + let width = width.unwrap_or_else(|| match initial_viewport.height { + Au(0) => initial_viewport.width, + initial_height => { + let ratio = initial_viewport.width.to_f32_px() / initial_height.to_f32_px(); + Au::from_f32_px(height.clone().unwrap().to_f32_px() * ratio) + } + }); + + // DEVICE-ADAPT § 6.2.6 Resolve height value + let height = height.unwrap_or_else(|| match initial_viewport.width { + Au(0) => initial_viewport.height, + initial_width => { + let ratio = initial_viewport.height.to_f32_px() / initial_width.to_f32_px(); + Au::from_f32_px(width.to_f32_px() * ratio) + } + }); + + Some(ViewportConstraints { + size: TypedSize2D(width.to_f32_px(), height.to_f32_px()), + + // TODO: compute a zoom factor for 'auto' as suggested by DEVICE-ADAPT § 10. + initial_zoom: ScaleFactor::new(initial_zoom.unwrap_or(1.)), + min_zoom: min_zoom.map(ScaleFactor::new), + max_zoom: max_zoom.map(ScaleFactor::new), + + user_zoom: user_zoom, + orientation: orientation + }) + } +} diff --git a/components/util/Cargo.toml b/components/util/Cargo.toml index 706ca02e9b6..dadc3872d8e 100644 --- a/components/util/Cargo.toml +++ b/components/util/Cargo.toml @@ -18,9 +18,6 @@ doctest = false [dependencies.plugins] path = "../plugins" -[dependencies.cssparser] -git = "https://github.com/servo/rust-cssparser" - [dependencies.selectors] git = "https://github.com/servo/rust-selectors" @@ -39,13 +36,15 @@ git = "https://github.com/servo/string-cache" [dependencies.string_cache_plugin] git = "https://github.com/servo/string-cache" -[dependencies.lazy_static] -git = "https://github.com/Kimundi/lazy-static.rs" - [dependencies] bitflags = "*" libc = "*" rand = "*" rustc-serialize = "0.3" -text_writer = "0.1.1" time = "0.1.12" +smallvec = "0.1" +num_cpus = "0.2.2" +fnv = "1.0" +cssparser = "0.3.1" +num = "0.1.24" +lazy_static = "0.1.10" diff --git a/components/util/bezier.rs b/components/util/bezier.rs index 768293b3421..28251745cbc 100644 --- a/components/util/bezier.rs +++ b/components/util/bezier.rs @@ -7,22 +7,21 @@ //! This is based on `WebCore/platform/graphics/UnitBezier.h` in WebKit. use geom::point::Point2D; -use std::num::Float; const NEWTON_METHOD_ITERATIONS: u8 = 8; pub struct Bezier { - ax: f64, - bx: f64, - cx: f64, - ay: f64, - by: f64, - cy: f64, + ax: f32, + bx: f32, + cx: f32, + ay: f32, + by: f32, + cy: f32, } impl Bezier { #[inline] - pub fn new(p1: Point2D<f64>, p2: Point2D<f64>) -> Bezier { + pub fn new(p1: Point2D<f32>, p2: Point2D<f32>) -> Bezier { let cx = 3.0 * p1.x; let bx = 3.0 * (p2.x - p1.x) - cx; @@ -40,23 +39,23 @@ impl Bezier { } #[inline] - fn sample_curve_x(&self, t: f64) -> f64 { + fn sample_curve_x(&self, t: f32) -> f32 { // ax * t^3 + bx * t^2 + cx * t ((self.ax * t + self.bx) * t + self.cx) * t } #[inline] - fn sample_curve_y(&self, t: f64) -> f64 { + fn sample_curve_y(&self, t: f32) -> f32 { ((self.ay * t + self.by) * t + self.cy) * t } #[inline] - fn sample_curve_derivative_x(&self, t: f64) -> f64 { + fn sample_curve_derivative_x(&self, t: f32) -> f32 { (3.0 * self.ax * t + 2.0 * self.bx) * t + self.cx } #[inline] - fn solve_curve_x(&self, x: f64, epsilon: f64) -> f64 { + fn solve_curve_x(&self, x: f32, epsilon: f32) -> f32 { // Fast path: Use Newton's method. let mut t = x; for _ in 0..NEWTON_METHOD_ITERATIONS { @@ -98,7 +97,7 @@ impl Bezier { } #[inline] - pub fn solve(&self, x: f64, epsilon: f64) -> f64 { + pub fn solve(&self, x: f32, epsilon: f32) -> f32 { self.sample_curve_y(self.solve_curve_x(x, epsilon)) } } @@ -107,9 +106,9 @@ trait ApproxEq { fn approx_eq(self, value: Self, epsilon: Self) -> bool; } -impl ApproxEq for f64 { +impl ApproxEq for f32 { #[inline] - fn approx_eq(self, value: f64, epsilon: f64) -> bool { + fn approx_eq(self, value: f32, epsilon: f32) -> bool { (self - value).abs() < epsilon } } diff --git a/components/util/cursor.rs b/components/util/cursor.rs index 4c6b61b38fe..622845deaa7 100644 --- a/components/util/cursor.rs +++ b/components/util/cursor.rs @@ -6,11 +6,10 @@ use cssparser::ToCss; use std::ascii::AsciiExt; -use text_writer::TextWriter; macro_rules! define_cursor { ($( $css: expr => $variant: ident = $value: expr, )+) => { - #[derive(Clone, Copy, PartialEq, Eq, FromPrimitive, Debug)] + #[derive(Clone, Copy, PartialEq, Eq, Debug)] #[repr(u8)] pub enum Cursor { $( $variant = $value ),+ @@ -26,7 +25,7 @@ macro_rules! define_cursor { } impl ToCss for Cursor { - fn to_css<W>(&self, dest: &mut W) -> ::text_writer::Result where W: TextWriter { + fn to_css<W>(&self, dest: &mut W) -> ::std::fmt::Result where W: ::std::fmt::Write { match self { $( &Cursor::$variant => dest.write_str($css) ),+ } diff --git a/components/util/deque/mod.rs b/components/util/deque/mod.rs index 1eb3f744c95..fc79d9f76ee 100644 --- a/components/util/deque/mod.rs +++ b/components/util/deque/mod.rs @@ -170,7 +170,9 @@ impl<T: Send + 'static> BufferPool<T> { } } } +} +impl<T> BufferPool<T> { fn free(&self, buf: Box<Buffer<T>>) { let mut pool = self.pool.lock().unwrap(); match pool.iter().position(|v| v.size() > buf.size()) { @@ -331,8 +333,7 @@ impl<T: Send + 'static> Deque<T> { } -#[unsafe_destructor] -impl<T: Send + 'static> Drop for Deque<T> { +impl<T> Drop for Deque<T> { fn drop(&mut self) { let t = self.top.load(SeqCst); let b = self.bottom.load(SeqCst); @@ -351,7 +352,7 @@ fn buffer_alloc_size<T>(log_size: usize) -> usize { (1 << log_size) * size_of::<T>() } -impl<T: Send> Buffer<T> { +impl<T> Buffer<T> { unsafe fn new(log_size: usize) -> Buffer<T> { let size = buffer_alloc_size::<T>(log_size); let buffer = allocate(size, min_align_of::<T>()); @@ -399,8 +400,7 @@ impl<T: Send> Buffer<T> { } } -#[unsafe_destructor] -impl<T: Send> Drop for Buffer<T> { +impl<T> Drop for Buffer<T> { fn drop(&mut self) { // It is assumed that all buffers are empty on drop. let size = buffer_alloc_size::<T>(self.log_size); diff --git a/components/util/geometry.rs b/components/util/geometry.rs index c32a0264665..ae149c5162e 100644 --- a/components/util/geometry.rs +++ b/components/util/geometry.rs @@ -10,7 +10,6 @@ use geom::num::Zero; use std::default::Default; use std::i32; -use std::num::{Float, NumCast, ToPrimitive}; use std::fmt; use std::ops::{Add, Sub, Neg, Mul, Div, Rem}; @@ -116,13 +115,13 @@ pub const MAX_AU: Au = Au(i32::MAX); impl Encodable for Au { fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> { - e.emit_f64(to_frac_px(*self)) + e.emit_f64(self.to_f64_px()) } } impl fmt::Debug for Au { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}px", to_frac_px(*self)) + write!(f, "{}px", self.to_f64_px()) }} impl Add for Au { @@ -130,9 +129,7 @@ impl Add for Au { #[inline] fn add(self, other: Au) -> Au { - let Au(s) = self; - let Au(o) = other; - Au(s.wrapping_add(o)) + Au(self.0.wrapping_add(other.0)) } } @@ -141,9 +138,7 @@ impl Sub for Au { #[inline] fn sub(self, other: Au) -> Au { - let Au(s) = self; - let Au(o) = other; - Au(s.wrapping_sub(o)) + Au(self.0.wrapping_sub(other.0)) } } @@ -153,8 +148,7 @@ impl Mul<i32> for Au { #[inline] fn mul(self, other: i32) -> Au { - let Au(s) = self; - Au(s.wrapping_mul(other)) + Au(self.0.wrapping_mul(other)) } } @@ -163,8 +157,7 @@ impl Div<i32> for Au { #[inline] fn div(self, other: i32) -> Au { - let Au(s) = self; - Au(s / other) + Au(self.0 / other) } } @@ -173,8 +166,7 @@ impl Rem<i32> for Au { #[inline] fn rem(self, other: i32) -> Au { - let Au(s) = self; - Au(s % other) + Au(self.0 % other) } } @@ -183,42 +175,7 @@ impl Neg for Au { #[inline] fn neg(self) -> Au { - let Au(s) = self; - Au(-s) - } -} - - -impl NumCast for Au { - #[inline] - fn from<T:ToPrimitive>(n: T) -> Option<Au> { - Some(Au(n.to_i32().unwrap())) - } -} - -impl ToPrimitive for Au { - #[inline] - fn to_i64(&self) -> Option<i64> { - let Au(s) = *self; - Some(s as i64) - } - - #[inline] - fn to_u64(&self) -> Option<u64> { - let Au(s) = *self; - Some(s as u64) - } - - #[inline] - fn to_f32(&self) -> Option<f32> { - let Au(s) = *self; - s.to_f32() - } - - #[inline] - fn to_f64(&self) -> Option<f64> { - let Au(s) = *self; - s.to_f64() + Au(-self.0) } } @@ -230,128 +187,84 @@ impl Au { } #[inline] - pub fn scale_by(self, factor: f64) -> Au { - let Au(s) = self; - Au(((s as f64) * factor) as i32) + pub fn scale_by(self, factor: f32) -> Au { + Au(((self.0 as f32) * factor) as i32) } #[inline] - pub fn from_px(px: isize) -> Au { - NumCast::from(px * 60).unwrap() + pub fn from_px(px: i32) -> Au { + Au((px * 60) as i32) } #[inline] pub fn from_page_px(px: Length<PagePx, f32>) -> Au { - NumCast::from(px.get() * 60f32).unwrap() + Au((px.get() * 60f32) as i32) + } + + /// Rounds this app unit down to the pixel towards zero and returns it. + #[inline] + pub fn to_px(self) -> i32 { + self.0 / 60 } /// Rounds this app unit down to the previous (left or top) pixel and returns it. #[inline] - pub fn to_prev_px(&self) -> isize { - let Au(s) = *self; - ((s as f64) / 60f64).floor() as isize + pub fn to_prev_px(self) -> i32 { + ((self.0 as f64) / 60f64).floor() as i32 } /// Rounds this app unit up to the next (right or bottom) pixel and returns it. #[inline] - pub fn to_next_px(&self) -> isize { - let Au(s) = *self; - ((s as f64) / 60f64).ceil() as isize + pub fn to_next_px(self) -> i32 { + ((self.0 as f64) / 60f64).ceil() as i32 } #[inline] - pub fn to_nearest_px(&self) -> isize { - let Au(s) = *self; - ((s as f64) / 60f64).round() as isize + pub fn to_nearest_px(self) -> i32 { + ((self.0 as f64) / 60f64).round() as i32 } #[inline] - pub fn to_frac32_px(&self) -> f32 { - let Au(s) = *self; - (s as f32) / 60f32 + pub fn to_f32_px(self) -> f32 { + (self.0 as f32) / 60f32 } #[inline] - pub fn to_subpx(&self) -> f64 { - let Au(s) = *self; - (s as f64) / 60f64 + pub fn to_f64_px(self) -> f64 { + (self.0 as f64) / 60f64 } #[inline] - pub fn to_snapped(&self) -> Au { - let Au(s) = *self; - let res = s % 60i32; - return if res >= 30i32 { return Au(s - res + 60i32) } - else { return Au(s - res) }; + pub fn to_snapped(self) -> Au { + let res = self.0 % 60i32; + return if res >= 30i32 { return Au(self.0 - res + 60i32) } + else { return Au(self.0 - res) }; } #[inline] - pub fn from_frac32_px(px: f32) -> Au { + pub fn from_f32_px(px: f32) -> Au { Au((px * 60f32) as i32) } #[inline] pub fn from_pt(pt: f64) -> Au { - from_frac_px(pt_to_px(pt)) + Au::from_f64_px(pt_to_px(pt)) } #[inline] - pub fn from_frac_px(px: f64) -> Au { - Au((px * 60f64) as i32) - } - - #[inline] - pub fn min(x: Au, y: Au) -> Au { - let Au(xi) = x; - let Au(yi) = y; - if xi < yi { x } else { y } - } - - #[inline] - pub fn max(x: Au, y: Au) -> Au { - let Au(xi) = x; - let Au(yi) = y; - if xi > yi { x } else { y } + pub fn from_f64_px(px: f64) -> Au { + Au((px * 60.) as i32) } } // assumes 72 points per inch, and 96 px per inch pub fn pt_to_px(pt: f64) -> f64 { - pt / 72f64 * 96f64 + pt / 72. * 96. } // assumes 72 points per inch, and 96 px per inch pub fn px_to_pt(px: f64) -> f64 { - px / 96f64 * 72f64 -} - -pub fn from_frac_px(px: f64) -> Au { - Au((px * 60f64) as i32) -} - -pub fn from_px(px: isize) -> Au { - NumCast::from(px * 60).unwrap() -} - -pub fn to_px(au: Au) -> isize { - let Au(a) = au; - (a / 60) as isize -} - -pub fn to_frac_px(au: Au) -> f64 { - let Au(a) = au; - (a as f64) / 60f64 -} - -// assumes 72 points per inch, and 96 px per inch -pub fn from_pt(pt: f64) -> Au { - from_px((pt / 72f64 * 96f64) as isize) -} - -// assumes 72 points per inch, and 96 px per inch -pub fn to_pt(au: Au) -> f64 { - let Au(a) = au; - (a as f64) / 60f64 * 72f64 / 96f64 + px / 96. * 72. } /// Returns true if the rect contains the given point. Points on the top or left sides of the rect @@ -364,7 +277,7 @@ pub fn rect_contains_point<T:PartialOrd + Add<T, Output=T>>(rect: Rect<T>, point /// A helper function to convert a rect of `f32` pixels to a rect of app units. pub fn f32_rect_to_au_rect(rect: Rect<f32>) -> Rect<Au> { - Rect(Point2D(Au::from_frac32_px(rect.origin.x), Au::from_frac32_px(rect.origin.y)), - Size2D(Au::from_frac32_px(rect.size.width), Au::from_frac32_px(rect.size.height))) + Rect(Point2D(Au::from_f32_px(rect.origin.x), Au::from_f32_px(rect.origin.y)), + Size2D(Au::from_f32_px(rect.size.width), Au::from_f32_px(rect.size.height))) } diff --git a/components/util/lib.rs b/components/util/lib.rs index 28efc0e58e1..021499c3adc 100644 --- a/components/util/lib.rs +++ b/components/util/lib.rs @@ -7,16 +7,14 @@ #![feature(collections)] #![feature(core)] #![feature(exit_status)] -#![feature(hash)] -#![feature(io)] #![feature(optin_builtin_traits)] -#![feature(path)] #![cfg_attr(not(target_os = "android"), feature(path_ext))] #![feature(plugin)] #![feature(rustc_private)] +#![feature(step_by)] +#![feature(step_trait)] #![feature(std_misc)] -#![feature(unicode)] -#![feature(unsafe_destructor)] +#![feature(zero_one)] #![plugin(string_cache_plugin)] @@ -25,29 +23,31 @@ extern crate azure; extern crate alloc; #[macro_use] extern crate bitflags; -extern crate cssparser; +#[macro_use] extern crate cssparser; +extern crate fnv as fnv_; extern crate geom; extern crate getopts; extern crate layers; extern crate libc; -#[no_link] #[macro_use] extern crate cssparser; +extern crate num as num_lib; +extern crate num_cpus; extern crate rand; -extern crate "rustc-serialize" as rustc_serialize; -extern crate text_writer; +extern crate rustc_serialize; extern crate selectors; +extern crate smallvec as smallvec_; extern crate string_cache; -pub use selectors::smallvec; - use std::sync::Arc; +pub use fnv_ as fnv; +pub use smallvec_ as smallvec; + pub mod bezier; pub mod cache; pub mod cursor; pub mod debug_utils; pub mod deque; pub mod linked_list; -pub mod fnv; pub mod geometry; pub mod logical_geometry; pub mod mem; diff --git a/components/util/mem.rs b/components/util/mem.rs index ad7cf6108a2..cd1b9834e48 100644 --- a/components/util/mem.rs +++ b/components/util/mem.rs @@ -154,7 +154,6 @@ unsafe fn linked_list2_check() { // Currently, types that implement the Drop type are larger than those that don't. Because // LinkedList implements Drop, LinkedList2 must also so that linked_list2_check() doesn't fail. -#[unsafe_destructor] impl<T> Drop for LinkedList2<T> { fn drop(&mut self) {} } diff --git a/components/util/opts.rs b/components/util/opts.rs index aaca57729cc..70ca9d4b92b 100644 --- a/components/util/opts.rs +++ b/components/util/opts.rs @@ -11,13 +11,13 @@ use geom::scale_factor::ScaleFactor; use geom::size::TypedSize2D; use layers::geometry::DevicePixel; use getopts; +use num_cpus; use std::collections::HashSet; use std::cmp; use std::env; use std::io::{self, Write}; use std::mem; use std::ptr; -use std::rt; /// Global flags for Servo, currently set on the command line. #[derive(Clone)] @@ -307,7 +307,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool { let mut paint_threads: usize = match opt_match.opt_str("t") { Some(paint_threads_str) => paint_threads_str.parse().unwrap(), - None => cmp::max(rt::default_sched_threads() * 3 / 4, 1), + None => cmp::max(num_cpus::get() * 3 / 4, 1), }; // If only the flag is present, default to a 5 second period for both profilers. @@ -322,7 +322,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool { let mut layout_threads: usize = match opt_match.opt_str("y") { Some(layout_threads_str) => layout_threads_str.parse().unwrap(), - None => cmp::max(rt::default_sched_threads() * 3 / 4, 1), + None => cmp::max(num_cpus::get() * 3 / 4, 1), }; let nonincremental_layout = opt_match.opt_present("i"); diff --git a/components/util/range.rs b/components/util/range.rs index e22fd478320..2c66c24dcd1 100644 --- a/components/util/range.rs +++ b/components/util/range.rs @@ -2,12 +2,38 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use std::cmp::{max, min}; +use num_lib; +use std::cmp::{self, max, min}; use std::fmt; +use std::iter; use std::marker::PhantomData; -use std::num::{self, Int}; +use std::num; use std::ops; +pub trait Int: + Copy + + ops::Add<Self, Output=Self> + + ops::Sub<Self, Output=Self> + + cmp::Ord +{ + fn zero() -> Self; + fn one() -> Self; + fn max_value() -> Self; + fn from_usize(n: usize) -> Option<Self>; +} +impl Int for isize { + fn zero() -> isize { 0 } + fn one() -> isize { 1 } + fn max_value() -> isize { ::std::isize::MAX } + fn from_usize(n: usize) -> Option<isize> { num_lib::NumCast::from(n) } +} +impl Int for usize { + fn zero() -> usize { 0 } + fn one() -> usize { 1 } + fn max_value() -> usize { ::std::usize::MAX } + fn from_usize(n: usize) -> Option<usize> { Some(n) } +} + /// An index type to be used by a `Range` pub trait RangeIndex: Int + fmt::Debug { type Index; @@ -61,32 +87,14 @@ macro_rules! int_range_index { } } - impl ::std::num::Int for $Self_ { - fn zero() -> $Self_ { $Self_(0) } - fn one() -> $Self_ { $Self_(1) } - fn min_value() -> $Self_ { $Self_(::std::num::Int::min_value()) } - fn max_value() -> $Self_ { $Self_(::std::num::Int::max_value()) } - fn count_ones(self) -> u32 { self.get().count_ones() } - fn leading_zeros(self) -> u32 { self.get().leading_zeros() } - fn trailing_zeros(self) -> u32 { self.get().trailing_zeros() } - fn rotate_left(self, n: u32) -> $Self_ { $Self_(self.get().rotate_left(n)) } - fn rotate_right(self, n: u32) -> $Self_ { $Self_(self.get().rotate_right(n)) } - fn swap_bytes(self) -> $Self_ { $Self_(self.get().swap_bytes()) } - fn checked_add(self, other: $Self_) -> Option<$Self_> { - self.get().checked_add(other.get()).map($Self_) - } - fn checked_sub(self, other: $Self_) -> Option<$Self_> { - self.get().checked_sub(other.get()).map($Self_) - } - fn checked_mul(self, other: $Self_) -> Option<$Self_> { - self.get().checked_mul(other.get()).map($Self_) - } - fn checked_div(self, other: $Self_) -> Option<$Self_> { - self.get().checked_div(other.get()).map($Self_) - } + impl $crate::range::Int for $Self_ { + fn zero() -> $Self_ { $Self_($crate::range::Int::zero()) } + fn one() -> $Self_ { $Self_($crate::range::Int::one()) } + fn max_value() -> $Self_ { $Self_($crate::range::Int::max_value()) } + fn from_usize(n: usize) -> Option<$Self_> { $crate::range::Int::from_usize(n).map($Self_) } } - impl Add<$Self_> for $Self_ { + impl ::std::ops::Add<$Self_> for $Self_ { type Output = $Self_; #[inline] @@ -95,7 +103,7 @@ macro_rules! int_range_index { } } - impl Sub<$Self_> for $Self_ { + impl ::std::ops::Sub<$Self_> for $Self_ { type Output = $Self_; #[inline] @@ -104,16 +112,7 @@ macro_rules! int_range_index { } } - impl Mul<$Self_> for $Self_ { - type Output = $Self_; - - #[inline] - fn mul(self, other: $Self_) -> $Self_ { - $Self_(self.get() * other.get()) - } - } - - impl Neg for $Self_ { + impl ::std::ops::Neg for $Self_ { type Output = $Self_; #[inline] @@ -121,105 +120,6 @@ macro_rules! int_range_index { $Self_(-self.get()) } } - - impl ToPrimitive for $Self_ { - fn to_i64(&self) -> Option<i64> { - Some(self.get() as i64) - } - - fn to_u64(&self) -> Option<u64> { - Some(self.get() as u64) - } - } - - impl ::std::num::NumCast for $Self_ { - fn from<T: ToPrimitive>(n: T) -> Option<$Self_> { - n.to_isize().map($Self_) - } - } - - impl Div<$Self_> for $Self_ { - type Output = $Self_; - fn div(self, other: $Self_) -> $Self_ { - $Self_(self.get() / other.get()) - } - } - - impl Rem<$Self_> for $Self_ { - type Output = $Self_; - fn rem(self, other: $Self_) -> $Self_ { - $Self_(self.get() % other.get()) - } - } - - impl Not for $Self_ { - type Output = $Self_; - fn not(self) -> $Self_ { - $Self_(!self.get()) - } - } - - impl BitAnd<$Self_> for $Self_ { - type Output = $Self_; - fn bitand(self, other: $Self_) -> $Self_ { - $Self_(self.get() & other.get()) - } - } - - impl BitOr<$Self_> for $Self_ { - type Output = $Self_; - fn bitor(self, other: $Self_) -> $Self_ { - $Self_(self.get() | other.get()) - } - } - - impl BitXor<$Self_> for $Self_ { - type Output = $Self_; - fn bitxor(self, other: $Self_) -> $Self_ { - $Self_(self.get() ^ other.get()) - } - } - - impl Shl<usize> for $Self_ { - type Output = $Self_; - fn shl(self, n: usize) -> $Self_ { - $Self_(self.get() << n) - } - } - - impl Shr<usize> for $Self_ { - type Output = $Self_; - fn shr(self, n: usize) -> $Self_ { - $Self_(self.get() >> n) - } - } - - impl ::std::num::wrapping::WrappingOps for $Self_ { - fn wrapping_add(self, rhs: $Self_) -> $Self_ { - $Self_(self.get().wrapping_add(rhs.get())) - } - fn wrapping_sub(self, rhs: $Self_) -> $Self_ { - $Self_(self.get().wrapping_sub(rhs.get())) - } - fn wrapping_mul(self, rhs: $Self_) -> $Self_ { - $Self_(self.get().wrapping_mul(rhs.get())) - } - } - - impl ::std::num::wrapping::OverflowingOps for $Self_ { - fn overflowing_add(self, rhs: $Self_) -> ($Self_, bool) { - let (x, b) = self.get().overflowing_add(rhs.get()); - ($Self_(x), b) - } - fn overflowing_sub(self, rhs: $Self_) -> ($Self_, bool) { - let (x, b) = self.get().overflowing_sub(rhs.get()); - ($Self_(x), b) - } - fn overflowing_mul(self, rhs: $Self_) -> ($Self_, bool) { - let (x, b) = self.get().overflowing_mul(rhs.get()); - ($Self_(x), b) - } - } ) } @@ -246,12 +146,13 @@ pub fn each_index<T: Int, I: RangeIndex<Index=T>>(start: I, stop: I) -> EachInde EachIndex { it: start.get()..stop.get(), phantom: PhantomData } } -impl<T: Int, I: RangeIndex<Index=T>> Iterator for EachIndex<T, I> { +impl<T: Int, I: RangeIndex<Index=T>> Iterator for EachIndex<T, I> +where T: Int + num::One + iter::Step, for<'a> &'a T: ops::Add<&'a T, Output = T> { type Item = I; #[inline] fn next(&mut self) -> Option<I> { - self.it.next().map(|i| RangeIndex::new(i)) + self.it.next().map(RangeIndex::new) } #[inline] @@ -407,7 +308,7 @@ impl<T: Int, I: RangeIndex<Index=T>> Range<I> { #[inline] pub fn is_valid_for_string(&self, s: &str) -> bool { let s_len = s.len(); - match num::cast::<usize, T>(s_len) { + match Int::from_usize(s_len) { Some(len) => { let len = RangeIndex::new(len); self.begin() < len diff --git a/components/util/resource_files.rs b/components/util/resource_files.rs index f614673946f..7c61a48f0ba 100644 --- a/components/util/resource_files.rs +++ b/components/util/resource_files.rs @@ -8,7 +8,7 @@ use std::path::PathBuf; #[cfg(target_os = "android")] pub fn resources_dir_path() -> PathBuf { - PathBuf::new("/sdcard/servo/") + PathBuf::from("/sdcard/servo/") } #[cfg(not(target_os = "android"))] @@ -18,7 +18,7 @@ pub fn resources_dir_path() -> PathBuf { use std::fs::PathExt; match opts::get().resources_path { - Some(ref path) => PathBuf::new(path), + Some(ref path) => PathBuf::from(path), None => { // FIXME: Find a way to not rely on the executable being // under `<servo source>/components/servo/target` diff --git a/components/util/str.rs b/components/util/str.rs index 7c36aca7c18..afa4b85c24c 100644 --- a/components/util/str.rs +++ b/components/util/str.rs @@ -7,11 +7,11 @@ use geometry::Au; use cssparser::{self, RGBA, Color}; use libc::c_char; +use num_lib::ToPrimitive; use std::ascii::AsciiExt; use std::borrow::ToOwned; use std::ffi::CStr; use std::iter::Filter; -use std::num::{Int, ToPrimitive}; use std::ops::Deref; use std::str::{from_utf8, FromStr, Split}; @@ -130,7 +130,7 @@ pub fn parse_unsigned_integer<T: Iterator<Item=char>>(input: T) -> Option<u32> { #[derive(Copy, Clone)] pub enum LengthOrPercentageOrAuto { Auto, - Percentage(f64), + Percentage(f32), Length(Au), } @@ -171,9 +171,9 @@ pub fn parse_length(mut value: &str) -> LengthOrPercentageOrAuto { value = &value[..end_index]; if found_percent { - let result: Result<f64, _> = FromStr::from_str(value); + let result: Result<f32, _> = FromStr::from_str(value); match result { - Ok(number) => return LengthOrPercentageOrAuto::Percentage((number as f64) / 100.0), + Ok(number) => return LengthOrPercentageOrAuto::Percentage((number as f32) / 100.0), Err(_) => return LengthOrPercentageOrAuto::Auto, } } @@ -243,7 +243,7 @@ pub fn parse_legacy_color(mut input: &str) -> Result<RGBA,()> { } // Step 9. - if input.char_at(0) == '#' { + if input.as_bytes()[0] == b'#' { input = &input[1..] } @@ -324,7 +324,7 @@ pub struct LowercaseString { impl LowercaseString { pub fn new(s: &str) -> LowercaseString { LowercaseString { - inner: s.chars().map(|c| c.to_lowercase()).collect(), + inner: s.to_lowercase(), } } } diff --git a/components/util/taskpool.rs b/components/util/taskpool.rs index ff70bc4c1c0..064b2c9c07e 100644 --- a/components/util/taskpool.rs +++ b/components/util/taskpool.rs @@ -44,7 +44,7 @@ impl TaskPool { loop { let job = rx.lock().unwrap().recv(); match job { - Ok(job) => job.invoke(()), + Ok(job) => job.call_box(()), Err(..) => break, } } @@ -54,6 +54,6 @@ impl TaskPool { pub fn execute<F>(&self, job: F) where F: FnOnce() + Send + 'static { - self.tx.send(Thunk::new(job)).unwrap(); + self.tx.send(Box::new(job)).unwrap(); } } diff --git a/components/util/vec.rs b/components/util/vec.rs index 238118aac1d..c660d26584a 100644 --- a/components/util/vec.rs +++ b/components/util/vec.rs @@ -2,10 +2,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use selectors::smallvec::VecLike; +use super::smallvec::VecLike; use std::cmp::{PartialOrd, PartialEq, Ordering}; -use std::iter::range_step; +use std::marker::PhantomData; +use std::ops; /// FIXME(pcwalton): Workaround for lack of unboxed closures. This is called in /// performance-critical code, so a closure is insufficient. @@ -68,7 +69,7 @@ impl<T:PartialEq + PartialOrd + Ord> Comparator<T,T> for DefaultComparator { // TODO(pcwalton): Speed up with SIMD, or better yet, find some way to not do this. pub fn byte_swap(data: &mut [u8]) { let length = data.len(); - for i in range_step(0, length, 4) { + for i in (0..length).step_by(4) { let r = data[i + 2]; data[i + 2] = data[i + 0]; data[i + 0] = r; @@ -76,14 +77,16 @@ pub fn byte_swap(data: &mut [u8]) { } /// A `VecLike` that only tracks whether or not something was ever pushed to it. -pub struct ForgetfulSink { +pub struct ForgetfulSink<T> { empty: bool, + _data: PhantomData<T>, } -impl ForgetfulSink { - pub fn new() -> ForgetfulSink { +impl<T> ForgetfulSink<T> { + pub fn new() -> ForgetfulSink<T> { ForgetfulSink { empty: true, + _data: PhantomData, } } @@ -92,19 +95,50 @@ impl ForgetfulSink { } } -impl<T> VecLike<T> for ForgetfulSink { - #[inline] - fn vec_len(&self) -> usize { +impl<T> ops::Deref for ForgetfulSink<T> { + type Target = [T]; + fn deref(&self) -> &[T] { unreachable!() } +} - #[inline] - fn vec_push(&mut self, _value: T) { - self.empty = false; +impl<T> ops::DerefMut for ForgetfulSink<T> { + fn deref_mut(&mut self) -> &mut [T] { + unreachable!() } +} +macro_rules! impl_index { + ($index_type: ty, $output_type: ty) => { + impl<T> ops::Index<$index_type> for ForgetfulSink<T> { + type Output = $output_type; + fn index(&self, _index: $index_type) -> &$output_type { + unreachable!() + } + } + + impl<T> ops::IndexMut<$index_type> for ForgetfulSink<T> { + fn index_mut(&mut self, _index: $index_type) -> &mut $output_type { + unreachable!() + } + } + } +} + +impl_index!(usize, T); +impl_index!(ops::Range<usize>, [T]); +impl_index!(ops::RangeFrom<usize>, [T]); +impl_index!(ops::RangeTo<usize>, [T]); +impl_index!(ops::RangeFull, [T]); + +impl<T> VecLike<T> for ForgetfulSink<T> { #[inline] - fn vec_slice_mut<'a>(&'a mut self, _start: usize, _end: usize) -> &'a mut [T] { + fn len(&self) -> usize { unreachable!() } + + #[inline] + fn push(&mut self, _value: T) { + self.empty = false; + } } diff --git a/components/webdriver_server/Cargo.toml b/components/webdriver_server/Cargo.toml index 17fa3188e78..7eb6135c696 100644 --- a/components/webdriver_server/Cargo.toml +++ b/components/webdriver_server/Cargo.toml @@ -19,7 +19,10 @@ path = "../webdriver_traits" [dependencies.webdriver] git = "https://github.com/jgraham/webdriver-rust.git" +[dependencies.png] +git = "https://github.com/servo/rust-png" + [dependencies] rustc-serialize = "0.3.4" url = "0.2.16" -uuid = "0.1.11"
\ No newline at end of file +uuid = "*" diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs index 7d410c90bf8..eed93e75ad7 100644 --- a/components/webdriver_server/lib.rs +++ b/components/webdriver_server/lib.rs @@ -5,21 +5,21 @@ #![crate_name = "webdriver_server"] #![crate_type = "rlib"] -#![feature(net)] -#![feature(rustc_private)] +#![feature(rustc_private, ip_addr)] #[macro_use] extern crate log; extern crate webdriver; extern crate msg; +extern crate png; extern crate url; extern crate util; -extern crate "rustc-serialize" as rustc_serialize; +extern crate rustc_serialize; extern crate uuid; extern crate webdriver_traits; -use msg::constellation_msg::{ConstellationChan, LoadData, PipelineId}; +use msg::constellation_msg::{ConstellationChan, LoadData, PipelineId, NavigationDirection}; use msg::constellation_msg::Msg as ConstellationMsg; use std::sync::mpsc::channel; use webdriver_traits::WebDriverScriptCommand; @@ -35,15 +35,18 @@ use util::task::spawn_named; use uuid::Uuid; use std::borrow::ToOwned; -use std::net::IpAddr; use rustc_serialize::json::{Json, ToJson}; +use rustc_serialize::base64::{Config, ToBase64, CharacterSet, Newline}; use std::collections::BTreeMap; +use std::net::SocketAddr; + +use std::thread::sleep_ms; pub fn start_server(port: u16, constellation_chan: ConstellationChan) { let handler = Handler::new(constellation_chan); spawn_named("WebdriverHttpServer".to_owned(), move || { - server::start(IpAddr::new_v4(0, 0, 0, 0), port, handler); + server::start(SocketAddr::new("0.0.0.0".parse().unwrap(), port), handler); }); } @@ -111,6 +114,29 @@ impl Handler { Ok(WebDriverResponse::Void) } + fn handle_go_back(&self) -> WebDriverResult<WebDriverResponse> { + let ConstellationChan(ref const_chan) = self.constellation_chan; + const_chan.send(ConstellationMsg::Navigate(None, NavigationDirection::Back)).unwrap(); + Ok(WebDriverResponse::Void) + } + + fn handle_go_forward(&self) -> WebDriverResult<WebDriverResponse> { + let ConstellationChan(ref const_chan) = self.constellation_chan; + const_chan.send(ConstellationMsg::Navigate(None, NavigationDirection::Forward)).unwrap(); + Ok(WebDriverResponse::Void) + } + + fn handle_get_title(&self) -> WebDriverResult<WebDriverResponse> { + let pipeline_id = self.get_root_pipeline(); + + let (sender, reciever) = channel(); + let ConstellationChan(ref const_chan) = self.constellation_chan; + const_chan.send(ConstellationMsg::WebDriverCommand(pipeline_id, + WebDriverScriptCommand::GetTitle(sender))).unwrap(); + let value = reciever.recv().unwrap(); + Ok(WebDriverResponse::Generic(ValueResponse::new(value.to_json()))) + } + fn handle_get_window_handle(&self) -> WebDriverResult<WebDriverResponse> { // For now we assume there's only one window so just use the session // id as the window id @@ -118,6 +144,13 @@ impl Handler { Ok(WebDriverResponse::Generic(ValueResponse::new(handle.to_json()))) } + fn handle_get_window_handles(&self) -> WebDriverResult<WebDriverResponse> { + // For now we assume there's only one window so just use the session + // id as the window id + let handles = vec![self.session.as_ref().unwrap().id.to_string().to_json()]; + Ok(WebDriverResponse::Generic(ValueResponse::new(handles.to_json()))) + } + fn handle_execute_script(&self, parameters: &JavascriptCommandParameters) -> WebDriverResult<WebDriverResponse> { // TODO: This isn't really right because it always runs the script in the // root window @@ -142,6 +175,46 @@ impl Handler { "Unsupported return type")) } } + + + fn handle_take_screenshot(&self) -> WebDriverResult<WebDriverResponse> { + let mut img = None; + + let interval = 20; + let iterations = 30_000 / interval; + + for _ in 0..iterations { + let (sender, reciever) = channel(); + let ConstellationChan(ref const_chan) = self.constellation_chan; + const_chan.send(ConstellationMsg::CompositePng(sender)).unwrap(); + + if let Some(x) = reciever.recv().unwrap() { + img = Some(x); + break; + }; + + sleep_ms(interval) + } + + if img.is_none() { + return Err(WebDriverError::new(ErrorStatus::Timeout, + "Taking screenshot timed out")); + } + + let img_vec = match png::to_vec(&mut img.unwrap()) { + Ok(x) => x, + Err(_) => return Err(WebDriverError::new(ErrorStatus::UnknownError, + "Taking screenshot failed")) + }; + let config = Config { + char_set:CharacterSet::Standard, + newline: Newline::LF, + pad: true, + line_length: None + }; + let encoded = img_vec.to_base64(config); + Ok(WebDriverResponse::Generic(ValueResponse::new(encoded.to_json()))) + } } impl WebDriverHandler for Handler { @@ -150,8 +223,13 @@ impl WebDriverHandler for Handler { match msg.command { WebDriverCommand::NewSession => self.handle_new_session(), WebDriverCommand::Get(ref parameters) => self.handle_get(parameters), + WebDriverCommand::GoBack => self.handle_go_back(), + WebDriverCommand::GoForward => self.handle_go_forward(), + WebDriverCommand::GetTitle => self.handle_get_title(), WebDriverCommand::GetWindowHandle => self.handle_get_window_handle(), + WebDriverCommand::GetWindowHandles => self.handle_get_window_handles(), WebDriverCommand::ExecuteScript(ref x) => self.handle_execute_script(x), + WebDriverCommand::TakeScreenshot => self.handle_take_screenshot(), _ => Err(WebDriverError::new(ErrorStatus::UnsupportedOperation, "Command not implemented")) } diff --git a/components/webdriver_traits/Cargo.toml b/components/webdriver_traits/Cargo.toml index c4575e73a53..e27f0e4cf74 100644 --- a/components/webdriver_traits/Cargo.toml +++ b/components/webdriver_traits/Cargo.toml @@ -8,4 +8,4 @@ name = "webdriver_traits" path = "lib.rs" [dependencies] -rustc-serialize="0.3.4"
\ No newline at end of file +rustc-serialize="0.3.4" diff --git a/components/webdriver_traits/lib.rs b/components/webdriver_traits/lib.rs index 4e6a307f64a..8e816165722 100644 --- a/components/webdriver_traits/lib.rs +++ b/components/webdriver_traits/lib.rs @@ -5,13 +5,14 @@ #![crate_name = "webdriver_traits"] #![crate_type = "rlib"] -extern crate "rustc-serialize" as rustc_serialize; +extern crate rustc_serialize; use rustc_serialize::json::{Json, ToJson}; use std::sync::mpsc::Sender; pub enum WebDriverScriptCommand { - EvaluateJS(String, Sender<Result<EvaluateJSReply, ()>>) + EvaluateJS(String, Sender<Result<EvaluateJSReply, ()>>), + GetTitle(Sender<String>) } pub enum EvaluateJSReply { diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index ab2eb625afa..8fcf0cc6e50 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -6,6 +6,7 @@ dependencies = [ "cgl 0.0.1 (git+https://github.com/servo/rust-cgl)", "cocoa 0.1.1 (git+https://github.com/servo/rust-cocoa)", "compositing 0.0.1", + "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)", "core_text 0.1.0 (git+https://github.com/servo/rust-core-text)", "devtools 0.0.1", @@ -15,9 +16,10 @@ dependencies = [ "glutin_app 0.0.1", "js 0.1.0 (git+https://github.com/servo/rust-mozjs)", "layers 0.1.0 (git+https://github.com/servo/rust-layers)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net 0.0.1", + "objc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", "png 0.1.0 (git+https://github.com/servo/rust-png)", "script 0.0.1", @@ -25,19 +27,19 @@ dependencies = [ "servo 0.0.1", "stb_image 0.1.0 (git+https://github.com/servo/rust-stb-image)", "style 0.0.1", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] [[package]] name = "android_glue" -version = "0.0.1" -source = "git+https://github.com/tomaka/android-rs-glue#5a68056599fb498b0cf3715fd359894825e3b856" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "azure" version = "0.1.0" -source = "git+https://github.com/servo/rust-azure#3e5daf667a62f702dc16285e923464458bef785f" +source = "git+https://github.com/servo/rust-azure#91e18a325fa5fdee9b1634b44a3a3a7ac1fb09ff" dependencies = [ "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)", @@ -45,8 +47,8 @@ dependencies = [ "egl 0.1.0 (git+https://github.com/servo/rust-egl)", "freetype 0.1.0 (git+https://github.com/servo/rust-freetype)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "skia 0.0.20130412 (git+https://github.com/servo/skia?branch=upstream-2014-06-16)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "skia 0.0.20130412 (git+https://github.com/servo/skia)", "xlib 0.1.0 (git+https://github.com/servo/rust-xlib)", ] @@ -56,15 +58,20 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "byteorder" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "canvas" version = "0.0.1" dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure)", - "cssparser 0.2.0 (git+https://github.com/servo/rust-cssparser)", + "cssparser 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gfx 0.0.1", "gleam 0.0.1 (git+https://github.com/servo/gleam)", - "glutin 0.0.7 (git+https://github.com/servo/glutin?branch=servo)", + "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "offscreen_gl_context 0.0.1 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)", "util 0.0.1", ] @@ -72,32 +79,37 @@ dependencies = [ [[package]] name = "cgl" version = "0.0.1" -source = "git+https://github.com/servo/rust-cgl#211afc4d1572d8fe67b91c452441b6cb292a2bc7" +source = "git+https://github.com/servo/rust-cgl#851ca1b90081d221c3c38d33548d3e22a19db79f" dependencies = [ "gleam 0.0.1 (git+https://github.com/servo/gleam)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "clipboard" version = "0.0.1" -source = "git+https://github.com/aweinstock314/rust-x11-clipboard#eae9596e7e407c8b6037b934c1a8e42a309423fd" +source = "git+https://github.com/servo/rust-x11-clipboard#43afb218871e3148758c603f335576cb101cb1fa" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "xlib 0.1.0 (git+https://github.com/servo/rust-xlib)", ] [[package]] name = "clock_ticks" -version = "0.0.4" -source = "git+https://github.com/tomaka/clock_ticks#6a3005279bedc406b13eea09ff92447f05ca0de6" +version = "0.0.5" +source = "git+https://github.com/tomaka/clock_ticks#462848731d99ed2f800e2e5a19e2d8ca3b11c90c" +dependencies = [ + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "cocoa" version = "0.1.1" -source = "git+https://github.com/servo/rust-cocoa#ca3441a14783aa0683e073f1a1f990ed21900718" +source = "git+https://github.com/servo/rust-cocoa#26d02e3f3606223645dde173a7bb924bce4836de" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -105,7 +117,7 @@ name = "compositing" version = "0.0.1" dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure)", - "clipboard 0.0.1 (git+https://github.com/aweinstock314/rust-x11-clipboard)", + "clipboard 0.0.1 (git+https://github.com/servo/rust-x11-clipboard)", "core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)", "core_text 0.1.0 (git+https://github.com/servo/rust-core-text)", "devtools_traits 0.0.1", @@ -114,73 +126,83 @@ dependencies = [ "gleam 0.0.1 (git+https://github.com/servo/gleam)", "layers 0.1.0 (git+https://github.com/servo/rust-layers)", "layout_traits 0.0.1", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net 0.0.1", "net_traits 0.0.1", + "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "png 0.1.0 (git+https://github.com/servo/rust-png)", - "profile 0.0.1", + "profile_traits 0.0.1", "script_traits 0.0.1", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "style 0.0.1", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "webdriver_traits 0.0.1", ] [[package]] name = "cookie" -version = "0.1.14" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "openssl 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "core_foundation" version = "0.1.0" -source = "git+https://github.com/servo/rust-core-foundation#c577bd64b0301fe926cf7b757b9852a1ce1d521d" +source = "git+https://github.com/servo/rust-core-foundation#928efbae42fc596e6ede2cf0949c3d6d6f3dad8f" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "core_graphics" version = "0.1.0" -source = "git+https://github.com/servo/rust-core-graphics#e169ad38f71ed003c21fb550a9dfa0e51423ed3a" +source = "git+https://github.com/servo/rust-core-graphics#da0d2fe947412afea55b438454194b2183c21594" dependencies = [ "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "core_text" version = "0.1.0" -source = "git+https://github.com/servo/rust-core-text#8809f011445585d023d5e2a0712a1adcbf7ce609" +source = "git+https://github.com/servo/rust-core-text#bc6994c3765f0660e9c04f5488ba194a9354e8fb" dependencies = [ "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cssparser" -version = "0.2.0" -source = "git+https://github.com/servo/rust-cssparser#56d5f94d5239d4bd68358813405e4d5823c01ff6" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "encoding 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "text_writer 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] +name = "debug-builders" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "devtools" version = "0.0.1" dependencies = [ "devtools_traits 0.0.1", + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] @@ -188,101 +210,111 @@ dependencies = [ name = "devtools_traits" version = "0.0.1" dependencies = [ + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] [[package]] name = "egl" version = "0.1.0" -source = "git+https://github.com/servo/rust-egl#328e79b6256dea346f1821ccc4215e95fd1d58bc" +source = "git+https://github.com/servo/rust-egl#c0159346b3adfdcf13f2cd86f5ee41750a72c078" +dependencies = [ + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "encoding" -version = "0.2.25" +version = "0.2.32" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "encoding-index-japanese 1.20141219.2 (registry+https://github.com/rust-lang/crates.io-index)", - "encoding-index-korean 1.20141219.1 (registry+https://github.com/rust-lang/crates.io-index)", - "encoding-index-simpchinese 1.20141219.1 (registry+https://github.com/rust-lang/crates.io-index)", - "encoding-index-singlebyte 1.20141219.1 (registry+https://github.com/rust-lang/crates.io-index)", - "encoding-index-tradchinese 1.20141219.2 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-japanese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-korean 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-simpchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-singlebyte 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-tradchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "encoding-index-japanese" -version = "1.20141219.2" +version = "1.20141219.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "encoding_index_tests 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "encoding-index-korean" -version = "1.20141219.1" +version = "1.20141219.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "encoding_index_tests 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "encoding-index-simpchinese" -version = "1.20141219.1" +version = "1.20141219.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "encoding_index_tests 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "encoding-index-singlebyte" -version = "1.20141219.1" +version = "1.20141219.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "encoding_index_tests 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "encoding-index-tradchinese" -version = "1.20141219.2" +version = "1.20141219.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "encoding_index_tests 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "encoding_index_tests" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "expat-sys" version = "2.1.0" -source = "git+https://github.com/servo/libexpat#523a2f2f51b41adf7bb5c4c65e80db0cb615d70b" +source = "git+https://github.com/servo/libexpat#5f798cfbb74650a5e1d95e4c03a9e41e55e28625" [[package]] name = "flate2" -version = "0.2.0" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] +name = "fnv" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "fontconfig" version = "0.1.0" -source = "git+https://github.com/servo/rust-fontconfig#91195bd29daa9280680bb28ba556821d504a17c6" +source = "git+https://github.com/servo/rust-fontconfig#7839e5adcb4d6da3cefe2256f5071ac0203b9206" dependencies = [ "fontconfig-sys 2.11.1 (git+https://github.com/servo/libfontconfig)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "fontconfig-sys" version = "2.11.1" -source = "git+https://github.com/servo/libfontconfig#adc60cacbca697123f4535ce2ff07619ec013cec" +source = "git+https://github.com/servo/libfontconfig#ce4a38633dc649b95c9b4935c0cce53e76d8b46a" dependencies = [ "expat-sys 2.1.0 (git+https://github.com/servo/libexpat)", "freetype-sys 2.4.11 (git+https://github.com/servo/libfreetype2)", @@ -293,38 +325,36 @@ name = "freetype" version = "0.1.0" source = "git+https://github.com/servo/rust-freetype#f256a9ac84893f0a183b8966de2a3a03d7552b8b" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "freetype-sys" version = "2.4.11" -source = "git+https://github.com/servo/libfreetype2#a488dfd86872bf9c163d54a7f73a5dc4d3c4fd9e" - -[[package]] -name = "gcc" -version = "0.3.1" -source = "git+https://github.com/alexcrichton/gcc-rs#564247d019449ba46f25f64ffdefade5968b6ae7" +source = "git+https://github.com/servo/libfreetype2#50c1cf412d87f20ccbb940e39a14a38ae7cbb512" [[package]] name = "gcc" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "gdi32-sys" -version = "0.0.4" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "geom" version = "0.1.0" -source = "git+https://github.com/servo/rust-geom#c47fc0f927b6d6e5543fe3b5445c86810831dce1" +source = "git+https://github.com/servo/rust-geom#c4bdb1ef8f4915ae636eb752b103f69246b50304" dependencies = [ - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -341,69 +371,84 @@ dependencies = [ "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "harfbuzz 0.1.0 (git+https://github.com/servo/rust-harfbuzz)", "layers 0.1.0 (git+https://github.com/servo/rust-layers)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", "plugins 0.0.1", "png 0.1.0 (git+https://github.com/servo/rust-png)", - "profile 0.0.1", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "profile_traits 0.0.1", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "script_traits 0.0.1", - "skia 0.0.20130412 (git+https://github.com/servo/skia?branch=upstream-2014-06-16)", + "skia 0.0.20130412 (git+https://github.com/servo/skia)", "stb_image 0.1.0 (git+https://github.com/servo/rust-stb-image)", - "string_cache 0.0.0 (git+https://github.com/servo/string-cache)", + "string_cache 0.1.0 (git+https://github.com/servo/string-cache)", "style 0.0.1", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] [[package]] +name = "gl" +version = "0.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gl_common 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "khronos_api 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "gl_common" version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gl_generator" -version = "0.0.19" +version = "0.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "khronos_api 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "xml-rs 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "xml-rs 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gleam" version = "0.0.1" -source = "git+https://github.com/servo/gleam#70c5f2ea3ef3602277b7c380c24b504e42338056" +source = "git+https://github.com/servo/gleam#f2edabf2ef0474bb270b107e5e68c2727c4a422d" dependencies = [ "gl_common 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gl_generator 0.0.19 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "khronos_api 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "glutin" -version = "0.0.7" -source = "git+https://github.com/servo/glutin?branch=servo#0feab4842c5b229bfe88739d2c526d03c198fd33" +version = "0.0.26" +source = "git+https://github.com/servo/glutin?branch=servo#11389c9ead188376095297a5a295f53d98129a57" dependencies = [ - "android_glue 0.0.1 (git+https://github.com/tomaka/android-rs-glue)", - "cocoa 0.1.1 (git+https://github.com/servo/rust-cocoa)", - "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", - "core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)", - "gdi32-sys 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "android_glue 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gdi32-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "gl_common 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gl_generator 0.0.19 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin_cocoa 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin_core_foundation 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin_core_graphics 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "khronos_api 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "user32-sys 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "osmesa-sys 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "user32-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "x11 0.0.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -416,99 +461,139 @@ dependencies = [ "egl 0.1.0 (git+https://github.com/servo/rust-egl)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gleam 0.0.1 (git+https://github.com/servo/gleam)", - "glutin 0.0.7 (git+https://github.com/servo/glutin?branch=servo)", + "glutin 0.0.26 (git+https://github.com/servo/glutin?branch=servo)", "layers 0.1.0 (git+https://github.com/servo/rust-layers)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "script_traits 0.0.1", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] [[package]] +name = "glutin_cocoa" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "glutin_core_foundation" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "glutin_core_graphics" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "glutin_core_foundation 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "glx" version = "0.0.1" -source = "git+https://github.com/servo/rust-glx#f2103861d38076ef5e01a8c2f58df1e79ca12f41" +source = "git+https://github.com/servo/rust-glx#60ac0aee2438eadb4b51ddc8eac6fc4b5ca8e447" dependencies = [ "gl_common 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gl_generator 0.0.19 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "khronos_api 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "harfbuzz" version = "0.1.0" -source = "git+https://github.com/servo/rust-harfbuzz#cc875777f820da0b85f39c2359d9609650b16600" +source = "git+https://github.com/servo/rust-harfbuzz#33b6fd019fc04e46dd5fe15a5faf8efb1a9a0128" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "html5ever" version = "0.0.0" -source = "git+https://github.com/servo/html5ever#8bad1ca8e1e05a7972be80acc64efd729ffdc8a5" +source = "git+https://github.com/servo/html5ever#74dc5f5a36451cfbe789488b20d51bef97c63898" dependencies = [ "html5ever_macros 0.0.0 (git+https://github.com/servo/html5ever)", - "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "mac 0.0.2 (git+https://github.com/reem/rust-mac)", - "phf 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "phf_macros 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "string_cache 0.0.0 (git+https://github.com/servo/string-cache)", - "string_cache_plugin 0.0.0 (git+https://github.com/servo/string-cache)", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", + "phf 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_macros 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache 0.1.0 (git+https://github.com/servo/string-cache)", + "string_cache_plugin 0.1.1 (git+https://github.com/servo/string-cache)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "html5ever_macros" version = "0.0.0" -source = "git+https://github.com/servo/html5ever#8bad1ca8e1e05a7972be80acc64efd729ffdc8a5" +source = "git+https://github.com/servo/html5ever#74dc5f5a36451cfbe789488b20d51bef97c63898" dependencies = [ "mac 0.0.2 (git+https://github.com/reem/rust-mac)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] +name = "httparse" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "hyper" -version = "0.3.0" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cookie 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "cookie 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "unicase 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "traitobject 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "typeable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "io_surface" version = "0.1.0" -source = "git+https://github.com/servo/rust-io-surface#f380a03a9b0e0316866d4320d46a78dda87efbec" +source = "git+https://github.com/servo/rust-io-surface#ab0ebd4ea6dd953c1581d9486b9e80ecf3c7577d" dependencies = [ "cgl 0.0.1 (git+https://github.com/servo/rust-cgl)", "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gleam 0.0.1 (git+https://github.com/servo/gleam)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "js" version = "0.1.0" -source = "git+https://github.com/servo/rust-mozjs#402b7b2db8816ffeccacfa9a8d316f4487e96ba0" +source = "git+https://github.com/servo/rust-mozjs#30a1ad31d1ee47a8e4e1ef582e793badfb405fa0" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "mozjs_sys 0.0.0 (git+https://github.com/servo/mozjs)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "kernel32-sys" -version = "0.0.11" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -519,7 +604,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "layers" version = "0.1.0" -source = "git+https://github.com/servo/rust-layers#df3a14d00260c8ab506565972555931444361ff8" +source = "git+https://github.com/servo/rust-layers#018259e838c3842032010829feeaba316e577376" dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure)", "cgl 0.0.1 (git+https://github.com/servo/rust-cgl)", @@ -529,8 +614,10 @@ dependencies = [ "gleam 0.0.1 (git+https://github.com/servo/gleam)", "glx 0.0.1 (git+https://github.com/servo/rust-glx)", "io_surface 0.1.0 (git+https://github.com/servo/rust-io-surface)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "skia 0.0.20130412 (git+https://github.com/servo/skia?branch=upstream-2014-06-16)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "skia 0.0.20130412 (git+https://github.com/servo/skia)", "xlib 0.1.0 (git+https://github.com/servo/rust-xlib)", ] @@ -541,26 +628,26 @@ dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure)", "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "canvas 0.0.1", - "clock_ticks 0.0.4 (git+https://github.com/tomaka/clock_ticks)", - "cssparser 0.2.0 (git+https://github.com/servo/rust-cssparser)", - "encoding 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)", + "clock_ticks 0.0.5 (git+https://github.com/tomaka/clock_ticks)", + "cssparser 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gfx 0.0.1", "layout_traits 0.0.1", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", "plugins 0.0.1", "png 0.1.0 (git+https://github.com/servo/rust-png)", - "profile 0.0.1", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "profile_traits 0.0.1", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "script 0.0.1", "script_traits 0.0.1", "selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", - "string_cache 0.0.0 (git+https://github.com/servo/string-cache)", - "string_cache_plugin 0.0.0 (git+https://github.com/servo/string-cache)", + "string_cache 0.1.0 (git+https://github.com/servo/string-cache)", + "string_cache_plugin 0.1.1 (git+https://github.com/servo/string-cache)", "style 0.0.1", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] @@ -571,34 +658,37 @@ dependencies = [ "gfx 0.0.1", "msg 0.0.1", "net_traits 0.0.1", - "profile 0.0.1", + "profile_traits 0.0.1", "script_traits 0.0.1", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] [[package]] name = "lazy_static" -version = "0.1.8" -source = "git+https://github.com/Kimundi/lazy-static.rs#56b4be4141d3c58273cf5ee1d2e956e2f22248b9" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.1.2" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libressl-pnacl-sys" -version = "2.1.4" +version = "2.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "pnacl-build-helper 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "pnacl-build-helper 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "log" -version = "0.2.5" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "mac" @@ -606,6 +696,19 @@ version = "0.0.2" source = "git+https://github.com/reem/rust-mac#6316d3f4663756180fd236b126a84e245e978765" [[package]] +name = "mac" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "malloc_buf" +version = "0.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "matches" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -615,21 +718,21 @@ name = "mime" version = "0.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "miniz-sys" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "mod_path" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -645,11 +748,12 @@ dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", - "hyper 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "io_surface 0.1.0 (git+https://github.com/servo/rust-io-surface)", "layers 0.1.0 (git+https://github.com/servo/rust-layers)", + "png 0.1.0 (git+https://github.com/servo/rust-png)", "style 0.0.1", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "webdriver_traits 0.0.1", ] @@ -658,20 +762,21 @@ dependencies = [ name = "net" version = "0.0.1" dependencies = [ - "cookie 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cookie 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", + "devtools_traits 0.0.1", + "flate2 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", - "hyper 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "net_traits 0.0.1", - "openssl 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "png 0.1.0 (git+https://github.com/servo/rust-png)", - "profile 0.0.1", - "regex 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "regex_macros 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", + "regex_macros 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", + "uuid 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -679,81 +784,122 @@ name = "net_traits" version = "0.0.1" dependencies = [ "geom 0.1.0 (git+https://github.com/servo/rust-geom)", - "hyper 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "msg 0.0.1", "png 0.1.0 (git+https://github.com/servo/rust-png)", - "profile 0.0.1", "stb_image 0.1.0 (git+https://github.com/servo/rust-stb-image)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] [[package]] +name = "num" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num_cpus" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "objc" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "malloc_buf 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "offscreen_gl_context" version = "0.0.1" -source = "git+https://github.com/ecoal95/rust-offscreen-rendering-context#9547d416019b15e0e59dc5176f5b1a14e14b44ca" +source = "git+https://github.com/ecoal95/rust-offscreen-rendering-context#c2b3dfd7fe344384e4206672b99c296141f5b4d6" dependencies = [ "cgl 0.0.1 (git+https://github.com/servo/rust-cgl)", + "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gleam 0.0.1 (git+https://github.com/servo/gleam)", "glx 0.0.1 (git+https://github.com/servo/rust-glx)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "xlib 0.1.0 (git+https://github.com/servo/rust-xlib)", ] [[package]] name = "openssl" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "openssl-sys" -version = "0.5.1" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gcc 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libressl-pnacl-sys 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "osmesa-sys" +version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libressl-pnacl-sys 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gl 0.0.12 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "phf" -version = "0.6.12" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "phf_shared 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "debug-builders 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "phf_generator" -version = "0.6.12" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "phf_shared 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "phf_macros" -version = "0.6.12" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "phf_generator 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "phf_shared 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_generator 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "phf_shared" -version = "0.6.12" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "pkg-config" -version = "0.3.0" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -765,60 +911,76 @@ dependencies = [ [[package]] name = "pnacl-build-helper" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "tempdir 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "png" version = "0.1.0" -source = "git+https://github.com/servo/rust-png#1d9c59c97598014860077f372443ae98b35ff4d9" +source = "git+https://github.com/servo/rust-png#80e765ed1880ea70a8326a13964f57657b9e6fa9" dependencies = [ - "gcc 0.3.1 (git+https://github.com/alexcrichton/gcc-rs)", + "gcc 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "png-sys 1.6.16 (git+https://github.com/servo/rust-png)", ] [[package]] name = "png-sys" version = "1.6.16" -source = "git+https://github.com/servo/rust-png#1d9c59c97598014860077f372443ae98b35ff4d9" +source = "git+https://github.com/servo/rust-png#80e765ed1880ea70a8326a13964f57657b9e6fa9" [[package]] name = "profile" version = "0.0.1" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "profile_traits 0.0.1", + "regex 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", "task_info 0.0.1", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] [[package]] +name = "profile_traits" +version = "0.0.1" +dependencies = [ + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quicksort" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "rand" -version = "0.1.4" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex" -version = "0.1.18" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "regex_macros" -version = "0.1.11" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "regex 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-serialize" -version = "0.3.4" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -827,31 +989,34 @@ version = "0.0.1" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "canvas 0.0.1", - "cssparser 0.2.0 (git+https://github.com/servo/rust-cssparser)", + "cssparser 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "devtools_traits 0.0.1", - "encoding 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gfx 0.0.1", "html5ever 0.0.0 (git+https://github.com/servo/html5ever)", - "hyper 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "js 0.1.0 (git+https://github.com/servo/rust-mozjs)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", + "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", "png 0.1.0 (git+https://github.com/servo/rust-png)", - "profile 0.0.1", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "profile_traits 0.0.1", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "script_traits 0.0.1", "selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", - "string_cache 0.0.0 (git+https://github.com/servo/string-cache)", - "string_cache_plugin 0.0.0 (git+https://github.com/servo/string-cache)", + "string_cache 0.1.0 (git+https://github.com/servo/string-cache)", + "string_cache_plugin 0.1.1 (git+https://github.com/servo/string-cache)", "style 0.0.1", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "uuid 0.1.11 (git+https://github.com/rust-lang/uuid)", + "uuid 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "webdriver_traits 0.0.1", + "websocket 0.11.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -860,10 +1025,10 @@ version = "0.0.1" dependencies = [ "devtools_traits 0.0.1", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "webdriver_traits 0.0.1", ] @@ -871,13 +1036,15 @@ dependencies = [ [[package]] name = "selectors" version = "0.1.0" -source = "git+https://github.com/servo/rust-selectors#0d7d846090c21d71ebb1bc17921806933a38f52b" +source = "git+https://github.com/servo/rust-selectors#1fda09bf0c59acfcb697f71b38dad22108b3d27a" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.2.0 (git+https://github.com/servo/rust-cssparser)", + "cssparser 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "string_cache 0.0.0 (git+https://github.com/servo/string-cache)", - "string_cache_plugin 0.0.0 (git+https://github.com/servo/string-cache)", + "quicksort 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache 0.1.0 (git+https://github.com/servo/string-cache)", + "string_cache_plugin 0.1.1 (git+https://github.com/servo/string-cache)", ] [[package]] @@ -891,14 +1058,16 @@ dependencies = [ "gfx 0.0.1", "glutin_app 0.0.1", "layout 0.0.1", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net 0.0.1", "net_traits 0.0.1", "png 0.1.0 (git+https://github.com/servo/rust-png)", "profile 0.0.1", + "profile_traits 0.0.1", "script 0.0.1", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "webdriver_server 0.0.1", ] @@ -906,56 +1075,71 @@ dependencies = [ [[package]] name = "skia" version = "0.0.20130412" -source = "git+https://github.com/servo/skia?branch=upstream-2014-06-16#db5b5393c83da9ff5b8fb2076481e98fb2b659f2" +source = "git+https://github.com/servo/skia#d60e6753b2b23b3b4ff787b505da56cfad0335c9" dependencies = [ "expat-sys 2.1.0 (git+https://github.com/servo/libexpat)", "freetype-sys 2.4.11 (git+https://github.com/servo/libfreetype2)", ] [[package]] +name = "smallvec" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "stb_image" version = "0.1.0" -source = "git+https://github.com/servo/rust-stb-image#b683cc9e7ba52a1bb65361347da0df1bc9c5e854" +source = "git+https://github.com/servo/rust-stb-image#f6c411b381322609a321b7fb5f948b2365973604" +dependencies = [ + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "string_cache" -version = "0.0.0" -source = "git+https://github.com/servo/string-cache#124cb555651bd7838c5c6dc4788bc4f5350947a9" +version = "0.1.0" +source = "git+https://github.com/servo/string-cache#c5912f925e9c1db7dbe4a7980fbc3eed08eef51d" dependencies = [ - "lazy_static 0.1.8 (git+https://github.com/Kimundi/lazy-static.rs)", - "phf 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "phf_macros 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "string_cache_plugin 0.0.0 (git+https://github.com/servo/string-cache)", + "lazy_static 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "phf 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_macros 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache_plugin 0.1.1 (git+https://github.com/servo/string-cache)", + "string_cache_shared 0.1.0 (git+https://github.com/servo/string-cache)", ] [[package]] name = "string_cache_plugin" -version = "0.0.0" -source = "git+https://github.com/servo/string-cache#124cb555651bd7838c5c6dc4788bc4f5350947a9" +version = "0.1.1" +source = "git+https://github.com/servo/string-cache#c5912f925e9c1db7dbe4a7980fbc3eed08eef51d" dependencies = [ - "lazy_static 0.1.8 (git+https://github.com/Kimundi/lazy-static.rs)", - "mac 0.0.2 (git+https://github.com/reem/rust-mac)", + "lazy_static 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache_shared 0.1.0 (git+https://github.com/servo/string-cache)", ] [[package]] +name = "string_cache_shared" +version = "0.1.0" +source = "git+https://github.com/servo/string-cache#c5912f925e9c1db7dbe4a7980fbc3eed08eef51d" + +[[package]] name = "style" version = "0.0.1" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.2.0 (git+https://github.com/servo/rust-cssparser)", - "encoding 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", - "lazy_static 0.1.8 (git+https://github.com/Kimundi/lazy-static.rs)", + "lazy_static 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "mod_path 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "mod_path 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", - "string_cache 0.0.0 (git+https://github.com/servo/string-cache)", - "string_cache_plugin 0.0.0 (git+https://github.com/servo/string-cache)", - "text_writer 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache 0.1.0 (git+https://github.com/servo/string-cache)", + "string_cache_plugin 0.1.1 (git+https://github.com/servo/string-cache)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] @@ -964,44 +1148,57 @@ name = "task_info" version = "0.0.1" [[package]] +name = "tempdir" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "tenacious" version = "0.0.1" source = "git+https://github.com/Manishearth/rust-tenacious.git#d61782e70005a9f0cdf66f366d4ec88fc563ea1e" [[package]] -name = "text_writer" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] name = "time" -version = "0.1.19" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] +name = "traitobject" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "typeable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "unicase" -version = "0.0.5" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "url" -version = "0.2.23" +version = "0.2.31" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "user32-sys" -version = "0.0.11" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1010,49 +1207,43 @@ version = "0.0.1" dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure)", "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.2.0 (git+https://github.com/servo/rust-cssparser)", + "cssparser 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "layers 0.1.0 (git+https://github.com/servo/rust-layers)", - "lazy_static 0.1.8 (git+https://github.com/Kimundi/lazy-static.rs)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", - "rand 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", - "string_cache 0.0.0 (git+https://github.com/servo/string-cache)", - "string_cache_plugin 0.0.0 (git+https://github.com/servo/string-cache)", - "text_writer 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "uuid" -version = "0.1.11" -source = "git+https://github.com/rust-lang/uuid#c7862508f84b114d22bb68ec01202eafc50a81b2" -dependencies = [ - "rand 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache 0.1.0 (git+https://github.com/servo/string-cache)", + "string_cache_plugin 0.1.1 (git+https://github.com/servo/string-cache)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uuid" -version = "0.1.11" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "webdriver" -version = "0.0.1" -source = "git+https://github.com/jgraham/webdriver-rust.git#fa625e3cf8fdb39b503c1cc902506df3a1d1c9de" +version = "0.1.0" +source = "git+https://github.com/jgraham/webdriver-rust.git#c2038b4195ee8cd982079cc48d6a9d039f59f1fb" dependencies = [ - "hyper 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "uuid 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1060,11 +1251,12 @@ name = "webdriver_server" version = "0.0.1" dependencies = [ "msg 0.0.1", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "png 0.1.0 (git+https://github.com/servo/rust-png)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "uuid 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "webdriver 0.0.1 (git+https://github.com/jgraham/webdriver-rust.git)", + "uuid 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "webdriver 0.1.0 (git+https://github.com/jgraham/webdriver-rust.git)", "webdriver_traits 0.0.1", ] @@ -1072,20 +1264,38 @@ dependencies = [ name = "webdriver_traits" version = "0.0.1" dependencies = [ - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "winapi" -version = "0.0.5" +name = "websocket" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "winapi" -version = "0.1.15" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "x11" +version = "0.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1094,12 +1304,12 @@ version = "0.1.0" source = "git+https://github.com/servo/rust-xlib#1a0f3d48fbebf96e2d1bf83ac71309b27f49e0c7" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "xml-rs" -version = "0.1.20" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/ports/cef/Cargo.toml b/ports/cef/Cargo.toml index a8ea2e62517..2e73e96319c 100644 --- a/ports/cef/Cargo.toml +++ b/ports/cef/Cargo.toml @@ -62,6 +62,9 @@ git = "https://github.com/servo/rust-png" [dependencies.stb_image] git = "https://github.com/servo/rust-stb-image" +[dependencies.core_foundation] +git = "https://github.com/servo/rust-core-foundation" + [dependencies.core_graphics] git = "https://github.com/servo/rust-core-graphics" @@ -80,3 +83,4 @@ git = "https://github.com/servo/rust-cgl" [dependencies] url = "*" libc = "*" +objc = "0.1" diff --git a/ports/cef/lib.rs b/ports/cef/lib.rs index 6e0627b959b..2f6718a1dea 100644 --- a/ports/cef/lib.rs +++ b/ports/cef/lib.rs @@ -7,11 +7,12 @@ #![feature(plugin)] #![feature(link_args)] #![feature(thread_local)] -#![feature(unicode)] #![feature(core)] #![feature(std_misc)] #![feature(rustc_private)] #![feature(collections)] +#![feature(negate_unsigned)] +#![feature(unicode)] #![allow(non_camel_case_types)] @@ -31,9 +32,9 @@ extern crate glutin_app; extern crate js; extern crate layers; extern crate png; +extern crate rustc_unicode; extern crate script; extern crate script_traits; -extern crate unicode; extern crate net; extern crate msg; @@ -42,16 +43,21 @@ extern crate style; extern crate stb_image; extern crate libc; -extern crate "url" as std_url; +extern crate url as std_url; #[cfg(target_os="macos")] extern crate cgl; #[cfg(target_os="macos")] extern crate cocoa; #[cfg(target_os="macos")] +extern crate core_foundation; +#[cfg(target_os="macos")] extern crate core_graphics; #[cfg(target_os="macos")] extern crate core_text; +#[cfg(target_os="macos")] +#[macro_use] +extern crate objc; // Must come first. pub mod macros; diff --git a/ports/cef/string.rs b/ports/cef/string.rs index 37cdafac751..523c4f66d2d 100644 --- a/ports/cef/string.rs +++ b/ports/cef/string.rs @@ -94,7 +94,7 @@ pub extern "C" fn cef_string_utf8_set(src: *const u8, src_len: size_t, output: * return 0; } - ptr::copy((*output).str, src, src_len as usize); + ptr::copy(src, (*output).str, src_len as usize); (*output).length = src_len; (*output).dtor = Some(string_utf8_dtor as extern "C" fn(*mut u8)); } @@ -175,7 +175,7 @@ pub extern "C" fn cef_string_utf16_set(src: *const c_ushort, src_len: size_t, ou return 0; } - ptr::copy((*output).str, src, src_len as usize); + ptr::copy(src, (*output).str, src_len as usize); (*output).length = src_len; (*output).dtor = Some(string_utf16_dtor as extern "C" fn(*mut c_ushort)); } @@ -233,7 +233,7 @@ pub extern "C" fn cef_string_wide_set(src: *const wchar_t, src_len: size_t, outp return 0; } - ptr::copy((*output).str, src, src_len as usize); + ptr::copy(src, (*output).str, src_len as usize); (*output).length = src_len; (*output).dtor = Some(string_wide_dtor as extern "C" fn(*mut wchar_t)); } diff --git a/ports/cef/string_multimap.rs b/ports/cef/string_multimap.rs index d0ad3aa0b87..909039bc2ad 100644 --- a/ports/cef/string_multimap.rs +++ b/ports/cef/string_multimap.rs @@ -3,9 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use eutil::slice_to_str; -use libc::{c_int}; +use libc::c_int; use std::collections::BTreeMap; -use std::iter::AdditiveIterator; use std::mem; use std::string::String; use string::{cef_string_userfree_utf16_alloc, cef_string_userfree_utf16_free}; @@ -31,7 +30,11 @@ pub extern "C" fn cef_string_multimap_size(smm: *mut cef_string_multimap_t) -> c unsafe { if smm.is_null() { return 0; } let v = string_multimap_to_treemap(smm); - (*v).values().map(|val| (*val).len()).sum() as c_int + // t1 : collections::btree::map::Values<'_, collections::string::String, collections::vec::Vec<*mut types::cef_string_utf16>>` + let t1 = (*v).values(); + // t2 : collections::btree::map::BTreeMap<collections::string::String, collections::vec::Vec<*mut types::cef_string_utf16>> + let t2 : usize = t1.map(|val| (*val).len()).sum(); + t2 as c_int } } diff --git a/ports/cef/window.rs b/ports/cef/window.rs index 948a3c13380..90740c54622 100644 --- a/ports/cef/window.rs +++ b/ports/cef/window.rs @@ -10,8 +10,8 @@ use eutil::Downcast; use interfaces::CefBrowser; use render_handler::CefRenderHandlerExtensions; +use rustc_unicode::str::Utf16Encoder; use types::{cef_cursor_handle_t, cef_rect_t}; -use unicode::str::Utf16Encoder; use compositing::compositor_task::{self, CompositorProxy, CompositorReceiver}; use compositing::windowing::{WindowEvent, WindowMethods}; @@ -91,30 +91,33 @@ impl Window { /// bundles custom resources (which we don't yet do). #[cfg(target_os="macos")] fn cursor_handle_for_cursor(&self, cursor: Cursor) -> cef_cursor_handle_t { - use cocoa::base::{class, msg_send, selector}; - - let cocoa_name = match cursor { - Cursor::NoCursor => return 0 as cef_cursor_handle_t, - Cursor::ContextMenuCursor => "contextualMenuCursor", - Cursor::GrabbingCursor => "closedHandCursor", - Cursor::CrosshairCursor => "crosshairCursor", - Cursor::CopyCursor => "dragCopyCursor", - Cursor::AliasCursor => "dragLinkCursor", - Cursor::TextCursor => "IBeamCursor", - Cursor::GrabCursor | Cursor::AllScrollCursor => "openHandCursor", - Cursor::NoDropCursor | Cursor::NotAllowedCursor => "operationNotAllowedCursor", - Cursor::PointerCursor => "pointingHandCursor", - Cursor::SResizeCursor => "resizeDownCursor", - Cursor::WResizeCursor => "resizeLeftCursor", - Cursor::EwResizeCursor | Cursor::ColResizeCursor => "resizeLeftRightCursor", - Cursor::EResizeCursor => "resizeRightCursor", - Cursor::NResizeCursor => "resizeUpCursor", - Cursor::NsResizeCursor | Cursor::RowResizeCursor => "resizeUpDownCursor", - Cursor::VerticalTextCursor => "IBeamCursorForVerticalLayout", - _ => "arrowCursor", - }; + use cocoa::base::class; + unsafe { - msg_send()(class("NSCursor"), selector(cocoa_name)) + match cursor { + Cursor::NoCursor => return 0 as cef_cursor_handle_t, + Cursor::ContextMenuCursor => msg_send![class("NSCursor"), contextualMenuCursor], + Cursor::GrabbingCursor => msg_send![class("NSCursor"), closedHandCursor], + Cursor::CrosshairCursor => msg_send![class("NSCursor"), crosshairCursor], + Cursor::CopyCursor => msg_send![class("NSCursor"), dragCopyCursor], + Cursor::AliasCursor => msg_send![class("NSCursor"), dragLinkCursor], + Cursor::TextCursor => msg_send![class("NSCursor"), IBeamCursor], + Cursor::GrabCursor | Cursor::AllScrollCursor => + msg_send![class("NSCursor"), openHandCursor], + Cursor::NoDropCursor | Cursor::NotAllowedCursor => + msg_send![class("NSCursor"), operationNotAllowedCursor], + Cursor::PointerCursor => msg_send![class("NSCursor"), pointingHandCursor], + Cursor::SResizeCursor => msg_send![class("NSCursor"), resizeDownCursor], + Cursor::WResizeCursor => msg_send![class("NSCursor"), resizeLeftCursor], + Cursor::EwResizeCursor | Cursor::ColResizeCursor => + msg_send![class("NSCursor"), resizeLeftRightCursor], + Cursor::EResizeCursor => msg_send![class("NSCursor"), resizeRightCursor], + Cursor::NResizeCursor => msg_send![class("NSCursor"), resizeUpCursor], + Cursor::NsResizeCursor | Cursor::RowResizeCursor => + msg_send![class("NSCursor"), resizeUpDownCursor], + Cursor::VerticalTextCursor => msg_send![class("NSCursor"), IBeamCursorForVerticalLayout], + _ => msg_send![class("NSCursor"), arrowCursor], + } } } @@ -325,9 +328,10 @@ struct CefCompositorProxy { impl CompositorProxy for CefCompositorProxy { #[cfg(target_os="macos")] fn send(&mut self, msg: compositor_task::Msg) { - use cocoa::appkit::{NSApp, NSApplication, NSApplicationDefined, NSAutoreleasePool}; - use cocoa::appkit::{NSEvent, NSEventModifierFlags, NSEventSubtype, NSPoint}; + use cocoa::appkit::{NSApp, NSApplication, NSApplicationDefined}; + use cocoa::appkit::{NSEvent, NSEventModifierFlags, NSEventSubtype}; use cocoa::base::nil; + use cocoa::foundation::{NSAutoreleasePool, NSPoint}; // Send a message and kick the OS event loop awake. self.sender.send(msg).unwrap(); @@ -342,7 +346,7 @@ impl CompositorProxy for CefCompositorProxy { NSEventModifierFlags::empty(), 0.0, 0, - 0, + nil, NSEventSubtype::NSWindowExposedEventType, 0, 0); diff --git a/ports/cef/wrappers.rs b/ports/cef/wrappers.rs index 99858f7887e..0ac8b5f668b 100644 --- a/ports/cef/wrappers.rs +++ b/ports/cef/wrappers.rs @@ -4,6 +4,7 @@ use interfaces::{cef_drag_data_t, cef_post_data_element_t, cef_v8value_t, CefPostDataElement}; use interfaces::{CefV8Value}; +use rustc_unicode::str::Utf16Encoder; use types::{cef_base_t, cef_browser_settings_t, cef_color_model_t}; use types::{cef_context_menu_edit_state_flags_t, cef_context_menu_handler_t}; use types::{cef_context_menu_media_state_flags_t}; @@ -29,7 +30,6 @@ use types::{cef_termination_status_t, cef_text_input_context_t, cef_thread_id_t} use types::{cef_time_t, cef_transition_type_t, cef_urlrequest_status_t}; use types::{cef_v8_accesscontrol_t, cef_v8_propertyattribute_t, cef_value_type_t}; use types::{cef_window_info_t, cef_xml_encoding_type_t, cef_xml_node_type_t}; -use unicode::str::Utf16Encoder; use libc::{self, c_char, c_int, c_ushort, c_void}; use std::boxed; @@ -183,8 +183,8 @@ cef_unimplemented_wrapper!(cef_string_t, String); impl<'a> CefWrap<*const cef_string_t> for &'a [u16] { fn to_c(buffer: &'a [u16]) -> *const cef_string_t { unsafe { - let ptr: *mut c_ushort = mem::transmute(libc::malloc(((buffer.len() + 1) * 2) as u64)); - ptr::copy(ptr, mem::transmute(buffer.as_ptr()), buffer.len()); + let ptr = libc::malloc(((buffer.len() + 1) * 2) as u64) as *mut c_ushort; + ptr::copy(buffer.as_ptr(), ptr, buffer.len()); *ptr.offset(buffer.len() as isize) = 0; // FIXME(pcwalton): This leaks!! We should instead have the caller pass some scratch diff --git a/ports/glutin/lib.rs b/ports/glutin/lib.rs index 8198eae5493..b655bf4ef7f 100644 --- a/ports/glutin/lib.rs +++ b/ports/glutin/lib.rs @@ -4,9 +4,7 @@ //! A simple application that uses glutin to open a window for Servo to display in. -#![feature(int_uint)] #![feature(box_syntax)] -#![cfg_attr(all(feature = "window", target_os = "linux"), feature(old_io, std_misc))] #[macro_use] extern crate bitflags; #[cfg(target_os="macos")] diff --git a/ports/glutin/window.rs b/ports/glutin/window.rs index 8e47004e938..48a1c9b61c9 100644 --- a/ports/glutin/window.rs +++ b/ports/glutin/window.rs @@ -33,8 +33,6 @@ use msg::constellation_msg::{KeyState, CONTROL, SHIFT, ALT}; #[cfg(feature = "window")] use std::cell::{Cell, RefCell}; #[cfg(feature = "window")] -use std::num::Float; -#[cfg(feature = "window")] use util::opts; #[cfg(all(feature = "headless", target_os="linux"))] @@ -237,21 +235,22 @@ impl Window { MouseWindowEvent::MouseDown(MouseButton::Left, TypedPoint2D(x as f32, y as f32)) } ElementState::Released => { + let mouse_up_event = MouseWindowEvent::MouseUp(MouseButton::Left, TypedPoint2D(x as f32, y as f32)); match self.mouse_down_button.get() { - None => (), + None => mouse_up_event, Some(but) if button == but => { let pixel_dist = self.mouse_down_point.get() - Point2D(x, y); let pixel_dist = ((pixel_dist.x * pixel_dist.x + pixel_dist.y * pixel_dist.y) as f64).sqrt(); if pixel_dist < max_pixel_dist { - let click_event = MouseWindowEvent::Click( - MouseButton::Left, TypedPoint2D(x as f32, y as f32)); - self.event_queue.borrow_mut().push(WindowEvent::MouseWindowEventClass(click_event)); + self.event_queue.borrow_mut().push(WindowEvent::MouseWindowEventClass(mouse_up_event)); + MouseWindowEvent::Click(MouseButton::Left, TypedPoint2D(x as f32, y as f32)) + } else { + mouse_up_event } - } - Some(_) => (), + }, + Some(_) => mouse_up_event, } - MouseWindowEvent::MouseUp(MouseButton::Left, TypedPoint2D(x as f32, y as f32)) } }; self.event_queue.borrow_mut().push(WindowEvent::MouseWindowEventClass(event)); @@ -265,8 +264,7 @@ impl Window { #[cfg(target_os="linux")] fn handle_next_event(&self) -> bool { - use std::old_io::timer::sleep; - use std::time::duration::Duration; + use std::thread::sleep_ms; // TODO(gw): This is an awful hack to work around the // broken way we currently call X11 from multiple threads. @@ -290,7 +288,7 @@ impl Window { self.handle_window_event(event) } None => { - sleep(Duration::milliseconds(16)); + sleep_ms(16); false } } @@ -740,42 +738,42 @@ impl CompositorProxy for GlutinCompositorProxy { #[allow(non_snake_case)] #[no_mangle] -pub extern "C" fn glBindVertexArrayOES(_array: uint) +pub extern "C" fn glBindVertexArrayOES(_array: usize) { unimplemented!() } #[allow(non_snake_case)] #[no_mangle] -pub extern "C" fn glDeleteVertexArraysOES(_n: int, _arrays: *const ()) +pub extern "C" fn glDeleteVertexArraysOES(_n: isize, _arrays: *const ()) { unimplemented!() } #[allow(non_snake_case)] #[no_mangle] -pub extern "C" fn glGenVertexArraysOES(_n: int, _arrays: *const ()) +pub extern "C" fn glGenVertexArraysOES(_n: isize, _arrays: *const ()) { unimplemented!() } #[allow(non_snake_case)] #[no_mangle] -pub extern "C" fn glRenderbufferStorageMultisampleIMG(_: int, _: int, _: int, _: int, _: int) +pub extern "C" fn glRenderbufferStorageMultisampleIMG(_: isize, _: isize, _: isize, _: isize, _: isize) { unimplemented!() } #[allow(non_snake_case)] #[no_mangle] -pub extern "C" fn glFramebufferTexture2DMultisampleIMG(_: int, _: int, _: int, _: int, _: int, _: int) +pub extern "C" fn glFramebufferTexture2DMultisampleIMG(_: isize, _: isize, _: isize, _: isize, _: isize, _: isize) { unimplemented!() } #[allow(non_snake_case)] #[no_mangle] -pub extern "C" fn glDiscardFramebufferEXT(_: int, _: int, _: *const ()) +pub extern "C" fn glDiscardFramebufferEXT(_: isize, _: isize, _: *const ()) { unimplemented!() } diff --git a/ports/gonk/Cargo.lock b/ports/gonk/Cargo.lock index ccad0c6f5c3..1c616b24447 100644 --- a/ports/gonk/Cargo.lock +++ b/ports/gonk/Cargo.lock @@ -5,12 +5,13 @@ dependencies = [ "compositing 0.0.1", "devtools 0.0.1", "egl 0.1.0 (git+https://github.com/servo/rust-egl)", + "errno 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gfx 0.0.1", "gleam 0.0.1 (git+https://github.com/servo/gleam)", "layers 0.1.0 (git+https://github.com/servo/rust-layers)", "layout 0.0.1", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net 0.0.1", "net_traits 0.0.1", @@ -18,20 +19,15 @@ dependencies = [ "script 0.0.1", "script_traits 0.0.1", "servo 0.0.1", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] [[package]] -name = "android_glue" -version = "0.0.1" -source = "git+https://github.com/tomaka/android-rs-glue#5a68056599fb498b0cf3715fd359894825e3b856" - -[[package]] name = "azure" version = "0.1.0" -source = "git+https://github.com/servo/rust-azure#3e5daf667a62f702dc16285e923464458bef785f" +source = "git+https://github.com/servo/rust-azure#91e18a325fa5fdee9b1634b44a3a3a7ac1fb09ff" dependencies = [ "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)", @@ -39,8 +35,8 @@ dependencies = [ "egl 0.1.0 (git+https://github.com/servo/rust-egl)", "freetype 0.1.0 (git+https://github.com/servo/rust-freetype)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "skia 0.0.20130412 (git+https://github.com/servo/skia?branch=upstream-2014-06-16)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "skia 0.0.20130412 (git+https://github.com/servo/skia)", "xlib 0.1.0 (git+https://github.com/servo/rust-xlib)", ] @@ -50,15 +46,20 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "byteorder" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "canvas" version = "0.0.1" dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure)", - "cssparser 0.2.0 (git+https://github.com/servo/rust-cssparser)", + "cssparser 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gfx 0.0.1", "gleam 0.0.1 (git+https://github.com/servo/gleam)", - "glutin 0.0.7 (git+https://github.com/servo/glutin?branch=servo)", + "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "offscreen_gl_context 0.0.1 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)", "util 0.0.1", ] @@ -66,33 +67,27 @@ dependencies = [ [[package]] name = "cgl" version = "0.0.1" -source = "git+https://github.com/servo/rust-cgl#211afc4d1572d8fe67b91c452441b6cb292a2bc7" +source = "git+https://github.com/servo/rust-cgl#851ca1b90081d221c3c38d33548d3e22a19db79f" dependencies = [ "gleam 0.0.1 (git+https://github.com/servo/gleam)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "clipboard" version = "0.0.1" -source = "git+https://github.com/aweinstock314/rust-x11-clipboard#eae9596e7e407c8b6037b934c1a8e42a309423fd" +source = "git+https://github.com/servo/rust-x11-clipboard#43afb218871e3148758c603f335576cb101cb1fa" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "xlib 0.1.0 (git+https://github.com/servo/rust-xlib)", ] [[package]] name = "clock_ticks" -version = "0.0.4" -source = "git+https://github.com/tomaka/clock_ticks#6a3005279bedc406b13eea09ff92447f05ca0de6" - -[[package]] -name = "cocoa" -version = "0.1.1" -source = "git+https://github.com/servo/rust-cocoa#26d02e3f3606223645dde173a7bb924bce4836de" +version = "0.0.5" +source = "git+https://github.com/tomaka/clock_ticks#462848731d99ed2f800e2e5a19e2d8ca3b11c90c" dependencies = [ - "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "objc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -100,7 +95,7 @@ name = "compositing" version = "0.0.1" dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure)", - "clipboard 0.0.1 (git+https://github.com/aweinstock314/rust-x11-clipboard)", + "clipboard 0.0.1 (git+https://github.com/servo/rust-x11-clipboard)", "core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)", "core_text 0.1.0 (git+https://github.com/servo/rust-core-text)", "devtools_traits 0.0.1", @@ -109,73 +104,83 @@ dependencies = [ "gleam 0.0.1 (git+https://github.com/servo/gleam)", "layers 0.1.0 (git+https://github.com/servo/rust-layers)", "layout_traits 0.0.1", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net 0.0.1", "net_traits 0.0.1", + "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "png 0.1.0 (git+https://github.com/servo/rust-png)", - "profile 0.0.1", + "profile_traits 0.0.1", "script_traits 0.0.1", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "style 0.0.1", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "webdriver_traits 0.0.1", ] [[package]] name = "cookie" -version = "0.1.14" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "openssl 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "core_foundation" version = "0.1.0" -source = "git+https://github.com/servo/rust-core-foundation#c577bd64b0301fe926cf7b757b9852a1ce1d521d" +source = "git+https://github.com/servo/rust-core-foundation#928efbae42fc596e6ede2cf0949c3d6d6f3dad8f" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "core_graphics" version = "0.1.0" -source = "git+https://github.com/servo/rust-core-graphics#e169ad38f71ed003c21fb550a9dfa0e51423ed3a" +source = "git+https://github.com/servo/rust-core-graphics#da0d2fe947412afea55b438454194b2183c21594" dependencies = [ "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "core_text" version = "0.1.0" -source = "git+https://github.com/servo/rust-core-text#8809f011445585d023d5e2a0712a1adcbf7ce609" +source = "git+https://github.com/servo/rust-core-text#bc6994c3765f0660e9c04f5488ba194a9354e8fb" dependencies = [ "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cssparser" -version = "0.2.0" -source = "git+https://github.com/servo/rust-cssparser#56d5f94d5239d4bd68358813405e4d5823c01ff6" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "encoding 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "text_writer 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] +name = "debug-builders" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "devtools" version = "0.0.1" dependencies = [ "devtools_traits 0.0.1", + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] @@ -183,101 +188,121 @@ dependencies = [ name = "devtools_traits" version = "0.0.1" dependencies = [ + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] [[package]] name = "egl" version = "0.1.0" -source = "git+https://github.com/servo/rust-egl#328e79b6256dea346f1821ccc4215e95fd1d58bc" +source = "git+https://github.com/servo/rust-egl#c0159346b3adfdcf13f2cd86f5ee41750a72c078" +dependencies = [ + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "encoding" -version = "0.2.25" +version = "0.2.32" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "encoding-index-japanese 1.20141219.2 (registry+https://github.com/rust-lang/crates.io-index)", - "encoding-index-korean 1.20141219.1 (registry+https://github.com/rust-lang/crates.io-index)", - "encoding-index-simpchinese 1.20141219.1 (registry+https://github.com/rust-lang/crates.io-index)", - "encoding-index-singlebyte 1.20141219.1 (registry+https://github.com/rust-lang/crates.io-index)", - "encoding-index-tradchinese 1.20141219.2 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-japanese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-korean 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-simpchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-singlebyte 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-tradchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "encoding-index-japanese" -version = "1.20141219.2" +version = "1.20141219.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "encoding_index_tests 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "encoding-index-korean" -version = "1.20141219.1" +version = "1.20141219.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "encoding_index_tests 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "encoding-index-simpchinese" -version = "1.20141219.1" +version = "1.20141219.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "encoding_index_tests 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "encoding-index-singlebyte" -version = "1.20141219.1" +version = "1.20141219.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "encoding_index_tests 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "encoding-index-tradchinese" -version = "1.20141219.2" +version = "1.20141219.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "encoding_index_tests 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "encoding_index_tests" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "errno" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "expat-sys" version = "2.1.0" -source = "git+https://github.com/servo/libexpat#523a2f2f51b41adf7bb5c4c65e80db0cb615d70b" +source = "git+https://github.com/servo/libexpat#5f798cfbb74650a5e1d95e4c03a9e41e55e28625" [[package]] name = "flate2" -version = "0.2.0" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] +name = "fnv" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "fontconfig" version = "0.1.0" -source = "git+https://github.com/servo/rust-fontconfig#91195bd29daa9280680bb28ba556821d504a17c6" +source = "git+https://github.com/servo/rust-fontconfig#7839e5adcb4d6da3cefe2256f5071ac0203b9206" dependencies = [ "fontconfig-sys 2.11.1 (git+https://github.com/servo/libfontconfig)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "fontconfig-sys" version = "2.11.1" -source = "git+https://github.com/servo/libfontconfig#adc60cacbca697123f4535ce2ff07619ec013cec" +source = "git+https://github.com/servo/libfontconfig#ce4a38633dc649b95c9b4935c0cce53e76d8b46a" dependencies = [ "expat-sys 2.1.0 (git+https://github.com/servo/libexpat)", "freetype-sys 2.4.11 (git+https://github.com/servo/libfreetype2)", @@ -288,38 +313,28 @@ name = "freetype" version = "0.1.0" source = "git+https://github.com/servo/rust-freetype#f256a9ac84893f0a183b8966de2a3a03d7552b8b" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "freetype-sys" version = "2.4.11" -source = "git+https://github.com/servo/libfreetype2#a488dfd86872bf9c163d54a7f73a5dc4d3c4fd9e" - -[[package]] -name = "gcc" -version = "0.3.1" -source = "git+https://github.com/alexcrichton/gcc-rs#564247d019449ba46f25f64ffdefade5968b6ae7" +source = "git+https://github.com/servo/libfreetype2#50c1cf412d87f20ccbb940e39a14a38ae7cbb512" [[package]] name = "gcc" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "gdi32-sys" -version = "0.1.0" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "geom" version = "0.1.0" -source = "git+https://github.com/servo/rust-geom#c47fc0f927b6d6e5543fe3b5445c86810831dce1" +source = "git+https://github.com/servo/rust-geom#c4bdb1ef8f4915ae636eb752b103f69246b50304" dependencies = [ - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -336,20 +351,20 @@ dependencies = [ "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "harfbuzz 0.1.0 (git+https://github.com/servo/rust-harfbuzz)", "layers 0.1.0 (git+https://github.com/servo/rust-layers)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", "plugins 0.0.1", "png 0.1.0 (git+https://github.com/servo/rust-png)", - "profile 0.0.1", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "profile_traits 0.0.1", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "script_traits 0.0.1", - "skia 0.0.20130412 (git+https://github.com/servo/skia?branch=upstream-2014-06-16)", + "skia 0.0.20130412 (git+https://github.com/servo/skia)", "stb_image 0.1.0 (git+https://github.com/servo/rust-stb-image)", - "string_cache 0.0.0 (git+https://github.com/servo/string-cache)", + "string_cache 0.1.0 (git+https://github.com/servo/string-cache)", "style 0.0.1", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] @@ -358,124 +373,118 @@ name = "gl_common" version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gl_generator" -version = "0.0.19" +version = "0.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "khronos_api 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "xml-rs 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "xml-rs 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gleam" version = "0.0.1" -source = "git+https://github.com/servo/gleam#70c5f2ea3ef3602277b7c380c24b504e42338056" +source = "git+https://github.com/servo/gleam#f2edabf2ef0474bb270b107e5e68c2727c4a422d" dependencies = [ "gl_common 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gl_generator 0.0.19 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "khronos_api 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "glutin" -version = "0.0.7" -source = "git+https://github.com/servo/glutin?branch=servo#0feab4842c5b229bfe88739d2c526d03c198fd33" -dependencies = [ - "android_glue 0.0.1 (git+https://github.com/tomaka/android-rs-glue)", - "cocoa 0.1.1 (git+https://github.com/servo/rust-cocoa)", - "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", - "core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)", - "gdi32-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gl_common 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gl_generator 0.0.19 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "khronos_api 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "user32-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "glx" version = "0.0.1" -source = "git+https://github.com/servo/rust-glx#f2103861d38076ef5e01a8c2f58df1e79ca12f41" +source = "git+https://github.com/servo/rust-glx#60ac0aee2438eadb4b51ddc8eac6fc4b5ca8e447" dependencies = [ "gl_common 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gl_generator 0.0.19 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "khronos_api 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "harfbuzz" version = "0.1.0" -source = "git+https://github.com/servo/rust-harfbuzz#cc875777f820da0b85f39c2359d9609650b16600" +source = "git+https://github.com/servo/rust-harfbuzz#33b6fd019fc04e46dd5fe15a5faf8efb1a9a0128" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "html5ever" version = "0.0.0" -source = "git+https://github.com/servo/html5ever#8bad1ca8e1e05a7972be80acc64efd729ffdc8a5" +source = "git+https://github.com/servo/html5ever#74dc5f5a36451cfbe789488b20d51bef97c63898" dependencies = [ "html5ever_macros 0.0.0 (git+https://github.com/servo/html5ever)", - "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "mac 0.0.2 (git+https://github.com/reem/rust-mac)", - "phf 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "phf_macros 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "string_cache 0.0.0 (git+https://github.com/servo/string-cache)", - "string_cache_plugin 0.0.0 (git+https://github.com/servo/string-cache)", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", + "phf 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_macros 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache 0.1.0 (git+https://github.com/servo/string-cache)", + "string_cache_plugin 0.1.1 (git+https://github.com/servo/string-cache)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "html5ever_macros" version = "0.0.0" -source = "git+https://github.com/servo/html5ever#8bad1ca8e1e05a7972be80acc64efd729ffdc8a5" +source = "git+https://github.com/servo/html5ever#74dc5f5a36451cfbe789488b20d51bef97c63898" dependencies = [ "mac 0.0.2 (git+https://github.com/reem/rust-mac)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] +name = "httparse" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "hyper" -version = "0.3.0" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cookie 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "cookie 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "unicase 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "traitobject 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "typeable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "io_surface" version = "0.1.0" -source = "git+https://github.com/servo/rust-io-surface#f380a03a9b0e0316866d4320d46a78dda87efbec" +source = "git+https://github.com/servo/rust-io-surface#ab0ebd4ea6dd953c1581d9486b9e80ecf3c7577d" dependencies = [ "cgl 0.0.1 (git+https://github.com/servo/rust-cgl)", "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gleam 0.0.1 (git+https://github.com/servo/gleam)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "js" version = "0.1.0" -source = "git+https://github.com/servo/rust-mozjs#402b7b2db8816ffeccacfa9a8d316f4487e96ba0" +source = "git+https://github.com/servo/rust-mozjs#30a1ad31d1ee47a8e4e1ef582e793badfb405fa0" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "mozjs_sys 0.0.0 (git+https://github.com/servo/mozjs)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -494,7 +503,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "layers" version = "0.1.0" -source = "git+https://github.com/servo/rust-layers#df3a14d00260c8ab506565972555931444361ff8" +source = "git+https://github.com/servo/rust-layers#018259e838c3842032010829feeaba316e577376" dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure)", "cgl 0.0.1 (git+https://github.com/servo/rust-cgl)", @@ -504,8 +513,10 @@ dependencies = [ "gleam 0.0.1 (git+https://github.com/servo/gleam)", "glx 0.0.1 (git+https://github.com/servo/rust-glx)", "io_surface 0.1.0 (git+https://github.com/servo/rust-io-surface)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "skia 0.0.20130412 (git+https://github.com/servo/skia?branch=upstream-2014-06-16)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "skia 0.0.20130412 (git+https://github.com/servo/skia)", "xlib 0.1.0 (git+https://github.com/servo/rust-xlib)", ] @@ -516,26 +527,26 @@ dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure)", "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "canvas 0.0.1", - "clock_ticks 0.0.4 (git+https://github.com/tomaka/clock_ticks)", - "cssparser 0.2.0 (git+https://github.com/servo/rust-cssparser)", - "encoding 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)", + "clock_ticks 0.0.5 (git+https://github.com/tomaka/clock_ticks)", + "cssparser 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gfx 0.0.1", "layout_traits 0.0.1", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", "plugins 0.0.1", "png 0.1.0 (git+https://github.com/servo/rust-png)", - "profile 0.0.1", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "profile_traits 0.0.1", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "script 0.0.1", "script_traits 0.0.1", "selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", - "string_cache 0.0.0 (git+https://github.com/servo/string-cache)", - "string_cache_plugin 0.0.0 (git+https://github.com/servo/string-cache)", + "string_cache 0.1.0 (git+https://github.com/servo/string-cache)", + "string_cache_plugin 0.1.1 (git+https://github.com/servo/string-cache)", "style 0.0.1", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] @@ -546,34 +557,37 @@ dependencies = [ "gfx 0.0.1", "msg 0.0.1", "net_traits 0.0.1", - "profile 0.0.1", + "profile_traits 0.0.1", "script_traits 0.0.1", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] [[package]] name = "lazy_static" -version = "0.1.8" -source = "git+https://github.com/Kimundi/lazy-static.rs#56b4be4141d3c58273cf5ee1d2e956e2f22248b9" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.1.2" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libressl-pnacl-sys" -version = "2.1.4" +version = "2.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "pnacl-build-helper 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "pnacl-build-helper 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "log" -version = "0.2.5" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "mac" @@ -581,12 +595,9 @@ version = "0.0.2" source = "git+https://github.com/reem/rust-mac#6316d3f4663756180fd236b126a84e245e978765" [[package]] -name = "malloc_buf" -version = "0.0.5" +name = "mac" +version = "0.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "matches" @@ -598,21 +609,21 @@ name = "mime" version = "0.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "miniz-sys" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "mod_path" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -628,11 +639,12 @@ dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", - "hyper 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "io_surface 0.1.0 (git+https://github.com/servo/rust-io-surface)", "layers 0.1.0 (git+https://github.com/servo/rust-layers)", + "png 0.1.0 (git+https://github.com/servo/rust-png)", "style 0.0.1", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "webdriver_traits 0.0.1", ] @@ -641,20 +653,21 @@ dependencies = [ name = "net" version = "0.0.1" dependencies = [ - "cookie 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cookie 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", + "devtools_traits 0.0.1", + "flate2 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", - "hyper 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "net_traits 0.0.1", - "openssl 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "png 0.1.0 (git+https://github.com/servo/rust-png)", - "profile 0.0.1", - "regex 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "regex_macros 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", + "regex_macros 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", + "uuid 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -662,90 +675,103 @@ name = "net_traits" version = "0.0.1" dependencies = [ "geom 0.1.0 (git+https://github.com/servo/rust-geom)", - "hyper 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "msg 0.0.1", "png 0.1.0 (git+https://github.com/servo/rust-png)", - "profile 0.0.1", "stb_image 0.1.0 (git+https://github.com/servo/rust-stb-image)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] [[package]] -name = "objc" -version = "0.1.3" +name = "num" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num_cpus" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "malloc_buf 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "offscreen_gl_context" version = "0.0.1" -source = "git+https://github.com/ecoal95/rust-offscreen-rendering-context#9547d416019b15e0e59dc5176f5b1a14e14b44ca" +source = "git+https://github.com/ecoal95/rust-offscreen-rendering-context#c2b3dfd7fe344384e4206672b99c296141f5b4d6" dependencies = [ "cgl 0.0.1 (git+https://github.com/servo/rust-cgl)", + "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gleam 0.0.1 (git+https://github.com/servo/gleam)", "glx 0.0.1 (git+https://github.com/servo/rust-glx)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "xlib 0.1.0 (git+https://github.com/servo/rust-xlib)", ] [[package]] name = "openssl" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "openssl-sys" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libressl-pnacl-sys 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libressl-pnacl-sys 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "phf" -version = "0.6.12" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "phf_shared 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "debug-builders 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "phf_generator" -version = "0.6.12" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "phf_shared 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "phf_macros" -version = "0.6.12" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "phf_generator 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "phf_shared 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_generator 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "phf_shared" -version = "0.6.12" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "pkg-config" -version = "0.3.0" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -757,60 +783,76 @@ dependencies = [ [[package]] name = "pnacl-build-helper" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "tempdir 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "png" version = "0.1.0" -source = "git+https://github.com/servo/rust-png#1d9c59c97598014860077f372443ae98b35ff4d9" +source = "git+https://github.com/servo/rust-png#80e765ed1880ea70a8326a13964f57657b9e6fa9" dependencies = [ - "gcc 0.3.1 (git+https://github.com/alexcrichton/gcc-rs)", + "gcc 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "png-sys 1.6.16 (git+https://github.com/servo/rust-png)", ] [[package]] name = "png-sys" version = "1.6.16" -source = "git+https://github.com/servo/rust-png#1d9c59c97598014860077f372443ae98b35ff4d9" +source = "git+https://github.com/servo/rust-png#80e765ed1880ea70a8326a13964f57657b9e6fa9" [[package]] name = "profile" version = "0.0.1" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "profile_traits 0.0.1", + "regex 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", "task_info 0.0.1", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] [[package]] +name = "profile_traits" +version = "0.0.1" +dependencies = [ + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quicksort" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "rand" -version = "0.1.4" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex" -version = "0.1.18" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "regex_macros" -version = "0.1.11" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "regex 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-serialize" -version = "0.3.4" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -819,31 +861,34 @@ version = "0.0.1" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "canvas 0.0.1", - "cssparser 0.2.0 (git+https://github.com/servo/rust-cssparser)", + "cssparser 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "devtools_traits 0.0.1", - "encoding 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gfx 0.0.1", "html5ever 0.0.0 (git+https://github.com/servo/html5ever)", - "hyper 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "js 0.1.0 (git+https://github.com/servo/rust-mozjs)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", + "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", "png 0.1.0 (git+https://github.com/servo/rust-png)", - "profile 0.0.1", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "profile_traits 0.0.1", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "script_traits 0.0.1", "selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", - "string_cache 0.0.0 (git+https://github.com/servo/string-cache)", - "string_cache_plugin 0.0.0 (git+https://github.com/servo/string-cache)", + "string_cache 0.1.0 (git+https://github.com/servo/string-cache)", + "string_cache_plugin 0.1.1 (git+https://github.com/servo/string-cache)", "style 0.0.1", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "uuid 0.1.11 (git+https://github.com/rust-lang/uuid)", + "uuid 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "webdriver_traits 0.0.1", + "websocket 0.11.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -852,10 +897,10 @@ version = "0.0.1" dependencies = [ "devtools_traits 0.0.1", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "webdriver_traits 0.0.1", ] @@ -863,13 +908,15 @@ dependencies = [ [[package]] name = "selectors" version = "0.1.0" -source = "git+https://github.com/servo/rust-selectors#0d7d846090c21d71ebb1bc17921806933a38f52b" +source = "git+https://github.com/servo/rust-selectors#1fda09bf0c59acfcb697f71b38dad22108b3d27a" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.2.0 (git+https://github.com/servo/rust-cssparser)", + "cssparser 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "string_cache 0.0.0 (git+https://github.com/servo/string-cache)", - "string_cache_plugin 0.0.0 (git+https://github.com/servo/string-cache)", + "quicksort 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache 0.1.0 (git+https://github.com/servo/string-cache)", + "string_cache_plugin 0.1.1 (git+https://github.com/servo/string-cache)", ] [[package]] @@ -882,14 +929,16 @@ dependencies = [ "devtools_traits 0.0.1", "gfx 0.0.1", "layout 0.0.1", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net 0.0.1", "net_traits 0.0.1", "png 0.1.0 (git+https://github.com/servo/rust-png)", "profile 0.0.1", + "profile_traits 0.0.1", "script 0.0.1", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "webdriver_server 0.0.1", ] @@ -897,56 +946,71 @@ dependencies = [ [[package]] name = "skia" version = "0.0.20130412" -source = "git+https://github.com/servo/skia?branch=upstream-2014-06-16#db5b5393c83da9ff5b8fb2076481e98fb2b659f2" +source = "git+https://github.com/servo/skia#d60e6753b2b23b3b4ff787b505da56cfad0335c9" dependencies = [ "expat-sys 2.1.0 (git+https://github.com/servo/libexpat)", "freetype-sys 2.4.11 (git+https://github.com/servo/libfreetype2)", ] [[package]] +name = "smallvec" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "stb_image" version = "0.1.0" -source = "git+https://github.com/servo/rust-stb-image#b683cc9e7ba52a1bb65361347da0df1bc9c5e854" +source = "git+https://github.com/servo/rust-stb-image#f6c411b381322609a321b7fb5f948b2365973604" +dependencies = [ + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "string_cache" -version = "0.0.0" -source = "git+https://github.com/servo/string-cache#124cb555651bd7838c5c6dc4788bc4f5350947a9" +version = "0.1.0" +source = "git+https://github.com/servo/string-cache#c5912f925e9c1db7dbe4a7980fbc3eed08eef51d" dependencies = [ - "lazy_static 0.1.8 (git+https://github.com/Kimundi/lazy-static.rs)", - "phf 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "phf_macros 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "string_cache_plugin 0.0.0 (git+https://github.com/servo/string-cache)", + "lazy_static 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "phf 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_macros 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache_plugin 0.1.1 (git+https://github.com/servo/string-cache)", + "string_cache_shared 0.1.0 (git+https://github.com/servo/string-cache)", ] [[package]] name = "string_cache_plugin" -version = "0.0.0" -source = "git+https://github.com/servo/string-cache#124cb555651bd7838c5c6dc4788bc4f5350947a9" +version = "0.1.1" +source = "git+https://github.com/servo/string-cache#c5912f925e9c1db7dbe4a7980fbc3eed08eef51d" dependencies = [ - "lazy_static 0.1.8 (git+https://github.com/Kimundi/lazy-static.rs)", - "mac 0.0.2 (git+https://github.com/reem/rust-mac)", + "lazy_static 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache_shared 0.1.0 (git+https://github.com/servo/string-cache)", ] [[package]] +name = "string_cache_shared" +version = "0.1.0" +source = "git+https://github.com/servo/string-cache#c5912f925e9c1db7dbe4a7980fbc3eed08eef51d" + +[[package]] name = "style" version = "0.0.1" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.2.0 (git+https://github.com/servo/rust-cssparser)", - "encoding 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", - "lazy_static 0.1.8 (git+https://github.com/Kimundi/lazy-static.rs)", + "lazy_static 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "mod_path 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "mod_path 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", - "string_cache 0.0.0 (git+https://github.com/servo/string-cache)", - "string_cache_plugin 0.0.0 (git+https://github.com/servo/string-cache)", - "text_writer 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache 0.1.0 (git+https://github.com/servo/string-cache)", + "string_cache_plugin 0.1.1 (git+https://github.com/servo/string-cache)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", ] @@ -955,44 +1019,49 @@ name = "task_info" version = "0.0.1" [[package]] +name = "tempdir" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "tenacious" version = "0.0.1" source = "git+https://github.com/Manishearth/rust-tenacious.git#d61782e70005a9f0cdf66f366d4ec88fc563ea1e" [[package]] -name = "text_writer" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] name = "time" -version = "0.1.19" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "unicase" -version = "0.0.5" +name = "traitobject" +version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "url" -version = "0.2.23" +name = "typeable" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] -name = "user32-sys" +name = "unicase" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "url" +version = "0.2.31" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1001,49 +1070,43 @@ version = "0.0.1" dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure)", "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.2.0 (git+https://github.com/servo/rust-cssparser)", + "cssparser 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "layers 0.1.0 (git+https://github.com/servo/rust-layers)", - "lazy_static 0.1.8 (git+https://github.com/Kimundi/lazy-static.rs)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", - "rand 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", - "string_cache 0.0.0 (git+https://github.com/servo/string-cache)", - "string_cache_plugin 0.0.0 (git+https://github.com/servo/string-cache)", - "text_writer 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "uuid" -version = "0.1.11" -source = "git+https://github.com/rust-lang/uuid#c7862508f84b114d22bb68ec01202eafc50a81b2" -dependencies = [ - "rand 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache 0.1.0 (git+https://github.com/servo/string-cache)", + "string_cache_plugin 0.1.1 (git+https://github.com/servo/string-cache)", + "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uuid" -version = "0.1.11" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "webdriver" -version = "0.0.1" -source = "git+https://github.com/jgraham/webdriver-rust.git#fa625e3cf8fdb39b503c1cc902506df3a1d1c9de" +version = "0.1.0" +source = "git+https://github.com/jgraham/webdriver-rust.git#c2038b4195ee8cd982079cc48d6a9d039f59f1fb" dependencies = [ - "hyper 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "uuid 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1051,11 +1114,12 @@ name = "webdriver_server" version = "0.0.1" dependencies = [ "msg 0.0.1", - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "png 0.1.0 (git+https://github.com/servo/rust-png)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "uuid 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "webdriver 0.0.1 (git+https://github.com/jgraham/webdriver-rust.git)", + "uuid 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "webdriver 0.1.0 (git+https://github.com/jgraham/webdriver-rust.git)", "webdriver_traits 0.0.1", ] @@ -1063,7 +1127,22 @@ dependencies = [ name = "webdriver_traits" version = "0.0.1" dependencies = [ - "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "websocket" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1071,7 +1150,7 @@ name = "winapi" version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1080,12 +1159,12 @@ version = "0.1.0" source = "git+https://github.com/servo/rust-xlib#1a0f3d48fbebf96e2d1bf83ac71309b27f49e0c7" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "xml-rs" -version = "0.1.20" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/ports/gonk/Cargo.toml b/ports/gonk/Cargo.toml index 5ed55793d43..cf681e7edf7 100644 --- a/ports/gonk/Cargo.toml +++ b/ports/gonk/Cargo.toml @@ -57,4 +57,5 @@ git = "https://github.com/servo/gleam" [dependencies] url = "0.2.16" time = "0.1.17" +errno = "*" libc = "*" diff --git a/ports/gonk/src/input.rs b/ports/gonk/src/input.rs index 54e54b87784..bac48d43162 100644 --- a/ports/gonk/src/input.rs +++ b/ports/gonk/src/input.rs @@ -8,9 +8,7 @@ use std::path::Path; use std::mem::size_of; use std::mem::transmute; use std::mem::zeroed; -use std::os::errno; -use std::os::unix::AsRawFd; -use std::num::Float; +use std::os::unix::io::AsRawFd; use std::fs::File; use std::thread; use std::sync::mpsc::Sender; @@ -18,6 +16,7 @@ use std::io::Read; use geom::point::TypedPoint2D; +use errno::errno; use libc::c_int; use libc::c_long; use libc::time_t; @@ -135,7 +134,7 @@ fn read_input_device(device_path: &Path, let mut last_dist: f32 = 0f32; let mut touch_count: i32 = 0; - let mut current_slot: uint = 0; + let mut current_slot: usize = 0; // XXX: Need to use the real dimensions of the screen let screen_dist = dist(0, 480, 854, 0); loop { @@ -154,7 +153,7 @@ fn read_input_device(device_path: &Path, let count = read / size_of::<linux_input_event>(); let events: *mut linux_input_event = unsafe { transmute(buf.as_mut_ptr()) }; let mut tracking_updated = false; - for idx in 0..(count as int) { + for idx in 0..(count as isize) { let event: &linux_input_event = unsafe { transmute(events.offset(idx)) }; match (event.evt_type, event.code) { (EV_SYN, EV_REPORT) => { @@ -204,8 +203,8 @@ fn read_input_device(device_path: &Path, }, (EV_SYN, _) => println!("Unknown SYN code {}", event.code), (EV_ABS, ABS_MT_SLOT) => { - if (event.value as uint) < slots.len() { - current_slot = event.value as uint; + if (event.value as usize) < slots.len() { + current_slot = event.value as usize; } else { println!("Invalid slot! {}", event.value); } diff --git a/ports/gonk/src/lib.rs b/ports/gonk/src/lib.rs index 6d4a2d517bb..3174c5294ee 100644 --- a/ports/gonk/src/lib.rs +++ b/ports/gonk/src/lib.rs @@ -4,8 +4,7 @@ #![feature(thread_local)] #![feature(box_syntax)] -#![feature(int_uint)] -#![feature(path, rustc_private)] +#![feature(rustc_private)] // For FFI #![allow(non_snake_case, dead_code)] @@ -104,7 +103,7 @@ impl Browser { }); // Create a Servo instance. - let resource_task = new_resource_task(opts.user_agent.clone()); + let resource_task = new_resource_task(opts.user_agent.clone(), devtools_chan.clone()); let image_cache_task = new_image_cache_task(resource_task.clone()); let font_cache_task = FontCacheTask::new(resource_task.clone()); diff --git a/ports/gonk/src/main.rs b/ports/gonk/src/main.rs index 5a6af9db9ef..335fdd361b6 100644 --- a/ports/gonk/src/main.rs +++ b/ports/gonk/src/main.rs @@ -6,8 +6,7 @@ #![deny(unused_variables)] #![feature(box_syntax)] -#![feature(int_uint)] -#![feature(core, os, path, io, std_misc)] +#![feature(convert)] // For FFI #![allow(non_snake_case, dead_code)] @@ -27,6 +26,7 @@ extern crate servo; extern crate time; extern crate util; +extern crate errno; extern crate compositing; extern crate script_traits; diff --git a/ports/gonk/src/window.rs b/ports/gonk/src/window.rs index 6c3258972a6..621804640bc 100644 --- a/ports/gonk/src/window.rs +++ b/ports/gonk/src/window.rs @@ -60,7 +60,7 @@ pub struct native_handle { pub struct ANativeBase { magic: u32, version: u32, - reserved: [int; 4], + reserved: [isize; 4], incRef: extern fn(*mut ANativeBase), decRef: extern fn(*mut ANativeBase), } @@ -86,7 +86,7 @@ pub struct ANativeWindow { maxSwapInterval: c_int, xdpi: f32, ydpi: f32, - oem: [int; 4], + oem: [isize; 4], setSwapInterval: extern fn(*mut ANativeWindow, c_int) -> c_int, //dequeueBuffer_DEPRECATED: extern fn(*mut ANativeWindow, *mut *mut ANativeWindowBuffer) -> c_int, //lockBuffer_DEPRECATED: extern fn(*mut ANativeWindow, *mut ANativeWindowBuffer) -> c_int, @@ -342,7 +342,7 @@ extern fn dequeueBuffer(base: *mut ANativeWindow, buf: *mut *mut ANativeWindowBu unsafe { let window: &mut GonkNativeWindow = transmute(base); for idx in 0..window.bufs.len() { - if idx == window.last_idx as uint { + if idx == window.last_idx as usize { continue; } match window.bufs[idx] { @@ -695,7 +695,7 @@ impl Window { egl::EGL_ALPHA_SIZE, 0, egl::EGL_NONE, 0]; - let mut config: EGLConfig = unsafe { transmute(0i) }; + let mut config: EGLConfig = unsafe { transmute(0isize) }; let mut num_config: EGLint = 0; let ret2 = unsafe { diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py index ca9075a48f0..1a8a8947843 100644 --- a/python/servo/build_commands.py +++ b/python/servo/build_commands.py @@ -136,6 +136,8 @@ class MachCommands(CommandBase): status = subprocess.call( make_cmd + ["-f", "openssl.makefile"], env=self.build_env()) + if status: + return status openssl_dir = path.join(self.android_support_dir(), "openssl-1.0.1k") env['OPENSSL_LIB_DIR'] = openssl_dir env['OPENSSL_INCLUDE_DIR'] = path.join(openssl_dir, "include") diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 5b3ad797c03..8047bf44179 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -168,7 +168,7 @@ class CommandBase(object): env["GONKDIR"] = self.config["gonk"]["b2g"] if "GONKDIR" not in env: # Things can get pretty opaque if this hasn't been set - print("Please set $GONKDIR in your environment or servobild file") + print("Please set $GONKDIR in your environment or .servobuild file") sys.exit(1) if self.config["gonk"]["product"]: env["GONK_PRODUCT"] = self.config["gonk"]["product"] diff --git a/python/tidy.py b/python/tidy.py index 07eebf80677..780cfca647e 100644 --- a/python/tidy.py +++ b/python/tidy.py @@ -72,12 +72,10 @@ def check_length(idx, line): yield (idx + 1, "(much) overlong line") def check_whatwg_url(idx, line): - matches = re.findall(r'whatwg.org/multipage.*#', line); - if matches: - for i, match in enumerate(matches): - parts = match.split('multipage') - if len(parts[1]) > 1 and parts[1][1] != '#': - yield (idx + 1, "URL should not point to specific WHATWG multipage page!") + match = re.search(r"https://html\.spec\.whatwg\.org/multipage/[\w-]+\.html#([\w\:-]+)", line) + if match is not None: + preferred_link = "https://html.spec.whatwg.org/multipage/#{}".format(match.group(1)) + yield (idx + 1, "link to WHATWG may break in the future, use this format instead: {}".format(preferred_link)) def check_whitespace(idx, line): if line[-1] == "\n": diff --git a/rust-snapshot-hash b/rust-snapshot-hash index edeea6b61f2..377c6efc0b2 100644 --- a/rust-snapshot-hash +++ b/rust-snapshot-hash @@ -1 +1 @@ -d3c49d2140fc65e8bb7d7cf25bfe74dda6ce5ecf/rustc-1.0.0-dev +551a74dddd84cf01440ee84148ebd18bc68bd7c8/rustc-1.1.0-dev diff --git a/support/android-rs-glue b/support/android-rs-glue -Subproject 34f588aace4d05ce42f4ca605d5470df8fdd236 +Subproject 10116eb3af332f9565e0fb803e600511bb585d6 diff --git a/tests/html/test-websocket.html b/tests/html/test-websocket.html new file mode 100644 index 00000000000..2ff209e38d4 --- /dev/null +++ b/tests/html/test-websocket.html @@ -0,0 +1,69 @@ +<!DOCTYPE html> + +<meta charset="utf-8" /> + +<title>WebSocket Test</title> + +<script language="javascript" type="text/javascript"> + +var wsUri = "ws://echo.websocket.org/"; +var output; + +function init() { + output = document.getElementById("output"); + testWebSocket(); +} + +function testWebSocket() { + websocket = new WebSocket(wsUri); + websocket.onopen = function(evt) { + onOpen(evt) + }; + websocket.onclose = function(evt) { + onClose(evt) + }; + websocket.onmessage = function(evt) { + onMessage(evt) + }; + websocket.onerror = function(evt) { + onError(evt) + }; +} + +function onOpen(evt) { + writeToScreen("CONNECTED"); + doSend("WebSocket rocks"); +} + +function onClose(evt) { + writeToScreen("DISCONNECTED"); +} + +function onMessage(evt) { + writeToScreen('<span style="color: blue;">RESPONSE: ' + evt.data+'</span>'); + websocket.close(); +} + +function onError(evt) { + writeToScreen('<span style="color: red;">ERROR:</span> ' + evt.data); +} + +function doSend(message) { + writeToScreen("SENT: " + message); + websocket.send(message); +} + +function writeToScreen(message) { + var pre = document.createElement("p"); + pre.style.wordWrap = "break-word"; + pre.innerHTML = message; + output.appendChild(pre); +} + +window.addEventListener("load", init, false); + +</script> + +<h2>WebSocket Test</h2> + +<div id="output"></div> diff --git a/tests/html/test_mouse_down_mouse_up_click.html b/tests/html/test_mouse_down_mouse_up_click.html new file mode 100644 index 00000000000..84cf8d7c954 --- /dev/null +++ b/tests/html/test_mouse_down_mouse_up_click.html @@ -0,0 +1,14 @@ +<body> +<input id="clicked"> +<script> + document.getElementById("clicked").addEventListener("mousedown", function () { + window.alert("mousedown"); }, + false); + document.getElementById("clicked").addEventListener('mouseup', function() { + window.alert("mouseup"); }, + false); + document.getElementById("clicked").addEventListener("click", function() { + window.alert("clicked"); }, + false); +</script> +</body> diff --git a/tests/html/test_request_animation_frame.html b/tests/html/test_request_animation_frame.html new file mode 100644 index 00000000000..29ebac99348 --- /dev/null +++ b/tests/html/test_request_animation_frame.html @@ -0,0 +1,5 @@ +<script> +window.requestAnimationFrame(function (time) { + alert("time " + time); +}); +</script> diff --git a/tests/html/test_webgl_triangle.html b/tests/html/test_webgl_triangle.html new file mode 100644 index 00000000000..b55a746b4a2 --- /dev/null +++ b/tests/html/test_webgl_triangle.html @@ -0,0 +1,108 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8" /> + <title>WebGL Triangle Test</title> +</head> +<body> +<div style="text-align: center"> + <canvas id="canvas" width="512" height="512"></canvas> +</div> +<script id="vertexshader" type="x-shader"> + attribute vec2 aVertexPosition; + attribute vec4 aColour; + varying vec4 aVertexColor; + + void main() { + aVertexColor = aColour; + gl_Position = vec4(aVertexPosition, 0.0, 1.0); + } +</script> +<script id="fragmentshader" type="x-shader"> + #ifdef GL_ES + precision highp float; + #endif + + varying vec4 aVertexColor; + + void main() { + gl_FragColor = aVertexColor; + } +</script> +<script type="text/javascript"> + + var canvas; + function initWebGL() + { + canvas = document.getElementById("canvas"); + var gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); + if (!gl) return null; // can't initialize WebGL + return gl; + } + + var gl = initWebGL(); + + // Setup Shaders: + var v = document.getElementById("vertexshader").firstChild.nodeValue; + var f = document.getElementById("fragmentshader").firstChild.nodeValue; + + var vs = gl.createShader(gl.VERTEX_SHADER); + gl.shaderSource(vs, v); + gl.compileShader(vs); + + if (!gl.getShaderParameter(vs, gl.COMPILE_STATUS)) { + alert(gl.getShaderInfoLog(vs)); + } + + var fs = gl.createShader(gl.FRAGMENT_SHADER); + gl.shaderSource(fs, f); + gl.compileShader(fs); + + if (!gl.getShaderParameter(fs, gl.COMPILE_STATUS)) { + alert(gl.getShaderInfoLog(fs)); + } + + program = gl.createProgram(); + gl.attachShader(program, vs); + gl.attachShader(program, fs); + gl.linkProgram(program); + + // if (!gl.getProgramParameter(program, gl.LINK_STATUS)) + // alert(gl.getProgramInfoLog(program)); + + // Setup Geometry + var vertices = new Float32Array([ + -0.5,-0.5, 0.5,-0.5, 0.0,0.5, // Triangle-Coordinates + 1.0, 0.0, 0.0, 1.0, + 0.0, 1.0, 0.0, 1.0, + 0.0, 0.0, 1.0, 1.0, + ]); + + vbuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, vbuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + + itemSize = 2; // we have 2 coordinates (x,y) + numItems = vertices.length / itemSize; // number of vertices + + // Viewport + gl.viewport(0, 0, canvas.width, canvas.height); + gl.clearColor(0, 0, 0, 1); + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); + + // Setup Geometry + gl.useProgram(program); + + program.aVertexPosition = gl.getAttribLocation(program, "aVertexPosition"); + gl.enableVertexAttribArray(program.aVertexPosition); + gl.vertexAttribPointer(program.aVertexPosition, itemSize, gl.FLOAT, false, 0, 0); + + program.aColour = gl.getAttribLocation(program, "aColour"); + gl.enableVertexAttribArray(program.aColour); + gl.vertexAttribPointer(program.aColour, 4, gl.FLOAT, false, 0, 24); + + // Draw + gl.drawArrays(gl.TRIANGLES, 0, 3); +</script> +</body> +</html> diff --git a/tests/ref/basic.list b/tests/ref/basic.list index aa20b7fb70e..fd5197b13a0 100644 --- a/tests/ref/basic.list +++ b/tests/ref/basic.list @@ -9,39 +9,9 @@ # Should be == with expected failure: fragment=top != ../html/acid2.html acid2_ref.html -== 2dcontext/drawimage_canvas_1.html 2dcontext/drawimage_canvas_1_ref.html -== 2dcontext/drawimage_canvas_10.html 2dcontext/drawimage_canvas_10_ref.html -== 2dcontext/drawimage_canvas_11.html 2dcontext/drawimage_canvas_11_ref.html -== 2dcontext/drawimage_canvas_12.html 2dcontext/drawimage_canvas_12_ref.html -== 2dcontext/drawimage_canvas_2.html 2dcontext/drawimage_canvas_2_ref.html -== 2dcontext/drawimage_canvas_3.html 2dcontext/drawimage_canvas_3_ref.html -== 2dcontext/drawimage_canvas_4.html 2dcontext/drawimage_canvas_4_ref.html -== 2dcontext/drawimage_canvas_5.html 2dcontext/drawimage_canvas_5_ref.html -== 2dcontext/drawimage_canvas_6.html 2dcontext/drawimage_canvas_6_ref.html -== 2dcontext/drawimage_canvas_7.html 2dcontext/drawimage_canvas_7_ref.html -== 2dcontext/drawimage_canvas_8.html 2dcontext/drawimage_canvas_8_ref.html -== 2dcontext/drawimage_canvas_9.html 2dcontext/drawimage_canvas_9_ref.html -== 2dcontext/drawimage_html_image_1.html 2dcontext/drawimage_html_image_1_ref.html -== 2dcontext/drawimage_html_image_10.html 2dcontext/drawimage_html_image_10_ref.html -== 2dcontext/drawimage_html_image_11.html 2dcontext/drawimage_html_image_11_ref.html -== 2dcontext/drawimage_html_image_12.html 2dcontext/drawimage_html_image_12_ref.html -== 2dcontext/drawimage_html_image_2.html 2dcontext/drawimage_html_image_2_ref.html -== 2dcontext/drawimage_html_image_3.html 2dcontext/drawimage_html_image_3_ref.html -== 2dcontext/drawimage_html_image_4.html 2dcontext/drawimage_html_image_4_ref.html -== 2dcontext/drawimage_html_image_5.html 2dcontext/drawimage_html_image_5_ref.html -== 2dcontext/drawimage_html_image_6.html 2dcontext/drawimage_html_image_6_ref.html -== 2dcontext/drawimage_html_image_7.html 2dcontext/drawimage_html_image_7_ref.html -== 2dcontext/drawimage_html_image_8.html 2dcontext/drawimage_html_image_8_ref.html -== 2dcontext/drawimage_html_image_9.html 2dcontext/drawimage_html_image_9_ref.html - - == 2dcontext/lineto_a.html 2dcontext/lineto_ref.html == 2dcontext/transform_a.html 2dcontext/transform_ref.html -== abs_float_pref_width_a.html abs_float_pref_width_ref.html -== absolute_clipping_of_own_contents_a.html absolute_clipping_of_own_contents_ref.html -== absolute_content_height_a.html absolute_content_height_ref.html -== absolute_hypothetical_float_a.html absolute_hypothetical_float_ref.html == acid1_a.html acid1_b.html == acid2_noscroll.html acid2_ref_broken.html == after_block_iteration.html after_block_iteration_ref.html @@ -70,6 +40,7 @@ flaky_cpu == append_style_a.html append_style_b.html == block_formatting_context_cleared_float_a.html block_formatting_context_cleared_float_ref.html == block_formatting_context_complex_a.html block_formatting_context_complex_ref.html == block_formatting_context_containing_floats_a.html block_formatting_context_containing_floats_ref.html +== block_formatting_context_float_placement_a.html block_formatting_context_float_placement_ref.html == block_formatting_context_relative_a.html block_formatting_context_ref.html == block_formatting_context_translation_a.html block_formatting_context_translation_ref.html == block_image.html 500x300_green.html @@ -118,6 +89,7 @@ flaky_cpu == append_style_a.html append_style_b.html == first_of_type_pseudo_a.html first_of_type_pseudo_b.html == fixed_width_overrides_child_intrinsic_width_a.html fixed_width_overrides_child_intrinsic_width_ref.html == float_clearance_a.html float_clearance_ref.html +== float_clearance_intrinsic_width_a.html float_clearance_intrinsic_width_ref.html == float_intrinsic_height.html float_intrinsic_height_ref.html == float_intrinsic_width_a.html float_intrinsic_width_ref.html == float_right_intrinsic_width_a.html float_right_intrinsic_width_ref.html @@ -164,6 +136,7 @@ flaky_cpu == append_style_a.html append_style_b.html != inline_background_a.html inline_background_ref.html == inline_block_baseline_a.html inline_block_baseline_ref.html == inline_block_border_a.html inline_block_border_ref.html +== inline_block_border_intrinsic_size_a.html inline_block_border_intrinsic_size_ref.html == inline_block_img_a.html inline_block_img_ref.html == inline_block_margin_a.html inline_block_margin_ref.html == inline_block_min_width.html inline_block_min_width_ref.html @@ -338,6 +311,7 @@ resolution=800x600 == viewport_percentage_vmin_vmax.html viewport_percentage_vmi resolution=600x800 == viewport_percentage_vmin_vmax.html viewport_percentage_vmin_vmax_b.html resolution=800x600 == viewport_percentage_vw_vh.html viewport_percentage_vw_vh_a.html resolution=600x800 == viewport_percentage_vw_vh.html viewport_percentage_vw_vh_b.html +experimental == viewport_rule.html viewport_rule_ref.html == visibility_hidden.html visibility_hidden_ref.html flaky_cpu == webgl-context/clearcolor.html webgl-context/clearcolor_ref.html diff --git a/tests/ref/block_formatting_context_float_placement_a.html b/tests/ref/block_formatting_context_float_placement_a.html new file mode 100644 index 00000000000..33cf261ef8d --- /dev/null +++ b/tests/ref/block_formatting_context_float_placement_a.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<html> +<head> +<style> +#nav-searchbar { + overflow: hidden; +} +.nav-submit-button { + float: right; +} +#nav-search-in { + float: left; +} +.nav-searchfield-width { + height: 35px; + overflow: hidden; + border: solid black 1px; +} +</style> +</head> + +<body> + <form id="nav-searchbar"> + <div class="nav-submit-button">Foo</div><span id="nav-search-in">Bar</span> + <div class="nav-searchfield-width"></div> + </form> +</body> +</html> diff --git a/tests/ref/block_formatting_context_float_placement_ref.html b/tests/ref/block_formatting_context_float_placement_ref.html new file mode 100644 index 00000000000..86e27d5582e --- /dev/null +++ b/tests/ref/block_formatting_context_float_placement_ref.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<html> +<head> +<style> +.nav-submit-button { + float: right; +} +#nav-search-in { + float: left; +} +.nav-searchfield-width { + height: 35px; + overflow: hidden; + border: solid black 1px; +} +</style> +</head> + +<body> + <form id="nav-searchbar"> + <div class="nav-submit-button">Foo</div><span id="nav-search-in">Bar</span> + <div class="nav-searchfield-width"></div> + </form> +</body> +</html> diff --git a/tests/ref/float_clearance_intrinsic_width_a.html b/tests/ref/float_clearance_intrinsic_width_a.html new file mode 100644 index 00000000000..2e9704a5914 --- /dev/null +++ b/tests/ref/float_clearance_intrinsic_width_a.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<html> +<head> +<style> +#nav-your-account { + background: lightblue; + display: inline-block; +} +.nav-button-title { + float: left; + clear: both; +} +</style> +</head> +<body> + <a id="nav-your-account"> + <div class="nav-button-title">Hello.</div> + <div class="nav-button-title">Account</div> + <div class="nav-button-title">Account</div> + <div class="nav-button-title">Account</div> + <div class="nav-button-title">Account</div> + <div class="nav-button-title">Account</div> + </a> +</body> +</html> diff --git a/tests/ref/float_clearance_intrinsic_width_ref.html b/tests/ref/float_clearance_intrinsic_width_ref.html new file mode 100644 index 00000000000..3d498ea2b87 --- /dev/null +++ b/tests/ref/float_clearance_intrinsic_width_ref.html @@ -0,0 +1,21 @@ +<!DOCTYPE html> +<html> +<head> +<style> +#nav-your-account { + background: lightblue; + display: inline-block; +} +</style> +</head> +<body> + <a id="nav-your-account"> + <div class="nav-button-title">Hello.</div> + <div class="nav-button-title">Account</div> + <div class="nav-button-title">Account</div> + <div class="nav-button-title">Account</div> + <div class="nav-button-title">Account</div> + <div class="nav-button-title">Account</div> + </a> +</body> +</html> diff --git a/tests/ref/inline_block_border_intrinsic_size_a.html b/tests/ref/inline_block_border_intrinsic_size_a.html new file mode 100644 index 00000000000..7e8a7e0be19 --- /dev/null +++ b/tests/ref/inline_block_border_intrinsic_size_a.html @@ -0,0 +1,26 @@ +<!DOCTYPE html> +<html> +<head> +<style> +html, body { + margin: 0; + font-size: 0; + line-height: 0; +} +.nav-button-outer { + background: red; + display: inline-block; +} +.nav-down-arrow { + display: inline-block; + border-style: solid; + border-color: black; + border-width: 10px 200px 0 0; +} +</style> +</head> + +<body> + <a class="nav-button-outer"><span class="nav-down-arrow"></span></a> +</body> +</html> diff --git a/tests/ref/inline_block_border_intrinsic_size_ref.html b/tests/ref/inline_block_border_intrinsic_size_ref.html new file mode 100644 index 00000000000..b11fd4f1b8e --- /dev/null +++ b/tests/ref/inline_block_border_intrinsic_size_ref.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<html> +<head> +<style> +html, body { + margin: 0; + font-size: 0; + line-height: 0; +} +.nav-button-outer { + display: inline-block; +} +.nav-down-arrow { + display: inline-block; + border-style: solid; + border-color: black; + border-width: 10px 200px 0 0; +} +</style> +</head> + +<body> + <a class="nav-button-outer"><span class="nav-down-arrow"></span></a> +</body> +</html> diff --git a/tests/ref/viewport_rule.html b/tests/ref/viewport_rule.html new file mode 100644 index 00000000000..bccd08bb79d --- /dev/null +++ b/tests/ref/viewport_rule.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<html> + <head> + <style> + @viewport { + height: auto; + width: 240px; + } + + #container { + background: blue; + height: 100vh; + width: 100vw; + } + + #box { + background: green; + height: 50vh; + width: 50vw; + } + </style> + </head> + <body> + <div id="container"> + <div id="box"> + </div> + </div> + </body> +</html> diff --git a/tests/ref/viewport_rule_ref.html b/tests/ref/viewport_rule_ref.html new file mode 100644 index 00000000000..2cd2b347d3f --- /dev/null +++ b/tests/ref/viewport_rule_ref.html @@ -0,0 +1,24 @@ +<!DOCTYPE html> +<html> + <head> + <style> + #container { + background: blue; + height: 180px; + width: 232px; + } + + #box { + background: green; + height: 90px; + width: 120px; + } + </style> + </head> + <body> + <div id="container"> + <div id="box"> + </div> + </div> + </body> +</html> diff --git a/tests/reftest.rs b/tests/reftest.rs index 4ce8a96cdcb..d7932a783bd 100644 --- a/tests/reftest.rs +++ b/tests/reftest.rs @@ -7,7 +7,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(collections, exit_status, fs_walk, io, old_io, path, path_ext, std_misc, test)] +#![feature(collections, exit_status, fs_walk, path_ext, slice_patterns, test)] #[macro_use] extern crate bitflags; extern crate png; extern crate test; @@ -16,11 +16,9 @@ extern crate url; use std::env; use std::ffi::OsStr; use std::fs::{PathExt, File, walk_dir}; -use std::io::Read; -use std::old_io::{Reader, IoResult}; +use std::io::{self, Read, Result}; use std::path::{Path, PathBuf}; use std::process::{Command, Stdio}; -use std::thunk::Thunk; use test::{AutoColor, DynTestName, DynTestFn, TestDesc, TestOpts, TestDescAndFn, ShouldPanic}; use test::run_tests_console; use url::Url; @@ -72,7 +70,7 @@ fn main() { let maybe_extension = file.extension(); match maybe_extension { Some(extension) => { - if extension == OsStr::from_str("list") && file.is_file() { + if extension == OsStr::new("list") && file.is_file() { let mut tests = parse_lists(&file, servo_args, render_mode, all_tests.len()); println!("\t{} [{} tests]", file.display(), tests.len()); all_tests.append(&mut tests); @@ -102,7 +100,7 @@ fn main() { } fn run(test_opts: TestOpts, all_tests: Vec<TestDescAndFn>, - servo_args: Vec<String>) -> IoResult<bool> { + servo_args: Vec<String>) -> io::Result<bool> { // Verify that we're passing in valid servo arguments. Otherwise, servo // will exit before we've run any tests, and it will appear to us as if // all the tests are failing. @@ -238,7 +236,7 @@ fn make_test(reftest: Reftest) -> TestDescAndFn { ignore: false, should_panic: ShouldPanic::No, }, - testfn: DynTestFn(Thunk::new(move || { + testfn: DynTestFn(Box::new(move || { check_reftest(reftest); })), } diff --git a/tests/unit/net/Cargo.toml b/tests/unit/net/Cargo.toml index 390d6f8ba01..5c265bfec6b 100644 --- a/tests/unit/net/Cargo.toml +++ b/tests/unit/net/Cargo.toml @@ -14,9 +14,6 @@ path = "../../../components/net" [dependencies.net_traits] path = "../../../components/net_traits" -[dependencies.profile] -path = "../../../components/profile" - [dependencies.util] path = "../../../components/util" diff --git a/tests/unit/net/cookie.rs b/tests/unit/net/cookie.rs index afdbd05334b..edf93ba2e05 100644 --- a/tests/unit/net/cookie.rs +++ b/tests/unit/net/cookie.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -extern crate "cookie" as cookie_rs; +extern crate cookie as cookie_rs; use net::cookie::Cookie; use net::cookie_storage::CookieStorage; diff --git a/tests/unit/net/data_loader.rs b/tests/unit/net/data_loader.rs index 517788a0344..b641b58d06a 100644 --- a/tests/unit/net/data_loader.rs +++ b/tests/unit/net/data_loader.rs @@ -20,7 +20,7 @@ fn assert_parse(url: &'static str, use net::data_loader::load; let (start_chan, start_port) = channel(); - load(LoadData::new(Url::parse(url).unwrap()), Channel(start_chan)); + load(LoadData::new(Url::parse(url).unwrap(), None), Channel(start_chan)); let response = start_port.recv().unwrap(); assert_eq!(&response.metadata.content_type, &content_type); diff --git a/tests/unit/net/lib.rs b/tests/unit/net/lib.rs index f44c6fd54cd..29d04d2ee65 100644 --- a/tests/unit/net/lib.rs +++ b/tests/unit/net/lib.rs @@ -2,11 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#![cfg_attr(test, feature(net, alloc, path, io))] +#![cfg_attr(test, feature(alloc))] extern crate net; extern crate net_traits; -extern crate profile; extern crate url; extern crate util; diff --git a/tests/unit/net/mime_classifier.rs b/tests/unit/net/mime_classifier.rs index 8bba57290c5..c44c3c1103a 100644 --- a/tests/unit/net/mime_classifier.rs +++ b/tests/unit/net/mime_classifier.rs @@ -23,7 +23,7 @@ fn read_file(path: &path::Path) -> io::Result<Vec<u8>> { fn test_sniff_mp4_matcher() { let matcher = Mp4Matcher; - let p = PathBuf::new("parsable_mime/video/mp4/test.mp4"); + let p = PathBuf::from("parsable_mime/video/mp4/test.mp4"); let read_result = read_file(&p); match read_result { @@ -43,7 +43,7 @@ fn test_sniff_full(filename_orig: &path::Path,type_string: &str,subtype_string: let current_working_directory = env::current_dir().unwrap(); println!("The current directory is {}", current_working_directory.display()); - let mut filename = PathBuf::new("parsable_mime/"); + let mut filename = PathBuf::from("parsable_mime/"); filename.push(filename_orig); let classifier = MIMEClassifier::new(); @@ -73,7 +73,7 @@ fn test_sniff_full(filename_orig: &path::Path,type_string: &str,subtype_string: #[cfg(test)] fn test_sniff_classification(file: &str,type_string: &str,subtype_string: &str, supplied_type: Option<(&'static str,&'static str)>){ - let mut x = PathBuf::new("./"); + let mut x = PathBuf::from("./"); x.push(type_string); x.push(subtype_string); x.push(file); @@ -181,19 +181,19 @@ fn test_sniff_vsn_ms_fontobject() { #[test] #[should_panic] fn test_sniff_true_type() { - test_sniff_full(&PathBuf::new("unknown/true_type.ttf"), "(TrueType)", "", None); + test_sniff_full(&PathBuf::from("unknown/true_type.ttf"), "(TrueType)", "", None); } #[test] #[should_panic] fn test_sniff_open_type() { - test_sniff_full(&PathBuf::new("unknown/open_type"), "(OpenType)", "", None); + test_sniff_full(&PathBuf::from("unknown/open_type"), "(OpenType)", "", None); } #[test] #[should_panic] fn test_sniff_true_type_collection() { - test_sniff_full(&PathBuf::new("unknown/true_type_collection.ttc"), "(TrueType Collection)", "", None); + test_sniff_full(&PathBuf::from("unknown/true_type_collection.ttc"), "(TrueType Collection)", "", None); } #[test] @@ -435,10 +435,10 @@ fn test_sniff_utf_8_bom() { #[test] fn test_sniff_rss_feed() { - test_sniff_full(&PathBuf::new("text/xml/feed.rss"), "application", "rss+xml", Some(("text", "html"))); + test_sniff_full(&PathBuf::from("text/xml/feed.rss"), "application", "rss+xml", Some(("text", "html"))); } #[test] fn test_sniff_atom_feed() { - test_sniff_full(&PathBuf::new("text/xml/feed.atom"), "application", "atom+xml", Some(("text", "html"))); + test_sniff_full(&PathBuf::from("text/xml/feed.atom"), "application", "atom+xml", Some(("text", "html"))); } diff --git a/tests/unit/net/resource_task.rs b/tests/unit/net/resource_task.rs index d9ef7cde4d3..9690ae2473d 100644 --- a/tests/unit/net/resource_task.rs +++ b/tests/unit/net/resource_task.rs @@ -14,16 +14,16 @@ use url::Url; #[test] fn test_exit() { - let resource_task = new_resource_task(None); + let resource_task = new_resource_task(None, None); resource_task.send(ControlMsg::Exit).unwrap(); } #[test] fn test_bad_scheme() { - let resource_task = new_resource_task(None); + let resource_task = new_resource_task(None, None); let (start_chan, start) = channel(); let url = Url::parse("bogus://whatever").unwrap(); - resource_task.send(ControlMsg::Load(LoadData::new(url), LoadConsumer::Channel(start_chan))).unwrap(); + resource_task.send(ControlMsg::Load(LoadData::new(url, None), LoadConsumer::Channel(start_chan))).unwrap(); let response = start.recv().unwrap(); match response.progress_port.recv().unwrap() { ProgressMsg::Done(result) => { assert!(result.is_err()) } @@ -167,13 +167,13 @@ fn test_replace_hosts() { //Start the TCP server let listener = TcpListener::bind("127.0.0.1:0").unwrap(); - let port = listener.socket_addr().unwrap().port(); + let port = listener.local_addr().unwrap().port(); //Start the resource task and make a request to our TCP server - let resource_task = new_resource_task(None); + 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), host_table), LoadConsumer::Channel(start_chan))).unwrap(); + resource_task.send(ControlMsg::Load(replace_hosts(LoadData::new(url, None), host_table), LoadConsumer::Channel(start_chan))).unwrap(); match listener.accept() { Ok(..) => assert!(true, "received request"), diff --git a/tests/unit/script/Cargo.toml b/tests/unit/script/Cargo.toml index 759e0581545..52b4e4b2e80 100644 --- a/tests/unit/script/Cargo.toml +++ b/tests/unit/script/Cargo.toml @@ -8,5 +8,8 @@ name = "script_tests" path = "lib.rs" doctest = false +[dependencies.msg] +path = "../../../components/msg" + [dependencies.script] path = "../../../components/script" diff --git a/tests/unit/script/lib.rs b/tests/unit/script/lib.rs index 3073fcb8588..f0d22cd2ca6 100644 --- a/tests/unit/script/lib.rs +++ b/tests/unit/script/lib.rs @@ -3,6 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ extern crate script; +extern crate msg; #[cfg(all(test, target_pointer_width = "64"))] mod size_of; #[cfg(test)] mod textinput; diff --git a/tests/unit/script/textinput.rs b/tests/unit/script/textinput.rs index 0d7326685db..653507983a2 100644 --- a/tests/unit/script/textinput.rs +++ b/tests/unit/script/textinput.rs @@ -7,12 +7,20 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use msg::constellation_msg::{Key, KeyModifiers}; + +#[cfg(target_os="macos")] +use msg::constellation_msg::SUPER; +#[cfg(not(target_os="macos"))] +use msg::constellation_msg::CONTROL; + use script::textinput::{TextInput, Selection, Lines, DeleteDir}; +use script::clipboard_provider::DummyClipboardContext; use std::borrow::ToOwned; #[test] fn test_textinput_delete_char() { - let mut textinput = TextInput::new(Lines::Single, "abcdefg".to_owned(), None); + let mut textinput = TextInput::new(Lines::Single, "abcdefg".to_owned(), DummyClipboardContext::new("")); textinput.adjust_horizontal(2, Selection::NotSelected); textinput.delete_char(DeleteDir::Backward); assert_eq!(textinput.get_content(), "acdefg"); @@ -27,7 +35,7 @@ fn test_textinput_delete_char() { #[test] fn test_textinput_insert_char() { - let mut textinput = TextInput::new(Lines::Single, "abcdefg".to_owned(), None); + let mut textinput = TextInput::new(Lines::Single, "abcdefg".to_owned(), DummyClipboardContext::new("")); textinput.adjust_horizontal(2, Selection::NotSelected); textinput.insert_char('a'); assert_eq!(textinput.get_content(), "abacdefg"); @@ -39,7 +47,7 @@ fn test_textinput_insert_char() { #[test] fn test_textinput_get_sorted_selection() { - let mut textinput = TextInput::new(Lines::Single, "abcdefg".to_owned(), None); + let mut textinput = TextInput::new(Lines::Single, "abcdefg".to_owned(), DummyClipboardContext::new("")); textinput.adjust_horizontal(2, Selection::NotSelected); textinput.adjust_horizontal(2, Selection::Selected); let (begin, end) = textinput.get_sorted_selection(); @@ -56,7 +64,7 @@ fn test_textinput_get_sorted_selection() { #[test] fn test_textinput_replace_selection() { - let mut textinput = TextInput::new(Lines::Single, "abcdefg".to_owned(), None); + let mut textinput = TextInput::new(Lines::Single, "abcdefg".to_owned(), DummyClipboardContext::new("")); textinput.adjust_horizontal(2, Selection::NotSelected); textinput.adjust_horizontal(2, Selection::Selected); @@ -66,7 +74,7 @@ fn test_textinput_replace_selection() { #[test] fn test_textinput_current_line_length() { - let mut textinput = TextInput::new(Lines::Multiple, "abc\nde\nf".to_owned(), None); + let mut textinput = TextInput::new(Lines::Multiple, "abc\nde\nf".to_owned(), DummyClipboardContext::new("")); assert_eq!(textinput.current_line_length(), 3); textinput.adjust_vertical(1, Selection::NotSelected); @@ -78,7 +86,7 @@ fn test_textinput_current_line_length() { #[test] fn test_textinput_adjust_vertical() { - let mut textinput = TextInput::new(Lines::Multiple, "abc\nde\nf".to_owned(), None); + let mut textinput = TextInput::new(Lines::Multiple, "abc\nde\nf".to_owned(), DummyClipboardContext::new("")); textinput.adjust_horizontal(3, Selection::NotSelected); textinput.adjust_vertical(1, Selection::NotSelected); assert_eq!(textinput.edit_point.line, 1); @@ -95,7 +103,7 @@ fn test_textinput_adjust_vertical() { #[test] fn test_textinput_adjust_horizontal() { - let mut textinput = TextInput::new(Lines::Multiple, "abc\nde\nf".to_owned(), None); + let mut textinput = TextInput::new(Lines::Multiple, "abc\nde\nf".to_owned(), DummyClipboardContext::new("")); textinput.adjust_horizontal(4, Selection::NotSelected); assert_eq!(textinput.edit_point.line, 1); assert_eq!(textinput.edit_point.index, 0); @@ -115,12 +123,12 @@ fn test_textinput_adjust_horizontal() { #[test] fn test_textinput_handle_return() { - let mut single_line_textinput = TextInput::new(Lines::Single, "abcdef".to_owned(), None); + 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(), None); + 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"); @@ -128,7 +136,7 @@ fn test_textinput_handle_return() { #[test] fn test_textinput_select_all() { - let mut textinput = TextInput::new(Lines::Multiple, "abc\nde\nf".to_owned(), None); + 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); @@ -139,16 +147,16 @@ fn test_textinput_select_all() { #[test] fn test_textinput_get_content() { - let single_line_textinput = TextInput::new(Lines::Single, "abcdefg".to_owned(), None); + 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(), None); + 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"); } #[test] fn test_textinput_set_content() { - let mut textinput = TextInput::new(Lines::Multiple, "abc\nde\nf".to_owned(), None); + let mut textinput = TextInput::new(Lines::Multiple, "abc\nde\nf".to_owned(), DummyClipboardContext::new("")); assert_eq!(textinput.get_content(), "abc\nde\nf"); textinput.set_content("abc\nf".to_owned()); @@ -165,3 +173,16 @@ fn test_textinput_set_content() { assert_eq!(textinput.edit_point.index, 2); } +#[test] +fn test_clipboard_paste() { + #[cfg(target_os="macos")] + const MODIFIERS: KeyModifiers = SUPER; + #[cfg(not(target_os="macos"))] + const MODIFIERS: KeyModifiers = CONTROL; + + let mut textinput = TextInput::new(Lines::Single, "defg".to_owned(), DummyClipboardContext::new("abc")); + assert_eq!(textinput.get_content(), "defg"); + assert_eq!(textinput.edit_point.index, 0); + textinput.handle_keydown_aux(Key::V, MODIFIERS); + assert_eq!(textinput.get_content(), "abcdefg"); +} diff --git a/tests/unit/style/Cargo.toml b/tests/unit/style/Cargo.toml index 64e34f2bd03..8f36c8890b5 100644 --- a/tests/unit/style/Cargo.toml +++ b/tests/unit/style/Cargo.toml @@ -26,8 +26,6 @@ git = "https://github.com/servo/rust-geom" [dependencies.selectors] git = "https://github.com/servo/rust-selectors" -[dependencies.cssparser] -git = "https://github.com/servo/rust-cssparser" - [dependencies] url = "*" +cssparser = "0.3.1" diff --git a/tests/unit/style/lib.rs b/tests/unit/style/lib.rs index 9e379d1336b..a90707b522c 100644 --- a/tests/unit/style/lib.rs +++ b/tests/unit/style/lib.rs @@ -16,6 +16,7 @@ extern crate util; #[cfg(test)] mod stylesheets; #[cfg(test)] mod media_queries; +#[cfg(test)] mod viewport; #[cfg(test)] mod writing_modes { use util::logical_geometry::WritingMode; diff --git a/tests/unit/style/viewport.rs b/tests/unit/style/viewport.rs new file mode 100644 index 00000000000..6be92ea24fd --- /dev/null +++ b/tests/unit/style/viewport.rs @@ -0,0 +1,275 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use cssparser::Parser; +use geom::size::TypedSize2D; +use geom::scale_factor::ScaleFactor; +use style::media_queries::{Device, MediaType}; +use style::parser::ParserContext; +use style::stylesheets::{Origin, Stylesheet, CSSRuleIteratorExt}; +use style::values::specified::{Length, LengthOrPercentageOrAuto}; +use style::viewport::*; +use url::Url; + +macro_rules! stylesheet { + ($css:expr, $origin:ident) => { + Stylesheet::from_str($css, + Url::parse("http://localhost").unwrap(), + Origin::$origin); + } +} + +fn test_viewport_rule<F>(css: &str, + device: &Device, + callback: F) + where F: Fn(&Vec<ViewportDescriptorDeclaration>, &str) +{ + ::util::opts::set_experimental_enabled(true); + + let stylesheet = stylesheet!(css, Author); + let mut rule_count = 0; + for rule in stylesheet.effective_rules(&device).viewport() { + rule_count += 1; + callback(&rule.declarations, css); + } + assert!(rule_count > 0); +} + +macro_rules! assert_declarations_len { + ($declarations:ident == 1) => { + assert!($declarations.len() == 1, + "expected 1 declaration; have {}: {:?})", + $declarations.len(), $declarations) + }; + ($declarations:ident == $len:expr) => { + assert!($declarations.len() == $len, + "expected {} declarations; have {}: {:?})", + $len, $declarations.len(), $declarations) + } +} + +#[test] +fn empty_viewport_rule() { + let device = Device::new(MediaType::Screen, TypedSize2D(800., 600.)); + + test_viewport_rule("@viewport {}", &device, |declarations, css| { + println!("{}", css); + assert_declarations_len!(declarations == 0); + }); +} + +macro_rules! assert_declaration_eq { + ($d:expr, $origin:ident, $expected:ident: $value:expr) => {{ + assert_eq!($d.origin, Origin::$origin); + assert_eq!($d.descriptor, ViewportDescriptor::$expected($value)); + assert!($d.important == false, "descriptor should not be !important"); + }}; + ($d:expr, $origin:ident, $expected:ident: $value:expr, !important) => {{ + assert_eq!($d.origin, Origin::$origin); + assert_eq!($d.descriptor, ViewportDescriptor::$expected($value)); + assert!($d.important == true, "descriptor should be !important"); + }}; +} + +#[test] +fn simple_viewport_rules() { + let device = Device::new(MediaType::Screen, TypedSize2D(800., 600.)); + + test_viewport_rule("@viewport { width: auto; height: auto;\ + zoom: auto; min-zoom: 0; max-zoom: 200%;\ + 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); + }); + + 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); + }); +} + +#[test] +fn cascading_within_viewport_rule() { + let device = Device::new(MediaType::Screen, TypedSize2D(800., 600.)); + + // normal order of appearance + 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); + }); + + // !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); + }); + + // !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); + }); + + // 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); + }); + + // 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); + }); + + // 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.))); + }); + + // 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); + }); +} + +#[test] +fn multiple_stylesheets_cascading() { + let device = Device::new(MediaType::Screen, TypedSize2D(800., 600.)); + + let stylesheets = vec![ + stylesheet!("@viewport { min-width: 100px; min-height: 100px; zoom: 1; }", UserAgent), + stylesheet!("@viewport { min-width: 200px; min-height: 200px; }", User), + stylesheet!("@viewport { min-width: 300px; }", 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, 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.))); + + 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)]; + + 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); +} + +#[test] +fn constrain_viewport() { + let url = Url::parse("http://localhost").unwrap(); + let context = ParserContext::new(Origin::Author, &url); + + macro_rules! from_css { + ($css:expr) => { + &ViewportRule::parse(&mut Parser::new($css), &context).unwrap() + } + } + + let initial_viewport = TypedSize2D(800., 600.); + assert_eq!(ViewportConstraints::maybe_new(initial_viewport, from_css!("")), + None); + + let initial_viewport = TypedSize2D(800., 600.); + assert_eq!(ViewportConstraints::maybe_new(initial_viewport, from_css!("width: 320px auto")), + Some(ViewportConstraints { + size: initial_viewport, + + initial_zoom: ScaleFactor::new(1.), + min_zoom: None, + max_zoom: None, + + user_zoom: UserZoom::Zoom, + orientation: Orientation::Auto + })); + + let initial_viewport = TypedSize2D(200., 150.); + assert_eq!(ViewportConstraints::maybe_new(initial_viewport, from_css!("width: 320px auto")), + Some(ViewportConstraints { + size: TypedSize2D(320., 240.), + + initial_zoom: ScaleFactor::new(1.), + min_zoom: None, + max_zoom: None, + + user_zoom: UserZoom::Zoom, + orientation: Orientation::Auto + })); + + let initial_viewport = TypedSize2D(800., 600.); + assert_eq!(ViewportConstraints::maybe_new(initial_viewport, from_css!("width: 320px auto")), + Some(ViewportConstraints { + size: initial_viewport, + + initial_zoom: ScaleFactor::new(1.), + min_zoom: None, + max_zoom: None, + + user_zoom: UserZoom::Zoom, + orientation: Orientation::Auto + })); + + let initial_viewport = TypedSize2D(800., 600.); + assert_eq!(ViewportConstraints::maybe_new(initial_viewport, from_css!("width: 800px; height: 600px;\ + zoom: 1;\ + user-zoom: zoom;\ + orientation: auto;")), + Some(ViewportConstraints { + size: initial_viewport, + + initial_zoom: ScaleFactor::new(1.), + min_zoom: None, + max_zoom: None, + + user_zoom: UserZoom::Zoom, + orientation: Orientation::Auto + })); +} diff --git a/tests/unit/util/vec.rs b/tests/unit/util/vec.rs index 815e0500918..d8f259aac19 100644 --- a/tests/unit/util/vec.rs +++ b/tests/unit/util/vec.rs @@ -35,12 +35,12 @@ fn test_match<T: PartialEq>(b: &T, a: Option<&T>) -> bool { #[test] fn should_find_all_elements() { - let arr_odd = [1u32, 2, 4, 6, 7, 8, 9]; - let arr_even = [1u32, 2, 5, 6, 7, 8, 9, 42]; - let arr_double = [1u32, 1, 2, 2, 6, 8, 22]; - let arr_one = [234986325u32]; - let arr_two = [3044u32, 8393]; - let arr_three = [12u32, 23, 34]; + let arr_odd = [1_i32, 2, 4, 6, 7, 8, 9]; + let arr_even = [1_i32, 2, 5, 6, 7, 8, 9, 42]; + let arr_double = [1_i32, 1, 2, 2, 6, 8, 22]; + let arr_one = [234986325_i32]; + let arr_two = [3044_i32, 8393]; + let arr_three = [12_i32, 23, 34]; test_find_all_elems(&arr_odd); test_find_all_elems(&arr_even); @@ -52,12 +52,12 @@ fn should_find_all_elements() { #[test] fn should_not_find_missing_elements() { - let arr_odd = [1u32, 2, 4, 6, 7, 8, 9]; - let arr_even = [1u32, 2, 5, 6, 7, 8, 9, 42]; - let arr_double = [1u32, 1, 2, 2, 6, 8, 22]; - let arr_one = [234986325u32]; - let arr_two = [3044u32, 8393]; - let arr_three = [12u32, 23, 34]; + let arr_odd = [1_i32, 2, 4, 6, 7, 8, 9]; + let arr_even = [1_i32, 2, 5, 6, 7, 8, 9, 42]; + let arr_double = [1_i32, 1, 2, 2, 6, 8, 22]; + let arr_one = [234986325_i32]; + let arr_two = [3044_i32, 8393]; + let arr_three = [12_i32, 23, 34]; test_miss_all_elems(&arr_odd, &[-22, 0, 3, 5, 34938, 10, 11, 12]); test_miss_all_elems(&arr_even, &[-1, 0, 3, 34938, 10, 11, 12]); diff --git a/tests/wpt/harness/wptrunner/executors/executorservo.py b/tests/wpt/harness/wptrunner/executors/executorservo.py index ef2bffdb2b3..9de859b37e4 100644 --- a/tests/wpt/harness/wptrunner/executors/executorservo.py +++ b/tests/wpt/harness/wptrunner/executors/executorservo.py @@ -186,7 +186,8 @@ class ServoRefTestExecutor(ProcessTestExecutor): with TempFilename(self.tempdir) as output_path: self.command = [self.binary, "--cpu", "--hard-fail", "--exit", - "--output=%s" % output_path, full_url] + "-Z", "disable-text-aa", "--output=%s" % output_path, + full_url] env = os.environ.copy() env["HOST_FILE"] = self.hosts_path diff --git a/tests/wpt/include.ini b/tests/wpt/include.ini index bdbdc97fd6e..505beee1521 100644 --- a/tests/wpt/include.ini +++ b/tests/wpt/include.ini @@ -1,6 +1,8 @@ skip: true [2dcontext] skip: false +[animation-timing] + skip: false [dom] skip: false [domparsing] @@ -97,5 +99,7 @@ skip: true skip: false [encoding] skip: false +[websockets] + skip: false [_mozilla] skip: false diff --git a/tests/wpt/metadata/2dcontext/transformations/2d.transformation.order.html.ini b/tests/wpt/metadata/2dcontext/transformations/2d.transformation.order.html.ini deleted file mode 100644 index a263b319a67..00000000000 --- a/tests/wpt/metadata/2dcontext/transformations/2d.transformation.order.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.transformation.order.html] - type: testharness - [Transformations are applied in the right order] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/transformations/2d.transformation.rotate.direction.html.ini b/tests/wpt/metadata/2dcontext/transformations/2d.transformation.rotate.direction.html.ini deleted file mode 100644 index 9de526626a8..00000000000 --- a/tests/wpt/metadata/2dcontext/transformations/2d.transformation.rotate.direction.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.transformation.rotate.direction.html] - type: testharness - [rotate() is clockwise] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/transformations/2d.transformation.rotate.nonfinite.html.ini b/tests/wpt/metadata/2dcontext/transformations/2d.transformation.rotate.nonfinite.html.ini deleted file mode 100644 index bc9a6afb294..00000000000 --- a/tests/wpt/metadata/2dcontext/transformations/2d.transformation.rotate.nonfinite.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.transformation.rotate.nonfinite.html] - type: testharness - [rotate() with Infinity/NaN is ignored] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/transformations/2d.transformation.rotate.radians.html.ini b/tests/wpt/metadata/2dcontext/transformations/2d.transformation.rotate.radians.html.ini deleted file mode 100644 index 572010938a9..00000000000 --- a/tests/wpt/metadata/2dcontext/transformations/2d.transformation.rotate.radians.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.transformation.rotate.radians.html] - type: testharness - [rotate() uses radians] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/transformations/2d.transformation.rotate.wrap.html.ini b/tests/wpt/metadata/2dcontext/transformations/2d.transformation.rotate.wrap.html.ini deleted file mode 100644 index 31ddd50de23..00000000000 --- a/tests/wpt/metadata/2dcontext/transformations/2d.transformation.rotate.wrap.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.transformation.rotate.wrap.html] - type: testharness - [rotate() wraps large positive values correctly] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/transformations/2d.transformation.rotate.wrapnegative.html.ini b/tests/wpt/metadata/2dcontext/transformations/2d.transformation.rotate.wrapnegative.html.ini deleted file mode 100644 index ba64eb83421..00000000000 --- a/tests/wpt/metadata/2dcontext/transformations/2d.transformation.rotate.wrapnegative.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.transformation.rotate.wrapnegative.html] - type: testharness - [rotate() wraps large negative values correctly] - expected: FAIL - diff --git a/tests/wpt/metadata/2dcontext/transformations/2d.transformation.rotate.zero.html.ini b/tests/wpt/metadata/2dcontext/transformations/2d.transformation.rotate.zero.html.ini deleted file mode 100644 index ddfed08dbc8..00000000000 --- a/tests/wpt/metadata/2dcontext/transformations/2d.transformation.rotate.zero.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.transformation.rotate.zero.html] - type: testharness - [rotate() by 0 does nothing] - expected: FAIL - diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index 90d23f18817..3a6c2845cd5 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -1158,6 +1158,16 @@ "url": "/2dcontext/transformations/canvas_transformations_scale_001.htm" }, { + "path": "2dcontext/transformations/canvas_transformations_reset_001.htm", + "references": [ + [ + "/2dcontext/transformations/canvas_transformations_reset_001-ref.htm", + "==" + ] + ], + "url": "/2dcontext/transformations/canvas_transformations_reset_001.htm" + }, + { "path": "FileAPI/url/url_xmlhttprequest_img.html", "references": [ [ @@ -20178,8 +20188,612 @@ }, "local_changes": { "deleted": [], - "items": {}, - "reftest_nodes": {} + "items": { + "reftest": { + "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_1.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_1.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_1_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_1.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_10.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_10.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_10_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_10.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_11.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_11.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_11_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_11.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_12.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_12.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_12_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_12.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_2.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_2.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_2_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_2.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_3.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_3.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_3_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_3.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_4.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_4.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_4_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_4.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_5.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_5.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_5_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_5.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_6.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_6.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_6_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_6.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_7.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_7.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_7_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_7.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_8.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_8.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_8_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_8.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_9.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_9.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_9_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_9.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_10.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_10.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_10_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_10.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_11.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_11.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_11_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_11.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_12.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_12.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_12_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_12.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_13.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_13.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_13_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_13.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_2.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_2.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_2_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_2.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_3.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_3.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_3_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_3.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_4.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_4.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_4_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_4.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_5.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_5.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_5_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_5.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_6.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_6.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_6_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_6.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_7.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_7.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_7_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_7.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_8.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_8.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_8_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_8.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_9.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_9.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_9_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_9.html" + } + ] + } + }, + "reftest_nodes": { + "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_1.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_1.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_1_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_1.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_10.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_10.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_10_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_10.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_11.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_11.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_11_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_11.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_12.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_12.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_12_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_12.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_2.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_2.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_2_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_2.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_3.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_3.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_3_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_3.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_4.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_4.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_4_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_4.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_5.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_5.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_5_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_5.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_6.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_6.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_6_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_6.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_7.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_7.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_7_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_7.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_8.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_8.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_8_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_8.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_9.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_canvas_9.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_9_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_9.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_10.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_10.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_10_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_10.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_11.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_11.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_11_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_11.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_12.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_12.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_12_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_12.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_13.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_13.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_13_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_13.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_2.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_2.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_2_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_2.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_3.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_3.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_3_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_3.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_4.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_4.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_4_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_4.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_5.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_5.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_5_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_5.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_6.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_6.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_6_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_6.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_7.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_7.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_7_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_7.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_8.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_8.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_8_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_8.html" + } + ], + "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_9.html": [ + { + "path": "2dcontext/drawing-images-to-the-canvas/drawimage_html_image_9.html", + "references": [ + [ + "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_9_ref.html", + "==" + ] + ], + "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_9.html" + } + ] + } }, "reftest_nodes": { "2dcontext/building-paths/canvas_complexshapes_arcto_001.htm": [ @@ -20278,6 +20892,18 @@ "url": "/2dcontext/transformations/canvas_transformations_scale_001.htm" } ], + "2dcontext/transformations/canvas_transformations_reset_001.htm": [ + { + "path": "2dcontext/transformations/canvas_transformations_reset_001.htm", + "references": [ + [ + "/2dcontext/transformations/canvas_transformations_reset_001-ref.htm", + "==" + ] + ], + "url": "/2dcontext/transformations/canvas_transformations_reset_001.htm" + } + ], "FileAPI/url/url_xmlhttprequest_img.html": [ { "path": "FileAPI/url/url_xmlhttprequest_img.html", diff --git a/tests/wpt/metadata/animation-timing/callback-invoked.html.ini b/tests/wpt/metadata/animation-timing/callback-invoked.html.ini new file mode 100644 index 00000000000..60487ba50cc --- /dev/null +++ b/tests/wpt/metadata/animation-timing/callback-invoked.html.ini @@ -0,0 +1,4 @@ +[callback-invoked.html] + type: testharness + [requestAnimationFrame callback is invoked at least once before the timeout] + expected: FAIL diff --git a/tests/wpt/metadata/encoding/api-invalid-label.html.ini b/tests/wpt/metadata/encoding/api-invalid-label.html.ini deleted file mode 100644 index 3f31413c569..00000000000 --- a/tests/wpt/metadata/encoding/api-invalid-label.html.ini +++ /dev/null @@ -1,218 +0,0 @@ -[api-invalid-label.html] - type: testharness - [Invalid label "\\vunicode-1-1-utf-8" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "unicode-1-1-utf-8\\v" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "\\vunicode-1-1-utf-8\\v" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label " unicode-1-1-utf-8" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "unicode-1-1-utf-8 " should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label " unicode-1-1-utf-8 " should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "
unicode-1-1-utf-8" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "unicode-1-1-utf-8
" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "
unicode-1-1-utf-8
" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "
unicode-1-1-utf-8" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "unicode-1-1-utf-8
" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "
unicode-1-1-utf-8
" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "\\vutf-8" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "utf-8\\v" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "\\vutf-8\\v" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label " utf-8" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "utf-8 " should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label " utf-8 " should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "
utf-8" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "utf-8
" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "
utf-8
" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "
utf-8" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "utf-8
" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "
utf-8
" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "\\vutf8" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "utf8\\v" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "\\vutf8\\v" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label " utf8" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "utf8 " should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label " utf8 " should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "
utf8" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "utf8
" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "
utf8
" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "
utf8" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "utf8
" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "
utf8
" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "\\vutf-16be" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "utf-16be\\v" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "\\vutf-16be\\v" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label " utf-16be" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "utf-16be " should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label " utf-16be " should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "
utf-16be" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "utf-16be
" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "
utf-16be
" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "
utf-16be" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "utf-16be
" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "
utf-16be
" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "\\vutf-16" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "utf-16\\v" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "\\vutf-16\\v" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label " utf-16" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "utf-16 " should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label " utf-16 " should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "
utf-16" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "utf-16
" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "
utf-16
" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "
utf-16" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "utf-16
" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "
utf-16
" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "\\vutf-16le" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "utf-16le\\v" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "\\vutf-16le\\v" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label " utf-16le" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "utf-16le " should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label " utf-16le " should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "
utf-16le" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "utf-16le
" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "
utf-16le
" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "
utf-16le" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "utf-16le
" should be rejected by TextEncoder.] - expected: FAIL - - [Invalid label "
utf-16le
" should be rejected by TextEncoder.] - expected: FAIL - diff --git a/tests/wpt/metadata/encoding/api-replacement-encodings.html.ini b/tests/wpt/metadata/encoding/api-replacement-encodings.html.ini deleted file mode 100644 index 99468e76336..00000000000 --- a/tests/wpt/metadata/encoding/api-replacement-encodings.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[api-replacement-encodings.html] - type: testharness - [Label for "replacement" should be rejected by API: hz-gb-2312] - expected: FAIL - diff --git a/tests/wpt/metadata/encoding/textdecoder-labels.html.ini b/tests/wpt/metadata/encoding/textdecoder-labels.html.ini deleted file mode 100644 index 324cc276a86..00000000000 --- a/tests/wpt/metadata/encoding/textdecoder-labels.html.ini +++ /dev/null @@ -1,530 +0,0 @@ -[textdecoder-labels.html] - type: testharness - ["chinese" => "gbk"] - expected: FAIL - - [" chinese" => "gbk"] - expected: FAIL - - ["chinese " => "gbk"] - expected: FAIL - - [" chinese " => "gbk"] - expected: FAIL - - ["\\tchinese" => "gbk"] - expected: FAIL - - ["chinese\\t" => "gbk"] - expected: FAIL - - ["\\tchinese\\t" => "gbk"] - expected: FAIL - - ["\\nchinese" => "gbk"] - expected: FAIL - - ["chinese\\n" => "gbk"] - expected: FAIL - - ["\\nchinese\\n" => "gbk"] - expected: FAIL - - ["\\fchinese" => "gbk"] - expected: FAIL - - ["chinese\\f" => "gbk"] - expected: FAIL - - ["\\fchinese\\f" => "gbk"] - expected: FAIL - - ["\\rchinese" => "gbk"] - expected: FAIL - - ["chinese\\r" => "gbk"] - expected: FAIL - - ["\\rchinese\\r" => "gbk"] - expected: FAIL - - ["csgb2312" => "gbk"] - expected: FAIL - - [" csgb2312" => "gbk"] - expected: FAIL - - ["csgb2312 " => "gbk"] - expected: FAIL - - [" csgb2312 " => "gbk"] - expected: FAIL - - ["\\tcsgb2312" => "gbk"] - expected: FAIL - - ["csgb2312\\t" => "gbk"] - expected: FAIL - - ["\\tcsgb2312\\t" => "gbk"] - expected: FAIL - - ["\\ncsgb2312" => "gbk"] - expected: FAIL - - ["csgb2312\\n" => "gbk"] - expected: FAIL - - ["\\ncsgb2312\\n" => "gbk"] - expected: FAIL - - ["\\fcsgb2312" => "gbk"] - expected: FAIL - - ["csgb2312\\f" => "gbk"] - expected: FAIL - - ["\\fcsgb2312\\f" => "gbk"] - expected: FAIL - - ["\\rcsgb2312" => "gbk"] - expected: FAIL - - ["csgb2312\\r" => "gbk"] - expected: FAIL - - ["\\rcsgb2312\\r" => "gbk"] - expected: FAIL - - ["csiso58gb231280" => "gbk"] - expected: FAIL - - [" csiso58gb231280" => "gbk"] - expected: FAIL - - ["csiso58gb231280 " => "gbk"] - expected: FAIL - - [" csiso58gb231280 " => "gbk"] - expected: FAIL - - ["\\tcsiso58gb231280" => "gbk"] - expected: FAIL - - ["csiso58gb231280\\t" => "gbk"] - expected: FAIL - - ["\\tcsiso58gb231280\\t" => "gbk"] - expected: FAIL - - ["\\ncsiso58gb231280" => "gbk"] - expected: FAIL - - ["csiso58gb231280\\n" => "gbk"] - expected: FAIL - - ["\\ncsiso58gb231280\\n" => "gbk"] - expected: FAIL - - ["\\fcsiso58gb231280" => "gbk"] - expected: FAIL - - ["csiso58gb231280\\f" => "gbk"] - expected: FAIL - - ["\\fcsiso58gb231280\\f" => "gbk"] - expected: FAIL - - ["\\rcsiso58gb231280" => "gbk"] - expected: FAIL - - ["csiso58gb231280\\r" => "gbk"] - expected: FAIL - - ["\\rcsiso58gb231280\\r" => "gbk"] - expected: FAIL - - ["gb2312" => "gbk"] - expected: FAIL - - [" gb2312" => "gbk"] - expected: FAIL - - ["gb2312 " => "gbk"] - expected: FAIL - - [" gb2312 " => "gbk"] - expected: FAIL - - ["\\tgb2312" => "gbk"] - expected: FAIL - - ["gb2312\\t" => "gbk"] - expected: FAIL - - ["\\tgb2312\\t" => "gbk"] - expected: FAIL - - ["\\ngb2312" => "gbk"] - expected: FAIL - - ["gb2312\\n" => "gbk"] - expected: FAIL - - ["\\ngb2312\\n" => "gbk"] - expected: FAIL - - ["\\fgb2312" => "gbk"] - expected: FAIL - - ["gb2312\\f" => "gbk"] - expected: FAIL - - ["\\fgb2312\\f" => "gbk"] - expected: FAIL - - ["\\rgb2312" => "gbk"] - expected: FAIL - - ["gb2312\\r" => "gbk"] - expected: FAIL - - ["\\rgb2312\\r" => "gbk"] - expected: FAIL - - ["gb_2312" => "gbk"] - expected: FAIL - - [" gb_2312" => "gbk"] - expected: FAIL - - ["gb_2312 " => "gbk"] - expected: FAIL - - [" gb_2312 " => "gbk"] - expected: FAIL - - ["\\tgb_2312" => "gbk"] - expected: FAIL - - ["gb_2312\\t" => "gbk"] - expected: FAIL - - ["\\tgb_2312\\t" => "gbk"] - expected: FAIL - - ["\\ngb_2312" => "gbk"] - expected: FAIL - - ["gb_2312\\n" => "gbk"] - expected: FAIL - - ["\\ngb_2312\\n" => "gbk"] - expected: FAIL - - ["\\fgb_2312" => "gbk"] - expected: FAIL - - ["gb_2312\\f" => "gbk"] - expected: FAIL - - ["\\fgb_2312\\f" => "gbk"] - expected: FAIL - - ["\\rgb_2312" => "gbk"] - expected: FAIL - - ["gb_2312\\r" => "gbk"] - expected: FAIL - - ["\\rgb_2312\\r" => "gbk"] - expected: FAIL - - ["gb_2312-80" => "gbk"] - expected: FAIL - - [" gb_2312-80" => "gbk"] - expected: FAIL - - ["gb_2312-80 " => "gbk"] - expected: FAIL - - [" gb_2312-80 " => "gbk"] - expected: FAIL - - ["\\tgb_2312-80" => "gbk"] - expected: FAIL - - ["gb_2312-80\\t" => "gbk"] - expected: FAIL - - ["\\tgb_2312-80\\t" => "gbk"] - expected: FAIL - - ["\\ngb_2312-80" => "gbk"] - expected: FAIL - - ["gb_2312-80\\n" => "gbk"] - expected: FAIL - - ["\\ngb_2312-80\\n" => "gbk"] - expected: FAIL - - ["\\fgb_2312-80" => "gbk"] - expected: FAIL - - ["gb_2312-80\\f" => "gbk"] - expected: FAIL - - ["\\fgb_2312-80\\f" => "gbk"] - expected: FAIL - - ["\\rgb_2312-80" => "gbk"] - expected: FAIL - - ["gb_2312-80\\r" => "gbk"] - expected: FAIL - - ["\\rgb_2312-80\\r" => "gbk"] - expected: FAIL - - ["gbk" => "gbk"] - expected: FAIL - - [" gbk" => "gbk"] - expected: FAIL - - ["gbk " => "gbk"] - expected: FAIL - - [" gbk " => "gbk"] - expected: FAIL - - ["\\tgbk" => "gbk"] - expected: FAIL - - ["gbk\\t" => "gbk"] - expected: FAIL - - ["\\tgbk\\t" => "gbk"] - expected: FAIL - - ["\\ngbk" => "gbk"] - expected: FAIL - - ["gbk\\n" => "gbk"] - expected: FAIL - - ["\\ngbk\\n" => "gbk"] - expected: FAIL - - ["\\fgbk" => "gbk"] - expected: FAIL - - ["gbk\\f" => "gbk"] - expected: FAIL - - ["\\fgbk\\f" => "gbk"] - expected: FAIL - - ["\\rgbk" => "gbk"] - expected: FAIL - - ["gbk\\r" => "gbk"] - expected: FAIL - - ["\\rgbk\\r" => "gbk"] - expected: FAIL - - ["iso-ir-58" => "gbk"] - expected: FAIL - - [" iso-ir-58" => "gbk"] - expected: FAIL - - ["iso-ir-58 " => "gbk"] - expected: FAIL - - [" iso-ir-58 " => "gbk"] - expected: FAIL - - ["\\tiso-ir-58" => "gbk"] - expected: FAIL - - ["iso-ir-58\\t" => "gbk"] - expected: FAIL - - ["\\tiso-ir-58\\t" => "gbk"] - expected: FAIL - - ["\\niso-ir-58" => "gbk"] - expected: FAIL - - ["iso-ir-58\\n" => "gbk"] - expected: FAIL - - ["\\niso-ir-58\\n" => "gbk"] - expected: FAIL - - ["\\fiso-ir-58" => "gbk"] - expected: FAIL - - ["iso-ir-58\\f" => "gbk"] - expected: FAIL - - ["\\fiso-ir-58\\f" => "gbk"] - expected: FAIL - - ["\\riso-ir-58" => "gbk"] - expected: FAIL - - ["iso-ir-58\\r" => "gbk"] - expected: FAIL - - ["\\riso-ir-58\\r" => "gbk"] - expected: FAIL - - ["x-gbk" => "gbk"] - expected: FAIL - - [" x-gbk" => "gbk"] - expected: FAIL - - ["x-gbk " => "gbk"] - expected: FAIL - - [" x-gbk " => "gbk"] - expected: FAIL - - ["\\tx-gbk" => "gbk"] - expected: FAIL - - ["x-gbk\\t" => "gbk"] - expected: FAIL - - ["\\tx-gbk\\t" => "gbk"] - expected: FAIL - - ["\\nx-gbk" => "gbk"] - expected: FAIL - - ["x-gbk\\n" => "gbk"] - expected: FAIL - - ["\\nx-gbk\\n" => "gbk"] - expected: FAIL - - ["\\fx-gbk" => "gbk"] - expected: FAIL - - ["x-gbk\\f" => "gbk"] - expected: FAIL - - ["\\fx-gbk\\f" => "gbk"] - expected: FAIL - - ["\\rx-gbk" => "gbk"] - expected: FAIL - - ["x-gbk\\r" => "gbk"] - expected: FAIL - - ["\\rx-gbk\\r" => "gbk"] - expected: FAIL - - ["utf-16" => "utf-16le"] - expected: FAIL - - [" utf-16" => "utf-16le"] - expected: FAIL - - ["utf-16 " => "utf-16le"] - expected: FAIL - - [" utf-16 " => "utf-16le"] - expected: FAIL - - ["\\tutf-16" => "utf-16le"] - expected: FAIL - - ["utf-16\\t" => "utf-16le"] - expected: FAIL - - ["\\tutf-16\\t" => "utf-16le"] - expected: FAIL - - ["\\nutf-16" => "utf-16le"] - expected: FAIL - - ["utf-16\\n" => "utf-16le"] - expected: FAIL - - ["\\nutf-16\\n" => "utf-16le"] - expected: FAIL - - ["\\futf-16" => "utf-16le"] - expected: FAIL - - ["utf-16\\f" => "utf-16le"] - expected: FAIL - - ["\\futf-16\\f" => "utf-16le"] - expected: FAIL - - ["\\rutf-16" => "utf-16le"] - expected: FAIL - - ["utf-16\\r" => "utf-16le"] - expected: FAIL - - ["\\rutf-16\\r" => "utf-16le"] - expected: FAIL - - ["utf-16le" => "utf-16le"] - expected: FAIL - - [" utf-16le" => "utf-16le"] - expected: FAIL - - ["utf-16le " => "utf-16le"] - expected: FAIL - - [" utf-16le " => "utf-16le"] - expected: FAIL - - ["\\tutf-16le" => "utf-16le"] - expected: FAIL - - ["utf-16le\\t" => "utf-16le"] - expected: FAIL - - ["\\tutf-16le\\t" => "utf-16le"] - expected: FAIL - - ["\\nutf-16le" => "utf-16le"] - expected: FAIL - - ["utf-16le\\n" => "utf-16le"] - expected: FAIL - - ["\\nutf-16le\\n" => "utf-16le"] - expected: FAIL - - ["\\futf-16le" => "utf-16le"] - expected: FAIL - - ["utf-16le\\f" => "utf-16le"] - expected: FAIL - - ["\\futf-16le\\f" => "utf-16le"] - expected: FAIL - - ["\\rutf-16le" => "utf-16le"] - expected: FAIL - - ["utf-16le\\r" => "utf-16le"] - expected: FAIL - - ["\\rutf-16le\\r" => "utf-16le"] - expected: FAIL - diff --git a/tests/wpt/metadata/encoding/textencoder-constructor-non-utf.html.ini b/tests/wpt/metadata/encoding/textencoder-constructor-non-utf.html.ini deleted file mode 100644 index d186734577b..00000000000 --- a/tests/wpt/metadata/encoding/textencoder-constructor-non-utf.html.ini +++ /dev/null @@ -1,8 +0,0 @@ -[textencoder-constructor-non-utf.html] - type: testharness - [Non-UTF encodings supported only for decode, not encode: gbk] - expected: FAIL - - [UTF encodings are supported for encode and decode: utf-16le] - expected: FAIL - diff --git a/tests/wpt/metadata/html/dom/interfaces.html.ini b/tests/wpt/metadata/html/dom/interfaces.html.ini index b0048beb2f8..80d2fdd9c1d 100644 --- a/tests/wpt/metadata/html/dom/interfaces.html.ini +++ b/tests/wpt/metadata/html/dom/interfaces.html.ini @@ -5238,9 +5238,6 @@ [HTMLTableDataCellElement interface: document.createElement("td") must inherit property "abbr" with the proper type (0)] expected: FAIL - [HTMLTableCellElement interface: document.createElement("td") must inherit property "colSpan" with the proper type (0)] - expected: FAIL - [HTMLTableCellElement interface: document.createElement("td") must inherit property "rowSpan" with the proper type (1)] expected: FAIL @@ -5307,9 +5304,6 @@ [HTMLTableHeaderCellElement interface: document.createElement("th") must inherit property "sort" with the proper type (3)] expected: FAIL - [HTMLTableCellElement interface: document.createElement("th") must inherit property "colSpan" with the proper type (0)] - expected: FAIL - [HTMLTableCellElement interface: document.createElement("th") must inherit property "rowSpan" with the proper type (1)] expected: FAIL @@ -5352,9 +5346,6 @@ [HTMLTableCellElement interface object length] expected: FAIL - [HTMLTableCellElement interface: attribute colSpan] - expected: FAIL - [HTMLTableCellElement interface: attribute rowSpan] expected: FAIL @@ -6828,12 +6819,6 @@ [CanvasRenderingContext2D interface: attribute currentTransform] expected: FAIL - [CanvasRenderingContext2D interface: operation rotate(unrestricted double)] - expected: FAIL - - [CanvasRenderingContext2D interface: operation resetTransform()] - expected: FAIL - [CanvasRenderingContext2D interface: operation createPattern(CanvasImageSource,DOMString)] expected: FAIL @@ -6960,15 +6945,6 @@ [CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "currentTransform" with the proper type (6)] expected: FAIL - [CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "rotate" with the proper type (8)] - expected: FAIL - - [CanvasRenderingContext2D interface: calling rotate(unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError] - expected: FAIL - - [CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "resetTransform" with the proper type (12)] - expected: FAIL - [CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "strokeStyle" with the proper type (16)] expected: FAIL @@ -8805,21 +8781,9 @@ [WebSocket interface object length] expected: FAIL - [WebSocket interface: attribute readyState] - expected: FAIL - [WebSocket interface: attribute bufferedAmount] expected: FAIL - [WebSocket interface: attribute onopen] - expected: FAIL - - [WebSocket interface: attribute onerror] - expected: FAIL - - [WebSocket interface: attribute onclose] - expected: FAIL - [WebSocket interface: attribute extensions] expected: FAIL @@ -8835,39 +8799,12 @@ [WebSocket interface: attribute binaryType] expected: FAIL - [WebSocket interface: operation send(DOMString)] - expected: FAIL - - [WebSocket interface: operation send(Blob)] - expected: FAIL - - [WebSocket interface: operation send(ArrayBuffer)] - expected: FAIL - - [WebSocket interface: operation send(ArrayBufferView)] - expected: FAIL - [CloseEvent interface: existence and properties of interface object] expected: FAIL [CloseEvent interface object length] expected: FAIL - [CloseEvent interface: existence and properties of interface prototype object] - expected: FAIL - - [CloseEvent interface: existence and properties of interface prototype object's "constructor" property] - expected: FAIL - - [CloseEvent interface: attribute wasClean] - expected: FAIL - - [CloseEvent interface: attribute code] - expected: FAIL - - [CloseEvent interface: attribute reason] - expected: FAIL - [MessageChannel interface: existence and properties of interface object] expected: FAIL diff --git a/tests/wpt/metadata/html/dom/reflection-embedded.html.ini b/tests/wpt/metadata/html/dom/reflection-embedded.html.ini index 75db57ee650..1269ad6f764 100644 --- a/tests/wpt/metadata/html/dom/reflection-embedded.html.ini +++ b/tests/wpt/metadata/html/dom/reflection-embedded.html.ini @@ -1125,24 +1125,12 @@ [img.lowsrc: IDL set to object "test-valueOf" followed by IDL get] expected: FAIL - [img.hspace: setAttribute() to 2147483648 followed by IDL get] - expected: FAIL - - [img.hspace: setAttribute() to 4294967295 followed by IDL get] - expected: FAIL - [img.hspace: setAttribute() to object "3" followed by getAttribute()] expected: FAIL [img.hspace: setAttribute() to object "3" followed by IDL get] expected: FAIL - [img.vspace: setAttribute() to 2147483648 followed by IDL get] - expected: FAIL - - [img.vspace: setAttribute() to 4294967295 followed by IDL get] - expected: FAIL - [img.vspace: setAttribute() to object "3" followed by getAttribute()] expected: FAIL diff --git a/tests/wpt/metadata/html/dom/reflection-forms.html.ini b/tests/wpt/metadata/html/dom/reflection-forms.html.ini index e55c97d7b5a..604280dfb3d 100644 --- a/tests/wpt/metadata/html/dom/reflection-forms.html.ini +++ b/tests/wpt/metadata/html/dom/reflection-forms.html.ini @@ -5766,33 +5766,12 @@ [input.required: IDL set to object "test-valueOf" followed by IDL get] expected: FAIL - [input.size: IDL get with DOM attribute unset] - expected: FAIL - - [input.size: setAttribute() to 0 followed by IDL get] - expected: FAIL - - [input.size: setAttribute() to 2147483648 followed by IDL get] - expected: FAIL - - [input.size: setAttribute() to 4294967295 followed by IDL get] - expected: FAIL - - [input.size: setAttribute() to "-0" followed by IDL get] - expected: FAIL - - [input.size: setAttribute() to "0" followed by IDL get] - expected: FAIL - [input.size: setAttribute() to object "3" followed by getAttribute()] expected: FAIL [input.size: setAttribute() to object "3" followed by IDL get] expected: FAIL - [input.size: IDL set to 0 must throw INDEX_SIZE_ERR] - expected: FAIL - [input.src: typeof IDL attribute] expected: FAIL @@ -12201,33 +12180,12 @@ [textarea.autofocus: IDL set to object "test-valueOf" followed by IDL get] expected: FAIL - [textarea.cols: IDL get with DOM attribute unset] - expected: FAIL - - [textarea.cols: setAttribute() to 0 followed by IDL get] - expected: FAIL - - [textarea.cols: setAttribute() to 2147483648 followed by IDL get] - expected: FAIL - - [textarea.cols: setAttribute() to 4294967295 followed by IDL get] - expected: FAIL - - [textarea.cols: setAttribute() to "-0" followed by IDL get] - expected: FAIL - - [textarea.cols: setAttribute() to "0" followed by IDL get] - expected: FAIL - [textarea.cols: setAttribute() to object "3" followed by getAttribute()] expected: FAIL [textarea.cols: setAttribute() to object "3" followed by IDL get] expected: FAIL - [textarea.cols: IDL set to 0 must throw INDEX_SIZE_ERR] - expected: FAIL - [textarea.dirName: typeof IDL attribute] expected: FAIL @@ -13137,33 +13095,12 @@ [textarea.maxLength: IDL set to 2147483647 followed by getAttribute()] expected: FAIL - [textarea.rows: IDL get with DOM attribute unset] - expected: FAIL - - [textarea.rows: setAttribute() to 0 followed by IDL get] - expected: FAIL - - [textarea.rows: setAttribute() to 2147483648 followed by IDL get] - expected: FAIL - - [textarea.rows: setAttribute() to 4294967295 followed by IDL get] - expected: FAIL - - [textarea.rows: setAttribute() to "-0" followed by IDL get] - expected: FAIL - - [textarea.rows: setAttribute() to "0" followed by IDL get] - expected: FAIL - [textarea.rows: setAttribute() to object "3" followed by getAttribute()] expected: FAIL [textarea.rows: setAttribute() to object "3" followed by IDL get] expected: FAIL - [textarea.rows: IDL set to 0 must throw INDEX_SIZE_ERR] - expected: FAIL - [textarea.itemScope: typeof IDL attribute] expected: FAIL diff --git a/tests/wpt/metadata/html/dom/reflection-tabular.html.ini b/tests/wpt/metadata/html/dom/reflection-tabular.html.ini index cfc913aaec4..0ce072a63a7 100644 --- a/tests/wpt/metadata/html/dom/reflection-tabular.html.ini +++ b/tests/wpt/metadata/html/dom/reflection-tabular.html.ini @@ -11544,192 +11544,12 @@ [td.tabIndex: IDL set to -2147483648 followed by getAttribute()] expected: FAIL - [td.colSpan: typeof IDL attribute] - expected: FAIL - - [td.colSpan: IDL get with DOM attribute unset] - expected: FAIL - - [td.colSpan: setAttribute() to -2147483649 followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to -2147483648 followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to -36 followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to -1 followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to 0 followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to 1 followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to 257 followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to 2147483647 followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to 2147483648 followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to 4294967295 followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to 4294967296 followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to "" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to "-1" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to "-0" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to "0" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to "1" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to "\\t7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to "\\v7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to "\\f7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to "7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to "\\n7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to "\\r7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to "
7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to "
7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to "7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo " followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to undefined followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to 1.5 followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to true followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to false followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to object "[object Object\]" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to NaN followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to Infinity followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to -Infinity followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to "\\0" followed by IDL get] - expected: FAIL - - [td.colSpan: setAttribute() to object "2" followed by IDL get] - expected: FAIL - [td.colSpan: setAttribute() to object "3" followed by getAttribute()] expected: FAIL [td.colSpan: setAttribute() to object "3" followed by IDL get] expected: FAIL - [td.colSpan: IDL set to 0 followed by getAttribute()] - expected: FAIL - - [td.colSpan: IDL set to 1 followed by getAttribute()] - expected: FAIL - - [td.colSpan: IDL set to 257 followed by getAttribute()] - expected: FAIL - - [td.colSpan: IDL set to 2147483647 followed by getAttribute()] - expected: FAIL - - [td.colSpan: IDL set to "-0" followed by getAttribute()] - expected: FAIL - - [td.colSpan: IDL set to "-0" followed by IDL get] - expected: FAIL - [td.rowSpan: typeof IDL attribute] expected: FAIL @@ -13917,192 +13737,12 @@ [th.tabIndex: IDL set to -2147483648 followed by getAttribute()] expected: FAIL - [th.colSpan: typeof IDL attribute] - expected: FAIL - - [th.colSpan: IDL get with DOM attribute unset] - expected: FAIL - - [th.colSpan: setAttribute() to -2147483649 followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to -2147483648 followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to -36 followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to -1 followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to 0 followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to 1 followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to 257 followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to 2147483647 followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to 2147483648 followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to 4294967295 followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to 4294967296 followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to "" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to "-1" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to "-0" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to "0" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to "1" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to "\\t7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to "\\v7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to "\\f7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to "7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to "\\n7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to "\\r7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to "
7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to "
7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to "7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to " 7" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo " followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to undefined followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to 1.5 followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to true followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to false followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to object "[object Object\]" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to NaN followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to Infinity followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to -Infinity followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to "\\0" followed by IDL get] - expected: FAIL - - [th.colSpan: setAttribute() to object "2" followed by IDL get] - expected: FAIL - [th.colSpan: setAttribute() to object "3" followed by getAttribute()] expected: FAIL [th.colSpan: setAttribute() to object "3" followed by IDL get] expected: FAIL - [th.colSpan: IDL set to 0 followed by getAttribute()] - expected: FAIL - - [th.colSpan: IDL set to 1 followed by getAttribute()] - expected: FAIL - - [th.colSpan: IDL set to 257 followed by getAttribute()] - expected: FAIL - - [th.colSpan: IDL set to 2147483647 followed by getAttribute()] - expected: FAIL - - [th.colSpan: IDL set to "-0" followed by getAttribute()] - expected: FAIL - - [th.colSpan: IDL set to "-0" followed by IDL get] - expected: FAIL - [th.rowSpan: typeof IDL attribute] expected: FAIL diff --git a/tests/wpt/metadata/html/rendering/bindings/the-textarea-element-0/cols-zero.html.ini b/tests/wpt/metadata/html/rendering/bindings/the-textarea-element-0/cols-zero.html.ini deleted file mode 100644 index 55b4e3652d3..00000000000 --- a/tests/wpt/metadata/html/rendering/bindings/the-textarea-element-0/cols-zero.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[cols-zero.html] - type: reftest - reftype: == - refurl: /html/rendering/bindings/the-textarea-element-0/textarea-ref.html - expected: FAIL diff --git a/tests/wpt/metadata/html/rendering/bindings/the-textarea-element-0/rows-zero.html.ini b/tests/wpt/metadata/html/rendering/bindings/the-textarea-element-0/rows-zero.html.ini deleted file mode 100644 index e4361f0ba33..00000000000 --- a/tests/wpt/metadata/html/rendering/bindings/the-textarea-element-0/rows-zero.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[rows-zero.html] - type: reftest - reftype: == - refurl: /html/rendering/bindings/the-textarea-element-0/textarea-ref.html - expected: FAIL diff --git a/tests/wpt/metadata/html/semantics/embedded-content/the-img-element/update-the-source-set.html.ini b/tests/wpt/metadata/html/semantics/embedded-content/the-img-element/update-the-source-set.html.ini index c2b01ccff71..6dedfeadca1 100644 --- a/tests/wpt/metadata/html/semantics/embedded-content/the-img-element/update-the-source-set.html.ini +++ b/tests/wpt/metadata/html/semantics/embedded-content/the-img-element/update-the-source-set.html.ini @@ -66,18 +66,6 @@ [<picture><span><source srcset="data:,b"></span><img src="data:,a" data-expect="data:,a"></picture>] expected: FAIL - [<picture><svg><source srcset="data:,b"></svg><img src="data:,a" data-expect="data:,a"></picture>] - expected: FAIL - - [<picture><svg><source srcset="data:,b"><img src="data:,a" data-expect="data:,b"></svg></picture>] - expected: FAIL - - [<picture><svg><font><source srcset="data:,b"></font></svg><font><img src="data:,a" data-expect="data:,a"></font></picture>] - expected: FAIL - - [<picture><svg><!--<font face> tag breaks out of svg--><font face=""></font><source srcset="data:,b"></svg><img src="data:,a" data-expect="data:,b"></picture>] - expected: FAIL - [<picture><img src="data:,a"><img src="data:,b" data-expect="data:,b"></picture>] expected: FAIL @@ -267,3 +255,15 @@ [<picture><source srcset="data:,b"><img data-expect="data:,b"></picture>] expected: FAIL + [<picture><svg><source srcset="data:,b"></source></svg><img src="data:,a" data-expect="data:,a"></picture>] + expected: FAIL + + [<picture><svg></svg><source srcset="data:,b"><img src="data:,a" data-expect="data:,b"></picture>] + expected: FAIL + + [<picture><svg><font></font><source srcset="data:,b"></source></svg><img src="data:,a" data-expect="data:,a"></picture>] + expected: FAIL + + [<picture><svg><!--<font face> tag breaks out of svg--><font face=""></font><source srcset="data:,b"></source></svg><img src="data:,a" data-expect="data:,b"></picture>] + expected: FAIL + diff --git a/tests/wpt/metadata/old-tests/submission/Opera/script_scheduling/131.html.ini b/tests/wpt/metadata/old-tests/submission/Opera/script_scheduling/131.html.ini new file mode 100644 index 00000000000..91f628fdb7b --- /dev/null +++ b/tests/wpt/metadata/old-tests/submission/Opera/script_scheduling/131.html.ini @@ -0,0 +1,5 @@ +[131.html] + type: testharness + [scheduler: inline svg script ] + expected: FAIL + diff --git a/tests/wpt/metadata/old-tests/submission/Opera/script_scheduling/133.html.ini b/tests/wpt/metadata/old-tests/submission/Opera/script_scheduling/133.html.ini new file mode 100644 index 00000000000..91c80df2d42 --- /dev/null +++ b/tests/wpt/metadata/old-tests/submission/Opera/script_scheduling/133.html.ini @@ -0,0 +1,5 @@ +[133.html] + type: testharness + [scheduler: inline HTML script added by SVG script ] + expected: FAIL + diff --git a/tests/wpt/metadata/old-tests/submission/Opera/script_scheduling/137.html.ini b/tests/wpt/metadata/old-tests/submission/Opera/script_scheduling/137.html.ini deleted file mode 100644 index 60d25da62d0..00000000000 --- a/tests/wpt/metadata/old-tests/submission/Opera/script_scheduling/137.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[137.html] - type: testharness - [scheduler: SVG script empty xlink:href] - expected: FAIL - diff --git a/tests/wpt/metadata/old-tests/submission/Opera/script_scheduling/145.html.ini b/tests/wpt/metadata/old-tests/submission/Opera/script_scheduling/145.html.ini new file mode 100644 index 00000000000..b4836dc60d5 --- /dev/null +++ b/tests/wpt/metadata/old-tests/submission/Opera/script_scheduling/145.html.ini @@ -0,0 +1,5 @@ +[145.html] + type: testharness + [scheduler: SVG inline script adding text to empty script ] + expected: FAIL + diff --git a/tests/wpt/metadata/old-tests/submission/Opera/script_scheduling/146.html.ini b/tests/wpt/metadata/old-tests/submission/Opera/script_scheduling/146.html.ini new file mode 100644 index 00000000000..c5cde10199c --- /dev/null +++ b/tests/wpt/metadata/old-tests/submission/Opera/script_scheduling/146.html.ini @@ -0,0 +1,5 @@ +[146.html] + type: testharness + [scheduler: SVG script adding src attribute ] + expected: FAIL + diff --git a/tests/wpt/metadata/websockets/Close-1000-reason.htm.ini b/tests/wpt/metadata/websockets/Close-1000-reason.htm.ini new file mode 100644 index 00000000000..5ed97b6a4dd --- /dev/null +++ b/tests/wpt/metadata/websockets/Close-1000-reason.htm.ini @@ -0,0 +1,6 @@ +[Close-1000-reason.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create WebSocket - Close the Connection - close(1000, reason) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Close-1000.htm.ini b/tests/wpt/metadata/websockets/Close-1000.htm.ini new file mode 100644 index 00000000000..10017ef9131 --- /dev/null +++ b/tests/wpt/metadata/websockets/Close-1000.htm.ini @@ -0,0 +1,6 @@ +[Close-1000.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create WebSocket - Close the Connection - close(1000) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Close-reason-unpaired-surrogates.htm.ini b/tests/wpt/metadata/websockets/Close-reason-unpaired-surrogates.htm.ini new file mode 100644 index 00000000000..562ee256ea0 --- /dev/null +++ b/tests/wpt/metadata/websockets/Close-reason-unpaired-surrogates.htm.ini @@ -0,0 +1,3 @@ +[Close-reason-unpaired-surrogates.htm] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/Close-undefined.htm.ini b/tests/wpt/metadata/websockets/Close-undefined.htm.ini new file mode 100644 index 00000000000..9a1012b3c03 --- /dev/null +++ b/tests/wpt/metadata/websockets/Close-undefined.htm.ini @@ -0,0 +1,5 @@ +[Close-undefined.htm] + type: testharness + [W3C WebSocket API - Close WebSocket - Code is undefined] + expected: FAIL + diff --git a/tests/wpt/metadata/websockets/Create-Secure-blocked-port.htm.ini b/tests/wpt/metadata/websockets/Create-Secure-blocked-port.htm.ini new file mode 100644 index 00000000000..263a3d01948 --- /dev/null +++ b/tests/wpt/metadata/websockets/Create-Secure-blocked-port.htm.ini @@ -0,0 +1,3 @@ +[Create-Secure-blocked-port.htm] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/Create-Secure-extensions-empty.htm.ini b/tests/wpt/metadata/websockets/Create-Secure-extensions-empty.htm.ini new file mode 100644 index 00000000000..56e445df1d5 --- /dev/null +++ b/tests/wpt/metadata/websockets/Create-Secure-extensions-empty.htm.ini @@ -0,0 +1,9 @@ +[Create-Secure-extensions-empty.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create Secure WebSocket - wsocket.extensions should be set to '' after connection is established - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Create Secure WebSocket - wsocket.extensions should be set to '' after connection is established - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Create-Secure-url-with-space.htm.ini b/tests/wpt/metadata/websockets/Create-Secure-url-with-space.htm.ini new file mode 100644 index 00000000000..d474af4b3d8 --- /dev/null +++ b/tests/wpt/metadata/websockets/Create-Secure-url-with-space.htm.ini @@ -0,0 +1,3 @@ +[Create-Secure-url-with-space.htm] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/Create-Secure-valid-url-array-protocols.htm.ini b/tests/wpt/metadata/websockets/Create-Secure-valid-url-array-protocols.htm.ini new file mode 100644 index 00000000000..af398e5f60f --- /dev/null +++ b/tests/wpt/metadata/websockets/Create-Secure-valid-url-array-protocols.htm.ini @@ -0,0 +1,9 @@ +[Create-Secure-valid-url-array-protocols.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and array of protocol strings - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and array of protocol strings - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Create-Secure-valid-url-binaryType-blob.htm.ini b/tests/wpt/metadata/websockets/Create-Secure-valid-url-binaryType-blob.htm.ini new file mode 100644 index 00000000000..ca269349ee0 --- /dev/null +++ b/tests/wpt/metadata/websockets/Create-Secure-valid-url-binaryType-blob.htm.ini @@ -0,0 +1,9 @@ +[Create-Secure-valid-url-binaryType-blob.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create Secure WebSocket - wsocket.binaryType should be set to 'blob' after connection is established - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Create Secure WebSocket - wsocket.binaryType should be set to 'blob' after connection is established - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Create-Secure-valid-url-protocol-setCorrectly.htm.ini b/tests/wpt/metadata/websockets/Create-Secure-valid-url-protocol-setCorrectly.htm.ini new file mode 100644 index 00000000000..e3260bd25d4 --- /dev/null +++ b/tests/wpt/metadata/websockets/Create-Secure-valid-url-protocol-setCorrectly.htm.ini @@ -0,0 +1,9 @@ +[Create-Secure-valid-url-protocol-setCorrectly.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and protocol string - protocol should be set correctly - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and protocol string - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Create-Secure-valid-url-protocol-string.htm.ini b/tests/wpt/metadata/websockets/Create-Secure-valid-url-protocol-string.htm.ini new file mode 100644 index 00000000000..9f1e23a6ea4 --- /dev/null +++ b/tests/wpt/metadata/websockets/Create-Secure-valid-url-protocol-string.htm.ini @@ -0,0 +1,9 @@ +[Create-Secure-valid-url-protocol-string.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create Secure WebSocket - Check readyState is 1] + expected: NOTRUN + + [W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and protocol string - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Create-Secure-valid-url.htm.ini b/tests/wpt/metadata/websockets/Create-Secure-valid-url.htm.ini new file mode 100644 index 00000000000..20a98611055 --- /dev/null +++ b/tests/wpt/metadata/websockets/Create-Secure-valid-url.htm.ini @@ -0,0 +1,9 @@ +[Create-Secure-valid-url.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create Secure WebSocket - Pass a valid URL - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Create Secure WebSocket - Pass a valid URL - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Create-Secure-verify-url-set-non-default-port.htm.ini b/tests/wpt/metadata/websockets/Create-Secure-verify-url-set-non-default-port.htm.ini new file mode 100644 index 00000000000..a50cda27594 --- /dev/null +++ b/tests/wpt/metadata/websockets/Create-Secure-verify-url-set-non-default-port.htm.ini @@ -0,0 +1,3 @@ +[Create-Secure-verify-url-set-non-default-port.htm] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/Create-invalid-urls.htm.ini b/tests/wpt/metadata/websockets/Create-invalid-urls.htm.ini new file mode 100644 index 00000000000..fd3312d40fa --- /dev/null +++ b/tests/wpt/metadata/websockets/Create-invalid-urls.htm.ini @@ -0,0 +1,3 @@ +[Create-invalid-urls.htm] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/Create-non-absolute-url.htm.ini b/tests/wpt/metadata/websockets/Create-non-absolute-url.htm.ini new file mode 100644 index 00000000000..8524afa5027 --- /dev/null +++ b/tests/wpt/metadata/websockets/Create-non-absolute-url.htm.ini @@ -0,0 +1,3 @@ +[Create-non-absolute-url.htm] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/Create-nonAscii-protocol-string.htm.ini b/tests/wpt/metadata/websockets/Create-nonAscii-protocol-string.htm.ini new file mode 100644 index 00000000000..08b72e6c518 --- /dev/null +++ b/tests/wpt/metadata/websockets/Create-nonAscii-protocol-string.htm.ini @@ -0,0 +1,5 @@ +[Create-nonAscii-protocol-string.htm] + type: testharness + [W3C WebSocket API - Create WebSocket - Pass a valid URL and a protocol string with non-ascii values - SYNTAX_ERR is thrown] + expected: FAIL + diff --git a/tests/wpt/metadata/websockets/Create-protocol-with-space.htm.ini b/tests/wpt/metadata/websockets/Create-protocol-with-space.htm.ini new file mode 100644 index 00000000000..08c4f65eb16 --- /dev/null +++ b/tests/wpt/metadata/websockets/Create-protocol-with-space.htm.ini @@ -0,0 +1,5 @@ +[Create-protocol-with-space.htm] + type: testharness + [W3C WebSocket API - Create WebSocket - Pass a valid URL and a protocol string with a space in it - SYNTAX_ERR is thrown] + expected: FAIL + diff --git a/tests/wpt/metadata/websockets/Create-protocols-repeated.htm.ini b/tests/wpt/metadata/websockets/Create-protocols-repeated.htm.ini new file mode 100644 index 00000000000..e5f3bfc0acf --- /dev/null +++ b/tests/wpt/metadata/websockets/Create-protocols-repeated.htm.ini @@ -0,0 +1,5 @@ +[Create-protocols-repeated.htm] + type: testharness + [W3C WebSocket API - Create WebSocket - Pass a valid URL and an array of protocol strings with repeated values - SYNTAX_ERR is thrown] + expected: FAIL + diff --git a/tests/wpt/metadata/websockets/Create-valid-url-array-protocols.htm.ini b/tests/wpt/metadata/websockets/Create-valid-url-array-protocols.htm.ini new file mode 100644 index 00000000000..c39896ddd46 --- /dev/null +++ b/tests/wpt/metadata/websockets/Create-valid-url-array-protocols.htm.ini @@ -0,0 +1,6 @@ +[Create-valid-url-array-protocols.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create WebSocket - Pass a valid URL and array of protocol strings - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Create-valid-url-protocol-empty.htm.ini b/tests/wpt/metadata/websockets/Create-valid-url-protocol-empty.htm.ini new file mode 100644 index 00000000000..e39be950b89 --- /dev/null +++ b/tests/wpt/metadata/websockets/Create-valid-url-protocol-empty.htm.ini @@ -0,0 +1,5 @@ +[Create-valid-url-protocol-empty.htm] + type: testharness + [W3C WebSocket API - Create WebSocket - wsocket.protocol should be empty before connection is established] + expected: FAIL + diff --git a/tests/wpt/metadata/websockets/Create-valid-url-protocol.htm.ini b/tests/wpt/metadata/websockets/Create-valid-url-protocol.htm.ini new file mode 100644 index 00000000000..fe7e4139693 --- /dev/null +++ b/tests/wpt/metadata/websockets/Create-valid-url-protocol.htm.ini @@ -0,0 +1,6 @@ +[Create-valid-url-protocol.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create WebSocket - Pass a valid URL and a protocol string - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Create-valid-url.htm.ini b/tests/wpt/metadata/websockets/Create-valid-url.htm.ini new file mode 100644 index 00000000000..73b274b1c92 --- /dev/null +++ b/tests/wpt/metadata/websockets/Create-valid-url.htm.ini @@ -0,0 +1,6 @@ +[Create-valid-url.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create WebSocket - Pass a valid URL - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Create-wrong-scheme.htm.ini b/tests/wpt/metadata/websockets/Create-wrong-scheme.htm.ini new file mode 100644 index 00000000000..d10bc32841e --- /dev/null +++ b/tests/wpt/metadata/websockets/Create-wrong-scheme.htm.ini @@ -0,0 +1,3 @@ +[Create-wrong-scheme.htm] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/Secure-Close-0.htm.ini b/tests/wpt/metadata/websockets/Secure-Close-0.htm.ini new file mode 100644 index 00000000000..26379533b7d --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Close-0.htm.ini @@ -0,0 +1,6 @@ +[Secure-Close-0.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(0) - INVALID_ACCESS_ERR is thrown] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Close-1000-reason.htm.ini b/tests/wpt/metadata/websockets/Secure-Close-1000-reason.htm.ini new file mode 100644 index 00000000000..dbbbe8eebc1 --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Close-1000-reason.htm.ini @@ -0,0 +1,9 @@ +[Secure-Close-1000-reason.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1000, reason) - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1000, reason) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Close-1000-verify-code.htm.ini b/tests/wpt/metadata/websockets/Secure-Close-1000-verify-code.htm.ini new file mode 100644 index 00000000000..9f386dda36e --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Close-1000-verify-code.htm.ini @@ -0,0 +1,9 @@ +[Secure-Close-1000-verify-code.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1000, reason) - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1000, reason) - event.code == 1000 and event.reason = 'Clean Close'] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Close-1000.htm.ini b/tests/wpt/metadata/websockets/Secure-Close-1000.htm.ini new file mode 100644 index 00000000000..b50263f5d00 --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Close-1000.htm.ini @@ -0,0 +1,9 @@ +[Secure-Close-1000.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1000) - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1000) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Close-1005-verify-code.htm.ini b/tests/wpt/metadata/websockets/Secure-Close-1005-verify-code.htm.ini new file mode 100644 index 00000000000..8644d0f7b2f --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Close-1005-verify-code.htm.ini @@ -0,0 +1,9 @@ +[Secure-Close-1005-verify-code.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create Secure WebSocket - Close the Connection - close() - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Create Secure WebSocket - Close the Connection - close() - return close code is 1005 - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Close-1005.htm.ini b/tests/wpt/metadata/websockets/Secure-Close-1005.htm.ini new file mode 100644 index 00000000000..618133c4a71 --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Close-1005.htm.ini @@ -0,0 +1,6 @@ +[Secure-Close-1005.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(1005) - see '7.1.5. The WebSocket Connection Close Code' in http://www.ietf.org/rfc/rfc6455.txt] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Close-2999-reason.htm.ini b/tests/wpt/metadata/websockets/Secure-Close-2999-reason.htm.ini new file mode 100644 index 00000000000..f1195cfb63f --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Close-2999-reason.htm.ini @@ -0,0 +1,6 @@ +[Secure-Close-2999-reason.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(2999, reason) - INVALID_ACCESS_ERR is thrown] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Close-3000-reason.htm.ini b/tests/wpt/metadata/websockets/Secure-Close-3000-reason.htm.ini new file mode 100644 index 00000000000..d92d497fc58 --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Close-3000-reason.htm.ini @@ -0,0 +1,9 @@ +[Secure-Close-3000-reason.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(3000, reason) - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(3000, reason) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Close-3000-verify-code.htm.ini b/tests/wpt/metadata/websockets/Secure-Close-3000-verify-code.htm.ini new file mode 100644 index 00000000000..33d71e4b635 --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Close-3000-verify-code.htm.ini @@ -0,0 +1,9 @@ +[Secure-Close-3000-verify-code.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(3000, reason) - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(3000, reason) - verify return code is 3000 - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Close-4999-reason.htm.ini b/tests/wpt/metadata/websockets/Secure-Close-4999-reason.htm.ini new file mode 100644 index 00000000000..bcccbd3e4cb --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Close-4999-reason.htm.ini @@ -0,0 +1,9 @@ +[Secure-Close-4999-reason.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(4999, reason) - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(4999, reason) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Close-NaN.htm.ini b/tests/wpt/metadata/websockets/Secure-Close-NaN.htm.ini new file mode 100644 index 00000000000..9d6ee7032c8 --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Close-NaN.htm.ini @@ -0,0 +1,6 @@ +[Secure-Close-NaN.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create WebSocket - Close the Connection - close(NaN) - INVALID_ACCESS_ERR is thrown] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Close-Reason-124Bytes.htm.ini b/tests/wpt/metadata/websockets/Secure-Close-Reason-124Bytes.htm.ini new file mode 100644 index 00000000000..8c8a0b30597 --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Close-Reason-124Bytes.htm.ini @@ -0,0 +1,6 @@ +[Secure-Close-Reason-124Bytes.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(code, 'reason more than 123 bytes') - SYNTAX_ERR is thrown] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Close-Reason-Unpaired-surrogates.htm.ini b/tests/wpt/metadata/websockets/Secure-Close-Reason-Unpaired-surrogates.htm.ini new file mode 100644 index 00000000000..e88c86b9f32 --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Close-Reason-Unpaired-surrogates.htm.ini @@ -0,0 +1,9 @@ +[Secure-Close-Reason-Unpaired-surrogates.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(reason with unpaired surrogates) - connection should get opened] + expected: NOTRUN + + [W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(reason with unpaired surrogates) - connection should get closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Close-null.htm.ini b/tests/wpt/metadata/websockets/Secure-Close-null.htm.ini new file mode 100644 index 00000000000..0a74e3887f3 --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Close-null.htm.ini @@ -0,0 +1,6 @@ +[Secure-Close-null.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create WebSocket - Close the Connection - close(null) - INVALID_ACCESS_ERR is thrown] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Close-onlyReason.htm.ini b/tests/wpt/metadata/websockets/Secure-Close-onlyReason.htm.ini new file mode 100644 index 00000000000..65caa5fc292 --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Close-onlyReason.htm.ini @@ -0,0 +1,6 @@ +[Secure-Close-onlyReason.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(only reason) - INVALID_ACCESS_ERR is thrown] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Close-readyState-Closed.htm.ini b/tests/wpt/metadata/websockets/Secure-Close-readyState-Closed.htm.ini new file mode 100644 index 00000000000..4cbf0c31986 --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Close-readyState-Closed.htm.ini @@ -0,0 +1,9 @@ +[Secure-Close-readyState-Closed.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create Secure WebSocket - Close the Connection - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Create Secure WebSocket - Close the Connection - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Close-readyState-Closing.htm.ini b/tests/wpt/metadata/websockets/Secure-Close-readyState-Closing.htm.ini new file mode 100644 index 00000000000..42bde612fd3 --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Close-readyState-Closing.htm.ini @@ -0,0 +1,6 @@ +[Secure-Close-readyState-Closing.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create Secure WebSocket - Close the Connection - readyState should be in CLOSING state just before onclose is called] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Close-server-initiated-close.htm.ini b/tests/wpt/metadata/websockets/Secure-Close-server-initiated-close.htm.ini new file mode 100644 index 00000000000..1998a83c052 --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Close-server-initiated-close.htm.ini @@ -0,0 +1,9 @@ +[Secure-Close-server-initiated-close.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create Secure WebSocket - Server initiated Close - Client sends back a CLOSE - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Create Secure WebSocket - Server initiated Close - Client sends back a CLOSE - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Close-string.htm.ini b/tests/wpt/metadata/websockets/Secure-Close-string.htm.ini new file mode 100644 index 00000000000..f83c0efdabf --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Close-string.htm.ini @@ -0,0 +1,6 @@ +[Secure-Close-string.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create WebSocket - Close the Connection - close(string) - INVALID_ACCESS_ERR is thrown] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Close-undefined.htm.ini b/tests/wpt/metadata/websockets/Secure-Close-undefined.htm.ini new file mode 100644 index 00000000000..1cdd7f0fbed --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Close-undefined.htm.ini @@ -0,0 +1,6 @@ +[Secure-Close-undefined.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Close Secure WebSocket - Code is undefined] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Send-65K-data.htm.ini b/tests/wpt/metadata/websockets/Secure-Send-65K-data.htm.ini new file mode 100644 index 00000000000..07c6ae16f8a --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Send-65K-data.htm.ini @@ -0,0 +1,12 @@ +[Secure-Send-65K-data.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send 65K data on a Secure WebSocket - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Send 65K data on a Secure WebSocket - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send 65K data on a Secure WebSocket - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Send-binary-65K-arraybuffer.htm.ini b/tests/wpt/metadata/websockets/Secure-Send-binary-65K-arraybuffer.htm.ini new file mode 100644 index 00000000000..7e59c837844 --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Send-binary-65K-arraybuffer.htm.ini @@ -0,0 +1,12 @@ +[Secure-Send-binary-65K-arraybuffer.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send 65K binary data on a Secure WebSocket - ArrayBuffer - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Send 65K binary data on a Secure WebSocket - ArrayBuffer - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send 65K binary data on a Secure WebSocket - ArrayBuffer - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Send-binary-arraybuffer.htm.ini b/tests/wpt/metadata/websockets/Secure-Send-binary-arraybuffer.htm.ini new file mode 100644 index 00000000000..20d75551398 --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Send-binary-arraybuffer.htm.ini @@ -0,0 +1,12 @@ +[Secure-Send-binary-arraybuffer.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send binary data on a Secure WebSocket - ArrayBuffer - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Send binary data on a Secure WebSocket - ArrayBuffer - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send binary data on a Secure WebSocket - ArrayBuffer - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Send-binary-arraybufferview-float32.htm.ini b/tests/wpt/metadata/websockets/Secure-Send-binary-arraybufferview-float32.htm.ini new file mode 100644 index 00000000000..f345173423f --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Send-binary-arraybufferview-float32.htm.ini @@ -0,0 +1,9 @@ +[Secure-Send-binary-arraybufferview-float32.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Float32Array - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Float32Array - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Send-binary-arraybufferview-float64.htm.ini b/tests/wpt/metadata/websockets/Secure-Send-binary-arraybufferview-float64.htm.ini new file mode 100644 index 00000000000..2dc082c0449 --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Send-binary-arraybufferview-float64.htm.ini @@ -0,0 +1,12 @@ +[Secure-Send-binary-arraybufferview-float64.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Float64Array - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Float64Array - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Float64Array - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Send-binary-arraybufferview-int32.htm.ini b/tests/wpt/metadata/websockets/Secure-Send-binary-arraybufferview-int32.htm.ini new file mode 100644 index 00000000000..c5a131601d8 --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Send-binary-arraybufferview-int32.htm.ini @@ -0,0 +1,12 @@ +[Secure-Send-binary-arraybufferview-int32.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int32Array - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int32Array - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int32Array - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Send-binary-arraybufferview-uint16-offset-length.htm.ini b/tests/wpt/metadata/websockets/Secure-Send-binary-arraybufferview-uint16-offset-length.htm.ini new file mode 100644 index 00000000000..74c73cf21d1 --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Send-binary-arraybufferview-uint16-offset-length.htm.ini @@ -0,0 +1,12 @@ +[Secure-Send-binary-arraybufferview-uint16-offset-length.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint16Array with offset and length - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint16Array with offset and length - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint16Array with offset and length - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Send-binary-arraybufferview-uint32-offset.htm.ini b/tests/wpt/metadata/websockets/Secure-Send-binary-arraybufferview-uint32-offset.htm.ini new file mode 100644 index 00000000000..0904e765de3 --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Send-binary-arraybufferview-uint32-offset.htm.ini @@ -0,0 +1,12 @@ +[Secure-Send-binary-arraybufferview-uint32-offset.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint32Array with offset - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint32Array with offset - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint32Array with offset - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Send-binary-arraybufferview-uint8-offset-length.htm.ini b/tests/wpt/metadata/websockets/Secure-Send-binary-arraybufferview-uint8-offset-length.htm.ini new file mode 100644 index 00000000000..d5150e1eedb --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Send-binary-arraybufferview-uint8-offset-length.htm.ini @@ -0,0 +1,12 @@ +[Secure-Send-binary-arraybufferview-uint8-offset-length.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset and length - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset and length - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset and length - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Send-binary-arraybufferview-uint8-offset.htm.ini b/tests/wpt/metadata/websockets/Secure-Send-binary-arraybufferview-uint8-offset.htm.ini new file mode 100644 index 00000000000..c4a4d144881 --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Send-binary-arraybufferview-uint8-offset.htm.ini @@ -0,0 +1,12 @@ +[Secure-Send-binary-arraybufferview-uint8-offset.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Send-binary-blob.htm.ini b/tests/wpt/metadata/websockets/Secure-Send-binary-blob.htm.ini new file mode 100644 index 00000000000..f00b01c3de9 --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Send-binary-blob.htm.ini @@ -0,0 +1,12 @@ +[Secure-Send-binary-blob.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send binary data on a Secure WebSocket - Blob - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Send binary data on a Secure WebSocket - Blob - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send binary data on a Secure WebSocket - Blob - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Send-data.htm.ini b/tests/wpt/metadata/websockets/Secure-Send-data.htm.ini new file mode 100644 index 00000000000..21ea9cf66ad --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Send-data.htm.ini @@ -0,0 +1,12 @@ +[Secure-Send-data.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send data on a Secure WebSocket - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Send data on a Secure WebSocket - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send data on a Secure WebSocket - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Send-null.htm.ini b/tests/wpt/metadata/websockets/Secure-Send-null.htm.ini new file mode 100644 index 00000000000..4355fef9272 --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Send-null.htm.ini @@ -0,0 +1,12 @@ +[Secure-Send-null.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send null data on a Secure WebSocket - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Send null data on a Secure WebSocket - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send null data on a Secure WebSocket - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Send-paired-surrogates.htm.ini b/tests/wpt/metadata/websockets/Secure-Send-paired-surrogates.htm.ini new file mode 100644 index 00000000000..56b1dd4ab4e --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Send-paired-surrogates.htm.ini @@ -0,0 +1,12 @@ +[Secure-Send-paired-surrogates.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send paired surrogates data on a Secure WebSocket - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Send paired surrogates data on a Secure WebSocket - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send paired surrogates data on a Secure WebSocket - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Send-unicode-data.htm.ini b/tests/wpt/metadata/websockets/Secure-Send-unicode-data.htm.ini new file mode 100644 index 00000000000..f1c63b13c5a --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Send-unicode-data.htm.ini @@ -0,0 +1,12 @@ +[Secure-Send-unicode-data.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send unicode data on a Secure WebSocket - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Send unicode data on a Secure WebSocket - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send unicode data on a Secure WebSocket - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Secure-Send-unpaired-surrogates.htm.ini b/tests/wpt/metadata/websockets/Secure-Send-unpaired-surrogates.htm.ini new file mode 100644 index 00000000000..b7053a3813a --- /dev/null +++ b/tests/wpt/metadata/websockets/Secure-Send-unpaired-surrogates.htm.ini @@ -0,0 +1,12 @@ +[Secure-Send-unpaired-surrogates.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send unpaired surrogates on a Secure WebSocket - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Send unpaired surrogates on a Secure WebSocket - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send unpaired surrogates on a Secure WebSocket - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Send-0byte-data.htm.ini b/tests/wpt/metadata/websockets/Send-0byte-data.htm.ini new file mode 100644 index 00000000000..c9a9238029f --- /dev/null +++ b/tests/wpt/metadata/websockets/Send-0byte-data.htm.ini @@ -0,0 +1,12 @@ +[Send-0byte-data.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send 0 byte data on a WebSocket - Connection should be opened] + expected: FAIL + + [W3C WebSocket API - Send 0 byte data on a WebSocket - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send 0 byte data on a WebSocket - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Send-65K-data.htm.ini b/tests/wpt/metadata/websockets/Send-65K-data.htm.ini new file mode 100644 index 00000000000..5f3f650af2f --- /dev/null +++ b/tests/wpt/metadata/websockets/Send-65K-data.htm.ini @@ -0,0 +1,12 @@ +[Send-65K-data.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send 65K data on a WebSocket - Connection should be opened] + expected: FAIL + + [W3C WebSocket API - Send 65K data on a WebSocket - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send 65K data on a WebSocket - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Send-Unpaired-Surrogates.htm.ini b/tests/wpt/metadata/websockets/Send-Unpaired-Surrogates.htm.ini new file mode 100644 index 00000000000..b46ddc67b95 --- /dev/null +++ b/tests/wpt/metadata/websockets/Send-Unpaired-Surrogates.htm.ini @@ -0,0 +1,3 @@ +[Send-Unpaired-Surrogates.htm] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/Send-before-open.htm.ini b/tests/wpt/metadata/websockets/Send-before-open.htm.ini new file mode 100644 index 00000000000..548882ca473 --- /dev/null +++ b/tests/wpt/metadata/websockets/Send-before-open.htm.ini @@ -0,0 +1,5 @@ +[Send-before-open.htm] + type: testharness + [W3C WebSocket API - Send data on a WebSocket before connection is opened - INVALID_STATE_ERR is returned] + expected: FAIL + diff --git a/tests/wpt/metadata/websockets/Send-binary-65K-arraybuffer.htm.ini b/tests/wpt/metadata/websockets/Send-binary-65K-arraybuffer.htm.ini new file mode 100644 index 00000000000..a00c89142ad --- /dev/null +++ b/tests/wpt/metadata/websockets/Send-binary-65K-arraybuffer.htm.ini @@ -0,0 +1,12 @@ +[Send-binary-65K-arraybuffer.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send 65K binary data on a WebSocket - ArrayBuffer - Connection should be opened] + expected: FAIL + + [W3C WebSocket API - Send 65K binary data on a WebSocket - ArrayBuffer - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send 65K binary data on a WebSocket - ArrayBuffer - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Send-binary-arraybuffer.htm.ini b/tests/wpt/metadata/websockets/Send-binary-arraybuffer.htm.ini new file mode 100644 index 00000000000..7e695344f5b --- /dev/null +++ b/tests/wpt/metadata/websockets/Send-binary-arraybuffer.htm.ini @@ -0,0 +1,12 @@ +[Send-binary-arraybuffer.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBuffer - Connection should be opened] + expected: FAIL + + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBuffer - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBuffer - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Send-binary-arraybufferview-int16-offset.htm.ini b/tests/wpt/metadata/websockets/Send-binary-arraybufferview-int16-offset.htm.ini new file mode 100644 index 00000000000..20138d173eb --- /dev/null +++ b/tests/wpt/metadata/websockets/Send-binary-arraybufferview-int16-offset.htm.ini @@ -0,0 +1,9 @@ +[Send-binary-arraybufferview-int16-offset.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int16Array with offset - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int16Array with offset - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Send-binary-arraybufferview-int8.htm.ini b/tests/wpt/metadata/websockets/Send-binary-arraybufferview-int8.htm.ini new file mode 100644 index 00000000000..9c0434b4d76 --- /dev/null +++ b/tests/wpt/metadata/websockets/Send-binary-arraybufferview-int8.htm.ini @@ -0,0 +1,9 @@ +[Send-binary-arraybufferview-int8.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int8Array - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send binary data on a WebSocket - ArrayBufferView - Int8Array - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Send-binary-blob.htm.ini b/tests/wpt/metadata/websockets/Send-binary-blob.htm.ini new file mode 100644 index 00000000000..4c4d2ac715c --- /dev/null +++ b/tests/wpt/metadata/websockets/Send-binary-blob.htm.ini @@ -0,0 +1,9 @@ +[Send-binary-blob.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send binary data on a WebSocket - Blob - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send binary data on a WebSocket - Blob - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Send-data.htm.ini b/tests/wpt/metadata/websockets/Send-data.htm.ini new file mode 100644 index 00000000000..219bfa3c2fc --- /dev/null +++ b/tests/wpt/metadata/websockets/Send-data.htm.ini @@ -0,0 +1,12 @@ +[Send-data.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send data on a WebSocket - Connection should be opened] + expected: FAIL + + [W3C WebSocket API - Send data on a WebSocket - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send data on a WebSocket - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Send-null.htm.ini b/tests/wpt/metadata/websockets/Send-null.htm.ini new file mode 100644 index 00000000000..09ef0d5f976 --- /dev/null +++ b/tests/wpt/metadata/websockets/Send-null.htm.ini @@ -0,0 +1,9 @@ +[Send-null.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send null data on a WebSocket - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send null data on a WebSocket - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Send-paired-surrogates.htm.ini b/tests/wpt/metadata/websockets/Send-paired-surrogates.htm.ini new file mode 100644 index 00000000000..474c0b0e6fe --- /dev/null +++ b/tests/wpt/metadata/websockets/Send-paired-surrogates.htm.ini @@ -0,0 +1,12 @@ +[Send-paired-surrogates.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send (paired surrogates) data on a WebSocket - Connection should be opened] + expected: FAIL + + [W3C WebSocket API - Send (paired surrogates) data on a WebSocket - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send (paired surrogates) data on a WebSocket - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/Send-unicode-data.htm.ini b/tests/wpt/metadata/websockets/Send-unicode-data.htm.ini new file mode 100644 index 00000000000..20bbc2310f2 --- /dev/null +++ b/tests/wpt/metadata/websockets/Send-unicode-data.htm.ini @@ -0,0 +1,12 @@ +[Send-unicode-data.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Send unicode data on a WebSocket - Connection should be opened] + expected: FAIL + + [W3C WebSocket API - Send unicode data on a WebSocket - Message should be received] + expected: NOTRUN + + [W3C WebSocket API - Send unicode data on a WebSocket - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/binary/001.html.ini b/tests/wpt/metadata/websockets/binary/001.html.ini new file mode 100644 index 00000000000..c69310634cd --- /dev/null +++ b/tests/wpt/metadata/websockets/binary/001.html.ini @@ -0,0 +1,6 @@ +[001.html] + type: testharness + expected: TIMEOUT + [WebSockets: Send/Receive blob, blob size less than network array buffer] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/binary/002.html.ini b/tests/wpt/metadata/websockets/binary/002.html.ini new file mode 100644 index 00000000000..17c2178f041 --- /dev/null +++ b/tests/wpt/metadata/websockets/binary/002.html.ini @@ -0,0 +1,5 @@ +[002.html] + type: testharness + [WebSockets: Send/Receive blob, blob size greater than network array buffer] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/binary/004.html.ini b/tests/wpt/metadata/websockets/binary/004.html.ini new file mode 100644 index 00000000000..ef110ccc8b7 --- /dev/null +++ b/tests/wpt/metadata/websockets/binary/004.html.ini @@ -0,0 +1,5 @@ +[004.html] + type: testharness + [WebSockets: Send/Receive ArrayBuffer, size greater than network array buffer] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/binary/005.html.ini b/tests/wpt/metadata/websockets/binary/005.html.ini new file mode 100644 index 00000000000..3dc5e6482ad --- /dev/null +++ b/tests/wpt/metadata/websockets/binary/005.html.ini @@ -0,0 +1,6 @@ +[005.html] + type: testharness + expected: TIMEOUT + [WebSockets: Send/Receive ArrayBuffer, size less than network array buffer] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/binaryType-wrong-value.htm.ini b/tests/wpt/metadata/websockets/binaryType-wrong-value.htm.ini new file mode 100644 index 00000000000..9373b5727c9 --- /dev/null +++ b/tests/wpt/metadata/websockets/binaryType-wrong-value.htm.ini @@ -0,0 +1,9 @@ +[binaryType-wrong-value.htm] + type: testharness + expected: TIMEOUT + [W3C WebSocket API - Create WebSocket - set binaryType to something other than blob or arraybuffer - SYNTAX_ERR is returned - Connection should be opened] + expected: NOTRUN + + [W3C WebSocket API - Create WebSocket - set binaryType to something other than blob or arraybuffer - SYNTAX_ERR is returned - Connection should be closed] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/closing-handshake/002.html.ini b/tests/wpt/metadata/websockets/closing-handshake/002.html.ini new file mode 100644 index 00000000000..f6ecc3ff447 --- /dev/null +++ b/tests/wpt/metadata/websockets/closing-handshake/002.html.ini @@ -0,0 +1,6 @@ +[002.html] + type: testharness + expected: TIMEOUT + [WebSockets: server sends closing handshake] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/closing-handshake/003.html.ini b/tests/wpt/metadata/websockets/closing-handshake/003.html.ini new file mode 100644 index 00000000000..4c728c392b3 --- /dev/null +++ b/tests/wpt/metadata/websockets/closing-handshake/003.html.ini @@ -0,0 +1,6 @@ +[003.html] + type: testharness + expected: TIMEOUT + [WebSockets: client sends closing handshake] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/closing-handshake/004.html.ini b/tests/wpt/metadata/websockets/closing-handshake/004.html.ini new file mode 100644 index 00000000000..4edaa70e2c3 --- /dev/null +++ b/tests/wpt/metadata/websockets/closing-handshake/004.html.ini @@ -0,0 +1,6 @@ +[004.html] + type: testharness + expected: TIMEOUT + [WebSockets: data after closing handshake] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/constructor/002.html.ini b/tests/wpt/metadata/websockets/constructor/002.html.ini new file mode 100644 index 00000000000..29a2058d988 --- /dev/null +++ b/tests/wpt/metadata/websockets/constructor/002.html.ini @@ -0,0 +1,3 @@ +[002.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/constructor/004.html.ini b/tests/wpt/metadata/websockets/constructor/004.html.ini new file mode 100644 index 00000000000..2c1c228a251 --- /dev/null +++ b/tests/wpt/metadata/websockets/constructor/004.html.ini @@ -0,0 +1,3 @@ +[004.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/constructor/005.html.ini b/tests/wpt/metadata/websockets/constructor/005.html.ini new file mode 100644 index 00000000000..6a14cc88a26 --- /dev/null +++ b/tests/wpt/metadata/websockets/constructor/005.html.ini @@ -0,0 +1,3 @@ +[005.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/constructor/006.html.ini b/tests/wpt/metadata/websockets/constructor/006.html.ini new file mode 100644 index 00000000000..9701e26d8e9 --- /dev/null +++ b/tests/wpt/metadata/websockets/constructor/006.html.ini @@ -0,0 +1,3 @@ +[006.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/constructor/007.html.ini b/tests/wpt/metadata/websockets/constructor/007.html.ini new file mode 100644 index 00000000000..d2689f1a8a9 --- /dev/null +++ b/tests/wpt/metadata/websockets/constructor/007.html.ini @@ -0,0 +1,3 @@ +[007.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/constructor/008.html.ini b/tests/wpt/metadata/websockets/constructor/008.html.ini new file mode 100644 index 00000000000..9fbd1fc405a --- /dev/null +++ b/tests/wpt/metadata/websockets/constructor/008.html.ini @@ -0,0 +1,3 @@ +[008.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/constructor/009.html.ini b/tests/wpt/metadata/websockets/constructor/009.html.ini new file mode 100644 index 00000000000..db8502371ba --- /dev/null +++ b/tests/wpt/metadata/websockets/constructor/009.html.ini @@ -0,0 +1,6 @@ +[009.html] + type: testharness + expected: TIMEOUT + [WebSockets: protocol] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/constructor/010.html.ini b/tests/wpt/metadata/websockets/constructor/010.html.ini new file mode 100644 index 00000000000..4dc31aa432a --- /dev/null +++ b/tests/wpt/metadata/websockets/constructor/010.html.ini @@ -0,0 +1,3 @@ +[010.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/constructor/011.html.ini b/tests/wpt/metadata/websockets/constructor/011.html.ini new file mode 100644 index 00000000000..7962549aeed --- /dev/null +++ b/tests/wpt/metadata/websockets/constructor/011.html.ini @@ -0,0 +1,3 @@ +[011.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/constructor/012.html.ini b/tests/wpt/metadata/websockets/constructor/012.html.ini new file mode 100644 index 00000000000..778e50e98ce --- /dev/null +++ b/tests/wpt/metadata/websockets/constructor/012.html.ini @@ -0,0 +1,3 @@ +[012.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/constructor/013.html.ini b/tests/wpt/metadata/websockets/constructor/013.html.ini new file mode 100644 index 00000000000..1531cecf0c4 --- /dev/null +++ b/tests/wpt/metadata/websockets/constructor/013.html.ini @@ -0,0 +1,5 @@ +[013.html] + type: testharness + [WebSockets: multiple WebSocket objects] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/constructor/014.html.ini b/tests/wpt/metadata/websockets/constructor/014.html.ini new file mode 100644 index 00000000000..17969fd254d --- /dev/null +++ b/tests/wpt/metadata/websockets/constructor/014.html.ini @@ -0,0 +1,5 @@ +[014.html] + type: testharness + [WebSockets: serialize establish a connection] + expected: FAIL + diff --git a/tests/wpt/metadata/websockets/constructor/016.html.ini b/tests/wpt/metadata/websockets/constructor/016.html.ini new file mode 100644 index 00000000000..99e40a15a16 --- /dev/null +++ b/tests/wpt/metadata/websockets/constructor/016.html.ini @@ -0,0 +1,6 @@ +[016.html] + type: testharness + expected: TIMEOUT + [WebSockets: non-ascii URL in query, document encoding windows-1252] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/constructor/017.html.ini b/tests/wpt/metadata/websockets/constructor/017.html.ini new file mode 100644 index 00000000000..97d4f9f816b --- /dev/null +++ b/tests/wpt/metadata/websockets/constructor/017.html.ini @@ -0,0 +1,3 @@ +[017.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/constructor/018.html.ini b/tests/wpt/metadata/websockets/constructor/018.html.ini new file mode 100644 index 00000000000..20b6752778a --- /dev/null +++ b/tests/wpt/metadata/websockets/constructor/018.html.ini @@ -0,0 +1,6 @@ +[018.html] + type: testharness + expected: TIMEOUT + [WebSockets: NULL char in url] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/constructor/021.html.ini b/tests/wpt/metadata/websockets/constructor/021.html.ini new file mode 100644 index 00000000000..a1080a040ef --- /dev/null +++ b/tests/wpt/metadata/websockets/constructor/021.html.ini @@ -0,0 +1,3 @@ +[021.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/constructor/022.html.ini b/tests/wpt/metadata/websockets/constructor/022.html.ini new file mode 100644 index 00000000000..b83a6669f8f --- /dev/null +++ b/tests/wpt/metadata/websockets/constructor/022.html.ini @@ -0,0 +1,3 @@ +[022.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/cookies/001.html.ini b/tests/wpt/metadata/websockets/cookies/001.html.ini new file mode 100644 index 00000000000..af285926981 --- /dev/null +++ b/tests/wpt/metadata/websockets/cookies/001.html.ini @@ -0,0 +1,6 @@ +[001.html] + type: testharness + expected: TIMEOUT + [WebSockets: Cookie in request] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/cookies/002.html.ini b/tests/wpt/metadata/websockets/cookies/002.html.ini new file mode 100644 index 00000000000..29a2058d988 --- /dev/null +++ b/tests/wpt/metadata/websockets/cookies/002.html.ini @@ -0,0 +1,3 @@ +[002.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/cookies/003.html.ini b/tests/wpt/metadata/websockets/cookies/003.html.ini new file mode 100644 index 00000000000..54a1c984464 --- /dev/null +++ b/tests/wpt/metadata/websockets/cookies/003.html.ini @@ -0,0 +1,5 @@ +[003.html] + type: testharness + [WebSockets: sending HttpOnly cookies in ws request] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/cookies/004.html.ini b/tests/wpt/metadata/websockets/cookies/004.html.ini new file mode 100644 index 00000000000..2c1c228a251 --- /dev/null +++ b/tests/wpt/metadata/websockets/cookies/004.html.ini @@ -0,0 +1,3 @@ +[004.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/cookies/005.html.ini b/tests/wpt/metadata/websockets/cookies/005.html.ini new file mode 100644 index 00000000000..6a14cc88a26 --- /dev/null +++ b/tests/wpt/metadata/websockets/cookies/005.html.ini @@ -0,0 +1,3 @@ +[005.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/cookies/006.html.ini b/tests/wpt/metadata/websockets/cookies/006.html.ini new file mode 100644 index 00000000000..4e881b4ff89 --- /dev/null +++ b/tests/wpt/metadata/websockets/cookies/006.html.ini @@ -0,0 +1,6 @@ +[006.html] + type: testharness + expected: TIMEOUT + [WebSockets: setting Secure cookie with document.cookie, checking ws request] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/cookies/007.html.ini b/tests/wpt/metadata/websockets/cookies/007.html.ini new file mode 100644 index 00000000000..d2689f1a8a9 --- /dev/null +++ b/tests/wpt/metadata/websockets/cookies/007.html.ini @@ -0,0 +1,3 @@ +[007.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/eventhandlers.html.ini b/tests/wpt/metadata/websockets/eventhandlers.html.ini new file mode 100644 index 00000000000..6008ad31697 --- /dev/null +++ b/tests/wpt/metadata/websockets/eventhandlers.html.ini @@ -0,0 +1,5 @@ +[eventhandlers.html] + type: testharness + [Event handler for message should have [TreatNonCallableAsNull\]] + expected: FAIL + diff --git a/tests/wpt/metadata/websockets/extended-payload-length.html.ini b/tests/wpt/metadata/websockets/extended-payload-length.html.ini new file mode 100644 index 00000000000..6e2f07bdb8f --- /dev/null +++ b/tests/wpt/metadata/websockets/extended-payload-length.html.ini @@ -0,0 +1,14 @@ +[extended-payload-length.html] + type: testharness + [Application data is 125 byte which means any 'Extended payload length' field isn't used at all.] + expected: TIMEOUT + + [Application data is 126 byte which starts to use the 16 bit 'Extended payload length' field.] + expected: TIMEOUT + + [Application data is 0xFFFF byte which means the upper bound of the 16 bit 'Extended payload length' field.] + expected: TIMEOUT + + [Application data is (0xFFFF + 1) byte which starts to use the 64 bit 'Extended payload length' field] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/interfaces.html.ini b/tests/wpt/metadata/websockets/interfaces.html.ini new file mode 100644 index 00000000000..5d81aa429a3 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces.html.ini @@ -0,0 +1,3 @@ +[interfaces.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/CloseEvent/clean-close.html.ini b/tests/wpt/metadata/websockets/interfaces/CloseEvent/clean-close.html.ini new file mode 100644 index 00000000000..db24428e624 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/CloseEvent/clean-close.html.ini @@ -0,0 +1,5 @@ +[clean-close.html] + type: testharness + [WebSockets: wasClean, true] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/interfaces/CloseEvent/historical.html.ini b/tests/wpt/metadata/websockets/interfaces/CloseEvent/historical.html.ini new file mode 100644 index 00000000000..c92115a5e11 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/CloseEvent/historical.html.ini @@ -0,0 +1,5 @@ +[historical.html] + type: testharness + [initCloseEvent] + expected: FAIL + diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-arraybuffer.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-arraybuffer.html.ini new file mode 100644 index 00000000000..a65cc4592a2 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-arraybuffer.html.ini @@ -0,0 +1,5 @@ +[bufferedAmount-arraybuffer.html] + type: testharness + [WebSockets: bufferedAmount for ArrayBuffer] + expected: FAIL + diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-blob.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-blob.html.ini new file mode 100644 index 00000000000..8f338d442f9 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-blob.html.ini @@ -0,0 +1,5 @@ +[bufferedAmount-blob.html] + type: testharness + [WebSockets: bufferedAmount for blob] + expected: FAIL + diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-defineProperty-getter.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-defineProperty-getter.html.ini new file mode 100644 index 00000000000..04c21c351cc --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-defineProperty-getter.html.ini @@ -0,0 +1,3 @@ +[bufferedAmount-defineProperty-getter.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-defineProperty-setter.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-defineProperty-setter.html.ini new file mode 100644 index 00000000000..48c575c6548 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-defineProperty-setter.html.ini @@ -0,0 +1,3 @@ +[bufferedAmount-defineProperty-setter.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-deleting.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-deleting.html.ini new file mode 100644 index 00000000000..6016ccea7a8 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-deleting.html.ini @@ -0,0 +1,5 @@ +[bufferedAmount-deleting.html] + type: testharness + [WebSockets: delete bufferedAmount] + expected: FAIL + diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-getting.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-getting.html.ini new file mode 100644 index 00000000000..1716fa2b8ee --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-getting.html.ini @@ -0,0 +1,5 @@ +[bufferedAmount-getting.html] + type: testharness + [WebSockets: bufferedAmount after send()ing] + expected: FAIL + diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-initial.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-initial.html.ini new file mode 100644 index 00000000000..0aa903c2809 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-initial.html.ini @@ -0,0 +1,3 @@ +[bufferedAmount-initial.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-large.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-large.html.ini new file mode 100644 index 00000000000..e558160bf65 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-large.html.ini @@ -0,0 +1,5 @@ +[bufferedAmount-large.html] + type: testharness + [WebSockets: bufferedAmount for 65K data] + expected: FAIL + diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-readonly.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-readonly.html.ini new file mode 100644 index 00000000000..9e6c0729ca8 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-readonly.html.ini @@ -0,0 +1,3 @@ +[bufferedAmount-readonly.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-unicode.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-unicode.html.ini new file mode 100644 index 00000000000..b83de1709e3 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-unicode.html.ini @@ -0,0 +1,5 @@ +[bufferedAmount-unicode.html] + type: testharness + [WebSockets: bufferedAmount for unicode data] + expected: FAIL + diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/close/close-basic.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/close/close-basic.html.ini new file mode 100644 index 00000000000..7e636b9c6d7 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/close/close-basic.html.ini @@ -0,0 +1,3 @@ +[close-basic.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/close/close-connecting.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/close/close-connecting.html.ini new file mode 100644 index 00000000000..2e6ba7f302b --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/close/close-connecting.html.ini @@ -0,0 +1,3 @@ +[close-connecting.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/close/close-multiple.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/close/close-multiple.html.ini new file mode 100644 index 00000000000..d61e6dff3eb --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/close/close-multiple.html.ini @@ -0,0 +1,3 @@ +[close-multiple.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/close/close-nested.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/close/close-nested.html.ini new file mode 100644 index 00000000000..3e347afd861 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/close/close-nested.html.ini @@ -0,0 +1,3 @@ +[close-nested.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/close/close-replace.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/close/close-replace.html.ini new file mode 100644 index 00000000000..ef58523d1b6 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/close/close-replace.html.ini @@ -0,0 +1,3 @@ +[close-replace.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/close/close-return.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/close/close-return.html.ini new file mode 100644 index 00000000000..a5b7ad82243 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/close/close-return.html.ini @@ -0,0 +1,3 @@ +[close-return.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/constants/001.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/constants/001.html.ini new file mode 100644 index 00000000000..b3538369e2e --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/constants/001.html.ini @@ -0,0 +1,3 @@ +[001.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/constants/002.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/constants/002.html.ini new file mode 100644 index 00000000000..29a2058d988 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/constants/002.html.ini @@ -0,0 +1,3 @@ +[002.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/constants/003.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/constants/003.html.ini new file mode 100644 index 00000000000..a88bf82075a --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/constants/003.html.ini @@ -0,0 +1,3 @@ +[003.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/constants/004.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/constants/004.html.ini new file mode 100644 index 00000000000..2c1c228a251 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/constants/004.html.ini @@ -0,0 +1,3 @@ +[004.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/events/001.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/001.html.ini new file mode 100644 index 00000000000..b3538369e2e --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/001.html.ini @@ -0,0 +1,3 @@ +[001.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/events/002.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/002.html.ini new file mode 100644 index 00000000000..29a2058d988 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/002.html.ini @@ -0,0 +1,3 @@ +[002.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/events/003.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/003.html.ini new file mode 100644 index 00000000000..a88bf82075a --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/003.html.ini @@ -0,0 +1,3 @@ +[003.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/events/004.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/004.html.ini new file mode 100644 index 00000000000..2c1c228a251 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/004.html.ini @@ -0,0 +1,3 @@ +[004.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/events/006.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/006.html.ini new file mode 100644 index 00000000000..9701e26d8e9 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/006.html.ini @@ -0,0 +1,3 @@ +[006.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/events/007.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/007.html.ini new file mode 100644 index 00000000000..d2689f1a8a9 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/007.html.ini @@ -0,0 +1,3 @@ +[007.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/events/008.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/008.html.ini new file mode 100644 index 00000000000..9fbd1fc405a --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/008.html.ini @@ -0,0 +1,3 @@ +[008.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/events/009.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/009.html.ini new file mode 100644 index 00000000000..2633411d86e --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/009.html.ini @@ -0,0 +1,3 @@ +[009.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/events/010.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/010.html.ini new file mode 100644 index 00000000000..4dc31aa432a --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/010.html.ini @@ -0,0 +1,3 @@ +[010.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/events/011.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/011.html.ini new file mode 100644 index 00000000000..7962549aeed --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/011.html.ini @@ -0,0 +1,3 @@ +[011.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/events/012.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/012.html.ini new file mode 100644 index 00000000000..778e50e98ce --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/012.html.ini @@ -0,0 +1,3 @@ +[012.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/events/013.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/013.html.ini new file mode 100644 index 00000000000..daaf79b28a8 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/013.html.ini @@ -0,0 +1,3 @@ +[013.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/events/014.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/014.html.ini new file mode 100644 index 00000000000..9a52a26517e --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/014.html.ini @@ -0,0 +1,3 @@ +[014.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/events/015.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/015.html.ini new file mode 100644 index 00000000000..7569d80fe8b --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/015.html.ini @@ -0,0 +1,6 @@ +[015.html] + type: testharness + expected: TIMEOUT + [WebSockets: instanceof on events] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/events/016.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/016.html.ini new file mode 100644 index 00000000000..92e4236a330 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/016.html.ini @@ -0,0 +1,6 @@ +[016.html] + type: testharness + expected: TIMEOUT + [WebSockets: addEventListener] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/events/017.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/017.html.ini new file mode 100644 index 00000000000..dac07f5dd0c --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/017.html.ini @@ -0,0 +1,6 @@ +[017.html] + type: testharness + expected: TIMEOUT + [WebSockets: this, e.target, e.currentTarget, e.eventPhase] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/events/018.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/018.html.ini new file mode 100644 index 00000000000..ae7a947e82f --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/018.html.ini @@ -0,0 +1,5 @@ +[018.html] + type: testharness + [WebSockets: toString(), bubbles, cancelable] + expected: FAIL + diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/events/020.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/020.html.ini new file mode 100644 index 00000000000..4a9fd623af2 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/events/020.html.ini @@ -0,0 +1,3 @@ +[020.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/extensions/001.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/extensions/001.html.ini new file mode 100644 index 00000000000..b3538369e2e --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/extensions/001.html.ini @@ -0,0 +1,3 @@ +[001.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/protocol/protocol-initial.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/protocol/protocol-initial.html.ini new file mode 100644 index 00000000000..d14ce5bd22e --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/protocol/protocol-initial.html.ini @@ -0,0 +1,3 @@ +[protocol-initial.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/readyState/001.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/readyState/001.html.ini new file mode 100644 index 00000000000..b3538369e2e --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/readyState/001.html.ini @@ -0,0 +1,3 @@ +[001.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/readyState/002.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/readyState/002.html.ini new file mode 100644 index 00000000000..29a2058d988 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/readyState/002.html.ini @@ -0,0 +1,3 @@ +[002.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/readyState/003.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/readyState/003.html.ini new file mode 100644 index 00000000000..a88bf82075a --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/readyState/003.html.ini @@ -0,0 +1,3 @@ +[003.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/readyState/004.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/readyState/004.html.ini new file mode 100644 index 00000000000..2c1c228a251 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/readyState/004.html.ini @@ -0,0 +1,3 @@ +[004.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/readyState/005.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/readyState/005.html.ini new file mode 100644 index 00000000000..6a14cc88a26 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/readyState/005.html.ini @@ -0,0 +1,3 @@ +[005.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/readyState/008.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/readyState/008.html.ini new file mode 100644 index 00000000000..bd002c46bb2 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/readyState/008.html.ini @@ -0,0 +1,6 @@ +[008.html] + type: testharness + expected: TIMEOUT + [WebSockets: getting readyState in closed] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/send/001.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/send/001.html.ini new file mode 100644 index 00000000000..b3538369e2e --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/send/001.html.ini @@ -0,0 +1,3 @@ +[001.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/send/002.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/send/002.html.ini new file mode 100644 index 00000000000..29a2058d988 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/send/002.html.ini @@ -0,0 +1,3 @@ +[002.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/send/003.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/send/003.html.ini new file mode 100644 index 00000000000..a88bf82075a --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/send/003.html.ini @@ -0,0 +1,3 @@ +[003.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/send/004.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/send/004.html.ini new file mode 100644 index 00000000000..2c1c228a251 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/send/004.html.ini @@ -0,0 +1,3 @@ +[004.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/send/006.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/send/006.html.ini new file mode 100644 index 00000000000..9701e26d8e9 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/send/006.html.ini @@ -0,0 +1,3 @@ +[006.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/send/007.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/send/007.html.ini new file mode 100644 index 00000000000..fe3812e4bbd --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/send/007.html.ini @@ -0,0 +1,6 @@ +[007.html] + type: testharness + expected: TIMEOUT + [WebSockets: close() followed by send()] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/send/008.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/send/008.html.ini new file mode 100644 index 00000000000..a47971c62f9 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/send/008.html.ini @@ -0,0 +1,6 @@ +[008.html] + type: testharness + expected: TIMEOUT + [WebSockets: send() in onclose] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/send/009.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/send/009.html.ini new file mode 100644 index 00000000000..eb30d042dd6 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/send/009.html.ini @@ -0,0 +1,6 @@ +[009.html] + type: testharness + expected: TIMEOUT + [WebSockets: send('')] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/send/010.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/send/010.html.ini new file mode 100644 index 00000000000..b658b9b5eaa --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/send/010.html.ini @@ -0,0 +1,36 @@ +[010.html] + type: testharness + expected: TIMEOUT + [Constructor succeeds] + expected: TIMEOUT + + [WebSockets: sending non-strings (null)] + expected: NOTRUN + + [WebSockets: sending non-strings (undefined)] + expected: NOTRUN + + [WebSockets: sending non-strings (1)] + expected: NOTRUN + + [WebSockets: sending non-strings ([object Window\])] + expected: NOTRUN + + [WebSockets: sending non-strings ([object HTMLBodyElement\])] + expected: NOTRUN + + [WebSockets: sending non-strings ([object Object\])] + expected: NOTRUN + + [WebSockets: sending non-strings ()] + expected: NOTRUN + + [WebSockets: sending non-strings ([object WebSocket\])] + expected: NOTRUN + + [WebSockets: sending non-strings (function (){})] + expected: NOTRUN + + [WebSockets: sending non-strings (Error)] + expected: NOTRUN + diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/send/011.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/send/011.html.ini new file mode 100644 index 00000000000..94cacc22d2d --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/send/011.html.ini @@ -0,0 +1,6 @@ +[011.html] + type: testharness + expected: TIMEOUT + [WebSockets: sending non-ascii, combining chars and non-BMP] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/send/012.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/send/012.html.ini new file mode 100644 index 00000000000..42f6c5278c6 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/send/012.html.ini @@ -0,0 +1,6 @@ +[012.html] + type: testharness + expected: TIMEOUT + [WebSockets: sending null] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/url/001.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/url/001.html.ini new file mode 100644 index 00000000000..b3538369e2e --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/url/001.html.ini @@ -0,0 +1,3 @@ +[001.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/url/002.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/url/002.html.ini new file mode 100644 index 00000000000..29a2058d988 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/url/002.html.ini @@ -0,0 +1,3 @@ +[002.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/url/003.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/url/003.html.ini new file mode 100644 index 00000000000..a88bf82075a --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/url/003.html.ini @@ -0,0 +1,3 @@ +[003.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/url/004.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/url/004.html.ini new file mode 100644 index 00000000000..2c1c228a251 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/url/004.html.ini @@ -0,0 +1,3 @@ +[004.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/url/005.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/url/005.html.ini new file mode 100644 index 00000000000..6a14cc88a26 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/url/005.html.ini @@ -0,0 +1,3 @@ +[005.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/interfaces/WebSocket/url/006.html.ini b/tests/wpt/metadata/websockets/interfaces/WebSocket/url/006.html.ini new file mode 100644 index 00000000000..9701e26d8e9 --- /dev/null +++ b/tests/wpt/metadata/websockets/interfaces/WebSocket/url/006.html.ini @@ -0,0 +1,3 @@ +[006.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/keeping-connection-open/001.html.ini b/tests/wpt/metadata/websockets/keeping-connection-open/001.html.ini new file mode 100644 index 00000000000..3c26bf005a7 --- /dev/null +++ b/tests/wpt/metadata/websockets/keeping-connection-open/001.html.ini @@ -0,0 +1,5 @@ +[001.html] + type: testharness + [WebSockets: 20s inactivity after handshake] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/opening-handshake/001.html.ini b/tests/wpt/metadata/websockets/opening-handshake/001.html.ini new file mode 100644 index 00000000000..b3538369e2e --- /dev/null +++ b/tests/wpt/metadata/websockets/opening-handshake/001.html.ini @@ -0,0 +1,3 @@ +[001.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/opening-handshake/002.html.ini b/tests/wpt/metadata/websockets/opening-handshake/002.html.ini new file mode 100644 index 00000000000..947c3f19f0d --- /dev/null +++ b/tests/wpt/metadata/websockets/opening-handshake/002.html.ini @@ -0,0 +1,5 @@ +[002.html] + type: testharness + [WebSockets: valid handshake] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/opening-handshake/003.html.ini b/tests/wpt/metadata/websockets/opening-handshake/003.html.ini new file mode 100644 index 00000000000..6135cc04abd --- /dev/null +++ b/tests/wpt/metadata/websockets/opening-handshake/003.html.ini @@ -0,0 +1,6 @@ +[003.html] + type: testharness + expected: TIMEOUT + [WebSockets: origin] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/opening-handshake/005.html.ini b/tests/wpt/metadata/websockets/opening-handshake/005.html.ini new file mode 100644 index 00000000000..6a14cc88a26 --- /dev/null +++ b/tests/wpt/metadata/websockets/opening-handshake/005.html.ini @@ -0,0 +1,3 @@ +[005.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/security/001.html.ini b/tests/wpt/metadata/websockets/security/001.html.ini new file mode 100644 index 00000000000..b3538369e2e --- /dev/null +++ b/tests/wpt/metadata/websockets/security/001.html.ini @@ -0,0 +1,3 @@ +[001.html] + type: testharness + expected: TIMEOUT diff --git a/tests/wpt/metadata/websockets/security/002.html.ini b/tests/wpt/metadata/websockets/security/002.html.ini new file mode 100644 index 00000000000..facc1e108b9 --- /dev/null +++ b/tests/wpt/metadata/websockets/security/002.html.ini @@ -0,0 +1,5 @@ +[002.html] + type: testharness + [WebSockets: check Sec-WebSocket-Key] + expected: FAIL + diff --git a/tests/wpt/metadata/websockets/unload-a-document/001.html.ini b/tests/wpt/metadata/websockets/unload-a-document/001.html.ini new file mode 100644 index 00000000000..1d1e991b808 --- /dev/null +++ b/tests/wpt/metadata/websockets/unload-a-document/001.html.ini @@ -0,0 +1,5 @@ +[001.html] + type: testharness + [WebSockets: navigating top-level browsing context] + expected: FAIL + diff --git a/tests/wpt/metadata/websockets/unload-a-document/002.html.ini b/tests/wpt/metadata/websockets/unload-a-document/002.html.ini new file mode 100644 index 00000000000..72e2056cf24 --- /dev/null +++ b/tests/wpt/metadata/websockets/unload-a-document/002.html.ini @@ -0,0 +1,5 @@ +[002.html] + type: testharness + [WebSockets: navigating top-level browsing context with closed websocket] + expected: FAIL + diff --git a/tests/wpt/metadata/websockets/unload-a-document/003.html.ini b/tests/wpt/metadata/websockets/unload-a-document/003.html.ini new file mode 100644 index 00000000000..0f8dd7f068d --- /dev/null +++ b/tests/wpt/metadata/websockets/unload-a-document/003.html.ini @@ -0,0 +1,6 @@ +[003.html] + type: testharness + expected: TIMEOUT + [WebSockets: navigating nested browsing context] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/unload-a-document/004.html.ini b/tests/wpt/metadata/websockets/unload-a-document/004.html.ini new file mode 100644 index 00000000000..51828d4eabd --- /dev/null +++ b/tests/wpt/metadata/websockets/unload-a-document/004.html.ini @@ -0,0 +1,5 @@ +[004.html] + type: testharness + [WebSockets: navigating nested browsing context with closed websocket] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/websockets/unload-a-document/005.html.ini b/tests/wpt/metadata/websockets/unload-a-document/005.html.ini new file mode 100644 index 00000000000..438afe3993d --- /dev/null +++ b/tests/wpt/metadata/websockets/unload-a-document/005.html.ini @@ -0,0 +1,5 @@ +[005.html] + type: testharness + [WebSockets: navigating nested browsing context with a websocket in top-level] + expected: FAIL + diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 110dd12da11..841aa8f1c5b 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -15,6 +15,54 @@ "deleted": [], "items": { "reftest": { + "css/abs_float_pref_width.html": [ + { + "path": "css/abs_float_pref_width.html", + "references": [ + [ + "/_mozilla/css/abs_float_pref_width-ref.html", + "==" + ] + ], + "url": "/_mozilla/css/abs_float_pref_width.html" + } + ], + "css/absolute_clipping_of_own_contents.html": [ + { + "path": "css/absolute_clipping_of_own_contents.html", + "references": [ + [ + "/_mozilla/css/absolute_clipping_of_own_contents_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/absolute_clipping_of_own_contents.html" + } + ], + "css/absolute_content_height.html": [ + { + "path": "css/absolute_content_height.html", + "references": [ + [ + "/_mozilla/css/absolute_content_height_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/absolute_content_height.html" + } + ], + "css/absolute_hypothetical_float.html": [ + { + "path": "css/absolute_hypothetical_float.html", + "references": [ + [ + "/_mozilla/css/absolute_hypothetical_float_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/absolute_hypothetical_float.html" + } + ], "css/class-namespaces.html": [ { "path": "css/class-namespaces.html", @@ -524,6 +572,54 @@ } }, "reftest_nodes": { + "css/abs_float_pref_width.html": [ + { + "path": "css/abs_float_pref_width.html", + "references": [ + [ + "/_mozilla/css/abs_float_pref_width-ref.html", + "==" + ] + ], + "url": "/_mozilla/css/abs_float_pref_width.html" + } + ], + "css/absolute_clipping_of_own_contents.html": [ + { + "path": "css/absolute_clipping_of_own_contents.html", + "references": [ + [ + "/_mozilla/css/absolute_clipping_of_own_contents_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/absolute_clipping_of_own_contents.html" + } + ], + "css/absolute_content_height.html": [ + { + "path": "css/absolute_content_height.html", + "references": [ + [ + "/_mozilla/css/absolute_content_height_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/absolute_content_height.html" + } + ], + "css/absolute_hypothetical_float.html": [ + { + "path": "css/absolute_hypothetical_float.html", + "references": [ + [ + "/_mozilla/css/absolute_hypothetical_float_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/absolute_hypothetical_float.html" + } + ], "css/class-namespaces.html": [ { "path": "css/class-namespaces.html", @@ -542,4 +638,4 @@ "rev": null, "url_base": "/_mozilla/", "version": 2 -} +}
\ No newline at end of file diff --git a/tests/ref/abs_float_pref_width_ref.html b/tests/wpt/mozilla/tests/css/abs_float_pref_width-ref.html index 2b35cb62eb4..2b35cb62eb4 100644 --- a/tests/ref/abs_float_pref_width_ref.html +++ b/tests/wpt/mozilla/tests/css/abs_float_pref_width-ref.html diff --git a/tests/ref/abs_float_pref_width_a.html b/tests/wpt/mozilla/tests/css/abs_float_pref_width.html index 65714506722..2bd75d4da7b 100644 --- a/tests/ref/abs_float_pref_width_a.html +++ b/tests/wpt/mozilla/tests/css/abs_float_pref_width.html @@ -1,6 +1,7 @@ <!DOCTYPE html> <html> <head> + <link rel=match href="abs_float_pref_width-ref.html"> <style type="text/css"> @font-face { font-family: 'ahem'; diff --git a/tests/ref/absolute_clipping_of_own_contents_a.html b/tests/wpt/mozilla/tests/css/absolute_clipping_of_own_contents.html index b018d799a86..19919ff89c7 100644 --- a/tests/ref/absolute_clipping_of_own_contents_a.html +++ b/tests/wpt/mozilla/tests/css/absolute_clipping_of_own_contents.html @@ -2,6 +2,7 @@ <html> <head> <!-- Tests that clipping is preserved properly for nested `position: absolute` elements. --> +<link rel=match href=absolute_clipping_of_own_contents_ref.html> <style> body, html { margin: 0; diff --git a/tests/ref/absolute_clipping_of_own_contents_ref.html b/tests/wpt/mozilla/tests/css/absolute_clipping_of_own_contents_ref.html index 96608da13c9..96608da13c9 100644 --- a/tests/ref/absolute_clipping_of_own_contents_ref.html +++ b/tests/wpt/mozilla/tests/css/absolute_clipping_of_own_contents_ref.html diff --git a/tests/ref/absolute_content_height_a.html b/tests/wpt/mozilla/tests/css/absolute_content_height.html index 8f12b89aef8..80ac5b8daae 100644 --- a/tests/ref/absolute_content_height_a.html +++ b/tests/wpt/mozilla/tests/css/absolute_content_height.html @@ -1,6 +1,7 @@ <!DOCTYPE html> <html> <head> +<link rel=match href=absolute_content_height_ref.html> <style> section { position: absolute; diff --git a/tests/ref/absolute_content_height_ref.html b/tests/wpt/mozilla/tests/css/absolute_content_height_ref.html index bb239ed179f..bb239ed179f 100644 --- a/tests/ref/absolute_content_height_ref.html +++ b/tests/wpt/mozilla/tests/css/absolute_content_height_ref.html diff --git a/tests/ref/absolute_hypothetical_float_a.html b/tests/wpt/mozilla/tests/css/absolute_hypothetical_float.html index 78f1c70e04d..33506180d15 100644 --- a/tests/ref/absolute_hypothetical_float_a.html +++ b/tests/wpt/mozilla/tests/css/absolute_hypothetical_float.html @@ -1,6 +1,7 @@ <!DOCTYPE html> <html> <head> +<link rel=match href=absolute_hypothetical_float_ref.html> <style> #a { float: right; diff --git a/tests/ref/absolute_hypothetical_float_ref.html b/tests/wpt/mozilla/tests/css/absolute_hypothetical_float_ref.html index 008b2a65d29..008b2a65d29 100644 --- a/tests/ref/absolute_hypothetical_float_ref.html +++ b/tests/wpt/mozilla/tests/css/absolute_hypothetical_float_ref.html diff --git a/tests/wpt/mozilla/tests/css/fonts/ahem/COPYING b/tests/wpt/mozilla/tests/css/fonts/ahem/COPYING new file mode 100644 index 00000000000..6327b904bed --- /dev/null +++ b/tests/wpt/mozilla/tests/css/fonts/ahem/COPYING @@ -0,0 +1,36 @@ +The Ahem font in this directory belongs to the public domain. In +jurisdictions that do not recognize public domain ownership of these +files, the following Creative Commons Zero declaration applies: + +<http://labs.creativecommons.org/licenses/zero-waive/1.0/us/legalcode> + +which is quoted below: + + The person who has associated a work with this document (the "Work") + affirms that he or she (the "Affirmer") is the/an author or owner of + the Work. The Work may be any work of authorship, including a + database. + + The Affirmer hereby fully, permanently and irrevocably waives and + relinquishes all of her or his copyright and related or neighboring + legal rights in the Work available under any federal or state law, + treaty or contract, including but not limited to moral rights, + publicity and privacy rights, rights protecting against unfair + competition and any rights protecting the extraction, dissemination + and reuse of data, whether such rights are present or future, vested + or contingent (the "Waiver"). The Affirmer makes the Waiver for the + benefit of the public at large and to the detriment of the Affirmer's + heirs or successors. + + The Affirmer understands and intends that the Waiver has the effect + of eliminating and entirely removing from the Affirmer's control all + the copyright and related or neighboring legal rights previously held + by the Affirmer in the Work, to that extent making the Work freely + available to the public for any and all uses and purposes without + restriction of any kind, including commercial use and uses in media + and formats or by methods that have not yet been invented or + conceived. Should the Waiver for any reason be judged legally + ineffective in any jurisdiction, the Affirmer hereby grants a free, + full, permanent, irrevocable, nonexclusive and worldwide license for + all her or his copyright and related or neighboring legal rights in + the Work. diff --git a/tests/wpt/mozilla/tests/css/fonts/ahem/README b/tests/wpt/mozilla/tests/css/fonts/ahem/README new file mode 100644 index 00000000000..7a4fcea05a1 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/fonts/ahem/README @@ -0,0 +1,30 @@ +The Ahem font was developed by Todd Fahrner to help test writers +develop predictable tests. The font's em square is exactly square. +Its ascent and descent is exactly the size of the em square. This +means that the font's extent is exactly the same as its line-height, +meaning that it can be exactly aligned with padding, borders, margins, +and so forth. + +The font's alphabetic baseline is 0.2em above its bottom, and 0.8em +below its top. The font has an x-height of 0.8em. + +The font has four glyphs: + + 'X' U+0058 A square exactly 1em in height and width. + + 'p' U+0070 A rectangle exactly 0.2em high, 1em wide, and aligned so + that its top is flush with the baseline. + + 'É' U+00C9 A rectangle exactly 0.8em high, 1em wide, and aligned so + that its bottom is flush with the baseline. + + ' ' U+0020 A transparent space exactly 1em high and wide. + +Most other US-ASCII characters in the font have the same glyph as X. + +The Ahem font belongs to the public domain as described in COPYING. + +Acknowledgements: The font was originally created by Todd Fahrner in +the late 90s, and was updated by Paul Nelson in the mid 2000s. The +changes were the introduction of x-height information to the OS/2 +table and the addition of the space and non-breaking space glyphs. diff --git a/tests/wpt/mozilla/tests/css/fonts/ahem/ahem.ttf b/tests/wpt/mozilla/tests/css/fonts/ahem/ahem.ttf Binary files differnew file mode 100644 index 00000000000..ac81cb03165 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/fonts/ahem/ahem.ttf diff --git a/tests/wpt/mozilla/tests/mozilla/getBoundingClientRect.html b/tests/wpt/mozilla/tests/mozilla/getBoundingClientRect.html index 8d65b672072..6571fedabed 100644 --- a/tests/wpt/mozilla/tests/mozilla/getBoundingClientRect.html +++ b/tests/wpt/mozilla/tests/mozilla/getBoundingClientRect.html @@ -3,18 +3,68 @@ <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <style> -div { +@font-face { + font-family: 'ahem'; + src: url(../css/fonts/ahem/ahem.ttf); +} +#rel-div { position: relative; top: 100px; left: 100px; width: 100px; height: 100px; } +#abs1 { + position: absolute; + background-color: red; + top: 45px; + left: 55px; + width: 100px; + height: 120px; +} +#abs2 { + position: absolute; + background-color: green; + top: 5px; + left: 5px; + width: 80px; + height: 80px; +} +#abs3 { + position: absolute; + background-color: blue; + top: 12px; + left: 14px; + width: 48px; + height: 40px; +} +#span1 { + font-family: 'ahem'; + font-size: 20px; + line-height: 1; +} </style> </head> <body> - <div>my div</div> + <div id="rel-div">my div</div> + <div id="abs1"> + <div id="abs2"> + <div id="abs3"> + <span id="span1">X</span> + </div> + </div> + </div> <script> + test_rect = function(name, left, top, bottom, right) { + var div = document.getElementById(name); + var rect = div.getBoundingClientRect(); + + assert_equals(rect.left, left); + assert_equals(rect.top, top); + assert_equals(rect.bottom, bottom); + assert_equals(rect.right, right); + } + test(function() { assert_equals(String(DOMRect).indexOf("function DOMRect("), 0); @@ -32,6 +82,13 @@ div { assert_equals(rect.width, rect.right - rect.left); assert_equals(rect.height, rect.bottom - rect.top); }); + + test(function() { + test_rect('abs1', 55, 45, 165, 155); + test_rect('abs2', 60, 50, 130, 140); + test_rect('abs3', 74, 62, 102, 122); + test_rect('span1', 74, 62, 82, 94); + }); </script> </body> </html> diff --git a/tests/wpt/mozilla/tests/mozilla/interfaces.html b/tests/wpt/mozilla/tests/mozilla/interfaces.html index f31afc50ec9..821f3715c97 100644 --- a/tests/wpt/mozilla/tests/mozilla/interfaces.html +++ b/tests/wpt/mozilla/tests/mozilla/interfaces.html @@ -58,6 +58,7 @@ var interfaceNamesInGlobalScope = [ "CanvasRenderingContext2D", "CanvasPattern", "CharacterData", + "CloseEvent", "CSS", "CSSStyleDeclaration", "DOMRect", @@ -177,6 +178,11 @@ var interfaceNamesInGlobalScope = [ "URLSearchParams", "ValidityState", "WebGLRenderingContext", + "WebGLUniformLocation", + "WebGLBuffer", + "WebGLProgram", + "WebGLShader", + "WebGLObject", "WebSocket", "Window", "Worker", diff --git a/tests/ref/2x2.png b/tests/wpt/web-platform-tests/2dcontext/2x2.png Binary files differindex 276791c4348..276791c4348 100644 --- a/tests/ref/2x2.png +++ b/tests/wpt/web-platform-tests/2dcontext/2x2.png diff --git a/tests/ref/2dcontext/drawimage_canvas_1.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_1.html index 4c3ab02b123..871e279ac55 100644 --- a/tests/ref/2dcontext/drawimage_canvas_1.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_1.html @@ -1,14 +1,11 @@ <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<meta charset="utf-8"> +<link rel=match href=drawimage_canvas_1_ref.html> <style> html, body { margin: 0; } </style> -<body> <canvas id="dest" height="100" width="100"></canvas> <script> @@ -35,5 +32,3 @@ destCtx.imageSmoothingEnabled = smoothingEnabled; destCtx.drawImage(sourceCanvas, 0, 0); </script> -</body> -</html>
\ No newline at end of file diff --git a/tests/ref/2dcontext/drawimage_canvas_10.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_10.html index 35f7245c563..14e15ffc3f8 100644 --- a/tests/ref/2dcontext/drawimage_canvas_10.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_10.html @@ -1,14 +1,11 @@ <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<meta charset="utf-8"> +<link rel=match href=drawimage_canvas_10_ref.html> <style> html, body { margin: 0; } </style> -<body> <canvas id="dest" height="100" width="100"></canvas> <script> @@ -39,5 +36,3 @@ destCtx.imageSmoothingEnabled = smoothingEnabled; destCtx.drawImage(sourceCanvas, 0, 0, 50, 50, 0, 0, 200, 200); </script> -</body> -</html> diff --git a/tests/ref/2dcontext/drawimage_canvas_10_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_10_ref.html index cd05233b8f7..cd05233b8f7 100644 --- a/tests/ref/2dcontext/drawimage_canvas_10_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_10_ref.html diff --git a/tests/ref/2dcontext/drawimage_canvas_11.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_11.html index b0f148527be..e06dfc0df7e 100644 --- a/tests/ref/2dcontext/drawimage_canvas_11.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_11.html @@ -1,14 +1,11 @@ - <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<!DOCTYPE html> +<meta charset="utf-8"> +<link rel=match href=drawimage_canvas_11_ref.html> <style> html, body { margin: 0; } </style> -<body> <canvas id="dest" height="100" width="100"></canvas> <script> @@ -37,5 +34,3 @@ destCtx.imageSmoothingEnabled = smoothingEnabled; destCtx.drawImage(sourceCanvas, 0, 0, 100, 100, 0, 0, 50, 50); </script> -</body> -</html> diff --git a/tests/ref/2dcontext/drawimage_canvas_11_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_11_ref.html index 970f626dfbd..970f626dfbd 100644 --- a/tests/ref/2dcontext/drawimage_canvas_11_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_11_ref.html diff --git a/tests/ref/2dcontext/drawimage_canvas_12.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_12.html index 36a31cbaf2c..47debc796ec 100644 --- a/tests/ref/2dcontext/drawimage_canvas_12.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_12.html @@ -1,14 +1,11 @@ - <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<!DOCTYPE html> +<meta charset="utf-8"> +<link rel=match href=drawimage_canvas_12_ref.html> <style> html, body { margin: 0; } </style> -<body> <canvas id="dest" height="100" width="100"></canvas> <script> @@ -37,5 +34,3 @@ destCtx.imageSmoothingEnabled = smoothingEnabled; destCtx.drawImage(sourceCanvas, -25, -25, 50, 50, 0, 0, 50, 50); </script> -</body> -</html> diff --git a/tests/ref/2dcontext/drawimage_canvas_12_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_12_ref.html index 190f74f93ef..190f74f93ef 100644 --- a/tests/ref/2dcontext/drawimage_canvas_12_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_12_ref.html diff --git a/tests/ref/2dcontext/drawimage_canvas_1_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_1_ref.html index d0bac45ed5b..d0bac45ed5b 100644 --- a/tests/ref/2dcontext/drawimage_canvas_1_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_1_ref.html diff --git a/tests/ref/2dcontext/drawimage_canvas_2.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_2.html index 3cca00648c8..b169d3743c4 100644 --- a/tests/ref/2dcontext/drawimage_canvas_2.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_2.html @@ -1,14 +1,11 @@ <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<meta charset="utf-8"> +<link rel=match href=drawimage_canvas_2_ref.html> <style> html, body { margin: 0; } </style> -<body> <canvas id="dest" height="100" width="100"></canvas> <script> @@ -36,5 +33,3 @@ destCtx.imageSmoothingEnabled = smoothingEnabled; destCtx.drawImage(sourceCanvas, 25, 25); </script> -</body> -</html>
\ No newline at end of file diff --git a/tests/ref/2dcontext/drawimage_canvas_2_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_2_ref.html index 72ec289f714..72ec289f714 100644 --- a/tests/ref/2dcontext/drawimage_canvas_2_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_2_ref.html diff --git a/tests/ref/2dcontext/drawimage_canvas_3.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_3.html index 392723bd9f7..e59e5d352de 100644 --- a/tests/ref/2dcontext/drawimage_canvas_3.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_3.html @@ -1,14 +1,11 @@ <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<meta charset="utf-8"> +<link rel=match href=drawimage_canvas_3_ref.html> <style> html, body { margin: 0; } </style> -<body> <canvas id="dest" height="100" width="100"></canvas> <script> @@ -37,5 +34,3 @@ destCtx.imageSmoothingEnabled = smoothingEnabled; destCtx.drawImage(sourceCanvas, 50, 50, 50, 50); </script> -</body> -</html>
\ No newline at end of file diff --git a/tests/ref/2dcontext/drawimage_canvas_3_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_3_ref.html index 3e153f1ca65..3e153f1ca65 100644 --- a/tests/ref/2dcontext/drawimage_canvas_3_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_3_ref.html diff --git a/tests/ref/2dcontext/drawimage_canvas_4.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_4.html index a46986a68f0..f3dd84e2a35 100644 --- a/tests/ref/2dcontext/drawimage_canvas_4.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_4.html @@ -1,14 +1,11 @@ <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<meta charset="utf-8"> +<link rel=match href=drawimage_canvas_4_ref.html> <style> html, body { margin: 0; } </style> -<body> <canvas id="dest" height="100" width="100"></canvas> <script> @@ -38,5 +35,3 @@ destCtx.imageSmoothingEnabled = smoothingEnabled; destCtx.drawImage(sourceCanvas, 50, 50, 20, 20); </script> -</body> -</html>
\ No newline at end of file diff --git a/tests/ref/2dcontext/drawimage_canvas_4_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_4_ref.html index 9a8cc99371c..9a8cc99371c 100644 --- a/tests/ref/2dcontext/drawimage_canvas_4_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_4_ref.html diff --git a/tests/ref/2dcontext/drawimage_canvas_5.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_5.html index 0ddff823a35..2190847f8be 100644 --- a/tests/ref/2dcontext/drawimage_canvas_5.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_5.html @@ -1,14 +1,11 @@ <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<meta charset="utf-8"> +<link rel=match href=drawimage_canvas_5_ref.html> <style> html, body { margin: 0; } </style> -<body> <canvas id="dest" height="100" width="100"></canvas> <script> @@ -37,5 +34,3 @@ destCtx.imageSmoothingEnabled = smoothingEnabled; destCtx.drawImage(sourceCanvas, 50, 50, 50, 20); </script> -</body> -</html> diff --git a/tests/ref/2dcontext/drawimage_canvas_5_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_5_ref.html index 47dd63ee2b3..47dd63ee2b3 100644 --- a/tests/ref/2dcontext/drawimage_canvas_5_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_5_ref.html diff --git a/tests/ref/2dcontext/drawimage_canvas_6.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_6.html index e94efaadfa1..2ce48d8fafd 100644 --- a/tests/ref/2dcontext/drawimage_canvas_6.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_6.html @@ -1,14 +1,11 @@ <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<meta charset="utf-8"> +<link rel=match href=drawimage_canvas_6_ref.html> <style> html, body { margin: 0; } </style> -<body> <canvas id="dest" height="100" width="100"></canvas> <script> @@ -37,5 +34,3 @@ destCtx.imageSmoothingEnabled = smoothingEnabled; destCtx.drawImage(sourceCanvas, 0, 0, 25, 25, 0, 0, 25, 25); </script> -</body> -</html>
\ No newline at end of file diff --git a/tests/ref/2dcontext/drawimage_canvas_6_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_6_ref.html index 190f74f93ef..190f74f93ef 100644 --- a/tests/ref/2dcontext/drawimage_canvas_6_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_6_ref.html diff --git a/tests/ref/2dcontext/drawimage_canvas_7.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_7.html index 9ace085d979..1952909211d 100644 --- a/tests/ref/2dcontext/drawimage_canvas_7.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_7.html @@ -1,14 +1,11 @@ <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<meta charset="utf-8"> +<link rel=match href=drawimage_canvas_7_ref.html> <style> html, body { margin: 0; } </style> -<body> <canvas id="dest" height="100" width="100"></canvas> <script> @@ -37,5 +34,3 @@ destCtx.imageSmoothingEnabled = smoothingEnabled; destCtx.drawImage(sourceCanvas, 0, 0, 25, 25, 25, 25, 25, 25); </script> -</body> -</html>
\ No newline at end of file diff --git a/tests/ref/2dcontext/drawimage_canvas_7_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_7_ref.html index 51b2b276cad..51b2b276cad 100644 --- a/tests/ref/2dcontext/drawimage_canvas_7_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_7_ref.html diff --git a/tests/ref/2dcontext/drawimage_canvas_8.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_8.html index d1c1f5bced6..c47a5b55ce9 100644 --- a/tests/ref/2dcontext/drawimage_canvas_8.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_8.html @@ -1,14 +1,11 @@ <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<meta charset="utf-8"> +<link rel=match href=drawimage_canvas_8_ref.html> <style> html, body { margin: 0; } </style> -<body> <canvas id="dest" height="100" width="100"></canvas> <script> @@ -37,5 +34,3 @@ destCtx.imageSmoothingEnabled = smoothingEnabled; destCtx.drawImage(sourceCanvas, 25, 25, 50, 50, 0, 0, 50, 50); </script> -</body> -</html>
\ No newline at end of file diff --git a/tests/ref/2dcontext/drawimage_canvas_8_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_8_ref.html index 652bf6eb994..652bf6eb994 100644 --- a/tests/ref/2dcontext/drawimage_canvas_8_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_8_ref.html diff --git a/tests/ref/2dcontext/drawimage_canvas_9.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_9.html index 510f9c923c2..7cb61b67aee 100644 --- a/tests/ref/2dcontext/drawimage_canvas_9.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_9.html @@ -1,8 +1,6 @@ <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<meta charset="utf-8"> +<link rel=match href=drawimage_canvas_9_ref.html> <style> html, body { margin: 0; @@ -44,5 +42,3 @@ catch(err) { } </script> -</body> -</html> diff --git a/tests/ref/2dcontext/drawimage_canvas_9_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_9_ref.html index b9be7e514f1..b9be7e514f1 100644 --- a/tests/ref/2dcontext/drawimage_canvas_9_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_9_ref.html diff --git a/tests/ref/2dcontext/drawimage_html_image_1.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1.html index 9619103b0fe..ea5be1227cf 100644 --- a/tests/ref/2dcontext/drawimage_html_image_1.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1.html @@ -1,14 +1,11 @@ <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<meta charset="utf-8"> +<link rel=match href=drawimage_html_image_1_ref.html> <style> html, body { margin: 0; } </style> -<body> <canvas id="dest" height="100" width="100"></canvas> <script> @@ -17,7 +14,7 @@ var sourceHeight = 100; var smoothingEnabled = false; var destCanvas = document.getElementById('dest'); var sourceImg = document.createElement('img'); -sourceImg.src = '../rust-0.png' +sourceImg.src = '../2x2.png' sourceImg.width = sourceWidth; sourceImg.height = sourceHeight; @@ -30,5 +27,3 @@ destCtx.imageSmoothingEnabled = smoothingEnabled; destCtx.drawImage(sourceImg, 0, 0); </script> -</body> -</html> diff --git a/tests/ref/2dcontext/drawimage_html_image_10.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_10.html index 704e51109b6..68363633382 100644 --- a/tests/ref/2dcontext/drawimage_html_image_10.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_10.html @@ -1,14 +1,11 @@ <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<meta charset="utf-8"> +<link rel=match href=drawimage_html_image_10_ref.html> <style> html, body { margin: 0; } </style> -<body> <canvas id="dest" height="100" width="100"></canvas> <script> @@ -34,5 +31,3 @@ destCtx.imageSmoothingEnabled = smoothingEnabled; destCtx.drawImage(sourceImg, 0, 0, 512, 512, 0, 0, 256, 256); </script> -</body> -</html> diff --git a/tests/ref/2dcontext/drawimage_html_image_10_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_10_ref.html index 60545df17ff..60545df17ff 100644 --- a/tests/ref/2dcontext/drawimage_html_image_10_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_10_ref.html diff --git a/tests/ref/2dcontext/drawimage_html_image_11.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_11.html index fa3ad4125f8..d21d3d925b1 100644 --- a/tests/ref/2dcontext/drawimage_html_image_11.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_11.html @@ -1,14 +1,11 @@ <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<meta charset="utf-8"> +<link rel=match href=drawimage_html_image_11_ref.html> <style> html, body { margin: 0; } </style> -<body> <canvas id="dest" height="100" width="100"></canvas> <script> @@ -32,5 +29,3 @@ destCtx.imageSmoothingEnabled = smoothingEnabled; destCtx.drawImage(sourceImg, 0, 0, 2048, 2048, 0, 0, 800, 800); </script> -</body> -</html> diff --git a/tests/ref/2dcontext/drawimage_html_image_11_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_11_ref.html index 10d8885f2b0..10d8885f2b0 100644 --- a/tests/ref/2dcontext/drawimage_html_image_11_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_11_ref.html diff --git a/tests/ref/2dcontext/drawimage_html_image_12.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_12.html index a9a7560b94b..dc9c8d6bb7d 100644 --- a/tests/ref/2dcontext/drawimage_html_image_12.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_12.html @@ -1,14 +1,11 @@ <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<meta charset="utf-8"> +<link rel=match href=drawimage_html_image_12_ref.html> <style> html, body { margin: 0; } </style> -<body> <canvas id="dest" height="100" width="100"></canvas> <script> @@ -32,5 +29,3 @@ destCtx.imageSmoothingEnabled = smoothingEnabled; destCtx.drawImage(sourceImg, -25, -25, 50, 50, 0, 0, 50, 50); </script> -</body> -</html> diff --git a/tests/ref/2dcontext/drawimage_html_image_12_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_12_ref.html index 5f6f22111da..5f6f22111da 100644 --- a/tests/ref/2dcontext/drawimage_html_image_12_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_12_ref.html diff --git a/tests/ref/2dcontext/drawimage_html_image_13.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_13.html index 4d81d63b8b1..43f9512dbcf 100644 --- a/tests/ref/2dcontext/drawimage_html_image_13.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_13.html @@ -1,14 +1,11 @@ <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<meta charset="utf-8"> +<link rel=match href=drawimage_html_image_13_ref.html> <style> html, body { margin: 0; } </style> -<body> <canvas id="dest" height="100" width="100"></canvas> <script> @@ -40,5 +37,3 @@ catch(err) { } </script> -</body> -</html> diff --git a/tests/ref/2dcontext/drawimage_html_image_13_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_13_ref.html index 9ac306a5cc6..9ac306a5cc6 100644 --- a/tests/ref/2dcontext/drawimage_html_image_13_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_13_ref.html diff --git a/tests/ref/2dcontext/drawimage_html_image_1_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1_ref.html index 78c31206c50..60545df17ff 100644 --- a/tests/ref/2dcontext/drawimage_html_image_1_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1_ref.html @@ -10,7 +10,7 @@ #destination { width: 100px; height: 100px; - background-image: url("../rust-0.png"); + background-image: url("../2x2.png"); } </style> <body> diff --git a/tests/ref/2dcontext/drawimage_html_image_2.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_2.html index e38c85fc27e..9eeaae95ebb 100644 --- a/tests/ref/2dcontext/drawimage_html_image_2.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_2.html @@ -1,14 +1,11 @@ <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<meta charset="utf-8"> +<link rel=match href=drawimage_html_image_2_ref.html> <style> html, body { margin: 0; } </style> -<body> <canvas id="dest" height="100" width="100"></canvas> <script> @@ -17,7 +14,7 @@ var sourceHeight = 100; var smoothingEnabled = false; var destCanvas = document.getElementById('dest'); var sourceImg = document.createElement('img'); -sourceImg.src = '../rust-0.png' +sourceImg.src = '../2x2.png' sourceImg.width = sourceWidth; sourceImg.height = sourceHeight; @@ -31,5 +28,3 @@ destCtx.imageSmoothingEnabled = smoothingEnabled; destCtx.drawImage(sourceImg, 25, 25); </script> -</body> -</html> diff --git a/tests/ref/2dcontext/drawimage_html_image_2_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_2_ref.html index c8f719b2b14..c4535283500 100644 --- a/tests/ref/2dcontext/drawimage_html_image_2_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_2_ref.html @@ -12,7 +12,7 @@ width: 100px; height: 100px; background-color: red; - background-image: url("../rust-0.png"); + background-image: url("../2x2.png"); background-position: 25px 25px; background-repeat: no-repeat; } diff --git a/tests/ref/2dcontext/drawimage_html_image_3.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_3.html index 8a85fc2fef9..63b303944ba 100644 --- a/tests/ref/2dcontext/drawimage_html_image_3.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_3.html @@ -1,14 +1,11 @@ <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<meta charset="utf-8"> +<link rel=match href=drawimage_html_image_3_ref.html> <style> html, body { margin: 0; } </style> -<body> <canvas id="dest" height="100" width="100"></canvas> <script> @@ -31,5 +28,3 @@ destCtx.imageSmoothingEnabled = smoothingEnabled; destCtx.drawImage(sourceImg, 50, 50, 50, 50); </script> -</body> -</html> diff --git a/tests/ref/2dcontext/drawimage_html_image_3_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_3_ref.html index b72687a8ace..b72687a8ace 100644 --- a/tests/ref/2dcontext/drawimage_html_image_3_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_3_ref.html diff --git a/tests/ref/2dcontext/drawimage_html_image_4.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_4.html index 8158fe2b4db..dfaf4018d69 100644 --- a/tests/ref/2dcontext/drawimage_html_image_4.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_4.html @@ -1,14 +1,11 @@ <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<meta charset="utf-8"> +<link rel=match href=drawimage_html_image_4_ref.html> <style> html, body { margin: 0; } </style> -<body> <canvas id="dest" height="100" width="100"></canvas> <script> @@ -32,5 +29,3 @@ destCtx.imageSmoothingEnabled = smoothingEnabled; destCtx.drawImage(sourceImg, 50, 50, 16, 16); </script> -</body> -</html> diff --git a/tests/ref/2dcontext/drawimage_html_image_4_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_4_ref.html index baa6591a220..baa6591a220 100644 --- a/tests/ref/2dcontext/drawimage_html_image_4_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_4_ref.html diff --git a/tests/ref/2dcontext/drawimage_html_image_5.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_5.html index 871379e500a..a359fdf35b5 100644 --- a/tests/ref/2dcontext/drawimage_html_image_5.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_5.html @@ -1,14 +1,11 @@ <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<meta charset="utf-8"> +<link rel=match href=drawimage_html_image_5_ref.html> <style> html, body { margin: 0; } </style> -<body> <canvas id="dest" height="100" width="100"></canvas> <script> @@ -31,5 +28,3 @@ destCtx.imageSmoothingEnabled = smoothingEnabled; destCtx.drawImage(sourceImg, 50, 50, 64, 32); </script> -</body> -</html> diff --git a/tests/ref/2dcontext/drawimage_html_image_5_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_5_ref.html index 66b7cc194ac..66b7cc194ac 100644 --- a/tests/ref/2dcontext/drawimage_html_image_5_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_5_ref.html diff --git a/tests/ref/2dcontext/drawimage_html_image_6.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_6.html index 793a1757547..4482ca3c319 100644 --- a/tests/ref/2dcontext/drawimage_html_image_6.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_6.html @@ -1,14 +1,11 @@ <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<meta charset="utf-8"> +<link rel=match href=drawimage_html_image_6_ref.html> <style> html, body { margin: 0; } </style> -<body> <canvas id="dest" height="100" width="100"></canvas> <script> @@ -32,5 +29,3 @@ destCtx.imageSmoothingEnabled = smoothingEnabled; destCtx.drawImage(sourceImg, 0, 0, 32, 32, 0, 0, 32, 32); </script> -</body> -</html> diff --git a/tests/ref/2dcontext/drawimage_html_image_6_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_6_ref.html index d7343375508..d7343375508 100644 --- a/tests/ref/2dcontext/drawimage_html_image_6_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_6_ref.html diff --git a/tests/ref/2dcontext/drawimage_html_image_7.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_7.html index 1b0de346bc1..cf6daa0d4c3 100644 --- a/tests/ref/2dcontext/drawimage_html_image_7.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_7.html @@ -1,14 +1,11 @@ <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<meta charset="utf-8"> +<link rel=match href=drawimage_html_image_7_ref.html> <style> html, body { margin: 0; } </style> -<body> <canvas id="dest" height="100" width="100"></canvas> <script> @@ -32,5 +29,3 @@ destCtx.imageSmoothingEnabled = smoothingEnabled; destCtx.drawImage(sourceImg, 0, 0, 32, 32, 32, 32, 32, 32); </script> -</body> -</html> diff --git a/tests/ref/2dcontext/drawimage_html_image_7_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_7_ref.html index e823ffbb75a..e823ffbb75a 100644 --- a/tests/ref/2dcontext/drawimage_html_image_7_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_7_ref.html diff --git a/tests/ref/2dcontext/drawimage_html_image_8.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_8.html index 0197f28c494..c1ebfa81648 100644 --- a/tests/ref/2dcontext/drawimage_html_image_8.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_8.html @@ -1,14 +1,11 @@ <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<meta charset="utf-8"> +<link rel=match href=drawimage_html_image_8_ref.html> <style> html, body { margin: 0; } </style> -<body> <canvas id="dest" height="100" width="100"></canvas> <script> @@ -32,5 +29,3 @@ destCtx.imageSmoothingEnabled = smoothingEnabled; destCtx.drawImage(sourceImg, 32, 32, 32, 32, 0, 0, 32, 32); </script> -</body> -</html> diff --git a/tests/ref/2dcontext/drawimage_html_image_8_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_8_ref.html index 1a025d26d99..1a025d26d99 100644 --- a/tests/ref/2dcontext/drawimage_html_image_8_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_8_ref.html diff --git a/tests/ref/2dcontext/drawimage_html_image_9.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_9.html index 7caf475065c..f0fc85d384a 100644 --- a/tests/ref/2dcontext/drawimage_html_image_9.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_9.html @@ -1,14 +1,11 @@ <!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> -</head> +<meta charset="utf-8"> +<link rel=match href=drawimage_html_image_9_ref.html> <style> html, body { margin: 0; } </style> -<body> <canvas id="dest" height="100" width="100"></canvas> <script> @@ -39,5 +36,3 @@ catch(err) { } </script> -</body> -</html> diff --git a/tests/ref/2dcontext/drawimage_html_image_9_ref.html b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_9_ref.html index 5341e05c1e1..5341e05c1e1 100644 --- a/tests/ref/2dcontext/drawimage_html_image_9_ref.html +++ b/tests/wpt/web-platform-tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_9_ref.html diff --git a/tests/wpt/web-platform-tests/2dcontext/transformations/canvas_transformations_reset_001-ref.html b/tests/wpt/web-platform-tests/2dcontext/transformations/canvas_transformations_reset_001-ref.html new file mode 100644 index 00000000000..caeea04cef4 --- /dev/null +++ b/tests/wpt/web-platform-tests/2dcontext/transformations/canvas_transformations_reset_001-ref.html @@ -0,0 +1,21 @@ +<!DOCTYPE html> +<html> +<body> +<style> + html, body, div { + margin: 0; + padding: 0; + } + div { + width: 75px; + height: 75px; + float: left; + } +</style> + +<div style="background-color:red"></div> +<div style="clear:left"></div> +<div style="background-color:blue"></div> + +</body> +</html> diff --git a/tests/wpt/web-platform-tests/2dcontext/transformations/canvas_transformations_reset_001.html b/tests/wpt/web-platform-tests/2dcontext/transformations/canvas_transformations_reset_001.html new file mode 100644 index 00000000000..9cc643da8b8 --- /dev/null +++ b/tests/wpt/web-platform-tests/2dcontext/transformations/canvas_transformations_reset_001.html @@ -0,0 +1,22 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<link rel="match" href="canvas_transformations_reset_001-ref.htm"> +<style> + html, body { + margin: 0; + padding: 0; + } +</style> +<canvas id="c" width="150" height="150"></canvas> +<script> +var c = document.getElementById("c"); +var ctx = c.getContext("2d"); + +ctx.translate(75, 75); +ctx.fillStyle = 'blue'; +ctx.fillRect(0, 0, 75, 75); + +ctx.resetTransform(); +ctx.fillStyle = 'red'; +ctx.fillRect(0, 0, 75, 75); +</script> |