mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
style: Ignore pref-controlled properties in cached scrollbar style assertions.
Now if you add a new inherited, pref-controlled property, you must declare whether it can have an effect on scrollbar styles. If no, then the property will be skipped in the assertions that check whether our cached styles are equal to those we would compute. Differential Revision: https://phabricator.services.mozilla.com/D37507
This commit is contained in:
parent
145acbf876
commit
e3b57efc7e
5 changed files with 36 additions and 1 deletions
|
@ -175,6 +175,7 @@ class Longhand(object):
|
||||||
predefined_type=None, servo_pref=None, gecko_pref=None,
|
predefined_type=None, servo_pref=None, gecko_pref=None,
|
||||||
enabled_in="content", need_index=False,
|
enabled_in="content", need_index=False,
|
||||||
gecko_ffi_name=None,
|
gecko_ffi_name=None,
|
||||||
|
has_effect_on_gecko_scrollbars=None,
|
||||||
allowed_in_keyframe_block=True, cast_type='u8',
|
allowed_in_keyframe_block=True, cast_type='u8',
|
||||||
logical=False, logical_group=None, alias=None, extra_prefixes=None, boxed=False,
|
logical=False, logical_group=None, alias=None, extra_prefixes=None, boxed=False,
|
||||||
flags=None, allowed_in_page_rule=False, allow_quirks="No",
|
flags=None, allowed_in_page_rule=False, allow_quirks="No",
|
||||||
|
@ -192,6 +193,14 @@ class Longhand(object):
|
||||||
self.style_struct = style_struct
|
self.style_struct = style_struct
|
||||||
self.servo_pref = servo_pref
|
self.servo_pref = servo_pref
|
||||||
self.gecko_pref = gecko_pref
|
self.gecko_pref = gecko_pref
|
||||||
|
self.has_effect_on_gecko_scrollbars = has_effect_on_gecko_scrollbars
|
||||||
|
assert (
|
||||||
|
has_effect_on_gecko_scrollbars in [None, False, True] and
|
||||||
|
not style_struct.inherited or
|
||||||
|
(gecko_pref is None) == (has_effect_on_gecko_scrollbars is None)), (
|
||||||
|
"Property " + name + ": has_effect_on_gecko_scrollbars must be " +
|
||||||
|
"specified, and must have a value of True or False, iff a " +
|
||||||
|
"property is inherited and is behind a Gecko pref")
|
||||||
# For enabled_in, the setup is as follows:
|
# For enabled_in, the setup is as follows:
|
||||||
# It needs to be one of the four values: ["", "ua", "chrome", "content"]
|
# It needs to be one of the four values: ["", "ua", "chrome", "content"]
|
||||||
# * "chrome" implies "ua", and implies that they're explicitly
|
# * "chrome" implies "ua", and implies that they're explicitly
|
||||||
|
|
|
@ -192,6 +192,7 @@ ${helpers.predefined_type(
|
||||||
"FontVariationSettings",
|
"FontVariationSettings",
|
||||||
products="gecko",
|
products="gecko",
|
||||||
gecko_pref="layout.css.font-variations.enabled",
|
gecko_pref="layout.css.font-variations.enabled",
|
||||||
|
has_effect_on_gecko_scrollbars=False,
|
||||||
initial_value="computed::FontVariationSettings::normal()",
|
initial_value="computed::FontVariationSettings::normal()",
|
||||||
initial_specified_value="specified::FontVariationSettings::normal()",
|
initial_specified_value="specified::FontVariationSettings::normal()",
|
||||||
animation_value_type="ComputedValue",
|
animation_value_type="ComputedValue",
|
||||||
|
@ -216,6 +217,7 @@ ${helpers.single_keyword_system(
|
||||||
"auto none",
|
"auto none",
|
||||||
products="gecko",
|
products="gecko",
|
||||||
gecko_pref="layout.css.font-variations.enabled",
|
gecko_pref="layout.css.font-variations.enabled",
|
||||||
|
has_effect_on_gecko_scrollbars=False,
|
||||||
gecko_ffi_name="mFont.opticalSizing",
|
gecko_ffi_name="mFont.opticalSizing",
|
||||||
gecko_constant_prefix="NS_FONT_OPTICAL_SIZING",
|
gecko_constant_prefix="NS_FONT_OPTICAL_SIZING",
|
||||||
animation_value_type="discrete",
|
animation_value_type="discrete",
|
||||||
|
@ -512,6 +514,7 @@ ${helpers.single_keyword(
|
||||||
gecko_constant_prefix="NS_FONT_SMOOTHING",
|
gecko_constant_prefix="NS_FONT_SMOOTHING",
|
||||||
gecko_ffi_name="mFont.smoothing",
|
gecko_ffi_name="mFont.smoothing",
|
||||||
gecko_pref="layout.css.osx-font-smoothing.enabled",
|
gecko_pref="layout.css.osx-font-smoothing.enabled",
|
||||||
|
has_effect_on_gecko_scrollbars=False,
|
||||||
products="gecko",
|
products="gecko",
|
||||||
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth)",
|
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth)",
|
||||||
flags="APPLIES_TO_CUE APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER APPLIES_TO_MARKER",
|
flags="APPLIES_TO_CUE APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER APPLIES_TO_MARKER",
|
||||||
|
|
|
@ -103,7 +103,8 @@ ${helpers.predefined_type(
|
||||||
gecko_enum_prefix="StyleTextJustify"
|
gecko_enum_prefix="StyleTextJustify"
|
||||||
animation_value_type="discrete"
|
animation_value_type="discrete"
|
||||||
gecko_pref="layout.css.text-justify.enabled"
|
gecko_pref="layout.css.text-justify.enabled"
|
||||||
flags="APPLIES_TO_PLACEHOLDER",
|
has_effect_on_gecko_scrollbars="False"
|
||||||
|
flags="APPLIES_TO_PLACEHOLDER"
|
||||||
spec="https://drafts.csswg.org/css-text/#propdef-text-justify"
|
spec="https://drafts.csswg.org/css-text/#propdef-text-justify"
|
||||||
servo_restyle_damage="rebuild_and_reflow"
|
servo_restyle_damage="rebuild_and_reflow"
|
||||||
>
|
>
|
||||||
|
@ -383,6 +384,7 @@ ${helpers.predefined_type(
|
||||||
products="gecko",
|
products="gecko",
|
||||||
animation_value_type="ComputedValue",
|
animation_value_type="ComputedValue",
|
||||||
gecko_pref="layout.css.text-underline-offset.enabled",
|
gecko_pref="layout.css.text-underline-offset.enabled",
|
||||||
|
has_effect_on_gecko_scrollbars=False,
|
||||||
spec="https://drafts.csswg.org/css-text-decor-4/#underline-offset",
|
spec="https://drafts.csswg.org/css-text-decor-4/#underline-offset",
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
@ -395,5 +397,6 @@ ${helpers.predefined_type(
|
||||||
needs_context=False,
|
needs_context=False,
|
||||||
animation_value_type="discrete",
|
animation_value_type="discrete",
|
||||||
gecko_pref="layout.css.text-decoration-skip-ink.enabled",
|
gecko_pref="layout.css.text-decoration-skip-ink.enabled",
|
||||||
|
has_effect_on_gecko_scrollbars=False,
|
||||||
spec="https://drafts.csswg.org/css-text-decor-4/#text-decoration-skip-ink-property",
|
spec="https://drafts.csswg.org/css-text-decor-4/#text-decoration-skip-ink-property",
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -74,6 +74,10 @@ ${helpers.predefined_type(
|
||||||
"Default::default()",
|
"Default::default()",
|
||||||
spec="https://drafts.csswg.org/css-scrollbars-1/#scrollbar-color",
|
spec="https://drafts.csswg.org/css-scrollbars-1/#scrollbar-color",
|
||||||
gecko_pref="layout.css.scrollbar-color.enabled",
|
gecko_pref="layout.css.scrollbar-color.enabled",
|
||||||
|
# Surprisingly, yes the computed value of scrollbar-color has no effect on
|
||||||
|
# Gecko scrollbar elements, since the value only matters on the scrollable
|
||||||
|
# element itself.
|
||||||
|
has_effect_on_gecko_scrollbars=False,
|
||||||
animation_value_type="ScrollbarColor",
|
animation_value_type="ScrollbarColor",
|
||||||
boxed=True,
|
boxed=True,
|
||||||
ignored_when_colors_disabled=True,
|
ignored_when_colors_disabled=True,
|
||||||
|
|
|
@ -812,6 +812,22 @@ impl LonghandIdSet {
|
||||||
&IGNORED_WHEN_COLORS_DISABLED
|
&IGNORED_WHEN_COLORS_DISABLED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the set of properties that are declared as having no effect on
|
||||||
|
/// Gecko <scrollbar> elements or their descendant scrollbar parts.
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
#[cfg(feature = "gecko")]
|
||||||
|
#[inline]
|
||||||
|
pub fn has_no_effect_on_gecko_scrollbars() -> &'static Self {
|
||||||
|
// data.py asserts that has_no_effect_on_gecko_scrollbars is True or
|
||||||
|
// False for properties that are inherited and Gecko pref controlled,
|
||||||
|
// and is None for all other properties.
|
||||||
|
${static_longhand_id_set(
|
||||||
|
"HAS_NO_EFFECT_ON_SCROLLBARS",
|
||||||
|
lambda p: p.has_effect_on_gecko_scrollbars is False
|
||||||
|
)}
|
||||||
|
&HAS_NO_EFFECT_ON_SCROLLBARS
|
||||||
|
}
|
||||||
|
|
||||||
/// Iterate over the current longhand id set.
|
/// Iterate over the current longhand id set.
|
||||||
pub fn iter(&self) -> LonghandIdSetIterator {
|
pub fn iter(&self) -> LonghandIdSetIterator {
|
||||||
LonghandIdSetIterator { longhands: self, cur: 0, }
|
LonghandIdSetIterator { longhands: self, cur: 0, }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue