aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/text.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/text.rs')
-rw-r--r--components/script/dom/text.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/components/script/dom/text.rs b/components/script/dom/text.rs
index 37917922e84..c9381f207a8 100644
--- a/components/script/dom/text.rs
+++ b/components/script/dom/text.rs
@@ -33,19 +33,21 @@ impl Text {
}
}
- pub fn new(text: DOMString, document: &Document) -> DomRoot<Text> {
- Self::new_with_proto(text, document, None)
+ pub fn new(text: DOMString, document: &Document, can_gc: CanGc) -> DomRoot<Text> {
+ Self::new_with_proto(text, document, None, can_gc)
}
fn new_with_proto(
text: DOMString,
document: &Document,
proto: Option<HandleObject>,
+ can_gc: CanGc,
) -> DomRoot<Text> {
Node::reflect_node_with_proto(
Box::new(Text::new_inherited(text, document)),
document,
proto,
+ can_gc,
)
}
}
@@ -55,16 +57,16 @@ impl TextMethods for Text {
fn Constructor(
window: &Window,
proto: Option<HandleObject>,
- _can_gc: CanGc,
+ can_gc: CanGc,
text: DOMString,
) -> Fallible<DomRoot<Text>> {
let document = window.Document();
- Ok(Text::new_with_proto(text, &document, proto))
+ Ok(Text::new_with_proto(text, &document, proto, can_gc))
}
// https://dom.spec.whatwg.org/#dom-text-splittext
// https://dom.spec.whatwg.org/#concept-text-split
- fn SplitText(&self, offset: u32) -> Fallible<DomRoot<Text>> {
+ fn SplitText(&self, offset: u32, can_gc: CanGc) -> Fallible<DomRoot<Text>> {
let cdata = self.upcast::<CharacterData>();
// Step 1.
let length = cdata.Length();
@@ -79,7 +81,7 @@ impl TextMethods for Text {
// Step 5.
let node = self.upcast::<Node>();
let owner_doc = node.owner_doc();
- let new_node = owner_doc.CreateTextNode(new_data);
+ let new_node = owner_doc.CreateTextNode(new_data, can_gc);
// Step 6.
let parent = node.GetParentNode();
if let Some(ref parent) = parent {