Remove/don’t call no-op compute_font_hash method for stylo.

This removes a potentially-costly Arc::mut call.
This commit is contained in:
Simon Sapin 2017-02-26 18:57:35 +01:00
parent 4ad844f7bd
commit e0c63efe01
3 changed files with 9 additions and 11 deletions

View file

@ -1247,9 +1247,6 @@ fn static_assert() {
unsafe { transmute(self.gecko.mFont.weight) }
}
// This is used for PartialEq, which we don't implement for gecko style structs.
pub fn compute_font_hash(&mut self) {}
pub fn set_font_synthesis(&mut self, v: longhands::font_synthesis::computed_value::T) {
use gecko_bindings::structs::{NS_FONT_SYNTHESIS_WEIGHT, NS_FONT_SYNTHESIS_STYLE};

View file

@ -6,8 +6,7 @@
<% from data import Method %>
<% data.new_style_struct("Font",
inherited=True,
additional_methods=[Method("compute_font_hash", is_mut=True)]) %>
inherited=True) %>
<%helpers:longhand name="font-family" animatable="False" need_index="True"
spec="https://drafts.csswg.org/css-fonts/#propdef-font-family">
use self::computed_value::{FontFamily, FamilyName};

View file

@ -2044,12 +2044,14 @@ pub fn apply_declarations<'a, F, I>(viewport_size: Size2D<Au>,
style.set_root_font_size(s);
}
if seen.contains(LonghandId::FontStyle) ||
seen.contains(LonghandId::FontWeight) ||
seen.contains(LonghandId::FontStretch) ||
seen.contains(LonghandId::FontFamily) {
style.mutate_font().compute_font_hash();
}
% if product == "servo":
if seen.contains(LonghandId::FontStyle) ||
seen.contains(LonghandId::FontWeight) ||
seen.contains(LonghandId::FontStretch) ||
seen.contains(LonghandId::FontFamily) {
style.mutate_font().compute_font_hash();
}
% endif
style
}