From 417305d71950e7b061706146950e3f19988b92fc Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Wed, 8 Jul 2015 11:21:09 +0200 Subject: [PATCH] Really require documentation in the script_traits crate. My previous attempt (1303dd6e2e1af39b13b57986f154a67f9e7490e7) was foiled by a typo that made the requirement only apply to the next item. --- components/script_traits/lib.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index 20fe580fdba..f8c5ccc9d90 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -6,7 +6,7 @@ //! The traits are here instead of in script so that these modules won't have //! to depend on script. -#[deny(missing_docs)] +#![deny(missing_docs)] extern crate devtools_traits; extern crate euclid; @@ -55,14 +55,19 @@ pub struct NewLayoutInfo { pub load_data: LoadData, } +/// `StylesheetLoadResponder` is used to notify a responder that a style sheet +/// has loaded. pub trait StylesheetLoadResponder { + /// Respond to a loaded style sheet. fn respond(self: Box); } /// Used to determine if a script has any pending asynchronous activity. #[derive(Copy, Clone, Debug, PartialEq)] pub enum ScriptState { + /// The document has been loaded. DocumentLoaded, + /// The document is still loading. DocumentLoading, } @@ -96,7 +101,7 @@ pub enum ConstellationControlMsg { UpdateSubpageId(PipelineId, SubpageId, SubpageId), /// 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 + /// Passes a webdriver command to the script task for execution WebDriverScriptCommand(PipelineId, WebDriverScriptCommand), /// Notifies script task that all animations are done TickAllAnimations(PipelineId), @@ -141,7 +146,10 @@ pub struct OpaqueScriptLayoutChannel(pub (Box, Box)); #[derive(Clone)] pub struct ScriptControlChan(pub Sender); +/// This trait allows creating a `ScriptTask` without depending on the `script` +/// crate. pub trait ScriptTaskFactory { + /// Create a `ScriptTask`. fn create(_phantom: Option<&mut Self>, id: PipelineId, parent_info: Option<(PipelineId, SubpageId)>, @@ -158,7 +166,9 @@ pub trait ScriptTaskFactory { window_size: Option, load_data: LoadData) where C: ScriptListener + Send; + /// Create a script -> layout channel (`Sender`, `Receiver` pair). fn create_layout_channel(_phantom: Option<&mut Self>) -> OpaqueScriptLayoutChannel; + /// Clone the `Sender` in `pair`. fn clone_layout_channel(_phantom: Option<&mut Self>, pair: &OpaqueScriptLayoutChannel) -> Box; }