Auto merge of #15987 - nox:h5e, r=Ms2ger

Fix a couple of HTML parsing issues

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15987)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-03-16 17:36:00 -07:00 committed by GitHub
commit 47f0b4155c
6 changed files with 49 additions and 75 deletions

6
Cargo.lock generated
View file

@ -1134,7 +1134,7 @@ dependencies = [
[[package]] [[package]]
name = "html5ever" name = "html5ever"
version = "0.14.0" version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2253,7 +2253,7 @@ dependencies = [
"gfx_traits 0.0.1", "gfx_traits 0.0.1",
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever-atoms 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever-atoms 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.9.18 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.9.18 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper_serde 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "hyper_serde 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3413,7 +3413,7 @@ dependencies = [
"checksum heartbeats-simple 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ad003ce233955e9d95f2c69cde84e68302ba9ba4a673d351c9bff93c738aadc" "checksum heartbeats-simple 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ad003ce233955e9d95f2c69cde84e68302ba9ba4a673d351c9bff93c738aadc"
"checksum heartbeats-simple-sys 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e1a408c0011427cc0e0049f7861c70377819aedfc006e8c901b1c70fd98fb1a4" "checksum heartbeats-simple-sys 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e1a408c0011427cc0e0049f7861c70377819aedfc006e8c901b1c70fd98fb1a4"
"checksum hpack 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d2da7d3a34cf6406d9d700111b8eafafe9a251de41ae71d8052748259343b58" "checksum hpack 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d2da7d3a34cf6406d9d700111b8eafafe9a251de41ae71d8052748259343b58"
"checksum html5ever 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a3b2e982006a000535c1976213cd1baa3f455cd19335d50992ab219ffe1d3c06" "checksum html5ever 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c28216b1b9d20ef7407d8d633a3c1c4ec9a529ee661184aac0a03876709bd6b8"
"checksum html5ever-atoms 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f9bd86e3b6a5a7933a272cc0a854f24e371f31576e585c0b41e8f857270c5134" "checksum html5ever-atoms 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f9bd86e3b6a5a7933a272cc0a854f24e371f31576e585c0b41e8f857270c5134"
"checksum httparse 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a6e7a63e511f9edffbab707141fbb8707d1a3098615fb2adbd5769cdfcc9b17d" "checksum httparse 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a6e7a63e511f9edffbab707141fbb8707d1a3098615fb2adbd5769cdfcc9b17d"
"checksum hyper 0.9.18 (registry+https://github.com/rust-lang/crates.io-index)" = "1b9bf64f730d6ee4b0528a5f0a316363da9d8104318731509d4ccc86248f82b3" "checksum hyper 0.9.18 (registry+https://github.com/rust-lang/crates.io-index)" = "1b9bf64f730d6ee4b0528a5f0a316363da9d8104318731509d4ccc86248f82b3"

View file

@ -33,6 +33,7 @@ use html5ever::tree_builder::{NodeOrText, QuirksMode};
use html5ever::tree_builder::{Tracer as HtmlTracer, TreeBuilder, TreeBuilderOpts, TreeSink}; use html5ever::tree_builder::{Tracer as HtmlTracer, TreeBuilder, TreeBuilderOpts, TreeSink};
use js::jsapi::JSTracer; use js::jsapi::JSTracer;
use servo_url::ServoUrl; use servo_url::ServoUrl;
use std::ascii::AsciiExt;
use std::borrow::Cow; use std::borrow::Cow;
use std::io::{self, Write}; use std::io::{self, Write};
use style::context::QuirksMode as ServoQuirksMode; use style::context::QuirksMode as ServoQuirksMode;
@ -264,6 +265,16 @@ impl TreeSink for Sink {
} }
} }
/// https://html.spec.whatwg.org/multipage/#html-integration-point
/// Specifically, the <annotation-xml> cases.
fn is_mathml_annotation_xml_integration_point(&self, handle: JS<Node>) -> bool {
let elem = handle.downcast::<Element>().unwrap();
elem.get_attribute(&ns!(), &local_name!("encoding")).map_or(false, |attr| {
attr.value().eq_ignore_ascii_case("text/html")
|| attr.value().eq_ignore_ascii_case("application/xhtml+xml")
})
}
fn set_current_line(&mut self, line_number: u64) { fn set_current_line(&mut self, line_number: u64) {
self.current_line = line_number; self.current_line = line_number;
} }

