Permalink
Browse files

Auto merge of #22143 - emilio:gecko-sync, r=jdm

style: Sync changes from mozilla-central.

See each individual commit for details.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22143)
<!-- Reviewable:end -->
  • Loading branch information...
bors-servo committed Nov 8, 2018
2 parents dd5e5e9 + c96df0f commit 2aeefe8d5a211f8efa19dfde84f8a617eb126e2b
Showing with 242 additions and 205 deletions.
  1. +3 −4 components/layout/generated_content.rs
  2. +5 −0 components/style/gecko/arc_types.rs
  3. +2 −3 components/style/gecko/data.rs
  4. +22 −23 components/style/gecko/non_ts_pseudo_class_list.rs
  5. +3 −6 components/style/gecko/values.rs
  6. +3 −6 components/style/gecko/wrapper.rs
  7. +12 −5 components/style/gecko_bindings/sugar/refptr.rs
  8. +9 −25 components/style/properties/gecko.mako.rs
  9. +31 −15 components/style/properties/helpers/animated_properties.mako.rs
  10. +0 −3 components/style/properties/longhands/box.mako.rs
  11. +2 −3 components/style/values/animated/length.rs
  12. +8 −1 components/style/values/computed/length.rs
  13. +20 −16 components/style/values/computed/list.rs
  14. +11 −16 components/style/values/computed/mod.rs
  15. +2 −3 components/style/values/computed/svg.rs
  16. +1 −2 components/style/values/computed/transform.rs
  17. +30 −1 components/style/values/generics/background.rs
  18. +29 −4 components/style/values/generics/transform.rs
  19. +9 −3 components/style/values/mod.rs
  20. +2 −3 components/style/values/specified/box.rs
  21. +2 −3 components/style/values/specified/font.rs
  22. +8 −1 components/style/values/specified/length.rs
  23. +22 −39 components/style/values/specified/list.rs
  24. +5 −7 components/style/values/specified/mod.rs
  25. +1 −1 components/style/values/specified/transform.rs
  26. +0 −2 tests/wpt/metadata/css/css-backgrounds/background-331.html.ini
  27. +0 −2 tests/wpt/metadata/css/css-backgrounds/background-333.html.ini
  28. +0 −8 tests/wpt/metadata/css/css-backgrounds/background-size-001.html.ini
