style: Simplify the implementation of HasAuthorSpecifiedRules.

This patch computes the author-specified properties during the CSS cascade, and
removes the complex rule-tree-based implementation that tries to do the cascade
again.

This changes behavior in two ways, one of them which is not observable to
content, I believe:

 * revert now re-enables the native styling. This was brought up in
   https://github.com/w3c/csswg-drafts/issues/4777 and I think it is a bug-fix.

   This is observable to content, and I'm adding a test for it.

 * We don't look at inherited styles from our ancestors when `inherit` is
   specified in a non-author stylesheet. This was introduced for bug 452969 but
   we don't seem to inherit background anymore for file controls or such. It
   seems back then file controls used to have a text-field.

   I audited forms.css and ua.css and we don't explicitly inherit
   padding / border / background-color into any nested form control.

We keep the distinction between border/background and padding, because the later
has some callers. I think we should try to align with Chromium in the long run
and remove the padding bit.

We need to give an appearance to the range-thumb and such so that we can assert
that we don't call HasAuthorSpecifiedRules on non-themed stuff. I used a new
internal value for that.

Differential Revision: https://phabricator.services.mozilla.com/D67722
This commit is contained in:
Emilio Cobos Álvarez 2020-03-26 16:48:01 +00:00
parent 7d438cd816
commit 414edb5a4a
5 changed files with 122 additions and 243 deletions

View file

@ -1630,7 +1630,7 @@ pub enum Appearance {
RadioLabel,
/// nsRangeFrame and its subparts
Range,
RangeThumb,
RangeThumb, // FIXME: This should not be exposed to content.
/// The resizer background area in a status bar for the resizer widget in
/// the corner of a window.
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
@ -1856,6 +1856,14 @@ pub enum Appearance {
Count,
}
impl Appearance {
/// Returns whether we're the `none` value.
#[inline]
pub fn is_none(self) -> bool {
self == Appearance::None
}
}
/// A kind of break between two boxes.
///
/// https://drafts.csswg.org/css-break/#break-between