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

Upgrade rust-selectors, pass ':empty' tests #6607

Merged
merged 1 commit into from Jul 22, 2015

Conversation

@frewsxcv
Copy link
Member

frewsxcv commented Jul 13, 2015

@hoppipolla-critic-bot
Copy link

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 git rebase -i or git commit --amend) when updating this pull request.

@@ -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.

@frewsxcv

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.

@SimonSapin

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.

@frewsxcv

frewsxcv Jul 13, 2015

Author Member

Added in the latest force push

@frewsxcv
Copy link
Member Author

frewsxcv commented Jul 13, 2015

@frewsxcv frewsxcv force-pushed the frewsxcv:bump-selectors branch from fe1fd63 to 6b469ee Jul 13, 2015
@frewsxcv frewsxcv changed the title Upgrade rust-selectors, pass ':empty' test Upgrade rust-selectors, pass ':empty' WPT tests Jul 13, 2015
@frewsxcv
Copy link
Member Author

frewsxcv commented Jul 13, 2015

I forced pushed because I ran the entire suite and found I passed two WPT tests (instead of just one)

@frewsxcv frewsxcv force-pushed the frewsxcv:bump-selectors branch from 6b469ee to f782d45 Jul 13, 2015
@frewsxcv frewsxcv changed the title Upgrade rust-selectors, pass ':empty' WPT tests Upgrade rust-selectors, pass ':empty' WPT test Jul 13, 2015
@Ms2ger
Copy link
Contributor

Ms2ger commented Jul 13, 2015

These two implementations aren't equivalent.

@frewsxcv
Copy link
Member Author

frewsxcv commented Jul 13, 2015

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 (LayoutNode, LayoutJS, etc) so it's not entirely obvious to me how they differ.

@Ms2ger
Copy link
Contributor

Ms2ger commented Jul 13, 2015

<style>
#x { background: red; }
#x:empty { background: green }
</style>
<p id=x><!--foo--></p>
<script>
console.log(document.getElementById("x").matches(":empty"));
</script>
@SimonSapin
Copy link
Member

SimonSapin commented Jul 13, 2015

I don’t see the difference either. As far as I can tell both impls would return false for comment nodes.

@Ms2ger
Copy link
Contributor

Ms2ger commented Jul 13, 2015

textContent on comments gives their data.

@SimonSapin
Copy link
Member

SimonSapin commented Jul 13, 2015

Oh, I see. @frewsxcv, I think you want self.is_text() in there, similar to self.is_element().

@frewsxcv frewsxcv force-pushed the frewsxcv:bump-selectors branch from f782d45 to 1212e5c Jul 13, 2015
@frewsxcv
Copy link
Member Author

frewsxcv commented Jul 13, 2015

Ah, I understand, thanks for the clarification. Let me know how that latest force push looks.

@Ms2ger
Copy link
Contributor

Ms2ger commented Jul 16, 2015

r+ if you add that test

@frewsxcv
Copy link
Member Author

frewsxcv commented Jul 16, 2015

Sounds reasonable. I'll add

@frewsxcv
Copy link
Member Author

frewsxcv commented Jul 19, 2015

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

@pcwalton
Copy link
Contributor

pcwalton commented Jul 20, 2015

@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.

@frewsxcv
Copy link
Member Author

frewsxcv commented Jul 21, 2015

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.

@Ms2ger
Copy link
Contributor

Ms2ger commented Jul 21, 2015

Just add a new test under tests/wpt/mozilla, then, and make sure to test both css and matches().

@frewsxcv frewsxcv force-pushed the frewsxcv:bump-selectors branch from 1212e5c to 86f049d Jul 22, 2015
@frewsxcv frewsxcv changed the title Upgrade rust-selectors, pass ':empty' WPT test Upgrade rust-selectors, pass ':empty' tests Jul 22, 2015
@frewsxcv
Copy link
Member Author

frewsxcv commented Jul 22, 2015

Added a couple tests, let me know how they look

@Ms2ger
Copy link
Contributor

Ms2ger commented Jul 22, 2015

Thanks! One nit, though: in reftests, any red being visible idiomatically implies failure, so use blue or another colour?

@frewsxcv frewsxcv force-pushed the frewsxcv:bump-selectors branch from 86f049d to b1b03a3 Jul 22, 2015
@frewsxcv
Copy link
Member Author

frewsxcv commented Jul 22, 2015

Changed the colors to orange and purple

@Ms2ger
Copy link
Contributor

Ms2ger commented Jul 22, 2015

@bors-servo
Copy link
Contributor

bors-servo commented Jul 22, 2015

📌 Commit b1b03a3 has been approved by Ms2ger

@bors-servo
Copy link
Contributor

bors-servo commented Jul 22, 2015

Testing commit b1b03a3 with merge 488f3b6...

bors-servo pushed a commit that referenced this pull request Jul 22, 2015
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 -->
@bors-servo
Copy link
Contributor

bors-servo commented Jul 22, 2015

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

@bors-servo bors-servo merged commit b1b03a3 into servo:master Jul 22, 2015
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@frewsxcv frewsxcv deleted the frewsxcv:bump-selectors branch Jul 22, 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

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