Auto merge of #14556 - iamrohit7:fix-set-device, r=SimonSapin,Emilio

Make Stylist::set_device check stylesheet media queries

Fixes Stylist::set_device to check for media queries in stylesheets.

<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #14279  (github issue number if applicable).

<!-- Either: -->
- [X] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14556)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-01-29 04:06:03 -08:00 committed by GitHub
commit 1c1aaa5a88
5 changed files with 53 additions and 0 deletions

View file

@ -458,6 +458,11 @@ impl Stylist {
false
}
self.is_device_dirty |= stylesheets.iter().any(|stylesheet| {
let mq = stylesheet.media.read();
if mq.evaluate(&self.device) != mq.evaluate(&device) {
return true
}
mq_eval_changed(&stylesheet.rules.read().0, &self.device, &device)
});