Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: Sync changes from mozilla-central. #22111

Merged
merged 32 commits into from Nov 5, 2018
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
26040d1
style: Remove unused style constant.
emilio Oct 24, 2018
a9af61e
style: Don't allow auto in grid line names.
emilio Oct 28, 2018
a3fcfb6
style: Add a fast path for querySelector{,All} when we have classes o…
emilio Oct 29, 2018
62aaf86
style: Ignore border-image-source when overriding document colors.
Oct 29, 2018
badb8f3
style: Support ::before / ::after on ::slotted pseudos.
emilio Oct 29, 2018
edf6e6a
style: Update cbindgen due to breaking change.
emilio Oct 30, 2018
8bc8a0b
style: Interpolate the angle between mis-matched rotate() functions w…
birtles Oct 30, 2018
b00bbb3
style: Add a special list for cbindgen types to avoid generating redu…
BorisChiou Oct 31, 2018
591a478
style: Use alias for StyleAppearance.
BorisChiou Oct 31, 2018
cb2533d
style: Use alias for StyleDisplay and StyleDisplayMode.
BorisChiou Oct 31, 2018
c7027e2
style: Use alias for StyleFillRule.
BorisChiou Oct 31, 2018
b81bbb8
style: Use alias for StylePathCommand.
BorisChiou Oct 31, 2018
33b2514
style: Drop "mozilla" prefix in cbindgen_types in ServoBindings.toml.
BorisChiou Oct 31, 2018
5976956
style: Handle reversed ranges in @font-face descriptors.
heycam Oct 31, 2018
d43c4ce
style: Support unprefixed image-rendering: crisp-edges.
heycam Nov 1, 2018
52c3ba0
style: Fix inconsistent CRISPEDGES constant name.
heycam Nov 1, 2018
a7b5ba1
style: Use references in the shapes code.
emilio Nov 2, 2018
33fed65
style: Don't match document author rules if not needed for revalidation.
emilio Nov 5, 2018
d035d02
style: Don't keep a separate list of ignored-when-colors-disabled lon…
emilio Nov 5, 2018
282edf1
style: Move shorthand IDL order stuff out of animated_properties.
emilio Nov 4, 2018
f159c20
style: Move the keyframes property priority stuff outside of animated…
emilio Nov 4, 2018
778ae7d
style: Move various length animation implementations to its own file.
emilio Nov 4, 2018
707bd84
style: Move various font-related animation code to its own file.
emilio Nov 4, 2018
8b49ef8
style: Remove nscsspropertyid_is_{animatable,transitionable}.
emilio Nov 4, 2018
c88a483
style: Move animation of svg-related bits outside of animated_propert…
emilio Nov 4, 2018
5af6abf
style: Simplify the SVG animation code.
emilio Nov 4, 2018
b7da1ba
style: Implement the env() function with hardcoded zeros for safe-are…
emilio Nov 5, 2018
99f9d84
style: Simplify invalid custom property handling.
emilio Nov 5, 2018
29f5691
Update remaining references to cssparser 0.24.
emilio Nov 5, 2018
8560c8d
Fix tidy issues.
emilio Nov 5, 2018
64e70e2
style: Add the safe area constant names as atoms.
emilio Nov 5, 2018
ac6f921
style: Fix servo build.
emilio Nov 5, 2018
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

style: Don't keep a separate list of ignored-when-colors-disabled lon…

…ghands.

Most of the change is moving sets around to be static functions on
LonghandIdSet. I think I like that pattern, but I can also make the new set a
global static and add mako code to be `pub` or something.

Though I think the LonghandIdSet::foo().contains(..) pattern is nice to read :)

Differential Revision: https://phabricator.services.mozilla.com/D10653
  • Loading branch information
emilio committed Nov 5, 2018
commit d035d02517f37573e52260bf7870b1932ddecc5c
@@ -758,6 +758,41 @@ impl<'a> Iterator for LonghandIdSetIterator<'a> {
}

impl LonghandIdSet {
#[inline]
fn reset() -> &'static Self {
${static_longhand_id_set("RESET", lambda p: not p.style_struct.inherited)}
&RESET
}

#[inline]
fn animatable() -> &'static Self {
${static_longhand_id_set("ANIMATABLE", lambda p: p.animatable)}
&ANIMATABLE
}

#[inline]
fn discrete_animatable() -> &'static Self {
${static_longhand_id_set("DISCRETE_ANIMATABLE", lambda p: p.animation_value_type == "discrete")}
&DISCRETE_ANIMATABLE
}

