aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/text.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2015-10-25 10:26:54 +0100
committerAnthony Ramine <n.oxyde@gmail.com>2015-12-25 23:35:57 +0100
commit3c768356159c19a4ce5f0a07684b6dee9b20f2e4 (patch)
treecd69d31d1e5587b96c4982098c3c8c5a04c56def /components/script/dom/text.rs
parent1dd7c8cf01b27f63951504a63f5c69cca53ac73a (diff)
downloadservo-3c768356159c19a4ce5f0a07684b6dee9b20f2e4.tar.gz
servo-3c768356159c19a4ce5f0a07684b6dee9b20f2e4.zip
Properly propagate changes when range or trees are mutated
Diffstat (limited to 'components/script/dom/text.rs')
-rw-r--r--components/script/dom/text.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/components/script/dom/text.rs b/components/script/dom/text.rs
index ee92332752c..1c834f563cf 100644
--- a/components/script/dom/text.rs
+++ b/components/script/dom/text.rs
@@ -62,15 +62,18 @@ impl TextMethods for Text {
// Step 6.
let parent = node.GetParentNode();
if let Some(ref parent) = parent {
- // Step 7.
+ // Step 7.1.
parent.InsertBefore(new_node.upcast(), node.GetNextSibling().r()).unwrap();
- // TODO: Ranges.
+ // Steps 7.2-3.
+ node.ranges().move_to_following_text_sibling_above(node, offset, new_node.upcast());
+ // Steps 7.4-5.
+ parent.ranges().increment_at(&parent, node.index() + 1);
}
// Step 8.
cdata.DeleteData(offset, count).unwrap();
if parent.is_none() {
// Step 9.
- // TODO: Ranges
+ node.ranges().clamp_above(&node, offset);
}
// Step 10.
Ok(new_node)