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
This commit is contained in:
Bastien Orivel 2020-05-03 15:12:58 +02:00
parent d08c4fff15
commit 1b2464b4b6
13 changed files with 89 additions and 24 deletions

View file

@ -4,6 +4,7 @@
use crate::dom::bindings::codegen::Bindings::HTMLFrameSetElementBinding::HTMLFrameSetElementMethods;
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::root::DomRoot;
use crate::dom::document::Document;
use crate::dom::htmlelement::HTMLElement;
@ -33,12 +34,14 @@ impl HTMLFrameSetElement {
prefix: Option<Prefix>,
document: &Document,
) -> DomRoot<HTMLFrameSetElement> {
Node::reflect_node(
let n = Node::reflect_node(
Box::new(HTMLFrameSetElement::new_inherited(
local_name, prefix, document,
)),
document,
)
);
n.upcast::<Node>().set_weird_parser_insertion_mode();
n
}
}