Skip to content

Commit

Permalink
Bug 1298588 part 5. Store a ComputedValues on SharedStyleContext. r=b…
Browse files Browse the repository at this point in the history
…holley
  • Loading branch information
bzbarsky committed Jan 5, 2017
1 parent a5ac55c commit 56941d6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions components/layout_thread/lib.rs
Expand Up @@ -118,6 +118,7 @@ use style::error_reporting::{ParseErrorReporter, StdoutErrorReporter};
use style::logical_geometry::LogicalPoint;
use style::media_queries::{Device, MediaType};
use style::parser::ParserContextExtraData;
use style::properties::ComputedValues;
use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, REPOSITION, STORE_OVERFLOW};
use style::stylesheets::{Origin, Stylesheet, UserAgentStylesheets};
use style::stylist::Stylist;
Expand Down Expand Up @@ -527,6 +528,11 @@ impl LayoutThread {
local_context_creation_data: Mutex::new(thread_local_style_context_creation_data),
timer: self.timer.clone(),
quirks_mode: self.quirks_mode.unwrap(),
// FIXME(bz): This isn't really right, but it's no more wrong
// than what we used to do. See
// https://github.com/servo/servo/issues/14773 for fixing it
// properly.
default_computed_values: Arc::new(ComputedValues::initial_values().clone()),
},
image_cache_thread: Mutex::new(self.image_cache_thread.clone()),
image_cache_sender: Mutex::new(self.image_cache_sender.clone()),
Expand Down
5 changes: 5 additions & 0 deletions components/style/context.rs
Expand Up @@ -13,6 +13,7 @@ use error_reporting::ParseErrorReporter;
use euclid::Size2D;
use matching::StyleSharingCandidateCache;
use parking_lot::RwLock;
use properties::ComputedValues;
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
use std::sync::mpsc::Sender;
Expand Down Expand Up @@ -82,6 +83,10 @@ pub struct SharedStyleContext {

/// The QuirksMode state which the document needs to be rendered with
pub quirks_mode: QuirksMode,

/// The default computed values to use for elements with no rules
/// applying to them.
pub default_computed_values: Arc<ComputedValues>,
}

/// A thread-local style context.
Expand Down
1 change: 1 addition & 0 deletions ports/geckolib/glue.rs
Expand Up @@ -112,6 +112,7 @@ fn create_shared_context(per_doc_data: &PerDocumentStyleDataImpl) -> SharedStyle
timer: Timer::new(),
// FIXME Find the real QuirksMode information for this document
quirks_mode: QuirksMode::NoQuirks,
default_computed_values: per_doc_data.default_computed_values.clone(),
}
}

Expand Down

0 comments on commit 56941d6

Please sign in to comment.