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);
 }
Beispiel #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);
 }
Beispiel #4
0
 static {
   values.put(CSSConstants.CSS_LARGE_VALUE, CSSValueConstants.LARGE_VALUE);
   values.put(CSSConstants.CSS_LARGER_VALUE, CSSValueConstants.LARGER_VALUE);
   values.put(CSSConstants.CSS_MEDIUM_VALUE, CSSValueConstants.MEDIUM_VALUE);
   values.put(CSSConstants.CSS_SMALL_VALUE, CSSValueConstants.SMALL_VALUE);
   values.put(CSSConstants.CSS_SMALLER_VALUE, CSSValueConstants.SMALLER_VALUE);
   values.put(CSSConstants.CSS_X_LARGE_VALUE, CSSValueConstants.X_LARGE_VALUE);
   values.put(CSSConstants.CSS_X_SMALL_VALUE, CSSValueConstants.X_SMALL_VALUE);
   values.put(CSSConstants.CSS_XX_LARGE_VALUE, CSSValueConstants.XX_LARGE_VALUE);
   values.put(CSSConstants.CSS_XX_SMALL_VALUE, CSSValueConstants.XX_SMALL_VALUE);
 }
 static {
   computedValues.put(CSSConstants.CSS_THIN_VALUE, new FloatValue(CSSPrimitiveValue.CSS_PX, 1));
   computedValues.put(CSSConstants.CSS_MEDIUM_VALUE, new FloatValue(CSSPrimitiveValue.CSS_PX, 3));
   computedValues.put(CSSConstants.CSS_THICK_VALUE, new FloatValue(CSSPrimitiveValue.CSS_PX, 5));
 }
 static {
   values.put(CSSConstants.CSS_THIN_VALUE, CSSValueConstants.THIN_VALUE);
   values.put(CSSConstants.CSS_MEDIUM_VALUE, CSSValueConstants.MEDIUM_VALUE);
   values.put(CSSConstants.CSS_THICK_VALUE, CSSValueConstants.THICK_VALUE);
 }