Skip to content

Remove Rc<T> usage from Range - #8091

Merged
bors-servo merged 1 commit into
servo:masterfrom
nox:cleanup-range
Oct 23, 2015
Merged

bors-servo merged 1 commit into
servo:masterfrom
nox:cleanup-range

Conversation

@nox

@nox nox commented Oct 20, 2015

Copy link
Copy Markdown
Contributor

I initially used this to correctly handle ranges when their respective containers
are mutated, to get weak references of Range objects. I now realise that the weak
references should be handled at a lower level, closer to the JS-managed object.

Review on Reviewable

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Oct 20, 2015
@nox nox added A-content/dom Interacting with the DOM from web content I-cleanup No impact; the issue is one of maintainability or tidiness. and removed S-awaiting-review There is new code that needs to be reviewed. labels Oct 20, 2015
@bors-servo

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #8041) made this pull request unmergeable. Please resolve the merge conflicts.

@highfive highfive added S-needs-rebase There are merge conflict errors. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Oct 21, 2015
@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Oct 21, 2015
@nox nox removed the S-needs-rebase There are merge conflict errors. label Oct 21, 2015
@eefriedman

Copy link
Copy Markdown
Contributor

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


components/script/dom/range.rs, line 123 [r1] (raw file):
Are you sure self.start > self.end is correct, as opposed to !(self.start <= self.end)? (I would hope that the WPT tests cover this... but please add a test if they don't.)


Comments from the review on Reviewable.io

@jdm jdm added S-awaiting-answer Someone asked a question that requires an answer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Oct 22, 2015
@jdm

jdm commented Oct 22, 2015

Copy link
Copy Markdown
Member

@eefriedman is reviewing this PR.

@nox

nox commented Oct 22, 2015

Copy link
Copy Markdown
Contributor Author

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


components/script/dom/range.rs, line 123 [r1] (raw file):
Why would one be correct and not the other? I'm not sure I understand.


Comments from the review on Reviewable.io

@eefriedman

Copy link
Copy Markdown
Contributor

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


components/script/dom/range.rs, line 123 [r1] (raw file):
self.start > self.end is equivalent to self.start.partial_cmp(self.end) == Some(Ordering::Greater). The original code checks for None | Some(Ordering::Greater). The difference is relevant if the two nodes aren't part of the same tree.


Comments from the review on Reviewable.io

@nox

nox commented Oct 22, 2015

Copy link
Copy Markdown
Contributor Author

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


components/script/dom/range.rs, line 123 [r1] (raw file):
Oh, good catch. I'll check that the tests fail and will fix the code accordingly.


Comments from the review on Reviewable.io

@jdm jdm added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-answer Someone asked a question that requires an answer. labels Oct 22, 2015
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Oct 22, 2015
@nox

nox commented Oct 22, 2015

Copy link
Copy Markdown
Contributor Author

Review status: 0 of 1 files reviewed at latest revision, 1 unresolved discussion, some commit checks pending.


components/script/dom/range.rs, line 123 [r1] (raw file):
Half the tests in /dom/ranges/Range-set.html were failing without this change, indeed.


Comments from the review on Reviewable.io

@eefriedman

Copy link
Copy Markdown
Contributor

Reviewed 1 of 1 files at r3.
Review status: all files reviewed at latest revision, 1 unresolved discussion, some commit checks pending.


components/script/dom/range.rs, line 124 [r3] (raw file):
The comment is confusing. If you think the algorithm needs to be described, say a bit more, like "if the current end is before the start or in another document, set the end to the same point as the start". If you think !(a<=b) needs to be clarified, just change it to call bp_position or partial_cmp directly.


Comments from the review on Reviewable.io

@jdm jdm added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Oct 23, 2015
I initially used this to correctly handle ranges when their respective containers
are mutated, to get weak references of Range objects. I now realise that the weak
references should be handled at a lower-level, closer to the JS-managed object.
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Oct 23, 2015
@nox

nox commented Oct 23, 2015

Copy link
Copy Markdown
Contributor Author

Review status: 0 of 1 files reviewed at latest revision, 1 unresolved discussion, some commit checks pending.


components/script/dom/range.rs, line 124 [r3] (raw file):
I removed the comment, I already spent too much time on this patch. :)


Comments from the review on Reviewable.io

@eefriedman

Copy link
Copy Markdown
Contributor

OK.

r=me.

@nox

nox commented Oct 23, 2015

Copy link
Copy Markdown
Contributor Author

@bors-servo r=eefriedman

Thanks for the review!

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit a1b15d3 has been approved by eefriedman

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Oct 23, 2015
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit a1b15d3 with merge e3bcf7b...

bors-servo pushed a commit that referenced this pull request Oct 23, 2015
Remove Rc<T> usage from Range

I initially used this to correctly handle ranges when their respective containers
are mutated, to get weak references of Range objects. I now realise that the weak
references should be handled at a lower level, closer to the JS-managed object.

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

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, gonk, linux-dev, linux-rel, mac-dev-ref-unit, mac-rel-css, mac-rel-wpt

@bors-servo
bors-servo merged commit a1b15d3 into servo:master Oct 23, 2015
@nox
nox deleted the cleanup-range branch December 25, 2015 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-content/dom Interacting with the DOM from web content I-cleanup No impact; the issue is one of maintainability or tidiness. S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants