mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Auto merge of #19973 - emilio:media-feature-change, r=xidorn
style: Rework how media feature changes are handled for XBL. Bug: 1435939 Reviewed-by: xidorn <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19973) <!-- Reviewable:end -->
This commit is contained in:
commit
e57319a734
4 changed files with 851 additions and 725 deletions
|
@ -18,6 +18,7 @@ use gecko_bindings::structs::mozilla::dom::CallerType;
|
|||
use gecko_bindings::structs::mozilla::AnonymousCounterStyle;
|
||||
use gecko_bindings::structs::mozilla::AtomArray;
|
||||
use gecko_bindings::structs::mozilla::MallocSizeOf;
|
||||
use gecko_bindings::structs::mozilla::ServoStyleSet;
|
||||
use gecko_bindings::structs::mozilla::OriginFlags;
|
||||
use gecko_bindings::structs::mozilla::UniquePtr;
|
||||
use gecko_bindings::structs::ServoRawOffsetArc;
|
||||
|
@ -25,6 +26,7 @@ use gecko_bindings::structs::nsIContent;
|
|||
use gecko_bindings::structs::nsIDocument;
|
||||
use gecko_bindings::structs::nsIDocument_DocumentTheme;
|
||||
use gecko_bindings::structs::nsSimpleContentList;
|
||||
use gecko_bindings::structs::MediumFeaturesChangedResult;
|
||||
use gecko_bindings::structs::RawGeckoAnimationPropertySegment;
|
||||
use gecko_bindings::structs::RawGeckoComputedTiming;
|
||||
use gecko_bindings::structs::RawGeckoCSSPropertyIDList;
|
||||
|
@ -2097,15 +2099,10 @@ extern "C" {
|
|||
}
|
||||
extern "C" {
|
||||
pub fn Servo_StyleSet_MediumFeaturesChanged(
|
||||
set: RawServoStyleSetBorrowed,
|
||||
viewport_units_used: *mut bool,
|
||||
) -> u8;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_StyleSet_SetDevice(
|
||||
set: RawServoStyleSetBorrowed,
|
||||
pres_context: RawGeckoPresContextOwned,
|
||||
) -> u8;
|
||||
document_set: RawServoStyleSetBorrowed,
|
||||
non_document_sets: *const nsTArray<*mut ServoStyleSet>,
|
||||
may_affect_default_style: bool,
|
||||
) -> MediumFeaturesChangedResult;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_StyleSet_CompatModeChanged(raw_data: RawServoStyleSetBorrowed);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1089,9 +1089,6 @@ impl Stylist {
|
|||
///
|
||||
/// Also, the device that arrives here may need to take the viewport rules
|
||||
/// into account.
|
||||
///
|
||||
/// For Gecko, this is called when XBL bindings are used by different
|
||||
/// documents.
|
||||
pub fn set_device(
|
||||
&mut self,
|
||||
mut device: Device,
|
||||
|
@ -1119,14 +1116,22 @@ impl Stylist {
|
|||
}
|
||||
|
||||
self.device = device;
|
||||
self.media_features_change_changed_style(guards)
|
||||
self.media_features_change_changed_style(guards, &self.device)
|
||||
}
|
||||
|
||||
/// Returns whether, given a media feature change, any previously-applicable
|
||||
/// style has become non-applicable, or vice-versa for each origin.
|
||||
/// style has become non-applicable, or vice-versa for each origin, using
|
||||
/// `device`.
|
||||
///
|
||||
/// Passing `device` is needed because this is used for XBL in Gecko, which
|
||||
/// can be stale in various ways, so we need to pass the device of the
|
||||
/// document itself, which is what is kept up-to-date.
|
||||
///
|
||||
/// Arguably XBL should use something more lightweight than a Stylist.
|
||||
pub fn media_features_change_changed_style(
|
||||
&self,
|
||||
guards: &StylesheetGuards,
|
||||
device: &Device,
|
||||
) -> OriginSet {
|
||||
debug!("Stylist::media_features_change_changed_style");
|
||||
|
||||
|
@ -1145,7 +1150,7 @@ impl Stylist {
|
|||
let affected_changed = !origin_cascade_data.media_feature_affected_matches(
|
||||
stylesheet,
|
||||
guard,
|
||||
&self.device,
|
||||
device,
|
||||
self.quirks_mode
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue