final SelectorWeight[] weights = new SelectorWeight[target.getPropertyKeys().length];
for (int i = 0; i < activeStyleRules.length; i++)
{
final StyleRuleMatcher.MatcherResult activeStyleRule = activeStyleRules[i];
final ElementStyleRule rule = activeStyleRule.getRule();
final SelectorWeight weight = activeStyleRule.getWeight();
final StyleKey[] definedPropertyNamesArray = rule.getDefinedPropertyNamesArray();
for (int j = 0; j < definedPropertyNamesArray.length; j++)
{
final StyleKey styleKey = definedPropertyNamesArray[j];
if (styleKey == null)
{
continue;
}
final SelectorWeight selectorWeight = weights[j];
if (selectorWeight == null || (selectorWeight.compareTo(weight) > 0))
{
final Object styleProperty = rule.getStyleProperty(styleKey);
if (styleProperty != null)
{
target.setStyleProperty(styleKey, styleProperty);