style: Add code to make part rules affect the style of the elements.

I still haven't implemented each_part(), so this will do nothing yet.

The cascade order stuff is fishy, I know, and I'll fix in a followup if it's
fine with you. I moved the sorting of the rules to rule_collector, since it
seemed to me it was better that way that duplicating the code, and those
SelectorMap functions only have a single caller anyway.

Differential Revision: https://phabricator.services.mozilla.com/D32647
This commit is contained in:
Emilio Cobos Álvarez 2019-06-11 17:42:41 +00:00
parent 39de0a068e
commit 7139a4185a
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A
6 changed files with 100 additions and 27 deletions

View file

@ -520,6 +520,9 @@ pub trait TElement:
/// Whether this element has an attribute with a given namespace.
fn has_attr(&self, namespace: &Namespace, attr: &LocalName) -> bool;
/// Returns whether this element has a `part` attribute.
fn has_part_attr(&self) -> bool;
/// The ID for this element.
fn id(&self) -> Option<&WeakAtom>;
@ -528,6 +531,13 @@ pub trait TElement:
where
F: FnMut(&Atom);
/// Internal iterator for the part names of this element.
fn each_part<F>(&self, _callback: F)
where
F: FnMut(&Atom)
{
}
/// Whether a given element may generate a pseudo-element.
///
/// This is useful to avoid computing, for example, pseudo styles for