mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
Recompute viewport-dependent styles on viewport size change
Fixes #8754.
This commit is contained in:
parent
4df7975ed3
commit
25c1bce9f6
9 changed files with 71 additions and 57 deletions
|
@ -226,12 +226,16 @@ impl<Impl: SelectorImplExt> Stylist<Impl> {
|
|||
if let Some(ref constraints) = self.viewport_constraints {
|
||||
device = Device::new(MediaType::Screen, constraints.size);
|
||||
}
|
||||
let is_device_dirty = self.is_device_dirty || stylesheets.iter()
|
||||
.flat_map(|stylesheet| stylesheet.rules().media())
|
||||
.any(|media_rule| media_rule.evaluate(&self.device) != media_rule.evaluate(&device));
|
||||
|
||||
let size_changed = device.viewport_size != self.device.viewport_size;
|
||||
|
||||
self.is_device_dirty |= stylesheets.iter().any(|stylesheet| {
|
||||
(size_changed && stylesheet.dirty_on_viewport_size_change) ||
|
||||
stylesheet.rules().media().any(|media_rule|
|
||||
media_rule.evaluate(&self.device) != media_rule.evaluate(&device))
|
||||
});
|
||||
|
||||
self.device = device;
|
||||
self.is_device_dirty |= is_device_dirty;
|
||||
}
|
||||
|
||||
pub fn viewport_constraints(&self) -> &Option<ViewportConstraints> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue