diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-03-25 03:27:33 +0530 |
---|---|---|
committer | bors-servo <lbergstrom+bors@mozilla.com> | 2016-03-25 03:27:33 +0530 |
commit | 605842f193aedc1151ab38a99c49f693c76e5cf3 (patch) | |
tree | 1390698f84106f785cd82ecbbfda0bb53e725a77 /components/style/context.rs | |
parent | 7f944afee88bb2ab13de4f37118af14d40328f7f (diff) | |
parent | e82aa66245935f0aaac61e667a38dce9b5662f42 (diff) | |
download | servo-605842f193aedc1151ab38a99c49f693c76e5cf3.tar.gz servo-605842f193aedc1151ab38a99c49f693c76e5cf3.zip |
Auto merge of #10155 - bholley:generalize_style_structs, r=SimonSapin
Generalize the style structs
This allows geckolib to pass gecko style structs and have the style system write to them directly, provided we implement all the traits.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10155)
<!-- Reviewable:end -->
Diffstat (limited to 'components/style/context.rs')
-rw-r--r-- | components/style/context.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/components/style/context.rs b/components/style/context.rs index 6e4edfd1b52..ef19bc2561e 100644 --- a/components/style/context.rs +++ b/components/style/context.rs @@ -8,6 +8,7 @@ use dom::OpaqueNode; use error_reporting::ParseErrorReporter; use euclid::Size2D; use matching::{ApplicableDeclarationsCache, StyleSharingCandidateCache}; +use properties::TComputedValues; use selector_impl::SelectorImplExt; use selector_matching::Stylist; use std::cell::RefCell; @@ -54,15 +55,15 @@ pub struct SharedStyleContext<Impl: SelectorImplExt> { pub error_reporter: Box<ParseErrorReporter + Sync>, } -pub struct LocalStyleContext { - pub applicable_declarations_cache: RefCell<ApplicableDeclarationsCache>, - pub style_sharing_candidate_cache: RefCell<StyleSharingCandidateCache>, +pub struct LocalStyleContext<C: TComputedValues> { + pub applicable_declarations_cache: RefCell<ApplicableDeclarationsCache<C>>, + pub style_sharing_candidate_cache: RefCell<StyleSharingCandidateCache<C>>, } -pub trait StyleContext<'a, Impl: SelectorImplExt> { +pub trait StyleContext<'a, Impl: SelectorImplExt, C: TComputedValues> { fn shared_context(&self) -> &'a SharedStyleContext<Impl>; - fn local_context(&self) -> &LocalStyleContext; + fn local_context(&self) -> &LocalStyleContext<C>; } /// Why we're doing reflow. |