Auto merge of #17093 - ferjm:bug1365674.simulate.compute.value.failure, r=hiikezoe

Stylo - Bug 1365674: Simulate compute value failure for tests

- [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

<!-- 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/17093)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-05-31 12:03:50 -05:00 committed by GitHub
commit 71eb672923
2 changed files with 26 additions and 2 deletions

View file

@ -9306,10 +9306,11 @@ pub mod root {
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 ,
@ -9335,6 +9336,13 @@ pub mod root {
"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)]

View file

@ -68,7 +68,7 @@ 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;
@ -2424,6 +2424,18 @@ pub extern "C" fn Servo_ResolveStyleLazily(element: RawGeckoElementBorrowed,
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,
@ -2470,6 +2482,10 @@ pub extern "C" fn Servo_GetComputedKeyframeValues(keyframes: RawGeckoKeyframeLis
.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);