use of org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty in project webtools.sourceediting by eclipse.
the class CSSQueryContext method overrideWithExpand.
/**
*/
public void overrideWithExpand(ICSSStyleDeclaration decl, int specificity) {
if (decl == null)
return;
CSSLinkConverter conv = new CSSLinkConverter(decl.getOwnerDocument().getModel());
int nProperties = decl.getLength();
for (int i = 0; i < nProperties; i++) {
String propName = decl.item(i);
if (propName != null) {
String propN = propName.trim().toLowerCase();
if (propN.length() != 0) {
PropCMProperty prop = PropCMProperty.getInstanceOf(propN);
String priority = decl.getPropertyPriority(propName);
boolean important = priority != null && priority.length() > 0;
if (prop != null && prop.isShorthand()) {
// expand shorthand property
CSSQueryContext context = new CSSQueryContext();
expandToLeaf(prop, decl.getPropertyValue(propName), context);
Enumeration properties = context.properties();
while (properties.hasMoreElements()) {
propN = properties.nextElement().toString();
if (check(propN, important, specificity)) {
fProperties.put(propN, new CSSQueryValueData(conv.toAbsolute(context.get(propN)), important, specificity));
}
}
} else {
if (check(propN, important, specificity)) {
ICSSStyleDeclItem declItem = (ICSSStyleDeclItem) decl.getDeclItemNode(propName).cloneNode(true);
int nValues = declItem.getLength();
for (int j = 0; j < nValues; j++) {
conv.toAbsolute(declItem.item(j));
}
declItem.setPriority(null);
fProperties.put(propN, new CSSQueryDeclarationData(declItem, important, specificity));
}
}
}
}
}
}
Aggregations