@@ -42,10 +42,26 @@ public static IStyleCollection GetStyleCollection(this IWindow window)
42
42
/// <param name="pseudoSelector">The optional pseudo selector to use.</param>
43
43
/// <returns>The style declaration containing all the declarations.</returns>
44
44
public static ICssStyleDeclaration ComputeDeclarations ( this IStyleCollection styles , IElement element , String pseudoSelector = null )
45
+ {
46
+ var ctx = element . Owner ? . Context ;
47
+ var declarations = GetDeclarations ( styles , element , pseudoSelector ) ;
48
+ var context = new CssComputeContext ( styles . Device , ctx , declarations ) ;
49
+
50
+ return declarations . Compute ( context ) ;
51
+ }
52
+
53
+ /// <summary>
54
+ /// Gets the declarations for the given element in the context of
55
+ /// the specified styling rules.
56
+ /// </summary>
57
+ /// <param name="styles">The styles to use.</param>
58
+ /// <param name="element">The element that is questioned.</param>
59
+ /// <param name="pseudoSelector">The optional pseudo selector to use.</param>
60
+ /// <returns>The style declaration containing all the declarations.</returns>
61
+ public static ICssStyleDeclaration GetDeclarations ( this IStyleCollection styles , IElement element , String pseudoSelector = null )
45
62
{
46
63
var ctx = element . Owner ? . Context ;
47
64
var computedStyle = new CssStyleDeclaration ( ctx ) ;
48
- var context = new CssComputeContext ( styles . Device , ctx , computedStyle ) ;
49
65
var nodes = element . GetAncestors ( ) . OfType < IElement > ( ) ;
50
66
51
67
if ( ! String . IsNullOrEmpty ( pseudoSelector ) )
@@ -65,7 +81,7 @@ public static ICssStyleDeclaration ComputeDeclarations(this IStyleCollection sty
65
81
computedStyle . UpdateDeclarations ( styles . ComputeCascadedStyle ( node ) ) ;
66
82
}
67
83
68
- return computedStyle . Compute ( context ) ;
84
+ return computedStyle ;
69
85
}
70
86
71
87
/// <summary>
0 commit comments