aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-04-10 03:06:11 -0500
committerbors-servo <metajack+bors@gmail.com>2015-04-10 03:06:11 -0500
commit875f07ff25eada654e5e7bf03ddce46f7d76f6c8 (patch)
tree77417e0dded2119011ff5b1800ce75c027f60ed4
parentdb4609d722039e9477848c5e53e45ff214cb84c4 (diff)
parent881112d34e6bb95fefd256b17bd690b6e8290d74 (diff)
downloadservo-875f07ff25eada654e5e7bf03ddce46f7d76f6c8.tar.gz
servo-875f07ff25eada654e5e7bf03ddce46f7d76f6c8.zip
Auto merge of #5608 - pgonda:cmdline-disable-style-sharing, r=Ms2ger
Let me know if I should fix anything, or how I could implement a test if needed. I looked at some testing in servo/ports/command_line.rs but it did not seem to apply. Thanks!
-rw-r--r--components/layout/css/matching.rs4
-rw-r--r--components/util/opts.rs7
2 files changed, 11 insertions, 0 deletions
diff --git a/components/layout/css/matching.rs b/components/layout/css/matching.rs
index 1c977c8081b..2331afc65b2 100644
--- a/components/layout/css/matching.rs
+++ b/components/layout/css/matching.rs
@@ -32,6 +32,7 @@ use style::properties::{ComputedValues, cascade};
use style::selector_matching::{Stylist, DeclarationBlock};
use util::arc_ptr_eq;
use util::cache::{LRUCache, SimpleHashCache};
+use util::opts;
use util::smallvec::{SmallVec, SmallVec16};
pub struct ApplicableDeclarations {
@@ -564,6 +565,9 @@ impl<'ln> MatchMethods for LayoutNode<'ln> {
&mut StyleSharingCandidateCache,
parent: Option<LayoutNode>)
-> StyleSharingResult {
+ if opts::get().disable_share_style_cache {
+ return StyleSharingResult::CannotShare(false)
+ }
if !self.is_element() {
return StyleSharingResult::CannotShare(false)
}
diff --git a/components/util/opts.rs b/components/util/opts.rs
index 78cb530a8ce..9d184feb555 100644
--- a/components/util/opts.rs
+++ b/components/util/opts.rs
@@ -135,6 +135,9 @@ pub struct Opts {
/// Whether MIME sniffing should be used
pub sniff_mime_types: bool,
+
+ /// Whether Style Sharing Cache is used
+ pub disable_share_style_cache: bool,
}
fn print_usage(app: &str, opts: &[getopts::OptGroup]) {
@@ -162,6 +165,8 @@ pub fn print_debug_usage(app: &str) {
print_option("trace-layout", "Write layout trace to an external file for debugging.");
print_option("validate-display-list-geometry",
"Display an error when display list geometry escapes overflow region.");
+ print_option("disable-share-style-cache",
+ "Disable the style sharing cache.");
println!("");
}
@@ -216,6 +221,7 @@ pub fn default_opts() -> Opts {
profile_tasks: false,
resources_path: None,
sniff_mime_types: false,
+ disable_share_style_cache: false,
}
}
@@ -377,6 +383,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
validate_display_list_geometry: debug_options.contains(&"validate-display-list-geometry"),
resources_path: opt_match.opt_str("resources-path"),
sniff_mime_types: opt_match.opt_present("sniff-mime-types"),
+ disable_share_style_cache: debug_options.contains(&"disable-share-style-cache"),
};
set_opts(opts);