Remove remaining #doc attr comments

This commit is contained in:
Brian J. Burg 2012-09-29 12:11:55 -07:00
parent 5774950ede
commit 9ed67b31df
5 changed files with 47 additions and 32 deletions

View file

@ -1,4 +1,6 @@
#[doc="Constructs a list of css style rules from a token stream"] /**
Constructs a list of css style rules from a token stream
*/
// TODO: fail according to the css spec instead of failing when things // TODO: fail according to the css spec instead of failing when things
// are not as expected // are not as expected

View file

@ -1,4 +1,6 @@
#[doc="Performs CSS selector matching."] /**
Performs CSS selector matching.
*/
use dom::node::{LayoutData, Node, Text}; use dom::node::{LayoutData, Node, Text};
use dom::element::ElementData; use dom::element::ElementData;
@ -6,7 +8,9 @@ use dom::element::ElementData;
use values::*; use values::*;
use styles::{SpecifiedStyle}; use styles::{SpecifiedStyle};
#[doc="Check if a CSS attribute matches the attribute of an HTML element."] /**
Check if a CSS attribute matches the attribute of an HTML element.
*/
fn attrs_match(attr: Attr, elmt: ElementData) -> bool { fn attrs_match(attr: Attr, elmt: ElementData) -> bool {
match attr { match attr {
Exists(name) => { Exists(name) => {
@ -55,11 +59,13 @@ trait PrivMatchingMethods {
fn matches_selector(sel : ~Selector) -> bool; fn matches_selector(sel : ~Selector) -> bool;
} }
impl Node : PrivMatchingMethods { impl Node : PrivMatchingMethods {
#[doc="
Checks if the given CSS selector, which must describe a single element with no relational /**
information, describes the given HTML element. Checks if the given CSS selector, which must describe a single
"] element with no relational information, describes the given HTML
element.
*/
fn matches_element(sel: ~Selector) -> bool { fn matches_element(sel: ~Selector) -> bool {
match *sel { match *sel {
Child(_, _) | Descendant(_, _) | Sibling(_, _) => { return false; } Child(_, _) | Descendant(_, _) | Sibling(_, _) => { return false; }
@ -87,7 +93,9 @@ impl Node : PrivMatchingMethods {
//unsupported. //unsupported.
} }
#[doc = "Checks if a generic CSS selector matches a given HTML element"] /**
Checks if a generic CSS selector matches a given HTML element
*/
fn matches_selector(sel : ~Selector) -> bool { fn matches_selector(sel : ~Selector) -> bool {
match *sel { match *sel {
Element(*) => { return self.matches_element(sel); } Element(*) => { return self.matches_element(sel); }
@ -162,7 +170,9 @@ trait PrivStyleMethods {
} }
impl Node : PrivStyleMethods { impl Node : PrivStyleMethods {
#[doc="Update the computed style of an HTML element with a style specified by CSS."] /**
Update the computed style of an HTML element with a style specified by CSS.
*/
fn update_style(decl : StyleDeclaration) { fn update_style(decl : StyleDeclaration) {
self.aux(|layout| { self.aux(|layout| {
match decl { match decl {
@ -182,13 +192,16 @@ trait MatchingMethods {
} }
impl Node : MatchingMethods { impl Node : MatchingMethods {
#[doc="Compare an html element to a list of css rules and update its /**
style according to the rules matching it."] Compare an html element to a list of css rules and update its
style according to the rules matching it.
*/
fn match_css_style(styles : Stylesheet) { fn match_css_style(styles : Stylesheet) {
// Loop over each rule, see if our node matches what is described in the rule. If it // Loop over each rule, see if our node matches what is
// matches, update its style. As we don't currently have priorities of style information, // described in the rule. If it matches, update its style. As
// the latest rule takes precedence over the others. So we just overwrite style // we don't currently have priorities of style information,
// information as we go. // the latest rule takes precedence over the others. So we
// just overwrite style information as we go.
for styles.each |sty| { for styles.each |sty| {
let (selectors, decls) = copy **sty; let (selectors, decls) = copy **sty;
@ -201,7 +214,7 @@ impl Node : MatchingMethods {
} }
} }
self.aux(|a| #debug["Changed the style to: %?", copy *a.style]); self.aux(|a| debug!("Changed the style to: %?", copy *a.style));
} }
} }

View file

@ -1,4 +1,4 @@
#[doc="Text layout."] /** Text layout. */
use au = gfx::geometry; use au = gfx::geometry;
use geom::size::Size2D; use geom::size::Size2D;
@ -24,7 +24,7 @@ trait TextLayout {
fn reflow_text(ctx: &LayoutContext); fn reflow_text(ctx: &LayoutContext);
} }
#[doc="The main reflow routine for text layout."] /** The main reflow routine for text layout. */
impl @RenderBox : TextLayout { impl @RenderBox : TextLayout {
fn reflow_text(ctx: &LayoutContext) { fn reflow_text(ctx: &LayoutContext) {
let d = match self { let d = match self {

View file

@ -3,10 +3,10 @@ export GlyphIndex, GlyphPos, Glyph;
use gfx::geometry::au; use gfx::geometry::au;
use geom::point::Point2D; use geom::point::Point2D;
#[doc = "The index of a particular glyph within a font"] /** The index of a particular glyph within a font */
type GlyphIndex = uint; type GlyphIndex = uint;
#[doc="The position of a glyph on the screen."] /** The position of a glyph on the screen. */
struct GlyphPos { struct GlyphPos {
advance: Point2D<au>, advance: Point2D<au>,
offset: Point2D<au>, offset: Point2D<au>,
@ -19,7 +19,7 @@ fn GlyphPos(advance: Point2D<au>, offset: Point2D<au>) -> GlyphPos {
} }
} }
#[doc="A single glyph."] /** A single glyph. */
struct Glyph { struct Glyph {
index: GlyphIndex, index: GlyphIndex,
pos: GlyphPos, pos: GlyphPos,

View file

@ -1,4 +1,4 @@
#[doc = "A library for handling colors and parsing css color declarations."] /** A library for handling colors and parsing css color declarations. */
// TODO: handle #rrggbb color declarations, handle rgb(r%,g%,b%), // TODO: handle #rrggbb color declarations, handle rgb(r%,g%,b%),
// sanitize input / crop it to correct ranges, predefine other 130 // sanitize input / crop it to correct ranges, predefine other 130
@ -61,8 +61,8 @@ fn hsl(h : float, s : float, l : float) -> Color {
impl Color { impl Color {
fn print() -> ~str { fn print() -> ~str {
#fmt["rgba(%u,%u,%u,%f)", self.red as uint, self.green as uint, fmt!("rgba(%u,%u,%u,%f)", self.red as uint, self.green as uint,
self.blue as uint, self.alpha] self.blue as uint, self.alpha)
} }
} }
@ -70,11 +70,11 @@ mod parsing {
export parse_color; export parse_color;
fn fail_unrecognized(col : ~str) -> Option<Color> { fn fail_unrecognized(col : ~str) -> Option<Color> {
#warn["Unrecognized color %s", col]; warn!("Unrecognized color %s", col);
return None; return None;
} }
#[doc="Match an exact color keyword."] /** Match an exact color keyword. */
fn parse_by_name(color : ~str) -> Option<Color> { fn parse_by_name(color : ~str) -> Option<Color> {
let col = match color.to_lower() { let col = match color.to_lower() {
~"black" => black(), ~"black" => black(),
@ -100,7 +100,7 @@ mod parsing {
return Some(col); return Some(col);
} }
#[doc="Parses a color specification in the form rgb(foo,bar,baz)"] /** Parses a color specification in the form rgb(foo,bar,baz) */
fn parse_rgb(color : ~str) -> Option<Color> { fn parse_rgb(color : ~str) -> Option<Color> {
// Shave off the rgb( and the ) // Shave off the rgb( and the )
let only_colors = color.substr(4u, color.len() - 5u); let only_colors = color.substr(4u, color.len() - 5u);
@ -116,7 +116,7 @@ mod parsing {
} }
} }
#[doc="Parses a color specification in the form rgba(foo,bar,baz,qux)"] /** Parses a color specification in the form rgba(foo,bar,baz,qux) */
fn parse_rgba(color : ~str) -> Option<Color> { fn parse_rgba(color : ~str) -> Option<Color> {
// Shave off the rgba( and the ) // Shave off the rgba( and the )
let only_vals = color.substr(5u, color.len() - 6u); let only_vals = color.substr(5u, color.len() - 6u);
@ -132,7 +132,7 @@ mod parsing {
} }
} }
#[doc="Parses a color specification in the form hsl(foo,bar,baz)"] /** Parses a color specification in the form hsl(foo,bar,baz) */
fn parse_hsl(color : ~str) -> Option<Color> { fn parse_hsl(color : ~str) -> Option<Color> {
// Shave off the hsl( and the ) // Shave off the hsl( and the )
let only_vals = color.substr(4u, color.len() - 5u); let only_vals = color.substr(4u, color.len() - 5u);
@ -148,7 +148,7 @@ mod parsing {
} }
} }
#[doc="Parses a color specification in the form hsla(foo,bar,baz,qux)"] /** Parses a color specification in the form hsla(foo,bar,baz,qux) */
fn parse_hsla(color : ~str) -> Option<Color> { fn parse_hsla(color : ~str) -> Option<Color> {
// Shave off the hsla( and the ) // Shave off the hsla( and the )
let only_vals = color.substr(5u, color.len() - 6u); let only_vals = color.substr(5u, color.len() - 6u);
@ -240,7 +240,7 @@ mod test {
} }
#[doc="Define the colors specified by css"] /** Define the colors specified by css */
mod css_colors { mod css_colors {
// The 16 basic css colors // The 16 basic css colors
fn black() -> Color { fn black() -> Color {