#[inline]
fn logical() -> &'static Self {
${static_longhand_id_set("LOGICAL", lambda p: p.logical)}
&LOGICAL
}

/// Returns the set of longhands that are ignored when document colors are
/// disabled.
#[inline]
pub fn ignored_when_colors_disabled() -> &'static Self {
${static_longhand_id_set(
"IGNORED_WHEN_COLORS_DISABLED",
lambda p: p.ignored_when_colors_disabled
)}
&IGNORED_WHEN_COLORS_DISABLED
}

/// Iterate over the current longhand id set.
pub fn iter(&self) -> LonghandIdSetIterator {
LonghandIdSetIterator { longhands: self, cur: 0, }
@@ -784,6 +819,14 @@ impl LonghandIdSet {
false
}

/// Remove all the given properties from the set.
#[inline]
pub fn remove_all(&mut self, other: &Self) {
for (self_cell, other_cell) in self.storage.iter_mut().zip(other.storage.iter()) {
*self_cell &= !*other_cell;
}
}

/// Create an empty set
#[inline]
pub fn new() -> LonghandIdSet {
@@ -800,8 +843,7 @@ impl LonghandIdSet {
/// Return whether this set contains any reset longhand.
#[inline]
pub fn contains_any_reset(&self) -> bool {
${static_longhand_id_set("RESET", lambda p: not p.style_struct.inherited)}
self.contains_any(&RESET)
self.contains_any(Self::reset())
}

/// Add the given property to the set
@@ -961,9 +1003,8 @@ impl LonghandId {

/// Returns whether the longhand property is inherited by default.
#[inline]
pub fn inherited(&self) -> bool {
${static_longhand_id_set("INHERITED", lambda p: p.style_struct.inherited)}
INHERITED.contains(*self)
pub fn inherited(self) -> bool {
!LonghandIdSet::reset().contains(self)
}

fn shorthands(&self) -> NonCustomPropertyIterator<ShorthandId> {
@@ -1034,15 +1075,13 @@ impl LonghandId {
/// Returns whether this property is animatable.
#[inline]
pub fn is_animatable(self) -> bool {
${static_longhand_id_set("ANIMATABLE", lambda p: p.animatable)}
ANIMATABLE.contains(self)
LonghandIdSet::animatable().contains(self)
}

/// Returns whether this property is animatable in a discrete way.
#[inline]
pub fn is_discrete_animatable(self) -> bool {
${static_longhand_id_set("DISCRETE_ANIMATABLE", lambda p: p.animation_value_type == "discrete")}
DISCRETE_ANIMATABLE.contains(self)
LonghandIdSet::discrete_animatable().contains(self)
}

/// Converts from a LonghandId to an adequate nsCSSPropertyID.
@@ -1065,9 +1104,8 @@ impl LonghandId {

/// Return whether this property is logical.
#[inline]
pub fn is_logical(&self) -> bool {
${static_longhand_id_set("LOGICAL", lambda p: p.logical)}
LOGICAL.contains(*self)
pub fn is_logical(self) -> bool {
LonghandIdSet::logical().contains(self)
}

/// If this is a logical property, return the corresponding physical one in
@@ -1157,12 +1195,7 @@ impl LonghandId {
/// colors are disabled.
#[inline]
fn ignored_when_document_colors_disabled(self) -> bool {
${static_longhand_id_set(
"IGNORED_WHEN_COLORS_DISABLED",
lambda p: p.ignored_when_colors_disabled
)}

IGNORED_WHEN_COLORS_DISABLED.contains(self)
LonghandIdSet::ignored_when_colors_disabled().contains(self)
}

/// The computed value of some properties depends on the (sometimes
@@ -1288,25 +1288,12 @@ impl StrongRuleNode {
}
}

// If author colors are not allowed, only claim to have author-specified
// rules if we're looking at a non-color property, a border image, 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::BorderImageSource,
LonghandId::BorderTopColor,
LonghandId::BorderRightColor,
LonghandId::BorderBottomColor,
LonghandId::BorderLeftColor,
LonghandId::BorderInlineStartColor,
LonghandId::BorderInlineEndColor,
LonghandId::BorderBlockStartColor,
LonghandId::BorderBlockEndColor,
];

// If author colors are not allowed, don't look at those properties
// (except for background-color which is special and we handle below).
if !author_colors_allowed {
for id in IGNORED_WHEN_COLORS_DISABLED {
properties.remove(*id);
properties.remove_all(LonghandIdSet::ignored_when_colors_disabled());
if rule_type_mask & NS_AUTHOR_SPECIFIED_BACKGROUND != 0 {
properties.insert(LonghandId::BackgroundColor);
}
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.