style: Add a StyleBuilder struct to avoid refcount and atomic CAS during the cascade.

This should fix most of the complaints that caused
https://bugzilla.mozilla.org/show_bug.cgi?id=1360889 to be open, and also fix a
bunch of other FIXMEs across the style system.
This commit is contained in:
Emilio Cobos Álvarez 2017-04-30 13:59:10 +02:00
parent caa66a880a
commit 3b857f1c4e
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
11 changed files with 279 additions and 120 deletions

View file

@ -16,7 +16,7 @@ use gecko_bindings::structs::{nsMediaFeature_ValueType, nsMediaFeature_RangeType
use gecko_bindings::structs::RawGeckoPresContextOwned;
use media_queries::MediaType;
use parser::ParserContext;
use properties::ComputedValues;
use properties::{ComputedValues, StyleBuilder};
use std::fmt::{self, Write};
use std::sync::Arc;
use str::starts_with_ignore_ascii_case;
@ -552,6 +552,7 @@ impl Expression {
let default_values = device.default_computed_values();
let provider = get_metrics_provider_for_product();
// http://dev.w3.org/csswg/mediaqueries3/#units
@ -561,10 +562,9 @@ impl Expression {
device: device,
inherited_style: default_values,
layout_parent_style: default_values,
// This cloning business is kind of dumb.... It's because Context
// insists on having an actual ComputedValues inside itself.
style: default_values.clone(),
style: StyleBuilder::for_derived_style(default_values),
font_metrics_provider: &provider,
cached_system_font: None,
in_media_query: true,
// TODO: pass the correct value here.
quirks_mode: quirks_mode,