aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlhtmlelement.rs
diff options
context:
space:
mode:
authorbors-servo <servo-ops@mozilla.com>2020-05-04 12:43:49 -0400
committerGitHub <noreply@github.com>2020-05-04 12:43:49 -0400
commit271ff16028a8aa3ab5fa6acf0590ddfbb0624eb8 (patch)
tree2c1b9fadfa7057f27bc6d1ba0ce7b883a66f4f2e /components/script/dom/htmlhtmlelement.rs
parentd33a784c665ec7233b8825bb87d9edc97df33d0b (diff)
parent1b2464b4b686019211248ea7f4b51aa360b808b2 (diff)
downloadservo-271ff16028a8aa3ab5fa6acf0590ddfbb0624eb8.tar.gz
servo-271ff16028a8aa3ab5fa6acf0590ddfbb0624eb8.zip
Auto merge of #26398 - Eijebong:fast-path-set-inner-html, r=jdm
Add a fast path in Element::SetInnerHTML when the value is small and trivial text Inspired from gecko which has a similar fast path. This makes innerHTML more than 10 times faster for this case. Fixes #25892
Diffstat (limited to 'components/script/dom/htmlhtmlelement.rs')
-rw-r--r--components/script/dom/htmlhtmlelement.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/components/script/dom/htmlhtmlelement.rs b/components/script/dom/htmlhtmlelement.rs
index 05b34dec3dc..da77d3464d9 100644
--- a/components/script/dom/htmlhtmlelement.rs
+++ b/components/script/dom/htmlhtmlelement.rs
@@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::root::DomRoot;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
@@ -32,9 +33,12 @@ impl HTMLHtmlElement {
prefix: Option<Prefix>,
document: &Document,
) -> DomRoot<HTMLHtmlElement> {
- Node::reflect_node(
+ let n = Node::reflect_node(
Box::new(HTMLHtmlElement::new_inherited(localName, prefix, document)),
document,
- )
+ );
+
+ n.upcast::<Node>().set_weird_parser_insertion_mode();
+ n
}
}