mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
style: Flush parent document layout if needed for viewport dependent media queries
This is necessary to properly report changes in our document. The remaining failures are about change event scheduling, which is a pre-existing issue. Will fix, but in a separate bug. Differential Revision: https://phabricator.services.mozilla.com/D178917
This commit is contained in:
parent
ad81122fcf
commit
48f2f475c6
4 changed files with 19 additions and 5 deletions
|
@ -702,25 +702,25 @@ pub static MEDIA_FEATURES: [QueryFeatureDescription; 67] = [
|
|||
atom!("width"),
|
||||
AllowsRanges::Yes,
|
||||
Evaluator::Length(eval_width),
|
||||
FeatureFlags::empty(),
|
||||
FeatureFlags::VIEWPORT_DEPENDENT,
|
||||
),
|
||||
feature!(
|
||||
atom!("height"),
|
||||
AllowsRanges::Yes,
|
||||
Evaluator::Length(eval_height),
|
||||
FeatureFlags::empty(),
|
||||
FeatureFlags::VIEWPORT_DEPENDENT,
|
||||
),
|
||||
feature!(
|
||||
atom!("aspect-ratio"),
|
||||
AllowsRanges::Yes,
|
||||
Evaluator::NumberRatio(eval_aspect_ratio),
|
||||
FeatureFlags::empty(),
|
||||
FeatureFlags::VIEWPORT_DEPENDENT,
|
||||
),
|
||||
feature!(
|
||||
atom!("orientation"),
|
||||
AllowsRanges::No,
|
||||
keyword_evaluator!(eval_orientation, Orientation),
|
||||
FeatureFlags::empty(),
|
||||
FeatureFlags::VIEWPORT_DEPENDENT,
|
||||
),
|
||||
feature!(
|
||||
atom!("device-width"),
|
||||
|
|
|
@ -102,6 +102,11 @@ impl MediaList {
|
|||
self.media_queries.is_empty()
|
||||
}
|
||||
|
||||
/// Whether this `MediaList` depends on the viewport size.
|
||||
pub fn is_viewport_dependent(&self) -> bool {
|
||||
self.media_queries.iter().any(|q| q.is_viewport_dependent())
|
||||
}
|
||||
|
||||
/// Append a new media query item to the media list.
|
||||
/// <https://drafts.csswg.org/cssom/#dom-medialist-appendmedium>
|
||||
///
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
//! https://drafts.csswg.org/mediaqueries/#typedef-media-query
|
||||
|
||||
use crate::parser::ParserContext;
|
||||
use crate::queries::{FeatureType, QueryCondition};
|
||||
use crate::queries::{FeatureFlags, FeatureType, QueryCondition};
|
||||
use crate::str::string_as_ascii_lowercase;
|
||||
use crate::values::CustomIdent;
|
||||
use crate::Atom;
|
||||
|
@ -117,6 +117,13 @@ impl MediaQuery {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns whether this media query depends on the viewport.
|
||||
pub fn is_viewport_dependent(&self) -> bool {
|
||||
self.condition.as_ref().map_or(false, |c| {
|
||||
return c.cumulative_flags().contains(FeatureFlags::VIEWPORT_DEPENDENT)
|
||||
})
|
||||
}
|
||||
|
||||
/// Parse a media query given css input.
|
||||
///
|
||||
/// Returns an error if any of the expressions is unknown.
|
||||
|
|
|
@ -118,6 +118,8 @@ bitflags! {
|
|||
const CONTAINER_REQUIRES_WIDTH_AXIS = 1 << 4;
|
||||
/// The feature requires containment in the physical height axis.
|
||||
const CONTAINER_REQUIRES_HEIGHT_AXIS = 1 << 5;
|
||||
/// The feature evaluation depends on the viewport size.
|
||||
const VIEWPORT_DEPENDENT = 1 << 6;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue