Package org.eclipse.wst.css.core.internal.util

Examples of org.eclipse.wst.css.core.internal.util.CSSLinkConverter


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

TOP

Related Classes of org.eclipse.wst.css.core.internal.util.CSSLinkConverter

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.