aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/node.rs
diff options
context:
space:
mode:
authorBastien Orivel <eijebong@bananium.fr>2020-05-03 15:12:58 +0200
committerBastien Orivel <eijebong@bananium.fr>2020-05-04 18:11:49 +0200
commit1b2464b4b686019211248ea7f4b51aa360b808b2 (patch)
treea2d122044fa7b07951a8213aa4aa2107c695a7f2 /components/script/dom/node.rs
parentd08c4fff15cb5f6a8840621e848c9de22fcc3439 (diff)
downloadservo-1b2464b4b686019211248ea7f4b51aa360b808b2.tar.gz
servo-1b2464b4b686019211248ea7f4b51aa360b808b2.zip
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/node.rs')
-rw-r--r--components/script/dom/node.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 4579890a03e..503cc589b50 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -196,6 +196,10 @@ bitflags! {
/// Specifies whether this node's shadow-including root is a document.
const IS_CONNECTED = 1 << 10;
+
+ /// Whether this node has a weird parser insertion mode. i.e whether setting innerHTML
+ /// needs extra work or not
+ const HAS_WEIRD_PARSER_INSERTION_MODE = 1 << 11;
}
}
@@ -554,6 +558,16 @@ impl Node {
self.flags.get().contains(NodeFlags::IS_IN_SHADOW_TREE)
}
+ pub fn has_weird_parser_insertion_mode(&self) -> bool {
+ self.flags
+ .get()
+ .contains(NodeFlags::HAS_WEIRD_PARSER_INSERTION_MODE)
+ }
+
+ pub fn set_weird_parser_insertion_mode(&self) {
+ self.set_flag(NodeFlags::HAS_WEIRD_PARSER_INSERTION_MODE, true)
+ }
+
pub fn is_connected(&self) -> bool {
self.flags.get().contains(NodeFlags::IS_CONNECTED)
}