mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Constrain the viewport & zoom when reflowing
This commit is contained in:
parent
8977316d3e
commit
138596e861
13 changed files with 100 additions and 13 deletions
|
@ -17,6 +17,7 @@ use media_queries::Device;
|
|||
use node::TElementAttributes;
|
||||
use properties::{PropertyDeclaration, PropertyDeclarationBlock};
|
||||
use stylesheets::{Stylesheet, CSSRuleIteratorExt, Origin};
|
||||
use viewport::{ViewportConstraints, ViewportRuleCascade};
|
||||
|
||||
|
||||
pub type DeclarationBlock = GenericDeclarationBlock<Vec<PropertyDeclaration>>;
|
||||
|
@ -69,6 +70,14 @@ impl Stylist {
|
|||
stylist
|
||||
}
|
||||
|
||||
pub fn constrain_viewport(&self) -> Option<ViewportConstraints> {
|
||||
let cascaded_rule = self.stylesheets.iter()
|
||||
.flat_map(|s| s.effective_rules(&self.device).viewport())
|
||||
.cascade();
|
||||
|
||||
ViewportConstraints::maybe_new(self.device.viewport_size, &cascaded_rule)
|
||||
}
|
||||
|
||||
pub fn update(&mut self) -> bool {
|
||||
if self.is_dirty {
|
||||
self.element_map = PerPseudoElementSelectorMap::new();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue