forked from mirrors/gecko-dev
Bug 1738663 - Add a pref to expose all shorthands in the computed style. r=layout-reviewers,mats
Make it always false for now, as we still need a solution for layout-dependent shorthands like margin, padding, border, etc. Differential Revision: https://phabricator.services.mozilla.com/D130039
This commit is contained in:
parent
df34135583
commit
c9b9e30776
4 changed files with 28 additions and 6 deletions
|
|
@ -50,6 +50,10 @@ enum class CSSPropFlags : uint8_t {
|
||||||
|
|
||||||
// Whether this is a logical property.
|
// Whether this is a logical property.
|
||||||
IsLogical = 1 << 6,
|
IsLogical = 1 << 6,
|
||||||
|
|
||||||
|
// Whether this shorthand property is unconditionally exposed in
|
||||||
|
// getComputedStyle.
|
||||||
|
ShorthandUnconditionallyExposedOnGetCS = 1 << 7,
|
||||||
};
|
};
|
||||||
|
|
||||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(CSSPropFlags)
|
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(CSSPropFlags)
|
||||||
|
|
|
||||||
|
|
@ -110,11 +110,9 @@ def serialized_by_servo(prop):
|
||||||
def exposed_on_getcs(prop):
|
def exposed_on_getcs(prop):
|
||||||
if "Style" not in prop.rule_types_allowed_names():
|
if "Style" not in prop.rule_types_allowed_names():
|
||||||
return False
|
return False
|
||||||
if prop.type() == "longhand":
|
if is_internal(prop):
|
||||||
return not is_internal(prop)
|
return False
|
||||||
# TODO: bug 137688 / https://github.com/w3c/csswg-drafts/issues/2529
|
return True
|
||||||
if prop.type() == "shorthand":
|
|
||||||
return "SHORTHAND_IN_GETCS" in prop.flags
|
|
||||||
|
|
||||||
def rules(prop):
|
def rules(prop):
|
||||||
return ", ".join('"{}"'.format(rule) for rule in prop.rule_types_allowed_names())
|
return ", ".join('"{}"'.format(rule) for rule in prop.rule_types_allowed_names())
|
||||||
|
|
@ -133,6 +131,8 @@ def flags(prop):
|
||||||
result.append("CanAnimateOnCompositor")
|
result.append("CanAnimateOnCompositor")
|
||||||
if exposed_on_getcs(prop):
|
if exposed_on_getcs(prop):
|
||||||
result.append("ExposedOnGetCS")
|
result.append("ExposedOnGetCS")
|
||||||
|
if prop.type() == "shorthand" and "SHORTHAND_IN_GETCS" in prop.flags:
|
||||||
|
result.append("ShorthandUnconditionallyExposedOnGetCS")
|
||||||
if serialized_by_servo(prop):
|
if serialized_by_servo(prop):
|
||||||
result.append("SerializedByServo")
|
result.append("SerializedByServo")
|
||||||
if prop.type() == "longhand" and prop.logical:
|
if prop.type() == "longhand" and prop.logical:
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,15 @@ struct ComputedStyleMap {
|
||||||
ComputeMethod mGetter;
|
ComputeMethod mGetter;
|
||||||
|
|
||||||
bool IsEnabled() const {
|
bool IsEnabled() const {
|
||||||
return nsCSSProps::IsEnabled(mProperty, CSSEnabledState::ForAllContent);
|
if (!nsCSSProps::IsEnabled(mProperty, CSSEnabledState::ForAllContent)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (nsCSSProps::IsShorthand(mProperty) &&
|
||||||
|
!StaticPrefs::layout_css_computed_style_shorthands()) {
|
||||||
|
return nsCSSProps::PropHasFlags(
|
||||||
|
mProperty, CSSPropFlags::ShorthandUnconditionallyExposedOnGetCS);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -2506,6 +2514,10 @@ void nsComputedDOMStyle::RegisterPrefChangeCallbacks() {
|
||||||
prefs.InsertElementSorted(p->mPref);
|
prefs.InsertElementSorted(p->mPref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prefs.AppendElement(
|
||||||
|
StaticPrefs::GetPrefName_layout_css_computed_style_shorthands());
|
||||||
|
|
||||||
prefs.AppendElement(nullptr);
|
prefs.AppendElement(nullptr);
|
||||||
|
|
||||||
MOZ_ASSERT(!gCallbackPrefs);
|
MOZ_ASSERT(!gCallbackPrefs);
|
||||||
|
|
|
||||||
|
|
@ -6903,6 +6903,12 @@
|
||||||
value: true
|
value: true
|
||||||
mirror: always
|
mirror: always
|
||||||
|
|
||||||
|
# Whether we should expose all shorthands in getComputedStyle().
|
||||||
|
- name: layout.css.computed-style.shorthands
|
||||||
|
type: bool
|
||||||
|
value: false
|
||||||
|
mirror: always
|
||||||
|
|
||||||
# Are implicit tracks in computed grid templates serialized?
|
# Are implicit tracks in computed grid templates serialized?
|
||||||
- name: layout.css.serialize-grid-implicit-tracks
|
- name: layout.css.serialize-grid-implicit-tracks
|
||||||
type: RelaxedAtomicBool
|
type: RelaxedAtomicBool
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue