diff --git a/components/canvas/webgl_paint_task.rs b/components/canvas/webgl_paint_task.rs index 806440db36b..155cbde2297 100644 --- a/components/canvas/webgl_paint_task.rs +++ b/components/canvas/webgl_paint_task.rs @@ -37,6 +37,34 @@ impl WebGLPaintTask { }) } + pub fn handle_webgl_message(&self, message: CanvasWebGLMsg) { + match message { + CanvasWebGLMsg::AttachShader(program_id, shader_id) => self.attach_shader(program_id, shader_id), + CanvasWebGLMsg::BindBuffer(buffer_type, buffer_id) => self.bind_buffer(buffer_type, buffer_id), + CanvasWebGLMsg::BufferData(buffer_type, data, usage) => self.buffer_data(buffer_type, data, usage), + CanvasWebGLMsg::Clear(mask) => self.clear(mask), + CanvasWebGLMsg::ClearColor(r, g, b, a) => self.clear_color(r, g, b, a), + CanvasWebGLMsg::CreateBuffer(chan) => self.create_buffer(chan), + CanvasWebGLMsg::DrawArrays(mode, first, count) => self.draw_arrays(mode, first, count), + CanvasWebGLMsg::EnableVertexAttribArray(attrib_id) => self.enable_vertex_attrib_array(attrib_id), + CanvasWebGLMsg::GetAttribLocation(program_id, name, chan) => self.get_attrib_location(program_id, name, chan), + CanvasWebGLMsg::GetShaderInfoLog(shader_id, chan) => self.get_shader_info_log(shader_id, chan), + CanvasWebGLMsg::GetShaderParameter(shader_id, param_id, chan) => self.get_shader_parameter(shader_id, param_id, chan), + CanvasWebGLMsg::GetUniformLocation(program_id, name, chan) => self.get_uniform_location(program_id, name, chan), + CanvasWebGLMsg::CompileShader(shader_id) => self.compile_shader(shader_id), + CanvasWebGLMsg::CreateProgram(chan) => self.create_program(chan), + CanvasWebGLMsg::CreateShader(shader_type, chan) => self.create_shader(shader_type, chan), + CanvasWebGLMsg::LinkProgram(program_id) => self.link_program(program_id), + CanvasWebGLMsg::ShaderSource(shader_id, source) => self.shader_source(shader_id, source), + CanvasWebGLMsg::Uniform4fv(uniform_id, data) => self.uniform_4fv(uniform_id, data), + CanvasWebGLMsg::UseProgram(program_id) => self.use_program(program_id), + CanvasWebGLMsg::VertexAttribPointer2f(attrib_id, size, normalized, stride, offset) => { + self.vertex_attrib_pointer_f32(attrib_id, size, normalized, stride, offset); + }, + CanvasWebGLMsg::Viewport(x, y, width, height) => self.viewport(x, y, width, height), + } + } + pub fn start(size: Size2D) -> Result, &'static str> { let (chan, port) = channel::(); let mut painter = try!(WebGLPaintTask::new(size)); @@ -44,33 +72,7 @@ impl WebGLPaintTask { painter.init(); loop { 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::WebGL(message) => painter.handle_webgl_message(message), CanvasMsg::Common(message) => { match message { CanvasCommonMsg::Close => break, diff --git a/components/devtools/actors/console.rs b/components/devtools/actors/console.rs index 834ccc99235..bef7e456a49 100644 --- a/components/devtools/actors/console.rs +++ b/components/devtools/actors/console.rs @@ -2,9 +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/. */ -/// Liberally derived from the [Firefox JS implementation](http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/webconsole.js). -/// Mediates interaction between the remote web console and equivalent functionality (object -/// inspection, JS evaluation, autocompletion) in Servo. +//! Liberally derived from the [Firefox JS implementation] +//! (http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/webconsole.js). +//! Mediates interaction between the remote web console and equivalent functionality (object +//! inspection, JS evaluation, autocompletion) in Servo. use actor::{Actor, ActorRegistry}; use protocol::JsonPacketStream; diff --git a/components/devtools/actors/inspector.rs b/components/devtools/actors/inspector.rs index 3dbaf5c6d43..35025a9c21b 100644 --- a/components/devtools/actors/inspector.rs +++ b/components/devtools/actors/inspector.rs @@ -2,7 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/// Liberally derived from the [Firefox JS implementation](http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/inspector.js). +//! Liberally derived from the [Firefox JS implementation] +//! (http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/inspector.js). use devtools_traits::{DevtoolScriptControlMsg, NodeInfo}; use devtools_traits::DevtoolScriptControlMsg::{GetRootNode, GetDocumentElement, GetChildren}; @@ -461,12 +462,14 @@ impl Actor for PageStyleActor { let auto_margins = msg.get(&"autoMargins".to_string()).unwrap().as_boolean().unwrap(); //TODO: the remaining layout properties (margin, border, padding, position) - // as specified in getLayout in http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/styles.js + // as specified in getLayout in + // http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/styles.js let msg = GetLayoutReply { width: width.round() as i32, height: height.round() as i32, autoMargins: if auto_margins { - //TODO: real values like processMargins in http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/styles.js + //TODO: real values like processMargins in + // http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/styles.js let mut m = BTreeMap::new(); m.insert("top".to_string(), "auto".to_string().to_json()); m.insert("bottom".to_string(), "auto".to_string().to_json()); diff --git a/components/devtools/actors/network_event.rs b/components/devtools/actors/network_event.rs index 28a6acc18f0..9a741913cdd 100644 --- a/components/devtools/actors/network_event.rs +++ b/components/devtools/actors/network_event.rs @@ -2,8 +2,9 @@ * 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. +//! 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; diff --git a/components/devtools/actors/tab.rs b/components/devtools/actors/tab.rs index 7450ae45143..4a157edd692 100644 --- a/components/devtools/actors/tab.rs +++ b/components/devtools/actors/tab.rs @@ -2,9 +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/. */ -/// Liberally derived from the [Firefox JS implementation](http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/webbrowser.js). -/// Connection point for remote devtools that wish to investigate a particular tab's contents. -/// Supports dynamic attaching and detaching which control notifications of navigation, etc. +//! Liberally derived from the [Firefox JS implementation] +//! (http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/webbrowser.js). +//! Connection point for remote devtools that wish to investigate a particular tab's contents. +//! Supports dynamic attaching and detaching which control notifications of navigation, etc. use actor::{Actor, ActorRegistry}; use actors::console::ConsoleActor; diff --git a/components/layout/inline.rs b/components/layout/inline.rs index 5b65fc49ce1..9625787f019 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -32,7 +32,7 @@ use std::u16; use style::computed_values::{display, overflow_x, position, text_align, text_justify}; use style::computed_values::{text_overflow, vertical_align, white_space}; use style::properties::ComputedValues; -use util::geometry::{Au, MAX_AU, ZERO_POINT, ZERO_RECT}; +use util::geometry::{Au, MAX_AU, ZERO_RECT}; use util::logical_geometry::{LogicalRect, LogicalSize, WritingMode}; use util::range::{Range, RangeIndex}; use util; diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs index ffe76ddb7f8..cba1b2c6d86 100644 --- a/components/msg/constellation_msg.rs +++ b/components/msg/constellation_msg.rs @@ -260,7 +260,8 @@ pub enum MozBrowserEvent { AsyncScroll, /// Sent when window.close() is called within a browser