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. #21036

Merged
merged 40 commits into from Jun 12, 2018
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
ea5417b
style: Make contain:paint trigger clipping independent of the overflo…
muhammedyusuf-sermet May 30, 2018
35a1a30
style: Remove invalid assertion.
emilio Jun 4, 2018
6940787
style: Make the transition-property code make more sense.
emilio Jun 1, 2018
f6f421f
style: Hide multiple -moz-window-* properties from content.
emilio Jun 1, 2018
90ef560
style: Move TransitionProperty where it belongs.
emilio Jun 1, 2018
ce5a85d
style: Use custom_properties::Name in TransitionProperty.
emilio Jun 4, 2018
1da798e
style: Introduce css(parse_condition).
emilio Jun 2, 2018
cf7b10a
style: Hide -moz- display values from content behind a pref.
emilio Jun 2, 2018
618eef7
style: Don't hide -moz-box / -moz-inline-box yet.
emilio Jun 2, 2018
0f1b793
style: Minor indentation cleanup.
emilio Jun 4, 2018
4b10b2a
style: Update smallbitvec to v2.1.1.
emilio Jun 4, 2018
2baa794
style: Sprinkle some inline in methods that are just pointer-chasing …
emilio Jun 4, 2018
710184b
style: Sprinkle some #[inline] on methods that have inline fast-paths.
emilio Jun 4, 2018
f829300
style: Don't look at the rule type from value parsing.
emilio Jun 1, 2018
8d069d1
style: Work around a bindgen bug on Android.
emilio Jun 4, 2018
8821ad7
style: Make pseudo-elements work with :host.
emilio Jun 4, 2018
2c0a19e
style: Move some parsing-only attributes to use #[parse(..)] instead …
emilio Jun 4, 2018
d461a7d
style: Make the threadsafe refcounting macros more reusable.
emilio Jun 4, 2018
63ca2a8
style: Make clearing atoms slightly more ergonomic.
emilio Jun 4, 2018
c6e43c0
style: Avoid useless allocations in custom property name serialization.
emilio Jun 5, 2018
7529788
style: Make getting a property name explicitly an indexing operation.
emilio Jun 4, 2018
915c872
style: Remove PropertyId::name.
emilio Jun 4, 2018
3816143
style: Use Atomic<bool> for the staticpref version of layout.css.font…
bzbarsky Jun 6, 2018
255fe05
style: Extend StyleComplexColor to support additive blending.
djg May 23, 2018
9c51d31
style: Inline some trivial bits.
emilio Jun 4, 2018
e052666
style: Fix a typo.
emilio Jun 5, 2018
6ca324f
style: Remove unused PropertyDeclarationBlock::set_importance.
emilio Jun 5, 2018
3c7fb2a
style: Add a before-change callback to remove_property.
emilio Jun 5, 2018
cdbc409
style: Trivially simplify a condition.
emilio Jun 5, 2018
314b14d
style: Fix nsStyleBorder::mBorderColor for GCC.
djg Jun 5, 2018
5f74a15
style: Extract {animated,computed}::Color common parts.
djg Jun 5, 2018
011cad2
style: Add a Servo API to get the serialized style of a property.
emilio Jun 7, 2018
d65b29d
style: Add CssPropFlags::SerializedByServo and use it on some simple …
emilio Jun 7, 2018
572a931
style: Add diagnostics.
emilio Jun 9, 2018
078df23
style: Update cssparser.
emilio Jun 11, 2018
e94395b
style_derive: Fix tidy lint.
emilio Jun 11, 2018
ab76003
style: Fix servo build.
emilio Jun 11, 2018
4cd16ee
style: Derive Animate for ComplexColorRatios.
emilio Jun 11, 2018
0d0b0e0
Update WPT expectations.
emilio Jun 12, 2018
2106cc4
style: Update cssparser again to avoid intermittent stack overflows o…
emilio Jun 12, 2018
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Large diffs are not rendered by default.

