Fixed scaling artefacts in paint worklets caused by zoom and hidpi.

This commit is contained in:
Alan Jeffrey 2017-06-23 11:07:02 -05:00
parent e19fefcb47
commit caa3585219
24 changed files with 160 additions and 77 deletions

View file

@ -11,6 +11,7 @@ use bloom::StyleBloom;
use cache::LRUCache;
use data::{EagerPseudoStyles, ElementData};
use dom::{OpaqueNode, TNode, TElement, SendElement};
use euclid::ScaleFactor;
use euclid::Size2D;
use fnv::FnvHashMap;
use font_metrics::FontMetricsProvider;
@ -27,6 +28,8 @@ use std::fmt;
use std::ops;
#[cfg(feature = "servo")] use std::sync::Mutex;
#[cfg(feature = "servo")] use std::sync::mpsc::Sender;
use style_traits::CSSPixel;
use style_traits::DevicePixel;
use stylist::Stylist;
use thread_state;
use time;
@ -152,6 +155,11 @@ impl<'a> SharedStyleContext<'a> {
pub fn viewport_size(&self) -> Size2D<Au> {
self.stylist.device().au_viewport_size()
}
/// The device pixel ratio
pub fn device_pixel_ratio(&self) -> ScaleFactor<f32, CSSPixel, DevicePixel> {
self.stylist.device().device_pixel_ratio()
}
}
/// The structure holds various intermediate inputs that are eventually used by