style: Don't apply property restrictions to pseudo-elements in UA stylesheets.

And remove some of the ::placeholder and ::cue hacks where we need to use
!important to make the property not apply for content but apply on UA sheets.

The comment about the white-space property was wrong, we don't enforce it with
!important in the UA stylesheets for <input> (we do for <textarea> though), so
I've kept the flag since it really applies.

Differential Revision: https://phabricator.services.mozilla.com/D37717
This commit is contained in:
Emilio Cobos Álvarez 2019-07-11 23:06:41 +00:00
parent e3b57efc7e
commit 10cb9c07aa
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A
6 changed files with 2 additions and 21 deletions

View file

@ -153,7 +153,7 @@ where
// longhands are only allowed if they have our
// restriction flag set.
if let PropertyDeclarationId::Longhand(id) = declaration.id() {
if !id.flags().contains(restriction) {
if !id.flags().contains(restriction) && cascade_level.origin() != Origin::UserAgent {
return None;
}
}

View file

@ -9,15 +9,12 @@
inherited=False,
gecko_name="Display") %>
// We allow "display" to apply to placeholders because we need to make the
// placeholder pseudo-element an inline-block in the UA stylesheet in Gecko.
${helpers.predefined_type(
"display",
"Display",
"computed::Display::inline()",
initial_specified_value="specified::Display::inline()",
animation_value_type="discrete",
flags="APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-display/#propdef-display",
servo_restyle_damage="rebuild_and_reflow",
needs_context=product == "gecko"
@ -103,7 +100,6 @@ ${helpers.single_keyword("-servo-overflow-clip-box", "padding-box content-box",
products="gecko",
enabled_in="ua",
needs_context=False,
flags="APPLIES_TO_PLACEHOLDER",
gecko_pref="layout.css.overflow-clip-box.enabled",
animation_value_type="discrete",
spec="Internal, may be standardized in the future: \
@ -111,9 +107,6 @@ ${helpers.single_keyword("-servo-overflow-clip-box", "padding-box content-box",
)}
% endfor
// FIXME(pcwalton, #2742): Implement scrolling for `scroll` and `auto`.
//
// We allow it to apply to placeholders for UA sheets, which set it !important.
% for (axis, logical) in ALL_AXES:
<% full_name = "overflow-{}".format(axis) %>
${helpers.predefined_type(
@ -123,7 +116,6 @@ ${helpers.single_keyword("-servo-overflow-clip-box", "padding-box content-box",
logical_group="overflow",
logical=logical,
animation_value_type="discrete",
flags="APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-overflow-3/#propdef-{}".format(full_name),
needs_context=False,
servo_restyle_damage = "reflow",
@ -477,10 +469,6 @@ ${helpers.predefined_type(
// CSS Basic User Interface Module Level 3
// http://dev.w3.org/csswg/css-ui
//
// This is APPLIES_TO_PLACEHOLDER so we can override, in the UA sheet, the
// 'resize' property we'd inherit from textarea otherwise. Basically, just
// makes the UA rules easier to write.
${helpers.predefined_type(
"resize",
"Resize",
@ -489,7 +477,6 @@ ${helpers.predefined_type(
animation_value_type="discrete",
needs_context=False,
gecko_ffi_name="mResize",
flags="APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-ui/#propdef-resize",
)}

View file

@ -29,7 +29,6 @@ ${helpers.single_keyword(
servo_pref="layout.writing-mode.enabled",
animation_value_type="none",
spec="https://drafts.csswg.org/css-writing-modes/#propdef-writing-mode",
flags="APPLIES_TO_CUE",
servo_restyle_damage="rebuild_and_reflow",
)}

View file

@ -78,7 +78,6 @@ ${helpers.predefined_type(
"computed::OverflowWrap::Normal",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-text/#propdef-overflow-wrap",
flags="APPLIES_TO_CUE",
alias="word-wrap",
needs_context=False,
servo_restyle_damage="rebuild_and_reflow",
@ -182,7 +181,6 @@ ${helpers.predefined_type(
gecko_enum_prefix="StyleWhiteSpace"
needs_conversion="True"
animation_value_type="discrete"
// Only allowed for UA sheets, which set it !important.
flags="APPLIES_TO_CUE APPLIES_TO_PLACEHOLDER"
spec="https://drafts.csswg.org/css-text/#propdef-white-space"
servo_restyle_damage="rebuild_and_reflow"

View file

@ -23,7 +23,6 @@ ${helpers.single_keyword(
"auto none",
animation_value_type="discrete",
extra_gecko_values="visiblepainted visiblefill visiblestroke visible painted fill stroke all",
flags="APPLIES_TO_PLACEHOLDER",
spec="https://www.w3.org/TR/SVG11/interact.html#PointerEventsProperty",
)}

View file

@ -6,8 +6,6 @@
<% from data import ALL_SIDES, maybe_moz_logical_alias %>
<% data.new_style_struct("Padding", inherited=False) %>
// APPLIES_TO_PLACEHOLDER so we can set it in UA stylesheets. But we use a
// !important value there, so pages can't set it.
% for side in ALL_SIDES:
<%
spec = "https://drafts.csswg.org/css-box/#propdef-padding-%s" % side[0]
@ -23,7 +21,7 @@
logical=side[1],
logical_group="padding",
spec=spec,
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_PLACEHOLDER GETCS_NEEDS_LAYOUT_FLUSH",
flags="APPLIES_TO_FIRST_LETTER GETCS_NEEDS_LAYOUT_FLUSH",
allow_quirks="No" if side[1] else "Yes",
servo_restyle_damage="reflow rebuild_and_reflow_inline"
)}