Auto merge of #17933 - emilio:restyle-hint-conversion, r=Manishearth

stylo: Fix restyle hint conversion to handle eRestyle_ForceDescendants correctly.

<!-- 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/17933)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-08-01 11:20:41 -05:00 committed by GitHub
commit 9fd081bb1d

View file

@ -189,7 +189,8 @@ impl Default for RestyleHint {
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
impl From<nsRestyleHint> for RestyleHint { impl From<nsRestyleHint> for RestyleHint {
fn from(raw: nsRestyleHint) -> Self { fn from(mut raw: nsRestyleHint) -> Self {
use gecko_bindings::structs::nsRestyleHint_eRestyle_Force as eRestyle_Force;
use gecko_bindings::structs::nsRestyleHint_eRestyle_ForceDescendants as eRestyle_ForceDescendants; use gecko_bindings::structs::nsRestyleHint_eRestyle_ForceDescendants as eRestyle_ForceDescendants;
use gecko_bindings::structs::nsRestyleHint_eRestyle_LaterSiblings as eRestyle_LaterSiblings; use gecko_bindings::structs::nsRestyleHint_eRestyle_LaterSiblings as eRestyle_LaterSiblings;
use gecko_bindings::structs::nsRestyleHint_eRestyle_Self as eRestyle_Self; use gecko_bindings::structs::nsRestyleHint_eRestyle_Self as eRestyle_Self;
@ -202,14 +203,23 @@ impl From<nsRestyleHint> for RestyleHint {
"Handle later siblings manually if necessary plz."); "Handle later siblings manually if necessary plz.");
if (raw.0 & (eRestyle_Self.0 | eRestyle_Subtree.0)) != 0 { if (raw.0 & (eRestyle_Self.0 | eRestyle_Subtree.0)) != 0 {
raw.0 &= !eRestyle_Self.0;
hint.insert(RESTYLE_SELF); hint.insert(RESTYLE_SELF);
} }
if (raw.0 & (eRestyle_Subtree.0 | eRestyle_SomeDescendants.0)) != 0 { if (raw.0 & (eRestyle_Subtree.0 | eRestyle_SomeDescendants.0)) != 0 {
raw.0 &= !eRestyle_Subtree.0;
raw.0 &= !eRestyle_SomeDescendants.0;
hint.insert(RESTYLE_DESCENDANTS); hint.insert(RESTYLE_DESCENDANTS);
} }
if (raw.0 & (eRestyle_ForceDescendants.0 | eRestyle_Force.0)) != 0 {
raw.0 &= !eRestyle_Force.0;
hint.insert(RECASCADE_SELF);
}
if (raw.0 & eRestyle_ForceDescendants.0) != 0 { if (raw.0 & eRestyle_ForceDescendants.0) != 0 {
raw.0 &= !eRestyle_ForceDescendants.0;
hint.insert(RECASCADE_DESCENDANTS); hint.insert(RECASCADE_DESCENDANTS);
} }