mirror of
https://github.com/servo/servo.git
synced 2025-08-15 10:25:32 +01:00
Auto merge of #16968 - HeyZoos:stylist-accessors, r=emilio
Stylist accessors <!-- Please describe your changes on the following line: --> Add accessor methods for the `device` and `ruleset` fields in the `Stylist` struct. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #16857 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/16968) <!-- Reviewable:end -->
This commit is contained in:
commit
1306b16d5a
8 changed files with 61 additions and 25 deletions
|
@ -86,7 +86,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>,
|
||||
|
@ -106,9 +106,7 @@ pub struct Stylist {
|
|||
element_map: PerPseudoElementSelectorMap,
|
||||
|
||||
/// 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)
|
||||
|
@ -1064,6 +1062,21 @@ impl Stylist {
|
|||
CascadeFlags::empty(),
|
||||
self.quirks_mode))
|
||||
}
|
||||
|
||||
/// Accessor for a shared reference to the device.
|
||||
pub fn device(&self) -> &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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue