mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Make webkit device-pixel-ratio media queries a proper alias to resolution.
According to the spec: https://compat.spec.whatwg.org/#css-media-queries-webkit-device-pixel-ratio And to the Chromium implementation: https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/css/media_query_evaluator.cc?l=366&rcl=1d7328865bcf06a687aafc18ff95d55317030672 They're no different than resolution. In our implementation `resolution` does slightly different stuff. Given we still haven't shipped -webkit-device-pixel-ratio, making this match resolution looks better than the opposite. Differential Revision: https://phabricator.services.mozilla.com/D3588
This commit is contained in:
parent
c9c5e56079
commit
67f2185f54
2 changed files with 9 additions and 7 deletions
|
@ -150,14 +150,10 @@ fn eval_device_pixel_ratio(
|
|||
query_value: Option<f32>,
|
||||
range_or_operator: Option<RangeOrOperator>,
|
||||
) -> bool {
|
||||
let ratio = unsafe {
|
||||
bindings::Gecko_MediaFeatures_GetDevicePixelRatio(device.document())
|
||||
};
|
||||
|
||||
RangeOrOperator::evaluate(
|
||||
eval_resolution(
|
||||
device,
|
||||
query_value.map(Resolution::from_dppx),
|
||||
range_or_operator,
|
||||
query_value,
|
||||
ratio,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,12 @@ impl Resolution {
|
|||
pub fn dppx(&self) -> CSSFloat {
|
||||
self.0
|
||||
}
|
||||
|
||||
/// Return a computed `resolution` value from a dppx float value.
|
||||
#[inline]
|
||||
pub fn from_dppx(dppx: CSSFloat) -> Self {
|
||||
Resolution(dppx)
|
||||
}
|
||||
}
|
||||
|
||||
impl ToComputedValue for specified::Resolution {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue