style: Rewrap some comments to be consistent with the rest of the file.

This commit is contained in:
Emilio Cobos Álvarez 2017-05-21 03:02:05 +02:00
parent 50c022f91a
commit 99e5bb7a48
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -879,9 +879,11 @@ impl StrongRuleNode {
}
}
/// Implementation of `nsRuleNode::HasAuthorSpecifiedRules` for Servo rule nodes.
/// Implementation of `nsRuleNode::HasAuthorSpecifiedRules` for Servo rule
/// nodes.
///
/// Returns true if any properties specified by `rule_type_mask` was set by an author rule.
/// Returns true if any properties specified by `rule_type_mask` was set by
/// an author rule.
#[cfg(feature = "gecko")]
pub fn has_author_specified_rules<E>(&self,
mut element: E,
@ -964,9 +966,9 @@ impl StrongRuleNode {
}
}
// If author colors are not allowed, only claim to have author-specified rules if we're
// looking at a non-color property or if we're looking at the background color and it's
// set to transparent.
// If author colors are not allowed, only claim to have author-specified
// rules if we're looking at a non-color property or if we're looking at
// the background color and it's set to transparent.
const IGNORED_WHEN_COLORS_DISABLED: &'static [LonghandId] = &[
LonghandId::BackgroundImage,
LonghandId::BorderTopColor,
@ -985,15 +987,21 @@ impl StrongRuleNode {
let mut element_rule_node = Cow::Borrowed(self);
loop {
// We need to be careful not to count styles covered up by user-important or
// UA-important declarations. But we do want to catch explicit inherit styling in
// those and check our parent element to see whether we have user styling for
// those properties. Note that we don't care here about inheritance due to lack of
// a specified value, since all the properties we care about are reset properties.
// We need to be careful not to count styles covered up by
// user-important or UA-important declarations. But we do want to
// catch explicit inherit styling in those and check our parent
// element to see whether we have user styling for those properties.
// Note that we don't care here about inheritance due to lack of a
// specified value, since all the properties we care about are reset
// properties.
//
// FIXME: The above comment is copied from Gecko, but the last sentence is no longer
// correct since 'text-shadow' support was added. This is a bug in Gecko, replicated
// in Stylo for now: https://bugzilla.mozilla.org/show_bug.cgi?id=1363088
// FIXME: The above comment is copied from Gecko, but the last
// sentence is no longer correct since 'text-shadow' support was
// added.
//
// This is a bug in Gecko, replicated in Stylo for now:
//
// https://bugzilla.mozilla.org/show_bug.cgi?id=1363088
let mut inherited_properties = LonghandIdSet::new();
let mut have_explicit_ua_inherit = false;
@ -1025,12 +1033,14 @@ impl StrongRuleNode {
CascadeLevel::UserImportant => {
for (id, declaration) in longhands {
if properties.contains(id) {
// This property was set by a non-author rule. Stop looking for it in
// this element's rule nodes.
// This property was set by a non-author rule.
// Stop looking for it in this element's rule
// nodes.
properties.remove(id);
// However, if it is inherited, then it might be inherited from an
// author rule from an ancestor element's rule nodes.
// However, if it is inherited, then it might be
// inherited from an author rule from an
// ancestor element's rule nodes.
if declaration.get_css_wide_keyword() == Some(CSSWideKeyword::Inherit) ||
(declaration.get_css_wide_keyword() == Some(CSSWideKeyword::Unset) &&
inherited(id))
@ -1089,30 +1099,38 @@ impl StrongRuleNode {
.any(|node| node.cascade_level().is_animation())
}
/// Get a set of properties whose CascadeLevel are higher than Animations but not equal to
/// Transitions. If there are any custom properties, we set the boolean value of the returned
/// tuple to true.
pub fn get_properties_overriding_animations(&self, guards: &StylesheetGuards)
/// Get a set of properties whose CascadeLevel are higher than Animations
/// but not equal to Transitions.
///
/// If there are any custom properties, we set the boolean value of the
/// returned tuple to true.
pub fn get_properties_overriding_animations(&self,
guards: &StylesheetGuards)
-> (LonghandIdSet, bool) {
use properties::PropertyDeclarationId;
// We want to iterate over cascade levels that override the animations level, i.e.
// !important levels and the transitions level. However, we actually want to skip the
// transitions level because although it is higher in the cascade than animations, when
// both transitions and animations are present for a given element and property, transitions
// are suppressed so that they don't actually override animations.
let iter = self.self_and_ancestors()
.skip_while(|node| node.cascade_level() == CascadeLevel::Transitions)
.take_while(|node| node.cascade_level() > CascadeLevel::Animations);
// We want to iterate over cascade levels that override the animations
// level, i.e. !important levels and the transitions level.
//
// However, we actually want to skip the transitions level because
// although it is higher in the cascade than animations, when both
// transitions and animations are present for a given element and
// property, transitions are suppressed so that they don't actually
// override animations.
let iter =
self.self_and_ancestors()
.skip_while(|node| node.cascade_level() == CascadeLevel::Transitions)
.take_while(|node| node.cascade_level() > CascadeLevel::Animations);
let mut result = (LonghandIdSet::new(), false);
for node in iter {
let style = node.style_source().unwrap();
for &(ref decl, important) in style.read(node.cascade_level().guard(guards))
.declarations()
.iter() {
// Although we are only iterating over cascade levels that override animations,
// in a given property declaration block we can have a mixture of !important and
// non-!important declarations but only the !important declarations actually
// Although we are only iterating over cascade levels that
// override animations, in a given property declaration block we
// can have a mixture of !important and non-!important
// declarations but only the !important declarations actually
// override animations.
if important.important() {
match decl.id() {