Auto merge of #18367 - aethanyc:media-change-xbl-stylset, r=emilio

style: Expose stylist::set_device() for gecko

This was reviewed in bug https://bugzilla.mozilla.org/show_bug.cgi?id=1382078

<!-- 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/18367)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-09-04 15:19:06 -05:00 committed by GitHub
commit e97f28e2a6
5 changed files with 1097 additions and 591 deletions

View file

@ -1982,6 +1982,11 @@ extern "C" {
viewport_units_used:
*mut bool) -> u8;
}
extern "C" {
pub fn Servo_StyleSet_SetDevice(set: RawServoStyleSetBorrowed,
pres_context: RawGeckoPresContextOwned)
-> u8;
}
extern "C" {
pub fn Servo_StyleSet_CompatModeChanged(raw_data:
RawServoStyleSetBorrowed);

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1070,34 +1070,32 @@ impl Stylist {
/// Also, the device that arrives here may need to take the viewport rules
/// into account.
///
/// feature = "servo" because gecko only has one device, and manually tracks
/// when the device is dirty.
///
/// FIXME(emilio): The semantics of the device for Servo and Gecko are
/// different enough we may want to unify them.
#[cfg(feature = "servo")]
/// For Gecko, this is called when XBL bindings are used by different
/// documents.
pub fn set_device(
&mut self,
mut device: Device,
guard: &SharedRwLockReadGuard,
) -> OriginSet {
let cascaded_rule = {
let stylesheets = self.stylesheets.iter();
if viewport_rule::enabled() {
let cascaded_rule = {
let stylesheets = self.stylesheets.iter();
ViewportRule {
declarations: viewport_rule::Cascade::from_stylesheets(
stylesheets.clone(),
guard,
&device
).finish(),
ViewportRule {
declarations: viewport_rule::Cascade::from_stylesheets(
stylesheets.clone(),
guard,
&device
).finish(),
}
};
self.viewport_constraints =
ViewportConstraints::maybe_new(&device, &cascaded_rule, self.quirks_mode);
if let Some(ref constraints) = self.viewport_constraints {
device.account_for_viewport_rule(constraints);
}
};
self.viewport_constraints =
ViewportConstraints::maybe_new(&device, &cascaded_rule, self.quirks_mode);
if let Some(ref constraints) = self.viewport_constraints {
device.account_for_viewport_rule(constraints);
}
self.device = device;