Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Range#insertNode #6568

Merged
merged 1 commit into from Jul 17, 2015
Merged

Implement Range#insertNode #6568

merged 1 commit into from Jul 17, 2015

Conversation

@dzbarsky
Copy link
Member

dzbarsky commented Jul 7, 2015

Gecko doesn't really follow the spec but it seems to throw a HierarchyRequest error when parent is null.
Any ideas who I should talk to about fixing the spec to account for the null checks?

Review on Reviewable

@highfive
Copy link

highfive commented Jul 7, 2015

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @kmcallister (or someone else) soon.

@hoppipolla-critic-bot
Copy link

hoppipolla-critic-bot commented Jul 7, 2015

Critic review: https://critic.hoppipolla.co.uk/r/5482

This is an external review system which you may optionally use for the code review of your pull request.

In order to help critic track your changes, please do not make in-place history rewrites (e.g. via git rebase -i or git commit --amend) when updating this pull request.

@dzbarsky dzbarsky force-pushed the dzbarsky:delete_range branch from eeacb7a to cf70ac7 Jul 7, 2015
@Ms2ger Ms2ger self-assigned this Jul 7, 2015
@Ms2ger
Copy link
Contributor

Ms2ger commented Jul 7, 2015

Reviewed 1 of 4 files at r1, 1 of 1 files at r2, 2 of 2 files at r3.
Review status: all files reviewed at latest revision, 11 unresolved discussions, all commit checks successful.


components/script/dom/range.rs, line 307 [r3] (raw file):
Checking the wrong node here!


components/script/dom/range.rs, line 319 [r3] (raw file):
If you merge step 1 into this as well, you can make this

let parent = match start_node.GetParentNode() {
    Some(parent) => parent,
    None => return Err(HierarchyRequest),
};

components/script/dom/range.rs, line 326 [r3] (raw file):
What's the parent of one of start_node's children?


components/script/dom/range.rs, line 334 [r3] (raw file):
This can't happen if you get the first step right :)


components/script/dom/range.rs, line 350 [r3] (raw file):
Note that you're supposed to use the new reference_node here. However, I don't think this ever changesparent. Poking annevk.


components/script/dom/range.rs, line 357 [r3] (raw file):
node.GetNextSibling()


components/script/dom/range.rs, line 363 [r3] (raw file):
node.remove_self();


components/script/dom/range.rs, line 369 [r3] (raw file):
Unreachable


components/script/dom/range.rs, line 391 [r3] (raw file):
"set range’s end to (parent, …"


Comments from the review on Reviewable.io

@dzbarsky
Copy link
Member Author

dzbarsky commented Jul 7, 2015

Review status: all files reviewed at latest revision, 6 unresolved discussions, all commit checks successful.


components/script/dom/range.rs, line 307 [r3] (raw file):
Good catch!


components/script/dom/range.rs, line 319 [r3] (raw file):
It's cleaner this way but the steps are out of order. Maybe we can change the spec to move " or a Text node whose parent is null" from step 1 to step 3?


components/script/dom/range.rs, line 334 [r3] (raw file):
Yep :)


components/script/dom/range.rs, line 350 [r3] (raw file):
I haven't looked at https://dom.spec.whatwg.org/#concept-Text-split too closely, but it seems like step 7.2 could maybe change start_node?


components/script/dom/range.rs, line 357 [r3] (raw file):
True


components/script/dom/range.rs, line 391 [r3] (raw file):
Man, I read this so many times!


Comments from the review on Reviewable.io

@Ms2ger
Copy link
Contributor

Ms2ger commented Jul 7, 2015

-S-awaiting-review +S-needs-code-changes


Reviewed 1 of 1 files at r4, 1 of 1 files at r5.
Review status: all files reviewed at latest revision, 3 unresolved discussions, all commit checks successful.


components/script/dom/range.rs, line 319 [r3] (raw file):
I think this way is fine.


components/script/dom/range.rs, line 350 [r3] (raw file):
Perhaps, but I don't see how that's related. You're still getting the parent from the old reference_node rather than the new one (which is split_text), and which will always be the same as parent.


tests/wpt/metadata/dom/ranges/Range-insertNode.html.ini, line 3 [r5] (raw file):
Have you investigated why those still fail?


Comments from the review on Reviewable.io

@dzbarsky
Copy link
Member Author

dzbarsky commented Jul 7, 2015

Review status: all files reviewed at latest revision, 1 unresolved discussion, all commit checks successful.


tests/wpt/metadata/dom/ranges/Range-insertNode.html.ini, line 3 [r5] (raw file):
Possibly because we haven't implemented the range updating steps in splitText and Node.insert


Comments from the review on Reviewable.io

@Ms2ger
Copy link
Contributor

Ms2ger commented Jul 16, 2015

Reviewed 1 of 1 files at r6.
Review status: all files reviewed at latest revision, 1 unresolved discussion, all commit checks successful.


components/script/dom/range.rs, line 341 [r6] (raw file):
new_parent is still parent, so you don't need to redefine it; feel free to add an assert!() too.


Comments from the review on Reviewable.io

@Ms2ger
Copy link
Contributor

Ms2ger commented Jul 16, 2015

-S-awaiting-review +S-needs-code-changes


Review status: all files reviewed at latest revision, 1 unresolved discussion, all commit checks successful.


Comments from the review on Reviewable.io

@dzbarsky dzbarsky force-pushed the dzbarsky:delete_range branch from 057f329 to 011a87e Jul 16, 2015
@dzbarsky dzbarsky force-pushed the dzbarsky:delete_range branch from 011a87e to 982855c Jul 16, 2015
@Ms2ger
Copy link
Contributor

Ms2ger commented Jul 16, 2015

@bors-servo
Copy link
Contributor

bors-servo commented Jul 16, 2015

📌 Commit 982855c has been approved by Ms2ger

@bors-servo
Copy link
Contributor

bors-servo commented Jul 16, 2015

Testing commit 982855c with merge 0842960...

bors-servo pushed a commit that referenced this pull request Jul 16, 2015
Implement Range#insertNode

Gecko doesn't really follow the spec but it seems to throw a HierarchyRequest error when parent is null.
Any ideas who I should talk to about fixing the spec to account for the null checks?

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6568)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jul 16, 2015

💔 Test failed - mac1

@dzbarsky dzbarsky force-pushed the dzbarsky:delete_range branch from 982855c to c2664e5 Jul 16, 2015
@dzbarsky
Copy link
Member Author

dzbarsky commented Jul 16, 2015

@bors-servo retry

@jdm
Copy link
Member

jdm commented Jul 16, 2015

@bors-servo
Copy link
Contributor

bors-servo commented Jul 16, 2015

📌 Commit c2664e5 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Jul 16, 2015

Testing commit c2664e5 with merge acf47a0...

bors-servo pushed a commit that referenced this pull request Jul 16, 2015
Implement Range#insertNode

Gecko doesn't really follow the spec but it seems to throw a HierarchyRequest error when parent is null.
Any ideas who I should talk to about fixing the spec to account for the null checks?

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6568)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jul 16, 2015

💔 Test failed - mac1

@jdm
Copy link
Member

jdm commented Jul 17, 2015

@bors-servo
Copy link
Contributor

bors-servo commented Jul 17, 2015

Previous build results for android, gonk, linux1, linux2, linux3, mac2, mac3 are reusable. Rebuilding only mac1...

@bors-servo
Copy link
Contributor

bors-servo commented Jul 17, 2015

☀️ Test successful - android, gonk, linux1, linux2, linux3, mac1, mac2, mac3

@bors-servo bors-servo merged commit c2664e5 into servo:master Jul 17, 2015
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@dzbarsky dzbarsky deleted the dzbarsky:delete_range branch Jul 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.