From b3ee1c79c03a9cfdef0808723a60bcc987f7f452 Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Wed, 13 Sep 2017 16:06:02 +0800 Subject: [PATCH] style: Make structs uncacheable if logical float/clear property values are used. --- .../style/properties/longhand/box.mako.rs | 44 +++++++++++++++---- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/components/style/properties/longhand/box.mako.rs b/components/style/properties/longhand/box.mako.rs index 52befd9c67d..33099c6cc4b 100644 --- a/components/style/properties/longhand/box.mako.rs +++ b/components/style/properties/longhand/box.mako.rs @@ -225,10 +225,24 @@ ${helpers.single_keyword("position", "static absolute relative fixed sticky", let ltr = context.style().writing_mode.is_bidi_ltr(); // https://drafts.csswg.org/css-logical-props/#float-clear match *self { - SpecifiedValue::inline_start if ltr => computed_value::T::left, - SpecifiedValue::inline_start => computed_value::T::right, - SpecifiedValue::inline_end if ltr => computed_value::T::right, - SpecifiedValue::inline_end => computed_value::T::left, + SpecifiedValue::inline_start => { + context.rule_cache_conditions.borrow_mut() + .set_writing_mode_dependency(context.builder.writing_mode); + if ltr { + computed_value::T::left + } else { + computed_value::T::right + } + } + SpecifiedValue::inline_end => { + context.rule_cache_conditions.borrow_mut() + .set_writing_mode_dependency(context.builder.writing_mode); + if ltr { + computed_value::T::right + } else { + computed_value::T::left + } + } % for value in "none left right".split(): SpecifiedValue::${value} => computed_value::T::${value}, % endfor @@ -263,10 +277,24 @@ ${helpers.single_keyword("position", "static absolute relative fixed sticky", let ltr = context.style().writing_mode.is_bidi_ltr(); // https://drafts.csswg.org/css-logical-props/#float-clear match *self { - SpecifiedValue::inline_start if ltr => computed_value::T::left, - SpecifiedValue::inline_start => computed_value::T::right, - SpecifiedValue::inline_end if ltr => computed_value::T::right, - SpecifiedValue::inline_end => computed_value::T::left, + SpecifiedValue::inline_start => { + context.rule_cache_conditions.borrow_mut() + .set_writing_mode_dependency(context.builder.writing_mode); + if ltr { + computed_value::T::left + } else { + computed_value::T::right + } + } + SpecifiedValue::inline_end => { + context.rule_cache_conditions.borrow_mut() + .set_writing_mode_dependency(context.builder.writing_mode); + if ltr { + computed_value::T::right + } else { + computed_value::T::left + } + } % for value in "none left right both".split(): SpecifiedValue::${value} => computed_value::T::${value}, % endfor