mirror of
https://github.com/servo/servo.git
synced 2025-08-11 16:35:33 +01:00
style: Assert we never style a root element from another document.
Right now when calling getComputedStyle with an element from another document, we return the style using the pres context of that document, not of the document of the window getComputedStyle was called on, so this holds. But it will stop holding if we ever change this, so assert it doesn't happen. Bug: 1374062 Reviewed-By: Manishearth MozReview-Commit-ID: 3g8yQWWdsen
This commit is contained in:
parent
1b2fd3fe85
commit
6fefe522a3
14 changed files with 52 additions and 30 deletions
|
@ -1551,7 +1551,7 @@ fn static_assert() {
|
|||
|
||||
pub fn fixup_none_generic(&mut self, device: &Device) {
|
||||
unsafe {
|
||||
bindings::Gecko_nsStyleFont_FixupNoneGeneric(&mut self.gecko, &*device.pres_context)
|
||||
bindings::Gecko_nsStyleFont_FixupNoneGeneric(&mut self.gecko, device.pres_context())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1621,7 +1621,7 @@ fn static_assert() {
|
|||
}
|
||||
|
||||
pub fn fixup_font_min_size(&mut self, device: &Device) {
|
||||
unsafe { bindings::Gecko_nsStyleFont_FixupMinFontSize(&mut self.gecko, &*device.pres_context) }
|
||||
unsafe { bindings::Gecko_nsStyleFont_FixupMinFontSize(&mut self.gecko, device.pres_context()) }
|
||||
}
|
||||
|
||||
pub fn apply_unconstrained_font_size(&mut self, v: Au) {
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
fn to_computed_value(&self, cx: &Context) -> Self::ComputedValue {
|
||||
unsafe {
|
||||
Gecko_GetLookAndFeelSystemColor(*self as i32,
|
||||
&*cx.device.pres_context)
|
||||
cx.device.pres_context())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2388,9 +2388,12 @@ ${helpers.single_keyword("-moz-math-variant",
|
|||
|
||||
let mut system: nsFont = unsafe { mem::uninitialized() };
|
||||
unsafe {
|
||||
bindings::Gecko_nsFont_InitSystem(&mut system, id as i32,
|
||||
cx.style.get_font().gecko(),
|
||||
&*cx.device.pres_context)
|
||||
bindings::Gecko_nsFont_InitSystem(
|
||||
&mut system,
|
||||
id as i32,
|
||||
cx.style.get_font().gecko(),
|
||||
cx.device.pres_context()
|
||||
)
|
||||
}
|
||||
let family = system.fontlist.mFontlist.iter().map(|font| {
|
||||
use properties::longhands::font_family::computed_value::*;
|
||||
|
|
|
@ -2783,13 +2783,14 @@ pub fn apply_declarations<'a, F, I>(device: &Device,
|
|||
// which Gecko just does regular cascading with. Do the same.
|
||||
// This can only happen in the case where the language changed but the family did not
|
||||
if generic != structs::kGenericFont_NONE {
|
||||
let pres_context = context.device.pres_context;
|
||||
let gecko_font = context.mutate_style().mutate_font().gecko_mut();
|
||||
let gecko_font = context.style.mutate_font().gecko_mut();
|
||||
gecko_font.mGenericID = generic;
|
||||
unsafe {
|
||||
bindings::Gecko_nsStyleFont_PrefillDefaultForGeneric(gecko_font,
|
||||
&*pres_context,
|
||||
generic);
|
||||
bindings::Gecko_nsStyleFont_PrefillDefaultForGeneric(
|
||||
gecko_font,
|
||||
context.device.pres_context(),
|
||||
generic
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue