style: Move some of the media query code to a more generic queries module

No behavior change, just moving and renaming files.

The code in the "queries" module will be shared between @media and
@container.

@media has some other code that container queries doesn't need like
MediaList / MediaType / etc. That remains in the media_queries module.

Differential Revision: https://phabricator.services.mozilla.com/D144435
This commit is contained in:
Emilio Cobos Álvarez 2023-08-11 02:24:40 +02:00 committed by Martin Robinson
parent 3eed093e33
commit 453e7d03d4
10 changed files with 127 additions and 118 deletions

View file

@ -6,8 +6,9 @@
#[cfg(feature = "gecko")]
use crate::gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
use crate::media_queries::{Device, MediaCondition};
use crate::media_queries::Device;
use crate::parser::{Parse, ParserContext};
use crate::queries::QueryCondition;
use crate::values::computed::{self, ToComputedValue};
use crate::values::specified::{Length, NoCalcLength, ViewportPercentageLength};
use app_units::Au;
@ -20,7 +21,7 @@ use style_traits::ParseError;
/// https://html.spec.whatwg.org/multipage/#source-size
#[derive(Debug)]
pub struct SourceSize {
condition: MediaCondition,
condition: QueryCondition,
value: Length,
}
@ -29,9 +30,8 @@ impl Parse for SourceSize {
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
let condition = MediaCondition::parse(context, input)?;
let condition = QueryCondition::parse(context, input)?;
let value = Length::parse_non_negative(context, input)?;
Ok(Self { condition, value })
}
}