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 -->
This commit is contained in:
bors-servo 2016-03-25 03:27:33 +05:30
commit 605842f193
47 changed files with 995 additions and 433 deletions

View file

@ -26,13 +26,14 @@ use std::rc::Rc;
use std::sync::{Arc, Mutex, RwLock};
use style::context::{LocalStyleContext, StyleContext};
use style::matching::{ApplicableDeclarationsCache, StyleSharingCandidateCache};
use style::properties::ComputedValues;
use style::selector_impl::ServoSelectorImpl;
use style::servo::SharedStyleContext;
use url::Url;
use util::opts;
struct LocalLayoutContext {
style_context: LocalStyleContext,
style_context: LocalStyleContext<ComputedValues>,
font_context: RefCell<FontContext>,
}
@ -107,12 +108,12 @@ pub struct LayoutContext<'a> {
cached_local_layout_context: Rc<LocalLayoutContext>,
}
impl<'a> StyleContext<'a, ServoSelectorImpl> for LayoutContext<'a> {
impl<'a> StyleContext<'a, ServoSelectorImpl, ComputedValues> for LayoutContext<'a> {
fn shared_context(&self) -> &'a SharedStyleContext {
&self.shared.style_context
}
fn local_context(&self) -> &LocalStyleContext {
fn local_context(&self) -> &LocalStyleContext<ComputedValues> {
&self.cached_local_layout_context.style_context
}
}