Auto merge of #16358 - bholley:style_sharing_fixes, r=emilio

Fix up the style sharing cache

Reviewed in:
https://bugzilla.mozilla.org/show_bug.cgi?id=1354895
https://bugzilla.mozilla.org/show_bug.cgi?id=1332525

<!-- 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/16358)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-04-11 22:52:23 -05:00 committed by GitHub
commit 7ba3f1e4f3
12 changed files with 199 additions and 153 deletions

View file

@ -1890,6 +1890,19 @@ fn static_assert() {
self.gecko.mTransitions[0].mProperty = nsCSSPropertyID_eCSSPropertyExtra_no_properties;
}
}
/// Returns whether there are any transitions specified.
pub fn specifies_transitions(&self) -> bool {
use gecko_bindings::structs::nsCSSPropertyID::eCSSPropertyExtra_all_properties;
if self.gecko.mTransitionPropertyCount == 1 &&
self.gecko.mTransitions[0].mProperty == eCSSPropertyExtra_all_properties &&
self.gecko.mTransitions[0].mDuration.max(0.0) + self.gecko.mTransitions[0].mDelay <= 0.0f32 {
return false;
}
self.gecko.mTransitionPropertyCount > 0
}
pub fn transition_property_at(&self, index: usize)
-> longhands::transition_property::computed_value::SingleComputedValue {
self.gecko.mTransitions[index].mProperty.into()

View file

@ -1509,6 +1509,12 @@ pub mod style_structs {
pub fn specifies_animations(&self) -> bool {
self.animation_name_iter().any(|name| name.0 != atom!(""))
}
/// Returns whether there are any transitions specified.
#[cfg(feature = "servo")]
pub fn specifies_transitions(&self) -> bool {
self.transition_property_count() > 0
}
% endif
}