mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Remove remaining #doc attr comments
This commit is contained in:
parent
5774950ede
commit
9ed67b31df
5 changed files with 47 additions and 32 deletions
|
@ -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
|
||||
// are not as expected
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#[doc="Performs CSS selector matching."]
|
||||
/**
|
||||
Performs CSS selector matching.
|
||||
*/
|
||||
|
||||
use dom::node::{LayoutData, Node, Text};
|
||||
use dom::element::ElementData;
|
||||
|
@ -6,7 +8,9 @@ use dom::element::ElementData;
|
|||
use values::*;
|
||||
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 {
|
||||
match attr {
|
||||
Exists(name) => {
|
||||
|
@ -55,11 +59,13 @@ trait PrivMatchingMethods {
|
|||
fn matches_selector(sel : ~Selector) -> bool;
|
||||
}
|
||||
|
||||
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.
|
||||
"]
|
||||
impl Node : PrivMatchingMethods {
|
||||
|
||||
/**
|
||||
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 {
|
||||
match *sel {
|
||||
Child(_, _) | Descendant(_, _) | Sibling(_, _) => { return false; }
|
||||
|
@ -87,7 +93,9 @@ impl Node : PrivMatchingMethods {
|
|||
//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 {
|
||||
match *sel {
|
||||
Element(*) => { return self.matches_element(sel); }
|
||||
|
@ -162,7 +170,9 @@ trait 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) {
|
||||
self.aux(|layout| {
|
||||
match decl {
|
||||
|
@ -182,13 +192,16 @@ trait 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) {
|
||||
// Loop over each rule, see if our node matches what is described in the rule. If it
|
||||
// matches, update its style. As we don't currently have priorities of style information,
|
||||
// the latest rule takes precedence over the others. So we just overwrite style
|
||||
// information as we go.
|
||||
// Loop over each rule, see if our node matches what is
|
||||
// described in the rule. If it matches, update its style. As
|
||||
// we don't currently have priorities of style information,
|
||||
// the latest rule takes precedence over the others. So we
|
||||
// just overwrite style information as we go.
|
||||
|
||||
for styles.each |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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#[doc="Text layout."]
|
||||
/** Text layout. */
|
||||
|
||||
use au = gfx::geometry;
|
||||
use geom::size::Size2D;
|
||||
|
@ -24,7 +24,7 @@ trait TextLayout {
|
|||
fn reflow_text(ctx: &LayoutContext);
|
||||
}
|
||||
|
||||
#[doc="The main reflow routine for text layout."]
|
||||
/** The main reflow routine for text layout. */
|
||||
impl @RenderBox : TextLayout {
|
||||
fn reflow_text(ctx: &LayoutContext) {
|
||||
let d = match self {
|
||||
|
|
|
@ -3,10 +3,10 @@ export GlyphIndex, GlyphPos, Glyph;
|
|||
use gfx::geometry::au;
|
||||
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;
|
||||
|
||||
#[doc="The position of a glyph on the screen."]
|
||||
/** The position of a glyph on the screen. */
|
||||
struct GlyphPos {
|
||||
advance: 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 {
|
||||
index: GlyphIndex,
|
||||
pos: GlyphPos,
|
||||
|
|
|
@ -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%),
|
||||
// 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 {
|
||||
fn print() -> ~str {
|
||||
#fmt["rgba(%u,%u,%u,%f)", self.red as uint, self.green as uint,
|
||||
self.blue as uint, self.alpha]
|
||||
fmt!("rgba(%u,%u,%u,%f)", self.red as uint, self.green as uint,
|
||||
self.blue as uint, self.alpha)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,11 +70,11 @@ mod parsing {
|
|||
export parse_color;
|
||||
|
||||
fn fail_unrecognized(col : ~str) -> Option<Color> {
|
||||
#warn["Unrecognized color %s", col];
|
||||
warn!("Unrecognized color %s", col);
|
||||
return None;
|
||||
}
|
||||
|
||||
#[doc="Match an exact color keyword."]
|
||||
/** Match an exact color keyword. */
|
||||
fn parse_by_name(color : ~str) -> Option<Color> {
|
||||
let col = match color.to_lower() {
|
||||
~"black" => black(),
|
||||
|
@ -100,7 +100,7 @@ mod parsing {
|
|||
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> {
|
||||
// Shave off the rgb( and the )
|
||||
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> {
|
||||
// Shave off the rgba( and the )
|
||||
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> {
|
||||
// Shave off the hsl( and the )
|
||||
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> {
|
||||
// Shave off the hsla( and the )
|
||||
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 {
|
||||
// The 16 basic css colors
|
||||
fn black() -> Color {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue