Skip to content

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

Merged
bors-servo merged 1 commit into
servo:masterfrom
frewsxcv:bump-selectors
Jul 22, 2015
Merged

bors-servo merged 1 commit into
servo:masterfrom
frewsxcv:bump-selectors

Conversation

@frewsxcv

Copy link
Copy Markdown
Contributor

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jul 13, 2015
@hoppipolla-critic-bot

Copy link
Copy Markdown

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.

Comment thread components/layout/wrapper.rs Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This unimplemented!() is intentional because I'm not sure how this should be implemented for LayoutNode. If anyone has suggestions, please let me know

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in the latest force push

@frewsxcv

Copy link
Copy Markdown
Contributor Author

@SimonSapin r?

@frewsxcv frewsxcv changed the title Upgrade rust-selectors, pass ':empty' test Upgrade rust-selectors, pass ':empty' WPT tests Jul 13, 2015
@frewsxcv

Copy link
Copy Markdown
Contributor Author

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

@frewsxcv frewsxcv changed the title Upgrade rust-selectors, pass ':empty' WPT tests Upgrade rust-selectors, pass ':empty' WPT test Jul 13, 2015
@Ms2ger

Ms2ger commented Jul 13, 2015

Copy link
Copy Markdown
Contributor

These two implementations aren't equivalent.

@frewsxcv

Copy link
Copy Markdown
Contributor Author

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

Ms2ger commented Jul 13, 2015

Copy link
Copy Markdown
Contributor
<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
Copy Markdown
Member

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

@Ms2ger

Ms2ger commented Jul 13, 2015

Copy link
Copy Markdown
Contributor

textContent on comments gives their data.

@SimonSapin

Copy link
Copy Markdown
Member

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

@frewsxcv

Copy link
Copy Markdown
Contributor Author

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

@Ms2ger

Ms2ger commented Jul 16, 2015

Copy link
Copy Markdown
Contributor

r+ if you add that test

@frewsxcv

Copy link
Copy Markdown
Contributor Author

Sounds reasonable. I'll add

@frewsxcv

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Contributor

@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
Copy Markdown
Contributor Author

@Ms2ger

Ms2ger commented Jul 21, 2015

Copy link
Copy Markdown
Contributor

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

@frewsxcv frewsxcv changed the title Upgrade rust-selectors, pass ':empty' WPT test Upgrade rust-selectors, pass ':empty' tests Jul 22, 2015
@frewsxcv

Copy link
Copy Markdown
Contributor Author

Added a couple tests, let me know how they look

@Ms2ger

Ms2ger commented Jul 22, 2015

Copy link
Copy Markdown
Contributor

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

@frewsxcv

Copy link
Copy Markdown
Contributor Author

Changed the colors to orange and purple

@Ms2ger

Ms2ger commented Jul 22, 2015

Copy link
Copy Markdown
Contributor

@bors-servo r+

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit b1b03a3 has been approved by Ms2ger

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit b1b03a3 with merge 488f3b6...

@bors-servo

Copy link
Copy Markdown
Contributor

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

@bors-servo
bors-servo merged commit b1b03a3 into servo:master Jul 22, 2015
@frewsxcv
frewsxcv deleted the bump-selectors branch July 22, 2015 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-review There is new code that needs to be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants