Package org.eclipse.wst.html.core.internal.htmlcss

Examples of org.eclipse.wst.html.core.internal.htmlcss.CSSQueryTraverser


    // docnotifier.getAdapterFor(IStyleSheetListAdapter.class);
    //
    // StyleSheetList ssl = (adapter == null ? null :
    // adapter.getStyleSheets());

    CSSQueryTraverser query = new CSSQueryTraverser();
    query.setTraverseImported(true);
    query.setTraverseImportFirst(true);
    query.setElement(element, pseudoName);

    // if (ssl != null)
    // {
    // for (int i = 0, numStyles = ssl.getLength(); i < numStyles; i++)
    // {
    // // loop for styles (<style> and <link>)
    // org.w3c.dom.stylesheets.StyleSheet ss = ssl.item(i);
    if (styleSheets != null) {
      for (int i = 0, numStyles = styleSheets.size(); i < numStyles; i++) {
        StyleSheet ss = (StyleSheet) styleSheets.get(i);
        try {
          query.apply((ICSSNode) ss);
        } catch (ClassCastException ex) {
          Logger log = PDPlugin.getLogger(CSSStyleDeclaration.class);
          log.error("Error.CSSUtil.0", ex); //$NON-NLS-1$
          // FIXME: should this continue to be processed?
        }
      }
    }
    CSSStyleDeclaration declare = query.getDeclaration();
    // FIXME: when do we need to apply the user agent style sheet?
    return declare;
  }
View Full Code Here


   *            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;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.wst.html.core.internal.htmlcss.CSSQueryTraverser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.