private CSSPrimitiveValueImpl createFloatValue(String text, String type) { FloatInfo info = new FloatInfo(text); CSSPrimitiveValueImpl value = getCSSPrimitiveValue(info.getValueType()); if (value != null) { value.setValue(info.getValue()); } return value; }
private CSSPrimitiveValueImpl createStringValue(String text, String type) { short valueType = getStringValueType(text, type); CSSPrimitiveValueImpl value = getCSSPrimitiveValue(valueType); if (value != null) { if (valueType == CSSPrimitiveValue.CSS_URI) { text = CSSUtil.extractUriContents(text); } else if (valueType == CSSPrimitiveValue.CSS_STRING) { text = CSSUtil.extractStringContents(text); } value.setValue(text); } return value; }
private CSSPrimitiveValueImpl createLocalValue(ITextRegionList regions) { String funcName = getFunctionName(regions); if (funcName == null || !funcName.toLowerCase().equals("local")) { // $NON-NLS-1$ return null; } String accepts[] = {CSSRegionContexts.CSS_DECLARATION_VALUE_STRING}; ITextRegionList valueRegions = getFunctionParameters(regions, accepts); if (valueRegions.size() != 1) { return null; } CSSPrimitiveValueImpl value = getCSSPrimitiveValue(ICSSPrimitiveValue.CSS_LOCAL); if (value == null) { return null; } ITextRegion region = valueRegions.get(0); value.setValue(CSSUtil.extractStringContents(getText(region))); return value; }
private CSSPrimitiveValueImpl createAttrValue(ITextRegionList regions) { String funcName = getFunctionName(regions); if (funcName == null || !funcName.toLowerCase().equals("attr")) { // $NON-NLS-1$ return null; } String accepts[] = {CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT}; ITextRegionList valueRegions = getFunctionParameters(regions, accepts); if (valueRegions.size() != 1) { return null; } CSSPrimitiveValueImpl value = getCSSPrimitiveValue(CSSPrimitiveValue.CSS_ATTR); if (value == null) { return null; } ITextRegion region = valueRegions.get(0); value.setValue(getText(region)); return value; }