Change device and rule_set references to accessors

This commit is contained in:
heyzoos 2017-05-18 22:18:16 -05:00
parent 0ad0641872
commit 4196156bb9
7 changed files with 37 additions and 22 deletions

View file

@ -88,7 +88,7 @@ pub struct Stylist {
///
/// In both cases, the device is actually _owned_ by the Stylist, and it's
/// only an `Arc` so we can implement `add_stylesheet` more idiomatically.
pub device: Arc<Device>,
device: Arc<Device>,
/// Viewport constraints based on the current device.
viewport_constraints: Option<ViewportConstraints>,
@ -110,7 +110,7 @@ pub struct Stylist {
/// The rule tree, that stores the results of selector matching.
///
/// FIXME(emilio): Not `pub`!
pub rule_tree: RuleTree,
rule_tree: RuleTree,
/// The selector maps corresponding to a given pseudo-element
/// (depending on the implementation)
@ -1065,6 +1065,21 @@ impl Stylist {
CascadeFlags::empty(),
self.quirks_mode))
}
/// Accessor for a shared reference to the device.
pub fn device(&self) -> &Arc<Device> {
&self.device
}
/// Accessor for a mutable reference to the device.
pub fn device_mut(&mut self) -> &mut Arc<Device> {
&mut self.device
}
/// Accessor for a shared reference to the rule tree.
pub fn rule_tree(&self) -> &RuleTree {
&self.rule_tree
}
}
impl Drop for Stylist {