servo: Merge #8296 - Prepend, rather than append, SVG title elements (from notriddle:svg_title_prepend); r=nox
authorMichael Howell <michael@notriddle.com>
Sat, 07 Nov 2015 13:44:12 +0500
changeset 337530 3d71a9350b83216ff919ab58de6451c736d35448
parent 337529 1c25f2ddd7bcbfdef76ee453e16e1c3358493aa9
child 337531 d73fd742b3ef36eba53dec3d8f736130c3d7fa10
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnox
servo: Merge #8296 - Prepend, rather than append, SVG title elements (from notriddle:svg_title_prepend); r=nox Fixes #8164 Source-Repo: https://github.com/servo/servo Source-Revision: 3c794d0076d9f68754865c1fdaa7d2e6055bc777
servo/components/script/dom/document.rs
--- a/servo/components/script/dom/document.rs
+++ b/servo/components/script/dom/document.rs
@@ -1735,18 +1735,20 @@ impl DocumentMethods for Document {
                 node.local_name() == &atom!("title")
             });
             match elem {
                 Some(elem) => Root::upcast::<Node>(elem),
                 None => {
                     let name = QualName::new(ns!(SVG), atom!("title"));
                     let elem = Element::create(name, None, self,
                                                ElementCreator::ScriptCreated);
-                    root.upcast::<Node>()
-                        .AppendChild(elem.upcast())
+                    let parent = root.upcast::<Node>();
+                    let child = elem.upcast::<Node>();
+                    parent
+                        .InsertBefore(child, parent.GetFirstChild().r())
                         .unwrap()
                 }
             }
         } else if root.namespace() == &ns!(HTML) {
             let elem = root.upcast::<Node>()
                            .traverse_preorder()
                            .find(|node| node.is::<HTMLTitleElement>());
             match elem {