View file

@ -0,0 +1,35 @@
[html5lib_menuitem-element.html?run_type=uri]
type: testharness
[html5lib_menuitem-element.html afcd3b1e3317ac609ddab924d836ba1e3873b80f]
expected: FAIL
[html5lib_menuitem-element.html 95c0c6923fe609297c1592f2cb82bb9f2d0f5aed]
expected: FAIL
[html5lib_menuitem-element.html e2772fe779cbcefb4458f169a0cd495cf7115845]
expected: FAIL
[html5lib_menuitem-element.html?run_type=write_single]
type: testharness
[html5lib_menuitem-element.html afcd3b1e3317ac609ddab924d836ba1e3873b80f]
expected: FAIL
[html5lib_menuitem-element.html 95c0c6923fe609297c1592f2cb82bb9f2d0f5aed]
expected: FAIL
[html5lib_menuitem-element.html e2772fe779cbcefb4458f169a0cd495cf7115845]
expected: FAIL
[html5lib_menuitem-element.html?run_type=write]
type: testharness
[html5lib_menuitem-element.html afcd3b1e3317ac609ddab924d836ba1e3873b80f]
expected: FAIL
[html5lib_menuitem-element.html 95c0c6923fe609297c1592f2cb82bb9f2d0f5aed]
expected: FAIL
[html5lib_menuitem-element.html e2772fe779cbcefb4458f169a0cd495cf7115845]
expected: FAIL

View file

@ -1,56 +0,0 @@
[html5lib_tests20.html?run_type=write_single]
type: testharness
[html5lib_tests20.html a7e70930137ff8338778253ac93dc66f11eef966]
expected: FAIL
bug: https://github.com/servo/servo/issues/15980
[html5lib_tests20.html b92100bddc318e13996fbe96c087c35152cbb4e3]
expected: FAIL
bug: https://github.com/servo/servo/issues/15980
[html5lib_tests20.html f55b68de8cf9ec17e0512a6caae94e0fbf151260]
expected: FAIL
bug: https://github.com/servo/servo/issues/15980
[html5lib_tests20.html 7fb0d4342e3ed3fabee650b83ce66ffb2f66c173]
expected: FAIL
bug: https://github.com/servo/servo/issues/15980
[html5lib_tests20.html?run_type=write]
type: testharness
[html5lib_tests20.html a7e70930137ff8338778253ac93dc66f11eef966]
expected: FAIL
bug: https://github.com/servo/servo/issues/15980
[html5lib_tests20.html b92100bddc318e13996fbe96c087c35152cbb4e3]
expected: FAIL
bug: https://github.com/servo/servo/issues/15980
[html5lib_tests20.html f55b68de8cf9ec17e0512a6caae94e0fbf151260]
expected: FAIL
bug: https://github.com/servo/servo/issues/15980
[html5lib_tests20.html 7fb0d4342e3ed3fabee650b83ce66ffb2f66c173]
expected: FAIL
bug: https://github.com/servo/servo/issues/15980
[html5lib_tests20.html?run_type=uri]
type: testharness
[html5lib_tests20.html a7e70930137ff8338778253ac93dc66f11eef966]
expected: FAIL
bug: https://github.com/servo/servo/issues/15980
[html5lib_tests20.html b92100bddc318e13996fbe96c087c35152cbb4e3]
expected: FAIL
bug: https://github.com/servo/servo/issues/15980
[html5lib_tests20.html f55b68de8cf9ec17e0512a6caae94e0fbf151260]
expected: FAIL
bug: https://github.com/servo/servo/issues/15980
[html5lib_tests20.html 7fb0d4342e3ed3fabee650b83ce66ffb2f66c173]
expected: FAIL
bug: https://github.com/servo/servo/issues/15980

View file

@ -1,5 +0,0 @@
[math-parse01.html]
type: testharness
[html tags allowed in annotation-xml/@encoding='text/html'.]
expected: FAIL

View file

@ -1,11 +0,0 @@
[math-parse03.html]
type: testharness
[p in annotation-xml encoding=text/html stays as child of annotation-xml]
expected: FAIL
[p in annotation-xml encoding=TEXT/HTML stays as child of annotation-xml]
expected: FAIL
[p in annotation-xml encoding=application/xhtml+xml stays as child of annotation-xml]
expected: FAIL