@@ -366,16 +366,15 @@ impl<'a, 'b> ResolveGeneratedContentFragmentMutator<'a, 'b> {
if quotes.0.is_empty() {
return String::new();
}
let &(ref open_quote, ref close_quote) = if self.traversal.quote as usize >= quotes.0.len()
{
let pair = if self.traversal.quote as usize >= quotes.0.len() {
quotes.0.last().unwrap()
} else {
&quotes.0[self.traversal.quote as usize]
};
if close {
close_quote.to_string()
pair.closing.to_string()
} else {
open_quote.to_string()
pair.opening.to_string()
}
}
}
@@ -27,6 +27,7 @@ use gecko_bindings::structs::RawServoCssUrlData;
use gecko_bindings::structs::RawServoDeclarationBlock;
use gecko_bindings::structs::RawServoFontFaceRule;
use gecko_bindings::structs::RawServoMediaList;
use gecko_bindings::structs::RawServoQuotes;
use gecko_bindings::structs::RawServoStyleRule;
use gecko_bindings::structs::RawServoStyleSheetContents;
use gecko_bindings::sugar::ownership::{HasArcFFI, HasFFI, Strong};
@@ -41,6 +42,7 @@ use stylesheets::keyframes_rule::Keyframe;
use stylesheets::{CounterStyleRule, CssRules, FontFaceRule, FontFeatureValuesRule};
use stylesheets::{DocumentRule, ImportRule, KeyframesRule, MediaRule, NamespaceRule, PageRule};
use stylesheets::{StyleRule, StylesheetContents, SupportsRule};
use values::computed::QuotePair;
macro_rules! impl_arc_ffi {
($servo_type:ty => $gecko_type:ty[$addref:ident, $release:ident]) => {
@@ -115,6 +117,9 @@ impl_arc_ffi!(Locked<CounterStyleRule> => RawServoCounterStyleRule
impl_arc_ffi!(CssUrlData => RawServoCssUrlData
[Servo_CssUrlData_AddRef, Servo_CssUrlData_Release]);
impl_arc_ffi!(Box<[QuotePair]> => RawServoQuotes
[Servo_Quotes_AddRef, Servo_Quotes_Release]);
// RuleNode is a Arc-like type but it does not use Arc.
impl StrongRuleNode {
@@ -8,10 +8,9 @@ use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
use context::QuirksMode;
use dom::TElement;
use gecko_bindings::bindings::{self, RawServoStyleSet};
use gecko_bindings::structs::StyleSheet as DomStyleSheet;
use gecko_bindings::structs::{nsIDocument, StyleSheetInfo};
use gecko_bindings::structs::{
RawGeckoPresContextBorrowed, ServoStyleSetSizes, StyleSheet as DomStyleSheet,
};
use gecko_bindings::structs::{RawGeckoPresContextBorrowed, ServoStyleSetSizes};
use gecko_bindings::sugar::ownership::{HasArcFFI, HasBoxFFI, HasFFI, HasSimpleFFI};
use invalidation::media_queries::{MediaListKey, ToMediaListKey};
use malloc_size_of::MallocSizeOfOps;
@@ -3,29 +3,28 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* This file contains a helper macro includes all supported non-tree-structural
* pseudo-classes.
*
* FIXME: Find a way to autogenerate this file.
*
* Expected usage is as follows:
* ```
* macro_rules! pseudo_class_macro{
* ([$(($css:expr, $name:ident, $gecko_type:tt, $state:tt, $flags:tt),)*]) => {
* // do stuff
* }
* }
* apply_non_ts_list!(pseudo_class_macro)
* ```
*
* $gecko_type can be either "_" or an ident in Gecko's CSSPseudoClassType.
* $state can be either "_" or an expression of type ElementState. If present,
* the semantics are that the pseudo-class matches if any of the bits in
* $state are set on the element.
* $flags can be either "_" or an expression of type NonTSPseudoClassFlag,
* see selector_parser.rs for more details.
*/
* This file contains a helper macro includes all supported non-tree-structural
* pseudo-classes.
*
* FIXME: Find a way to autogenerate this file.
*
* Expected usage is as follows:
* ```
* macro_rules! pseudo_class_macro{
* ([$(($css:expr, $name:ident, $gecko_type:tt, $state:tt, $flags:tt),)*]) => {
* // do stuff
* }
* }
* apply_non_ts_list!(pseudo_class_macro)
* ```
*
* $gecko_type can be either "_" or an ident in Gecko's CSSPseudoClassType.
* $state can be either "_" or an expression of type ElementState. If present,
* the semantics are that the pseudo-class matches if any of the bits in
* $state are set on the element.
* $flags can be either "_" or an expression of type NonTSPseudoClassFlag,
* see selector_parser.rs for more details.
*/
macro_rules! apply_non_ts_list {
($apply_macro:ident) => {
@@ -17,13 +17,10 @@ use nsstring::{nsACString, nsCStr};
use std::cmp::max;
use values::computed::basic_shape::ShapeRadius as ComputedShapeRadius;
use values::computed::FlexBasis as ComputedFlexBasis;
use values::computed::{
Angle, ExtremumLength, Length, LengthOrPercentage, LengthOrPercentageOrAuto,
};
use values::computed::{Angle, ExtremumLength, Length, LengthOrPercentage};
use values::computed::{LengthOrPercentageOrAuto, Percentage};
use values::computed::{LengthOrPercentageOrNone, Number, NumberOrPercentage};
use values::computed::{
MaxLength as ComputedMaxLength, MozLength as ComputedMozLength, Percentage,
};
use values::computed::{MaxLength as ComputedMaxLength, MozLength as ComputedMozLength};
use values::computed::{NonNegativeLength, NonNegativeLengthOrPercentage, NonNegativeNumber};
use values::generics::basic_shape::ShapeRadius;
use values::generics::box_::Perspective;
@@ -44,9 +44,6 @@ use gecko_bindings::bindings::Gecko_MatchLang;
use gecko_bindings::bindings::Gecko_UnsetDirtyStyleAttr;
use gecko_bindings::bindings::Gecko_UpdateAnimations;
use gecko_bindings::bindings::{Gecko_ElementState, Gecko_GetDocumentLWTheme};
use gecko_bindings::bindings::{
Gecko_GetLastChild, Gecko_GetNextStyleChild, Gecko_GetPreviousSibling,
};
use gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags};
use gecko_bindings::structs;
use gecko_bindings::structs::nsChangeHint;
@@ -384,12 +381,12 @@ impl<'ln> TNode for GeckoNode<'ln> {
#[inline]
fn last_child(&self) -> Option<Self> {
unsafe { Gecko_GetLastChild(self.0).map(GeckoNode) }
unsafe { bindings::Gecko_GetLastChild(self.0).map(GeckoNode) }
}
#[inline]
fn prev_sibling(&self) -> Option<Self> {
unsafe { Gecko_GetPreviousSibling(self.0).map(GeckoNode) }
unsafe { bindings::Gecko_GetPreviousSibling(self.0).map(GeckoNode) }
}
#[inline]
@@ -506,7 +503,7 @@ impl<'a> Iterator for GeckoChildrenIterator<'a> {
// however we can't express this easily with bindgen, and it would
// introduce functions with two input lifetimes into bindgen,
// which would be out of scope for elision.
Gecko_GetNextStyleChild(&mut *(it as *mut _)).map(GeckoNode)
bindings::Gecko_GetNextStyleChild(&mut *(it as *mut _)).map(GeckoNode)
},
}
}
@@ -211,6 +211,18 @@ impl<T: RefCounted> structs::RefPtr<T> {
}
impl<T> structs::RefPtr<T> {
/// Sets the contents to an `Arc<T>`, releasing the old value in `self` if
/// necessary.
pub fn set_arc<U>(&mut self, other: Arc<U>)
where
U: HasArcFFI<FFIType = T>,
{
unsafe {
U::release_opt(self.mRawPtr.as_ref());
}
self.set_arc_leaky(other);
}
/// Sets the contents to an Arc<T>
/// will leak existing contents
pub fn set_arc_leaky<U>(&mut self, other: Arc<U>)
@@ -277,11 +289,6 @@ impl_threadsafe_refcount!(
bindings::Gecko_AddRefURLExtraDataArbitraryThread,
bindings::Gecko_ReleaseURLExtraDataArbitraryThread
);
impl_threadsafe_refcount!(
structs::nsStyleQuoteValues,
bindings::Gecko_AddRefQuoteValuesArbitraryThread,
bindings::Gecko_ReleaseQuoteValuesArbitraryThread
);
impl_threadsafe_refcount!(
structs::nsCSSValueSharedList,
bindings::Gecko_AddRefCSSValueSharedListArbitraryThread,
@@ -4180,41 +4180,25 @@ fn static_assert() {
}
pub fn set_quotes(&mut self, other: longhands::quotes::computed_value::T) {
use gecko_bindings::bindings::Gecko_NewStyleQuoteValues;
use gecko_bindings::sugar::refptr::UniqueRefPtr;
let mut refptr = unsafe {
UniqueRefPtr::from_addrefed(Gecko_NewStyleQuoteValues(other.0.len() as u32))
};
for (servo, gecko) in other.0.into_iter().zip(refptr.mQuotePairs.iter_mut()) {
gecko.first.assign_str(&servo.0);
gecko.second.assign_str(&servo.1);
}
self.gecko.mQuotes.set_move(refptr.get())
self.gecko.mQuotes.set_arc(other.0.clone());
}
pub fn copy_quotes_from(&mut self, other: &Self) {
unsafe { self.gecko.mQuotes.set(&other.gecko.mQuotes); }
self.set_quotes(other.clone_quotes());
}
pub fn reset_quotes(&mut self, other: &Self) {
self.copy_quotes_from(other)
}
pub fn clone_quotes(&self) -> longhands::quotes::computed_value::T {
unsafe {
let ref gecko_quote_values = *self.gecko.mQuotes.mRawPtr;
longhands::quotes::computed_value::T(
gecko_quote_values.mQuotePairs.iter().map(|gecko_pair| {
(
gecko_pair.first.to_string().into_boxed_str(),
gecko_pair.second.to_string().into_boxed_str(),
)
}).collect::<Vec<_>>().into_boxed_slice()
)
}
use gecko_bindings::sugar::ownership::HasArcFFI;
use values::computed::QuotePair;
let quote_pairs = unsafe { &*self.gecko.mQuotes.mRawPtr };
longhands::quotes::computed_value::T(
Box::<[QuotePair]>::as_arc(&quote_pairs).clone_arc()
)
}
#[allow(non_snake_case)]
@@ -2212,7 +2212,6 @@ impl ComputedScale {
Scale::None => (1.0, 1.0, 1.0),
Scale::Scale3D(sx, sy, sz) => (sx, sy, sz),
Scale::Scale(sx, sy) => (sx, sy, 1.),
Scale::ScaleX(sx) => (sx, 1., 1.),
}
}
}
@@ -2224,21 +2223,38 @@ impl Animate for ComputedScale {
other: &Self,
procedure: Procedure,
) -> Result<Self, ()> {
let from = ComputedScale::resolve(self);
let to = ComputedScale::resolve(other);
// FIXME(emilio, bug 1464791): why does this do something different than
// Scale3D / TransformOperation::Scale3D?
if procedure == Procedure::Add {
// scale(x1,y1,z1)*scale(x2,y2,z2) = scale(x1*x2, y1*y2, z1*z2)
return Ok(Scale::Scale3D(from.0 * to.0, from.1 * to.1, from.2 * to.2));
match (self, other) {
(&Scale::None, &Scale::None) => Ok(Scale::None),
(&Scale::Scale3D(_, ..), _) | (_, &Scale::Scale3D(_, ..)) => {
let from = ComputedScale::resolve(self);
let to = ComputedScale::resolve(other);
// FIXME(emilio, bug 1464791): why does this do something different than
// Scale3D / TransformOperation::Scale3D?
if procedure == Procedure::Add {
// scale(x1,y1,z1)*scale(x2,y2,z2) = scale(x1*x2, y1*y2, z1*z2)
return Ok(Scale::Scale3D(from.0 * to.0, from.1 * to.1, from.2 * to.2));
}
Ok(Scale::Scale3D(
animate_multiplicative_factor(from.0, to.0, procedure)?,
animate_multiplicative_factor(from.1, to.1, procedure)?,
animate_multiplicative_factor(from.2, to.2, procedure)?,
))
},
(&Scale::Scale(_, ..), _) | (_, &Scale::Scale(_, ..)) => {
let from = ComputedScale::resolve(self);
let to = ComputedScale::resolve(other);
// FIXME(emilio, bug 1464791): why does this do something different than
// Scale / TransformOperation::Scale?
if procedure == Procedure::Add {
// scale(x1,y1)*scale(x2,y2) = scale(x1*x2, y1*y2)
return Ok(Scale::Scale(from.0 * to.0, from.1 * to.1));
}
Ok(Scale::Scale(
animate_multiplicative_factor(from.0, to.0, procedure)?,
animate_multiplicative_factor(from.1, to.1, procedure)?,
))
},
}
Ok(Scale::Scale3D(
animate_multiplicative_factor(from.0, to.0, procedure)?,
animate_multiplicative_factor(from.1, to.1, procedure)?,
animate_multiplicative_factor(from.2, to.2, procedure)?,
))
}
}
@@ -604,7 +604,6 @@ ${helpers.predefined_type(
${helpers.predefined_type(
"shape-image-threshold", "Opacity", "0.0",
products="gecko",
gecko_pref="layout.css.shape-outside.enabled",
animation_value_type="ComputedValue",
flags="APPLIES_TO_FIRST_LETTER",
spec="https://drafts.csswg.org/css-shapes/#shape-image-threshold-property",
@@ -615,7 +614,6 @@ ${helpers.predefined_type(
"NonNegativeLengthOrPercentage",
"computed::NonNegativeLengthOrPercentage::zero()",
products="gecko",
gecko_pref="layout.css.shape-outside.enabled",
animation_value_type="NonNegativeLengthOrPercentage",
flags="APPLIES_TO_FIRST_LETTER",
spec="https://drafts.csswg.org/css-shapes/#shape-margin-property",
@@ -627,7 +625,6 @@ ${helpers.predefined_type(
"generics::basic_shape::ShapeSource::None",
products="gecko",
boxed=True,
gecko_pref="layout.css.shape-outside.enabled",
animation_value_type="ComputedValue",
flags="APPLIES_TO_FIRST_LETTER",
spec="https://drafts.csswg.org/css-shapes/#shape-outside-property",
@@ -5,9 +5,8 @@
//! Animation implementation for various length-related types.
use super::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero};
use values::computed::length::{
CalcLengthOrPercentage, Length, LengthOrPercentageOrAuto, LengthOrPercentageOrNone,
};
use values::computed::length::{CalcLengthOrPercentage, Length};
use values::computed::length::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
use values::computed::MaxLength as ComputedMaxLength;
use values::computed::MozLength as ComputedMozLength;
use values::computed::Percentage;
@@ -17,7 +17,7 @@ use values::generics::length::{MaxLength as GenericMaxLength, MozLength as Gener
use values::generics::NonNegative;
use values::specified::length::ViewportPercentageLength;
use values::specified::length::{AbsoluteLength, FontBaseSize, FontRelativeLength};
use values::{specified, Auto, CSSFloat, Either, Normal};
use values::{specified, Auto, CSSFloat, Either, IsAuto, Normal};
pub use super::image::Image;
pub use values::specified::url::UrlOrNone;
@@ -528,6 +528,13 @@ impl LengthOrPercentageOrAuto {
/// A wrapper of LengthOrPercentageOrAuto, whose value must be >= 0.
pub type NonNegativeLengthOrPercentageOrAuto = NonNegative<LengthOrPercentageOrAuto>;
impl IsAuto for NonNegativeLengthOrPercentageOrAuto {
#[inline]
fn is_auto(&self) -> bool {
*self == Self::auto()
}
}
impl NonNegativeLengthOrPercentageOrAuto {
/// `auto`
#[inline]
Oops, something went wrong.

0 comments on commit 2aeefe8

Please sign in to comment.