* declared.
* @return converted StyleSelector
*/
private StyleSelector convertSelector(Selector selector, StyleDeclaration declaration)
{
StyleSelector simpleTypeSelector = null;
// Type Selector
if (selector instanceof ElementSelector)
{
simpleTypeSelector = convertTypeSelector((ElementSelector)selector, declaration);
}
// Conditional Selector
else if (selector instanceof ConditionalSelector)
{
ConditionalSelector conditionalSelector = (ConditionalSelector)selector;
SimpleSelector simpleSelector = conditionalSelector.getSimpleSelector();
if (simpleSelector instanceof ElementSelector)
{
simpleTypeSelector = convertTypeSelector((ElementSelector)simpleSelector, declaration);
}
if (simpleTypeSelector != null)
{
Condition condition = conditionalSelector.getCondition();
boolean supportedCondition = convertCondition(simpleTypeSelector, condition);
if (!supportedCondition)
{
int lineNumber = getSelectorLineNumber(selector, declaration);
String path = getPathForReporting(declaration);
unsupportedCondition(condition, path, lineNumber);
return null;
}
}
else
{
int lineNumber = getSelectorLineNumber(selector, declaration);
String path = getPathForReporting(declaration);
unsupportedSelector(selector, path, lineNumber);
}
}
// Descendant Selector
else if (selector instanceof DescendantSelector)
{
DescendantSelector descendantSelector = (DescendantSelector)selector;
SimpleSelector simpleSelector = descendantSelector.getSimpleSelector();
// We may have conditions too, so we call convertSelector().
simpleTypeSelector = convertSelector(simpleSelector, declaration);
if (simpleTypeSelector != null)
{
Selector ancestorSelector = descendantSelector.getAncestorSelector();
simpleTypeSelector.setAncestor(convertSelector(ancestorSelector, declaration));
}
}
else
{
int lineNumber = getSelectorLineNumber(selector, declaration);