mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #6044 - Ms2ger:cleanup, r=jdm
<!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6044) <!-- Reviewable:end -->
This commit is contained in:
commit
7bda431e61
14 changed files with 80 additions and 54 deletions
|
@ -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<i32>) -> Result<Sender<CanvasMsg>, &'static str> {
|
||||
let (chan, port) = channel::<CanvasMsg>();
|
||||
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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -260,7 +260,8 @@ pub enum MozBrowserEvent {
|
|||
AsyncScroll,
|
||||
/// Sent when window.close() is called within a browser <iframe>.
|
||||
Close,
|
||||
/// Sent when a browser <iframe> tries to open a context menu. This allows handling <menuitem> element available within the browser <iframe>'s content.
|
||||
/// Sent when a browser <iframe> tries to open a context menu. This allows
|
||||
/// handling <menuitem> element available within the browser <iframe>'s content.
|
||||
ContextMenu,
|
||||
/// Sent when an error occurred while trying to load content within a browser <iframe>.
|
||||
Error,
|
||||
|
|
|
@ -9,7 +9,8 @@ use dom::bindings::codegen::Bindings::HTMLFormElementBinding::HTMLFormElementMet
|
|||
use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementMethods;
|
||||
use dom::bindings::codegen::Bindings::HTMLButtonElementBinding::HTMLButtonElementMethods;
|
||||
use dom::bindings::codegen::InheritTypes::{EventTargetCast, HTMLFormElementDerived, NodeCast};
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLInputElementCast, HTMLTextAreaElementCast, HTMLFormElementCast};
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLInputElementCast, HTMLTextAreaElementCast};
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLFormElementCast, HTMLDataListElementCast};
|
||||
use dom::bindings::global::GlobalRef;
|
||||
use dom::bindings::js::{JSRef, OptionalRootable, Rootable, Temporary};
|
||||
use dom::document::{Document, DocumentHelpers};
|
||||
|
@ -260,7 +261,7 @@ impl<'a> HTMLFormElementHelpers for JSRef<'a, HTMLFormElement> {
|
|||
return None;
|
||||
}
|
||||
if child.r().ancestors()
|
||||
.any(|a| a.root().r().type_id() == NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDataListElement))) {
|
||||
.any(|a| HTMLDataListElementCast::to_temporary(a).is_some()) {
|
||||
return None;
|
||||
}
|
||||
// XXXManishearth don't include it if it is a button but not the submitter
|
||||
|
|
|
@ -26,7 +26,9 @@ impl HTMLMediaElementDerived for EventTarget {
|
|||
}
|
||||
|
||||
impl HTMLMediaElement {
|
||||
pub fn new_inherited(type_id: HTMLMediaElementTypeId, tag_name: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLMediaElement {
|
||||
pub fn new_inherited(type_id: HTMLMediaElementTypeId, tag_name: DOMString,
|
||||
prefix: Option<DOMString>, document: JSRef<Document>)
|
||||
-> HTMLMediaElement {
|
||||
HTMLMediaElement {
|
||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLMediaElement(type_id), tag_name, prefix, document)
|
||||
}
|
||||
|
|
|
@ -2234,13 +2234,18 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
|||
|
||||
match node.type_id() {
|
||||
// Step 3.
|
||||
NodeTypeId::DocumentType if !is_equal_doctype(this, node) => return false,
|
||||
NodeTypeId::Element(..) if !is_equal_element(this, node) => return false,
|
||||
NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction) if !is_equal_processinginstruction(this, node) => return false,
|
||||
NodeTypeId::DocumentType
|
||||
if !is_equal_doctype(this, node) => return false,
|
||||
NodeTypeId::Element(..)
|
||||
if !is_equal_element(this, node) => return false,
|
||||
NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction)
|
||||
if !is_equal_processinginstruction(this, node) => return false,
|
||||
NodeTypeId::CharacterData(CharacterDataTypeId::Text) |
|
||||
NodeTypeId::CharacterData(CharacterDataTypeId::Comment) if !is_equal_characterdata(this, node) => return false,
|
||||
NodeTypeId::CharacterData(CharacterDataTypeId::Comment)
|
||||
if !is_equal_characterdata(this, node) => return false,
|
||||
// Step 4.
|
||||
NodeTypeId::Element(..) if !is_equal_element_attrs(this, node) => return false,
|
||||
NodeTypeId::Element(..)
|
||||
if !is_equal_element_attrs(this, node) => return false,
|
||||
_ => ()
|
||||
}
|
||||
|
||||
|
|
|
@ -156,7 +156,8 @@ impl<'a> WebSocketMethods for JSRef<'a, WebSocket> {
|
|||
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: bufferedAmount attribute returns the size of the buffer in bytes -
|
||||
this is a required attribute defined in the websocket.webidl 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
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue