From e0c63efe015e88dc344e000896ff23a19f467778 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Sun, 26 Feb 2017 18:57:35 +0100 Subject: [PATCH] =?UTF-8?q?Remove/don=E2=80=99t=20call=20no-op=20compute?= =?UTF-8?q?=5Ffont=5Fhash=20method=20for=20stylo.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This removes a potentially-costly Arc::mut call. --- components/style/properties/gecko.mako.rs | 3 --- components/style/properties/longhand/font.mako.rs | 3 +-- components/style/properties/properties.mako.rs | 14 ++++++++------ 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 901779eba59..b8fbbee1194 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -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}; diff --git a/components/style/properties/longhand/font.mako.rs b/components/style/properties/longhand/font.mako.rs index 1add7ea5680..4b05c50b970 100644 --- a/components/style/properties/longhand/font.mako.rs +++ b/components/style/properties/longhand/font.mako.rs @@ -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}; diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 0dd9682e5b1..c1a3db4778a 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -2044,12 +2044,14 @@ pub fn apply_declarations<'a, F, I>(viewport_size: Size2D, 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 }