mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
style: Remove a couple trivial dependencies on nsPresContext.
Differential Revision: https://phabricator.services.mozilla.com/D20141
This commit is contained in:
parent
3231714758
commit
dcfe30ff18
9 changed files with 32 additions and 34 deletions
|
@ -461,7 +461,7 @@ fn eval_moz_is_glyph(
|
|||
query_value: Option<bool>,
|
||||
_: Option<RangeOrOperator>,
|
||||
) -> bool {
|
||||
let is_glyph = unsafe { (*device.document()).mIsSVGGlyphsDocument() };
|
||||
let is_glyph = device.document().mIsSVGGlyphsDocument();
|
||||
query_value.map_or(is_glyph, |v| v == is_glyph)
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ impl Device {
|
|||
assert!(!pres_context.is_null());
|
||||
Device {
|
||||
pres_context,
|
||||
default_values: ComputedValues::default_values(unsafe { &*pres_context }),
|
||||
default_values: ComputedValues::default_values(unsafe { &*(*pres_context).mDocument.mRawPtr }),
|
||||
// FIXME(bz): Seems dubious?
|
||||
root_font_size: AtomicIsize::new(FontSize::medium().size().0 as isize),
|
||||
body_text_color: AtomicUsize::new(unsafe { &*pres_context }.mDefaultColor as usize),
|
||||
|
@ -162,13 +162,13 @@ impl Device {
|
|||
|
||||
/// Gets the document pointer.
|
||||
#[inline]
|
||||
pub fn document(&self) -> *mut structs::Document {
|
||||
self.pres_context().mDocument.mRawPtr
|
||||
pub fn document(&self) -> &structs::Document {
|
||||
unsafe { &*self.pres_context().mDocument.mRawPtr }
|
||||
}
|
||||
|
||||
/// Recreates the default computed values.
|
||||
pub fn reset_computed_values(&mut self) {
|
||||
self.default_values = ComputedValues::default_values(self.pres_context());
|
||||
self.default_values = ComputedValues::default_values(self.document());
|
||||
}
|
||||
|
||||
/// Rebuild all the cached data.
|
||||
|
|
|
@ -10,7 +10,6 @@ use crate::counter_style::{Symbol, Symbols};
|
|||
use crate::gecko_bindings::structs::{nsStyleCoord, CounterStylePtr};
|
||||
use crate::gecko_bindings::structs::{StyleGridTrackBreadth, StyleShapeRadius};
|
||||
use crate::gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut, CoordDataValue};
|
||||
use crate::media_queries::Device;
|
||||
use crate::values::computed::basic_shape::ShapeRadius as ComputedShapeRadius;
|
||||
use crate::values::computed::{Angle, Length, LengthPercentage};
|
||||
use crate::values::computed::{Number, NumberOrPercentage, Percentage};
|
||||
|
@ -387,16 +386,15 @@ pub fn round_border_to_device_pixels(width: Au, au_per_device_px: Au) -> Au {
|
|||
|
||||
impl CounterStyleOrNone {
|
||||
/// Convert this counter style to a Gecko CounterStylePtr.
|
||||
pub fn to_gecko_value(self, gecko_value: &mut CounterStylePtr, device: &Device) {
|
||||
pub fn to_gecko_value(self, gecko_value: &mut CounterStylePtr) {
|
||||
use crate::gecko_bindings::bindings::Gecko_SetCounterStyleToName as set_name;
|
||||
use crate::gecko_bindings::bindings::Gecko_SetCounterStyleToSymbols as set_symbols;
|
||||
let pres_context = device.pres_context();
|
||||
match self {
|
||||
CounterStyleOrNone::None => unsafe {
|
||||
set_name(gecko_value, atom!("none").into_addrefed(), pres_context);
|
||||
set_name(gecko_value, atom!("none").into_addrefed());
|
||||
},
|
||||
CounterStyleOrNone::Name(name) => unsafe {
|
||||
set_name(gecko_value, name.0.into_addrefed(), pres_context);
|
||||
set_name(gecko_value, name.0.into_addrefed());
|
||||
},
|
||||
CounterStyleOrNone::Symbols(symbols_type, symbols) => {
|
||||
let symbols: Vec<_> = symbols
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue