Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upUpgrade rust-selectors, pass ':empty' tests #6607
Conversation
hoppipolla-critic-bot
commented
Jul 13, 2015
|
Critic review: https://critic.hoppipolla.co.uk/r/5531 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 |
| @@ -263,6 +265,10 @@ impl<'ln> ::selectors::Node<LayoutElement<'ln>> for LayoutNode<'ln> { | |||
| _ => false | |||
| } | |||
| } | |||
|
|
|||
| fn is_element_or_non_empty_text(&self) -> bool { | |||
| unimplemented!() | |||
This comment has been minimized.
This comment has been minimized.
frewsxcv
Jul 13, 2015
Author
Member
This unimplemented!() is intentional because I'm not sure how this should be implemented for LayoutNode. If anyone has suggestions, please let me know
This comment has been minimized.
This comment has been minimized.
SimonSapin
Jul 13, 2015
Member
Based on reading ThreadSafeLayoutNode::text_content, try something like:
if let Some(text) = TextCast::to_layout_js(&self.node) {
unsafe {
!CharacterDataCast::from_layout_js(&text).data_for_layout().is_empty()
}
} else {
ElementCast::to_layout_js(&self.node).is_some()
}
This comment has been minimized.
This comment has been minimized.
|
@SimonSapin r? |
|
|
|
These two implementations aren't equivalent. |
In what ways are they different? At least for now, I'm very unfamiliar with any of the layout code ( |
<style>
#x { background: red; }
#x:empty { background: green }
</style>
<p id=x><!--foo--></p>
<script>
console.log(document.getElementById("x").matches(":empty"));
</script> |
|
I don’t see the difference either. As far as I can tell both impls would return false for comment nodes. |
|
|
|
Oh, I see. @frewsxcv, I think you want |
|
Ah, I understand, thanks for the clarification. Let me know how that latest force push looks. |
|
r+ if you add that test |
|
Sounds reasonable. I'll add |
|
I'd like to add a regression test for this, but I think it is blocked by #6663 since it affects the WPT test that I would be modifying |
|
@Ms2ger Can I help get this moving? The r+ here is blocked on a WPT upgrade which is blocked on some other bugs. Serialization of 2D canvas/WebGL messages is blocked on this, and e10s is blocked on that. |
|
Considering this test:
I don't think I need to add a new test case for this since it already exists (but currently doesn't work). Since I haven't explicitly stated, I am not actively working on #6663. |
|
Just add a new test under |
|
Added a couple tests, let me know how they look |
|
Thanks! One nit, though: in reftests, any red being visible idiomatically implies failure, so use blue or another colour? |
|
Changed the colors to orange and purple |
|
@bors-servo r+ |
|
|
Upgrade rust-selectors, pass ':empty' tests servo/rust-selectors#36 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6607) <!-- Reviewable:end -->
frewsxcv commentedJul 13, 2015
servo/rust-selectors#36