protected CSSValue parseFirstPosition(final LexicalUnit value) {
    if (value == null) {
      return null;
    }

    if (value.getLexicalUnitType() == LexicalUnit.SAC_IDENT) {
      if ("left".equalsIgnoreCase(value.getStringValue())) {
        return LEFT;
      } else if ("center".equalsIgnoreCase(value.getStringValue())) {
        return CENTER;
      } else if ("right".equalsIgnoreCase(value.getStringValue())) {
        return RIGHT;
      } else if ("top".equalsIgnoreCase(value.getStringValue())) {
        return TOP;
      } else if ("bottom".equalsIgnoreCase(value.getStringValue())) {
        return BOTTOM;
      }

      // ignore this rule.
      return null;
    }

    if (value.getLexicalUnitType() == LexicalUnit.SAC_PERCENTAGE) {
      return CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, value.getFloatValue());
    }
    if (CSSValueFactory.isLengthValue(value)) {
      return CSSValueFactory.createLengthValue(value);
    }
    // contains errors, we ignore this rule.
    return null;
  }
  public CSSValue createValue(StyleKey name, LexicalUnit value) {
    if (value.getLexicalUnitType() == LexicalUnit.SAC_IDENT) {
      final String text = value.getStringValue();
      if (ContentValues.NONE.getCSSText().equals(text)) {
        return ContentValues.NONE;
      }
      if (ContentValues.INHIBIT.getCSSText().equals(text)) {
        return ContentValues.INHIBIT;
      }
      if (ContentValues.NORMAL.getCSSText().equals(text)) {
        return ContentValues.NORMAL;
      }
    }

    final ArrayList contents = new ArrayList();
    final ArrayList contentList = new ArrayList();
    while (value != null) {
      if (value.getLexicalUnitType() == LexicalUnit.SAC_IDENT) {
        CSSValue o = lookupValue(value);
        if (o == null) {
          // parse error ...
          return null;
        }
        contentList.add(o);
      } else if (value.getLexicalUnitType() == LexicalUnit.SAC_STRING_VALUE) {
        contentList.add(new CSSStringValue(CSSStringType.STRING, value.getStringValue()));
      } else if (value.getLexicalUnitType() == LexicalUnit.SAC_URI) {
        final CSSStringValue uriValue = CSSValueFactory.createUriValue(value);
        if (uriValue == null) {
          return null;
        }
        contentList.add(uriValue);
      } else if (value.getLexicalUnitType() == LexicalUnit.SAC_FUNCTION
          || value.getLexicalUnitType() == LexicalUnit.SAC_COUNTER_FUNCTION
          || value.getLexicalUnitType() == LexicalUnit.SAC_COUNTERS_FUNCTION) {
        final CSSFunctionValue functionValue = CSSValueFactory.parseFunction(value);
        if (functionValue == null) {
          return null;
        }
        contentList.add(functionValue);
      } else if (value.getLexicalUnitType() == LexicalUnit.SAC_ATTR) {
        final CSSAttrFunction attrFn = CSSValueFactory.parseAttrFunction(value);
        if (attrFn == null) {
          return null;
        }
        contentList.add(attrFn);
      } else if (value.getLexicalUnitType() == LexicalUnit.SAC_OPERATOR_COMMA) {
        final CSSValue[] values =
            (CSSValue[]) contentList.toArray(new CSSValue[contentList.size()]);
        contents.add(new CSSValueList(values));
        contentList.clear();
      }
      value = value.getNextLexicalUnit();
    }

    final CSSValue[] values = (CSSValue[]) contentList.toArray(new CSSValue[contentList.size()]);
    contents.add(new CSSValueList(values));
    return new CSSValueList(contents);
  }
 public CSSValue createValue(StyleKey name, LexicalUnit value) {
   if (value.getLexicalUnitType() == LexicalUnit.SAC_IDENT) {
     if (value.getStringValue().equalsIgnoreCase("none")) {
       return new CSSConstant("none");
     }
   }
   return CSSValueFactory.createNumericValue(value);
 }
  private CSSValue parseSingleSpacingValue(final LexicalUnit value) {
    if (value == null) {
      return null;
    }

    if (value.getLexicalUnitType() == LexicalUnit.SAC_IDENT) {
      if (value.getStringValue().equalsIgnoreCase("normal")) {
        return SpacingLimitReadHandler.NORMAL;
      }
      return null;
    }
    if (value.getLexicalUnitType() == LexicalUnit.SAC_PERCENTAGE) {
      return CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, value.getFloatValue());
    }

    return CSSValueFactory.createLengthValue(value);
  }
 public CSSValue createValue(StyleKey name, LexicalUnit value) {
   // normalization is deferred until we compute the value.
   return CSSValueFactory.createNumericValue(value);
 }