mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #8572 - nerith:idiomatic, r=frewsxcv
Make Node::is_parent_of and Stylesheet::is_effective_for_device more idiomatic Fixes #8555. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8572) <!-- Reviewable:end -->
This commit is contained in:
commit
247f586284
2 changed files with 2 additions and 8 deletions
|
@ -599,10 +599,7 @@ impl Node {
|
|||
}
|
||||
|
||||
pub fn is_parent_of(&self, child: &Node) -> bool {
|
||||
match child.parent_node.get() {
|
||||
Some(ref parent) => parent.r() == self,
|
||||
None => false,
|
||||
}
|
||||
child.parent_node.get().map_or(false, |ref parent| parent.r() == self)
|
||||
}
|
||||
|
||||
pub fn to_trusted_node_address(&self) -> TrustedNodeAddress {
|
||||
|
|
|
@ -148,10 +148,7 @@ impl Stylesheet {
|
|||
///
|
||||
/// Always true if no associated MediaQueryList exists.
|
||||
pub fn is_effective_for_device(&self, device: &Device) -> bool {
|
||||
match self.media {
|
||||
Some(ref media) => media.evaluate(device),
|
||||
None => true
|
||||
}
|
||||
self.media.as_ref().map_or(true, |ref media| media.evaluate(device))
|
||||
}
|
||||
|
||||
/// Return an iterator over all the rules within the style-sheet.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue