Bug 1404140 - Remove the GetCSNeedsLayoutFlush flag, as it is unneeded now. r=heycam

MANUAL PUSH: Would need to reorder the stack manually (https://bugzilla.mozilla.org/show_bug.cgi?id=1481539)

Differential Revision: https://phabricator.services.mozilla.com/D40300
This commit is contained in:
Emilio Cobos Álvarez 2019-08-01 13:22:53 +02:00
parent b38e7248ab
commit 0f118f30e5
12 changed files with 34 additions and 56 deletions

View File

@ -16,10 +16,6 @@ enum class CSSPropFlags : uint8_t {
// attribute mapping. // attribute mapping.
Inaccessible = 1 << 0, Inaccessible = 1 << 0,
// This property's getComputedStyle implementation requires layout to
// be flushed.
GetCSNeedsLayoutFlush = 1 << 1,
// The following two flags along with the pref defines where the this // The following two flags along with the pref defines where the this
// property can be used: // property can be used:
// * If none of the two flags is presented, the pref completely controls // * If none of the two flags is presented, the pref completely controls
@ -36,24 +32,24 @@ enum class CSSPropFlags : uint8_t {
// transitions) these flags are ignored. That is, if the property is disabled // transitions) these flags are ignored. That is, if the property is disabled
// by a pref, we will *not* run animations or transitions on it even in // by a pref, we will *not* run animations or transitions on it even in
// UA sheets or chrome. // UA sheets or chrome.
EnabledInUASheets = 1 << 2, EnabledInUASheets = 1 << 1,
EnabledInChrome = 1 << 3, EnabledInChrome = 1 << 2,
EnabledInUASheetsAndChrome = EnabledInUASheets | EnabledInChrome, EnabledInUASheetsAndChrome = EnabledInUASheets | EnabledInChrome,
EnabledMask = EnabledInUASheetsAndChrome, EnabledMask = EnabledInUASheetsAndChrome,
// This property can be animated on the compositor. // This property can be animated on the compositor.
CanAnimateOnCompositor = 1 << 4, CanAnimateOnCompositor = 1 << 3,
// This property is an internal property that is not represented in // This property is an internal property that is not represented in
// the DOM. Properties with this flag are defined in an #ifndef // the DOM. Properties with this flag are defined in an #ifndef
// CSS_PROP_LIST_EXCLUDE_INTERNAL section. // CSS_PROP_LIST_EXCLUDE_INTERNAL section.
Internal = 1 << 5, Internal = 1 << 4,
// Whether this property should be serialized by Servo in getComputedStyle. // Whether this property should be serialized by Servo in getComputedStyle.
SerializedByServo = 1 << 6, SerializedByServo = 1 << 5,
// Whether this is a logical property. // Whether this is a logical property.
IsLogical = 1 << 7, IsLogical = 1 << 6,
}; };
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(CSSPropFlags) MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(CSSPropFlags)

View File

@ -69,23 +69,42 @@ LONGHANDS_NOT_SERIALIZED_WITH_SERVO = [
"column-rule-width", "column-rule-width",
# These resolve auto to zero in a few cases, but not all. # These resolve auto to zero in a few cases, but not all.
"max-block-size",
"max-height", "max-height",
"max-inline-size",
"max-width", "max-width",
"min-block-size",
"min-height", "min-height",
"min-inline-size",
"min-width", "min-width",
# resistfingerprinting stuff. # resistfingerprinting stuff.
"-moz-osx-font-smoothing", "-moz-osx-font-smoothing",
# Layout dependent.
"width",
"height",
"line-height",
"grid-template-rows",
"grid-template-columns",
"perspective-origin",
"transform-origin",
"transform",
"top",
"right",
"bottom",
"left",
"border-top-width",
"border-right-width",
"border-bottom-width",
"border-left-width",
"margin-top",
"margin-right",
"margin-bottom",
"margin-left",
"padding-top",
"padding-right",
"padding-bottom",
"padding-left",
] ]
def serialized_by_servo(prop): def serialized_by_servo(prop):
# If the property requires layout information, no such luck.
if "GETCS_NEEDS_LAYOUT_FLUSH" in prop.flags:
return False
if prop.type() == "shorthand": if prop.type() == "shorthand":
# FIXME: Need to serialize a value interpolated with currentcolor # FIXME: Need to serialize a value interpolated with currentcolor
# properly to be able to use text-decoration, and figure out what to do # properly to be able to use text-decoration, and figure out what to do
@ -114,8 +133,6 @@ def flags(prop):
result.append("Internal") result.append("Internal")
if prop.enabled_in == "": if prop.enabled_in == "":
result.append("Inaccessible") result.append("Inaccessible")
if "GETCS_NEEDS_LAYOUT_FLUSH" in prop.flags:
result.append("GetCSNeedsLayoutFlush")
if "CAN_ANIMATE_ON_COMPOSITOR" in prop.flags: if "CAN_ANIMATE_ON_COMPOSITOR" in prop.flags:
result.append("CanAnimateOnCompositor") result.append("CanAnimateOnCompositor")
if exposed_on_getcs(prop): if exposed_on_getcs(prop):

View File

@ -4464,11 +4464,6 @@
# #
# Only enabled on Nightly and early beta, at least for now. # Only enabled on Nightly and early beta, at least for now.
# #
# NOTE(emilio): If / when removing this pref, the GETCS_NEEDS_LAYOUT_FLUSH flag
# should be removed from line-height (and we should let -moz-block-height
# compute to the keyword as well, which shouldn't be observable anyway since
# it's an internal value).
#
# It'd be nice to make numbers compute also to themselves, but it looks like # It'd be nice to make numbers compute also to themselves, but it looks like
# everybody agrees on turning them into pixels, see the discussion starting # everybody agrees on turning them into pixels, see the discussion starting
# from [1]. # from [1].

View File

@ -58,7 +58,6 @@
animation_value_type="NonNegativeLength", animation_value_type="NonNegativeLength",
logical=is_logical, logical=is_logical,
logical_group="border-width", logical_group="border-width",
flags="GETCS_NEEDS_LAYOUT_FLUSH",
allow_quirks="No" if is_logical else "Yes", allow_quirks="No" if is_logical else "Yes",
servo_restyle_damage="reflow rebuild_and_reflow_inline" servo_restyle_damage="reflow rebuild_and_reflow_inline"
)} )}

View File

@ -339,8 +339,7 @@ ${helpers.predefined_type(
servo_2020_pref="layout.2020.unimplemented", servo_2020_pref="layout.2020.unimplemented",
extra_prefixes=transform_extra_prefixes, extra_prefixes=transform_extra_prefixes,
animation_value_type="ComputedValue", animation_value_type="ComputedValue",
flags="CREATES_STACKING_CONTEXT FIXPOS_CB \ flags="CREATES_STACKING_CONTEXT FIXPOS_CB CAN_ANIMATE_ON_COMPOSITOR",
GETCS_NEEDS_LAYOUT_FLUSH CAN_ANIMATE_ON_COMPOSITOR",
spec="https://drafts.csswg.org/css-transforms/#propdef-transform", spec="https://drafts.csswg.org/css-transforms/#propdef-transform",
servo_restyle_damage="reflow_out_of_flow", servo_restyle_damage="reflow_out_of_flow",
)} )}
@ -552,7 +551,6 @@ ${helpers.predefined_type(
boxed=True, boxed=True,
extra_prefixes=transform_extra_prefixes, extra_prefixes=transform_extra_prefixes,
spec="https://drafts.csswg.org/css-transforms-2/#perspective-origin-property", spec="https://drafts.csswg.org/css-transforms-2/#perspective-origin-property",
flags="GETCS_NEEDS_LAYOUT_FLUSH",
animation_value_type="ComputedValue", animation_value_type="ComputedValue",
servo_restyle_damage="reflow_out_of_flow" servo_restyle_damage="reflow_out_of_flow"
)} )}
@ -600,7 +598,6 @@ ${helpers.predefined_type(
extra_prefixes=transform_extra_prefixes, extra_prefixes=transform_extra_prefixes,
gecko_ffi_name="mTransformOrigin", gecko_ffi_name="mTransformOrigin",
boxed=True, boxed=True,
flags="GETCS_NEEDS_LAYOUT_FLUSH",
spec="https://drafts.csswg.org/css-transforms/#transform-origin-property", spec="https://drafts.csswg.org/css-transforms/#transform-origin-property",
servo_restyle_damage="reflow_out_of_flow", servo_restyle_damage="reflow_out_of_flow",
)} )}

View File

@ -23,7 +23,6 @@ ${helpers.predefined_type(
engines="gecko servo-2013 servo-2020", engines="gecko servo-2013 servo-2020",
servo_2020_pref="layout.2020.unimplemented", servo_2020_pref="layout.2020.unimplemented",
animation_value_type="LineHeight", animation_value_type="LineHeight",
flags="GETCS_NEEDS_LAYOUT_FLUSH",
spec="https://drafts.csswg.org/css2/visudet.html#propdef-line-height", spec="https://drafts.csswg.org/css2/visudet.html#propdef-line-height",
servo_restyle_damage="reflow" servo_restyle_damage="reflow"
)} )}

View File

@ -24,7 +24,6 @@
logical=side[1], logical=side[1],
logical_group="margin", logical_group="margin",
spec=spec, spec=spec,
flags="GETCS_NEEDS_LAYOUT_FLUSH",
allowed_in_page_rule=True, allowed_in_page_rule=True,
servo_restyle_damage="reflow" servo_restyle_damage="reflow"
)} )}

View File

@ -23,7 +23,6 @@
logical=side[1], logical=side[1],
logical_group="padding", logical_group="padding",
spec=spec, spec=spec,
flags="GETCS_NEEDS_LAYOUT_FLUSH",
allow_quirks="No" if side[1] else "Yes", allow_quirks="No" if side[1] else "Yes",
servo_restyle_damage="reflow rebuild_and_reflow_inline" servo_restyle_damage="reflow rebuild_and_reflow_inline"
)} )}

View File

@ -17,7 +17,6 @@
engines="gecko servo-2013 servo-2020", engines="gecko servo-2013 servo-2020",
servo_2020_pref="layout.2020.unimplemented", servo_2020_pref="layout.2020.unimplemented",
spec="https://www.w3.org/TR/CSS2/visuren.html#propdef-%s" % side, spec="https://www.w3.org/TR/CSS2/visuren.html#propdef-%s" % side,
flags="GETCS_NEEDS_LAYOUT_FLUSH",
animation_value_type="ComputedValue", animation_value_type="ComputedValue",
allow_quirks="Yes", allow_quirks="Yes",
servo_restyle_damage="reflow_out_of_flow", servo_restyle_damage="reflow_out_of_flow",
@ -33,7 +32,6 @@
engines="gecko servo-2013 servo-2020", engines="gecko servo-2013 servo-2020",
servo_2020_pref="layout.2020.unimplemented", servo_2020_pref="layout.2020.unimplemented",
spec="https://drafts.csswg.org/css-logical-props/#propdef-inset-%s" % side, spec="https://drafts.csswg.org/css-logical-props/#propdef-inset-%s" % side,
flags="GETCS_NEEDS_LAYOUT_FLUSH",
alias="offset-%s:layout.css.offset-logical-properties.enabled" % side, alias="offset-%s:layout.css.offset-logical-properties.enabled" % side,
animation_value_type="ComputedValue", animation_value_type="ComputedValue",
logical=True, logical=True,
@ -285,7 +283,6 @@ ${helpers.predefined_type(
allow_quirks="No" if logical else "Yes", allow_quirks="No" if logical else "Yes",
spec=spec % size, spec=spec % size,
animation_value_type="Size", animation_value_type="Size",
flags="GETCS_NEEDS_LAYOUT_FLUSH",
servo_restyle_damage="reflow", servo_restyle_damage="reflow",
)} )}
// min-width, min-height, min-block-size, min-inline-size // min-width, min-height, min-block-size, min-inline-size
@ -379,7 +376,6 @@ ${helpers.predefined_type(
engines="gecko", engines="gecko",
spec="https://drafts.csswg.org/css-grid/#propdef-grid-template-%ss" % kind, spec="https://drafts.csswg.org/css-grid/#propdef-grid-template-%ss" % kind,
boxed=True, boxed=True,
flags="GETCS_NEEDS_LAYOUT_FLUSH",
animation_value_type="ComputedValue", animation_value_type="ComputedValue",
)} )}

View File

@ -80,7 +80,6 @@ ${helpers.predefined_type(
"Transform", "Transform",
"generics::transform::Transform::none()", "generics::transform::Transform::none()",
engines="gecko", engines="gecko",
flags="GETCS_NEEDS_LAYOUT_FLUSH",
animation_value_type="ComputedValue", animation_value_type="ComputedValue",
spec="None (Nonstandard internal property)", spec="None (Nonstandard internal property)",
enabled_in="chrome", enabled_in="chrome",
@ -94,7 +93,6 @@ ${helpers.predefined_type(
animation_value_type="ComputedValue", animation_value_type="ComputedValue",
gecko_ffi_name="mWindowTransformOrigin", gecko_ffi_name="mWindowTransformOrigin",
boxed=True, boxed=True,
flags="GETCS_NEEDS_LAYOUT_FLUSH",
spec="None (Nonstandard internal property)", spec="None (Nonstandard internal property)",
enabled_in="chrome", enabled_in="chrome",
)} )}

View File

@ -979,13 +979,10 @@ bitflags! {
const APPLIES_TO_CUE = 1 << 6; const APPLIES_TO_CUE = 1 << 6;
/// This longhand property applies to ::marker. /// This longhand property applies to ::marker.
const APPLIES_TO_MARKER = 1 << 7; const APPLIES_TO_MARKER = 1 << 7;
/// This property's getComputedStyle implementation requires layout
/// to be flushed.
const GETCS_NEEDS_LAYOUT_FLUSH = 1 << 8;
/// This property is a legacy shorthand. /// This property is a legacy shorthand.
/// ///
/// https://drafts.csswg.org/css-cascade/#legacy-shorthand /// https://drafts.csswg.org/css-cascade/#legacy-shorthand
const IS_LEGACY_SHORTHAND = 1 << 9; const IS_LEGACY_SHORTHAND = 1 << 8;
/* The following flags are currently not used in Rust code, they /* The following flags are currently not used in Rust code, they
* only need to be listed in corresponding properties so that * only need to be listed in corresponding properties so that

View File

@ -6040,15 +6040,7 @@ pub unsafe extern "C" fn Servo_GetPropertyValue(
prop: nsCSSPropertyID, prop: nsCSSPropertyID,
value: *mut nsAString, value: *mut nsAString,
) { ) {
use style::properties::PropertyFlags;
if let Ok(longhand) = LonghandId::from_nscsspropertyid(prop) { if let Ok(longhand) = LonghandId::from_nscsspropertyid(prop) {
debug_assert!(
!longhand
.flags()
.contains(PropertyFlags::GETCS_NEEDS_LAYOUT_FLUSH),
"We're not supposed to serialize layout-dependent properties"
);
style style
.get_longhand_property_value(longhand, &mut CssWriter::new(&mut *value)) .get_longhand_property_value(longhand, &mut CssWriter::new(&mut *value))
.unwrap(); .unwrap();
@ -6068,12 +6060,6 @@ pub unsafe extern "C" fn Servo_GetPropertyValue(
"This won't quite do the right thing if we want to serialize \ "This won't quite do the right thing if we want to serialize \
logical shorthands" logical shorthands"
); );
debug_assert!(
!longhand
.flags()
.contains(PropertyFlags::GETCS_NEEDS_LAYOUT_FLUSH),
"Layout-dependent properties shouldn't get here"
);
let animated = AnimationValue::from_computed_values(longhand, style).expect( let animated = AnimationValue::from_computed_values(longhand, style).expect(
"Somebody tried to serialize a shorthand with \ "Somebody tried to serialize a shorthand with \
non-animatable properties, would need more code \ non-animatable properties, would need more code \