Skip to content
This repository was archived by the owner on Jul 10, 2023. It is now read-only.

Commit baa87a0

Browse files
author
Eric Atkinson
committed
Add stub visited callback and add equality to CSSTextDecoration
1 parent 2051eb1 commit baa87a0

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

select.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,12 @@ impl<N, H: SelectHandler<N>> n::s::CssSelectHandler<N> for SelectHandlerWrapper<
144144
false
145145
}
146146

147+
fn node_is_visited(&self, _node: &N) -> bool {
148+
// FIXME
149+
warn_unimpl("node_is_visited");
150+
false
151+
}
152+
147153
fn ua_default_for_property(&self, property: n::p::CssProperty) -> n::h::CssHint {
148154
warn!("not specifiying ua default for property %?", property);
149155
n::h::CssHintDefault

test.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,22 @@ fn single_div_test(style: &str, f: &fn(&ComputedStyle)) {
112112
f(&computed);
113113
}
114114
115+
fn single_html_test(style: &str, f: &fn(&ComputedStyle)) {
116+
let sheet = Stylesheet::new(test_url(), style_stream(style));
117+
let mut select_ctx = SelectCtx::new();
118+
let handler = &TestHandler::new();
119+
select_ctx.append_sheet(sheet, OriginAuthor);
120+
let dom = &TestNode(@NodeData {
121+
name: ~"html",
122+
id: ~"id1",
123+
children: ~[],
124+
parent: @mut None
125+
});
126+
let style = select_ctx.select_style(dom, handler);
127+
let computed = style.computed_style();
128+
f(&computed);
129+
}
130+
115131
#[test]
116132
fn test_background_color_simple() {
117133
let style = "div { background-color: #123456; }";
@@ -345,6 +361,22 @@ fn test_text_align() {
345361
}
346362
}
347363
364+
#[test]
365+
fn test_text_decoration(){
366+
let style = "div { text-decoration: none; }";
367+
do single_html_test(style) |computed| {
368+
assert!(computed.text_decoration() == Specified(CSSTextDecorationNone));
369+
}
370+
let style = "html { text-decoration: underline; }";
371+
do single_html_test(style) |computed| {
372+
assert!(computed.text_decoration() == Specified(CSSTextDecorationUnderline));
373+
}
374+
let style = "";
375+
do single_html_test(style) |computed| {
376+
assert!(computed.text_decoration() == Specified(CSSTextDecorationNone));
377+
}
378+
}
379+
348380
#[test]
349381
fn test_id_selector() {
350382
let style = "#id1 { text-align: center; }";

values.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ pub enum CSSTextAlign {
280280
CSSTextAlignJustify
281281
}
282282

283+
#[deriving(Eq)]
283284
pub enum CSSTextDecoration {
284285
CSSTextDecorationNone,
285286
CSSTextDecorationUnderline,

0 commit comments

Comments
 (0)