public Value computeValue(CSSStylableElement elt, CSSEngine engine, int idx, Value value) {
   IStyle cs = elt.getComputedStyle();
   CSSValue borderStyle = null;
   switch (idx) {
     case IStyle.STYLE_BORDER_TOP_WIDTH:
       borderStyle = cs.getProperty(IStyle.STYLE_BORDER_TOP_STYLE);
       break;
     case IStyle.STYLE_BORDER_BOTTOM_WIDTH:
       borderStyle = cs.getProperty(IStyle.STYLE_BORDER_BOTTOM_STYLE);
       break;
     case IStyle.STYLE_BORDER_LEFT_WIDTH:
       borderStyle = cs.getProperty(IStyle.STYLE_BORDER_LEFT_STYLE);
       break;
     case IStyle.STYLE_BORDER_RIGHT_WIDTH:
       borderStyle = cs.getProperty(IStyle.STYLE_BORDER_RIGHT_STYLE);
       break;
   }
   if (borderStyle == CSSValueConstants.NONE_VALUE
       || borderStyle == CSSValueConstants.HIDDEN_VALUE) {
     return CSSValueConstants.NUMBER_0;
   }
   if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
     if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) {
       String ident = value.getStringValue();
       Value cv = (Value) computedValues.get(ident);
       if (cv != null) {
         value = cv;
       }
     }
   }
   return super.computeValue(elt, engine, idx, value);
 }
Пример #2
0
 /** Implements {@link ValueManager#createStringValue(short,String,CSSEngine)}. */
 public CSSPrimitiveValue createStringValue(short type, String value) throws DOMException {
   if (type != CSSPrimitiveValue.CSS_IDENT) {
     throw createInvalidStringTypeDOMException(type);
   }
   Object v = values.get(value.toLowerCase().intern());
   if (v == null) {
     throw createInvalidIdentifierDOMException(value);
   }
   return (CSSPrimitiveValue) v;
 }
 public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException {
   switch (lu.getLexicalUnitType()) {
     case LexicalUnit.SAC_IDENT:
       String s = lu.getStringValue().toLowerCase().intern();
       Object v = values.get(s);
       if (v == null) {
         throw createInvalidIdentifierDOMException(lu.getStringValue());
       }
       return (Value) v;
   }
   return super.createValue(lu, engine);
 }