From ce0496e116387fa29132d25fbada07a09acb770e Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Wed, 27 Jun 2018 15:34:29 +1000 Subject: [PATCH] style: Generate ComputedStyleMap entry list from property data. This changes the order of properties returned from gCS. The old order doesn't make much sense, and other browsers don't agree on an identical order either, so it should be trivial to change it. Also the spec isn't super clear / useful in this case. Several -moz-prefixed properties are excluded from the list due to their being internal. I suspect they are never accessible anyway, so probably nothing gets changed by this. Bug: 1471114 Reviewed-by: xidorn MozReview-Commit-ID: 9LfangjpJ3P --- components/style/properties/properties.mako.rs | 2 ++ components/style/properties/shorthands/background.mako.rs | 1 + components/style/properties/shorthands/box.mako.rs | 1 + components/style/properties/shorthands/font.mako.rs | 1 + components/style/properties/shorthands/svg.mako.rs | 2 ++ components/style/properties/shorthands/text.mako.rs | 1 + 6 files changed, 8 insertions(+) diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index b27527d0132..5ba3619611b 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -836,6 +836,8 @@ bitflags! { * they can be checked in the C++ side via ServoCSSPropList.h. */ /// This property can be animated on the compositor. const CAN_ANIMATE_ON_COMPOSITOR = 0; + /// This shorthand property is accessible from getComputedStyle. + const SHORTHAND_IN_GETCS = 0; } } diff --git a/components/style/properties/shorthands/background.mako.rs b/components/style/properties/shorthands/background.mako.rs index b16c9918a24..dff9319cb30 100644 --- a/components/style/properties/shorthands/background.mako.rs +++ b/components/style/properties/shorthands/background.mako.rs @@ -196,6 +196,7 @@ <%helpers:shorthand name="background-position" + flags="SHORTHAND_IN_GETCS" sub_properties="background-position-x background-position-y" spec="https://drafts.csswg.org/css-backgrounds-4/#the-background-position"> use properties::longhands::{background_position_x, background_position_y}; diff --git a/components/style/properties/shorthands/box.mako.rs b/components/style/properties/shorthands/box.mako.rs index 842dfbd7229..1425f012854 100644 --- a/components/style/properties/shorthands/box.mako.rs +++ b/components/style/properties/shorthands/box.mako.rs @@ -6,6 +6,7 @@ <%helpers:shorthand name="overflow" + flags="SHORTHAND_IN_GETCS" sub_properties="overflow-x overflow-y" spec="https://drafts.csswg.org/css-overflow/#propdef-overflow" > diff --git a/components/style/properties/shorthands/font.mako.rs b/components/style/properties/shorthands/font.mako.rs index a53f899851c..75095bcebc2 100644 --- a/components/style/properties/shorthands/font.mako.rs +++ b/components/style/properties/shorthands/font.mako.rs @@ -285,6 +285,7 @@ <%helpers:shorthand name="font-variant" + flags="SHORTHAND_IN_GETCS" sub_properties="font-variant-caps ${'font-variant-alternates' if product == 'gecko' else ''} ${'font-variant-east-asian' if product == 'gecko' else ''} diff --git a/components/style/properties/shorthands/svg.mako.rs b/components/style/properties/shorthands/svg.mako.rs index aa73c77e46b..03027359dd4 100644 --- a/components/style/properties/shorthands/svg.mako.rs +++ b/components/style/properties/shorthands/svg.mako.rs @@ -5,6 +5,7 @@ <%namespace name="helpers" file="/helpers.mako.rs" /> <%helpers:shorthand name="mask" products="gecko" extra_prefixes="webkit" + flags="SHORTHAND_IN_GETCS" sub_properties="mask-mode mask-repeat mask-clip mask-origin mask-composite mask-position-x mask-position-y mask-size mask-image" spec="https://drafts.fxtf.org/css-masking/#propdef-mask"> @@ -182,6 +183,7 @@ <%helpers:shorthand name="mask-position" products="gecko" extra_prefixes="webkit" + flags="SHORTHAND_IN_GETCS" sub_properties="mask-position-x mask-position-y" spec="https://drafts.csswg.org/css-masks-4/#the-mask-position"> use properties::longhands::{mask_position_x,mask_position_y}; diff --git a/components/style/properties/shorthands/text.mako.rs b/components/style/properties/shorthands/text.mako.rs index 18a0786494d..e83d0b67544 100644 --- a/components/style/properties/shorthands/text.mako.rs +++ b/components/style/properties/shorthands/text.mako.rs @@ -5,6 +5,7 @@ <%namespace name="helpers" file="/helpers.mako.rs" /> <%helpers:shorthand name="text-decoration" + flags="SHORTHAND_IN_GETCS" sub_properties="text-decoration-line ${' text-decoration-style text-decoration-color' if product == 'gecko' else ''}" spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration">