mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Remove obsolete step from Text::SplitText
https://github.com/whatwg/dom/pull/419
This commit is contained in:
parent
b66839367c
commit
57291e5609
2 changed files with 3 additions and 12 deletions
|
@ -1214,12 +1214,6 @@ impl WeakRangeVec {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used for steps 9.1-2. when splitting a text node.
|
|
||||||
/// https://dom.spec.whatwg.org/#concept-text-split
|
|
||||||
pub fn clamp_above(&self, node: &Node, offset: u32) {
|
|
||||||
self.map_offset_above(node, offset, |_| offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn map_offset_above<F: FnMut(u32) -> u32>(&self, node: &Node, offset: u32, mut f: F) {
|
fn map_offset_above<F: FnMut(u32) -> u32>(&self, node: &Node, offset: u32, mut f: F) {
|
||||||
unsafe {
|
unsafe {
|
||||||
(*self.cell.get()).update(|entry| {
|
(*self.cell.get()).update(|entry| {
|
||||||
|
|
|
@ -43,7 +43,8 @@ impl Text {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TextMethods for Text {
|
impl TextMethods for Text {
|
||||||
// https://dom.spec.whatwg.org/#dom-text-splittextoffset
|
// https://dom.spec.whatwg.org/#dom-text-splittext
|
||||||
|
// https://dom.spec.whatwg.org/#concept-text-split
|
||||||
fn SplitText(&self, offset: u32) -> Fallible<Root<Text>> {
|
fn SplitText(&self, offset: u32) -> Fallible<Root<Text>> {
|
||||||
let cdata = self.upcast::<CharacterData>();
|
let cdata = self.upcast::<CharacterData>();
|
||||||
// Step 1.
|
// Step 1.
|
||||||
|
@ -72,11 +73,7 @@ impl TextMethods for Text {
|
||||||
}
|
}
|
||||||
// Step 8.
|
// Step 8.
|
||||||
cdata.DeleteData(offset, count).unwrap();
|
cdata.DeleteData(offset, count).unwrap();
|
||||||
if parent.is_none() {
|
// Step 9.
|
||||||
// Step 9.
|
|
||||||
node.ranges().clamp_above(&node, offset);
|
|
||||||
}
|
|
||||||
// Step 10.
|
|
||||||
Ok(new_node)
|
Ok(new_node)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue