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

View file

@ -33,6 +33,7 @@ use html5ever::tree_builder::{NodeOrText, QuirksMode};
use html5ever::tree_builder::{Tracer as HtmlTracer, TreeBuilder, TreeBuilderOpts, TreeSink};
use js::jsapi::JSTracer;
use servo_url::ServoUrl;
use std::ascii::AsciiExt;
use std::borrow::Cow;
use std::io::{self, Write};
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) {
self.current_line = line_number;
}