@@ -42,10 +42,26 @@ public static IStyleCollection GetStyleCollection(this IWindow window)
4242 /// <param name="pseudoSelector">The optional pseudo selector to use.</param>
4343 /// <returns>The style declaration containing all the declarations.</returns>
4444 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 )
4562 {
4663 var ctx = element . Owner ? . Context ;
4764 var computedStyle = new CssStyleDeclaration ( ctx ) ;
48- var context = new CssComputeContext ( styles . Device , ctx , computedStyle ) ;
4965 var nodes = element . GetAncestors ( ) . OfType < IElement > ( ) ;
5066
5167 if ( ! String . IsNullOrEmpty ( pseudoSelector ) )
@@ -65,7 +81,7 @@ public static ICssStyleDeclaration ComputeDeclarations(this IStyleCollection sty
6581 computedStyle . UpdateDeclarations ( styles . ComputeCascadedStyle ( node ) ) ;
6682 }
6783
68- return computedStyle . Compute ( context ) ;
84+ return computedStyle ;
6985 }
7086
7187 /// <summary>
0 commit comments