From 6b43624a7151f84871d53cf7e863f58b07c3c0f3 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Thu, 16 Mar 2017 15:46:46 +0100 Subject: Properly handle annotation-xml integration points (fixes #15980) --- components/script/dom/servoparser/html.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'components/script/dom/servoparser') diff --git a/components/script/dom/servoparser/html.rs b/components/script/dom/servoparser/html.rs index 688e2aba788..6142dba20f6 100644 --- a/components/script/dom/servoparser/html.rs +++ b/components/script/dom/servoparser/html.rs @@ -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 cases. + fn is_mathml_annotation_xml_integration_point(&self, handle: JS) -> bool { + let elem = handle.downcast::().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; } -- cgit v1.2.3