diff options
author | James Gilbertson <james.gilbertson@luniv.ca> | 2015-03-24 23:46:47 -0600 |
---|---|---|
committer | James Gilbertson <james.gilbertson@luniv.ca> | 2015-05-06 00:34:33 -0600 |
commit | 138596e86136fdea14459c2c440e55593b67b626 (patch) | |
tree | 3be54ee8f5be8d17d6cfdfb1258c290f336f0b8a /components/style | |
parent | 8977316d3ef99aab41873b0e30aa7d76b7bcd3d5 (diff) | |
download | servo-138596e86136fdea14459c2c440e55593b67b626.tar.gz servo-138596e86136fdea14459c2c440e55593b67b626.zip |
Constrain the viewport & zoom when reflowing
Diffstat (limited to 'components/style')
-rw-r--r-- | components/style/selector_matching.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/components/style/selector_matching.rs b/components/style/selector_matching.rs index 211ae3dbe56..a9c0839f5e8 100644 --- a/components/style/selector_matching.rs +++ b/components/style/selector_matching.rs @@ -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(); |