stylo: Fix restyle hint conversion to handle eRestyle_ForceDescendants correcty.

This commit is contained in:
Emilio Cobos Álvarez 2017-08-01 17:13:01 +01:00
parent dc244ad9e9
commit 8eef60ae1f
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

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);
} }