mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
stylo: Restrict system-metric media features to UA and chrome sheets only. r=xidorn
Reviewed-by: xidorn Bug: 1396066 MozReview-Commit-ID: 38jRV6mPbE3
This commit is contained in:
parent
8ec805874d
commit
43636e676d
2 changed files with 16 additions and 2 deletions
|
@ -32,6 +32,7 @@ use string_cache::Atom;
|
|||
use style_traits::{CSSPixel, DevicePixel};
|
||||
use style_traits::{ToCss, ParseError, StyleParseError};
|
||||
use style_traits::viewport::ViewportConstraints;
|
||||
use stylesheets::Origin;
|
||||
use values::{CSSFloat, CustomIdent, serialize_dimension};
|
||||
use values::computed::{self, ToComputedValue};
|
||||
use values::specified::Length;
|
||||
|
@ -594,8 +595,10 @@ impl Expression {
|
|||
/// ```
|
||||
/// (media-feature: media-value)
|
||||
/// ```
|
||||
pub fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>)
|
||||
-> Result<Self, ParseError<'i>> {
|
||||
pub fn parse<'i, 't>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
input.expect_parenthesis_block().map_err(|err|
|
||||
match err {
|
||||
BasicParseError::UnexpectedToken(t) => StyleParseError::ExpectedIdentifier(t),
|
||||
|
@ -616,6 +619,12 @@ impl Expression {
|
|||
)?;
|
||||
|
||||
let mut flags = 0;
|
||||
|
||||
if context.in_chrome_stylesheet() ||
|
||||
context.stylesheet_origin == Origin::UserAgent {
|
||||
flags |= nsMediaFeature_RequirementFlags::eUserAgentAndChromeOnly as u8;
|
||||
}
|
||||
|
||||
let result = {
|
||||
let mut feature_name = &**ident;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue