style: Cleanup the cascade a good bit.

This commit is contained in:
Emilio Cobos Álvarez 2017-07-20 11:20:37 +02:00
parent b70cbeb84c
commit e374a54050
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
20 changed files with 286 additions and 248 deletions

View file

@ -138,7 +138,7 @@ impl Angle {
impl nsStyleImage {
/// Set a given Servo `Image` value into this `nsStyleImage`.
pub fn set(&mut self, image: Image, cacheable: &mut bool) {
pub fn set(&mut self, image: Image) {
match image {
GenericImage::Gradient(gradient) => {
self.set_gradient(gradient)
@ -146,14 +146,6 @@ impl nsStyleImage {
GenericImage::Url(ref url) => {
unsafe {
Gecko_SetLayerImageImageValue(self, url.image_value.clone().unwrap().get());
// We unfortunately must make any url() value uncacheable, since
// the applicable declarations cache is not per document, but
// global, and the imgRequestProxy objects we store in the style
// structs don't like to be tracked by more than one document.
//
// FIXME(emilio): With the scoped TLS thing this is no longer
// true, remove this line in a follow-up!
*cacheable = false;
}
},
GenericImage::Rect(ref image_rect) => {
@ -161,15 +153,6 @@ impl nsStyleImage {
Gecko_SetLayerImageImageValue(self, image_rect.url.image_value.clone().unwrap().get());
Gecko_InitializeImageCropRect(self);
// We unfortunately must make any url() value uncacheable, since
// the applicable declarations cache is not per document, but
// global, and the imgRequestProxy objects we store in the style
// structs don't like to be tracked by more than one document.
//
// FIXME(emilio): With the scoped TLS thing this is no longer
// true, remove this line in a follow-up!
*cacheable = false;
// Set CropRect
let ref mut rect = *self.mCropRect.mPtr;
image_rect.top.to_gecko_style_coord(&mut rect.data_at_mut(0));

View file

@ -624,9 +624,7 @@ impl Expression {
// em units are relative to the initial font-size.
let context = computed::Context {
is_root_element: false,
device: device,
inherited_style: default_values,
style: StyleBuilder::for_derived_style(device, default_values, None),
builder: StyleBuilder::for_derived_style(device, default_values, None, None),
font_metrics_provider: &provider,
cached_system_font: None,
in_media_query: true,