@@ -253,7 +253,7 @@ impl CSSStyleDeclaration {
self.owner.mutate_associated_block(|pdb, changed| {
if value.is_empty() {
// Step 3
*changed = pdb.remove_property(&id);
*changed = pdb.remove_property(&id, |_| {});
return Ok(());
}

@@ -365,7 +365,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
let mut string = String::new();
self.owner.mutate_associated_block(|pdb, changed| {
pdb.property_value_to_css(&id, &mut string).unwrap();
*changed = pdb.remove_property(&id);
*changed = pdb.remove_property(&id, |_| {});
});

// Step 6
@@ -36,6 +36,7 @@ use std::slice;
/// (from left to right). Once the process is complete, callers should invoke
/// build(), which transforms the contents of the SelectorBuilder into a heap-
/// allocated Selector and leaves the builder in a drained state.
#[derive(Debug)]
pub struct SelectorBuilder<Impl: SelectorImpl> {
/// The entire sequence of simple selectors, from left to right, without combinators.
///
@@ -104,7 +105,7 @@ impl<Impl: SelectorImpl> SelectorBuilder<Impl> {
parsed_slotted: bool,
) -> ThinArc<SpecificityAndFlags, Component<Impl>> {
// Compute the specificity and flags.
let mut spec = SpecificityAndFlags(specificity(self.simple_selectors.iter()));
let mut spec = SpecificityAndFlags(specificity(&*self, self.simple_selectors.iter()));
if parsed_pseudo {
spec.0 |= HAS_PSEUDO_BIT;
}
@@ -268,25 +269,35 @@ impl From<Specificity> for u32 {
}
}

fn specificity<Impl>(iter: slice::Iter<Component<Impl>>) -> u32
fn specificity<Impl>(builder: &SelectorBuilder<Impl>, iter: slice::Iter<Component<Impl>>) -> u32
where
Impl: SelectorImpl,
{
complex_selector_specificity(iter).into()
complex_selector_specificity(builder, iter).into()
}

fn complex_selector_specificity<Impl>(mut iter: slice::Iter<Component<Impl>>) -> Specificity
fn complex_selector_specificity<Impl>(
builder: &SelectorBuilder<Impl>,
mut iter: slice::Iter<Component<Impl>>,
) -> Specificity
where
Impl: SelectorImpl,
{
fn simple_selector_specificity<Impl>(
builder: &SelectorBuilder<Impl>,
simple_selector: &Component<Impl>,
specificity: &mut Specificity,
) where
Impl: SelectorImpl,
{
match *simple_selector {
Component::Combinator(..) => unreachable!(),
Component::Combinator(ref combinator) => {
unreachable!(
"Found combinator {:?} in simple selectors vector? {:?}",
combinator,
builder,
);
}
// FIXME(emilio): Spec doesn't define any particular specificity for
// ::slotted(), so apply the general rule for pseudos per:
//
@@ -326,15 +337,15 @@ where
},
Component::Negation(ref negated) => {
for ss in negated.iter() {
simple_selector_specificity(&ss, specificity);
simple_selector_specificity(builder, &ss, specificity);
}
},
}
}

let mut specificity = Default::default();
for simple_selector in &mut iter {
simple_selector_specificity(&simple_selector, &mut specificity);
simple_selector_specificity(builder, &simple_selector, &mut specificity);
}
specificity
}
@@ -92,7 +92,7 @@ macro_rules! with_all_bounds {
/// NB: We need Clone so that we can derive(Clone) on struct with that
/// are parameterized on SelectorImpl. See
/// <https://github.com/rust-lang/rust/issues/26925>
pub trait SelectorImpl: Clone + Sized + 'static {
pub trait SelectorImpl: Clone + Debug + Sized + 'static {
type ExtraMatchingData: Sized + Default + 'static;
type AttrValue: $($InSelector)*;
type Identifier: $($InSelector)*;
@@ -544,10 +544,26 @@ impl<Impl: SelectorImpl> Selector<Impl> {
}

/// Whether this selector is a featureless :host selector, with no
/// combinators to the left.
/// combinators to the left, and optionally has a pseudo-element to the
/// right.
#[inline]
pub fn is_featureless_host_selector(&self) -> bool {
self.iter().is_featureless_host_selector()
pub fn is_featureless_host_selector_or_pseudo_element(&self) -> bool {
let mut iter = self.iter();
if !self.has_pseudo_element() {
return iter.is_featureless_host_selector();
}

// Skip the pseudo-element.
for _ in &mut iter { }

match iter.next_sequence() {
None => return false,
Some(combinator) => {
debug_assert_eq!(combinator, Combinator::PseudoElement);
}
}

iter.is_featureless_host_selector()
}

/// Returns an iterator over this selector in matching order (right-to-left),
@@ -59,7 +59,7 @@ serde = {version = "1.0", optional = true, features = ["derive"]}
servo_arc = { path = "../servo_arc" }
servo_atoms = {path = "../atoms", optional = true}
servo_config = {path = "../config", optional = true}
smallbitvec = "2.1.0"
smallbitvec = "2.1.1"
smallvec = "0.6"
string_cache = { version = "0.7", optional = true }
style_derive = {path = "../style_derive"}
@@ -10,7 +10,7 @@ use context::SharedStyleContext;
use dom::{OpaqueNode, TElement};
use font_metrics::FontMetricsProvider;
use properties::{self, CascadeFlags, ComputedValues, LonghandId};
use properties::animated_properties::{AnimatedProperty, TransitionProperty};
use properties::animated_properties::AnimatedProperty;
use properties::longhands::animation_direction::computed_value::single_value::T as AnimationDirection;
use properties::longhands::animation_play_state::computed_value::single_value::T as AnimationPlayState;
use rule_tree::CascadeLevel;
@@ -20,6 +20,7 @@ use std::sync::mpsc::Sender;
use stylesheets::keyframes_rule::{KeyframesAnimation, KeyframesStep, KeyframesStepValue};
use timer::Timer;
use values::computed::Time;
use values::computed::box_::TransitionProperty;
use values::computed::transform::TimingFunction;
use values::generics::box_::AnimationIterationCount;
use values::generics::transform::{StepPosition, TimingFunction as GenericTimingFunction};
@@ -303,7 +304,8 @@ impl PropertyAnimation {
let duration = box_style.transition_duration_mod(transition_index);

match transition_property {
TransitionProperty::Unsupported(_) => result,
TransitionProperty::Custom(..) |
TransitionProperty::Unsupported(..) => result,
TransitionProperty::Shorthand(ref shorthand_id) => shorthand_id
.longhands()
.filter_map(|longhand| {
@@ -323,7 +323,7 @@ macro_rules! is_descriptor_enabled {
("font-variation-settings") => {
unsafe {
use gecko_bindings::structs::mozilla;
mozilla::StaticPrefs_sVarCache_layout_css_font_variations_enabled
mozilla::StaticPrefs_sVarCache_layout_css_font_variations_enabled != 0
}
};
($name:tt) => {
@@ -67,7 +67,6 @@ use media_queries::Device;
use properties::{ComputedValues, LonghandId};
use properties::{Importance, PropertyDeclaration, PropertyDeclarationBlock};
use properties::animated_properties::{AnimationValue, AnimationValueMap};
use properties::animated_properties::TransitionProperty;
use properties::style_structs::Font;
use rule_tree::CascadeLevel as ServoCascadeLevel;
use selector_parser::{AttrValue, Direction, PseudoClassStringArg};
@@ -181,7 +180,6 @@ impl<'lr> TShadowRoot for GeckoShadowRoot<'lr> {

let author_styles = AuthorStyles::<GeckoStyleSheet>::from_ffi(author_styles);

debug_assert!(!author_styles.stylesheets.dirty());
debug_assert!(
author_styles.quirks_mode == self.as_node().owner_doc().quirks_mode() ||
author_styles.stylesheets.is_empty()
@@ -617,31 +615,37 @@ impl<'le> GeckoElement<'le> {
// GeckoNode is a raw reference.
//
// We can use a Cell<T>, but that's a bit of a pain.
#[inline]
fn set_flags(&self, flags: u32) {
unsafe { Gecko_SetNodeFlags(self.as_node().0, flags) }
}

#[inline]
unsafe fn unset_flags(&self, flags: u32) {
Gecko_UnsetNodeFlags(self.as_node().0, flags)
}

/// Returns true if this element has descendants for lazy frame construction.
#[inline]
pub fn descendants_need_frames(&self) -> bool {
self.flags() & (NODE_DESCENDANTS_NEED_FRAMES as u32) != 0
}

/// Returns true if this element needs lazy frame construction.
#[inline]
pub fn needs_frame(&self) -> bool {
self.flags() & (NODE_NEEDS_FRAME as u32) != 0
}

/// Returns a reference to the DOM slots for this Element, if they exist.
#[inline]
fn dom_slots(&self) -> Option<&structs::FragmentOrElement_nsDOMSlots> {
let slots = self.as_node().0.mSlots as *const structs::FragmentOrElement_nsDOMSlots;
unsafe { slots.as_ref() }
}

/// Returns a reference to the extended DOM slots for this Element.
#[inline]
fn extended_slots(&self) -> Option<&structs::FragmentOrElement_nsExtendedDOMSlots> {
self.dom_slots().and_then(|s| unsafe {
(s._base.mExtendedSlots.mPtr as *const structs::FragmentOrElement_nsExtendedDOMSlots)
@@ -699,6 +703,7 @@ impl<'le> GeckoElement<'le> {
}
}

#[inline]
fn non_xul_xbl_binding_parent_raw_content(&self) -> *mut nsIContent {
debug_assert!(!self.is_xul_element());
self.extended_slots()
@@ -1113,7 +1118,23 @@ impl<'le> TElement for GeckoElement<'le> {
assert_eq!(base as *const _, self.0 as *const _, "Bad cast");
}

let assigned_nodes: &[structs::RefPtr<structs::nsINode>] = &*slot.mAssignedNodes;
// FIXME(emilio): Workaround a bindgen bug on Android that causes
// mAssignedNodes to be at the wrong offset. See bug 1466406.
//
// Bug 1466580 tracks running the Android layout tests on automation.
//
// The actual bindgen bug still needs reduction.
let assigned_nodes: &[structs::RefPtr<structs::nsINode>] =
if !cfg!(target_os = "android") {
debug_assert_eq!(
unsafe { bindings::Gecko_GetAssignedNodes(self.0) },
&slot.mAssignedNodes as *const _,
);

&*slot.mAssignedNodes
} else {
unsafe { &**bindings::Gecko_GetAssignedNodes(self.0) }
};

debug_assert_eq!(
mem::size_of::<structs::RefPtr<structs::nsINode>>(),
@@ -1351,6 +1372,7 @@ impl<'le> TElement for GeckoElement<'le> {
!self.is_in_native_anonymous_subtree()
}

#[inline]
fn implemented_pseudo_element(&self) -> Option<PseudoElement> {
if !self.is_in_native_anonymous_subtree() {
return None;
@@ -1364,6 +1386,7 @@ impl<'le> TElement for GeckoElement<'le> {
PseudoElement::from_pseudo_type(pseudo_type)
}

#[inline]
fn store_children_to_process(&self, _: isize) {
// This is only used for bottom-up traversal, and is thus a no-op for Gecko.
}
@@ -1587,6 +1610,7 @@ impl<'le> TElement for GeckoElement<'le> {
) -> bool {
use gecko_bindings::structs::nsCSSPropertyID;
use properties::LonghandIdSet;
use values::computed::TransitionProperty;

debug_assert!(
self.might_need_transitions_update(Some(before_change_style), after_change_style),
@@ -1630,6 +1654,7 @@ impl<'le> TElement for GeckoElement<'le> {
};

match transition_property {
TransitionProperty::Custom(..) |
TransitionProperty::Unsupported(..) => {},
TransitionProperty::Shorthand(ref shorthand) => {
if shorthand.longhands().any(property_check_helper) {
@@ -8,6 +8,7 @@ use context::QuirksMode;
use gecko_bindings::structs::nsCompatibility;

impl From<nsCompatibility> for QuirksMode {
#[inline]
fn from(mode: nsCompatibility) -> QuirksMode {
match mode {
nsCompatibility::eCompatibility_FullStandards => QuirksMode::NoQuirks,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.