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