mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Fix existing syntactics nits.
This commit is contained in:
parent
7f935f010b
commit
8bb853f643
93 changed files with 393 additions and 397 deletions
|
@ -106,10 +106,10 @@ impl CORSRequest {
|
|||
}
|
||||
|
||||
pub fn http_fetch_async(&self,
|
||||
listener: Box<AsyncCORSResponseListener+Send>,
|
||||
script_chan: Box<ScriptChan+Send>) {
|
||||
listener: Box<AsyncCORSResponseListener + Send>,
|
||||
script_chan: Box<ScriptChan + Send>) {
|
||||
struct CORSContext {
|
||||
listener: Box<AsyncCORSResponseListener+Send>,
|
||||
listener: Box<AsyncCORSResponseListener + Send>,
|
||||
response: RefCell<Option<CORSResponse>>,
|
||||
}
|
||||
|
||||
|
@ -341,7 +341,7 @@ pub struct CORSCacheEntry {
|
|||
}
|
||||
|
||||
impl CORSCacheEntry {
|
||||
fn new(origin:Url,
|
||||
fn new(origin: Url,
|
||||
url: Url,
|
||||
max_age: u32,
|
||||
credentials: bool,
|
||||
|
|
|
@ -149,7 +149,7 @@ impl<'a> GlobalRef<'a> {
|
|||
|
||||
/// `ScriptChan` used to send messages to the event loop of this global's
|
||||
/// thread.
|
||||
pub fn script_chan(&self) -> Box<ScriptChan+Send> {
|
||||
pub fn script_chan(&self) -> Box<ScriptChan + Send> {
|
||||
match *self {
|
||||
GlobalRef::Window(ref window) => window.script_chan(),
|
||||
GlobalRef::Worker(ref worker) => worker.script_chan(),
|
||||
|
@ -159,7 +159,7 @@ impl<'a> GlobalRef<'a> {
|
|||
/// Create a new sender/receiver pair that can be used to implement an on-demand
|
||||
/// event loop. Used for implementing web APIs that require blocking semantics
|
||||
/// without resorting to nested event loops.
|
||||
pub fn new_script_pair(&self) -> (Box<ScriptChan+Send>, Box<ScriptPort+Send>) {
|
||||
pub fn new_script_pair(&self) -> (Box<ScriptChan + Send>, Box<ScriptPort + Send>) {
|
||||
match *self {
|
||||
GlobalRef::Window(ref window) => window.new_script_pair(),
|
||||
GlobalRef::Worker(ref worker) => worker.new_script_pair(),
|
||||
|
|
|
@ -207,11 +207,11 @@ impl MutHeapJSVal {
|
|||
/// `JS<T>`.
|
||||
#[must_root]
|
||||
#[derive(JSTraceable)]
|
||||
pub struct MutHeap<T: HeapGCValue+Copy> {
|
||||
pub struct MutHeap<T: HeapGCValue + Copy> {
|
||||
val: Cell<T>,
|
||||
}
|
||||
|
||||
impl<T: HeapGCValue+Copy> MutHeap<T> {
|
||||
impl<T: HeapGCValue + Copy> MutHeap<T> {
|
||||
/// Create a new `MutHeap`.
|
||||
pub fn new(initial: T) -> MutHeap<T> {
|
||||
MutHeap {
|
||||
|
@ -236,11 +236,11 @@ impl<T: HeapGCValue+Copy> MutHeap<T> {
|
|||
/// barriers are enforced.
|
||||
#[must_root]
|
||||
#[derive(JSTraceable, HeapSizeOf)]
|
||||
pub struct MutNullableHeap<T: HeapGCValue+Copy> {
|
||||
pub struct MutNullableHeap<T: HeapGCValue + Copy> {
|
||||
ptr: Cell<Option<T>>
|
||||
}
|
||||
|
||||
impl<T: HeapGCValue+Copy> MutNullableHeap<T> {
|
||||
impl<T: HeapGCValue + Copy> MutNullableHeap<T> {
|
||||
/// Create a new `MutNullableHeap`.
|
||||
pub fn new(initial: Option<T>) -> MutNullableHeap<T> {
|
||||
MutNullableHeap {
|
||||
|
@ -288,7 +288,7 @@ impl<T: Reflectable> MutNullableHeap<JS<T>> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: HeapGCValue+Copy> Default for MutNullableHeap<T> {
|
||||
impl<T: HeapGCValue + Copy> Default for MutNullableHeap<T> {
|
||||
fn default() -> MutNullableHeap<T> {
|
||||
MutNullableHeap {
|
||||
ptr: Cell::new(None)
|
||||
|
|
|
@ -178,7 +178,7 @@ impl<T: JSTraceable> JSTraceable for *mut T {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: JSTraceable+Copy> JSTraceable for Cell<T> {
|
||||
impl<T: JSTraceable + Copy> JSTraceable for Cell<T> {
|
||||
fn trace(&self, trc: *mut JSTracer) {
|
||||
self.get().trace(trc)
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ impl<T: JSTraceable, U: JSTraceable> JSTraceable for Result<T, U> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<K,V,S> JSTraceable for HashMap<K, V, S>
|
||||
impl<K, V, S> JSTraceable for HashMap<K, V, S>
|
||||
where K: Hash + Eq + JSTraceable,
|
||||
V: JSTraceable,
|
||||
S: HashState,
|
||||
|
@ -306,7 +306,7 @@ no_jsmanaged_fields!(WebGLError);
|
|||
no_jsmanaged_fields!(ProfilerChan);
|
||||
no_jsmanaged_fields!(PseudoElement);
|
||||
|
||||
impl JSTraceable for Box<ScriptChan+Send> {
|
||||
impl JSTraceable for Box<ScriptChan + Send> {
|
||||
#[inline]
|
||||
fn trace(&self, _trc: *mut JSTracer) {
|
||||
// Do nothing
|
||||
|
@ -327,7 +327,7 @@ impl<'a> JSTraceable for &'a str {
|
|||
}
|
||||
}
|
||||
|
||||
impl<A,B> JSTraceable for fn(A) -> B {
|
||||
impl<A, B> JSTraceable for fn(A) -> B {
|
||||
#[inline]
|
||||
fn trace(&self, _: *mut JSTracer) {
|
||||
// Do nothing
|
||||
|
@ -341,7 +341,7 @@ impl<T> JSTraceable for IpcSender<T> where T: Deserialize + Serialize {
|
|||
}
|
||||
}
|
||||
|
||||
impl JSTraceable for Box<LayoutRPC+'static> {
|
||||
impl JSTraceable for Box<LayoutRPC + 'static> {
|
||||
#[inline]
|
||||
fn trace(&self, _: *mut JSTracer) {
|
||||
// Do nothing
|
||||
|
|
|
@ -35,7 +35,7 @@ pub struct Blob {
|
|||
isClosed_: Cell<bool>
|
||||
}
|
||||
|
||||
fn is_ascii_printable(string: &DOMString) -> bool{
|
||||
fn is_ascii_printable(string: &DOMString) -> bool {
|
||||
// Step 5.1 in Sec 5.1 of File API spec
|
||||
// http://dev.w3.org/2006/webapi/FileAPI/#constructorBlob
|
||||
return string.chars().all(|c| { c >= '\x20' && c <= '\x7E' })
|
||||
|
@ -92,7 +92,7 @@ impl<'a> BlobHelpers for &'a Blob {
|
|||
|
||||
impl<'a> BlobMethods for &'a Blob {
|
||||
// https://dev.w3.org/2006/webapi/FileAPI/#dfn-size
|
||||
fn Size(self) -> u64{
|
||||
fn Size(self) -> u64 {
|
||||
match self.bytes {
|
||||
None => 0,
|
||||
Some(ref bytes) => bytes.len() as u64
|
||||
|
|
|
@ -173,7 +173,7 @@ impl CanvasRenderingContext2D {
|
|||
|
||||
// The source rectangle is the rectangle whose corners are the four points (sx, sy),
|
||||
// (sx+sw, sy), (sx+sw, sy+sh), (sx, sy+sh).
|
||||
let source_rect = Rect::new(Point2D::new(sx.min(sx+sw), sy.min(sy+sh)),
|
||||
let source_rect = Rect::new(Point2D::new(sx.min(sx + sw), sy.min(sy + sh)),
|
||||
Size2D::new(sw.abs(), sh.abs()));
|
||||
|
||||
// When the source rectangle is outside the source image,
|
||||
|
@ -191,8 +191,10 @@ impl CanvasRenderingContext2D {
|
|||
|
||||
// The destination rectangle is the rectangle whose corners are the four points (dx, dy),
|
||||
// (dx+dw, dy), (dx+dw, dy+dh), (dx, dy+dh).
|
||||
let dest_rect = Rect::new(Point2D::new(dx.min(dx+dest_rect_width_scaled), dy.min(dy+dest_rect_height_scaled)),
|
||||
Size2D::new(dest_rect_width_scaled.abs(), dest_rect_height_scaled.abs()));
|
||||
let dest_rect = Rect::new(Point2D::new(dx.min(dx + dest_rect_width_scaled),
|
||||
dy.min(dy + dest_rect_height_scaled)),
|
||||
Size2D::new(dest_rect_width_scaled.abs(),
|
||||
dest_rect_height_scaled.abs()));
|
||||
|
||||
let source_rect = Rect::new(Point2D::new(source_rect_clipped.origin.x,
|
||||
source_rect_clipped.origin.y),
|
||||
|
|
|
@ -88,7 +88,7 @@ impl<'a> ConsoleMethods for &'a Console {
|
|||
|
||||
fn prepare_message(logLevel: LogLevel, message: String) -> ConsoleMessage {
|
||||
//TODO: Sending fake values for filename, lineNumber and columnNumber in LogMessage; adjust later
|
||||
ConsoleMessage{
|
||||
ConsoleMessage {
|
||||
message: message,
|
||||
logLevel: logLevel,
|
||||
filename: "test".to_owned(),
|
||||
|
|
|
@ -150,7 +150,7 @@ pub struct DedicatedWorkerGlobalScope {
|
|||
worker: DOMRefCell<Option<TrustedWorkerAddress>>,
|
||||
#[ignore_heap_size_of = "Can't measure trait objects"]
|
||||
/// Sender to the parent thread.
|
||||
parent_sender: Box<ScriptChan+Send>,
|
||||
parent_sender: Box<ScriptChan + Send>,
|
||||
}
|
||||
|
||||
impl DedicatedWorkerGlobalScope {
|
||||
|
@ -159,7 +159,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
id: PipelineId,
|
||||
devtools_port: Receiver<DevtoolScriptControlMsg>,
|
||||
runtime: Rc<Runtime>,
|
||||
parent_sender: Box<ScriptChan+Send>,
|
||||
parent_sender: Box<ScriptChan + Send>,
|
||||
own_sender: Sender<(TrustedWorkerAddress, WorkerScriptMsg)>,
|
||||
receiver: Receiver<(TrustedWorkerAddress, WorkerScriptMsg)>)
|
||||
-> DedicatedWorkerGlobalScope {
|
||||
|
@ -180,7 +180,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
id: PipelineId,
|
||||
devtools_port: Receiver<DevtoolScriptControlMsg>,
|
||||
runtime: Rc<Runtime>,
|
||||
parent_sender: Box<ScriptChan+Send>,
|
||||
parent_sender: Box<ScriptChan + Send>,
|
||||
own_sender: Sender<(TrustedWorkerAddress, WorkerScriptMsg)>,
|
||||
receiver: Receiver<(TrustedWorkerAddress, WorkerScriptMsg)>)
|
||||
-> Root<DedicatedWorkerGlobalScope> {
|
||||
|
@ -197,7 +197,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
id: PipelineId,
|
||||
devtools_ipc_port: IpcReceiver<DevtoolScriptControlMsg>,
|
||||
worker: TrustedWorkerAddress,
|
||||
parent_sender: Box<ScriptChan+Send>,
|
||||
parent_sender: Box<ScriptChan + Send>,
|
||||
own_sender: Sender<(TrustedWorkerAddress, WorkerScriptMsg)>,
|
||||
receiver: Receiver<(TrustedWorkerAddress, WorkerScriptMsg)>) {
|
||||
let serialized_worker_url = worker_url.serialize();
|
||||
|
@ -247,14 +247,14 @@ impl DedicatedWorkerGlobalScope {
|
|||
}
|
||||
|
||||
pub trait DedicatedWorkerGlobalScopeHelpers {
|
||||
fn script_chan(self) -> Box<ScriptChan+Send>;
|
||||
fn script_chan(self) -> Box<ScriptChan + Send>;
|
||||
fn pipeline(self) -> PipelineId;
|
||||
fn new_script_pair(self) -> (Box<ScriptChan+Send>, Box<ScriptPort+Send>);
|
||||
fn new_script_pair(self) -> (Box<ScriptChan + Send>, Box<ScriptPort + Send>);
|
||||
fn process_event(self, msg: CommonScriptMsg);
|
||||
}
|
||||
|
||||
impl<'a> DedicatedWorkerGlobalScopeHelpers for &'a DedicatedWorkerGlobalScope {
|
||||
fn script_chan(self) -> Box<ScriptChan+Send> {
|
||||
fn script_chan(self) -> Box<ScriptChan + Send> {
|
||||
box WorkerThreadWorkerChan {
|
||||
sender: self.own_sender.clone(),
|
||||
worker: self.worker.borrow().as_ref().unwrap().clone(),
|
||||
|
@ -265,7 +265,7 @@ impl<'a> DedicatedWorkerGlobalScopeHelpers for &'a DedicatedWorkerGlobalScope {
|
|||
self.id
|
||||
}
|
||||
|
||||
fn new_script_pair(self) -> (Box<ScriptChan+Send>, Box<ScriptPort+Send>) {
|
||||
fn new_script_pair(self) -> (Box<ScriptChan + Send>, Box<ScriptPort + Send>) {
|
||||
let (tx, rx) = channel();
|
||||
let chan = box SendableWorkerScriptChan {
|
||||
sender: tx,
|
||||
|
|
|
@ -267,7 +267,7 @@ impl<'a> FileReaderMethods for &'a FileReader {
|
|||
}
|
||||
|
||||
// https://w3c.github.io/FileAPI/#dfn-readAsText
|
||||
fn ReadAsText(self, blob: &Blob, label:Option<DOMString>) -> ErrorResult {
|
||||
fn ReadAsText(self, blob: &Blob, label: Option<DOMString>) -> ErrorResult {
|
||||
self.read(FileReaderFunction::ReadAsText, blob, label)
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ impl<'a> FormDataMethods for &'a FormData {
|
|||
}
|
||||
}
|
||||
|
||||
trait PrivateFormDataHelpers{
|
||||
trait PrivateFormDataHelpers {
|
||||
fn get_file_from_blob(self, value: &Blob, filename: Option<DOMString>) -> Root<File>;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ pub trait CollectionFilter : JSTraceable {
|
|||
#[must_root]
|
||||
pub enum CollectionTypeId {
|
||||
Static(Vec<JS<Element>>),
|
||||
Live(JS<Node>, Box<CollectionFilter+'static>)
|
||||
Live(JS<Node>, Box<CollectionFilter + 'static>)
|
||||
}
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -53,7 +53,7 @@ impl HTMLCollection {
|
|||
|
||||
impl HTMLCollection {
|
||||
pub fn create(window: &Window, root: &Node,
|
||||
filter: Box<CollectionFilter+'static>) -> Root<HTMLCollection> {
|
||||
filter: Box<CollectionFilter + 'static>) -> Root<HTMLCollection> {
|
||||
HTMLCollection::new(window, CollectionTypeId::Live(JS::from_ref(root), filter))
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ use dom::bindings::codegen::Bindings::HTMLIFrameElementBinding;
|
|||
use dom::bindings::codegen::Bindings::HTMLIFrameElementBinding::HTMLIFrameElementMethods;
|
||||
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
|
||||
use dom::bindings::codegen::InheritTypes::{NodeCast, ElementCast, EventCast};
|
||||
use dom::bindings::codegen::InheritTypes::{EventTargetCast, HTMLElementCast,
|
||||
HTMLIFrameElementDerived};
|
||||
use dom::bindings::codegen::InheritTypes::{EventTargetCast, HTMLElementCast};
|
||||
use dom::bindings::codegen::InheritTypes::HTMLIFrameElementDerived;
|
||||
use dom::bindings::conversions::ToJSValConvertible;
|
||||
use dom::bindings::error::{ErrorResult, Fallible};
|
||||
use dom::bindings::error::Error::NotSupported;
|
||||
|
|
|
@ -8,8 +8,8 @@ use dom::bindings::cell::DOMRefCell;
|
|||
use dom::bindings::codegen::Bindings::HTMLImageElementBinding;
|
||||
use dom::bindings::codegen::Bindings::HTMLImageElementBinding::HTMLImageElementMethods;
|
||||
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
|
||||
use dom::bindings::codegen::InheritTypes::{NodeCast, ElementCast, EventTargetCast, HTMLElementCast,
|
||||
HTMLImageElementDerived};
|
||||
use dom::bindings::codegen::InheritTypes::{NodeCast, ElementCast, EventTargetCast};
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLImageElementDerived};
|
||||
use dom::bindings::error::Fallible;
|
||||
use dom::bindings::global::GlobalRef;
|
||||
use dom::bindings::js::{LayoutJS, Root};
|
||||
|
|
|
@ -264,7 +264,7 @@ impl LayoutDataRef {
|
|||
|
||||
/// Borrows the layout data immutably. This function is *not* thread-safe.
|
||||
#[inline]
|
||||
pub fn borrow<'a>(&'a self) -> Ref<'a,Option<LayoutData>> {
|
||||
pub fn borrow<'a>(&'a self) -> Ref<'a, Option<LayoutData>> {
|
||||
debug_assert!(task_state::get().is_layout());
|
||||
self.data_cell.borrow()
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ impl LayoutDataRef {
|
|||
/// prevent CSS selector matching from mutably accessing nodes it's not supposed to and racing
|
||||
/// on it. This has already resulted in one bug!
|
||||
#[inline]
|
||||
pub fn borrow_mut<'a>(&'a self) -> RefMut<'a,Option<LayoutData>> {
|
||||
pub fn borrow_mut<'a>(&'a self) -> RefMut<'a, Option<LayoutData>> {
|
||||
debug_assert!(task_state::get().is_layout());
|
||||
self.data_cell.borrow_mut()
|
||||
}
|
||||
|
@ -1464,7 +1464,7 @@ pub enum CloneChildrenFlag {
|
|||
fn as_uintptr<T>(t: &T) -> uintptr_t { t as *const T as uintptr_t }
|
||||
|
||||
impl Node {
|
||||
pub fn reflect_node<N: Reflectable+NodeBase>
|
||||
pub fn reflect_node<N: Reflectable + NodeBase>
|
||||
(node: Box<N>,
|
||||
document: &Document,
|
||||
wrap_fn: extern "Rust" fn(*mut JSContext, GlobalRef, Box<N>) -> Root<N>)
|
||||
|
@ -2554,12 +2554,12 @@ pub struct TrustedNodeAddress(pub *const c_void);
|
|||
#[allow(unsafe_code)]
|
||||
unsafe impl Send for TrustedNodeAddress {}
|
||||
|
||||
pub fn document_from_node<T: NodeBase+Reflectable>(derived: &T) -> Root<Document> {
|
||||
pub fn document_from_node<T: NodeBase + Reflectable>(derived: &T) -> Root<Document> {
|
||||
let node: &Node = NodeCast::from_ref(derived);
|
||||
node.owner_doc()
|
||||
}
|
||||
|
||||
pub fn window_from_node<T: NodeBase+Reflectable>(derived: &T) -> Root<Window> {
|
||||
pub fn window_from_node<T: NodeBase + Reflectable>(derived: &T) -> Root<Window> {
|
||||
let document = document_from_node(derived);
|
||||
document.r().window()
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ impl<'a> ProgressEventMethods for &'a ProgressEvent {
|
|||
}
|
||||
|
||||
// https://xhr.spec.whatwg.org/#dom-progressevent-loaded
|
||||
fn Loaded(self) -> u64{
|
||||
fn Loaded(self) -> u64 {
|
||||
self.loaded
|
||||
}
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ impl Range {
|
|||
};
|
||||
|
||||
// Step 11.
|
||||
let contained_children : Vec<Root<Node>> =
|
||||
let contained_children: Vec<Root<Node>> =
|
||||
common_ancestor.children().filter(|n| Range::contains(self, n)).collect();
|
||||
|
||||
// Step 12.
|
||||
|
|
|
@ -63,13 +63,13 @@ pub struct ParserContext {
|
|||
/// The subpage associated with this document.
|
||||
subpage: Option<SubpageId>,
|
||||
/// The target event loop for the response notifications.
|
||||
script_chan: Box<ScriptChan+Send>,
|
||||
script_chan: Box<ScriptChan + Send>,
|
||||
/// The URL for this document.
|
||||
url: Url,
|
||||
}
|
||||
|
||||
impl ParserContext {
|
||||
pub fn new(id: PipelineId, subpage: Option<SubpageId>, script_chan: Box<ScriptChan+Send>,
|
||||
pub fn new(id: PipelineId, subpage: Option<SubpageId>, script_chan: Box<ScriptChan + Send>,
|
||||
url: Url) -> ParserContext {
|
||||
ParserContext {
|
||||
parser: RefCell::new(None),
|
||||
|
|
|
@ -144,7 +144,7 @@ trait PrivateStorageHelpers {
|
|||
impl<'a> PrivateStorageHelpers for &'a Storage {
|
||||
/// https://html.spec.whatwg.org/multipage/#send-a-storage-notification
|
||||
fn broadcast_change_notification(self, key: Option<DOMString>, old_value: Option<DOMString>,
|
||||
new_value: Option<DOMString>){
|
||||
new_value: Option<DOMString>) {
|
||||
let global_root = self.global.root();
|
||||
let global_ref = global_root.r();
|
||||
let main_script_chan = global_ref.as_window().main_thread_script_chan();
|
||||
|
|
|
@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::WebGLActiveInfoBinding;
|
|||
use dom::bindings::codegen::Bindings::WebGLActiveInfoBinding::WebGLActiveInfoMethods;
|
||||
use dom::bindings::global::GlobalRef;
|
||||
use dom::bindings::js::Root;
|
||||
use dom::bindings::utils::{Reflector,reflect_dom_object};
|
||||
use dom::bindings::utils::{Reflector, reflect_dom_object};
|
||||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
|
|
|
@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::WebGLShaderPrecisionFormatBinding;
|
|||
use dom::bindings::codegen::Bindings::WebGLShaderPrecisionFormatBinding::WebGLShaderPrecisionFormatMethods;
|
||||
use dom::bindings::global::GlobalRef;
|
||||
use dom::bindings::js::Root;
|
||||
use dom::bindings::utils::{Reflector,reflect_dom_object};
|
||||
use dom::bindings::utils::{Reflector, reflect_dom_object};
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
use dom::bindings::codegen::Bindings::WebGLUniformLocationBinding;
|
||||
use dom::bindings::global::GlobalRef;
|
||||
use dom::bindings::js::Root;
|
||||
use dom::bindings::utils::{Reflector,reflect_dom_object};
|
||||
use dom::bindings::utils::{Reflector, reflect_dom_object};
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
|
|
|
@ -153,7 +153,7 @@ impl WebSocket {
|
|||
return Err(Syntax);
|
||||
}
|
||||
|
||||
if protocols[i+1..].iter().any(|p| p == protocol) {
|
||||
if protocols[i + 1..].iter().any(|p| p == protocol) {
|
||||
return Err(Syntax);
|
||||
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ use profile_traits::mem;
|
|||
use string_cache::Atom;
|
||||
use util::geometry::{self, Au, MAX_RECT};
|
||||
use util::{breakpoint, opts};
|
||||
use util::str::{DOMString,HTML_SPACE_CHARACTERS};
|
||||
use util::str::{DOMString, HTML_SPACE_CHARACTERS};
|
||||
|
||||
use euclid::{Point2D, Rect, Size2D};
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
|
@ -179,7 +179,7 @@ pub struct Window {
|
|||
|
||||
/// A handle to perform RPC calls into the layout, quickly.
|
||||
#[ignore_heap_size_of = "trait objects are hard"]
|
||||
layout_rpc: Box<LayoutRPC+'static>,
|
||||
layout_rpc: Box<LayoutRPC + 'static>,
|
||||
|
||||
/// The port that we will use to join layout. If this is `None`, then layout is not running.
|
||||
#[ignore_heap_size_of = "channels are hard"]
|
||||
|
@ -232,7 +232,7 @@ impl Window {
|
|||
self.js_runtime.borrow().as_ref().unwrap().cx()
|
||||
}
|
||||
|
||||
pub fn script_chan(&self) -> Box<ScriptChan+Send> {
|
||||
pub fn script_chan(&self) -> Box<ScriptChan + Send> {
|
||||
self.script_chan.clone()
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,7 @@ impl Window {
|
|||
self.parent_info
|
||||
}
|
||||
|
||||
pub fn new_script_pair(&self) -> (Box<ScriptChan+Send>, Box<ScriptPort+Send>) {
|
||||
pub fn new_script_pair(&self) -> (Box<ScriptChan + Send>, Box<ScriptPort + Send>) {
|
||||
let (tx, rx) = channel();
|
||||
(box SendableMainThreadScriptChan(tx), box rx)
|
||||
}
|
||||
|
@ -1143,7 +1143,7 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
fn should_move_clip_rect(clip_rect: Rect<Au>, new_viewport: Rect<f32>) -> bool{
|
||||
fn should_move_clip_rect(clip_rect: Rect<Au>, new_viewport: Rect<f32>) -> bool {
|
||||
let clip_rect = Rect::new(Point2D::new(clip_rect.origin.x.to_f32_px(),
|
||||
clip_rect.origin.y.to_f32_px()),
|
||||
Size2D::new(clip_rect.size.width.to_f32_px(),
|
||||
|
|
|
@ -288,9 +288,9 @@ impl<'a> WorkerGlobalScopeMethods for &'a WorkerGlobalScope {
|
|||
pub trait WorkerGlobalScopeHelpers {
|
||||
fn execute_script(self, source: DOMString);
|
||||
fn handle_fire_timer(self, timer_id: TimerId);
|
||||
fn script_chan(self) -> Box<ScriptChan+Send>;
|
||||
fn script_chan(self) -> Box<ScriptChan + Send>;
|
||||
fn pipeline(self) -> PipelineId;
|
||||
fn new_script_pair(self) -> (Box<ScriptChan+Send>, Box<ScriptPort+Send>);
|
||||
fn new_script_pair(self) -> (Box<ScriptChan + Send>, Box<ScriptPort + Send>);
|
||||
fn process_event(self, msg: CommonScriptMsg);
|
||||
fn get_cx(self) -> *mut JSContext;
|
||||
fn set_devtools_wants_updates(self, value: bool);
|
||||
|
@ -311,7 +311,7 @@ impl<'a> WorkerGlobalScopeHelpers for &'a WorkerGlobalScope {
|
|||
}
|
||||
}
|
||||
|
||||
fn script_chan(self) -> Box<ScriptChan+Send> {
|
||||
fn script_chan(self) -> Box<ScriptChan + Send> {
|
||||
let dedicated =
|
||||
DedicatedWorkerGlobalScopeCast::to_ref(self);
|
||||
match dedicated {
|
||||
|
@ -329,7 +329,7 @@ impl<'a> WorkerGlobalScopeHelpers for &'a WorkerGlobalScope {
|
|||
}
|
||||
}
|
||||
|
||||
fn new_script_pair(self) -> (Box<ScriptChan+Send>, Box<ScriptPort+Send>) {
|
||||
fn new_script_pair(self) -> (Box<ScriptChan + Send>, Box<ScriptPort + Send>) {
|
||||
let dedicated =
|
||||
DedicatedWorkerGlobalScopeCast::to_ref(self);
|
||||
match dedicated {
|
||||
|
|
|
@ -148,7 +148,7 @@ pub struct XMLHttpRequest {
|
|||
timeout_cancel: DOMRefCell<Option<Sender<()>>>,
|
||||
fetch_time: Cell<i64>,
|
||||
#[ignore_heap_size_of = "Cannot calculate Heap size"]
|
||||
timeout_target: DOMRefCell<Option<Box<ScriptChan+Send>>>,
|
||||
timeout_target: DOMRefCell<Option<Box<ScriptChan + Send>>>,
|
||||
generation_id: Cell<GenerationId>,
|
||||
response_status: Cell<Result<(), ()>>,
|
||||
}
|
||||
|
@ -201,13 +201,13 @@ impl XMLHttpRequest {
|
|||
fn check_cors(context: Arc<Mutex<XHRContext>>,
|
||||
load_data: LoadData,
|
||||
req: CORSRequest,
|
||||
script_chan: Box<ScriptChan+Send>,
|
||||
script_chan: Box<ScriptChan + Send>,
|
||||
resource_task: ResourceTask) {
|
||||
struct CORSContext {
|
||||
xhr: Arc<Mutex<XHRContext>>,
|
||||
load_data: RefCell<Option<LoadData>>,
|
||||
req: CORSRequest,
|
||||
script_chan: Box<ScriptChan+Send>,
|
||||
script_chan: Box<ScriptChan + Send>,
|
||||
resource_task: ResourceTask,
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,7 @@ impl XMLHttpRequest {
|
|||
}
|
||||
|
||||
fn initiate_async_xhr(context: Arc<Mutex<XHRContext>>,
|
||||
script_chan: Box<ScriptChan+Send>,
|
||||
script_chan: Box<ScriptChan + Send>,
|
||||
resource_task: ResourceTask,
|
||||
load_data: LoadData) {
|
||||
impl AsyncResponseListener for XHRContext {
|
||||
|
@ -761,7 +761,7 @@ trait PrivateXMLHttpRequestHelpers {
|
|||
fn dispatch_upload_progress_event(self, type_: DOMString, partial_load: Option<u64>);
|
||||
fn dispatch_response_progress_event(self, type_: DOMString);
|
||||
fn text_response(self) -> DOMString;
|
||||
fn set_timeout(self, timeout:u32);
|
||||
fn set_timeout(self, timeout: u32);
|
||||
fn cancel_timeout(self);
|
||||
fn filter_response_headers(self) -> Headers;
|
||||
fn discard_subsequent_responses(self);
|
||||
|
|
|
@ -43,7 +43,7 @@ impl XMLHttpRequestEventTargetDerived for EventTarget {
|
|||
}
|
||||
|
||||
impl<'a> XMLHttpRequestEventTargetMethods for &'a XMLHttpRequestEventTarget {
|
||||
event_handler!(loadstart,GetOnloadstart, SetOnloadstart);
|
||||
event_handler!(loadstart, GetOnloadstart, SetOnloadstart);
|
||||
event_handler!(progress, GetOnprogress, SetOnprogress);
|
||||
event_handler!(abort, GetOnabort, SetOnabort);
|
||||
event_handler!(error, GetOnerror, SetOnerror);
|
||||
|
|
|
@ -39,7 +39,7 @@ pub enum Msg {
|
|||
AddStylesheet(Stylesheet, MediaQueryList),
|
||||
|
||||
/// Adds the given stylesheet to the document.
|
||||
LoadStylesheet(Url, MediaQueryList, PendingAsyncLoad, Box<StylesheetLoadResponder+Send>),
|
||||
LoadStylesheet(Url, MediaQueryList, PendingAsyncLoad, Box<StylesheetLoadResponder + Send>),
|
||||
|
||||
/// Puts a document into quirks mode, causing the quirks mode stylesheet to be loaded.
|
||||
SetQuirksMode,
|
||||
|
@ -199,7 +199,7 @@ pub trait ScriptLayoutChan {
|
|||
|
||||
impl ScriptLayoutChan for OpaqueScriptLayoutChannel {
|
||||
fn new(sender: Sender<Msg>, receiver: Receiver<Msg>) -> OpaqueScriptLayoutChannel {
|
||||
let inner = (box sender as Box<Any+Send>, box receiver as Box<Any+Send>);
|
||||
let inner = (box sender as Box<Any + Send>, box receiver as Box<Any + Send>);
|
||||
OpaqueScriptLayoutChannel(inner)
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use std::sync::{Arc, Mutex};
|
|||
/// a target thread, where they are invoked on the provided context object.
|
||||
pub struct NetworkListener<T: AsyncResponseListener + PreInvoke + Send + 'static> {
|
||||
pub context: Arc<Mutex<T>>,
|
||||
pub script_chan: Box<ScriptChan+Send>,
|
||||
pub script_chan: Box<ScriptChan + Send>,
|
||||
}
|
||||
|
||||
impl<T: AsyncResponseListener + PreInvoke + Send + 'static> NetworkListener<T> {
|
||||
|
|
|
@ -32,8 +32,8 @@ use dom::bindings::js::{RootCollectionPtr, Root, RootedReference};
|
|||
use dom::bindings::refcounted::{LiveDOMReferences, Trusted, TrustedReference, trace_refcounted_objects};
|
||||
use dom::bindings::trace::{JSTraceable, trace_traceables, RootedVec};
|
||||
use dom::bindings::utils::{WRAP_CALLBACKS, DOM_CALLBACKS};
|
||||
use dom::document::{Document, IsHTMLDocument, DocumentHelpers, DocumentProgressHandler,
|
||||
DocumentProgressTask, DocumentSource, MouseEventType};
|
||||
use dom::document::{Document, IsHTMLDocument, DocumentHelpers, DocumentProgressHandler};
|
||||
use dom::document::{DocumentProgressTask, DocumentSource, MouseEventType};
|
||||
use dom::element::{Element, AttributeHandlers};
|
||||
use dom::event::{EventHelpers, EventBubbles, EventCancelable};
|
||||
use dom::htmliframeelement::HTMLIFrameElementHelpers;
|
||||
|
@ -190,7 +190,7 @@ pub enum CommonScriptMsg {
|
|||
/// A DOM object's last pinned reference was removed (dispatched to all tasks).
|
||||
RefcountCleanup(TrustedReference),
|
||||
/// Generic message that encapsulates event handling.
|
||||
RunnableMsg(Box<Runnable+Send>),
|
||||
RunnableMsg(Box<Runnable + Send>),
|
||||
}
|
||||
|
||||
/// Messages used to control the script event loop
|
||||
|
@ -203,7 +203,7 @@ pub enum MainThreadScriptMsg {
|
|||
/// should be closed (only dispatched to ScriptTask).
|
||||
ExitWindow(PipelineId),
|
||||
/// Generic message for running tasks in the ScriptTask
|
||||
MainThreadRunnableMsg(Box<MainThreadRunnable+Send>),
|
||||
MainThreadRunnableMsg(Box<MainThreadRunnable + Send>),
|
||||
/// Begins a content-initiated load on the specified pipeline (only
|
||||
/// dispatched to ScriptTask).
|
||||
Navigate(PipelineId, LoadData),
|
||||
|
@ -214,10 +214,10 @@ pub trait ScriptChan {
|
|||
/// Send a message to the associated event loop.
|
||||
fn send(&self, msg: CommonScriptMsg) -> Result<(), ()>;
|
||||
/// Clone this handle.
|
||||
fn clone(&self) -> Box<ScriptChan+Send>;
|
||||
fn clone(&self) -> Box<ScriptChan + Send>;
|
||||
}
|
||||
|
||||
impl OpaqueSender<CommonScriptMsg> for Box<ScriptChan+Send> {
|
||||
impl OpaqueSender<CommonScriptMsg> for Box<ScriptChan + Send> {
|
||||
fn send(&self, msg: CommonScriptMsg) {
|
||||
ScriptChan::send(&**self, msg).unwrap();
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ impl ScriptChan for SendableMainThreadScriptChan {
|
|||
return chan.send(msg).map_err(|_| ());
|
||||
}
|
||||
|
||||
fn clone(&self) -> Box<ScriptChan+Send> {
|
||||
fn clone(&self) -> Box<ScriptChan + Send> {
|
||||
let SendableMainThreadScriptChan(ref chan) = *self;
|
||||
box SendableMainThreadScriptChan((*chan).clone())
|
||||
}
|
||||
|
@ -294,7 +294,7 @@ impl ScriptChan for MainThreadScriptChan {
|
|||
return chan.send(MainThreadScriptMsg::Common(msg)).map_err(|_| ());
|
||||
}
|
||||
|
||||
fn clone(&self) -> Box<ScriptChan+Send> {
|
||||
fn clone(&self) -> Box<ScriptChan + Send> {
|
||||
let MainThreadScriptChan(ref chan) = *self;
|
||||
box MainThreadScriptChan((*chan).clone())
|
||||
}
|
||||
|
@ -436,8 +436,8 @@ impl ScriptTaskFactory for ScriptTask {
|
|||
ScriptLayoutChan::new(chan, port)
|
||||
}
|
||||
|
||||
fn clone_layout_channel(_phantom: Option<&mut ScriptTask>, pair: &OpaqueScriptLayoutChannel) -> Box<Any+Send> {
|
||||
box pair.sender() as Box<Any+Send>
|
||||
fn clone_layout_channel(_phantom: Option<&mut ScriptTask>, pair: &OpaqueScriptLayoutChannel) -> Box<Any + Send> {
|
||||
box pair.sender() as Box<Any + Send>
|
||||
}
|
||||
|
||||
fn create(_phantom: Option<&mut ScriptTask>,
|
||||
|
|
|
@ -142,7 +142,7 @@ impl TimerManager {
|
|||
timeout: i32,
|
||||
is_interval: IsInterval,
|
||||
source: TimerSource,
|
||||
script_chan: Box<ScriptChan+Send>)
|
||||
script_chan: Box<ScriptChan + Send>)
|
||||
-> i32 {
|
||||
let duration_ms = cmp::max(0, timeout) as u32;
|
||||
let handle = self.next_timer_handle.get();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue