diff --git a/src/components/main/css/select_handler.rs b/src/components/main/css/select_handler.rs index 80affef9d34..56312ee210b 100644 --- a/src/components/main/css/select_handler.rs +++ b/src/components/main/css/select_handler.rs @@ -86,6 +86,36 @@ impl SelectHandler> for NodeSelectHandler { } } + fn with_node_classes(&self, node: &AbstractNode, f: &fn(Option<&str>) -> R) -> R { + if !node.is_element() { + fail!(~"attempting to style non-element node"); + } + do node.with_imm_element() |element_n| { + f(element_n.get_attr("class")) + } + } + + fn node_has_class(&self, node: &AbstractNode, class: &str) -> bool { + if !node.is_element() { + fail!(~"attempting to style non-element node"); + } + do node.with_imm_element |element_n| { + match element_n.get_attr("class") { + None => false, + Some(existing_classes) => { + let mut ret = false; + for str::each_split_char(existing_classes, ' ') |s| { + if s == class { + ret = true; + break; + } + } + ret + } + } + } + } + fn with_node_id(&self, node: &AbstractNode, f: &fn(Option<&str>) -> R) -> R { if !node.is_element() { fail!(~"attempting to style non-element node"); diff --git a/src/support/css/rust-css b/src/support/css/rust-css index 57407e5209e..865f5391143 160000 --- a/src/support/css/rust-css +++ b/src/support/css/rust-css @@ -1 +1 @@ -Subproject commit 57407e5209ec95e695e17447fa7c5dfea96629b3 +Subproject commit 865f539114383a021822583801e8362faf916699 diff --git a/src/support/netsurfcss/libcss b/src/support/netsurfcss/libcss index d722188de38..da248d3f5b3 160000 --- a/src/support/netsurfcss/libcss +++ b/src/support/netsurfcss/libcss @@ -1 +1 @@ -Subproject commit d722188de3876ed748382965eb4f300fc1b78bf8 +Subproject commit da248d3f5b3ed6d9e804c543563be8e34baf1673 diff --git a/src/support/netsurfcss/rust-netsurfcss b/src/support/netsurfcss/rust-netsurfcss index 3565b32ba3d..325cd5197ed 160000 --- a/src/support/netsurfcss/rust-netsurfcss +++ b/src/support/netsurfcss/rust-netsurfcss @@ -1 +1 @@ -Subproject commit 3565b32ba3d15d31b02cc76bdf76d6b13fc88451 +Subproject commit 325cd5197ed953f5c7c9317111b20ec1599eaffe diff --git a/src/test/html/test_class_helloworld.html b/src/test/html/test_class_helloworld.html new file mode 100644 index 00000000000..5e997544d57 --- /dev/null +++ b/src/test/html/test_class_helloworld.html @@ -0,0 +1,20 @@ + + + + + + +
+
Hello
+
World
+
Hello
+
World
+
+ + diff --git a/src/test/test_italic_bold.html b/src/test/html/test_italic_bold.html similarity index 100% rename from src/test/test_italic_bold.html rename to src/test/html/test_italic_bold.html diff --git a/src/test/test_underline.html b/src/test/html/test_underline.html similarity index 100% rename from src/test/test_underline.html rename to src/test/html/test_underline.html diff --git a/src/test/test_underline_helloworld.html b/src/test/html/test_underline_helloworld.html similarity index 100% rename from src/test/test_underline_helloworld.html rename to src/test/html/test_underline_helloworld.html