mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Auto merge of #9799 - nox:range-extractcontents, r=KiChjang
Fix step 14.2 of Range::ExtractContents We need the last inclusive ancestor of start node that is not an inclusive ancestor of end node, not the first that is an inclusive ancestor of it. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9799) <!-- Reviewable:end -->
This commit is contained in:
commit
dfdeabf57d
2 changed files with 3 additions and 19 deletions
|
@ -564,8 +564,9 @@ impl RangeMethods for Range {
|
|||
} else {
|
||||
// Step 14.1-2.
|
||||
let reference_node = start_node.ancestors()
|
||||
.find(|n| n.is_inclusive_ancestor_of(end_node.r()))
|
||||
.unwrap();
|
||||
.take_while(|n| !n.is_inclusive_ancestor_of(&end_node))
|
||||
.last()
|
||||
.unwrap_or(Root::from_ref(&start_node));
|
||||
// Step 14.3.
|
||||
(reference_node.GetParentNode().unwrap(), reference_node.index() + 1)
|
||||
};
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
[Range-extractContents.html]
|
||||
type: testharness
|
||||
[Resulting cursor position for range 18 [paras[0\].firstChild, 0, paras[1\].firstChild, 0\]]
|
||||
expected: FAIL
|
||||
|
||||
[Resulting cursor position for range 19 [paras[0\].firstChild, 0, paras[1\].firstChild, 8\]]
|
||||
expected: FAIL
|
||||
|
||||
[Resulting cursor position for range 20 [paras[0\].firstChild, 3, paras[3\], 1\]]
|
||||
expected: FAIL
|
||||
|
||||
[Resulting cursor position for range 50 [paras[2\].firstChild, 4, comment, 2\]]
|
||||
expected: FAIL
|
||||
|
||||
[Resulting cursor position for range 51 [paras[3\], 1, comment, 8\]]
|
||||
expected: FAIL
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue