* the pseudoname of the element
* @return the style declaration
*/
public static CSSStyleDeclaration getDefaultCSSDeclaration(Element element,
String pseudoName) {
CSSQueryTraverser query = new CSSQueryTraverser();
query.setTraverseImported(true);
query.setTraverseImportFirst(true);
query.setElement(element, pseudoName);
// FIXME: when do we need to apply the user agent style sheet?
try {
getUserAgentDefaultStyleSheet(element);
} catch (UnsupportedEncodingException e) {
Logger log = PDPlugin.getLogger(CSSStyleDeclaration.class);
log.error("Error.CSSUtil.1", e); //$NON-NLS-1$
} catch (IOException e) {
Logger log = PDPlugin.getLogger(CSSStyleDeclaration.class);
log.error("Error.CSSUtil.2", e); //$NON-NLS-1$
}
if (_userAgentDefault != null) {
try {
query.apply((ICSSNode) _userAgentDefault);
} catch (ClassCastException ex) {
Logger log = PDPlugin.getLogger(CSSStyleDeclaration.class);
log.error("Error.CSSUtil.3", ex); //$NON-NLS-1$
}
}
CSSStyleDeclaration declare = query.getDeclaration();
return declare;
}