servo: Merge #17093 - Stylo - Bug 1365674: Simulate compute value failure for tests (from ferjm:bug1365674.simulate.compute.value.failure); r=hiikezoe
authorFernando Jiménez Moreno <ferjmoreno@gmail.com>
Wed, 31 May 2017 12:03:50 -0500
changeset 412094 d2b02f7d0e73998574942b1336066bdd045f9a13
parent 412093 72dfa41fadc123f882ee7c1fa1b915cdf8fe97e1
child 412095 37fb38a7ef4b36718d8f5653fff0a1c903f1bfc1
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershiikezoe
bugs1365674
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #17093 - Stylo - Bug 1365674: Simulate compute value failure for tests (from ferjm:bug1365674.simulate.compute.value.failure); r=hiikezoe - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors https://bugzilla.mozilla.org/show_bug.cgi?id=1365674 Source-Repo: https://github.com/servo/servo Source-Revision: 71eb672923365095c45cbd15ee0746eae3908cb6
servo/components/style/gecko/generated/structs_debug.rs
servo/ports/geckolib/glue.rs
--- a/servo/components/style/gecko/generated/structs_debug.rs
+++ b/servo/components/style/gecko/generated/structs_debug.rs
@@ -9301,20 +9301,21 @@ pub mod root {
  * A property-value pair specified on a keyframe.
  */
         #[repr(C)]
         #[derive(Debug)]
         pub struct PropertyValuePair {
             pub mProperty: root::nsCSSPropertyID,
             pub mValue: root::nsCSSValue,
             pub mServoDeclarationBlock: root::RefPtr<root::RawServoDeclarationBlock>,
+            pub mSimulateComputeValuesFailure: bool,
         }
         #[test]
         fn bindgen_test_layout_PropertyValuePair() {
-            assert_eq!(::std::mem::size_of::<PropertyValuePair>() , 32usize ,
+            assert_eq!(::std::mem::size_of::<PropertyValuePair>() , 40usize ,
                        concat ! (
                        "Size of: " , stringify ! ( PropertyValuePair ) ));
             assert_eq! (::std::mem::align_of::<PropertyValuePair>() , 8usize ,
                         concat ! (
                         "Alignment of " , stringify ! ( PropertyValuePair )
                         ));
             assert_eq! (unsafe {
                         & ( * ( 0 as * const PropertyValuePair ) ) . mProperty
@@ -9330,16 +9331,23 @@ pub mod root {
                         ));
             assert_eq! (unsafe {
                         & ( * ( 0 as * const PropertyValuePair ) ) .
                         mServoDeclarationBlock as * const _ as usize } ,
                         24usize , concat ! (
                         "Alignment of field: " , stringify ! (
                         PropertyValuePair ) , "::" , stringify ! (
                         mServoDeclarationBlock ) ));
+            assert_eq! (unsafe {
+                        & ( * ( 0 as * const PropertyValuePair ) ) .
+                        mSimulateComputeValuesFailure as * const _ as usize }
+                        , 32usize , concat ! (
+                        "Alignment of field: " , stringify ! (
+                        PropertyValuePair ) , "::" , stringify ! (
+                        mSimulateComputeValuesFailure ) ));
         }
         #[repr(C)]
         #[derive(Debug, Copy, Clone)]
         pub struct SVGLengthList {
             _unused: [u8; 0],
         }
         #[repr(C)]
         #[derive(Debug, Copy, Clone)]
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -63,17 +63,17 @@ use style::gecko_bindings::bindings::Ser
 use style::gecko_bindings::bindings::nsTArrayBorrowed_uintptr_t;
 use style::gecko_bindings::bindings::nsTimingFunctionBorrowed;
 use style::gecko_bindings::bindings::nsTimingFunctionBorrowedMut;
 use style::gecko_bindings::structs;
 use style::gecko_bindings::structs::{CSSPseudoElementType, CompositeOperation};
 use style::gecko_bindings::structs::{RawServoStyleRule, ServoStyleSheet};
 use style::gecko_bindings::structs::{SheetParsingMode, nsIAtom, nsCSSPropertyID};
 use style::gecko_bindings::structs::{nsCSSFontFaceRule, nsCSSCounterStyleRule};
-use style::gecko_bindings::structs::{nsRestyleHint, nsChangeHint};
+use style::gecko_bindings::structs::{nsRestyleHint, nsChangeHint, PropertyValuePair};
 use style::gecko_bindings::structs::IterationCompositeOperation;
 use style::gecko_bindings::structs::Loader;
 use style::gecko_bindings::structs::MallocSizeOf;
 use style::gecko_bindings::structs::RawGeckoPresContextOwned;
 use style::gecko_bindings::structs::ServoElementSnapshotTable;
 use style::gecko_bindings::structs::StyleRuleInclusion;
 use style::gecko_bindings::structs::URLExtraData;
 use style::gecko_bindings::structs::nsCSSValueSharedList;
@@ -2419,16 +2419,28 @@ pub extern "C" fn Servo_ResolveStyleLazi
             resolve_default_style(&mut context, element, &ensure, &set_data,
                                   |styles| result = Some(finish(styles)));
         }
     }
 
     result.unwrap().into_strong()
 }
 
+#[cfg(feature = "gecko_debug")]
+fn simulate_compute_values_failure(property: &PropertyValuePair) -> bool {
+    let p = property.mProperty;
+    let id = get_property_id_from_nscsspropertyid!(p, false);
+    id.as_shorthand().is_ok() && property.mSimulateComputeValuesFailure
+}
+
+#[cfg(not(feature = "gecko_debug"))]
+fn simulate_compute_values_failure(_: &PropertyValuePair) -> bool {
+    false
+}
+
 #[no_mangle]
 pub extern "C" fn Servo_GetComputedKeyframeValues(keyframes: RawGeckoKeyframeListBorrowed,
                                                   style: ServoComputedValuesBorrowed,
                                                   parent_style: ServoComputedValuesBorrowedOrNull,
                                                   raw_data: RawServoStyleSetBorrowed,
                                                   computed_keyframes: RawGeckoComputedKeyframeValuesListBorrowedMut)
 {
     use std::mem;
@@ -2465,16 +2477,20 @@ pub extern "C" fn Servo_GetComputedKeyfr
 
         let mut seen = LonghandIdSet::new();
 
         // mServoDeclarationBlock is null in the case where we have an invalid css property.
         let iter = keyframe.mPropertyValues.iter()
                                            .filter(|&property| !property.mServoDeclarationBlock.mRawPtr.is_null());
         let mut property_index = 0;
         for property in iter {
+            if simulate_compute_values_failure(property) {
+                continue;
+            }
+
             let declarations = unsafe { &*property.mServoDeclarationBlock.mRawPtr.clone() };
             let declarations = Locked::<PropertyDeclarationBlock>::as_arc(&declarations);
             let guard = declarations.read_with(&guard);
 
             let anim_iter = guard.declarations()
                             .iter()
                             .filter_map(|&(ref decl, imp)| {
                                 if imp == Importance::Normal {