@@ -8,6 +8,7 @@ use gecko_bindings::bindings;
8
8
use gecko_bindings:: structs;
9
9
use gecko_bindings:: structs:: { nsChangeHint, nsStyleContext} ;
10
10
use gecko_bindings:: sugar:: ownership:: FFIArcHelpers ;
11
+ use matching:: { StyleChange , StyleDifference } ;
11
12
use properties:: ComputedValues ;
12
13
use std:: ops:: { BitAnd , BitOr , BitOrAssign , Not } ;
13
14
use stylearc:: Arc ;
@@ -38,15 +39,17 @@ impl GeckoRestyleDamage {
38
39
self . 0 == nsChangeHint ( 0 )
39
40
}
40
41
41
- /// Computes a change hint given an old style (in the form of a
42
- /// `nsStyleContext`, and a new style (in the form of `ComputedValues`).
42
+ /// Computes the `StyleDifference` (including the appropriate change hint)
43
+ /// given an old style (in the form of a `nsStyleContext`, and a new style
44
+ /// (in the form of `ComputedValues`).
43
45
///
44
46
/// Note that we could in theory just get two `ComputedValues` here and diff
45
47
/// them, but Gecko has an interesting optimization when they mark accessed
46
48
/// structs, so they effectively only diff structs that have ever been
47
49
/// accessed from layout.
48
- pub fn compute ( source : & nsStyleContext ,
49
- new_style : & Arc < ComputedValues > ) -> Self {
50
+ pub fn compute_style_difference ( source : & nsStyleContext ,
51
+ new_style : & Arc < ComputedValues > )
52
+ -> StyleDifference {
50
53
// TODO(emilio): Const-ify this?
51
54
let context = source as * const nsStyleContext as * mut nsStyleContext ;
52
55
let mut any_style_changed: bool = false ;
@@ -55,7 +58,8 @@ impl GeckoRestyleDamage {
55
58
new_style. as_borrowed_opt ( ) . unwrap ( ) ,
56
59
& mut any_style_changed)
57
60
} ;
58
- GeckoRestyleDamage ( hint)
61
+ let change = if any_style_changed { StyleChange :: Changed } else { StyleChange :: Unchanged } ;
62
+ StyleDifference :: new ( GeckoRestyleDamage ( hint) , change)
59
63
}
60
64
61
65
/// Returns true if this restyle damage contains all the damage of |other|.
0 commit comments