Skip to content

Commit

Permalink
Stylo - Bug 1365674: Simulate compute value failure for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ferjm committed May 31, 2017
1 parent 779edd7 commit 7f5d62c
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion ports/geckolib/glue.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 7f5d62c

Please sign in to comment.