servo: Merge #18033 - Use namespace id instead of atom in synthesize_presentational_hints_for_legacy_attributes (from upsuper:disable-mathml); r=Manishearth

Using namespace id fixes this issue because in Gecko, the pref of MathML (as well as SVG) works in the way that we choose a different namespace id (the disabled id) for the elements. Those ids are mapped to the same namespace atom as normal ids, which means if we use the atom, we would treat the elements like normal mathml elements.

https://bugzilla.mozilla.org/show_bug.cgi?id=1388881

Source-Repo: https://github.com/servo/servo
Source-Revision: 1877cac477770c5908f4b9983adaf7108a361e6e

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 5be2c9ddb0f8745f4c7e4f8905949800f4b63e76
This commit is contained in:
Xidorn Quan 2017-08-10 01:42:30 -05:00
parent db963af2af
commit 683c186350

View File

@ -1534,9 +1534,9 @@ impl<'le> PresentationalHintsSynthesizer for GeckoElement<'le> {
};
};
let ns = self.get_namespace();
let ns = self.namespace_id();
// <th> elements get a default MozCenterOrInherit which may get overridden
if ns == &*Namespace(atom!("http://www.w3.org/1999/xhtml")) {
if ns == structs::kNameSpaceID_XHTML as i32 {
if self.get_local_name().as_ptr() == atom!("th").as_ptr() {
hints.push(TH_RULE.clone());
} else if self.get_local_name().as_ptr() == atom!("table").as_ptr() &&
@ -1544,7 +1544,7 @@ impl<'le> PresentationalHintsSynthesizer for GeckoElement<'le> {
hints.push(TABLE_COLOR_RULE.clone());
}
}
if ns == &*Namespace(atom!("http://www.w3.org/2000/svg")) {
if ns == structs::kNameSpaceID_SVG as i32 {
if self.get_local_name().as_ptr() == atom!("text").as_ptr() {
hints.push(SVG_TEXT_DISABLE_ZOOM_RULE.clone());
}
@ -1621,7 +1621,7 @@ impl<'le> PresentationalHintsSynthesizer for GeckoElement<'le> {
hints.push(ApplicableDeclarationBlock::from_declarations(arc, ServoCascadeLevel::PresHints))
}
// MathML's default lang has precedence over both `lang` and `xml:lang`
if ns == &*Namespace(atom!("http://www.w3.org/1998/Math/MathML")) {
if ns == structs::kNameSpaceID_MathML as i32 {
if self.get_local_name().as_ptr() == atom!("math").as_ptr() {
hints.push(MATHML_LANG_RULE.clone());
}